diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-11-30 16:04:50 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-11-30 16:06:57 +0100 |
commit | f746534ca4654112453a7e4904acaed148314764 (patch) | |
tree | fcfb05de3d57ef9cb1853b465110ac4676d75a55 /activerecord | |
parent | 8299a35d25a68dd9216a0cc6bb719c8aafa2b300 (diff) | |
parent | d1dcdf21286cb459a422b6b88967d712c75f002a (diff) | |
download | rails-f746534ca4654112453a7e4904acaed148314764.tar.gz rails-f746534ca4654112453a7e4904acaed148314764.tar.bz2 rails-f746534ca4654112453a7e4904acaed148314764.zip |
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.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG.md | 6 | ||||
-rw-r--r-- | activerecord/lib/active_record/tasks/postgresql_database_tasks.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/tasks/postgresql_rake_test.rb | 4 |
3 files changed, 10 insertions, 4 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 876443550a..79faa9326d 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,9 @@ +* 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* diff --git a/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb b/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb index cd7d949239..8b4874044c 100644 --- a/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb @@ -56,9 +56,9 @@ module ActiveRecord 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') diff --git a/activerecord/test/cases/tasks/postgresql_rake_test.rb b/activerecord/test/cases/tasks/postgresql_rake_test.rb index c31f94b2f2..ba53f340ae 100644 --- a/activerecord/test/cases/tasks/postgresql_rake_test.rb +++ b/activerecord/test/cases/tasks/postgresql_rake_test.rb @@ -212,7 +212,7 @@ module ActiveRecord 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 @@ module ActiveRecord 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) |