"""add gallery featuring columns to trees and script_templates

Revision ID: 9094262a4be3
Revises: b09c3789b7e6
Create Date: 2026-03-19 19:07:25.964399

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


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


def upgrade() -> None:
    # Add gallery featuring columns to trees
    op.add_column('trees', sa.Column('is_gallery_featured', sa.Boolean(), nullable=False, server_default=sa.text('false')))
    op.add_column('trees', sa.Column('gallery_sort_order', sa.Integer(), nullable=False, server_default=sa.text('0')))
    op.create_index(op.f('ix_trees_is_gallery_featured'), 'trees', ['is_gallery_featured'], unique=False)

    # Add gallery featuring columns to script_templates
    op.add_column('script_templates', sa.Column('is_gallery_featured', sa.Boolean(), nullable=False, server_default=sa.text('false')))
    op.add_column('script_templates', sa.Column('gallery_sort_order', sa.Integer(), nullable=False, server_default=sa.text('0')))
    op.create_index(op.f('ix_script_templates_is_gallery_featured'), 'script_templates', ['is_gallery_featured'], unique=False)


def downgrade() -> None:
    op.drop_index(op.f('ix_script_templates_is_gallery_featured'), table_name='script_templates')
    op.drop_column('script_templates', 'gallery_sort_order')
    op.drop_column('script_templates', 'is_gallery_featured')

    op.drop_index(op.f('ix_trees_is_gallery_featured'), table_name='trees')
    op.drop_column('trees', 'gallery_sort_order')
    op.drop_column('trees', 'is_gallery_featured')
