perf: reduce dodo data loading requests
ci / docker (push) Successful in 6m31s

This commit is contained in:
2026-09-05 19:51:00 +08:00
parent e8c49b045f
commit 2987a787d3
8 changed files with 248 additions and 44 deletions
+41
View File
@@ -0,0 +1,41 @@
"""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"],
)
op.create_index(
"ix_habit_logs_habit_day",
"habit_logs",
["habit_id", "day"],
)
def downgrade() -> None:
op.drop_index("ix_habit_logs_habit_day", table_name="habit_logs")
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")