"""seer raw index

Revision ID: 090c247f8618
Revises: 2e90b758090c
Create Date: 2024-07-24 14:55:15.986453

"""

from typing import Sequence, Union

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

# revision identifiers, used by Alembic.
revision: str = "090c247f8618"
down_revision: Union[str, None] = "2e90b758090c"
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(
        "uk_amoy_labels_tx_hash_log_idx_evt_raw",
        "amoy_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_amoy_labels_tx_hash_tx_call_raw",
        "amoy_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_arbitrum_nova_labels_tx_hash_log_idx_evt_raw",
        "arbitrum_nova_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_arbitrum_nova_labels_tx_hash_tx_call_raw",
        "arbitrum_nova_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_arbitrum_one_labels_tx_hash_log_idx_evt_raw",
        "arbitrum_one_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_arbitrum_one_labels_tx_hash_tx_call_raw",
        "arbitrum_one_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_arbitrum_sepolia_labels_tx_hash_log_idx_evt_raw",
        "arbitrum_sepolia_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_arbitrum_sepolia_labels_tx_hash_tx_call_raw",
        "arbitrum_sepolia_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_avalanche_fuji_labels_tx_hash_log_idx_evt_raw",
        "avalanche_fuji_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_avalanche_fuji_labels_tx_hash_tx_call_raw",
        "avalanche_fuji_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_avalanche_labels_tx_hash_log_idx_evt_raw",
        "avalanche_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_avalanche_labels_tx_hash_tx_call_raw",
        "avalanche_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_base_labels_tx_hash_log_idx_evt_raw",
        "base_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_base_labels_tx_hash_tx_call_raw",
        "base_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_blast_labels_tx_hash_log_idx_evt_raw",
        "blast_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_blast_labels_tx_hash_tx_call_raw",
        "blast_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_blast_sepolia_labels_tx_hash_log_idx_evt_raw",
        "blast_sepolia_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_blast_sepolia_labels_tx_hash_tx_call_raw",
        "blast_sepolia_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_ethereum_labels_tx_hash_log_idx_evt_raw",
        "ethereum_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_ethereum_labels_tx_hash_tx_call_raw",
        "ethereum_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_g7o_arbitrum_sepolia_labels_tx_hash_log_idx_evt_raw",
        "game7_orbit_arbitrum_sepolia_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_g7o_arbitrum_sepolia_labels_tx_hash_tx_call_raw",
        "game7_orbit_arbitrum_sepolia_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_mantle_labels_tx_hash_log_idx_evt_raw",
        "mantle_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_mantle_labels_tx_hash_tx_call_raw",
        "mantle_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_mantle_sepolia_labels_tx_hash_log_idx_evt_raw",
        "mantle_sepolia_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_mantle_sepolia_labels_tx_hash_tx_call_raw",
        "mantle_sepolia_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_mumbai_labels_tx_hash_log_idx_evt_raw",
        "mumbai_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_mumbai_labels_tx_hash_tx_call_raw",
        "mumbai_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_polygon_labels_tx_hash_log_idx_evt_raw",
        "polygon_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_polygon_labels_tx_hash_tx_call_raw",
        "polygon_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_proofofplay_apex_labels_tx_hash_log_idx_evt_raw",
        "proofofplay_apex_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_proofofplay_apex_labels_tx_hash_tx_call_raw",
        "proofofplay_apex_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_sepolia_labels_tx_hash_log_idx_evt_raw",
        "sepolia_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_sepolia_labels_tx_hash_tx_call_raw",
        "sepolia_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_starknet_labels_tx_hash_log_idx_evt_raw",
        "starknet_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_starknet_labels_tx_hash_tx_call_raw",
        "starknet_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_starknet_sepolia_labels_tx_hash_log_idx_evt_raw",
        "starknet_sepolia_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_starknet_sepolia_labels_tx_hash_tx_call_raw",
        "starknet_sepolia_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_xai_labels_tx_hash_log_idx_evt_raw",
        "xai_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_xai_labels_tx_hash_tx_call_raw",
        "xai_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_xai_sepolia_labels_tx_hash_log_idx_evt_raw",
        "xai_sepolia_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_xai_sepolia_labels_tx_hash_tx_call_raw",
        "xai_sepolia_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_xdai_labels_tx_hash_log_idx_evt_raw",
        "xdai_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_xdai_labels_tx_hash_tx_call_raw",
        "xdai_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_zksync_era_labels_tx_hash_log_idx_evt_raw",
        "zksync_era_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_zksync_era_labels_tx_hash_tx_call_raw",
        "zksync_era_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.create_index(
        "uk_zksync_era_sepolia_labels_tx_hash_log_idx_evt_raw",
        "zksync_era_sepolia_labels",
        ["transaction_hash", "log_index"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.create_index(
        "uk_zksync_era_sepolia_labels_tx_hash_tx_call_raw",
        "zksync_era_sepolia_labels",
        ["transaction_hash"],
        unique=True,
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(
        "uk_zksync_era_sepolia_labels_tx_hash_tx_call_raw",
        table_name="zksync_era_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_zksync_era_sepolia_labels_tx_hash_log_idx_evt_raw",
        table_name="zksync_era_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_zksync_era_labels_tx_hash_tx_call_raw",
        table_name="zksync_era_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_zksync_era_labels_tx_hash_log_idx_evt_raw",
        table_name="zksync_era_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_xdai_labels_tx_hash_tx_call_raw",
        table_name="xdai_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_xdai_labels_tx_hash_log_idx_evt_raw",
        table_name="xdai_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_xai_sepolia_labels_tx_hash_tx_call_raw",
        table_name="xai_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_xai_sepolia_labels_tx_hash_log_idx_evt_raw",
        table_name="xai_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_xai_labels_tx_hash_tx_call_raw",
        table_name="xai_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_xai_labels_tx_hash_log_idx_evt_raw",
        table_name="xai_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_starknet_sepolia_labels_tx_hash_tx_call_raw",
        table_name="starknet_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_starknet_sepolia_labels_tx_hash_log_idx_evt_raw",
        table_name="starknet_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_starknet_labels_tx_hash_tx_call_raw",
        table_name="starknet_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_starknet_labels_tx_hash_log_idx_evt_raw",
        table_name="starknet_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_sepolia_labels_tx_hash_tx_call_raw",
        table_name="sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_sepolia_labels_tx_hash_log_idx_evt_raw",
        table_name="sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_proofofplay_apex_labels_tx_hash_tx_call_raw",
        table_name="proofofplay_apex_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_proofofplay_apex_labels_tx_hash_log_idx_evt_raw",
        table_name="proofofplay_apex_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_polygon_labels_tx_hash_tx_call_raw",
        table_name="polygon_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_polygon_labels_tx_hash_log_idx_evt_raw",
        table_name="polygon_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_mumbai_labels_tx_hash_tx_call_raw",
        table_name="mumbai_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_mumbai_labels_tx_hash_log_idx_evt_raw",
        table_name="mumbai_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_mantle_sepolia_labels_tx_hash_tx_call_raw",
        table_name="mantle_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_mantle_sepolia_labels_tx_hash_log_idx_evt_raw",
        table_name="mantle_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_mantle_labels_tx_hash_tx_call_raw",
        table_name="mantle_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_mantle_labels_tx_hash_log_idx_evt_raw",
        table_name="mantle_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_g7o_arbitrum_sepolia_labels_tx_hash_tx_call_raw",
        table_name="game7_orbit_arbitrum_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_g7o_arbitrum_sepolia_labels_tx_hash_log_idx_evt_raw",
        table_name="game7_orbit_arbitrum_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_ethereum_labels_tx_hash_tx_call_raw",
        table_name="ethereum_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_ethereum_labels_tx_hash_log_idx_evt_raw",
        table_name="ethereum_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_blast_sepolia_labels_tx_hash_tx_call_raw",
        table_name="blast_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_blast_sepolia_labels_tx_hash_log_idx_evt_raw",
        table_name="blast_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_blast_labels_tx_hash_tx_call_raw",
        table_name="blast_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_blast_labels_tx_hash_log_idx_evt_raw",
        table_name="blast_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_base_labels_tx_hash_tx_call_raw",
        table_name="base_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_base_labels_tx_hash_log_idx_evt_raw",
        table_name="base_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_avalanche_labels_tx_hash_tx_call_raw",
        table_name="avalanche_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_avalanche_labels_tx_hash_log_idx_evt_raw",
        table_name="avalanche_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_avalanche_fuji_labels_tx_hash_tx_call_raw",
        table_name="avalanche_fuji_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_avalanche_fuji_labels_tx_hash_log_idx_evt_raw",
        table_name="avalanche_fuji_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_arbitrum_sepolia_labels_tx_hash_tx_call_raw",
        table_name="arbitrum_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_arbitrum_sepolia_labels_tx_hash_log_idx_evt_raw",
        table_name="arbitrum_sepolia_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_arbitrum_one_labels_tx_hash_tx_call_raw",
        table_name="arbitrum_one_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_arbitrum_one_labels_tx_hash_log_idx_evt_raw",
        table_name="arbitrum_one_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_arbitrum_nova_labels_tx_hash_tx_call_raw",
        table_name="arbitrum_nova_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_arbitrum_nova_labels_tx_hash_log_idx_evt_raw",
        table_name="arbitrum_nova_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    op.drop_index(
        "uk_amoy_labels_tx_hash_tx_call_raw",
        table_name="amoy_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='tx_call'"),
    )
    op.drop_index(
        "uk_amoy_labels_tx_hash_log_idx_evt_raw",
        table_name="amoy_labels",
        postgresql_where=sa.text("label='seer-raw' and label_type='event'"),
    )
    # ### end Alembic commands ###
