"""Add deployed by column

Revision ID: 5ce23893771f
Revises: 82ff1541f4b4
Create Date: 2024-11-07 14:03:31.833443

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = "5ce23893771f"
down_revision: Union[str, None] = "82ff1541f4b4"
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.add_column(
        "arbitrum_one_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_arbitrum_one_contracts_deployed_by"),
        "arbitrum_one_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "arbitrum_sepolia_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_arbitrum_sepolia_contracts_deployed_by"),
        "arbitrum_sepolia_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "b3_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_b3_contracts_deployed_by"),
        "b3_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "b3_sepolia_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_b3_sepolia_contracts_deployed_by"),
        "b3_sepolia_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "ethereum_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_ethereum_contracts_deployed_by"),
        "ethereum_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "game7_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_game7_contracts_deployed_by"),
        "game7_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "game7_orbit_arbitrum_sepolia_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_game7_orbit_arbitrum_sepolia_contracts_deployed_by"),
        "game7_orbit_arbitrum_sepolia_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "game7_testnet_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_game7_testnet_contracts_deployed_by"),
        "game7_testnet_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "imx_zkevm_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_imx_zkevm_contracts_deployed_by"),
        "imx_zkevm_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "imx_zkevm_sepolia_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_imx_zkevm_sepolia_contracts_deployed_by"),
        "imx_zkevm_sepolia_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "mantle_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_mantle_contracts_deployed_by"),
        "mantle_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "mantle_sepolia_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_mantle_sepolia_contracts_deployed_by"),
        "mantle_sepolia_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "polygon_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_polygon_contracts_deployed_by"),
        "polygon_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "sepolia_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_sepolia_contracts_deployed_by"),
        "sepolia_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "xai_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_xai_contracts_deployed_by"),
        "xai_contracts",
        ["deployed_by"],
        unique=False,
    )
    op.add_column(
        "xai_sepolia_contracts",
        sa.Column("deployed_by", sa.LargeBinary(length=20), nullable=False),
    )
    op.create_index(
        op.f("ix_xai_sepolia_contracts_deployed_by"),
        "xai_sepolia_contracts",
        ["deployed_by"],
        unique=False,
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(
        op.f("ix_xai_sepolia_contracts_deployed_by"), table_name="xai_sepolia_contracts"
    )
    op.drop_column("xai_sepolia_contracts", "deployed_by")
    op.drop_index(op.f("ix_xai_contracts_deployed_by"), table_name="xai_contracts")
    op.drop_column("xai_contracts", "deployed_by")
    op.drop_index(
        op.f("ix_sepolia_contracts_deployed_by"), table_name="sepolia_contracts"
    )
    op.drop_column("sepolia_contracts", "deployed_by")
    op.drop_index(
        op.f("ix_polygon_contracts_deployed_by"), table_name="polygon_contracts"
    )
    op.drop_column("polygon_contracts", "deployed_by")
    op.drop_index(
        op.f("ix_mantle_sepolia_contracts_deployed_by"),
        table_name="mantle_sepolia_contracts",
    )
    op.drop_column("mantle_sepolia_contracts", "deployed_by")
    op.drop_index(
        op.f("ix_mantle_contracts_deployed_by"), table_name="mantle_contracts"
    )
    op.drop_column("mantle_contracts", "deployed_by")
    op.drop_index(
        op.f("ix_imx_zkevm_sepolia_contracts_deployed_by"),
        table_name="imx_zkevm_sepolia_contracts",
    )
    op.drop_column("imx_zkevm_sepolia_contracts", "deployed_by")
    op.drop_index(
        op.f("ix_imx_zkevm_contracts_deployed_by"), table_name="imx_zkevm_contracts"
    )
    op.drop_column("imx_zkevm_contracts", "deployed_by")
    op.drop_index(
        op.f("ix_game7_testnet_contracts_deployed_by"),
        table_name="game7_testnet_contracts",
    )
    op.drop_column("game7_testnet_contracts", "deployed_by")
    op.drop_index(
        op.f("ix_game7_orbit_arbitrum_sepolia_contracts_deployed_by"),
        table_name="game7_orbit_arbitrum_sepolia_contracts",
    )
    op.drop_column("game7_orbit_arbitrum_sepolia_contracts", "deployed_by")
    op.drop_index(op.f("ix_game7_contracts_deployed_by"), table_name="game7_contracts")
    op.drop_column("game7_contracts", "deployed_by")
    op.drop_index(
        op.f("ix_ethereum_contracts_deployed_by"), table_name="ethereum_contracts"
    )
    op.drop_column("ethereum_contracts", "deployed_by")
    op.drop_index(
        op.f("ix_b3_sepolia_contracts_deployed_by"), table_name="b3_sepolia_contracts"
    )
    op.drop_column("b3_sepolia_contracts", "deployed_by")
    op.drop_index(op.f("ix_b3_contracts_deployed_by"), table_name="b3_contracts")
    op.drop_column("b3_contracts", "deployed_by")
    op.drop_index(
        op.f("ix_arbitrum_sepolia_contracts_deployed_by"),
        table_name="arbitrum_sepolia_contracts",
    )
    op.drop_column("arbitrum_sepolia_contracts", "deployed_by")
    op.drop_index(
        op.f("ix_arbitrum_one_contracts_deployed_by"),
        table_name="arbitrum_one_contracts",
    )
    op.drop_column("arbitrum_one_contracts", "deployed_by")
    # ### end Alembic commands ###
