From supergraph
Guides safe, reversible database schema changes and data migrations with blast radius analysis, migration patterns, and safety checks for PostgreSQL, MySQL, and ORMs.
How this skill is triggered — by the user, by Claude, or both
Slash command
/supergraph:database-migrationsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Safe, reversible database schema changes for production systems.
Safe, reversible database schema changes for production systems.
Announce: "🗄️ /supergraph:database-migrations — checking blast radius and migration safety..."
mcp__code-review-graph__get_impact_radius_tool(files=[schema_files, model_files], depth=2)
mcp__code-review-graph__query_graph_tool(query_type="dependents", target=<schema_file>)
Schema changes to hub tables (e.g. users, orders) ripple through repositories, queries, services. If blast radius > 20 files → STOP and discuss with user.
Serena symbol-level impact (optional):
mcp__serena__find_referencing_symbols(symbol=<column_or_model_name>)
Finds ORM field references that graph tools see only at file level — e.g. a Prisma field rename that query_graph sees as "file touched" but Serena sees as "12 usages in service layer". Skip if Serena unavailable.
Select the appropriate pattern from the sections below (PostgreSQL, Prisma, Drizzle, etc.) based on detected project type from .supergraph-env.
Follow Migration Safety Checklist before writing SQL/ORM migration code.
After migration written:
mcp__code-review-graph__get_affected_flows_tool(files=[migration_and_related_code])
All data flows still intact? Application code updated to match schema?
✅ /supergraph:database-migrations
- Pattern: [expand-contract | add-column | add-index | data-migration | ...]
- Blast radius: N files | Hub tables: [list/none]
- Safety checklist: PASS | BLOCKED (list issues)
- Next: /supergraph:tdd → /supergraph:fix → /supergraph:verify
Before applying any migration:
Full ORM examples (PostgreSQL, Prisma, Drizzle, Kysely, Django, golang-migrate): REFERENCE.md
| Anti-Pattern | Why It Fails | Better Approach |
|---|---|---|
| Manual SQL in production | No audit trail, unrepeatable | Always use migration files |
| Editing deployed migrations | Causes drift between environments | Create new migration instead |
| NOT NULL without default | Locks table, rewrites all rows | Add nullable, backfill, then add constraint |
| Inline index on large table | Blocks writes during build | CREATE INDEX CONCURRENTLY |
| Schema + data in one migration | Hard to rollback, long transactions | Separate migrations |
| Dropping column before removing code | Application errors on missing column | Remove code first, drop column next deploy |
npx claudepluginhub datit309/supergraph --plugin supergraphProvides database migration best practices for schema changes, data migrations, rollbacks, and zero-downtime deployments across PostgreSQL, MySQL, and ORMs like Prisma, Drizzle, and Django.
Provides best practices for safe database migrations: schema changes, data backfills, rollbacks, zero-downtime deploys for PostgreSQL, MySQL, Prisma, Drizzle, Django.
Guides schema design, migration safety, and ORM analysis. Detects database engine and ORM, evaluates normalization and indexing, and validates backward compatibility.