sqldb: set settled_at and settle_index on invocie insertion is set

Previously we intentially did not set settled_at and settle_index when
inserting a new invoice as those fields are set when we settle an
invoice through the usual invoice update. As migration requires that we
set these nullable fields, we can safely add them.
This commit is contained in:
Andras Banki-Horvath
2024-06-11 22:27:43 +02:00
parent 115f96c29a
commit 3820497d7f
3 changed files with 66 additions and 0 deletions

View File

@ -7,6 +7,16 @@ INSERT INTO invoices (
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15
) RETURNING id;
-- name: InsertMigratedInvoice :one
INSERT INTO invoices (
hash, preimage, settle_index, settled_at, memo, amount_msat, cltv_delta,
expiry, payment_addr, payment_request, payment_request_hash, state,
amount_paid_msat, is_amp, is_hodl, is_keysend, created_at
) VALUES (
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17
) RETURNING id;
-- name: InsertInvoiceFeature :exec
INSERT INTO invoice_features (
invoice_id, feature