mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-05 02:41:34 +00:00
Merge ef01e3adb3 into 3d70d43a1c
This commit is contained in:
commit
b039fe2261
1 changed files with 34 additions and 0 deletions
|
|
@ -0,0 +1,34 @@
|
|||
"""add pending knowledge files index
|
||||
|
||||
Revision ID: a7e2c4f91b08
|
||||
Revises: d4c1a8e37b62
|
||||
Create Date: 2026-09-14 13:42:18.905331
|
||||
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'a7e2c4f91b08'
|
||||
down_revision: str | None = 'd4c1a8e37b62'
|
||||
branch_labels: str | Sequence[str] | None = None
|
||||
depends_on: str | Sequence[str] | None = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# SQLite does not fold bound parameters when matching an expression index, so it could never use this one.
|
||||
if op.get_bind().dialect.name == 'postgresql':
|
||||
op.create_index(
|
||||
'file_pending_knowledge_idx',
|
||||
'file',
|
||||
[sa.text("((meta -> 'data') ->> 'knowledge_id')")],
|
||||
postgresql_where=sa.text("(data ->> 'status') IN ('pending', 'processing')"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
if op.get_bind().dialect.name == 'postgresql':
|
||||
op.drop_index('file_pending_knowledge_idx', table_name='file')
|
||||
Loading…
Add table
Reference in a new issue