mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #44028 from aldent95/pg_dump_args_fix
Updating the --no-comment argument to the correct --no-comments argument
This commit is contained in:
commit
8b29524a38
3 changed files with 18 additions and 12 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
* Fix incorrect argument in PostgreSQL structure dump tasks.
|
||||||
|
|
||||||
|
Updating the `--no-comment` argument added in Rails 7 to the correct `--no-comments` argument.
|
||||||
|
|
||||||
|
*Alex Dent*
|
||||||
|
|
||||||
* Fix migration compatibility to create SQLite references/belongs_to column as integer when migration version is 6.0.
|
* Fix migration compatibility to create SQLite references/belongs_to column as integer when migration version is 6.0.
|
||||||
|
|
||||||
Reference/belongs_to in migrations with version 6.0 were creating columns as
|
Reference/belongs_to in migrations with version 6.0 were creating columns as
|
||||||
|
|
|
@ -58,7 +58,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
args = ["--schema-only", "--no-privileges", "--no-owner"]
|
args = ["--schema-only", "--no-privileges", "--no-owner"]
|
||||||
args << "--no-comment" if connection.database_version >= 110_000
|
args << "--no-comments" if connection.database_version >= 110_000
|
||||||
args.concat(["--file", filename])
|
args.concat(["--file", filename])
|
||||||
|
|
||||||
args.concat(Array(extra_flags)) if extra_flags
|
args.concat(Array(extra_flags)) if extra_flags
|
||||||
|
|
|
@ -355,7 +355,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
||||||
assert_called_with(
|
assert_called_with(
|
||||||
Kernel,
|
Kernel,
|
||||||
:system,
|
:system,
|
||||||
[{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comment", "--file", @filename, "my-app-db"],
|
[{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comments", "--file", @filename, "my-app-db"],
|
||||||
returns: true
|
returns: true
|
||||||
) do
|
) do
|
||||||
ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename)
|
ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename)
|
||||||
|
@ -373,7 +373,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
||||||
|
|
||||||
def test_structure_dump_with_env
|
def test_structure_dump_with_env
|
||||||
expected_env = { "PGHOST" => "my.server.tld", "PGPORT" => "2345", "PGUSER" => "jane", "PGPASSWORD" => "s3cr3t" }
|
expected_env = { "PGHOST" => "my.server.tld", "PGPORT" => "2345", "PGUSER" => "jane", "PGPASSWORD" => "s3cr3t" }
|
||||||
expected_command = [expected_env, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comment", "--file", @filename, "my-app-db"]
|
expected_command = [expected_env, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comments", "--file", @filename, "my-app-db"]
|
||||||
|
|
||||||
assert_called_with(Kernel, :system, expected_command, returns: true) do
|
assert_called_with(Kernel, :system, expected_command, returns: true) do
|
||||||
ActiveRecord::Tasks::DatabaseTasks.structure_dump(
|
ActiveRecord::Tasks::DatabaseTasks.structure_dump(
|
||||||
|
@ -385,7 +385,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
||||||
|
|
||||||
def test_structure_dump_with_ssl_env
|
def test_structure_dump_with_ssl_env
|
||||||
expected_env = { "PGSSLMODE" => "verify-full", "PGSSLCERT" => "client.crt", "PGSSLKEY" => "client.key", "PGSSLROOTCERT" => "root.crt" }
|
expected_env = { "PGSSLMODE" => "verify-full", "PGSSLCERT" => "client.crt", "PGSSLKEY" => "client.key", "PGSSLROOTCERT" => "root.crt" }
|
||||||
expected_command = [expected_env, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comment", "--file", @filename, "my-app-db"]
|
expected_command = [expected_env, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comments", "--file", @filename, "my-app-db"]
|
||||||
|
|
||||||
assert_called_with(Kernel, :system, expected_command, returns: true) do
|
assert_called_with(Kernel, :system, expected_command, returns: true) do
|
||||||
ActiveRecord::Tasks::DatabaseTasks.structure_dump(
|
ActiveRecord::Tasks::DatabaseTasks.structure_dump(
|
||||||
|
@ -396,7 +396,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_structure_dump_with_extra_flags
|
def test_structure_dump_with_extra_flags
|
||||||
expected_command = [{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comment", "--file", @filename, "--noop", "my-app-db"]
|
expected_command = [{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comments", "--file", @filename, "--noop", "my-app-db"]
|
||||||
|
|
||||||
assert_called_with(Kernel, :system, expected_command, returns: true) do
|
assert_called_with(Kernel, :system, expected_command, returns: true) do
|
||||||
with_structure_dump_flags(["--noop"]) do
|
with_structure_dump_flags(["--noop"]) do
|
||||||
|
@ -406,7 +406,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_structure_dump_with_hash_extra_flags_for_a_different_driver
|
def test_structure_dump_with_hash_extra_flags_for_a_different_driver
|
||||||
expected_command = [{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comment", "--file", @filename, "my-app-db"]
|
expected_command = [{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comments", "--file", @filename, "my-app-db"]
|
||||||
|
|
||||||
assert_called_with(Kernel, :system, expected_command, returns: true) do
|
assert_called_with(Kernel, :system, expected_command, returns: true) do
|
||||||
with_structure_dump_flags({ mysql2: ["--noop"] }) do
|
with_structure_dump_flags({ mysql2: ["--noop"] }) do
|
||||||
|
@ -416,7 +416,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_structure_dump_with_hash_extra_flags_for_the_correct_driver
|
def test_structure_dump_with_hash_extra_flags_for_the_correct_driver
|
||||||
expected_command = [{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comment", "--file", @filename, "--noop", "my-app-db"]
|
expected_command = [{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comments", "--file", @filename, "--noop", "my-app-db"]
|
||||||
|
|
||||||
assert_called_with(Kernel, :system, expected_command, returns: true) do
|
assert_called_with(Kernel, :system, expected_command, returns: true) do
|
||||||
with_structure_dump_flags({ postgresql: ["--noop"] }) do
|
with_structure_dump_flags({ postgresql: ["--noop"] }) do
|
||||||
|
@ -434,7 +434,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
||||||
assert_called_with(
|
assert_called_with(
|
||||||
Kernel,
|
Kernel,
|
||||||
:system,
|
:system,
|
||||||
[{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comment", "--file", @filename, "-T", "foo", "-T", "bar", "my-app-db"],
|
[{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comments", "--file", @filename, "-T", "foo", "-T", "bar", "my-app-db"],
|
||||||
returns: true
|
returns: true
|
||||||
) do
|
) do
|
||||||
ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename)
|
ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename)
|
||||||
|
@ -448,7 +448,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
||||||
assert_called_with(
|
assert_called_with(
|
||||||
Kernel,
|
Kernel,
|
||||||
:system,
|
:system,
|
||||||
[{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comment", "--file", @filename, "--schema=foo", "--schema=bar", "my-app-db"],
|
[{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comments", "--file", @filename, "--schema=foo", "--schema=bar", "my-app-db"],
|
||||||
returns: true
|
returns: true
|
||||||
) do
|
) do
|
||||||
ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename)
|
ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename)
|
||||||
|
@ -461,7 +461,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
||||||
assert_called_with(
|
assert_called_with(
|
||||||
Kernel,
|
Kernel,
|
||||||
:system,
|
:system,
|
||||||
[{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comment", "--file", @filename, "my-app-db"],
|
[{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comments", "--file", @filename, "my-app-db"],
|
||||||
returns: true
|
returns: true
|
||||||
) do
|
) do
|
||||||
with_dump_schemas(:all) do
|
with_dump_schemas(:all) do
|
||||||
|
@ -474,7 +474,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
||||||
assert_called_with(
|
assert_called_with(
|
||||||
Kernel,
|
Kernel,
|
||||||
:system,
|
:system,
|
||||||
[{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comment", "--file", @filename, "--schema=foo", "--schema=bar", "my-app-db"],
|
[{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comments", "--file", @filename, "--schema=foo", "--schema=bar", "my-app-db"],
|
||||||
returns: true
|
returns: true
|
||||||
) do
|
) do
|
||||||
with_dump_schemas("foo,bar") do
|
with_dump_schemas("foo,bar") do
|
||||||
|
@ -488,7 +488,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
||||||
assert_called_with(
|
assert_called_with(
|
||||||
Kernel,
|
Kernel,
|
||||||
:system,
|
:system,
|
||||||
[{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comment", "--file", filename, "my-app-db"],
|
[{}, "pg_dump", "--schema-only", "--no-privileges", "--no-owner", "--no-comments", "--file", filename, "my-app-db"],
|
||||||
returns: nil
|
returns: nil
|
||||||
) do
|
) do
|
||||||
e = assert_raise(RuntimeError) do
|
e = assert_raise(RuntimeError) do
|
||||||
|
|
Loading…
Reference in a new issue