migration-helper
Skill: Migration Helper
Safe database and code migrations with zero-downtime strategies.
Safety Rules
- Always backup before migration
- Test on staging first
- Make migrations reversible
- Deploy in small batches
- Monitor during migration
Related Rules
rules/core/simplicity-over-complexity.md— smallest migration that closes the gap; no "while we're here" schema expansionsrules/core/verification.md— verify each migration step before advancingrules/workflow/immutable-workflow.md— migrations are append-only recordsrules/workflow/dual-llm-review.md— destructive migrations (DROP COLUMN/TABLE) trigger dual-LLM review
Schema Changes
| Change | Safe Approach |
|---|---|
| Add column | Add nullable → backfill → NOT NULL |
| Remove column | Stop using → deploy → drop |
| Rename column | Add new → copy → deploy → drop old |
| Add index | CREATE INDEX CONCURRENTLY |
| Change type | Add new col → migrate → drop old |
Zero-Downtime (6 phases)
Add nullable → dual-write → backfill → switch reads → remove old writes → drop old column.
Migration Script Pattern
export async function up(db: Database) {
await db.query(`ALTER TABLE users ADD COLUMN status VARCHAR(20) DEFAULT 'active'`);
// Backfill in batches of 1000
// Add NOT NULL constraint
}
export async function down(db: Database) {
await db.query(`ALTER TABLE users DROP COLUMN status`);
}
Code Migration
- Feature flags: Behind flag → gradually increase % → remove flag + old code
- Strangler Fig: New impl alongside old → route traffic gradually → remove old
Checklist
Before: Backup, tested on staging, rollback plan, monitoring alerts. During: Batch processing, monitor performance, verify integrity. After: Validation queries, smoke tests, monitor 24-48h, document.
Rollback Strategies
| Strategy | When |
|---|---|
| Script rollback | Reversible data changes |
| Backup restore | Major failure |
| Feature flag off | Code changes |
| Traffic reroute | Service migration |
More from nguyenthienthanh/aura-frog
stitch-design
Generate UI designs using Google Stitch AI with optimized prompts
37angular-expert
Angular 17+ gotchas and decision criteria. Covers signals vs observables, standalone patterns, and common pitfalls Claude gets wrong.
31flutter-expert
Flutter/Dart mobile expert. PROACTIVELY use when working with Flutter, Dart, mobile apps. Triggers: flutter, dart, widget, bloc, riverpod
16dev-expert
Development patterns for React, Vue, Laravel, Next.js, React Native - state management, forms, API integration
13react-native-expert
React Native best practices expert. PROACTIVELY use when working with React Native, mobile apps, Expo. Triggers: react-native, expo, mobile, iOS, Android, NativeWind
13visual-pixel-perfect
Pixel-perfect visual testing with auto-fix loop. Implement → Render → Snapshot → Compare → Fix until pass.
13