What's the syntax for dropping a database table column through a Rails migration?
A:
remove_column :table_name, :column_name
For instance:
remove_column :users, :hobby
would remove the hobby field from the users table.
Dizzy.co.uk has a really helpful migration cheatsheet.
http://dizzy.co.uk/ruby_on_rails/cheatsheets/rails-migrations
Nick Hammond
2010-06-03 05:49:17
+1
A:
Run this ruby script/generate migration RemoveFieldNameFromTableName field_name:datatype
prabu
2010-09-18 18:22:03