views:

50

answers:

1

I have a migration which adds triggers to MySQL via invoking ActiveRecord::Base.connection() method "execute". It works fine except what schema version is not updated. I suspect that is because the DB structure by itself is not changed (no columns and table updates).

Is there a way to force the schema version update in my migration?

A: 

Actually I think this should be updating your schema.rb file version based on my observations of how the :migrate task is defined.

task :migrate => :environment do
  ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
  ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
  Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
end

If it's not updated, perhaps your :schema_format is not :ruby?

Ryan Bigg