This commit is contained in:
@@ -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")
|
||||
Reference in New Issue
Block a user