mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
Fix: fixed migration to add rag_config properly
This commit is contained in:
parent
79e28a2c09
commit
a6262ed3cf
@ -29,15 +29,22 @@ import json
|
|||||||
with suppress(ImportError):
|
with suppress(ImportError):
|
||||||
import playhouse.postgres_ext as pw_pext
|
import playhouse.postgres_ext as pw_pext
|
||||||
|
|
||||||
|
class Knowledge(pw.Model):
|
||||||
|
class Meta:
|
||||||
|
table_name = 'knowledge'
|
||||||
|
|
||||||
def migrate(migrator: Migrator, database: pw.Database, *, fake=False):
|
def migrate(migrator: Migrator, database: pw.Database, *, fake=False):
|
||||||
"""Add rag_config column to knowledge table."""
|
"""Add rag_config column to knowledge table."""
|
||||||
|
Knowledge._meta.database = database # manually bind DB
|
||||||
|
|
||||||
migrator.add_fields(
|
migrator.add_fields(
|
||||||
"knowledge",
|
Knowledge,
|
||||||
rag_config=pw.TextField(null=True, default=json.dumps({})), # Store an empty dict as JSON string
|
rag_config=pw.TextField(null=True, default=json.dumps({"DEFAULT_RAG_SETTINGS": True})),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def rollback(migrator: Migrator, database: pw.Database, *, fake=False):
|
def rollback(migrator: Migrator, database: pw.Database, *, fake=False):
|
||||||
"""Remove rag_config column from knowledge table."""
|
"""Remove rag_config column from knowledge table."""
|
||||||
migrator.remove_fields("knowledge", "rag_config")
|
Knowledge._meta.database = database # manually bind DB
|
||||||
|
|
||||||
|
migrator.remove_fields(Knowledge, "rag_config")
|
||||||
|
Loading…
Reference in New Issue
Block a user