"""declarative indexes

Revision ID: c79044e047fe
Revises: dae735afc98f
Create Date: 2025-02-10 13:43:05.099092

"""
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 = 'c79044e047fe'
down_revision: Union[str, None] = 'dae735afc98f'
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_amoy_labels_label_addr_name', 'amoy_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_arbitrum_nova_labels_label_addr_name', 'arbitrum_nova_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_arbitrum_one_labels_label_addr_name', 'arbitrum_one_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_arbitrum_sepolia_labels_addr_block_ts', 'arbitrum_sepolia_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_arbitrum_sepolia_labels_label_addr_name', 'arbitrum_sepolia_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_avalanche_fuji_labels_addr_block_ts', 'avalanche_fuji_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_avalanche_fuji_labels_label_addr_name', 'avalanche_fuji_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_avalanche_labels_addr_block_ts', 'avalanche_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_avalanche_labels_label_addr_name', 'avalanche_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_b3_labels_label_addr_name', 'b3_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_b3_sepolia_labels_label_addr_name', 'b3_sepolia_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_base_labels_addr_block_ts', 'base_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_base_labels_label_addr_name', 'base_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_blast_labels_label_addr_name', 'blast_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_blast_sepolia_labels_label_addr_name', 'blast_sepolia_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_ethereum_labels_addr_block_ts', 'ethereum_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_ethereum_labels_label_addr_name', 'ethereum_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_game7_labels_label_addr_name', 'game7_labels', ['label', 'address', 'label_name'], unique=False)
    op.drop_index('ix_g7o_arbitrum_sepolia_labels_addr_block_num', table_name='game7_orbit_arbitrum_sepolia_labels')
    op.drop_index('ix_g7o_arbitrum_sepolia_labels_addr_block_ts', table_name='game7_orbit_arbitrum_sepolia_labels')
    op.drop_index('uk_g7o_arbitrum_sepolia_labels_tx_hash_log_idx_evt', table_name='game7_orbit_arbitrum_sepolia_labels', postgresql_where="(((label)::text = 'seer'::text) AND ((label_type)::text = 'event'::text))")
    op.drop_index('uk_g7o_arbitrum_sepolia_labels_tx_hash_log_idx_evt_raw', table_name='game7_orbit_arbitrum_sepolia_labels', postgresql_where="(((label)::text = 'seer-raw'::text) AND ((label_type)::text = 'event'::text))")
    op.drop_index('uk_g7o_arbitrum_sepolia_labels_tx_hash_tx_call', table_name='game7_orbit_arbitrum_sepolia_labels', postgresql_where="(((label)::text = 'seer'::text) AND ((label_type)::text = 'tx_call'::text))")
    op.drop_index('uk_g7o_arbitrum_sepolia_labels_tx_hash_tx_call_raw', table_name='game7_orbit_arbitrum_sepolia_labels', postgresql_where="(((label)::text = 'seer-raw'::text) AND ((label_type)::text = 'tx_call'::text))")
    op.create_index('ix_game7_orbit_arbitrum_sepolia_labels_addr_block_num', 'game7_orbit_arbitrum_sepolia_labels', ['address', 'block_number'], unique=False)
    op.create_index('ix_game7_orbit_arbitrum_sepolia_labels_addr_block_ts', 'game7_orbit_arbitrum_sepolia_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_game7_orbit_arbitrum_sepolia_labels_label_addr_name', 'game7_orbit_arbitrum_sepolia_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('uk_game7_orbit_arbitrum_sepolia_labels_tx_hash_log_idx_evt', 'game7_orbit_arbitrum_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'"))
    op.create_index('uk_game7_orbit_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_game7_orbit_arbitrum_sepolia_labels_tx_hash_tx_call', 'game7_orbit_arbitrum_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'"))
    op.create_index('uk_game7_orbit_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('ix_game7_testnet_labels_label_addr_name', 'game7_testnet_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_imx_zkevm_labels_label_addr_name', 'imx_zkevm_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_imx_zkevm_sepolia_labels_label_addr_name', 'imx_zkevm_sepolia_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_mantle_labels_label_addr_name', 'mantle_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_mantle_sepolia_labels_label_addr_name', 'mantle_sepolia_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_mumbai_labels_addr_block_ts', 'mumbai_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_mumbai_labels_label_addr_name', 'mumbai_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_polygon_labels_addr_block_ts', 'polygon_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_polygon_labels_label_addr_name', 'polygon_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_proofofplay_apex_labels_label_addr_name', 'proofofplay_apex_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_ronin_labels_label_addr_name', 'ronin_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_ronin_saigon_labels_label_addr_name', 'ronin_saigon_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_sepolia_labels_addr_block_ts', 'sepolia_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_sepolia_labels_label_addr_name', 'sepolia_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_starknet_labels_addr_block_ts', 'starknet_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_starknet_labels_label_addr_name', 'starknet_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_starknet_sepolia_labels_addr_block_ts', 'starknet_sepolia_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_starknet_sepolia_labels_label_addr_name', 'starknet_sepolia_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_xai_labels_addr_block_ts', 'xai_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_xai_labels_label_addr_name', 'xai_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_xai_sepolia_labels_addr_block_ts', 'xai_sepolia_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_xai_sepolia_labels_label_addr_name', 'xai_sepolia_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_xdai_labels_addr_block_ts', 'xdai_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_xdai_labels_label_addr_name', 'xdai_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_zksync_era_labels_addr_block_ts', 'zksync_era_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_zksync_era_labels_label_addr_name', 'zksync_era_labels', ['label', 'address', 'label_name'], unique=False)
    op.create_index('ix_zksync_era_sepolia_labels_addr_block_ts', 'zksync_era_sepolia_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_zksync_era_sepolia_labels_label_addr_name', 'zksync_era_sepolia_labels', ['label', 'address', 'label_name'], unique=False)
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('ix_zksync_era_sepolia_labels_label_addr_name', table_name='zksync_era_sepolia_labels')
    op.drop_index('ix_zksync_era_sepolia_labels_addr_block_ts', table_name='zksync_era_sepolia_labels')
    op.drop_index('ix_zksync_era_labels_label_addr_name', table_name='zksync_era_labels')
    op.drop_index('ix_zksync_era_labels_addr_block_ts', table_name='zksync_era_labels')
    op.drop_index('ix_xdai_labels_label_addr_name', table_name='xdai_labels')
    op.drop_index('ix_xdai_labels_addr_block_ts', table_name='xdai_labels')
    op.drop_index('ix_xai_sepolia_labels_label_addr_name', table_name='xai_sepolia_labels')
    op.drop_index('ix_xai_sepolia_labels_addr_block_ts', table_name='xai_sepolia_labels')
    op.drop_index('ix_xai_labels_label_addr_name', table_name='xai_labels')
    op.drop_index('ix_xai_labels_addr_block_ts', table_name='xai_labels')
    op.drop_index('ix_starknet_sepolia_labels_label_addr_name', table_name='starknet_sepolia_labels')
    op.drop_index('ix_starknet_sepolia_labels_addr_block_ts', table_name='starknet_sepolia_labels')
    op.drop_index('ix_starknet_labels_label_addr_name', table_name='starknet_labels')
    op.drop_index('ix_starknet_labels_addr_block_ts', table_name='starknet_labels')
    op.drop_index('ix_sepolia_labels_label_addr_name', table_name='sepolia_labels')
    op.drop_index('ix_sepolia_labels_addr_block_ts', table_name='sepolia_labels')
    op.drop_index('ix_ronin_saigon_labels_label_addr_name', table_name='ronin_saigon_labels')
    op.drop_index('ix_ronin_labels_label_addr_name', table_name='ronin_labels')
    op.drop_index('ix_proofofplay_apex_labels_label_addr_name', table_name='proofofplay_apex_labels')
    op.drop_index('ix_polygon_labels_label_addr_name', table_name='polygon_labels')
    op.drop_index('ix_polygon_labels_addr_block_ts', table_name='polygon_labels')
    op.drop_index('ix_mumbai_labels_label_addr_name', table_name='mumbai_labels')
    op.drop_index('ix_mumbai_labels_addr_block_ts', table_name='mumbai_labels')
    op.drop_index('ix_mantle_sepolia_labels_label_addr_name', table_name='mantle_sepolia_labels')
    op.drop_index('ix_mantle_labels_label_addr_name', table_name='mantle_labels')
    op.drop_index('ix_imx_zkevm_sepolia_labels_label_addr_name', table_name='imx_zkevm_sepolia_labels')
    op.drop_index('ix_imx_zkevm_labels_label_addr_name', table_name='imx_zkevm_labels')
    op.drop_index('ix_game7_testnet_labels_label_addr_name', table_name='game7_testnet_labels')
    op.drop_index('uk_game7_orbit_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_game7_orbit_arbitrum_sepolia_labels_tx_hash_tx_call', table_name='game7_orbit_arbitrum_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'"))
    op.drop_index('uk_game7_orbit_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_game7_orbit_arbitrum_sepolia_labels_tx_hash_log_idx_evt', table_name='game7_orbit_arbitrum_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'"))
    op.drop_index('ix_game7_orbit_arbitrum_sepolia_labels_label_addr_name', table_name='game7_orbit_arbitrum_sepolia_labels')
    op.drop_index('ix_game7_orbit_arbitrum_sepolia_labels_addr_block_ts', table_name='game7_orbit_arbitrum_sepolia_labels')
    op.drop_index('ix_game7_orbit_arbitrum_sepolia_labels_addr_block_num', table_name='game7_orbit_arbitrum_sepolia_labels')
    op.create_index('uk_g7o_arbitrum_sepolia_labels_tx_hash_tx_call_raw', 'game7_orbit_arbitrum_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where="(((label)::text = 'seer-raw'::text) AND ((label_type)::text = 'tx_call'::text))")
    op.create_index('uk_g7o_arbitrum_sepolia_labels_tx_hash_tx_call', 'game7_orbit_arbitrum_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where="(((label)::text = 'seer'::text) AND ((label_type)::text = 'tx_call'::text))")
    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="(((label)::text = 'seer-raw'::text) AND ((label_type)::text = 'event'::text))")
    op.create_index('uk_g7o_arbitrum_sepolia_labels_tx_hash_log_idx_evt', 'game7_orbit_arbitrum_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where="(((label)::text = 'seer'::text) AND ((label_type)::text = 'event'::text))")
    op.create_index('ix_g7o_arbitrum_sepolia_labels_addr_block_ts', 'game7_orbit_arbitrum_sepolia_labels', ['address', 'block_timestamp'], unique=False)
    op.create_index('ix_g7o_arbitrum_sepolia_labels_addr_block_num', 'game7_orbit_arbitrum_sepolia_labels', ['address', 'block_number'], unique=False)
    op.drop_index('ix_game7_labels_label_addr_name', table_name='game7_labels')
    op.drop_index('ix_ethereum_labels_label_addr_name', table_name='ethereum_labels')
    op.drop_index('ix_ethereum_labels_addr_block_ts', table_name='ethereum_labels')
    op.drop_index('ix_blast_sepolia_labels_label_addr_name', table_name='blast_sepolia_labels')
    op.drop_index('ix_blast_labels_label_addr_name', table_name='blast_labels')
    op.drop_index('ix_base_labels_label_addr_name', table_name='base_labels')
    op.drop_index('ix_base_labels_addr_block_ts', table_name='base_labels')
    op.drop_index('ix_b3_sepolia_labels_label_addr_name', table_name='b3_sepolia_labels')
    op.drop_index('ix_b3_labels_label_addr_name', table_name='b3_labels')
    op.drop_index('ix_avalanche_labels_label_addr_name', table_name='avalanche_labels')
    op.drop_index('ix_avalanche_labels_addr_block_ts', table_name='avalanche_labels')
    op.drop_index('ix_avalanche_fuji_labels_label_addr_name', table_name='avalanche_fuji_labels')
    op.drop_index('ix_avalanche_fuji_labels_addr_block_ts', table_name='avalanche_fuji_labels')
    op.drop_index('ix_arbitrum_sepolia_labels_label_addr_name', table_name='arbitrum_sepolia_labels')
    op.drop_index('ix_arbitrum_sepolia_labels_addr_block_ts', table_name='arbitrum_sepolia_labels')
    op.drop_index('ix_arbitrum_one_labels_label_addr_name', table_name='arbitrum_one_labels')
    op.drop_index('ix_arbitrum_nova_labels_label_addr_name', table_name='arbitrum_nova_labels')
    op.drop_index('ix_amoy_labels_label_addr_name', table_name='amoy_labels')
    # ### end Alembic commands ###
