← ClaudeAtlas

database-migrationlisted

Writes schema changes and forward-only database migrations. Use proactively when creating tables, altering schema, or adding indexes.
rajurayhan/ai-agent-framework · ★ 0 · API & Backend · score 73
Install: claude install-skill rajurayhan/ai-agent-framework
# Database Migration ## Workflow 1. Edit schema in your schema directory 2. Generate migration via project tooling 3. Review generated SQL 4. Apply locally 5. Update data-access layer and types ## Conventions - **Soft deletes** on financial/audit tables — status or deleted_at, no CASCADE on money FKs - **Effective-dated history** — never overwrite history rows - **Snapshot storage** — materialize at write time for immutable records - **Money columns** — always pair amount + currency; FX rate at transaction time - **Append-only** audit tables — no update/delete migrations - Forward-only migrations; direct connection for apply, not pooler (see `db-runtime-client.mdc`) ## Checklist ``` - [ ] Matches requirements entity list - [ ] Soft delete where required - [ ] Indexes on FK and filter columns - [ ] Currency on money fields - [ ] No breaking change without expand-and-contract ``` ## After migration Run migrations locally and integration tests if schema affects them. ## Do NOT - Hand-edit tables in database dashboard - Use direct DB connection in runtime app code ## References - `.cursor/rules/migrations.mdc` - `.cursor/rules/db-runtime-client.mdc` - `docs/SRS.md` or `docs/REQUIREMENTS.md` §5 entity list - Claude equivalent: `new-migration` skill; review with `@migration-architect` --- ## Worked Example: Add Overtime Tracking ### Schema ```typescript export const attendanceRecords = pgTable('attendance_records', { overtime_hours: decimal('overtime_hours').notNu