Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails g migration "command" to generate column rename migration?

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?

like image 328
Dan Baker Avatar asked Nov 28 '13 20:11

Dan Baker


1 Answers

No, There is no auto-generation command for "renaming" columns.

Refer Source Code. Auto generator understands only "to","from","add","remove","join_table","create"

like image 122
Rahul garg Avatar answered Oct 14 '22 09:10

Rahul garg