I got an app running in production on heroku, but there is a problem with the schema_migrations table.

The last migration changes are present at the db/schema.rb file, but there is no entry for this migration in the schema_migrations table.

So when running rake db:version I got the number corresponding to the migration executed before this last migration.

I believe i should add an entry for this migration on schema_migrations table, but i am not sure of how to do this without affecting the date on my database, and remotely on heroku.

有帮助吗?

解决方案

I had a similar problem, where I had no migrations in my schema_migrations table. So I had to run this:

Dir.open('db/migrate').each do |fname|
    i = fname.split('_').first.to_i
    next if i == 0
    ActiveRecord::Base.connection.execute("INSERT INTO schema_migrations (version) VALUES(#{i})")
end

source

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top