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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With