If I\'m adding a column via MySQL, I can specify where in the table that column will be using the AFTER modifier. But if I do the add_column via a Rails migration, the colum
There does not seem to be a position option for the add_column method in migrations. But migrations support executing literal SQL. I'm no Rails developer, but something like the following:
class AddColumnAfterOtherColumn < ActiveRecord::Migration
def self.up
execute "ALTER TABLE table_name ADD COLUMN column_name INTEGER
AFTER other_column"
end
def self.down
remove_column :table_name, :column_name
end
end