mirror of
https://github.com/open-webui/open-webui
synced 2025-04-26 17:20:15 +00:00
fix
This commit is contained in:
parent
670672c067
commit
25de3e753d
@ -54,11 +54,10 @@ else:
|
|||||||
# Workaround to handle the peewee migration
|
# Workaround to handle the peewee migration
|
||||||
# This is required to ensure the peewee migration is handled before the alembic migration
|
# This is required to ensure the peewee migration is handled before the alembic migration
|
||||||
def handle_peewee_migration(DATABASE_URL):
|
def handle_peewee_migration(DATABASE_URL):
|
||||||
|
# db = None
|
||||||
try:
|
try:
|
||||||
# Replace the postgresql:// with postgres:// to handle the peewee migration
|
# Replace the postgresql:// with postgres:// to handle the peewee migration
|
||||||
db = register_connection(
|
db = register_connection(DATABASE_URL.replace("postgresql://", "postgres://"))
|
||||||
DATABASE_URL.replace("postgresql://", "postgres://"), unquote_password=True
|
|
||||||
)
|
|
||||||
migrate_dir = BACKEND_DIR / "apps" / "webui" / "internal" / "migrations"
|
migrate_dir = BACKEND_DIR / "apps" / "webui" / "internal" / "migrations"
|
||||||
router = Router(db, logger=log, migrate_dir=migrate_dir)
|
router = Router(db, logger=log, migrate_dir=migrate_dir)
|
||||||
router.run()
|
router.run()
|
||||||
@ -67,7 +66,6 @@ def handle_peewee_migration(DATABASE_URL):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error(f"Failed to initialize the database connection: {e}")
|
log.error(f"Failed to initialize the database connection: {e}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
# Properly closing the database connection
|
# Properly closing the database connection
|
||||||
if db and not db.is_closed():
|
if db and not db.is_closed():
|
||||||
|
Loading…
Reference in New Issue
Block a user