How to drop columns using Rails migration

Ethan picture Ethan · May 14, 2010 · Viewed 392.2k times · Source

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

Answer

Nick Hammond picture Nick Hammond · Jun 3, 2010
remove_column :table_name, :column_name

For instance:

remove_column :users, :hobby

would remove the hobby Column from the users table.