From 54c83a371a687142438f6f70d3ffc10e6d450fe3 Mon Sep 17 00:00:00 2001 From: Andrey Date: Sat, 18 May 2024 13:04:12 +0300 Subject: [PATCH 1/3] Add uniqiue indexes for tx_call/event under seer label. --- ...33be47_tx_call_and_event_unique_indexes.py | 184 ++++++++++++ moonstreamdb-v3/moonstreamdbv3/models.py | 278 +++++++++++++++++- moonstreamdb-v3/moonstreamdbv3/version.txt | 2 +- 3 files changed, 462 insertions(+), 2 deletions(-) create mode 100644 moonstreamdb-v3/moonstreamdbv3/alembic/versions/d2ceff33be47_tx_call_and_event_unique_indexes.py diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic/versions/d2ceff33be47_tx_call_and_event_unique_indexes.py b/moonstreamdb-v3/moonstreamdbv3/alembic/versions/d2ceff33be47_tx_call_and_event_unique_indexes.py new file mode 100644 index 00000000..5ce1f46e --- /dev/null +++ b/moonstreamdb-v3/moonstreamdbv3/alembic/versions/d2ceff33be47_tx_call_and_event_unique_indexes.py @@ -0,0 +1,184 @@ +"""tx call and event unique indexes + +Revision ID: d2ceff33be47 +Revises: e9f640a2b45b +Create Date: 2024-05-17 16:35:56.059519 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = 'd2ceff33be47' +down_revision: Union[str, None] = 'e9f640a2b45b' +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_transaction_hash_log_index_event', 'amoy_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_amoy_labels_transaction_hash_tx_call', 'amoy_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_amoy_labels_id'), 'amoy_labels', ['id']) + op.create_index('uk_arbitrum_nova_labels_transaction_hash_log_index_event', 'arbitrum_nova_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_arbitrum_nova_labels_transaction_hash_tx_call', 'arbitrum_nova_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_arbitrum_nova_labels_id'), 'arbitrum_nova_labels', ['id']) + op.create_index('uk_arbitrum_one_labels_transaction_hash_log_index_event', 'arbitrum_one_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_arbitrum_one_labels_transaction_hash_tx_call', 'arbitrum_one_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_arbitrum_one_labels_id'), 'arbitrum_one_labels', ['id']) + op.create_index('ix_arbitrum_sepolia_labels_addr_block_ts', 'arbitrum_sepolia_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_arbitrum_sepolia_labels_transaction_hash_log_index_event', 'arbitrum_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_arbitrum_sepolia_labels_transaction_hash_tx_call', 'arbitrum_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_arbitrum_sepolia_labels_id'), 'arbitrum_sepolia_labels', ['id']) + op.create_index('ix_avalanche_fuji_labels_addr_block_ts', 'avalanche_fuji_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_avalanche_fuji_labels_transaction_hash_log_index_event', 'avalanche_fuji_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_avalanche_fuji_labels_transaction_hash_tx_call', 'avalanche_fuji_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_avalanche_fuji_labels_id'), 'avalanche_fuji_labels', ['id']) + op.create_index('ix_avalanche_labels_addr_block_ts', 'avalanche_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_avalanche_labels_transaction_hash_log_index_event', 'avalanche_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_avalanche_labels_transaction_hash_tx_call', 'avalanche_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_avalanche_labels_id'), 'avalanche_labels', ['id']) + op.create_index('ix_base_labels_addr_block_ts', 'base_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_base_labels_transaction_hash_log_index_event', 'base_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_base_labels_transaction_hash_tx_call', 'base_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_base_labels_id'), 'base_labels', ['id']) + op.create_index('uk_blast_labels_transaction_hash_log_index_event', 'blast_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_blast_labels_transaction_hash_tx_call', 'blast_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_blast_labels_id'), 'blast_labels', ['id']) + op.create_index('uk_blast_sepolia_labels_transaction_hash_log_index_event', 'blast_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_blast_sepolia_labels_transaction_hash_tx_call', 'blast_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_blast_sepolia_labels_id'), 'blast_sepolia_labels', ['id']) + op.create_index('ix_ethereum_labels_addr_block_ts', 'ethereum_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_ethereum_labels_transaction_hash_log_index_event', 'ethereum_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_ethereum_labels_transaction_hash_tx_call', 'ethereum_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_ethereum_labels_id'), 'ethereum_labels', ['id']) + op.create_index('ix_mumbai_labels_addr_block_ts', 'mumbai_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_mumbai_labels_transaction_hash_log_index_event', 'mumbai_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_mumbai_labels_transaction_hash_tx_call', 'mumbai_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_mumbai_labels_id'), 'mumbai_labels', ['id']) + op.create_index('ix_polygon_labels_addr_block_ts', 'polygon_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_polygon_labels_transaction_hash_log_index_event', 'polygon_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_polygon_labels_transaction_hash_tx_call', 'polygon_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_polygon_labels_id'), 'polygon_labels', ['id']) + op.create_index('uk_proofofplay_apex_labels_transaction_hash_log_index_event', 'proofofplay_apex_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_proofofplay_apex_labels_transaction_hash_tx_call', 'proofofplay_apex_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_proofofplay_apex_labels_id'), 'proofofplay_apex_labels', ['id']) + op.create_index('ix_sepolia_labels_addr_block_ts', 'sepolia_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_sepolia_labels_transaction_hash_log_index_event', 'sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_sepolia_labels_transaction_hash_tx_call', 'sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_sepolia_labels_id'), 'sepolia_labels', ['id']) + op.create_index('ix_starknet_labels_addr_block_ts', 'starknet_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_starknet_labels_transaction_hash_log_index_event', 'starknet_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_starknet_labels_transaction_hash_tx_call', 'starknet_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_starknet_labels_id'), 'starknet_labels', ['id']) + op.create_index('ix_starknet_sepolia_labels_addr_block_ts', 'starknet_sepolia_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_starknet_sepolia_labels_transaction_hash_log_index_event', 'starknet_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_starknet_sepolia_labels_transaction_hash_tx_call', 'starknet_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_starknet_sepolia_labels_id'), 'starknet_sepolia_labels', ['id']) + op.create_index('ix_xai_labels_addr_block_ts', 'xai_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_xai_labels_transaction_hash_log_index_event', 'xai_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_xai_labels_transaction_hash_tx_call', 'xai_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_xai_labels_id'), 'xai_labels', ['id']) + op.create_index('ix_xai_sepolia_labels_addr_block_ts', 'xai_sepolia_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_xai_sepolia_labels_transaction_hash_log_index_event', 'xai_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_xai_sepolia_labels_transaction_hash_tx_call', 'xai_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_xai_sepolia_labels_id'), 'xai_sepolia_labels', ['id']) + op.create_index('ix_xdai_labels_addr_block_ts', 'xdai_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_xdai_labels_transaction_hash_log_index_event', 'xdai_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_xdai_labels_transaction_hash_tx_call', 'xdai_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_xdai_labels_id'), 'xdai_labels', ['id']) + op.create_index('ix_zksync_era_labels_addr_block_ts', 'zksync_era_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_zksync_era_labels_transaction_hash_log_index_event', 'zksync_era_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_zksync_era_labels_transaction_hash_tx_call', 'zksync_era_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_zksync_era_labels_id'), 'zksync_era_labels', ['id']) + op.create_index('ix_zksync_era_sepolia_labels_addr_block_ts', 'zksync_era_sepolia_labels', ['address', 'block_timestamp'], unique=False) + op.create_index('uk_zksync_era_sepolia_labels_transaction_hash_log_index_event', 'zksync_era_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_zksync_era_sepolia_labels_transaction_hash_tx_call', 'zksync_era_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_unique_constraint(op.f('uq_zksync_era_sepolia_labels_id'), 'zksync_era_sepolia_labels', ['id']) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_constraint(op.f('uq_zksync_era_sepolia_labels_id'), 'zksync_era_sepolia_labels', type_='unique') + op.drop_index('uk_zksync_era_sepolia_labels_transaction_hash_tx_call', table_name='zksync_era_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_zksync_era_sepolia_labels_transaction_hash_log_index_event', table_name='zksync_era_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_zksync_era_sepolia_labels_addr_block_ts', table_name='zksync_era_sepolia_labels') + op.drop_constraint(op.f('uq_zksync_era_labels_id'), 'zksync_era_labels', type_='unique') + op.drop_index('uk_zksync_era_labels_transaction_hash_tx_call', table_name='zksync_era_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_zksync_era_labels_transaction_hash_log_index_event', table_name='zksync_era_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_zksync_era_labels_addr_block_ts', table_name='zksync_era_labels') + op.drop_constraint(op.f('uq_xdai_labels_id'), 'xdai_labels', type_='unique') + op.drop_index('uk_xdai_labels_transaction_hash_tx_call', table_name='xdai_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_xdai_labels_transaction_hash_log_index_event', table_name='xdai_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_xdai_labels_addr_block_ts', table_name='xdai_labels') + op.drop_constraint(op.f('uq_xai_sepolia_labels_id'), 'xai_sepolia_labels', type_='unique') + op.drop_index('uk_xai_sepolia_labels_transaction_hash_tx_call', table_name='xai_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_xai_sepolia_labels_transaction_hash_log_index_event', table_name='xai_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_xai_sepolia_labels_addr_block_ts', table_name='xai_sepolia_labels') + op.drop_constraint(op.f('uq_xai_labels_id'), 'xai_labels', type_='unique') + op.drop_index('uk_xai_labels_transaction_hash_tx_call', table_name='xai_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_xai_labels_transaction_hash_log_index_event', table_name='xai_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_xai_labels_addr_block_ts', table_name='xai_labels') + op.drop_constraint(op.f('uq_starknet_sepolia_labels_id'), 'starknet_sepolia_labels', type_='unique') + op.drop_index('uk_starknet_sepolia_labels_transaction_hash_tx_call', table_name='starknet_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_starknet_sepolia_labels_transaction_hash_log_index_event', table_name='starknet_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_starknet_sepolia_labels_addr_block_ts', table_name='starknet_sepolia_labels') + op.drop_constraint(op.f('uq_starknet_labels_id'), 'starknet_labels', type_='unique') + op.drop_index('uk_starknet_labels_transaction_hash_tx_call', table_name='starknet_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_starknet_labels_transaction_hash_log_index_event', table_name='starknet_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_starknet_labels_addr_block_ts', table_name='starknet_labels') + op.drop_constraint(op.f('uq_sepolia_labels_id'), 'sepolia_labels', type_='unique') + op.drop_index('uk_sepolia_labels_transaction_hash_tx_call', table_name='sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_sepolia_labels_transaction_hash_log_index_event', table_name='sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_sepolia_labels_addr_block_ts', table_name='sepolia_labels') + op.drop_constraint(op.f('uq_proofofplay_apex_labels_id'), 'proofofplay_apex_labels', type_='unique') + op.drop_index('uk_proofofplay_apex_labels_transaction_hash_tx_call', table_name='proofofplay_apex_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_proofofplay_apex_labels_transaction_hash_log_index_event', table_name='proofofplay_apex_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_constraint(op.f('uq_polygon_labels_id'), 'polygon_labels', type_='unique') + op.drop_index('uk_polygon_labels_transaction_hash_tx_call', table_name='polygon_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_polygon_labels_transaction_hash_log_index_event', table_name='polygon_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_polygon_labels_addr_block_ts', table_name='polygon_labels') + op.drop_constraint(op.f('uq_mumbai_labels_id'), 'mumbai_labels', type_='unique') + op.drop_index('uk_mumbai_labels_transaction_hash_tx_call', table_name='mumbai_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_mumbai_labels_transaction_hash_log_index_event', table_name='mumbai_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_mumbai_labels_addr_block_ts', table_name='mumbai_labels') + op.drop_constraint(op.f('uq_ethereum_labels_id'), 'ethereum_labels', type_='unique') + op.drop_index('uk_ethereum_labels_transaction_hash_tx_call', table_name='ethereum_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_ethereum_labels_transaction_hash_log_index_event', table_name='ethereum_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_ethereum_labels_addr_block_ts', table_name='ethereum_labels') + op.drop_constraint(op.f('uq_blast_sepolia_labels_id'), 'blast_sepolia_labels', type_='unique') + op.drop_index('uk_blast_sepolia_labels_transaction_hash_tx_call', table_name='blast_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_blast_sepolia_labels_transaction_hash_log_index_event', table_name='blast_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_constraint(op.f('uq_blast_labels_id'), 'blast_labels', type_='unique') + op.drop_index('uk_blast_labels_transaction_hash_tx_call', table_name='blast_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_blast_labels_transaction_hash_log_index_event', table_name='blast_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_constraint(op.f('uq_base_labels_id'), 'base_labels', type_='unique') + op.drop_index('uk_base_labels_transaction_hash_tx_call', table_name='base_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_base_labels_transaction_hash_log_index_event', table_name='base_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_base_labels_addr_block_ts', table_name='base_labels') + op.drop_constraint(op.f('uq_avalanche_labels_id'), 'avalanche_labels', type_='unique') + op.drop_index('uk_avalanche_labels_transaction_hash_tx_call', table_name='avalanche_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_avalanche_labels_transaction_hash_log_index_event', table_name='avalanche_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_avalanche_labels_addr_block_ts', table_name='avalanche_labels') + op.drop_constraint(op.f('uq_avalanche_fuji_labels_id'), 'avalanche_fuji_labels', type_='unique') + op.drop_index('uk_avalanche_fuji_labels_transaction_hash_tx_call', table_name='avalanche_fuji_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_avalanche_fuji_labels_transaction_hash_log_index_event', table_name='avalanche_fuji_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_avalanche_fuji_labels_addr_block_ts', table_name='avalanche_fuji_labels') + op.drop_constraint(op.f('uq_arbitrum_sepolia_labels_id'), 'arbitrum_sepolia_labels', type_='unique') + op.drop_index('uk_arbitrum_sepolia_labels_transaction_hash_tx_call', table_name='arbitrum_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_arbitrum_sepolia_labels_transaction_hash_log_index_event', table_name='arbitrum_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('ix_arbitrum_sepolia_labels_addr_block_ts', table_name='arbitrum_sepolia_labels') + op.drop_constraint(op.f('uq_arbitrum_one_labels_id'), 'arbitrum_one_labels', type_='unique') + op.drop_index('uk_arbitrum_one_labels_transaction_hash_tx_call', table_name='arbitrum_one_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_arbitrum_one_labels_transaction_hash_log_index_event', table_name='arbitrum_one_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_constraint(op.f('uq_arbitrum_nova_labels_id'), 'arbitrum_nova_labels', type_='unique') + op.drop_index('uk_arbitrum_nova_labels_transaction_hash_tx_call', table_name='arbitrum_nova_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_arbitrum_nova_labels_transaction_hash_log_index_event', table_name='arbitrum_nova_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_constraint(op.f('uq_amoy_labels_id'), 'amoy_labels', type_='unique') + op.drop_index('uk_amoy_labels_transaction_hash_tx_call', table_name='amoy_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_amoy_labels_transaction_hash_log_index_event', table_name='amoy_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + # ### end Alembic commands ### diff --git a/moonstreamdb-v3/moonstreamdbv3/models.py b/moonstreamdb-v3/moonstreamdbv3/models.py index b8b9e7be..d06e19d7 100644 --- a/moonstreamdb-v3/moonstreamdbv3/models.py +++ b/moonstreamdb-v3/moonstreamdbv3/models.py @@ -30,7 +30,7 @@ from sqlalchemy import ( from sqlalchemy.dialects.postgresql import JSONB, UUID from sqlalchemy.ext.compiler import compiles from sqlalchemy.ext.declarative import declarative_base -from sqlalchemy.sql import expression +from sqlalchemy.sql import expression, text """ Naming conventions doc @@ -68,6 +68,7 @@ def pg_utcnow(element, compiler, **kwargs): class EvmBasedLabel(Base): # type: ignore __abstract__ = True + id = Column( UUID(as_uuid=True), primary_key=True, @@ -133,6 +134,19 @@ class EthereumLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_ethereum_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_ethereum_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ), ) @@ -152,6 +166,20 @@ class SepoliaLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_sepolia_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_sepolia_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) + ) @@ -171,6 +199,19 @@ class PolygonLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_polygon_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_polygon_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -190,6 +231,19 @@ class MumbaiLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_mumbai_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_mumbai_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -209,6 +263,19 @@ class AmoyLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_amoy_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_amoy_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -228,6 +295,20 @@ class XDaiLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_xdai_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_xdai_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) + ) @@ -247,6 +328,19 @@ class ZkSyncEraLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_zksync_era_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_zksync_era_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -266,6 +360,19 @@ class ZkSyncEraSepoliaLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_zksync_era_sepolia_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_zksync_era_sepolia_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -285,6 +392,19 @@ class BaseLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_base_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_base_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -304,6 +424,19 @@ class ArbitrumNovaLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_arbitrum_nova_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_arbitrum_nova_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -323,6 +456,19 @@ class ArbitrumOneLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_arbitrum_one_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_arbitrum_one_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -342,6 +488,19 @@ class ArbitrumSepoliaLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_arbitrum_sepolia_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_arbitrum_sepolia_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -361,6 +520,19 @@ class XaiLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_xai_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_xai_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -380,6 +552,19 @@ class XaiSepoliaLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_xai_sepolia_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_xai_sepolia_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -399,6 +584,19 @@ class AvalancheLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_avalanche_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_avalanche_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -418,6 +616,19 @@ class AvalancheFujiLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_avalanche_fuji_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_avalanche_fuji_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -437,6 +648,19 @@ class BlastLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_blast_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_blast_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -456,6 +680,19 @@ class BlastSepoliaLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_blast_sepolia_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_blast_sepolia_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -475,6 +712,19 @@ class ProofOfPlayApexLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_proofofplay_apex_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_proofofplay_apex_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -494,6 +744,19 @@ class StarknetLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_starknet_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_starknet_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) @@ -513,4 +776,17 @@ class StarknetSepoliaLabel(EvmBasedLabel): # type: ignore "block_timestamp", unique=False, ), + Index( + 'uk_starknet_sepolia_labels_transaction_hash_tx_call', + 'transaction_hash', + unique=True, + postgresql_where=text("label='seer' and label_type='tx_call'") + ), + Index( + 'uk_starknet_sepolia_labels_transaction_hash_log_index_event', + 'transaction_hash', + 'log_index', + unique=True, + postgresql_where=text("label='seer' and label_type='event'") + ) ) diff --git a/moonstreamdb-v3/moonstreamdbv3/version.txt b/moonstreamdb-v3/moonstreamdbv3/version.txt index 05b19b1f..fa3de586 100644 --- a/moonstreamdb-v3/moonstreamdbv3/version.txt +++ b/moonstreamdb-v3/moonstreamdbv3/version.txt @@ -1 +1 @@ -0.0.4 \ No newline at end of file +0.0.5 \ No newline at end of file From 568250396dbb0e6e491484afd1dfe1f702b2bf18 Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 20 May 2024 12:06:26 +0300 Subject: [PATCH 2/3] Shorter index names. --- ...33be47_tx_call_and_event_unique_indexes.py | 168 +++++++++--------- moonstreamdb-v3/moonstreamdbv3/models.py | 84 ++++----- 2 files changed, 126 insertions(+), 126 deletions(-) diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic/versions/d2ceff33be47_tx_call_and_event_unique_indexes.py b/moonstreamdb-v3/moonstreamdbv3/alembic/versions/d2ceff33be47_tx_call_and_event_unique_indexes.py index 5ce1f46e..39f8d8d6 100644 --- a/moonstreamdb-v3/moonstreamdbv3/alembic/versions/d2ceff33be47_tx_call_and_event_unique_indexes.py +++ b/moonstreamdb-v3/moonstreamdbv3/alembic/versions/d2ceff33be47_tx_call_and_event_unique_indexes.py @@ -20,83 +20,83 @@ depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.create_index('uk_amoy_labels_transaction_hash_log_index_event', 'amoy_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_amoy_labels_transaction_hash_tx_call', 'amoy_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_amoy_labels_tx_hash_log_idx_evt', 'amoy_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_amoy_labels_tx_hash_tx_call', 'amoy_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_amoy_labels_id'), 'amoy_labels', ['id']) - op.create_index('uk_arbitrum_nova_labels_transaction_hash_log_index_event', 'arbitrum_nova_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_arbitrum_nova_labels_transaction_hash_tx_call', 'arbitrum_nova_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_arbitrum_nova_labels_tx_hash_log_idx_evt', 'arbitrum_nova_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_arbitrum_nova_labels_tx_hash_tx_call', 'arbitrum_nova_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_arbitrum_nova_labels_id'), 'arbitrum_nova_labels', ['id']) - op.create_index('uk_arbitrum_one_labels_transaction_hash_log_index_event', 'arbitrum_one_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_arbitrum_one_labels_transaction_hash_tx_call', 'arbitrum_one_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_arbitrum_one_labels_tx_hash_log_idx_evt', 'arbitrum_one_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_arbitrum_one_labels_tx_hash_tx_call', 'arbitrum_one_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_arbitrum_one_labels_id'), 'arbitrum_one_labels', ['id']) op.create_index('ix_arbitrum_sepolia_labels_addr_block_ts', 'arbitrum_sepolia_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_arbitrum_sepolia_labels_transaction_hash_log_index_event', 'arbitrum_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_arbitrum_sepolia_labels_transaction_hash_tx_call', 'arbitrum_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_arbitrum_sepolia_labels_tx_hash_log_idx_evt', 'arbitrum_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_arbitrum_sepolia_labels_tx_hash_tx_call', 'arbitrum_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_arbitrum_sepolia_labels_id'), 'arbitrum_sepolia_labels', ['id']) op.create_index('ix_avalanche_fuji_labels_addr_block_ts', 'avalanche_fuji_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_avalanche_fuji_labels_transaction_hash_log_index_event', 'avalanche_fuji_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_avalanche_fuji_labels_transaction_hash_tx_call', 'avalanche_fuji_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_avalanche_fuji_labels_tx_hash_log_idx_evt', 'avalanche_fuji_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_avalanche_fuji_labels_tx_hash_tx_call', 'avalanche_fuji_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_avalanche_fuji_labels_id'), 'avalanche_fuji_labels', ['id']) op.create_index('ix_avalanche_labels_addr_block_ts', 'avalanche_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_avalanche_labels_transaction_hash_log_index_event', 'avalanche_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_avalanche_labels_transaction_hash_tx_call', 'avalanche_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_avalanche_labels_tx_hash_log_idx_evt', 'avalanche_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_avalanche_labels_tx_hash_tx_call', 'avalanche_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_avalanche_labels_id'), 'avalanche_labels', ['id']) op.create_index('ix_base_labels_addr_block_ts', 'base_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_base_labels_transaction_hash_log_index_event', 'base_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_base_labels_transaction_hash_tx_call', 'base_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_base_labels_tx_hash_log_idx_evt', 'base_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_base_labels_tx_hash_tx_call', 'base_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_base_labels_id'), 'base_labels', ['id']) - op.create_index('uk_blast_labels_transaction_hash_log_index_event', 'blast_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_blast_labels_transaction_hash_tx_call', 'blast_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_blast_labels_tx_hash_log_idx_evt', 'blast_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_blast_labels_tx_hash_tx_call', 'blast_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_blast_labels_id'), 'blast_labels', ['id']) - op.create_index('uk_blast_sepolia_labels_transaction_hash_log_index_event', 'blast_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_blast_sepolia_labels_transaction_hash_tx_call', 'blast_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_blast_sepolia_labels_tx_hash_log_idx_evt', 'blast_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_blast_sepolia_labels_tx_hash_tx_call', 'blast_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_blast_sepolia_labels_id'), 'blast_sepolia_labels', ['id']) op.create_index('ix_ethereum_labels_addr_block_ts', 'ethereum_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_ethereum_labels_transaction_hash_log_index_event', 'ethereum_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_ethereum_labels_transaction_hash_tx_call', 'ethereum_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_ethereum_labels_tx_hash_log_idx_evt', 'ethereum_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_ethereum_labels_tx_hash_tx_call', 'ethereum_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_ethereum_labels_id'), 'ethereum_labels', ['id']) op.create_index('ix_mumbai_labels_addr_block_ts', 'mumbai_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_mumbai_labels_transaction_hash_log_index_event', 'mumbai_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_mumbai_labels_transaction_hash_tx_call', 'mumbai_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_mumbai_labels_tx_hash_log_idx_evt', 'mumbai_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_mumbai_labels_tx_hash_tx_call', 'mumbai_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_mumbai_labels_id'), 'mumbai_labels', ['id']) op.create_index('ix_polygon_labels_addr_block_ts', 'polygon_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_polygon_labels_transaction_hash_log_index_event', 'polygon_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_polygon_labels_transaction_hash_tx_call', 'polygon_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_polygon_labels_tx_hash_log_idx_evt', 'polygon_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_polygon_labels_tx_hash_tx_call', 'polygon_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_polygon_labels_id'), 'polygon_labels', ['id']) - op.create_index('uk_proofofplay_apex_labels_transaction_hash_log_index_event', 'proofofplay_apex_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_proofofplay_apex_labels_transaction_hash_tx_call', 'proofofplay_apex_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_proofofplay_apex_labels_tx_hash_log_idx_evt', 'proofofplay_apex_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_proofofplay_apex_labels_tx_hash_tx_call', 'proofofplay_apex_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_proofofplay_apex_labels_id'), 'proofofplay_apex_labels', ['id']) op.create_index('ix_sepolia_labels_addr_block_ts', 'sepolia_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_sepolia_labels_transaction_hash_log_index_event', 'sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_sepolia_labels_transaction_hash_tx_call', 'sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_sepolia_labels_tx_hash_log_idx_evt', 'sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_sepolia_labels_tx_hash_tx_call', 'sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_sepolia_labels_id'), 'sepolia_labels', ['id']) op.create_index('ix_starknet_labels_addr_block_ts', 'starknet_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_starknet_labels_transaction_hash_log_index_event', 'starknet_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_starknet_labels_transaction_hash_tx_call', 'starknet_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_starknet_labels_tx_hash_log_idx_evt', 'starknet_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_starknet_labels_tx_hash_tx_call', 'starknet_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_starknet_labels_id'), 'starknet_labels', ['id']) op.create_index('ix_starknet_sepolia_labels_addr_block_ts', 'starknet_sepolia_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_starknet_sepolia_labels_transaction_hash_log_index_event', 'starknet_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_starknet_sepolia_labels_transaction_hash_tx_call', 'starknet_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_starknet_sepolia_labels_tx_hash_log_idx_evt', 'starknet_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_starknet_sepolia_labels_tx_hash_tx_call', 'starknet_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_starknet_sepolia_labels_id'), 'starknet_sepolia_labels', ['id']) op.create_index('ix_xai_labels_addr_block_ts', 'xai_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_xai_labels_transaction_hash_log_index_event', 'xai_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_xai_labels_transaction_hash_tx_call', 'xai_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_xai_labels_tx_hash_log_idx_evt', 'xai_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_xai_labels_tx_hash_tx_call', 'xai_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_xai_labels_id'), 'xai_labels', ['id']) op.create_index('ix_xai_sepolia_labels_addr_block_ts', 'xai_sepolia_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_xai_sepolia_labels_transaction_hash_log_index_event', 'xai_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_xai_sepolia_labels_transaction_hash_tx_call', 'xai_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_xai_sepolia_labels_tx_hash_log_idx_evt', 'xai_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_xai_sepolia_labels_tx_hash_tx_call', 'xai_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_xai_sepolia_labels_id'), 'xai_sepolia_labels', ['id']) op.create_index('ix_xdai_labels_addr_block_ts', 'xdai_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_xdai_labels_transaction_hash_log_index_event', 'xdai_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_xdai_labels_transaction_hash_tx_call', 'xdai_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_xdai_labels_tx_hash_log_idx_evt', 'xdai_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_xdai_labels_tx_hash_tx_call', 'xdai_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_xdai_labels_id'), 'xdai_labels', ['id']) op.create_index('ix_zksync_era_labels_addr_block_ts', 'zksync_era_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_zksync_era_labels_transaction_hash_log_index_event', 'zksync_era_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_zksync_era_labels_transaction_hash_tx_call', 'zksync_era_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_zksync_era_labels_tx_hash_log_idx_evt', 'zksync_era_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_zksync_era_labels_tx_hash_tx_call', 'zksync_era_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_zksync_era_labels_id'), 'zksync_era_labels', ['id']) op.create_index('ix_zksync_era_sepolia_labels_addr_block_ts', 'zksync_era_sepolia_labels', ['address', 'block_timestamp'], unique=False) - op.create_index('uk_zksync_era_sepolia_labels_transaction_hash_log_index_event', 'zksync_era_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) - op.create_index('uk_zksync_era_sepolia_labels_transaction_hash_tx_call', 'zksync_era_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.create_index('uk_zksync_era_sepolia_labels_tx_hash_log_idx_evt', 'zksync_era_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) + op.create_index('uk_zksync_era_sepolia_labels_tx_hash_tx_call', 'zksync_era_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.create_unique_constraint(op.f('uq_zksync_era_sepolia_labels_id'), 'zksync_era_sepolia_labels', ['id']) # ### end Alembic commands ### @@ -104,81 +104,81 @@ def upgrade() -> None: def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(op.f('uq_zksync_era_sepolia_labels_id'), 'zksync_era_sepolia_labels', type_='unique') - op.drop_index('uk_zksync_era_sepolia_labels_transaction_hash_tx_call', table_name='zksync_era_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_zksync_era_sepolia_labels_transaction_hash_log_index_event', table_name='zksync_era_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_zksync_era_sepolia_labels_tx_hash_tx_call', table_name='zksync_era_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_zksync_era_sepolia_labels_tx_hash_log_idx_evt', table_name='zksync_era_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_zksync_era_sepolia_labels_addr_block_ts', table_name='zksync_era_sepolia_labels') op.drop_constraint(op.f('uq_zksync_era_labels_id'), 'zksync_era_labels', type_='unique') - op.drop_index('uk_zksync_era_labels_transaction_hash_tx_call', table_name='zksync_era_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_zksync_era_labels_transaction_hash_log_index_event', table_name='zksync_era_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_zksync_era_labels_tx_hash_tx_call', table_name='zksync_era_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_zksync_era_labels_tx_hash_log_idx_evt', table_name='zksync_era_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_zksync_era_labels_addr_block_ts', table_name='zksync_era_labels') op.drop_constraint(op.f('uq_xdai_labels_id'), 'xdai_labels', type_='unique') - op.drop_index('uk_xdai_labels_transaction_hash_tx_call', table_name='xdai_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_xdai_labels_transaction_hash_log_index_event', table_name='xdai_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_xdai_labels_tx_hash_tx_call', table_name='xdai_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_xdai_labels_tx_hash_log_idx_evt', table_name='xdai_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_xdai_labels_addr_block_ts', table_name='xdai_labels') op.drop_constraint(op.f('uq_xai_sepolia_labels_id'), 'xai_sepolia_labels', type_='unique') - op.drop_index('uk_xai_sepolia_labels_transaction_hash_tx_call', table_name='xai_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_xai_sepolia_labels_transaction_hash_log_index_event', table_name='xai_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_xai_sepolia_labels_tx_hash_tx_call', table_name='xai_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_xai_sepolia_labels_tx_hash_log_idx_evt', table_name='xai_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_xai_sepolia_labels_addr_block_ts', table_name='xai_sepolia_labels') op.drop_constraint(op.f('uq_xai_labels_id'), 'xai_labels', type_='unique') - op.drop_index('uk_xai_labels_transaction_hash_tx_call', table_name='xai_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_xai_labels_transaction_hash_log_index_event', table_name='xai_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_xai_labels_tx_hash_tx_call', table_name='xai_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_xai_labels_tx_hash_log_idx_evt', table_name='xai_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_xai_labels_addr_block_ts', table_name='xai_labels') op.drop_constraint(op.f('uq_starknet_sepolia_labels_id'), 'starknet_sepolia_labels', type_='unique') - op.drop_index('uk_starknet_sepolia_labels_transaction_hash_tx_call', table_name='starknet_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_starknet_sepolia_labels_transaction_hash_log_index_event', table_name='starknet_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_starknet_sepolia_labels_tx_hash_tx_call', table_name='starknet_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_starknet_sepolia_labels_tx_hash_log_idx_evt', table_name='starknet_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_starknet_sepolia_labels_addr_block_ts', table_name='starknet_sepolia_labels') op.drop_constraint(op.f('uq_starknet_labels_id'), 'starknet_labels', type_='unique') - op.drop_index('uk_starknet_labels_transaction_hash_tx_call', table_name='starknet_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_starknet_labels_transaction_hash_log_index_event', table_name='starknet_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_starknet_labels_tx_hash_tx_call', table_name='starknet_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_starknet_labels_tx_hash_log_idx_evt', table_name='starknet_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_starknet_labels_addr_block_ts', table_name='starknet_labels') op.drop_constraint(op.f('uq_sepolia_labels_id'), 'sepolia_labels', type_='unique') - op.drop_index('uk_sepolia_labels_transaction_hash_tx_call', table_name='sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_sepolia_labels_transaction_hash_log_index_event', table_name='sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_sepolia_labels_tx_hash_tx_call', table_name='sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_sepolia_labels_tx_hash_log_idx_evt', table_name='sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_sepolia_labels_addr_block_ts', table_name='sepolia_labels') op.drop_constraint(op.f('uq_proofofplay_apex_labels_id'), 'proofofplay_apex_labels', type_='unique') - op.drop_index('uk_proofofplay_apex_labels_transaction_hash_tx_call', table_name='proofofplay_apex_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_proofofplay_apex_labels_transaction_hash_log_index_event', table_name='proofofplay_apex_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_proofofplay_apex_labels_tx_hash_tx_call', table_name='proofofplay_apex_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_proofofplay_apex_labels_tx_hash_log_idx_evt', table_name='proofofplay_apex_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_constraint(op.f('uq_polygon_labels_id'), 'polygon_labels', type_='unique') - op.drop_index('uk_polygon_labels_transaction_hash_tx_call', table_name='polygon_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_polygon_labels_transaction_hash_log_index_event', table_name='polygon_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_polygon_labels_tx_hash_tx_call', table_name='polygon_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_polygon_labels_tx_hash_log_idx_evt', table_name='polygon_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_polygon_labels_addr_block_ts', table_name='polygon_labels') op.drop_constraint(op.f('uq_mumbai_labels_id'), 'mumbai_labels', type_='unique') - op.drop_index('uk_mumbai_labels_transaction_hash_tx_call', table_name='mumbai_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_mumbai_labels_transaction_hash_log_index_event', table_name='mumbai_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_mumbai_labels_tx_hash_tx_call', table_name='mumbai_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_mumbai_labels_tx_hash_log_idx_evt', table_name='mumbai_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_mumbai_labels_addr_block_ts', table_name='mumbai_labels') op.drop_constraint(op.f('uq_ethereum_labels_id'), 'ethereum_labels', type_='unique') - op.drop_index('uk_ethereum_labels_transaction_hash_tx_call', table_name='ethereum_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_ethereum_labels_transaction_hash_log_index_event', table_name='ethereum_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_ethereum_labels_tx_hash_tx_call', table_name='ethereum_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_ethereum_labels_tx_hash_log_idx_evt', table_name='ethereum_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_ethereum_labels_addr_block_ts', table_name='ethereum_labels') op.drop_constraint(op.f('uq_blast_sepolia_labels_id'), 'blast_sepolia_labels', type_='unique') - op.drop_index('uk_blast_sepolia_labels_transaction_hash_tx_call', table_name='blast_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_blast_sepolia_labels_transaction_hash_log_index_event', table_name='blast_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_blast_sepolia_labels_tx_hash_tx_call', table_name='blast_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_blast_sepolia_labels_tx_hash_log_idx_evt', table_name='blast_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_constraint(op.f('uq_blast_labels_id'), 'blast_labels', type_='unique') - op.drop_index('uk_blast_labels_transaction_hash_tx_call', table_name='blast_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_blast_labels_transaction_hash_log_index_event', table_name='blast_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_blast_labels_tx_hash_tx_call', table_name='blast_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_blast_labels_tx_hash_log_idx_evt', table_name='blast_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_constraint(op.f('uq_base_labels_id'), 'base_labels', type_='unique') - op.drop_index('uk_base_labels_transaction_hash_tx_call', table_name='base_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_base_labels_transaction_hash_log_index_event', table_name='base_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_base_labels_tx_hash_tx_call', table_name='base_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_base_labels_tx_hash_log_idx_evt', table_name='base_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_base_labels_addr_block_ts', table_name='base_labels') op.drop_constraint(op.f('uq_avalanche_labels_id'), 'avalanche_labels', type_='unique') - op.drop_index('uk_avalanche_labels_transaction_hash_tx_call', table_name='avalanche_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_avalanche_labels_transaction_hash_log_index_event', table_name='avalanche_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_avalanche_labels_tx_hash_tx_call', table_name='avalanche_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_avalanche_labels_tx_hash_log_idx_evt', table_name='avalanche_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_avalanche_labels_addr_block_ts', table_name='avalanche_labels') op.drop_constraint(op.f('uq_avalanche_fuji_labels_id'), 'avalanche_fuji_labels', type_='unique') - op.drop_index('uk_avalanche_fuji_labels_transaction_hash_tx_call', table_name='avalanche_fuji_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_avalanche_fuji_labels_transaction_hash_log_index_event', table_name='avalanche_fuji_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_avalanche_fuji_labels_tx_hash_tx_call', table_name='avalanche_fuji_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_avalanche_fuji_labels_tx_hash_log_idx_evt', table_name='avalanche_fuji_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_avalanche_fuji_labels_addr_block_ts', table_name='avalanche_fuji_labels') op.drop_constraint(op.f('uq_arbitrum_sepolia_labels_id'), 'arbitrum_sepolia_labels', type_='unique') - op.drop_index('uk_arbitrum_sepolia_labels_transaction_hash_tx_call', table_name='arbitrum_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_arbitrum_sepolia_labels_transaction_hash_log_index_event', table_name='arbitrum_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_arbitrum_sepolia_labels_tx_hash_tx_call', table_name='arbitrum_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_arbitrum_sepolia_labels_tx_hash_log_idx_evt', table_name='arbitrum_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_index('ix_arbitrum_sepolia_labels_addr_block_ts', table_name='arbitrum_sepolia_labels') op.drop_constraint(op.f('uq_arbitrum_one_labels_id'), 'arbitrum_one_labels', type_='unique') - op.drop_index('uk_arbitrum_one_labels_transaction_hash_tx_call', table_name='arbitrum_one_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_arbitrum_one_labels_transaction_hash_log_index_event', table_name='arbitrum_one_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_arbitrum_one_labels_tx_hash_tx_call', table_name='arbitrum_one_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_arbitrum_one_labels_tx_hash_log_idx_evt', table_name='arbitrum_one_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_constraint(op.f('uq_arbitrum_nova_labels_id'), 'arbitrum_nova_labels', type_='unique') - op.drop_index('uk_arbitrum_nova_labels_transaction_hash_tx_call', table_name='arbitrum_nova_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_arbitrum_nova_labels_transaction_hash_log_index_event', table_name='arbitrum_nova_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_arbitrum_nova_labels_tx_hash_tx_call', table_name='arbitrum_nova_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_arbitrum_nova_labels_tx_hash_log_idx_evt', table_name='arbitrum_nova_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) op.drop_constraint(op.f('uq_amoy_labels_id'), 'amoy_labels', type_='unique') - op.drop_index('uk_amoy_labels_transaction_hash_tx_call', table_name='amoy_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.drop_index('uk_amoy_labels_transaction_hash_log_index_event', table_name='amoy_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) + op.drop_index('uk_amoy_labels_tx_hash_tx_call', table_name='amoy_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) + op.drop_index('uk_amoy_labels_tx_hash_log_idx_evt', table_name='amoy_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) # ### end Alembic commands ### diff --git a/moonstreamdb-v3/moonstreamdbv3/models.py b/moonstreamdb-v3/moonstreamdbv3/models.py index d06e19d7..9503b0bd 100644 --- a/moonstreamdb-v3/moonstreamdbv3/models.py +++ b/moonstreamdb-v3/moonstreamdbv3/models.py @@ -135,13 +135,13 @@ class EthereumLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_ethereum_labels_transaction_hash_tx_call', + 'uk_ethereum_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_ethereum_labels_transaction_hash_log_index_event', + 'uk_ethereum_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -167,13 +167,13 @@ class SepoliaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_sepolia_labels_transaction_hash_tx_call', + 'uk_sepolia_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_sepolia_labels_transaction_hash_log_index_event', + 'uk_sepolia_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -200,13 +200,13 @@ class PolygonLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_polygon_labels_transaction_hash_tx_call', + 'uk_polygon_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_polygon_labels_transaction_hash_log_index_event', + 'uk_polygon_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -232,13 +232,13 @@ class MumbaiLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_mumbai_labels_transaction_hash_tx_call', + 'uk_mumbai_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_mumbai_labels_transaction_hash_log_index_event', + 'uk_mumbai_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -264,13 +264,13 @@ class AmoyLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_amoy_labels_transaction_hash_tx_call', + 'uk_amoy_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_amoy_labels_transaction_hash_log_index_event', + 'uk_amoy_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -296,13 +296,13 @@ class XDaiLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_xdai_labels_transaction_hash_tx_call', + 'uk_xdai_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_xdai_labels_transaction_hash_log_index_event', + 'uk_xdai_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -329,13 +329,13 @@ class ZkSyncEraLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_zksync_era_labels_transaction_hash_tx_call', + 'uk_zksync_era_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_zksync_era_labels_transaction_hash_log_index_event', + 'uk_zksync_era_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -361,13 +361,13 @@ class ZkSyncEraSepoliaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_zksync_era_sepolia_labels_transaction_hash_tx_call', + 'uk_zksync_era_sepolia_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_zksync_era_sepolia_labels_transaction_hash_log_index_event', + 'uk_zksync_era_sepolia_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -393,13 +393,13 @@ class BaseLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_base_labels_transaction_hash_tx_call', + 'uk_base_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_base_labels_transaction_hash_log_index_event', + 'uk_base_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -425,13 +425,13 @@ class ArbitrumNovaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_arbitrum_nova_labels_transaction_hash_tx_call', + 'uk_arbitrum_nova_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_arbitrum_nova_labels_transaction_hash_log_index_event', + 'uk_arbitrum_nova_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -457,13 +457,13 @@ class ArbitrumOneLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_arbitrum_one_labels_transaction_hash_tx_call', + 'uk_arbitrum_one_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_arbitrum_one_labels_transaction_hash_log_index_event', + 'uk_arbitrum_one_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -489,13 +489,13 @@ class ArbitrumSepoliaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_arbitrum_sepolia_labels_transaction_hash_tx_call', + 'uk_arbitrum_sepolia_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_arbitrum_sepolia_labels_transaction_hash_log_index_event', + 'uk_arbitrum_sepolia_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -521,13 +521,13 @@ class XaiLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_xai_labels_transaction_hash_tx_call', + 'uk_xai_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_xai_labels_transaction_hash_log_index_event', + 'uk_xai_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -553,13 +553,13 @@ class XaiSepoliaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_xai_sepolia_labels_transaction_hash_tx_call', + 'uk_xai_sepolia_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_xai_sepolia_labels_transaction_hash_log_index_event', + 'uk_xai_sepolia_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -585,13 +585,13 @@ class AvalancheLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_avalanche_labels_transaction_hash_tx_call', + 'uk_avalanche_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_avalanche_labels_transaction_hash_log_index_event', + 'uk_avalanche_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -617,13 +617,13 @@ class AvalancheFujiLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_avalanche_fuji_labels_transaction_hash_tx_call', + 'uk_avalanche_fuji_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_avalanche_fuji_labels_transaction_hash_log_index_event', + 'uk_avalanche_fuji_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -649,13 +649,13 @@ class BlastLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_blast_labels_transaction_hash_tx_call', + 'uk_blast_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_blast_labels_transaction_hash_log_index_event', + 'uk_blast_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -681,13 +681,13 @@ class BlastSepoliaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_blast_sepolia_labels_transaction_hash_tx_call', + 'uk_blast_sepolia_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_blast_sepolia_labels_transaction_hash_log_index_event', + 'uk_blast_sepolia_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -713,13 +713,13 @@ class ProofOfPlayApexLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_proofofplay_apex_labels_transaction_hash_tx_call', + 'uk_proofofplay_apex_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_proofofplay_apex_labels_transaction_hash_log_index_event', + 'uk_proofofplay_apex_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -745,13 +745,13 @@ class StarknetLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_starknet_labels_transaction_hash_tx_call', + 'uk_starknet_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_starknet_labels_transaction_hash_log_index_event', + 'uk_starknet_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, @@ -777,13 +777,13 @@ class StarknetSepoliaLabel(EvmBasedLabel): # type: ignore unique=False, ), Index( - 'uk_starknet_sepolia_labels_transaction_hash_tx_call', + 'uk_starknet_sepolia_labels_tx_hash_tx_call', 'transaction_hash', unique=True, postgresql_where=text("label='seer' and label_type='tx_call'") ), Index( - 'uk_starknet_sepolia_labels_transaction_hash_log_index_event', + 'uk_starknet_sepolia_labels_tx_hash_log_idx_evt', 'transaction_hash', 'log_index', unique=True, From 95aec6bece38cd9520a65f2f58ace0087227ba59 Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 20 May 2024 12:20:32 +0300 Subject: [PATCH 3/3] Remove unrelated indexes. --- ...33be47_tx_call_and_event_unique_indexes.py | 93 +++++-------------- 1 file changed, 21 insertions(+), 72 deletions(-) diff --git a/moonstreamdb-v3/moonstreamdbv3/alembic/versions/d2ceff33be47_tx_call_and_event_unique_indexes.py b/moonstreamdb-v3/moonstreamdbv3/alembic/versions/d2ceff33be47_tx_call_and_event_unique_indexes.py index 39f8d8d6..b2f2a3be 100644 --- a/moonstreamdb-v3/moonstreamdbv3/alembic/versions/d2ceff33be47_tx_call_and_event_unique_indexes.py +++ b/moonstreamdb-v3/moonstreamdbv3/alembic/versions/d2ceff33be47_tx_call_and_event_unique_indexes.py @@ -20,165 +20,114 @@ depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### + # uq_amoy_labels op.create_index('uk_amoy_labels_tx_hash_log_idx_evt', 'amoy_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_amoy_labels_tx_hash_tx_call', 'amoy_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_amoy_labels_id'), 'amoy_labels', ['id']) + # uq_arbitrum_nova_labels op.create_index('uk_arbitrum_nova_labels_tx_hash_log_idx_evt', 'arbitrum_nova_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_arbitrum_nova_labels_tx_hash_tx_call', 'arbitrum_nova_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_arbitrum_nova_labels_id'), 'arbitrum_nova_labels', ['id']) + # uq_arbitrum_one_labels op.create_index('uk_arbitrum_one_labels_tx_hash_log_idx_evt', 'arbitrum_one_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_arbitrum_one_labels_tx_hash_tx_call', 'arbitrum_one_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_arbitrum_one_labels_id'), 'arbitrum_one_labels', ['id']) - op.create_index('ix_arbitrum_sepolia_labels_addr_block_ts', 'arbitrum_sepolia_labels', ['address', 'block_timestamp'], unique=False) + # uq_arbitrum_sepolia_labels op.create_index('uk_arbitrum_sepolia_labels_tx_hash_log_idx_evt', 'arbitrum_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_arbitrum_sepolia_labels_tx_hash_tx_call', 'arbitrum_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_arbitrum_sepolia_labels_id'), 'arbitrum_sepolia_labels', ['id']) - op.create_index('ix_avalanche_fuji_labels_addr_block_ts', 'avalanche_fuji_labels', ['address', 'block_timestamp'], unique=False) + # uq_avalanche_fuji_labels op.create_index('uk_avalanche_fuji_labels_tx_hash_log_idx_evt', 'avalanche_fuji_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_avalanche_fuji_labels_tx_hash_tx_call', 'avalanche_fuji_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_avalanche_fuji_labels_id'), 'avalanche_fuji_labels', ['id']) - op.create_index('ix_avalanche_labels_addr_block_ts', 'avalanche_labels', ['address', 'block_timestamp'], unique=False) + # uq_avalanche_labels op.create_index('uk_avalanche_labels_tx_hash_log_idx_evt', 'avalanche_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_avalanche_labels_tx_hash_tx_call', 'avalanche_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_avalanche_labels_id'), 'avalanche_labels', ['id']) - op.create_index('ix_base_labels_addr_block_ts', 'base_labels', ['address', 'block_timestamp'], unique=False) + # uq_base_labels op.create_index('uk_base_labels_tx_hash_log_idx_evt', 'base_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_base_labels_tx_hash_tx_call', 'base_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_base_labels_id'), 'base_labels', ['id']) + # uq_blast_labels op.create_index('uk_blast_labels_tx_hash_log_idx_evt', 'blast_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_blast_labels_tx_hash_tx_call', 'blast_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_blast_labels_id'), 'blast_labels', ['id']) + # uq_blast_sepolia_labels op.create_index('uk_blast_sepolia_labels_tx_hash_log_idx_evt', 'blast_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_blast_sepolia_labels_tx_hash_tx_call', 'blast_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_blast_sepolia_labels_id'), 'blast_sepolia_labels', ['id']) - op.create_index('ix_ethereum_labels_addr_block_ts', 'ethereum_labels', ['address', 'block_timestamp'], unique=False) + # uq_ethereum_labels op.create_index('uk_ethereum_labels_tx_hash_log_idx_evt', 'ethereum_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_ethereum_labels_tx_hash_tx_call', 'ethereum_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_ethereum_labels_id'), 'ethereum_labels', ['id']) - op.create_index('ix_mumbai_labels_addr_block_ts', 'mumbai_labels', ['address', 'block_timestamp'], unique=False) + # uq_mumbai_labels op.create_index('uk_mumbai_labels_tx_hash_log_idx_evt', 'mumbai_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_mumbai_labels_tx_hash_tx_call', 'mumbai_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_mumbai_labels_id'), 'mumbai_labels', ['id']) - op.create_index('ix_polygon_labels_addr_block_ts', 'polygon_labels', ['address', 'block_timestamp'], unique=False) + # uq_polygon_labels op.create_index('uk_polygon_labels_tx_hash_log_idx_evt', 'polygon_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_polygon_labels_tx_hash_tx_call', 'polygon_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_polygon_labels_id'), 'polygon_labels', ['id']) + # uq_proofofplay_apex_labels op.create_index('uk_proofofplay_apex_labels_tx_hash_log_idx_evt', 'proofofplay_apex_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_proofofplay_apex_labels_tx_hash_tx_call', 'proofofplay_apex_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_proofofplay_apex_labels_id'), 'proofofplay_apex_labels', ['id']) - op.create_index('ix_sepolia_labels_addr_block_ts', 'sepolia_labels', ['address', 'block_timestamp'], unique=False) + # uq_sepolia_labels op.create_index('uk_sepolia_labels_tx_hash_log_idx_evt', 'sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_sepolia_labels_tx_hash_tx_call', 'sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_sepolia_labels_id'), 'sepolia_labels', ['id']) - op.create_index('ix_starknet_labels_addr_block_ts', 'starknet_labels', ['address', 'block_timestamp'], unique=False) + # uq_starknet_labels op.create_index('uk_starknet_labels_tx_hash_log_idx_evt', 'starknet_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_starknet_labels_tx_hash_tx_call', 'starknet_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_starknet_labels_id'), 'starknet_labels', ['id']) - op.create_index('ix_starknet_sepolia_labels_addr_block_ts', 'starknet_sepolia_labels', ['address', 'block_timestamp'], unique=False) + # uq_starknet_sepolia_labels op.create_index('uk_starknet_sepolia_labels_tx_hash_log_idx_evt', 'starknet_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_starknet_sepolia_labels_tx_hash_tx_call', 'starknet_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_starknet_sepolia_labels_id'), 'starknet_sepolia_labels', ['id']) - op.create_index('ix_xai_labels_addr_block_ts', 'xai_labels', ['address', 'block_timestamp'], unique=False) + # uq_xai_labels op.create_index('uk_xai_labels_tx_hash_log_idx_evt', 'xai_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_xai_labels_tx_hash_tx_call', 'xai_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_xai_labels_id'), 'xai_labels', ['id']) - op.create_index('ix_xai_sepolia_labels_addr_block_ts', 'xai_sepolia_labels', ['address', 'block_timestamp'], unique=False) + # uq_xai_sepolia_labels op.create_index('uk_xai_sepolia_labels_tx_hash_log_idx_evt', 'xai_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_xai_sepolia_labels_tx_hash_tx_call', 'xai_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_xai_sepolia_labels_id'), 'xai_sepolia_labels', ['id']) - op.create_index('ix_xdai_labels_addr_block_ts', 'xdai_labels', ['address', 'block_timestamp'], unique=False) + # xdai_labels op.create_index('uk_xdai_labels_tx_hash_log_idx_evt', 'xdai_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_xdai_labels_tx_hash_tx_call', 'xdai_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_xdai_labels_id'), 'xdai_labels', ['id']) - op.create_index('ix_zksync_era_labels_addr_block_ts', 'zksync_era_labels', ['address', 'block_timestamp'], unique=False) + # zksync_era_labels op.create_index('uk_zksync_era_labels_tx_hash_log_idx_evt', 'zksync_era_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_zksync_era_labels_tx_hash_tx_call', 'zksync_era_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_zksync_era_labels_id'), 'zksync_era_labels', ['id']) - op.create_index('ix_zksync_era_sepolia_labels_addr_block_ts', 'zksync_era_sepolia_labels', ['address', 'block_timestamp'], unique=False) + # zksync_era_sepolia_labels op.create_index('uk_zksync_era_sepolia_labels_tx_hash_log_idx_evt', 'zksync_era_sepolia_labels', ['transaction_hash', 'log_index'], unique=True, postgresql_where=sa.text("label='seer' and label_type='event'")) op.create_index('uk_zksync_era_sepolia_labels_tx_hash_tx_call', 'zksync_era_sepolia_labels', ['transaction_hash'], unique=True, postgresql_where=sa.text("label='seer' and label_type='tx_call'")) - op.create_unique_constraint(op.f('uq_zksync_era_sepolia_labels_id'), 'zksync_era_sepolia_labels', ['id']) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### - op.drop_constraint(op.f('uq_zksync_era_sepolia_labels_id'), 'zksync_era_sepolia_labels', type_='unique') op.drop_index('uk_zksync_era_sepolia_labels_tx_hash_tx_call', table_name='zksync_era_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_zksync_era_sepolia_labels_tx_hash_log_idx_evt', table_name='zksync_era_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_zksync_era_sepolia_labels_addr_block_ts', table_name='zksync_era_sepolia_labels') - op.drop_constraint(op.f('uq_zksync_era_labels_id'), 'zksync_era_labels', type_='unique') op.drop_index('uk_zksync_era_labels_tx_hash_tx_call', table_name='zksync_era_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_zksync_era_labels_tx_hash_log_idx_evt', table_name='zksync_era_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_zksync_era_labels_addr_block_ts', table_name='zksync_era_labels') - op.drop_constraint(op.f('uq_xdai_labels_id'), 'xdai_labels', type_='unique') op.drop_index('uk_xdai_labels_tx_hash_tx_call', table_name='xdai_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_xdai_labels_tx_hash_log_idx_evt', table_name='xdai_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_xdai_labels_addr_block_ts', table_name='xdai_labels') - op.drop_constraint(op.f('uq_xai_sepolia_labels_id'), 'xai_sepolia_labels', type_='unique') op.drop_index('uk_xai_sepolia_labels_tx_hash_tx_call', table_name='xai_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_xai_sepolia_labels_tx_hash_log_idx_evt', table_name='xai_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_xai_sepolia_labels_addr_block_ts', table_name='xai_sepolia_labels') - op.drop_constraint(op.f('uq_xai_labels_id'), 'xai_labels', type_='unique') op.drop_index('uk_xai_labels_tx_hash_tx_call', table_name='xai_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_xai_labels_tx_hash_log_idx_evt', table_name='xai_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_xai_labels_addr_block_ts', table_name='xai_labels') - op.drop_constraint(op.f('uq_starknet_sepolia_labels_id'), 'starknet_sepolia_labels', type_='unique') op.drop_index('uk_starknet_sepolia_labels_tx_hash_tx_call', table_name='starknet_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_starknet_sepolia_labels_tx_hash_log_idx_evt', table_name='starknet_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_starknet_sepolia_labels_addr_block_ts', table_name='starknet_sepolia_labels') - op.drop_constraint(op.f('uq_starknet_labels_id'), 'starknet_labels', type_='unique') op.drop_index('uk_starknet_labels_tx_hash_tx_call', table_name='starknet_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_starknet_labels_tx_hash_log_idx_evt', table_name='starknet_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_starknet_labels_addr_block_ts', table_name='starknet_labels') - op.drop_constraint(op.f('uq_sepolia_labels_id'), 'sepolia_labels', type_='unique') op.drop_index('uk_sepolia_labels_tx_hash_tx_call', table_name='sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_sepolia_labels_tx_hash_log_idx_evt', table_name='sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_sepolia_labels_addr_block_ts', table_name='sepolia_labels') - op.drop_constraint(op.f('uq_proofofplay_apex_labels_id'), 'proofofplay_apex_labels', type_='unique') op.drop_index('uk_proofofplay_apex_labels_tx_hash_tx_call', table_name='proofofplay_apex_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_proofofplay_apex_labels_tx_hash_log_idx_evt', table_name='proofofplay_apex_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_constraint(op.f('uq_polygon_labels_id'), 'polygon_labels', type_='unique') op.drop_index('uk_polygon_labels_tx_hash_tx_call', table_name='polygon_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_polygon_labels_tx_hash_log_idx_evt', table_name='polygon_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_polygon_labels_addr_block_ts', table_name='polygon_labels') - op.drop_constraint(op.f('uq_mumbai_labels_id'), 'mumbai_labels', type_='unique') op.drop_index('uk_mumbai_labels_tx_hash_tx_call', table_name='mumbai_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_mumbai_labels_tx_hash_log_idx_evt', table_name='mumbai_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_mumbai_labels_addr_block_ts', table_name='mumbai_labels') - op.drop_constraint(op.f('uq_ethereum_labels_id'), 'ethereum_labels', type_='unique') op.drop_index('uk_ethereum_labels_tx_hash_tx_call', table_name='ethereum_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_ethereum_labels_tx_hash_log_idx_evt', table_name='ethereum_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_ethereum_labels_addr_block_ts', table_name='ethereum_labels') - op.drop_constraint(op.f('uq_blast_sepolia_labels_id'), 'blast_sepolia_labels', type_='unique') op.drop_index('uk_blast_sepolia_labels_tx_hash_tx_call', table_name='blast_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_blast_sepolia_labels_tx_hash_log_idx_evt', table_name='blast_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_constraint(op.f('uq_blast_labels_id'), 'blast_labels', type_='unique') op.drop_index('uk_blast_labels_tx_hash_tx_call', table_name='blast_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_blast_labels_tx_hash_log_idx_evt', table_name='blast_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_constraint(op.f('uq_base_labels_id'), 'base_labels', type_='unique') op.drop_index('uk_base_labels_tx_hash_tx_call', table_name='base_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_base_labels_tx_hash_log_idx_evt', table_name='base_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_base_labels_addr_block_ts', table_name='base_labels') - op.drop_constraint(op.f('uq_avalanche_labels_id'), 'avalanche_labels', type_='unique') op.drop_index('uk_avalanche_labels_tx_hash_tx_call', table_name='avalanche_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_avalanche_labels_tx_hash_log_idx_evt', table_name='avalanche_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_avalanche_labels_addr_block_ts', table_name='avalanche_labels') - op.drop_constraint(op.f('uq_avalanche_fuji_labels_id'), 'avalanche_fuji_labels', type_='unique') op.drop_index('uk_avalanche_fuji_labels_tx_hash_tx_call', table_name='avalanche_fuji_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_avalanche_fuji_labels_tx_hash_log_idx_evt', table_name='avalanche_fuji_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_avalanche_fuji_labels_addr_block_ts', table_name='avalanche_fuji_labels') - op.drop_constraint(op.f('uq_arbitrum_sepolia_labels_id'), 'arbitrum_sepolia_labels', type_='unique') op.drop_index('uk_arbitrum_sepolia_labels_tx_hash_tx_call', table_name='arbitrum_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_arbitrum_sepolia_labels_tx_hash_log_idx_evt', table_name='arbitrum_sepolia_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_index('ix_arbitrum_sepolia_labels_addr_block_ts', table_name='arbitrum_sepolia_labels') - op.drop_constraint(op.f('uq_arbitrum_one_labels_id'), 'arbitrum_one_labels', type_='unique') op.drop_index('uk_arbitrum_one_labels_tx_hash_tx_call', table_name='arbitrum_one_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_arbitrum_one_labels_tx_hash_log_idx_evt', table_name='arbitrum_one_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_constraint(op.f('uq_arbitrum_nova_labels_id'), 'arbitrum_nova_labels', type_='unique') op.drop_index('uk_arbitrum_nova_labels_tx_hash_tx_call', table_name='arbitrum_nova_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_arbitrum_nova_labels_tx_hash_log_idx_evt', table_name='arbitrum_nova_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) - op.drop_constraint(op.f('uq_amoy_labels_id'), 'amoy_labels', type_='unique') op.drop_index('uk_amoy_labels_tx_hash_tx_call', table_name='amoy_labels', postgresql_where=sa.text("label='seer' and label_type='tx_call'")) op.drop_index('uk_amoy_labels_tx_hash_log_idx_evt', table_name='amoy_labels', postgresql_where=sa.text("label='seer' and label_type='event'")) # ### end Alembic commands ###