"""make clone_mode nullable

Revision ID: 2026_06_13_make_clone_mode_nullable
Revises: 86cec91fdb00
Create Date: 2026-06-13 10:00:00.000000
"""

from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = "2026_06_13_make_clone_mode_nullable"
down_revision = "86cec91fdb00"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # The workspace-first cleanup no longer writes clone_mode; existing rows
    # keep their value, but new rows may be NULL.
    op.alter_column(
        "tool_instances",
        "clone_mode",
        existing_type=sa.String(20),
        nullable=True,
    )


def downgrade() -> None:
    op.alter_column(
        "tool_instances",
        "clone_mode",
        existing_type=sa.String(20),
        nullable=False,
    )
