"""add_custom_emojis

Revision ID: fa8ec8756c9f
Revises: 1a9ae6818aaf
Create Date: 2026-11-18 05:30:43.526848

"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'fa8ec8756c9f'
down_revision: Union[str, None] = '1a9ae6818aaf'
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! ###
    op.create_table('emoji_packs',
    sa.Column('id', sa.UUID(), nullable=False),
    sa.Column('name', sa.String(length=128), nullable=False),
    sa.Column('title', sa.String(length=255), nullable=False),
    sa.Column('is_animated', sa.Boolean(), nullable=False),
    sa.Column('is_video', sa.Boolean(), nullable=False),
    sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
    sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_emoji_packs_name'), 'emoji_packs', ['name'], unique=True)
    op.create_table('custom_emojis',
    sa.Column('id', sa.UUID(), nullable=False),
    sa.Column('pack_id', sa.UUID(), nullable=True),
    sa.Column('custom_emoji_id', sa.String(length=64), nullable=False),
    sa.Column('name', sa.String(length=100), nullable=False),
    sa.Column('fallback_emoji', sa.String(length=16), nullable=False),
    sa.Column('category', sa.String(length=50), nullable=False),
    sa.Column('is_animated', sa.Boolean(), nullable=False),
    sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
    sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
    sa.ForeignKeyConstraint(['pack_id'], ['emoji_packs.id'], ondelete='SET NULL'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_custom_emojis_category'), 'custom_emojis', ['category'], unique=False)
    op.create_index(op.f('ix_custom_emojis_custom_emoji_id'), 'custom_emojis', ['custom_emoji_id'], unique=True)
    op.create_index(op.f('ix_custom_emojis_name'), 'custom_emojis', ['name'], unique=False)
    op.create_index(op.f('ix_custom_emojis_pack_id'), 'custom_emojis', ['pack_id'], unique=False)
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_custom_emojis_pack_id'), table_name='custom_emojis')
    op.drop_index(op.f('ix_custom_emojis_name'), table_name='custom_emojis')
    op.drop_index(op.f('ix_custom_emojis_custom_emoji_id'), table_name='custom_emojis')
    op.drop_index(op.f('ix_custom_emojis_category'), table_name='custom_emojis')
    op.drop_table('custom_emojis')
    op.drop_index(op.f('ix_emoji_packs_name'), table_name='emoji_packs')
    op.drop_table('emoji_packs')
    # ### end Alembic commands ###
