Rails: ActiveRecord::IrreversibleMigration — This migration uses remove_column without a type; db:rollback can't reverse it
rails db:rollback can't undo the migration because it contains an operation Rails can't invert.
StandardError: An error has occurred, this and all later migrations canceled: ActiveRecord::IrreversibleMigrationThis migration uses remove_column which is not automatically reversibleActiveRecord::IrreversibleMigration: This migration uses execute, which is not automatically reversible Meaning
Define explicit up and down, or give reversible hints (remove_column :users, :age, :integer; change_table with types), or use reversible do |dir|. Data migrations and raw SQL need up/down. Don't edit applied migrations in shared branches — add a new one.
Common causes
remove_columnwithout typeexecuteraw SQL inchangechange_columnwithoutchange_column_defaultinfo- Data transformation
- Dropping tables without a definition
⚡ Quick fix
- Provide
downorreversible do |dir| dir.up { ... } dir.down { ... } end - Give column types to
remove_columnso it's reversible - Raise
IrreversibleMigrationintentionally only if truly irreversible
Detailed fix by platform
Rails
def change; remove_column :users, :age, :integer; end # reversible with type
How to diagnose
- Operation — Irreversible?
- Type — Provided?
- Plan — up/down?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Ruby / Rails
- ActionController::InvalidAuthenticityToken Rails: ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity)
- undefined method for nil Ruby: NoMethodError: undefined method `x' for nil (nil:NilClass)
- Bundler could not find compatible versions for gem Bundler: Bundler could not find compatible versions for gem "activesupport": In Gemfile: rails (= 7.1.0) depends on activesupport (= 7.1.0)
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026