"""task_claims — a task can say a session is working it (milestone 381 step 2) Revision ID: 0110 Revises: 0109 Create Date: 2026-09-23 `status` is durable and nothing clears it, so `in_progress` cannot also mean "someone is on this now". The claim is that second meaning, stored as WHO and WHEN rather than as a flag, so it can be read as dead without anything having cleared it (`services/task_claims.py` has the semantics). Four nullable columns, no backfill: no existing row has ever been claimed, and inventing a claim for one would assert attention nobody observed. No CHECK enum is touched. """ import sqlalchemy as sa from alembic import op revision = "0110" down_revision = "0109" branch_labels = None depends_on = None def upgrade() -> None: op.add_column("notes", sa.Column( "claimed_by", sa.Integer(), sa.ForeignKey("users.id", ondelete="SET NULL"), nullable=True, )) op.add_column("notes", sa.Column("claimed_at", sa.DateTime(timezone=True), nullable=True)) op.add_column("notes", sa.Column("claim_touched_at", sa.DateTime(timezone=True), nullable=True)) op.add_column("notes", sa.Column("claim_session", sa.Text(), nullable=True)) def downgrade() -> None: op.drop_column("notes", "claim_session") op.drop_column("notes", "claim_touched_at") op.drop_column("notes", "claimed_at") op.drop_column("notes", "claimed_by")