mirror of
https://codeberg.org/catask-org/catask.git
synced 2025-04-19 13:23:41 -05:00
add host to pg_dump and pg_restore
This commit is contained in:
parent
afc89777fb
commit
791530b28a
1 changed files with 3 additions and 2 deletions
|
@ -698,7 +698,7 @@ def createExport() -> dict:
|
||||||
# Export database to SQL file
|
# Export database to SQL file
|
||||||
dump_file = temp_dir / 'database.sql'
|
dump_file = temp_dir / 'database.sql'
|
||||||
result = subprocess.Popen(
|
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,
|
stdin=subprocess.PIPE,
|
||||||
shell=True,
|
shell=True,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
|
@ -706,6 +706,7 @@ def createExport() -> dict:
|
||||||
encoding="utf-8",
|
encoding="utf-8",
|
||||||
env=dict(os.environ, PGPASSWORD=dbPass)
|
env=dict(os.environ, PGPASSWORD=dbPass)
|
||||||
)
|
)
|
||||||
|
|
||||||
# absolutely dumb workaround for an error
|
# absolutely dumb workaround for an error
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
@ -771,7 +772,7 @@ def importData(export_file) -> dict:
|
||||||
|
|
||||||
dump_file = const.tempDir / 'database.sql'
|
dump_file = const.tempDir / 'database.sql'
|
||||||
process = subprocess.Popen(
|
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,
|
shell=True,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
|
|
Loading…
Add table
Reference in a new issue