mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #33906 from dark-panda/ignore-psqlrc-when-using-psql
Ignore psqlrc files when executing psql commands
This commit is contained in:
commit
f3c359800a
4 changed files with 12 additions and 12 deletions
|
@ -18,8 +18,8 @@ module QueJobsManager
|
|||
user = uri.user || ENV["USER"]
|
||||
pass = uri.password
|
||||
db = uri.path[1..-1]
|
||||
%x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'drop database if exists "#{db}"' -U #{user} -t template1}
|
||||
%x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'create database "#{db}"' -U #{user} -t template1}
|
||||
%x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -X -c 'drop database if exists "#{db}"' -U #{user} -t template1}
|
||||
%x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -X -c 'create database "#{db}"' -U #{user} -t template1}
|
||||
Que.connection = Sequel.connect(que_url)
|
||||
Que.migrate!
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ module QueueClassicJobsManager
|
|||
user = uri.user || ENV["USER"]
|
||||
pass = uri.password
|
||||
db = uri.path[1..-1]
|
||||
%x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'drop database if exists "#{db}"' -U #{user} -t template1}
|
||||
%x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'create database "#{db}"' -U #{user} -t template1}
|
||||
%x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -X -c 'drop database if exists "#{db}"' -U #{user} -t template1}
|
||||
%x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -X -c 'create database "#{db}"' -U #{user} -t template1}
|
||||
QC::Setup.create
|
||||
|
||||
QC.default_conn_adapter.disconnect
|
||||
|
|
|
@ -61,7 +61,7 @@ module ActiveRecord
|
|||
ActiveRecord::Base.dump_schemas
|
||||
end
|
||||
|
||||
args = ["-s", "-x", "-O", "-f", filename]
|
||||
args = ["-s", "-X", "-x", "-O", "-f", filename]
|
||||
args.concat(Array(extra_flags)) if extra_flags
|
||||
unless search_path.blank?
|
||||
args += search_path.split(",").map do |part|
|
||||
|
|
|
@ -366,7 +366,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
|||
assert_called_with(
|
||||
Kernel,
|
||||
:system,
|
||||
["pg_dump", "-s", "-x", "-O", "-f", @filename, "my-app-db"],
|
||||
["pg_dump", "-s", "-X", "-x", "-O", "-f", @filename, "my-app-db"],
|
||||
returns: true
|
||||
) do
|
||||
ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename)
|
||||
|
@ -383,7 +383,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
|||
end
|
||||
|
||||
def test_structure_dump_with_extra_flags
|
||||
expected_command = ["pg_dump", "-s", "-x", "-O", "-f", @filename, "--noop", "my-app-db"]
|
||||
expected_command = ["pg_dump", "-s", "-X", "-x", "-O", "-f", @filename, "--noop", "my-app-db"]
|
||||
|
||||
assert_called_with(Kernel, :system, expected_command, returns: true) do
|
||||
with_structure_dump_flags(["--noop"]) do
|
||||
|
@ -401,7 +401,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
|||
assert_called_with(
|
||||
Kernel,
|
||||
:system,
|
||||
["pg_dump", "-s", "-x", "-O", "-f", @filename, "-T", "foo", "-T", "bar", "my-app-db"],
|
||||
["pg_dump", "-s", "-X", "-x", "-O", "-f", @filename, "-T", "foo", "-T", "bar", "my-app-db"],
|
||||
returns: true
|
||||
) do
|
||||
ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename)
|
||||
|
@ -415,7 +415,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
|||
assert_called_with(
|
||||
Kernel,
|
||||
:system,
|
||||
["pg_dump", "-s", "-x", "-O", "-f", @filename, "--schema=foo", "--schema=bar", "my-app-db"],
|
||||
["pg_dump", "-s", "-X", "-x", "-O", "-f", @filename, "--schema=foo", "--schema=bar", "my-app-db"],
|
||||
returns: true
|
||||
) do
|
||||
ActiveRecord::Tasks::DatabaseTasks.structure_dump(@configuration, @filename)
|
||||
|
@ -428,7 +428,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
|||
assert_called_with(
|
||||
Kernel,
|
||||
:system,
|
||||
["pg_dump", "-s", "-x", "-O", "-f", @filename, "my-app-db"],
|
||||
["pg_dump", "-s", "-X", "-x", "-O", "-f", @filename, "my-app-db"],
|
||||
returns: true
|
||||
) do
|
||||
with_dump_schemas(:all) do
|
||||
|
@ -441,7 +441,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
|||
assert_called_with(
|
||||
Kernel,
|
||||
:system,
|
||||
["pg_dump", "-s", "-x", "-O", "-f", @filename, "--schema=foo", "--schema=bar", "my-app-db"],
|
||||
["pg_dump", "-s", "-X", "-x", "-O", "-f", @filename, "--schema=foo", "--schema=bar", "my-app-db"],
|
||||
returns: true
|
||||
) do
|
||||
with_dump_schemas("foo,bar") do
|
||||
|
@ -455,7 +455,7 @@ if current_adapter?(:PostgreSQLAdapter)
|
|||
assert_called_with(
|
||||
Kernel,
|
||||
:system,
|
||||
["pg_dump", "-s", "-x", "-O", "-f", filename, "my-app-db"],
|
||||
["pg_dump", "-s", "-X", "-x", "-O", "-f", filename, "my-app-db"],
|
||||
returns: nil
|
||||
) do
|
||||
e = assert_raise(RuntimeError) do
|
||||
|
|
Loading…
Reference in a new issue