database-migration

Implements schema and data migrations across Sequelize, TypeORM, and Prisma with rollback strategies.

Updated Aug 11, 2026
One-click install
npx skills add https://github.com/DucCuong159/Realtime-chatapp --skill database-migration-duccuong159
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-migration
Source: https://github.com/DucCuong159/Realtime-chatapp/tree/main/.agent/skills/database-migration
Command: npx skills add https://github.com/DucCuong159/Realtime-chatapp --skill database-migration-duccuong159

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Changing database schemas or moving data between databases is risky: a failed migration can corrupt data, cause downtime, or leave no way to roll back. This Skill provides tested migration patterns for Sequelize, TypeORM, and Prisma, including rollback procedures and zero-downtime deployment strategies. ## Core Features & Use Cases - ORM Migration Patterns: Ready-to-use migration templates for Sequelize, TypeORM, and Prisma covering table creation, column changes, and type conversions. - Rollback & Safety Strategies: Transaction-based migrations, checkpoint backups, and verification steps that let you recover from failed migrations. - Zero-Downtime Deployments: Multi-phase blue-green migration patterns (add column, backfill, switch reads, drop old column) for production systems. - Use Case: You need to rename a heavily used email column in production without downtime. The Skill walks you through adding a new column, dual-writing, backfilling data, switching reads, and dropping the old column across separate deploys. ## Quick Start Ask the AI to write a zero-downtime Sequelize migration that renames the users.name column to full_name with a working rollback.

Frequently Asked Questions about database-migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a database migration in Sequelize?

Create a migration file exporting up and down functions that receive queryInterface and Sequelize. Use queryInterface.createTable, addColumn, or removeColumn inside up, and reverse each operation in down. Run with npx sequelize-cli db:migrate and roll back with db:migrate:undo.

How to rename a column in production without downtime?

Use a multi-phase approach: add the new column, deploy code that writes to both columns, backfill existing rows, deploy code reading from the new column, then drop the old column. Each phase is a separate small migration that stays backward compatible.

Sequelize vs TypeORM vs Prisma for migrations?

Sequelize and TypeORM use explicit code-based migration files with up/down methods, giving full control over rollback logic. Prisma generates migrations from schema.prisma diffs via prisma migrate dev, which is simpler but offers less control over custom data transformations.

How do I roll back a failed database migration?

Wrap migration steps in a transaction so failures roll back automatically, or create a backup table before changes and restore from it on error. Every up migration should have a tested down counterpart, and migrations should be verified on staging first.

Can one migration handle both PostgreSQL and MySQL?

Yes, detect the dialect with queryInterface.sequelize.getDialect() and branch the logic, for example using JSONB columns on PostgreSQL and JSON on MySQL. This keeps a single migration file portable across database engines.

What are common database migration mistakes to avoid?

Common pitfalls include skipping rollback testing, making breaking changes without a downtime strategy, ignoring NULL handling and foreign key constraints, and migrating too much data in one step. Break changes into small, idempotent, transactional migrations.