database-migrations

Create reversible Rails database migrations with indexes and rollback strategies.

Updated Nov 1, 2025
One-click install
npx skills add https://github.com/nschneble/rails-superstack --skill database-migrations-nschneble
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-migrations
Source: https://github.com/nschneble/rails-superstack/tree/main/.agents/skills/database-migrations
Command: npx skills add https://github.com/nschneble/rails-superstack --skill database-migrations-nschneble

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creates safe database migrations with proper indexes and rollback strategies. Use when creating tables, adding columns, creating indexes, handling zero-downtime migrations, or when user mentions migrations, schema changes, or database structure.

Core Features & Use Cases

  • Safe migration patterns: reversible migrations, batched updates for large tables, and minimal locking.
  • Indexing, constraints, and foreign keys: adds indexes and constraints with safety in mind; supports concurrent index creation and safe rollbacks.
  • Use cases: applying schema changes in production Rails apps, performing migrations with minimal downtime, backfilling data safely.

Quick Start

Follow the safe migration patterns to scaffold and apply a reversible migration with proper indexing.

Frequently Asked Questions about database-migrations

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

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

Create zero-downtime Rails database migrations by applying batched updates, concurrent index creation, and reversible changes to minimize locking. This ensures data integrity and continuous availability when applying schema changes to production applications.

What is the best way to add an index to a large table without locking the database?

Add indexes to large tables without locking by using concurrent index creation patterns. This safe migration strategy supports safe rollbacks and prevents downtime when modifying database structure on large production tables.

How do I safely backfill data when adding a new column in Rails?

Safely backfill data when adding a column by using safe defaults and batched updates. This migration pattern applies changes incrementally to maintain data integrity constraints and minimize locking on large database tables.

Can I create reversible database migrations with proper rollback strategies?

Yes, you can create reversible database migrations with proper rollback strategies. This approach ensures that adding columns, creating foreign keys, and applying schema changes can be safely reversed to maintain database structure integrity.

Does this migration approach support foreign keys and data integrity constraints?

Yes, this database migration approach supports creating foreign keys and data integrity constraints safely. It applies schema changes with safety in mind, ensuring constraints are added with minimal locking and support safe rollbacks.