"""add-usenet-columns

Revision ID: 333866afcd2c
Revises: aa4689f80796
Create Date: 2025-07-09 20:55:42.338629

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision: str = "333866afcd2c"
down_revision: Union[str, None] = "aa4689f80796"
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(
        "indexer_query_result",
        sa.Column(
            "usenet", sa.Boolean(), nullable=False, server_default=sa.text("false")
        ),
    )
    op.add_column(
        "indexer_query_result",
        sa.Column("age", sa.Integer(), nullable=False, server_default=sa.text("0")),
    )
    op.add_column(
        "torrent",
        sa.Column(
            "usenet", sa.Boolean(), nullable=False, server_default=sa.text("false")
        ),
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("torrent", "usenet")
    op.drop_column("indexer_query_result", "age")
    op.drop_column("indexer_query_result", "usenet")
    # ### end Alembic commands ###
