|
1 | | -"""add transactions |
| 1 | +"""add raw transactions |
2 | 2 |
|
3 | | -Revision ID: d13b6bb1d214 |
4 | | -Revises: d816689b786a |
5 | | -Create Date: 2024-11-10 23:34:21.581396 |
| 3 | +Revision ID: a6580c96ae2c |
| 4 | +Revises: e6d3c285e7cc |
| 5 | +Create Date: 2024-11-13 11:56:48.605875 |
6 | 6 |
|
7 | 7 | """ |
8 | 8 |
|
|
13 | 13 | from sqlalchemy.dialects import postgresql |
14 | 14 |
|
15 | 15 | # revision identifiers, used by Alembic. |
16 | | -revision: str = "d13b6bb1d214" |
17 | | -down_revision: Union[str, None] = "d816689b786a" |
| 16 | +revision: str = "a6580c96ae2c" |
| 17 | +down_revision: Union[str, None] = "e6d3c285e7cc" |
18 | 18 | branch_labels: Union[str, Sequence[str], None] = None |
19 | 19 | depends_on: Union[str, Sequence[str], None] = None |
20 | 20 |
|
@@ -1569,6 +1569,72 @@ def upgrade() -> None: |
1569 | 1569 | ["value"], |
1570 | 1570 | unique=False, |
1571 | 1571 | ) |
| 1572 | + op.create_table( |
| 1573 | + "ronin_transactions", |
| 1574 | + sa.Column("hash", sa.VARCHAR(length=256), nullable=False), |
| 1575 | + sa.Column("block_timestamp", sa.BigInteger(), nullable=False), |
| 1576 | + sa.Column("block_hash", sa.VARCHAR(length=256), nullable=False), |
| 1577 | + sa.Column("from_address", sa.LargeBinary(), nullable=True), |
| 1578 | + sa.Column("to_address", sa.LargeBinary(), nullable=True), |
| 1579 | + sa.Column("gas", sa.BigInteger(), nullable=True), |
| 1580 | + sa.Column("gas_price", sa.BigInteger(), nullable=True), |
| 1581 | + sa.Column("max_fee_per_gas", sa.BigInteger(), nullable=True), |
| 1582 | + sa.Column("max_priority_fee_per_gas", sa.BigInteger(), nullable=True), |
| 1583 | + sa.Column("input", sa.Text(), nullable=True), |
| 1584 | + sa.Column("nonce", sa.BigInteger(), nullable=True), |
| 1585 | + sa.Column("transaction_index", sa.BigInteger(), nullable=True), |
| 1586 | + sa.Column("transaction_type", sa.Integer(), nullable=True), |
| 1587 | + sa.Column("value", sa.BigInteger(), nullable=True), |
| 1588 | + sa.Column( |
| 1589 | + "indexed_at", |
| 1590 | + sa.DateTime(timezone=True), |
| 1591 | + server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), |
| 1592 | + nullable=False, |
| 1593 | + ), |
| 1594 | + sa.PrimaryKeyConstraint("hash", name=op.f("pk_ronin_transactions")), |
| 1595 | + ) |
| 1596 | + op.create_index( |
| 1597 | + op.f("ix_ronin_transactions_block_hash"), |
| 1598 | + "ronin_transactions", |
| 1599 | + ["block_hash"], |
| 1600 | + unique=False, |
| 1601 | + ) |
| 1602 | + op.create_index( |
| 1603 | + op.f("ix_ronin_transactions_block_timestamp"), |
| 1604 | + "ronin_transactions", |
| 1605 | + ["block_timestamp"], |
| 1606 | + unique=False, |
| 1607 | + ) |
| 1608 | + op.create_index( |
| 1609 | + op.f("ix_ronin_transactions_from_address"), |
| 1610 | + "ronin_transactions", |
| 1611 | + ["from_address"], |
| 1612 | + unique=False, |
| 1613 | + ) |
| 1614 | + op.create_index( |
| 1615 | + op.f("ix_ronin_transactions_gas"), "ronin_transactions", ["gas"], unique=False |
| 1616 | + ) |
| 1617 | + op.create_index( |
| 1618 | + op.f("ix_ronin_transactions_gas_price"), |
| 1619 | + "ronin_transactions", |
| 1620 | + ["gas_price"], |
| 1621 | + unique=False, |
| 1622 | + ) |
| 1623 | + op.create_index( |
| 1624 | + op.f("ix_ronin_transactions_hash"), "ronin_transactions", ["hash"], unique=True |
| 1625 | + ) |
| 1626 | + op.create_index( |
| 1627 | + op.f("ix_ronin_transactions_to_address"), |
| 1628 | + "ronin_transactions", |
| 1629 | + ["to_address"], |
| 1630 | + unique=False, |
| 1631 | + ) |
| 1632 | + op.create_index( |
| 1633 | + op.f("ix_ronin_transactions_value"), |
| 1634 | + "ronin_transactions", |
| 1635 | + ["value"], |
| 1636 | + unique=False, |
| 1637 | + ) |
1572 | 1638 | op.create_table( |
1573 | 1639 | "sepolia_transactions", |
1574 | 1640 | sa.Column("hash", sa.VARCHAR(length=256), nullable=False), |
@@ -2142,6 +2208,25 @@ def downgrade() -> None: |
2142 | 2208 | op.f("ix_sepolia_transactions_block_hash"), table_name="sepolia_transactions" |
2143 | 2209 | ) |
2144 | 2210 | op.drop_table("sepolia_transactions") |
| 2211 | + op.drop_index(op.f("ix_ronin_transactions_value"), table_name="ronin_transactions") |
| 2212 | + op.drop_index( |
| 2213 | + op.f("ix_ronin_transactions_to_address"), table_name="ronin_transactions" |
| 2214 | + ) |
| 2215 | + op.drop_index(op.f("ix_ronin_transactions_hash"), table_name="ronin_transactions") |
| 2216 | + op.drop_index( |
| 2217 | + op.f("ix_ronin_transactions_gas_price"), table_name="ronin_transactions" |
| 2218 | + ) |
| 2219 | + op.drop_index(op.f("ix_ronin_transactions_gas"), table_name="ronin_transactions") |
| 2220 | + op.drop_index( |
| 2221 | + op.f("ix_ronin_transactions_from_address"), table_name="ronin_transactions" |
| 2222 | + ) |
| 2223 | + op.drop_index( |
| 2224 | + op.f("ix_ronin_transactions_block_timestamp"), table_name="ronin_transactions" |
| 2225 | + ) |
| 2226 | + op.drop_index( |
| 2227 | + op.f("ix_ronin_transactions_block_hash"), table_name="ronin_transactions" |
| 2228 | + ) |
| 2229 | + op.drop_table("ronin_transactions") |
2145 | 2230 | op.drop_index( |
2146 | 2231 | op.f("ix_proofofplay_apex_transactions_value"), |
2147 | 2232 | table_name="proofofplay_apex_transactions", |
|
0 commit comments