Files
dodo/migrations/versions/0005_query_indexes.py
2026-09-05 20:08:52 +08:00

36 lines
855 B
Python

"""add task and habit query indexes
Revision ID: 0005
Revises: 0004
"""
from alembic import op
revision = "0005"
down_revision = "0004"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_index(
"ix_tasks_user_active_created",
"tasks",
["user_id", "deleted_at", "parent_id", "created_at", "id"],
)
op.create_index(
"ix_tasks_user_due",
"tasks",
["user_id", "deleted_at", "due_at"],
)
op.create_index(
"ix_tasks_user_list_active",
"tasks",
["user_id", "list_id", "deleted_at", "parent_id", "created_at", "id"],
)
def downgrade() -> None:
op.drop_index("ix_tasks_user_list_active", table_name="tasks")
op.drop_index("ix_tasks_user_due", table_name="tasks")
op.drop_index("ix_tasks_user_active_created", table_name="tasks")