mev-inspect-py/alembic/versions/a5a44a7c854d_create_total_profit_by_block_table.py
Luca G.F f24a802de5
Add total profit by block table in db (#6)
* feat: add new alembic migration

Signed-off-by: Luca Georges Francois <luca@quartz.technology>

* feat: add method to store total profits in bulk

Signed-off-by: Luca Georges Francois <luca@quartz.technology>

Signed-off-by: Luca Georges Francois <luca@quartz.technology>
2022-12-27 16:33:22 +00:00

32 lines
850 B
Python

"""create total profit by block table
Revision ID: a5a44a7c854d
Revises: 5c5375de15fd
Create Date: 2022-12-12 02:46:57.125040
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "a5a44a7c854d"
down_revision = "5c5375de15fd"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"total_profit_by_block",
sa.Column("block_number", sa.Numeric, primary_key=True),
sa.Column("transaction_hash", sa.String(66), nullable=False),
sa.Column("token_debt", sa.String(66), nullable=True),
sa.Column("amount_debt", sa.Numeric, nullable=False),
sa.Column("token_received", sa.String(66), nullable=False),
sa.Column("amount_received", sa.Numeric, nullable=False),
)
def downgrade():
op.drop_table("total_profit_by_block")