Skip to content

fix(demo-data): add version_family_id to data_contracts/data_products seeds#474

Merged
larsgeorge-db merged 1 commit into
mainfrom
fix-demo-data-version-family-id
May 30, 2026
Merged

fix(demo-data): add version_family_id to data_contracts/data_products seeds#474
larsgeorge-db merged 1 commit into
mainfrom
fix-demo-data-version-family-id

Conversation

@larsgeorge-db
Copy link
Copy Markdown
Collaborator

Summary

Migration j1_add_version_family_id (PRD #442, commit 0ff3d77) made version_family_id NOT NULL on both data_contracts and data_products, but the demo SQL seeds in src/backend/src/data/demo_data_*.sql were never updated. Loading any vertical preset (retail, hls, auto, fsi, mfg) fails immediately:

psycopg2.errors.NotNullViolation: null value in column "version_family_id"
of relation "data_contracts" violates not-null constraint

Fix

Add version_family_id to the column list and set it to each row's own id in every INSERT INTO data_contracts / INSERT INTO data_products block. All seed rows are family roots (no parent), so version_family_id = id exactly matches the migration's recursive-CTE backfill semantics.

  • 5 files patched (demo_data_retail, _hls, _auto, _fsi, _mfg)
  • 10 INSERT blocks updated
  • 27 contract rows + 27 product rows

Verified mechanically: every patched row's trailing version_family_id literal equals its leading id literal (0 mismatches).

Test plan

  • Drop the local Postgres dev DB (or wipe the affected tables) and restart the backend; confirm startup_tasks loads demo data without NotNullViolation.
  • Verify SELECT id, version_family_id FROM data_contracts; shows version_family_id = id for all seeded rows.
  • Same check for data_products.
  • Open the UI Data Contracts / Data Products lists and confirm the seeded demo entities render and the version-family selector works.

… seeds

Migration `j1_add_version_family_id` (PRD #442) made `version_family_id`
NOT NULL on `data_contracts` and `data_products`, but the demo SQL
seeds were never updated. Loading any demo preset failed with:

  psycopg2.errors.NotNullViolation: null value in column
  "version_family_id" of relation "data_contracts" violates
  not-null constraint

All seed rows are version-family roots (no parent), so set
`version_family_id = id` on each row to match the migration's
backfill semantics.

Affects all 5 vertical presets: retail, hls, auto, fsi, mfg
(27 contract rows + 27 product rows).
@larsgeorge-db larsgeorge-db requested a review from a team as a code owner May 30, 2026 07:49
@larsgeorge-db larsgeorge-db merged commit f097714 into main May 30, 2026
6 of 7 checks passed
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.

1 participant