← ClaudeAtlas

migration-safetylisted

Static scan of migration files for online-safety violations — blocking `CREATE INDEX` without `CONCURRENTLY`, `NOT NULL` added with no safe backfill, destructive drops of columns the running code still reads, and table-rewriting DDL. Run on any diff that adds or edits a migration, and before a deploy that ships a schema change. Not the timed rehearsal against prod-sized data — that is `migration-rehearsal` in the database pack.
adnanmokhtar/refract · ★ 1 · API & Backend · score 80
Install: claude install-skill adnanmokhtar/refract
# Skill: migration-safety ## Premise A schema migration runs against a live database under concurrent traffic. The failure is invisible in review and catastrophic in prod: a migration that takes an `ACCESS EXCLUSIVE` lock, rewrites a big table, or drops a column the running code still reads → an outage during deploy. The `migration-backend` rule and `add-endpoint`/`add-module` *promise* "online-safe, reversible" migrations; this skill is the verifier that enforces the promise. **Every finding cites the migration file at `<file:line>` + the unsafe statement + the safe rewrite.** "This migration looks risky" without the cited statement is not a finding. This is a static scan of the migration files in the diff (or a target dir). ## Adapt to the codebase Detect the migration tool + the target engine and phrase findings in its idiom — lock behaviour differs by engine and version: | Tool | Migration files | Online-DDL escape hatch | |---|---|---| | **Rails (ActiveRecord)** | `db/migrate/*.rb` | `disable_ddl_transaction!` + `algorithm: :concurrently`; `strong_migrations` gem | | **Django** | `<app>/migrations/*.py` | `AddIndexConcurrently` / `SeparateDatabaseAndState`; `atomic = False` | | **Prisma / TypeORM / Knex** | `migrations/*.sql|.ts` | raw `CREATE INDEX CONCURRENTLY`; split expand/contract | | **Alembic** | `alembic/versions/*.py` | `op.create_index(..., postgresql_concurrently=True)` + non-transactional | | **Flyway / Liquibase** | `db/migration/V*__*.sql` | `CREATE I