开发者

How to update schema version manually in RoR?

I have a migration which adds triggers to MySQL via invoking ActiveRecord::Base.connection() method "execute". It works fine except what sch开发者_开发知识库ema 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?


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜