migrations

Generate safe, reversible Active Record database migrations in Ruby on Rails.

5|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/ThinkOodle/rails-skills --skill migrations-thinkoodle
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrations
Source: https://github.com/ThinkOodle/rails-skills/tree/main/skills/migrations
Command: npx skills add https://github.com/ThinkOodle/rails-skills --skill migrations-thinkoodle

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides expert guidance for creating database schema changes in Rails applications that are safe, reversible, and maintainable, preventing common production issues.

Core Features & Use Cases

  • Safe Migration Generation: Use Rails generators to create migration files with descriptive names.
  • Reversible Operations: Write migrations that can be easily rolled back using change or up/down methods.
  • Data Migration Strategies: Learn how to handle both small inline data updates and large data migrations using separate tasks.
  • Use Case: You need to add a new status column to your posts table, ensuring it has a default value and can be safely rolled back if necessary.

Quick Start

Generate a new migration to add a status column to the posts table with a default value of 'draft'.

Frequently Asked Questions about migrations

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

FAQPage Schema
How do I write reversible Rails migrations for schema changes?

Write reversible Rails migrations using the `change` method or defining explicit `up` and `down` methods to ensure schema modifications can be safely rolled back. This approach handles column additions, removals, and indexing automatically.

What is the best way to handle large data migrations in Ruby on Rails?

Handle large data migrations in Ruby on Rails by separating them into dedicated tasks rather than inline schema changes. This prevents locking issues and keeps your Active Record schema migrations fast and safe.

Why should I avoid referencing Active Record models directly inside database migrations?

Avoid referencing Active Record models inside migrations because model classes can change or be deleted over time, causing migrations to fail. Instead, use raw SQL queries or define migration-specific classes to maintain stability.

What are the risks of editing committed database migrations in a Rails application?

Editing committed database migrations in a Rails application creates inconsistencies between environments because the schema changes have already been executed. Always create new forward-only migrations to alter existing schema states safely.

How do you safely add a database column with a default value in Rails?

Safely add a database column with a default value in Rails by generating a new migration and specifying the default parameter. This ensures existing records update correctly and the schema change remains reversible.