Skip to content

Commit 50bce68

Browse files
authored
fix: catch accounts without balance to track balance after cutoff (#801)
1 parent 969a742 commit 50bce68

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

deployment/migrations/versions/0034_8ece21fbeb47_balance_tracker.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ def upgrade() -> None:
3838
"""
3939
)
4040

41+
op.execute(
42+
"""
43+
INSERT INTO balances(address, chain, balance, eth_height)
44+
SELECT distinct m.sender, 'ETH', 0, 22196000 FROM messages m
45+
INNER JOIN message_status ms ON m.item_hash = ms.item_hash
46+
LEFT JOIN balances b ON m.sender = b.address
47+
WHERE m."type" = 'STORE' AND ms.status = 'processed' AND b.address is null AND m."time" > '2025-04-04T0:0:0.000Z'
48+
"""
49+
)
50+
4151
pass
4252

4353

@@ -46,4 +56,10 @@ def downgrade() -> None:
4656

4757
op.drop_table("cron_jobs")
4858

59+
op.execute(
60+
"""
61+
DELETE FROM balances b WHERE b.eth_height = 22196000
62+
"""
63+
)
64+
4965
pass

0 commit comments

Comments
 (0)