I have a fresh database that I'm attempting to recreate, but running rake db:schema:load does not populate the schema_migrations table at all. The result of this is every migration is now pending. The schema version in schema.rb matches the latest migration, and this answer would indicate what I thought was happening (Rails populates the migrations table with all migration numbers prior to the current migration nubmer) is, in this particular instance, not happening. My coworkers have confirmed this is happening with their databases as well so it's definitely a project-wide problem. We're using SQLServer with a custom schema, though the db user is correctly creating all tables. I'm completely stumped. Any ideas?
Per D. Patrick, answering my own question:
So the end result was that another developer had installed activerecord-nulldb-adapter
, which monkey patches ActiveRecord::Schema.define
and doesn't run initialize_schema_migrations_table()
or assume_migrated_up_version()
. I uninstalled the gem, ran my db:schema:load
just fine.
Try to run the command with the trace flag
rake db:schema:load --trace
By the end of the log you should see lines
-- initialize_schema_migrations_table()
-> 0.0045s
Also, it worth to check does you test suit generate table from schema and the schema_migrations table correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With