Run Rails migrations right from the console

Posted by peter on April 19, 2008

Since mysql doesn’t support transactional table modifications (i.e. you can’t wrap ALTER in BEGIN/COMMIT) every so often you’ll get migrations that fail, putting your database in schema purgatory.

A handy way to deal with this is to run migrations manually from console like this:

ActiveRecord::Migration.add_index :commonalities, :match_id ActiveRecord::Migration.remove_column :users, :middle_name


Of course, these will run against whatever environment you started console with.

Post a comment
Comment