Skip to content

Commit

Permalink
postgres db backup with location string
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Feb 11, 2024
1 parent fba5956 commit 9b1ba7b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions cashu/core/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ async def backup_database(db: Database, version: int = 0) -> str:
elif db.type in {POSTGRES, COCKROACH}:
filepath = f"{filepath}.dump"
logger.info(f"Creating {db.type} backup of {db.name} db to {filepath}")
user = db.db_location.split("/")[-1]
host = db.db_location.split("@")[-1].split(":")[0]
name = db.db_location.split("/")[-1]
os.system(f"pg_dump -U {user} -h {host} -d {name} -f {filepath}")
os.system(f"pg_dump --dbname={db.db_location} --file={filepath}")

return filepath

Expand Down

0 comments on commit 9b1ba7b

Please sign in to comment.