feat(db): add source column to relationships table #50

Merged
forbes merged 2 commits from issue-44-bom-source into main 2026-02-09 01:21:30 +00:00
Owner

Closes #44

Promotes BOM source from metadata JSONB to a dedicated VARCHAR(20) column with CHECK constraint ('manual' or 'assembly').

Changes

  • Migration 012_bom_source.sql: adds column with default, migrates existing metadata values, cleans up metadata
  • Go structs: Source field on Relationship and BOMEntry
  • SQL queries: GetBOM, GetWhereUsed, GetExpandedBOM, Create all include source
  • API types: BOMEntryResponse.source, AddBOMEntryRequest.source
  • CSV export/import: reads/writes e.Source instead of getMetaString(e.Metadata, "source")
  • ODS export: same change in both HandleExportBOMODS and HandleProjectSheetODS
  • Frontend: BOMEntry.source type, BOMTab reads/writes source as top-level field
Closes #44 Promotes BOM source from metadata JSONB to a dedicated `VARCHAR(20)` column with CHECK constraint (`'manual'` or `'assembly'`). ### Changes - **Migration 012_bom_source.sql**: adds column with default, migrates existing metadata values, cleans up metadata - **Go structs**: `Source` field on `Relationship` and `BOMEntry` - **SQL queries**: `GetBOM`, `GetWhereUsed`, `GetExpandedBOM`, `Create` all include `source` - **API types**: `BOMEntryResponse.source`, `AddBOMEntryRequest.source` - **CSV export/import**: reads/writes `e.Source` instead of `getMetaString(e.Metadata, "source")` - **ODS export**: same change in both `HandleExportBOMODS` and `HandleProjectSheetODS` - **Frontend**: `BOMEntry.source` type, `BOMTab` reads/writes source as top-level field
forbes added 1 commit 2026-02-09 00:45:54 +00:00
Promote BOM source from metadata JSONB to a dedicated VARCHAR(20)
column with CHECK constraint ('manual' or 'assembly').

- Add migration 012_bom_source.sql (column, data migration, cleanup)
- Add Source field to Relationship and BOMEntry structs
- Update all SQL queries (GetBOM, GetWhereUsed, GetExpandedBOM, Create)
- Update API response/request types with source field
- Update CSV/ODS export to read e.Source instead of metadata
- Update CSV import to set source on relationship directly
- Update frontend types and BOMTab to use top-level source field
forbes added 1 commit 2026-02-09 01:21:17 +00:00
forbes merged commit aa414adc43 into main 2026-02-09 01:21:30 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/silo#50