"""add_source_is_active_to_global_tags_and_literature_id_index

Revision ID: 57a77b787817
Revises: 9e0f7def15ee
Create Date: 2026-07-15 12:21:09.541922
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

revision: str = '57a77b787817'
down_revision: Union[str, None] = '9e0f7def15ee'
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_index('ix_glt_literature', 'global_literature_tags', ['literature_id'], unique=False)
    op.add_column('global_tags', sa.Column('source', sa.String(length=20), server_default='auto', nullable=False))
    op.add_column('global_tags', sa.Column('is_active', sa.Boolean(), server_default='false', nullable=False))
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('global_tags', 'is_active')
    op.drop_column('global_tags', 'source')
    op.drop_index('ix_glt_literature', table_name='global_literature_tags')
    # ### end Alembic commands ###
