Files
SGC 6c6b49b45c fix: add cross-file Ref declarations for relspecgo merge
- Add explicit Ref: blocks at bottom of each DBML file for cross-file FK relationships
- files.dbml: stored_files → thoughts, projects
- skills.dbml: project_skills/project_guardrails → projects
- meta.dbml: chat_histories → projects
- Update Makefile to use the relspec merge workflow where applicable
- Regenerate 020_generated_schema.sql with proper cross-file constraints

Addresses review comment on PR #20
2026-04-04 15:13:50 +02:00
..

Schema workflow

The schema/*.dbml files are the database schema source of truth.

Generate SQL migrations

Run:

make generate-migrations

This uses relspec to convert the DBML files into PostgreSQL SQL and writes the generated schema migration to:

  • migrations/020_generated_schema.sql

Check schema drift

Run:

make check-schema-drift

This regenerates the SQL from schema/*.dbml and compares it with migrations/020_generated_schema.sql. If the generated output differs, the command fails so CI can catch schema drift.

Workflow

  1. Update the DBML files in schema/
  2. Run make generate-migrations
  3. Review the generated SQL
  4. Commit both the DBML changes and the generated migration

Existing handwritten migrations stay in place. Going forward, update the DBML first and regenerate the SQL from there.