"""make canvas layer name unique

Revision ID: eda1c0c1f709
Revises: 31194f554323
Create Date: 2025-10-01 08:39:36.064092

"""

from typing import Sequence, Union

from airunner.components.art.data.canvas_layer import CanvasLayer
from airunner.utils.db.column import (
    create_unique_constraint,
    drop_column,
    drop_constraint,
)


# revision identifiers, used by Alembic.
revision: str = "eda1c0c1f709"
down_revision: Union[str, None] = "31194f554323"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    create_unique_constraint(
        CanvasLayer, ["name"], constraint_name="uq_canvas_layer_name"
    )
    drop_column(CanvasLayer, "mask")
    drop_column(CanvasLayer, "image")


def downgrade() -> None:
    drop_constraint(CanvasLayer, "uq_canvas_layer_name")
