From 61bacd6ef9c302238f3b8d9e6b432ee2090f6b78 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Fri, 31 Oct 2014 15:20:44 -0600 Subject: Load test schema even if there are no migrations Fixes #17170 --- activerecord/lib/active_record/migration.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') 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 -- cgit v1.2.3