I want to auto generate a migration file that looks like this:
class RenameDatabaseColumn < ActiveRecord::Migration
def change
rename_column :events, :subcategory, :subcategory_id
end
end
Is there some way to format my
rails g migration ~rename_column_events_subcategory_subcategory_id~
or something like that to auto generate that file?
No, There is no auto-generation command for "renaming" columns.
Refer Source Code . Auto generator understands only "to","from","add","remove","join_table","create"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.