What are the problems using rake db:migrate to load vanilla SQL?
The business requirements I work with do not allow me to use the default Rails migrations. But I still need to track changes, easily change the DDL of the database and other things that Rails migration gives you.
So, the migration file will look like this:
class AddDateToPost < ActiveRecord::Migration def self.up ActiveRecord::Base.connection.execute("ALTER TABLE `posts` ADD COLUMN date DATETIME NULL") end def self.down ActiveRecord::Base.connection.execute("ALTER TABLE `posts` DROP COLUMN date") end end
ruby-on-rails rake rails-migrations
vrish88
source share