"""Add SpecificCollectionConfiguration

Revision ID: 641cbe0d7779
Revises: 619c67750c15
Create Date: 2026-07-09 19:28:48.444781

"""
from typing import Sequence, Union

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

# revision identifiers, used by Alembic.
revision: str = '641cbe0d7779'
down_revision: Union[str, None] = '619c67750c15'
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('specific_collection_configurations',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('product_id', sa.Integer(), nullable=False),
    sa.Column('collection_type', sa.String(length=100), nullable=False),
    sa.Column('park_collection', sa.Boolean(), nullable=False),
    sa.Column('metadata_config', sa.JSON(), nullable=True),
    sa.Column('version', sa.Integer(), nullable=False),
    sa.Column('is_active', sa.Boolean(), nullable=False),
    sa.Column('effective_from', sa.DateTime(timezone=True), nullable=False),
    sa.Column('effective_to', sa.DateTime(timezone=True), nullable=True),
    sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
    sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
    sa.Column('created_by', sa.String(length=100), nullable=True),
    sa.Column('updated_by', sa.String(length=100), nullable=True),
    sa.ForeignKeyConstraint(['product_id'], ['products.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_specific_collection_configurations_id'), 'specific_collection_configurations', ['id'], unique=False)
    op.drop_column('allocation_configurations', 'park_advance_collection')
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('allocation_configurations', sa.Column('park_advance_collection', mysql.TINYINT(display_width=1), server_default=sa.text("'0'"), autoincrement=False, nullable=False))
    op.drop_index(op.f('ix_specific_collection_configurations_id'), table_name='specific_collection_configurations')
    op.drop_table('specific_collection_configurations')
    # ### end Alembic commands ###

