Ruby on Rails - changing tables in ruby on rails- ruby on rails tutorial - rails guides - rails tutorial - ruby rails
- We have created a table with some wrong schema, then the easiest way to change the columns and their properties is change_table.
Example
- Above migration changes a table orders.
line-by-line description of the changes
- t.remove :ordered_at removes the column ordered_at from the table orders.
- t.string :skew_number adding a new string-type column named skew_number in the orders table.
- t.index :skew_number adding an index on the skew_number column in the orders table.
- t.rename :location, :state renames the location column in the orders table to state.