rails_migration_advisor
Generate Rails migration code for schema changes like add_column, rename_column, and add_index. Flags irreversible operations and shows affected models so you can plan database changes safely.
Instructions
Generates migration code for schema changes. Given an action (add_column, remove_column, rename_column, add_index, add_association, change_type), generates the migration, flags irreversible operations, and shows affected models. Use when: adding fields, changing schema, planning database changes. Key params: action, table, column, type, new_name (for rename_column).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Column type (e.g., 'string', 'integer', 'boolean', 'references'). For add_association with column, the table the reference points at (e.g., 'users'). | |
| table | Yes | Table name (e.g., 'users', 'posts') | |
| action | Yes | Migration action to perform | |
| column | No | Column name (e.g., 'email', 'status'). For add_association, the reference (e.g., 'user', 'parent'). | |
| options | No | Additional options (e.g., 'null: false, default: 0') | |
| new_name | No | New column name - only for rename_column action (e.g., 'full_name') |