diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-10-31 15:20:44 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-10-31 15:21:17 -0600 |
commit | 61bacd6ef9c302238f3b8d9e6b432ee2090f6b78 (patch) | |
tree | 77338d330b4cf6e7755040bb3099530f4eb83ccb /activerecord/lib/active_record | |
parent | 487145f871d93a56d128b135720d8059e831985d (diff) | |
download | rails-61bacd6ef9c302238f3b8d9e6b432ee2090f6b78.tar.gz rails-61bacd6ef9c302238f3b8d9e6b432ee2090f6b78.tar.bz2 rails-61bacd6ef9c302238f3b8d9e6b432ee2090f6b78.zip |
Load test schema even if there are no migrations
Fixes #17170
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index d0d9304a36..230659b97c 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -394,7 +394,7 @@ module ActiveRecord end def load_schema_if_pending! - if ActiveRecord::Migrator.needs_migration? + if ActiveRecord::Migrator.needs_migration? || !ActiveRecord::Migrator.any_migrations? ActiveRecord::Tasks::DatabaseTasks.load_schema_current check_pending! end @@ -848,6 +848,10 @@ module ActiveRecord (migrations(migrations_paths).collect(&:version) - get_all_versions(connection)).size > 0 end + def any_migrations? + migrations(migrations_paths).any? + end + def last_version last_migration.version end |