提交 8e155b0a 编写于 作者: Y Yves Senn

Merge pull request #21527 from rngtng/fix-migrator-path-setup

Use global migrations_path configuration in Migrator
* `bin/rake db:migrate` uses
`ActiveRecord::Tasks::DatabaseTasks.migrations_paths` instead of
`Migrator.migrations_paths`.
*Tobias Bielohlawek*
* Support dropping indexes concurrently in PostgreSQL.
See http://www.postgresql.org/docs/9.4/static/sql-dropindex.html for more
......
......@@ -134,7 +134,7 @@ def migrate
version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
scope = ENV['SCOPE']
verbose_was, Migration.verbose = Migration.verbose, verbose
Migrator.migrate(Migrator.migrations_paths, version) do |migration|
Migrator.migrate(migrations_paths, version) do |migration|
scope.blank? || scope == migration.scope
end
ensure
......
......@@ -277,12 +277,14 @@ class DatabaseTasksMigrateTest < ActiveRecord::TestCase
def test_migrate_receives_correct_env_vars
verbose, version = ENV['VERBOSE'], ENV['VERSION']
ActiveRecord::Tasks::DatabaseTasks.migrations_paths = 'custom/path'
ENV['VERBOSE'] = 'false'
ENV['VERSION'] = '4'
ActiveRecord::Migrator.expects(:migrate).with(ActiveRecord::Migrator.migrations_paths, 4)
ActiveRecord::Migrator.expects(:migrate).with('custom/path', 4)
ActiveRecord::Tasks::DatabaseTasks.migrate
ensure
ActiveRecord::Tasks::DatabaseTasks.migrations_paths = nil
ENV['VERBOSE'], ENV['VERSION'] = verbose, version
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册