add host to pg_dump and pg_restore

This commit is contained in:
mst 2025-03-19 13:36:44 +03:00
parent afc89777fb
commit 791530b28a
No known key found for this signature in database

View file

@ -698,7 +698,7 @@ def createExport() -> dict:
# Export database to SQL file
dump_file = temp_dir / 'database.sql'
result = subprocess.Popen(
f'pg_dump -U {dbUser} -d {dbName} -F c -E UTF8 -f {dump_file}',
f'pg_dump -h {dbHost} -U {dbUser} -d {dbName} -F c -E UTF8 -f {dump_file}',
stdin=subprocess.PIPE,
shell=True,
stdout=subprocess.PIPE,
@ -706,6 +706,7 @@ def createExport() -> dict:
encoding="utf-8",
env=dict(os.environ, PGPASSWORD=dbPass)
)
# absolutely dumb workaround for an error
time.sleep(1)
@ -771,7 +772,7 @@ def importData(export_file) -> dict:
dump_file = const.tempDir / 'database.sql'
process = subprocess.Popen(
f'pg_restore --clean -U {dbUser} -d {dbName} {dump_file}',
f'pg_restore -h {dbHost} --clean -U {dbUser} -d {dbName} {dump_file}',
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,