"""Fix task queue sort

Revision ID: 8263992eb6c8
Revises: f8a7c273f18a
Create Date: 2024-12-18 11:34:57.186942

"""

from alembic import op

# revision identifiers, used by Alembic.
revision = "8263992eb6c8"
down_revision = "f8a7c273f18a"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index("ix_task_queue_sort", table_name="task_queue")
    op.execute(
        "CREATE INDEX ix_task_queue_sort ON task_queue (priority DESC, sort_date, id, tag) WHERE available = True;"
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###
