Migration with field for EIP 1559

pull/339/head
kompotkot 2021-10-26 09:59:26 +00:00
rodzic 9b0a267023
commit 205b223447
2 zmienionych plików z 35 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,32 @@
"""fields-for-eip-1559
Revision ID: 0b46c8e17bf2
Revises: 240476c67b9f
Create Date: 2021-10-26 09:52:17.367528
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '0b46c8e17bf2'
down_revision = '240476c67b9f'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('ethereum_blocks', sa.Column('base_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True))
op.add_column('ethereum_transactions', sa.Column('max_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True))
op.add_column('ethereum_transactions', sa.Column('max_priority_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('ethereum_transactions', 'max_priority_fee_per_gas')
op.drop_column('ethereum_transactions', 'max_fee_per_gas')
op.drop_column('ethereum_blocks', 'base_fee_per_gas')
# ### end Alembic commands ###

Wyświetl plik

@ -59,6 +59,7 @@ class EthereumBlock(Base): # type: ignore
extra_data = Column(VARCHAR(128))
gas_limit = Column(BigInteger)
gas_used = Column(BigInteger)
base_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
hash = Column(VARCHAR(256), index=True)
logs_bloom = Column(VARCHAR(1024))
miner = Column(VARCHAR(256))
@ -92,6 +93,8 @@ class EthereumTransaction(Base): # type: ignore
to_address = Column(VARCHAR(256), index=True)
gas = Column(Numeric(precision=78, scale=0), index=True)
gas_price = Column(Numeric(precision=78, scale=0), index=True)
max_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
max_priority_fee_per_gas = Column(Numeric(precision=78, scale=0), nullable=True)
input = Column(Text)
nonce = Column(VARCHAR(256))
transaction_index = Column(BigInteger)