database-migrations

Plan and execute reversible database migrations across PostgreSQL, MySQL, and ORMs.

Updated May 27, 2025
One-click install
npx skills add https://github.com/vinwang/tools --skill database-migrations-vinwang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-migrations
Source: https://github.com/vinwang/tools/tree/main/iflow/skills/database-migrations
Command: npx skills add https://github.com/vinwang/tools --skill database-migrations-vinwang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Database migrations are error-prone in production. This Skill provides a structured, safety-first approach to planning, implementing, and validating schema changes and data migrations with rollback capabilities and kill-switch precautions.

Core Features & Use Cases

  • Migration safety: enforce UP/DOWN migrations, separate schema and data migrations, and tested rollback plans.
  • Zero-downtime workflows: support expand-contract patterns for non-disruptive deployments.
  • Cross-engine guidance: covers PostgreSQL, MySQL, and popular ORMs (Prisma, Drizzle, Django, TypeORM, golang-migrate).

Quick Start

Create a migration that adds or updates a schema, backfill data in a separate step, and deploy with a rollback plan.

Frequently Asked Questions about database-migrations

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

FAQPage Schema
How do I execute zero-downtime database migrations in production?

Zero-downtime database migrations use the expand-contract pattern to separate schema changes from data backfilling, ensuring non-disruptive deployments. This approach requires independent schema and data migration steps with tested rollback plans.

How do I write reversible PostgreSQL migrations with a rollback plan?

Reversible PostgreSQL migrations require dual UP and DOWN scripts for every change, explicitly marking any irreversible operations. You must separate schema changes from data migrations and validate rollback procedures in a test environment before production deployment.

Does this database migration approach work with Prisma and TypeORM ORMs?

Yes, this database migration approach provides cross-engine guidance for popular ORMs including Prisma, TypeORM, Drizzle, Django, and golang-migrate. It applies structured safety-first workflows to schema changes across PostgreSQL and MySQL environments.

What is the best way to backfill data during a schema change without downtime?

The best way to backfill data without downtime is separating data migrations from schema migrations and using the expand-contract workflow. This structured method allows safe data backfilling in independent steps while maintaining application availability.

When should I separate schema migrations from data migrations?

You should always separate schema migrations from data migrations in production environments to maintain safety and enable precise rollback plans. This separation allows independent validation and deployment of structural changes versus data backfilling operations.

Why do database migrations fail during production deployments and how to prevent it?

Database migrations fail during production deployments due to untested rollback plans and disruptive schema changes. Prevent failures by enforcing dual UP/DOWN migrations, applying zero-downtime expand-contract patterns, and implementing kill-switch precautions.