Files
projax/db
mAi 1fcf6356f8 fix(db): track applied migrations in projax.schema_migrations
The destructive deltas in 0010 (drop parent_id, drop path) broke idempotent
re-runs of 0001/0002 on every boot — those expect the legacy columns to
exist. Stop relying on every migration being safe-to-rerun and track
applied versions in projax.schema_migrations instead.

ApplyMigrations now:
- ensures projax.schema_migrations exists,
- reads the set of applied filenames,
- applies only the missing ones, in lexicographic order,
- records each apply on success.

Existing fleet was bootstrapped via MCP-as-supabase-admin (where each
0001..0010 was applied directly to the live DB before this commit
existed). To match the new runner's expectations, the tracker was
seeded with all ten names before this push (matching DB state).

migrate_test.go: TestMigrationsAreIdempotent now asserts on parent_ids
shape instead of the old parent_id column.

This is the production-down fix — the previous deploy was crashlooping
on 'apply 0001_init.sql: ERROR: column "path" does not exist'.
2026-05-15 16:36:43 +02:00
..