mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
fix: enhance database schema handling for SQLite and PostgreSQL
- Updated schema configuration to set None for SQLite databases. - Added schema creation logic in the connection wrapper for PostgreSQL. - Adjusted migration environment to ignore schema for SQLite. - Fixed unquote parameters in connection tests for consistency.
This commit is contained in:
@@ -77,7 +77,8 @@ def run_migrations_online() -> None:
|
||||
)
|
||||
|
||||
with connectable.connect() as connection:
|
||||
if target_metadata.schema:
|
||||
if target_metadata.schema and connection.dialect.name == 'postgresql':
|
||||
# PostgreSQL에서만 스키마 설정 적용
|
||||
connection.execute(
|
||||
text(f"SET search_path TO {target_metadata.schema}, public")
|
||||
)
|
||||
@@ -87,6 +88,7 @@ def run_migrations_online() -> None:
|
||||
version_table_schema=target_metadata.schema,
|
||||
)
|
||||
else:
|
||||
# For SQLite, ignore schema and use default behavior
|
||||
context.configure(
|
||||
connection=connection,
|
||||
target_metadata=target_metadata,
|
||||
|
||||
Reference in New Issue
Block a user