From 36cebffbf59a1477ff919a6fad47e3db22795c37 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Tue, 6 Dec 2022 13:23:51 +0100 Subject: [PATCH] clean migration --- lnbits/core/migrations.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lnbits/core/migrations.py b/lnbits/core/migrations.py index d98c959ff..9853c33b9 100644 --- a/lnbits/core/migrations.py +++ b/lnbits/core/migrations.py @@ -197,13 +197,14 @@ async def m005_balance_check_balance_notify(db): async def m006_add_invoice_expiry_to_apipayments(db): """ - Adds invoice expiry field to apipayments and precomputes them for + Adds invoice expiry column to apipayments and precomputes them for existing entries """ try: await db.execute("ALTER TABLE apipayments ADD COLUMN expiry TIMESTAMP") except OperationalError: pass + try: rows = await ( await db.execute( @@ -217,12 +218,11 @@ async def m006_add_invoice_expiry_to_apipayments(db): """ ) ).fetchall() - logger.info(f"Checking expiry of {len(rows)} invoices") + logger.info(f"Mirgraion: Checking expiry of {len(rows)} invoices") for i, ( payment_request, checking_id, ) in enumerate(rows): - logger.info(f"Checking invoice {i}/{len(rows)}") try: invoice = bolt11.decode(payment_request) if invoice.expiry is None: @@ -232,7 +232,7 @@ async def m006_add_invoice_expiry_to_apipayments(db): invoice.date + invoice.expiry ) logger.info( - f"Setting expiry of invoice {invoice.payment_hash} to {expiration_date}" + f"Mirgraion: {i}/{len(rows)} setting expiry of invoice {invoice.payment_hash} to {expiration_date}" ) await db.execute( """