提交 2b5cb1cd 编写于 作者: A Aaron Patterson

Merge pull request #5486 from kennyj/fix_5435

Fix GH #5435. db:structure:dump should be re-enable.
......@@ -426,6 +426,7 @@ db_namespace = namespace :db do
if ActiveRecord::Base.connection.supports_migrations?
File.open(filename, "a") { |f| f << ActiveRecord::Base.connection.dump_schema_information }
end
db_namespace['structure:dump'].reenable
end
# desc "Recreate the databases from the structure.sql file"
......
......@@ -140,6 +140,18 @@ def test_rake_dump_structure_should_respect_db_structure_env_variable
assert File.exists?(File.join(app_path, 'db', 'my_structure.sql'))
end
def test_rake_dump_structure_should_be_called_twice_when_migrate_redo
add_to_config "config.active_record.schema_format = :sql"
output = Dir.chdir(app_path) do
`rails g model post title:string;
bundle exec rake db:migrate:redo 2>&1 --trace;`
end
# expect only Invoke db:structure:dump (first_time)
assert_no_match(/^\*\* Invoke db:structure:dump\s+$/, output)
end
def test_rake_dump_schema_cache
Dir.chdir(app_path) do
`rails generate model post title:string;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册