Backend Migrations

Automates database migrations with schema versioning and zero-downtime deployment planning.

6|1|Updated Nov 12, 2022
One-click install
npx skills add https://github.com/coreyja/coreyja.com --skill backend-migrations-coreyja
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Backend Migrations
Source: https://github.com/coreyja/coreyja.com/tree/main/.claude/skills/backend-migrations
Command: npx skills add https://github.com/coreyja/coreyja.com --skill backend-migrations-coreyja

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill ensures database changes are handled safely, consistently, and with proper rollback mechanisms, preventing data loss and downtime. It guides the AI in adhering to best practices for database schema evolution.

Core Features & Use Cases

  • Safe Schema Evolution: Guides the creation of new migration files, modification of table schemas, and management of database version control.
  • Zero-Downtime Deployments: Focuses on implementing backwards-compatible changes for production environments.
  • Use Case: Automatically generate a migration script to add a new email column to the users table, ensuring it's nullable initially for zero-downtime deployment and includes a proper rollback method.

Quick Start

Use the Backend Migrations skill to create a new database migration that adds a 'status' column to the 'orders' table, ensuring it has a default value and a rollback method.

Frequently Asked Questions about Backend Migrations

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

FAQPage Schema
How do I create database migrations safely with rollback support?

Database migrations automate schema changes with built-in rollback mechanisms. Create descriptive migration files that define both up (forward) and down (reverse) operations, enabling you to undo changes if deployment fails or issues arise.

What's the best way to add columns to a production database without downtime?

Zero-downtime deployments require backward-compatible changes: add columns as nullable first, deploy the code change separately, then backfill data and add constraints in follow-up migrations. This prevents locking tables during production updates.

How do I manage schema versioning across database migrations?

Schema versioning tracks each migration file sequentially, recording which changes have been applied to your database. Maintain consistent naming conventions and store migration state to ensure environments stay synchronized and prevent duplicate or out-of-order execution.

Can I separate schema changes from data migrations?

Yes, separating schema changes (table structure) from data migrations (populating or transforming records) improves safety and clarity. Keep structural changes in dedicated schema migration files and data operations in separate migration files for easier debugging and rollback.

What should I include in migration files for indexes and foreign keys?

Migration files should define index creation with appropriate columns and uniqueness constraints, and foreign key definitions with proper table references and cascading rules. Include corresponding rollback operations to drop indexes and constraints in the down migration.

Why do migration file names need to be descriptive?

Descriptive migration filenames document intent and sequence, making it easy to understand schema history and diagnose issues. Clear naming prevents confusion across team members and environments, reducing errors during deployment and maintenance.