fix datetime conversion
This commit is contained in:
+2
-1
@@ -348,6 +348,7 @@ async def delete_expired_invoices(
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
# payments
|
||||
# --------
|
||||
|
||||
@@ -399,7 +400,7 @@ async def create_payment(
|
||||
if extra and extra != {} and type(extra) is dict
|
||||
else None,
|
||||
webhook,
|
||||
expiration_date,
|
||||
db.datetime_to_timestamp(expiration_date),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user