kopia lustrzana https://github.com/bugout-dev/moonstream
ethereum_sepolia -> sepolia
rodzic
bc20aab171
commit
6deae0e967
|
@ -22,7 +22,7 @@ depends_on: Union[str, Sequence[str], None] = None
|
||||||
def upgrade() -> None:
|
def upgrade() -> None:
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"ethereum_sepolia_blocks",
|
"sepolia_blocks",
|
||||||
sa.Column("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_hash", sa.VARCHAR(length=256), nullable=False),
|
||||||
sa.Column("block_timestamp", sa.BigInteger(), nullable=False),
|
sa.Column("block_timestamp", sa.BigInteger(), nullable=False),
|
||||||
|
@ -35,43 +35,41 @@ def upgrade() -> None:
|
||||||
server_default=sa.text("TIMEZONE('utc', statement_timestamp())"),
|
server_default=sa.text("TIMEZONE('utc', statement_timestamp())"),
|
||||||
nullable=False,
|
nullable=False,
|
||||||
),
|
),
|
||||||
sa.PrimaryKeyConstraint(
|
sa.PrimaryKeyConstraint("block_number", name=op.f("pk_sepolia_blocks")),
|
||||||
"block_number", name=op.f("pk_ethereum_sepolia_blocks")
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_blocks_block_number"),
|
op.f("ix_sepolia_blocks_block_number"),
|
||||||
"ethereum_sepolia_blocks",
|
"sepolia_blocks",
|
||||||
["block_number"],
|
["block_number"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_blocks_block_timestamp"),
|
op.f("ix_sepolia_blocks_block_timestamp"),
|
||||||
"ethereum_sepolia_blocks",
|
"sepolia_blocks",
|
||||||
["block_timestamp"],
|
["block_timestamp"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"ethereum_sepolia_reorgs",
|
"sepolia_reorgs",
|
||||||
sa.Column("id", sa.UUID(), nullable=False),
|
sa.Column("id", sa.UUID(), nullable=False),
|
||||||
sa.Column("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_hash", sa.VARCHAR(length=256), nullable=False),
|
||||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_ethereum_sepolia_reorgs")),
|
sa.PrimaryKeyConstraint("id", name=op.f("pk_sepolia_reorgs")),
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_reorgs_block_hash"),
|
op.f("ix_sepolia_reorgs_block_hash"),
|
||||||
"ethereum_sepolia_reorgs",
|
"sepolia_reorgs",
|
||||||
["block_hash"],
|
["block_hash"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_reorgs_block_number"),
|
op.f("ix_sepolia_reorgs_block_number"),
|
||||||
"ethereum_sepolia_reorgs",
|
"sepolia_reorgs",
|
||||||
["block_number"],
|
["block_number"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"ethereum_sepolia_transactions",
|
"sepolia_transactions",
|
||||||
sa.Column("block_number", sa.BigInteger(), nullable=False),
|
sa.Column("block_number", sa.BigInteger(), nullable=False),
|
||||||
sa.Column("hash", sa.VARCHAR(length=256), nullable=False),
|
sa.Column("hash", sa.VARCHAR(length=256), nullable=False),
|
||||||
sa.Column("from_address", sa.LargeBinary(length=20), nullable=False),
|
sa.Column("from_address", sa.LargeBinary(length=20), nullable=False),
|
||||||
|
@ -90,64 +88,62 @@ def upgrade() -> None:
|
||||||
),
|
),
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
["block_number"],
|
["block_number"],
|
||||||
["ethereum_sepolia_blocks.block_number"],
|
["sepolia_blocks.block_number"],
|
||||||
name=op.f(
|
name=op.f("fk_sepolia_transactions_block_number_sepolia_blocks"),
|
||||||
"fk_ethereum_sepolia_transactions_block_number_ethereum_sepolia_blocks"
|
|
||||||
),
|
|
||||||
ondelete="CASCADE",
|
ondelete="CASCADE",
|
||||||
),
|
),
|
||||||
sa.PrimaryKeyConstraint("hash", name=op.f("pk_ethereum_sepolia_transactions")),
|
sa.PrimaryKeyConstraint("hash", name=op.f("pk_sepolia_transactions")),
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_transactions_block_hash"),
|
op.f("ix_sepolia_transactions_block_hash"),
|
||||||
"ethereum_sepolia_transactions",
|
"sepolia_transactions",
|
||||||
["block_hash"],
|
["block_hash"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_transactions_block_number"),
|
op.f("ix_sepolia_transactions_block_number"),
|
||||||
"ethereum_sepolia_transactions",
|
"sepolia_transactions",
|
||||||
["block_number"],
|
["block_number"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_transactions_from_address"),
|
op.f("ix_sepolia_transactions_from_address"),
|
||||||
"ethereum_sepolia_transactions",
|
"sepolia_transactions",
|
||||||
["from_address"],
|
["from_address"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_transactions_hash"),
|
op.f("ix_sepolia_transactions_hash"),
|
||||||
"ethereum_sepolia_transactions",
|
"sepolia_transactions",
|
||||||
["hash"],
|
["hash"],
|
||||||
unique=True,
|
unique=True,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_transactions_index"),
|
op.f("ix_sepolia_transactions_index"),
|
||||||
"ethereum_sepolia_transactions",
|
"sepolia_transactions",
|
||||||
["index"],
|
["index"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_transactions_selector"),
|
op.f("ix_sepolia_transactions_selector"),
|
||||||
"ethereum_sepolia_transactions",
|
"sepolia_transactions",
|
||||||
["selector"],
|
["selector"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_transactions_to_address"),
|
op.f("ix_sepolia_transactions_to_address"),
|
||||||
"ethereum_sepolia_transactions",
|
"sepolia_transactions",
|
||||||
["to_address"],
|
["to_address"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_transactions_type"),
|
op.f("ix_sepolia_transactions_type"),
|
||||||
"ethereum_sepolia_transactions",
|
"sepolia_transactions",
|
||||||
["type"],
|
["type"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
"ethereum_sepolia_logs",
|
"sepolia_logs",
|
||||||
sa.Column("transaction_hash", sa.VARCHAR(length=256), nullable=False),
|
sa.Column("transaction_hash", sa.VARCHAR(length=256), nullable=False),
|
||||||
sa.Column("block_hash", sa.VARCHAR(length=256), nullable=False),
|
sa.Column("block_hash", sa.VARCHAR(length=256), nullable=False),
|
||||||
sa.Column("address", sa.LargeBinary(length=20), nullable=False),
|
sa.Column("address", sa.LargeBinary(length=20), nullable=False),
|
||||||
|
@ -166,48 +162,46 @@ def upgrade() -> None:
|
||||||
),
|
),
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
["transaction_hash"],
|
["transaction_hash"],
|
||||||
["ethereum_sepolia_transactions.hash"],
|
["sepolia_transactions.hash"],
|
||||||
name=op.f(
|
name=op.f("fk_sepolia_logs_transaction_hash_sepolia_transactions"),
|
||||||
"fk_ethereum_sepolia_logs_transaction_hash_ethereum_sepolia_transactions"
|
|
||||||
),
|
|
||||||
ondelete="CASCADE",
|
ondelete="CASCADE",
|
||||||
),
|
),
|
||||||
sa.PrimaryKeyConstraint(
|
sa.PrimaryKeyConstraint(
|
||||||
"transaction_hash", "log_index", name="pk_ethereum_sepolia_log_index"
|
"transaction_hash", "log_index", name="pk_sepolia_log_index"
|
||||||
),
|
),
|
||||||
sa.UniqueConstraint(
|
sa.UniqueConstraint(
|
||||||
"transaction_hash",
|
"transaction_hash",
|
||||||
"log_index",
|
"log_index",
|
||||||
name="uq_ethereum_sepolia_log_index_transaction_hash_log_index",
|
name="uq_sepolia_log_index_transaction_hash_log_index",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
"idx_ethereum_sepolia_logs_address_selector",
|
"idx_sepolia_logs_address_selector",
|
||||||
"ethereum_sepolia_logs",
|
"sepolia_logs",
|
||||||
["address", "selector"],
|
["address", "selector"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
"idx_ethereum_sepolia_logs_block_hash_log_index",
|
"idx_sepolia_logs_block_hash_log_index",
|
||||||
"ethereum_sepolia_logs",
|
"sepolia_logs",
|
||||||
["block_hash", "log_index"],
|
["block_hash", "log_index"],
|
||||||
unique=True,
|
unique=True,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_logs_address"),
|
op.f("ix_sepolia_logs_address"),
|
||||||
"ethereum_sepolia_logs",
|
"sepolia_logs",
|
||||||
["address"],
|
["address"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_logs_block_hash"),
|
op.f("ix_sepolia_logs_block_hash"),
|
||||||
"ethereum_sepolia_logs",
|
"sepolia_logs",
|
||||||
["block_hash"],
|
["block_hash"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
op.create_index(
|
op.create_index(
|
||||||
op.f("ix_ethereum_sepolia_logs_transaction_hash"),
|
op.f("ix_sepolia_logs_transaction_hash"),
|
||||||
"ethereum_sepolia_logs",
|
"sepolia_logs",
|
||||||
["transaction_hash"],
|
["transaction_hash"],
|
||||||
unique=False,
|
unique=False,
|
||||||
)
|
)
|
||||||
|
@ -217,72 +211,66 @@ def upgrade() -> None:
|
||||||
def downgrade() -> None:
|
def downgrade() -> None:
|
||||||
# ### commands auto generated by Alembic - please adjust! ###
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
op.drop_index(
|
op.drop_index(
|
||||||
op.f("ix_ethereum_sepolia_logs_transaction_hash"),
|
op.f("ix_sepolia_logs_transaction_hash"),
|
||||||
table_name="ethereum_sepolia_logs",
|
table_name="sepolia_logs",
|
||||||
|
)
|
||||||
|
op.drop_index(op.f("ix_sepolia_logs_block_hash"), table_name="sepolia_logs")
|
||||||
|
op.drop_index(op.f("ix_sepolia_logs_address"), table_name="sepolia_logs")
|
||||||
|
op.drop_index(
|
||||||
|
"idx_sepolia_logs_block_hash_log_index",
|
||||||
|
table_name="sepolia_logs",
|
||||||
|
)
|
||||||
|
op.drop_index("idx_sepolia_logs_address_selector", table_name="sepolia_logs")
|
||||||
|
op.drop_table("sepolia_logs")
|
||||||
|
op.drop_index(
|
||||||
|
op.f("ix_sepolia_transactions_type"),
|
||||||
|
table_name="sepolia_transactions",
|
||||||
)
|
)
|
||||||
op.drop_index(
|
op.drop_index(
|
||||||
op.f("ix_ethereum_sepolia_logs_block_hash"), table_name="ethereum_sepolia_logs"
|
op.f("ix_sepolia_transactions_to_address"),
|
||||||
|
table_name="sepolia_transactions",
|
||||||
)
|
)
|
||||||
op.drop_index(
|
op.drop_index(
|
||||||
op.f("ix_ethereum_sepolia_logs_address"), table_name="ethereum_sepolia_logs"
|
op.f("ix_sepolia_transactions_selector"),
|
||||||
|
table_name="sepolia_transactions",
|
||||||
)
|
)
|
||||||
op.drop_index(
|
op.drop_index(
|
||||||
"idx_ethereum_sepolia_logs_block_hash_log_index",
|
op.f("ix_sepolia_transactions_index"),
|
||||||
table_name="ethereum_sepolia_logs",
|
table_name="sepolia_transactions",
|
||||||
)
|
)
|
||||||
op.drop_index(
|
op.drop_index(
|
||||||
"idx_ethereum_sepolia_logs_address_selector", table_name="ethereum_sepolia_logs"
|
op.f("ix_sepolia_transactions_hash"),
|
||||||
)
|
table_name="sepolia_transactions",
|
||||||
op.drop_table("ethereum_sepolia_logs")
|
|
||||||
op.drop_index(
|
|
||||||
op.f("ix_ethereum_sepolia_transactions_type"),
|
|
||||||
table_name="ethereum_sepolia_transactions",
|
|
||||||
)
|
)
|
||||||
op.drop_index(
|
op.drop_index(
|
||||||
op.f("ix_ethereum_sepolia_transactions_to_address"),
|
op.f("ix_sepolia_transactions_from_address"),
|
||||||
table_name="ethereum_sepolia_transactions",
|
table_name="sepolia_transactions",
|
||||||
)
|
)
|
||||||
op.drop_index(
|
op.drop_index(
|
||||||
op.f("ix_ethereum_sepolia_transactions_selector"),
|
op.f("ix_sepolia_transactions_block_number"),
|
||||||
table_name="ethereum_sepolia_transactions",
|
table_name="sepolia_transactions",
|
||||||
)
|
)
|
||||||
op.drop_index(
|
op.drop_index(
|
||||||
op.f("ix_ethereum_sepolia_transactions_index"),
|
op.f("ix_sepolia_transactions_block_hash"),
|
||||||
table_name="ethereum_sepolia_transactions",
|
table_name="sepolia_transactions",
|
||||||
|
)
|
||||||
|
op.drop_table("sepolia_transactions")
|
||||||
|
op.drop_index(
|
||||||
|
op.f("ix_sepolia_reorgs_block_number"),
|
||||||
|
table_name="sepolia_reorgs",
|
||||||
)
|
)
|
||||||
op.drop_index(
|
op.drop_index(
|
||||||
op.f("ix_ethereum_sepolia_transactions_hash"),
|
op.f("ix_sepolia_reorgs_block_hash"),
|
||||||
table_name="ethereum_sepolia_transactions",
|
table_name="sepolia_reorgs",
|
||||||
|
)
|
||||||
|
op.drop_table("sepolia_reorgs")
|
||||||
|
op.drop_index(
|
||||||
|
op.f("ix_sepolia_blocks_block_timestamp"),
|
||||||
|
table_name="sepolia_blocks",
|
||||||
)
|
)
|
||||||
op.drop_index(
|
op.drop_index(
|
||||||
op.f("ix_ethereum_sepolia_transactions_from_address"),
|
op.f("ix_sepolia_blocks_block_number"),
|
||||||
table_name="ethereum_sepolia_transactions",
|
table_name="sepolia_blocks",
|
||||||
)
|
)
|
||||||
op.drop_index(
|
op.drop_table("sepolia_blocks")
|
||||||
op.f("ix_ethereum_sepolia_transactions_block_number"),
|
|
||||||
table_name="ethereum_sepolia_transactions",
|
|
||||||
)
|
|
||||||
op.drop_index(
|
|
||||||
op.f("ix_ethereum_sepolia_transactions_block_hash"),
|
|
||||||
table_name="ethereum_sepolia_transactions",
|
|
||||||
)
|
|
||||||
op.drop_table("ethereum_sepolia_transactions")
|
|
||||||
op.drop_index(
|
|
||||||
op.f("ix_ethereum_sepolia_reorgs_block_number"),
|
|
||||||
table_name="ethereum_sepolia_reorgs",
|
|
||||||
)
|
|
||||||
op.drop_index(
|
|
||||||
op.f("ix_ethereum_sepolia_reorgs_block_hash"),
|
|
||||||
table_name="ethereum_sepolia_reorgs",
|
|
||||||
)
|
|
||||||
op.drop_table("ethereum_sepolia_reorgs")
|
|
||||||
op.drop_index(
|
|
||||||
op.f("ix_ethereum_sepolia_blocks_block_timestamp"),
|
|
||||||
table_name="ethereum_sepolia_blocks",
|
|
||||||
)
|
|
||||||
op.drop_index(
|
|
||||||
op.f("ix_ethereum_sepolia_blocks_block_number"),
|
|
||||||
table_name="ethereum_sepolia_blocks",
|
|
||||||
)
|
|
||||||
op.drop_table("ethereum_sepolia_blocks")
|
|
||||||
# ### end Alembic commands ###
|
# ### end Alembic commands ###
|
||||||
|
|
|
@ -154,15 +154,15 @@ class EthereumReorgs(EvmBasedReorgs):
|
||||||
|
|
||||||
|
|
||||||
class SepoliaBlockIndex(EvmBasedBlocks):
|
class SepoliaBlockIndex(EvmBasedBlocks):
|
||||||
__tablename__ = "ethereum_sepolia_blocks"
|
__tablename__ = "sepolia_blocks"
|
||||||
|
|
||||||
|
|
||||||
class SepoliaTransactionIndex(EvmBasedTransactions):
|
class SepoliaTransactionIndex(EvmBasedTransactions):
|
||||||
__tablename__ = "ethereum_sepolia_transactions"
|
__tablename__ = "sepolia_transactions"
|
||||||
|
|
||||||
block_number = Column(
|
block_number = Column(
|
||||||
BigInteger,
|
BigInteger,
|
||||||
ForeignKey("ethereum_sepolia_blocks.block_number", ondelete="CASCADE"),
|
ForeignKey("sepolia_blocks.block_number", ondelete="CASCADE"),
|
||||||
nullable=False,
|
nullable=False,
|
||||||
index=True,
|
index=True,
|
||||||
)
|
)
|
||||||
|
@ -170,17 +170,17 @@ class SepoliaTransactionIndex(EvmBasedTransactions):
|
||||||
|
|
||||||
class SepoliaLogIndex(EvmBasedLogs):
|
class SepoliaLogIndex(EvmBasedLogs):
|
||||||
|
|
||||||
__tablename__ = "ethereum_sepolia_logs"
|
__tablename__ = "sepolia_logs"
|
||||||
|
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
Index(
|
Index(
|
||||||
"idx_ethereum_sepolia_logs_address_selector",
|
"idx_sepolia_logs_address_selector",
|
||||||
"address",
|
"address",
|
||||||
"selector",
|
"selector",
|
||||||
unique=False,
|
unique=False,
|
||||||
),
|
),
|
||||||
Index(
|
Index(
|
||||||
"idx_ethereum_sepolia_logs_block_hash_log_index",
|
"idx_sepolia_logs_block_hash_log_index",
|
||||||
"block_hash",
|
"block_hash",
|
||||||
"log_index",
|
"log_index",
|
||||||
unique=True,
|
unique=True,
|
||||||
|
@ -188,22 +188,22 @@ class SepoliaLogIndex(EvmBasedLogs):
|
||||||
UniqueConstraint(
|
UniqueConstraint(
|
||||||
"transaction_hash",
|
"transaction_hash",
|
||||||
"log_index",
|
"log_index",
|
||||||
name="uq_ethereum_sepolia_log_index_transaction_hash_log_index",
|
name="uq_sepolia_log_index_transaction_hash_log_index",
|
||||||
),
|
),
|
||||||
PrimaryKeyConstraint(
|
PrimaryKeyConstraint(
|
||||||
"transaction_hash", "log_index", name="pk_ethereum_sepolia_log_index"
|
"transaction_hash", "log_index", name="pk_sepolia_log_index"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
transaction_hash = Column(
|
transaction_hash = Column(
|
||||||
VARCHAR(256),
|
VARCHAR(256),
|
||||||
ForeignKey("ethereum_sepolia_transactions.hash", ondelete="CASCADE"),
|
ForeignKey("sepolia_transactions.hash", ondelete="CASCADE"),
|
||||||
nullable=False,
|
nullable=False,
|
||||||
index=True,
|
index=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SepoliaReorgs(EvmBasedReorgs):
|
class SepoliaReorgs(EvmBasedReorgs):
|
||||||
__tablename__ = "ethereum_sepolia_reorgs"
|
__tablename__ = "sepolia_reorgs"
|
||||||
|
|
||||||
|
|
||||||
### Polygon
|
### Polygon
|
||||||
|
|
Ładowanie…
Reference in New Issue