This file is byte-identical to the first copy the registry indexed, one of 8 indexed copies. Same content hash, so the same checks give both the same grade.
db-migration from globalmpc/backendskills is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.
Rules for database schema changes. Use for any new table, column, index, constraint, enum or trigger, any data backfill, and any migration file.
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# Schema change
Examples are Postgres. Assume the table is large and the app is live: deploys are rolling, so the previous
version of the app keeps running against the new schema for a few minutes.
## 1. Expand, then contract: never rename or drop in the same deploy
Why: the version still running during the deploy queries the old name and fails until the deploy finishes.
```sql
-- Bad: the running version breaks the moment this migration lands
alter table customers rename column name to full_name;
-- Good, deploy 1: add the new column and fill it. Keep it in sync until every server runs the new code
-- (write both in the app, or use a trigger).
alter table customers add column full_name text;
update customers set full_name = name where full_name is null; -- batch it on big tables (rule 4)
-- Deploy 2, once nothing reads the old column: drop name.
```
The same applies to dropping a table or column, and to narrowing a type. Adding is safe. Removing waits
for a later deploy.
## 2. Indexes on big tables are built concurrently
Why: a plain `create index` blocks every write to the table until it finishes, which can take minutes.
```sql
-- Bad
…
The line at the top of this page pins the label git:20261105.6131a31, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
GET https://markdownregistry.com/api/v1/artifacts/art_hd6mzk7zmzzfg4ah
GET https://markdownregistry.com/api/v1/resolve?ref=globalmpc/backendskills/db-migration
GET https://markdownregistry.com/api/v1/blob/2a1e42884f6534788822c2ceff9275641b85a4003e235f69e86fd07649eff7e9
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104164959-6498/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104164959-6498/skills/data-integrity/SKILL.md · Rules for code that writes to the database where two requests, retries or jobs can run at once. Use for anything that…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104164959-6498/skills/db-migration/SKILL.md · Rules for database schema changes. Use for any new table, column, index, constraint, enum or trigger, any data…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104173809-28998/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104173809-28998/skills/data-integrity/SKILL.md · Rules for code that writes to the database where two requests, retries or jobs can run at once. Use for anything that…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104173809-28998/skills/db-migration/SKILL.md · Rules for database schema changes. Use for any new table, column, index, constraint, enum or trigger, any data…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261105081443-28376/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261105081443-28376/skills/data-integrity/SKILL.md · Rules for code that writes to the database where two requests, retries or jobs can run at once. Use for anything that…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-2-20261104164959-23336/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-2-20261104164959-23336/skills/data-integrity/SKILL.md · Rules for code that writes to the database where two requests, retries or jobs can run at once. Use for anything that…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-2-20261104164959-23336/skills/db-migration/SKILL.md · Rules for database schema changes. Use for any new table, column, index, constraint, enum or trigger, any data…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-2-20261104173809-13068/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
a-pavithraa/springboot-skills-marketplace · plugins/springboot-architecture/skills/spring-boot-team-harness/assets/project-skills/db-migration/SKILL.md · Writes a Flyway database migration for this project following the team's rules for naming, editing and renaming, so…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-3-20261104164959-7407/skills/db-migration/SKILL.md · Rules for database schema changes. Use for any new table, column, index, constraint, enum or trigger, any data…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-3-20261104173809-29907/skills/db-migration/SKILL.md · Rules for database schema changes. Use for any new table, column, index, constraint, enum or trigger, any data…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104173809-28998/skills/db-migration/SKILL.md · Rules for database schema changes. Use for any new table, column, index, constraint, enum or trigger, any data…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104164959-6498/skills/db-migration/SKILL.md · Rules for database schema changes. Use for any new table, column, index, constraint, enum or trigger, any data…