Hi i have a t开发者_如何学Pythonable in which there are two columns from and to of type datatime i want to change the datatype from datetime to date. i dont know the exact command for chagning column type in migrations like rails g
From the command line, run:
rails generate migration change_data_type_for_table_column
Write your migration as:
change_table :table do |t|
t.change :column, :type
end
Use change_column.
change_column(:table, :column, :date)
精彩评论