# Rails: ActiveRecord::IrreversibleMigration — This migration uses remove_column without a type; db:rollback can't reverse it

**Code:** `ActiveRecord::IrreversibleMigration` · **Category:** Ruby / Rails · **Seen on:** Ruby

`rails db:rollback` can't undo the migration because it contains an operation Rails can't invert.

## 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_column` without type
- `execute` raw SQL in `change`
- `change_column` without `change_column_default` info
- Data transformation
- Dropping tables without a definition

## Quick fix

1. Provide `down` or `reversible do |dir| dir.up { ... } dir.down { ... } end`
2. Give column types to `remove_column` so it's reversible
3. Raise `IrreversibleMigration` intentionally only if truly irreversible

## Detailed fix by platform

### Rails

1. `def change; remove_column :users, :age, :integer; end  # reversible with type`

## How to diagnose

1. **Operation** — Irreversible?
2. **Type** — Provided?
3. **Plan** — up/down?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ruby/activerecord-irreversiblemigration)
