"""add task assigned_to_user_id

Revision ID: 86a6b2beaac9
Revises: 510018b229c3
Create Date: 2026-04-22 01:21:09.059410

"""

from __future__ import annotations

from collections.abc import Sequence

import sqlalchemy as sa
import sqlmodel

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "86a6b2beaac9"
down_revision: str | None = "510018b229c3"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("tasks", schema=None) as batch_op:
        batch_op.add_column(
            sa.Column("assigned_to_user_id", sqlmodel.sql.sqltypes.AutoString(), nullable=True)
        )
        batch_op.create_index(
            batch_op.f("ix_tasks_assigned_to_user_id"), ["assigned_to_user_id"], unique=False
        )

    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("tasks", schema=None) as batch_op:
        batch_op.drop_index(batch_op.f("ix_tasks_assigned_to_user_id"))
        batch_op.drop_column("assigned_to_user_id")

    # ### end Alembic commands ###
