From 673b893a8a31a2f268b42156f65432d5c9b70367 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 22 Aug 2024 16:11:19 +0200 Subject: [PATCH] refac --- backend/apps/webui/internal/db.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/apps/webui/internal/db.py b/backend/apps/webui/internal/db.py index fbe287e18..2d778bfe1 100644 --- a/backend/apps/webui/internal/db.py +++ b/backend/apps/webui/internal/db.py @@ -55,17 +55,15 @@ else: # This is required to ensure the peewee migration is handled before the alembic migration def handle_peewee_migration(DATABASE_URL): try: - # Replace the postgresql:// with postgres:// and %40 with @ in the DATABASE_URL + # Replace the postgresql:// with postgres:// to handle the peewee migration db = register_connection( - DATABASE_URL.replace("postgresql://", "postgres://").replace("%40", "@") + DATABASE_URL.replace("postgresql://", "postgres://"), unquote_password=True ) migrate_dir = BACKEND_DIR / "apps" / "webui" / "internal" / "migrations" router = Router(db, logger=log, migrate_dir=migrate_dir) router.run() db.close() - # check if db connection has been closed - except Exception as e: log.error(f"Failed to initialize the database connection: {e}") raise