提交 f746534c 编写于 作者: Y Yves Senn

Merge pull request #22345 from GUI/fix-multi-schema-structure-dump

Fix rake db:structure:dump on Postgres when multiple schemas are used

Conflicts:
	activerecord/CHANGELOG.md

Closes #22346.
* Fix `rake db:structure:dump` on Postgres when multiple schemas are used.
Fixes #22346.
*Nick Muerdter*, *ckoenig*
* Add schema dumping support for PostgreSQL geometric data types.
*Ryuta Kamizono*
......
......@@ -56,9 +56,9 @@ def structure_dump(filename)
args = ['-s', '-x', '-O', '-f', filename]
unless search_path.blank?
args << search_path.split(',').map do |part|
args += search_path.split(',').map do |part|
"--schema=#{part.strip}"
end.join(' ')
end
end
args << configuration['database']
run_cmd('pg_dump', args, 'dumping')
......
......@@ -212,7 +212,7 @@ def test_structure_dump
def test_structure_dump_with_schema_search_path
@configuration['schema_search_path'] = 'foo,bar'
Kernel.expects(:system).with('pg_dump', '-s', '-x', '-O', '-f', @filename, '--schema=foo --schema=bar', 'my-app-db').returns(true)
Kernel.expects(:system).with('pg_dump', '-s', '-x', '-O', '-f', @filename, '--schema=foo', '--schema=bar', 'my-app-db').returns(true)
ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename)
end
......@@ -228,7 +228,7 @@ def test_structure_dump_with_schema_search_path_and_dump_schemas_all
end
def test_structure_dump_with_dump_schemas_string
Kernel.expects(:system).with("pg_dump", '-s', '-x', '-O', '-f', @filename, '--schema=foo --schema=bar', "my-app-db").returns(true)
Kernel.expects(:system).with("pg_dump", '-s', '-x', '-O', '-f', @filename, '--schema=foo', '--schema=bar', "my-app-db").returns(true)
with_dump_schemas('foo,bar') do
ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册