In Rails we have command to add migration that specifies the table name
column name. For example :
$ rails generate migration AddPartNumberToProducts part_number:string
will generate
class AddPartNumberToProducts < ActiveRecord::Migration
def change
add_column :products, :part_number, :string
endend
I know we can add the options on migration file, below migration will
add
part_number column after description column on products table.
class AddPartNumberToProducts < ActiveRecord::Migration
def change
add_column :products, :part_number, :string, :after => :descritpion
endend
Problem: How to specify the options (example :after => :descritpion) on
command line so that it will add directly on migration file.
FYI : I’ve asked the same question on stackoverflow Link