From 332188535e643585f4bba07d9de2328cd0fd5502 Mon Sep 17 00:00:00 2001 From: MadsLang Date: Tue, 10 Dec 2024 15:18:26 +0100 Subject: [PATCH 001/489] add option to add database schema as env var --- backend/open_webui/apps/webui/internal/db.py | 6 ++++-- backend/open_webui/env.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/apps/webui/internal/db.py b/backend/open_webui/apps/webui/internal/db.py index bcf913e6fd..72185ea1ed 100644 --- a/backend/open_webui/apps/webui/internal/db.py +++ b/backend/open_webui/apps/webui/internal/db.py @@ -7,6 +7,7 @@ from open_webui.env import ( OPEN_WEBUI_DIR, DATABASE_URL, + DATABASE_SCHEMA, SRC_LOG_LEVELS, DATABASE_POOL_MAX_OVERFLOW, DATABASE_POOL_RECYCLE, @@ -14,7 +15,7 @@ DATABASE_POOL_TIMEOUT, ) from peewee_migrate import Router -from sqlalchemy import Dialect, create_engine, types +from sqlalchemy import Dialect, create_engine, MetaData, types from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy.pool import QueuePool, NullPool @@ -99,7 +100,8 @@ def handle_peewee_migration(DATABASE_URL): SessionLocal = sessionmaker( autocommit=False, autoflush=False, bind=engine, expire_on_commit=False ) -Base = declarative_base() +metadata_obj = MetaData(schema=DATABASE_SCHEMA) +Base = declarative_base(metadata=metadata_obj) Session = scoped_session(SessionLocal) diff --git a/backend/open_webui/env.py b/backend/open_webui/env.py index e1b350ead4..ffdc72d570 100644 --- a/backend/open_webui/env.py +++ b/backend/open_webui/env.py @@ -269,6 +269,8 @@ def parse_section(section): if "postgres://" in DATABASE_URL: DATABASE_URL = DATABASE_URL.replace("postgres://", "postgresql://") +DATABASE_SCHEMA = os.environ.get("DATABASE_SCHEMA", None) + DATABASE_POOL_SIZE = os.environ.get("DATABASE_POOL_SIZE", 0) if DATABASE_POOL_SIZE == "": From 61303a216ccf629b1afb53c0b4f1ba29612ce87c Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sun, 5 Jan 2025 13:56:42 -0800 Subject: [PATCH 002/489] refac: styling --- src/routes/s/[id]/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/s/[id]/+page.svelte b/src/routes/s/[id]/+page.svelte index 862185c9b6..b275c92097 100644 --- a/src/routes/s/[id]/+page.svelte +++ b/src/routes/s/[id]/+page.svelte @@ -166,7 +166,7 @@