Skip to content

Commit

Permalink
Use -X when loading structure.sql via psql
Browse files Browse the repository at this point in the history
  • Loading branch information
dark-panda committed Sep 27, 2018
1 parent ff1b4eb commit dbc0da4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def structure_dump(filename, extra_flags)

def structure_load(filename, extra_flags)
set_psql_env
args = ["-v", ON_ERROR_STOP_1, "-q", "-f", filename]
args = ["-v", ON_ERROR_STOP_1, "-q", "-X", "-f", filename]
args.concat(Array(extra_flags)) if extra_flags
args << configuration["database"]
run_cmd("psql", args, "loading")
Expand Down
6 changes: 3 additions & 3 deletions activerecord/test/cases/tasks/postgresql_rake_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def test_structure_load
assert_called_with(
Kernel,
:system,
["psql", "-v", "ON_ERROR_STOP=1", "-q", "-f", filename, @configuration["database"]],
["psql", "-v", "ON_ERROR_STOP=1", "-q", "-X", "-f", filename, @configuration["database"]],
returns: true
) do
ActiveRecord::Tasks::DatabaseTasks.structure_load(@configuration, filename)
Expand All @@ -505,7 +505,7 @@ def test_structure_load

def test_structure_load_with_extra_flags
filename = "awesome-file.sql"
expected_command = ["psql", "-v", "ON_ERROR_STOP=1", "-q", "-f", filename, "--noop", @configuration["database"]]
expected_command = ["psql", "-v", "ON_ERROR_STOP=1", "-q", "-X", "-f", filename, "--noop", @configuration["database"]]

assert_called_with(Kernel, :system, expected_command, returns: true) do
with_structure_load_flags(["--noop"]) do
Expand All @@ -519,7 +519,7 @@ def test_structure_load_accepts_path_with_spaces
assert_called_with(
Kernel,
:system,
["psql", "-v", "ON_ERROR_STOP=1", "-q", "-f", filename, @configuration["database"]],
["psql", "-v", "ON_ERROR_STOP=1", "-q", "-X", "-f", filename, @configuration["database"]],
returns: true
) do
ActiveRecord::Tasks::DatabaseTasks.structure_load(@configuration, filename)
Expand Down

0 comments on commit dbc0da4

Please sign in to comment.