From 3b27acc77eaf112d8521ae22282c619ef9ccf394 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 8 Jul 2024 11:34:24 -0700 Subject: [PATCH] fix --- backend/apps/webui/internal/db.py | 6 ------ backend/config.py | 4 ++++ backend/migrations/env.py | 3 +++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/apps/webui/internal/db.py b/backend/apps/webui/internal/db.py index aed110254..61025489f 100644 --- a/backend/apps/webui/internal/db.py +++ b/backend/apps/webui/internal/db.py @@ -81,12 +81,6 @@ handle_peewee_migration() SQLALCHEMY_DATABASE_URL = DATABASE_URL -# Replace the postgres:// with postgresql:// -if "postgres://" in SQLALCHEMY_DATABASE_URL: - SQLALCHEMY_DATABASE_URL = SQLALCHEMY_DATABASE_URL.replace( - "postgres://", "postgresql://" - ) - if "sqlite" in SQLALCHEMY_DATABASE_URL: engine = create_engine( SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} diff --git a/backend/config.py b/backend/config.py index fcf44b3ef..4db04ea65 100644 --- a/backend/config.py +++ b/backend/config.py @@ -1331,3 +1331,7 @@ AUDIO_TTS_VOICE = PersistentConfig( #################################### DATABASE_URL = os.environ.get("DATABASE_URL", f"sqlite:///{DATA_DIR}/webui.db") + +# Replace the postgres:// with postgresql:// +if "postgres://" in DATABASE_URL: + DATABASE_URL = DATABASE_URL.replace("postgres://", "postgresql://") diff --git a/backend/migrations/env.py b/backend/migrations/env.py index 40f0700de..efd37445f 100644 --- a/backend/migrations/env.py +++ b/backend/migrations/env.py @@ -49,6 +49,9 @@ if DB_URL: config.set_main_option("sqlalchemy.url", DB_URL) +print("DB_URL", DB_URL) + + def run_migrations_offline() -> None: """Run migrations in 'offline' mode.