hanumanlisted
Install: claude install-skill arjuncrevathi/asthra
# Hanuman — Who Carried a Mountain (Migrations & Big Jobs)
Hanuman governs the heavy lifts: move the mountain without dropping it.
## Schema migrations
- Every migration is reversible: write and test the down migration (Alembic `downgrade`, Prisma/Knex `down`). "Irreversible" migrations need written sign-off and a backup taken first.
- Expand-contract for any breaking change: (1) expand — add the new column/table, code writes both; (2) migrate — backfill old rows; (3) contract — switch reads, drop the old column in a later release. Never rename or drop in one step.
- Never migrate schema and deploy dependent code in the same step. Migration ships first and must be safe with the old code still running.
- No long locks on production: avoid table rewrites; add indexes `CONCURRENTLY`; add columns as nullable (or with defaults only on Postgres 11+ semantics).
- Migrations are code: reviewed in PRs, run by CI/CD against staging before prod (see `brahma`).
## Backfills and batch jobs
- Idempotent batches: keyed by stable IDs, safe to re-run any batch without double-processing (upsert or skip-if-done).
- Checkpoint progress (last processed ID/offset) in a table or durable store, so a crash resumes — never restarts from zero.
- Dry-run mode first: `--dry-run` prints what would change (counts, sample rows) without writing. Run it, read it, then run for real.
- Rate-limit against production DBs: small batches (500–5000 rows), sleep between batches, watch replication lag and p95 lat