db:schema:load does not insert all the migrations' versions #14013

Closed
d-unseductable opened this Issue Feb 11, 2014 · 3 comments

Comments

Projects
None yet
2 participants

Getting pending migrations errors after running

$ rake db:migrate

when db/migrate directory contains any migrations in its subdirectories.

Example directories structure:

db/
    migrate/
        archive/
            1_create_people.rb
            2_add_age_to_people.rb
        3_add_phone_number_to_people.rb

If the db/migrate directory contains any migrations in its subdirectories,
their versions are not inserted into schema_migrations table.

As for the example above,

ActiveRecord::ConnectionAdapters::SchemaStatements.assume_migrated_upto_version

method inserts only the 3rd version into the schema_migrations table.
But

ActiveRecord::Migrator.migrations

method expects the table to include all of the 3 versions. 1 and 2 are
perceived as pending and this fact causes the pending migrations error.

Member

robin850 commented Feb 16, 2014

@d-unseductable : Thanks for reporting and providing a patch but next time, could you link to the attached patch (i.e. #14012) when closing please ? This makes it easier for people when reading the issues. :-)

@robin850 Sorry, this is my first patch to Rails. I haven't noticed that another issue (#14012) was automatically created when I submitted my PR. So I decided to close this one. I'll link issues before closing them next time. Thank you!

Member

robin850 commented Feb 16, 2014

@d-unseductable : No problem! This was just FYI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment