
Database Migration
Shows you how to change database schemas in production without breaking things or taking downtime. Covers the expand-contract pattern (add new column, backfill data, make required, drop old column), safe ways to add indexes with CONCURRENTLY, and how to handle renaming columns or changing types across multiple deploys. Includes decision trees for picking migration strategies and troubleshooting guides for when migrations fail halfway through. Works with Alembic, Knex, Rails migrations, and other common tools. The multi-phase approach feels slow when you're used to just altering tables, but it's how you avoid 3am rollbacks.
- skills.sh installs
- 427
- GitHub stars
- 79
- last updated
- Aug 21, 2026
Install
$ npx -y skills add bobmatnyc/claude-mpm-skills --skill database-migration --agent claude-codeInstalls into .claude/skills of the current project.
Files
Database Migration
Safe patterns for evolving database schemas in production.
Migration Principles
- Backward compatible - New code works with old schema
- Reversible - Can rollback if needed
- Tested - Verify on staging before production
- Incremental - Small changes, not big-bang
- Zero downtime - No service interruption
Safe Migration Pattern
Phase 1: Add New (Compatible)
-- Add new column (nullable initially)
ALTER TABLE users ADD COLUMN full_name VARCHAR(255) NULL;
-- Deploy new code that writes to both old and new
UPDATE users SET full_name = CONCAT(first_name, ' ', last_name);
Phase 2: Migrate Data
-- Backfill existing data
UPDATE users
SET full_name = CONCAT(first_name, ' ', last_name)
WHERE full_name IS NULL;
Phase 3: Make Required
-- Make column required
ALTER TABLE users ALTER COLUMN full_name SET NOT NULL;
Phase 4: Remove Old (After New Code Deployed)
-- Remove old columns
ALTER TABLE users DROP COLUMN first_name;
ALTER TABLE users DROP COLUMN last_name;
Common Migrations
Sponsors
Promote your product hereReach 125k+ visitors monthlyPromote your product hereReach 125k+ visitors monthly
Agent CaffeineSponsoredClose your lid, come back to finished work
SnugSponsoredThe clipboard manager for the AI eraPromote your product hereReach 125k+ visitors monthly
WaxSponsoredBlock anything with supervision, without erasing your iPhonePromote your product hereReach 125k+ visitors monthly
knobsSponsoredSee your site on any phone, any day, in any language
Details
- Repository
- github.com/bobmatnyc/claude-mpm-skills
- Categories
- Backend & APIs, Debugging, Productivity & Planning, Databases
- First seen
- Jun 3, 2026
More from bobmatnyc/claude-mpm-skills
All 158- Hono Testing422
- Golang Observability Opentelemetry421
- Shadcn Ui421
- Golang Concurrency Patterns420
- Digitalocean Overview419
- Hono Validation419
- Digitalocean Networking415
- Digitalocean Storage414
- Golang Database Patterns414
- Openrouter413
- Digitalocean Managed Databases404
- Verification Before Completion401
- Test Driven Development400
- Better Auth Authentication398
- Kysely398
- Kubernetes397
- Json Data Handling394
- Systematic Debugging391
- Vue390
- Api Documentation389
- Screenshot389
- Software Patterns382
- Nextjs V16380
- Vercel Deployments Builds378
Recommended
More Backend & APIs2
auth-implementation-patternssickn33/antigravity-awesome-skillsauth implementation patterns418skills.sh installs
3
openalex-databasedavila7/claude-code-templatesQuery and analyze scholarly literature using the OpenAlex database. This skill should be used when searching for academic papers, analyzing research trends, fin416skills.sh installs
4
api-changelog-versioningsecondsky/claude-skillsCreates comprehensive API changelogs documenting breaking changes, deprecations, and migration strategies for API consumers. Use when managing API versions, com415skills.sh installs
5
api-versioning-strategysecondsky/claude-skillsImplements API versioning using URL paths, headers, or query parameters with backward compatibility and deprecation strategies. Use when managing multiple API v410skills.sh installs
6
api-docs-generatorpatricio0312rev/skillsGenerates API documentation using OpenAPI/Swagger specifications with interactive documentation, code examples, and SDK generation. Use when users request "API 407skills.sh installs