diff options
author | Nick Muerdter <nick.muerdter@nrel.gov> | 2015-11-19 11:12:24 -0700 |
---|---|---|
committer | Nick Muerdter <nick.muerdter@nrel.gov> | 2015-11-19 11:42:04 -0700 |
commit | d1dcdf21286cb459a422b6b88967d712c75f002a (patch) | |
tree | b6a96e37495a19b61064dedf3956a423d9fef0ed /activerecord/test | |
parent | 6b7861e8343400b85636d1f32917e463e309864a (diff) | |
download | rails-d1dcdf21286cb459a422b6b88967d712c75f002a.tar.gz rails-d1dcdf21286cb459a422b6b88967d712c75f002a.tar.bz2 rails-d1dcdf21286cb459a422b6b88967d712c75f002a.zip |
Fix rake db:structure:dump on Postgres when multiple schemas are used.
If postgresql is being used and there are multiple schemas listed on the
`schema_search_path`, then `structure.sql` dumps (triggered by `rake
db:structure:dump` or `config.active_record.schema_format = :sql`) began
failing in Rails 4.2.5.
This is due to the changes made in
https://github.com/rails/rails/pull/17885 The problem is that multiple
schemas were getting getting passed to `Kernel.system` as a single,
space delimited string argument (for example, "--schema=foo
--schema=bar"). However, with the updated array style of calling
`Kernel.system`, these need to be passed as separate arguments (for
example, "--schema=foo", "--schema=bar"). If they get passed as a single
string, then the underlying pg_dump program isn't sure how to interpret
that single argument and you'll get an error reporting: "pg_dump: No
matching schemas were found"
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/tasks/postgresql_rake_test.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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) |