migrations/0001_init.sql creates the 25 tables of the CTXD CONTEXT.MD data
model with foreign keys (default NO ACTION, so a parent with children cannot
be deleted; ai_run_id references are ON DELETE SET NULL for the 30-day
ai_runs purge), a CHECK on every enum and boolean column, and the unique
constraints the model names. Single-row settings tables are pinned to id 1.
internal/store/schema_test.go migrates a temp database with the embedded
migrations and asserts every table exists, every enum CHECK rejects an
invalid value, every named unique constraint rejects a duplicate, and
deleting a parent with children is refused.
TestMigrateEmbeddedMigrations now expects 0000_bootstrap,0001_init, and the
upgrade test migrates a bootstrap-only database to the real embedded set.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>