提交 dbc0da42 编写于 作者: J J Smith

Use -X when loading structure.sql via psql

上级 ff1b4eb3
...@@ -82,7 +82,7 @@ def structure_dump(filename, extra_flags) ...@@ -82,7 +82,7 @@ def structure_dump(filename, extra_flags)
def structure_load(filename, extra_flags) def structure_load(filename, extra_flags)
set_psql_env 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.concat(Array(extra_flags)) if extra_flags
args << configuration["database"] args << configuration["database"]
run_cmd("psql", args, "loading") run_cmd("psql", args, "loading")
......
...@@ -496,7 +496,7 @@ def test_structure_load ...@@ -496,7 +496,7 @@ def test_structure_load
assert_called_with( assert_called_with(
Kernel, Kernel,
:system, :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 returns: true
) do ) do
ActiveRecord::Tasks::DatabaseTasks.structure_load(@configuration, filename) ActiveRecord::Tasks::DatabaseTasks.structure_load(@configuration, filename)
...@@ -505,7 +505,7 @@ def test_structure_load ...@@ -505,7 +505,7 @@ def test_structure_load
def test_structure_load_with_extra_flags def test_structure_load_with_extra_flags
filename = "awesome-file.sql" 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 assert_called_with(Kernel, :system, expected_command, returns: true) do
with_structure_load_flags(["--noop"]) do with_structure_load_flags(["--noop"]) do
...@@ -519,7 +519,7 @@ def test_structure_load_accepts_path_with_spaces ...@@ -519,7 +519,7 @@ def test_structure_load_accepts_path_with_spaces
assert_called_with( assert_called_with(
Kernel, Kernel,
:system, :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 returns: true
) do ) do
ActiveRecord::Tasks::DatabaseTasks.structure_load(@configuration, filename) ActiveRecord::Tasks::DatabaseTasks.structure_load(@configuration, filename)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册