database-migrations

Guide safe, reversible database migrations across SQL databases and ORMs.

1|1|Updated Feb 21, 2026
One-click install
npx skills add https://github.com/VenTheZone/favorite-opencode-setup --skill database-migrations-venthezone
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-migrations
Source: https://github.com/VenTheZone/favorite-opencode-setup/tree/main/skills/database-migrations
Command: npx skills add https://github.com/VenTheZone/favorite-opencode-setup --skill database-migrations-venthezone

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to performing safe, reversible database schema and data migrations, preventing downtime and data loss in production environments.

Core Features & Use Cases

  • Best Practices: Enforces core principles for safe migrations, including immutability and separation of schema/data changes.
  • Tooling Guidance: Offers specific patterns and workflows for popular tools like Prisma, Drizzle, Django, and golang-migrate.
  • Zero-Downtime Strategies: Details the expand-contract pattern for critical production changes.
  • Use Case: Safely add a new, non-nullable column to a large users table in PostgreSQL without locking the table or causing application errors.

Quick Start

Use the database-migrations skill to generate a new SQL migration file for adding an index to the users table.

Frequently Asked Questions about database-migrations

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

FAQPage Schema
How do I perform zero-downtime database migrations in PostgreSQL?

Zero-downtime database migrations in PostgreSQL use the expand-contract pattern to separate schema and data changes, preventing table locks. This approach ensures applications remain operational by deploying backward-compatible schema updates incrementally before removing deprecated structures.

What is the best way to add a non-nullable column to a large table without locking?

Adding a non-nullable column to a large table requires a multi-step migration strategy to avoid locking. You must first deploy the column as nullable, backfill existing rows, and enforce constraints at the application layer before finally applying the non-null database constraint.

Does this database migration guide work with Drizzle and Prisma?

Yes, this guide provides specific schema migration workflows and patterns for Drizzle and Prisma. It covers safe deployment strategies tailored to these ORMs, ensuring reversible schema changes and preventing inline indexing anti-patterns on large production tables.

How do I rollback a schema change if a production migration fails?

Rolling back a failed production migration requires immutability and prior rollback planning during the initial schema change design. The guide details creating reversible migration steps for tools like Django and golang-migrate to safely restore previous database states without data loss.

Why should I avoid inline indexing on large tables during schema migrations?

Inline indexing on large tables during schema migrations causes severe table locking and application downtime. The guide identifies this as a critical anti-pattern, recommending explicit, concurrent index creation strategies instead to maintain database availability.