migrations

Create safe, reversible Rails database migrations with zero-downtime patterns.

Updated Mar 3, 2026
One-click install
npx skills add https://github.com/pelletencate/iron-horse --skill migrations-pelletencate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrations
Source: https://github.com/pelletencate/iron-horse/tree/main/skills/migrations
Command: npx skills add https://github.com/pelletencate/iron-horse --skill migrations-pelletencate

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Migrations can cause downtime or data integrity issues in production. This skill provides guidance and patterns to create safe, reversible Rails migrations with zero-downtime strategies and strong_migrations checks.

Core Features & Use Cases

  • Safe, reversible migrations: Use change when possible, or explicit up/down with rollback guidance, to ensure you can rollback safely.
  • Zero-downtime patterns: Concurrency-friendly indexes, two-step NOT NULL constraints, and staged data backfills to minimize locking.
  • Guidance for data migrations: Separate schema migrations from data migrations, with batching and safety checks to avoid long-running locks.
  • Use Case: When deploying to production, apply non-blocking schema changes, gracefully backfill data, and verify rollback scenarios.

Quick Start

Follow the guide to implement a safe, reversible migration in your Rails app.

Frequently Asked Questions about migrations

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

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

Zero-downtime database migrations in Rails require concurrency-friendly indexing, two-step NOT NULL constraints, and staged data backfills to minimize locking during production deploys. This approach ensures non-blocking schema changes and graceful data backfills.

What is the best way to separate schema and data migrations in Rails?

Separating schema and data migrations in Rails involves isolating structural changes from data transformations, applying batching and safety checks to the latter. This prevents long-running locks and maintains data integrity during production updates.

How do I ensure reversible Rails migrations for safe rollbacks?

Reversible Rails migrations are ensured by using the change method when possible, or providing explicit up and down paths with rollback guidance. This guarantees that schema changes can be safely undone if production deployment fails.

Does strong_migrations prevent locking issues when adding indexes?

Yes, strong_migrations enforces safe indexing with concurrency checks to prevent locking issues when adding indexes. It detects risky operations and guides you toward concurrency-friendly patterns required for zero-downtime changes.

Why do adding NOT NULL constraints cause downtime in production databases?

Adding NOT NULL constraints causes downtime because the database acquires a long-running lock to validate existing rows. Using a two-step constraint pattern backfills data first, then enforces the constraint safely without blocking production traffic.