snippetrubyrailsCritical
How to drop columns using Rails migration
Viewed 0 times
howdropcolumnsusingmigrationrails
Problem
What's the syntax for dropping a database table column through a Rails migration?
Solution
remove_column :table_name, :column_nameFor instance:
remove_column :users, :hobbywould remove the hobby Column from the users table.
Code Snippets
remove_column :table_name, :column_nameremove_column :users, :hobbyContext
Stack Overflow Q#2831059, score: 1074
Revisions (0)
No revisions yet.