Ruby-on-rails – How to drop columns using Rails migration

activerecorddatabaserails-migrationsrubyruby-on-rails

What's the syntax for dropping a database table column through a Rails migration?

Best Solution

remove_column :table_name, :column_name

For instance:

remove_column :users, :hobby

would remove the hobby Column from the users table.