
Database Migration
Author and sequence Sequelize-style migrations—including zero-downtime and cross-dialect patterns—so you can change production schema without breaking live traffic.
Overview
Database Migration is an agent skill most often used in Build (also Ship, Operate) that supplies zero-downtime and cross-dialect Sequelize migration templates for solo builders changing live schemas.
Install
npx skills add https://github.com/wshobson/agents --skill database-migrationWhat is this skill?
- Five-phase blue-green migration flow: compatible column add, dual-write deploy, backfill, cutover read path, drop legacy
- Backward-compatible migration steps so old and new app code can run during rollout
- Cross-database patterns (e.g. PostgreSQL vs MySQL) with dialect branching in Sequelize migrations
- Executable migration module examples for addColumn, raw SQL backfill, and removeColumn
- Five-phase blue-green migration sequence (add, dual-write deploy, backfill, read cutover, remove old column)
- Cross-dialect branching example for PostgreSQL and MySQL in one migration file
Adoption & trust: 12.5k installs on skills.sh; 36.5k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need to change production tables but a single big migration would force downtime or break code still reading old columns.
Who is it for?
Indie SaaS or API owners shipping schema changes on Sequelize with PostgreSQL or MySQL and no full-time DBA.
Skip if: Greenfield projects with empty databases where destructive one-shot migrations are acceptable, or teams standardized on Prisma/Flyway-only workflows without Sequelize.
When should I use this skill?
Planning Sequelize (or similar) migrations for production schema changes, zero-downtime rollouts, or cross-database porting.
What do I get? / Deliverables
You get a phased migration playbook—compatible adds, backfills, dual-write/cutover steps, and safe drops—ready to paste into migration files before deploy.
- Phased migration file snippets
- Backfill SQL steps
- Dialect-specific createTable patterns
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Schema migration files and dialect-specific DDL are created during product build; this skill’s canonical shelf is backend data modeling before deploy. Backend is where migration up/down scripts, column adds, and backfills belong in the solo-builder journey—not launch copy or monitoring dashboards.
Where it fits
Draft addColumn and backfill migrations before merging a feature that renames user email fields.
Split deploy into code that dual-writes old and new columns, then a follow-up release that reads only the new column.
Run the final removeColumn migration after metrics show no reads against the legacy column.
How it compares
Skill templates for ordered DDL rollout—not a hosted migration runner or live database MCP.
Common Questions / FAQ
Who is database-migration for?
Solo and indie builders who write backend migrations themselves and need zero-downtime sequencing for a live app on Sequelize-compatible stacks.
When should I use database-migration?
During Build when authoring migrations; during Ship when planning a blue-green column rollout; during Operate when backfilling or retiring legacy columns after traffic has cut over.
Is database-migration safe to install?
Treat it as executable guidance for production data—review the Security Audits panel on this Prism page and never run generated SQL against production without backups and a rollback plan.
SKILL.md
READMESKILL.md - Database Migration
# database-migration — additional patterns and templates ## Zero-Downtime Migrations ### Blue-Green Deployment Strategy ```javascript // Phase 1: Make changes backward compatible module.exports = { up: async (queryInterface, Sequelize) => { // Add new column (both old and new code can work) await queryInterface.addColumn("users", "email_new", { type: Sequelize.STRING, }); }, }; // Phase 2: Deploy code that writes to both columns // Phase 3: Backfill data module.exports = { up: async (queryInterface) => { await queryInterface.sequelize.query(` UPDATE users SET email_new = email WHERE email_new IS NULL `); }, }; // Phase 4: Deploy code that reads from new column // Phase 5: Remove old column module.exports = { up: async (queryInterface) => { await queryInterface.removeColumn("users", "email"); }, }; ``` ## Cross-Database Migrations ### PostgreSQL to MySQL ```javascript // Handle differences module.exports = { up: async (queryInterface, Sequelize) => { const dialectName = queryInterface.sequelize.getDialect(); if (dialectName === "mysql") { await queryInterface.createTable("users", { id: { type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true, }, data: { type: Sequelize.JSON, // MySQL JSON type }, }); } else if (dialectName === "postgres") { await queryInterface.createTable("users", { id: { type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true, }, data: { type: Sequelize.JSONB, // PostgreSQL JSONB type }, }); } }, }; ``` --- name: database-migration description: Execute database migrations across ORMs and platforms with zero-downtime strategies, data transformation, and rollback procedures. Use when migrating databases, changing schemas, performing data transformations, or implementing zero-downtime deployment strategies. --- # Database Migration Master database schema and data migrations across ORMs (Sequelize, TypeORM, Prisma), including rollback strategies and zero-downtime deployments. ## When to Use This Skill - Migrating between different ORMs - Performing schema transformations - Moving data between databases - Implementing rollback procedures - Zero-downtime deployments - Database version upgrades - Data model refactoring ## ORM Migrations ### Sequelize Migrations ```javascript // migrations/20231201-create-users.js module.exports = { up: async (queryInterface, Sequelize) => { await queryInterface.createTable("users", { id: { type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true, }, email: { type: Sequelize.STRING, unique: true, allowNull: false, }, createdAt: Sequelize.DATE, updatedAt: Sequelize.DATE, }); }, down: async (queryInterface, Sequelize) => { await queryInterface.dropTable("users"); }, }; // Run: npx sequelize-cli db:migrate // Rollback: npx sequelize-cli db:migrate:undo ``` ### TypeORM Migrations ```typescript // migrations/1701234567-CreateUsers.ts import { MigrationInterface, QueryRunner, Table } from "typeorm"; export class CreateUsers1701234567 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise<void> { await queryRunner.createTable( new Table({ name: "users", columns: [ { name: "id", type: "int", isPrimary: true, isGenerated: true, generationStrategy: "increment", }, { name: "email", type: "varchar", isUnique: true, }, { name: "created_at", type: "timestamp", default: "CURRENT_TIMESTAMP", }, ], }), ); } public async down(queryRunner: QueryR