separate migrations

This commit is contained in:
callebtc
2022-12-06 16:21:19 +01:00
parent 00a3bd9ce7
commit 3bb11dc487
2 changed files with 9 additions and 3 deletions
+7 -3
View File
@@ -197,14 +197,18 @@ async def m005_balance_check_balance_notify(db):
async def m006_add_invoice_expiry_to_apipayments(db):
"""
Adds invoice expiry column to apipayments and precomputes them for
existing entries
Adds invoice expiry column to apipayments.
"""
try:
await db.execute("ALTER TABLE apipayments ADD COLUMN expiry TIMESTAMP")
except OperationalError:
pass
async def m007_set_invoice_expiries(db):
"""
Precomputes invoice expiry for existing pending incoming payments.
"""
try:
rows = await (
await db.execute(
@@ -232,7 +236,7 @@ async def m006_add_invoice_expiry_to_apipayments(db):
invoice.date + invoice.expiry
)
logger.info(
f"Mirgraion: {i}/{len(rows)} setting expiry of invoice {invoice.payment_hash} to {expiration_date}"
f"Mirgraion: {i+1}/{len(rows)} setting expiry of invoice {invoice.payment_hash} to {expiration_date}"
)
await db.execute(
"""