Skip to content

Support "version row" in vocabulary table - #803

Merged
clairblacketer merged 1 commit into
developfrom
nullable_vocabulary_id
Aug 14, 2026
Merged

Support "version row" in vocabulary table#803
clairblacketer merged 1 commit into
developfrom
nullable_vocabulary_id

Conversation

@ganisimov

Copy link
Copy Markdown
Collaborator

Permit a single row with NULL vocabulary_id to store version information for the vocabulary itself.

To preserve foreign keys, replace the primary key constraint on vocabulary.vocabulary_id with a UNIQUE constraint.

Rows with NULL vocabulary_id cannot be referenced by foreign keys, since NULL in a foreign key indicates the absence of a parent row. This is not a problem because the version row is not intended to be referenced.

NULL handling in UNIQUE constraints differs across DBMS implementations: some allow only one NULL value, while others allow multiple. Since this table will contain only one NULL row, these differences do not affect the intended behavior.

Tested only on limited set of dialects:

  • Postgres
  • Spark (using Databricks)
  • Redshift

Permit a single row with NULL vocabulary_id to store version information for the vocabulary itself.

To preserve foreign keys, replace the primary key constraint on vocabulary.vocabulary_id with a UNIQUE constraint.

Rows with NULL vocabulary_id cannot be referenced by foreign keys, since NULL in a foreign key indicates the absence of a parent row. This is not a problem because the version row is not intended to be referenced.

NULL handling in UNIQUE constraints differs across DBMS implementations: some allow only one NULL value, while others allow multiple. Since this table will contain only one NULL row, these differences do not affect the intended behavior.

Tested only on limited set of dialects:
- Postgres
- Spark (using Databricks)
- Redshift
@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.25%. Comparing base (43f6573) to head (fd40a04).
⚠️ Report is 217 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #803      +/-   ##
===========================================
+ Coverage    51.51%   57.25%   +5.73%     
===========================================
  Files            8        8              
  Lines          231      262      +31     
===========================================
+ Hits           119      150      +31     
  Misses         112      112              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@clairblacketer clairblacketer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thank you @ganisimov!

@clairblacketer
clairblacketer merged commit b026a7f into develop Aug 14, 2026
4 of 8 checks passed
@clairblacketer
clairblacketer deleted the nullable_vocabulary_id branch August 14, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants