fix datetime conversion

This commit is contained in:
callebtc
2022-12-02 17:38:36 +01:00
parent 79ffbb7bc2
commit 4e69924c9c
3 changed files with 16 additions and 11 deletions
+6 -2
View File
@@ -197,6 +197,10 @@ async def m006_add_invoice_expiry_to_apipayments(db):
Adds invoice expiry field 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(
@@ -206,7 +210,7 @@ async def m006_add_invoice_expiry_to_apipayments(db):
WHERE pending = true
AND bolt11 IS NOT NULL
AND expiry IS NULL
AND amount > 0 AND time < {db.timestamp_now} - {db.interval_seconds(86400)}
AND amount > 0 AND time < {db.timestamp_now}
"""
)
).fetchall()
@@ -237,7 +241,7 @@ async def m006_add_invoice_expiry_to_apipayments(db):
WHERE checking_id = ? AND amount > 0
""",
(
expiration_date,
db.datetime_to_timestamp(expiration_date),
invoice.payment_hash,
),
)