"""add icon and color to custom types

Revision ID: bac5764d4496
Revises: f5fae279ec04
Create Date: 2026-02-14 12:10:26.415916

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision: str = 'bac5764d4496'
down_revision: Union[str, None] = 'f5fae279ec04'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('custom_types', sa.Column('icon', sa.String(), nullable=True))
    op.add_column('custom_types', sa.Column('color', sa.String(), nullable=True))
    op.alter_column('enricher_templates', 'content',
               existing_type=postgresql.JSONB(astext_type=sa.Text()),
               type_=sa.JSON(),
               existing_nullable=False)
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('enricher_templates', 'content',
               existing_type=sa.JSON(),
               type_=postgresql.JSONB(astext_type=sa.Text()),
               existing_nullable=False)
    op.drop_column('custom_types', 'color')
    op.drop_column('custom_types', 'icon')
    # ### end Alembic commands ###
