aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-03-05 00:29:41 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-03-05 00:29:41 +0900
commit031605aa90fd6bbb706758cdf1a6e235f48c0ea7 (patch)
tree44cc0504be57f06aa0cd1eadbec13b94c9e38aed /activerecord/test
parent145adda5815e910df09af107e9ff97467799e853 (diff)
downloadrails-031605aa90fd6bbb706758cdf1a6e235f48c0ea7.tar.gz
rails-031605aa90fd6bbb706758cdf1a6e235f48c0ea7.tar.bz2
rails-031605aa90fd6bbb706758cdf1a6e235f48c0ea7.zip
Fix `rake db:schema:load` with subdirectories
Related #25174. `db:schema:load` doesn't work with subdirectories like previous `db:migrate:status`. `Migrator.migration_files` should be used in `assume_migrated_upto_version` to fix the issue.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/migrator_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/test/cases/migrator_test.rb b/activerecord/test/cases/migrator_test.rb
index 81f9749063..aadbc375af 100644
--- a/activerecord/test/cases/migrator_test.rb
+++ b/activerecord/test/cases/migrator_test.rb
@@ -152,6 +152,23 @@ class MigratorTest < ActiveRecord::TestCase
], ActiveRecord::Migrator.migrations_status(path)
end
+ def test_migrations_status_with_schema_define_in_subdirectories
+ path = MIGRATIONS_ROOT + "/valid_with_subdirectories"
+ prev_paths = ActiveRecord::Migrator.migrations_paths
+ ActiveRecord::Migrator.migrations_paths = path
+
+ ActiveRecord::Schema.define(version: 3) do
+ end
+
+ assert_equal [
+ ["up", "001", "Valid people have last names"],
+ ["up", "002", "We need reminders"],
+ ["up", "003", "Innocent jointable"],
+ ], ActiveRecord::Migrator.migrations_status(path)
+ ensure
+ ActiveRecord::Migrator.migrations_paths = prev_paths
+ end
+
def test_migrations_status_from_two_directories
paths = [MIGRATIONS_ROOT + "/valid_with_timestamps", MIGRATIONS_ROOT + "/to_copy_with_timestamps"]