Game7 mainnet indexes table

pull/1133/head
kompotkot 2024-10-14 16:11:21 +00:00
rodzic c2434a90d7
commit c61671f4f3
3 zmienionych plików z 80 dodań i 0 usunięć

Wyświetl plik

@ -44,10 +44,12 @@ from moonstreamdbv3.models_indexes import (
EthereumLogIndex,
EthereumReorgs,
EthereumTransactionIndex,
Game7BlockIndex,
Game7OrbitArbitrumSepoliaBlockIndex,
Game7OrbitArbitrumSepoliaLogIndex,
Game7OrbitArbitrumSepoliaReorgs,
Game7OrbitArbitrumSepoliaTransactionIndex,
Game7Reorgs,
Game7TestnetBlockIndex,
Game7TestnetLogIndex,
Game7TestnetReorgs,
@ -113,6 +115,8 @@ def include_symbol(tablename, schema):
Game7OrbitArbitrumSepoliaTransactionIndex.__tablename__,
Game7OrbitArbitrumSepoliaLogIndex.__tablename__,
Game7OrbitArbitrumSepoliaReorgs.__tablename__,
Game7BlockIndex.__tablename__,
Game7Reorgs.__tablename__,
Game7TestnetBlockIndex.__tablename__,
Game7TestnetTransactionIndex.__tablename__,
Game7TestnetLogIndex.__tablename__,

Wyświetl plik

@ -0,0 +1,57 @@
"""Add Game7 mainnet indexes
Revision ID: c1bc596631f9
Revises: 6807bdf6f417
Create Date: 2024-10-14 16:10:27.757094
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'c1bc596631f9'
down_revision: Union[str, None] = '6807bdf6f417'
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_table('game7_blocks',
sa.Column('l1_block_number', sa.BigInteger(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('block_timestamp', sa.BigInteger(), nullable=False),
sa.Column('parent_hash', sa.VARCHAR(length=256), nullable=False),
sa.Column('row_id', sa.BigInteger(), nullable=False),
sa.Column('path', sa.Text(), nullable=False),
sa.Column('transactions_indexed_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('logs_indexed_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('indexed_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
sa.PrimaryKeyConstraint('block_number', name=op.f('pk_game7_blocks'))
)
op.create_index(op.f('ix_game7_blocks_block_number'), 'game7_blocks', ['block_number'], unique=False)
op.create_index(op.f('ix_game7_blocks_block_timestamp'), 'game7_blocks', ['block_timestamp'], unique=False)
op.create_table('game7_reorgs',
sa.Column('id', sa.UUID(), nullable=False),
sa.Column('block_number', sa.BigInteger(), nullable=False),
sa.Column('block_hash', sa.VARCHAR(length=256), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_game7_reorgs'))
)
op.create_index(op.f('ix_game7_reorgs_block_hash'), 'game7_reorgs', ['block_hash'], unique=False)
op.create_index(op.f('ix_game7_reorgs_block_number'), 'game7_reorgs', ['block_number'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_game7_reorgs_block_number'), table_name='game7_reorgs')
op.drop_index(op.f('ix_game7_reorgs_block_hash'), table_name='game7_reorgs')
op.drop_table('game7_reorgs')
op.drop_index(op.f('ix_game7_blocks_block_timestamp'), table_name='game7_blocks')
op.drop_index(op.f('ix_game7_blocks_block_number'), table_name='game7_blocks')
op.drop_table('game7_blocks')
# ### end Alembic commands ###

Wyświetl plik

@ -727,6 +727,22 @@ class ImxZkevmSepoliaReorgs(EvmBasedReorgs):
__tablename__ = "imx_zkevm_sepolia_reorgs"
# Game7
class Game7BlockIndex(EvmBasedBlocks):
__tablename__ = "game7_blocks"
l1_block_number = Column(BigInteger, nullable=False)
class Game7Reorgs(EvmBasedReorgs):
__tablename__ = "game7_reorgs"
# Game7 Testnet
class Game7TestnetBlockIndex(EvmBasedBlocks):
__tablename__ = "game7_testnet_blocks"
@ -775,6 +791,9 @@ class Game7TestnetReorgs(EvmBasedReorgs):
__tablename__ = "game7_testnet_reorgs"
# B3
class B3BlockIndex(EvmBasedBlocks):
__tablename__ = "b3_blocks"