Skip to content

Commit

Permalink
fix migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
kgarbacinski committed Apr 18, 2024
1 parent 683c578 commit 6d804aa
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,28 @@
from alembic import op
from decimal import Decimal

# revision identifiers, used by Alembic.
revision = "8e72b01c43a7"
down_revision = "fc7a01c20be5"
branch_labels = None
depends_on = None

individual_rewards = Decimal(
"146655862334541166188"
) # Got directly from the database for Pending Snapshot in Epoch3
staking_proceeds = Decimal(
"959848624830407629247"
) # Got directly from the database for Pending Snapshot in Epoch3
ppf = int(staking_proceeds * Decimal("0.35") - individual_rewards)

def upgrade():
individual_rewards = Decimal(
"146655862334541166188"
) # Got directly from the database for Pending Snapshot in Epoch3
staking_proceeds = Decimal(
"959848624830407629247"
) # Got directly from the database for Pending Snapshto in Epoch3
ppf = staking_proceeds * Decimal("0.35") - individual_rewards

def upgrade():
query = f"UPDATE pending_epoch_snapshots SET ppf = '{ppf}' WHERE epoch = 3 AND all_individual_rewards = '{individual_rewards}' AND eth_proceeds = '{staking_proceeds}';"
op.execute(query)


def downgrade():
old_ppf = "335947018690642670236"

query = f"UPDATE pending_epoch_snapshots SET ppf = '{old_ppf}' WHERE epoch = 3 AND all_individual_rewards = '{individual_rewards}' AND eth_proceeds = '{staking_proceeds}' AND ppf = '{ppf};"

op.execute(query)

0 comments on commit 6d804aa

Please sign in to comment.