new-migrationlisted
Install: claude install-skill rajurayhan/ai-agent-framework
# New Migration
Migrations are the **only** source of schema truth — never hand-edit tables in the database dashboard.
## Steps
1. **Check requirements doc** for the entity you're adding/changing.
2. **Decide if entity needs history, not overwrite** — effective-dated versioning for config that affects historical records.
3. **Decide if entity needs soft delete** — financial/audit-relevant entities get status or deleted_at; no CASCADE deletes.
4. **Money columns**: pair every amount with currency; store FX at transaction time where applicable.
5. **Snapshot tables**: materialize computed values at write time — not views over live config.
6. **Append-only tables** (audit logs): no update/delete migrations.
7. Write forward-only migration file. Run against **direct** connection, not pooler.
8. Consider running `migration-architect` agent to review before applying.
## Conventions
- Forward-only migrations
- Indexes on FK and common filter columns
- No breaking change without expand-and-contract plan
## After migration
Apply locally and run integration tests if schema affects them.
See `.claude/skills/db-runtime-client/SKILL.md` for pooler vs direct connection.
Full worked example: If Cursor initialized, see `.cursor/skills/database-migration/SKILL.md`