"""add task completed_by_user_id

Revision ID: 96a2f32bb179
Revises: 883488224db5
Create Date: 2026-05-06 00:50:45.583893

"""

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 = "96a2f32bb179"
down_revision: str | None = "883488224db5"
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("completed_by_user_id", sqlmodel.sql.sqltypes.AutoString(), nullable=True)
        )
        batch_op.create_index(
            batch_op.f("ix_tasks_completed_by_user_id"), ["completed_by_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_completed_by_user_id"))
        batch_op.drop_column("completed_by_user_id")

    # ### end Alembic commands ###
