Triggers on:
✓ Push to main or feat/* branches with changes to migrations/
✓ Pull requests that modify migrations/
✓ Manual workflow_dispatch trigger
Workflow:
1. test-migrations job:
- Runs on every PR + push (changes or manual)
- Detects changed migration files
- Tests all migrations on clean test database
- Verifies schema (table counts, agent tables, indices)
- Required to pass before merge
2. apply-migrations job:
- Runs only on push to main (after test-migrations passes)
- Applies changed migrations to production database
- Verifies production schema after apply
- Only if tests passed
3. gate-on-migrations job:
- Blocks PR merge if migration tests fail
- Prevents bad migrations from being committed
Prevents:
✗ Invalid SQL from being merged
✗ Schema breaking changes without review
✗ Migrations applied to production without test pass
Migration paths updated:
- Old: crates/mem-store/migrations/
- New: migrations/ (root level, matches our structure)