diff options
author | Ralin Chimev <ralin.chimev@gmail.com> | 2016-05-10 20:44:33 +0300 |
---|---|---|
committer | Ralin Chimev <ralin.chimev@gmail.com> | 2016-05-10 22:23:44 +0300 |
commit | 09a90bb6a06b1dafc9881651f585e8b40dda4227 (patch) | |
tree | 779fe084eb1539d5ef35509b4ae00dc0c2a0b0fe /activerecord/test/cases | |
parent | 932655a4ef61083da98724bb612d00f89e153c46 (diff) | |
download | rails-09a90bb6a06b1dafc9881651f585e8b40dda4227.tar.gz rails-09a90bb6a06b1dafc9881651f585e8b40dda4227.tar.bz2 rails-09a90bb6a06b1dafc9881651f585e8b40dda4227.zip |
PostgreSQL: Fix db:structure:load silent failure on SQL error
The command line flag "-v ON_ERROR_STOP=1" should be used when invoking psql to make sure errors are not suppressed.
Example: psql -v ON_ERROR_STOP=1 -q -f awesome-file.sql my-app-db
Fixes #23818.
Diffstat (limited to 'activerecord/test/cases')
-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 6a0c7fbcb5..99d73e91a4 100644 --- a/activerecord/test/cases/tasks/postgresql_rake_test.rb +++ b/activerecord/test/cases/tasks/postgresql_rake_test.rb @@ -288,14 +288,14 @@ module ActiveRecord def test_structure_load filename = "awesome-file.sql" - Kernel.expects(:system).with('psql', '-q', '-f', filename, @configuration['database']).returns(true) + Kernel.expects(:system).with('psql', '-v', 'ON_ERROR_STOP=1', '-q', '-f', filename, @configuration['database']).returns(true) ActiveRecord::Tasks::DatabaseTasks.structure_load(@configuration, filename) end def test_structure_load_accepts_path_with_spaces filename = "awesome file.sql" - Kernel.expects(:system).with('psql', '-q', '-f', filename, @configuration['database']).returns(true) + Kernel.expects(:system).with('psql', '-v', 'ON_ERROR_STOP=1', '-q', '-f', filename, @configuration['database']).returns(true) ActiveRecord::Tasks::DatabaseTasks.structure_load(@configuration, filename) end |