Some checks failed
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / build-slim-image (linux/amd64, ubuntu-latest) (push) Has been cancelled
Create and publish Docker images with specific build args / build-slim-image (linux/arm64, ubuntu-24.04-arm) (push) Has been cancelled
Create and publish Docker images with specific build args / merge-main-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-cuda-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-cuda126-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-ollama-images (push) Has been cancelled
Create and publish Docker images with specific build args / merge-slim-images (push) Has been cancelled
Python CI / Format Backend (3.11.x) (push) Has been cancelled
Python CI / Format Backend (3.12.x) (push) Has been cancelled
Frontend Build / Format & Build Frontend (push) Has been cancelled
Frontend Build / Frontend Unit Tests (push) Has been cancelled
Close inactive issues / close-issues (push) Has been cancelled
47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
"""Add indexes
|
|
|
|
Revision ID: 018012973d35
|
|
Revises: 97c08d196e3d
|
|
Create Date: 2025-08-13 03:00:00.000000
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "018012973d35"
|
|
down_revision = "97c08d196e3d"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# Chat table indexes
|
|
op.create_index("folder_id_idx", "chat", ["folder_id"])
|
|
op.create_index("user_id_pinned_idx", "chat", ["user_id", "pinned"])
|
|
op.create_index("user_id_archived_idx", "chat", ["user_id", "archived"])
|
|
op.create_index("updated_at_user_id_idx", "chat", ["updated_at", "user_id"])
|
|
op.create_index("folder_id_user_id_idx", "chat", ["folder_id", "user_id"])
|
|
|
|
# Tag table index
|
|
op.create_index("user_id_idx", "tag", ["user_id"])
|
|
|
|
# Function table index
|
|
op.create_index("is_global_idx", "function", ["is_global"])
|
|
|
|
|
|
def downgrade():
|
|
# Chat table indexes
|
|
op.drop_index("folder_id_idx", table_name="chat")
|
|
op.drop_index("user_id_pinned_idx", table_name="chat")
|
|
op.drop_index("user_id_archived_idx", table_name="chat")
|
|
op.drop_index("updated_at_user_id_idx", table_name="chat")
|
|
op.drop_index("folder_id_user_id_idx", table_name="chat")
|
|
|
|
# Tag table index
|
|
op.drop_index("user_id_idx", table_name="tag")
|
|
|
|
# Function table index
|
|
|
|
op.drop_index("is_global_idx", table_name="function")
|