feat(db): .kc metadata database migration #140
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add database migration for all .kc server-side metadata tables as specified in KC_SERVER.md Section 3.
Tables to create:
item_metadata(Section 3.1)Indexes
silo/manifest.jsonandsilo/metadata.jsonfrom .kc files. Primary key onitem_id. Stores schema_name, tags (TEXT[]), lifecycle_state, fields (JSONB), kc_version, manifest_uuid, silo_instance, revision_hash.Indexes: GIN on tags, B-tree on lifecycle_state, GIN on fields.
item_dependencies(Section 3.2)Indexes
silo/dependencies.json-- CAD-extracted assembly relationships. Columns: parent_item_id, child_uuid, child_part_number, child_revision, quantity, label, relationship, revision_number.Complements (does not replace) the existing
relationshipstable. This is the CAD-authoritative record;relationshipsis the server-authoritative BOM.item_approvals+approval_signatures(Section 3.3)ECO workflow tables.
item_approvals: item_id, eco_number, state, updated_at, updated_by.approval_signatures: approval_id FK, username, role, status, signed_at, comment.item_macros(Section 3.4)Registers macros from
silo/macros/. Columns: item_id, filename, trigger, content, revision_number. UNIQUE(item_id, filename).Notes:
migrations/018_kc_metadata.sql