paymentsdb+sqldb: add migration related query

Add a migration specific query which allows to set the failure
reason when inserting a payment into the db.
This commit is contained in:
ziggie committed 2026-02-25 18:52:31 +01:00
1 parent e9a88267ff
commit 2596d34619
4 files changed
+179

No files matched your search

+8
View File
@@ -54,6 +54,9 @@ type Querier interface {
// Used to avoid fetching redundant payment data when processing multiple
// attempts for the same payment.
FetchPaymentsByIDs(ctx context.Context, paymentIds []int64) ([]FetchPaymentsByIDsRow, error)
// Migration-specific batch fetch that returns payment data along with HTLC
// attempt counts for structural validation during KV to SQL migration.
FetchPaymentsByIDsMig(ctx context.Context, paymentIds []int64) ([]FetchPaymentsByIDsMigRow, error)
// FetchPendingInvoices returns all invoices in a pending state (open or
// accepted). The invoices_state_idx index on the state column makes this a
// fast index scan rather than a full table scan.
@@ -178,6 +181,11 @@ type Querier interface {
InsertPaymentHopCustomRecord(ctx context.Context, arg InsertPaymentHopCustomRecordParams) error
// Insert a payment intent for a given payment and return its ID.
InsertPaymentIntent(ctx context.Context, arg InsertPaymentIntentParams) (int64, error)
// Migration-specific payment insert that allows setting fail_reason.
// Normal InsertPayment forces fail_reason to NULL since new payments
// aren't failed yet. During migration, we're inserting historical data
// that may already be failed.
InsertPaymentMig(ctx context.Context, arg InsertPaymentMigParams) (int64, error)
InsertRouteHop(ctx context.Context, arg InsertRouteHopParams) (int64, error)
InsertRouteHopAmp(ctx context.Context, arg InsertRouteHopAmpParams) error
InsertRouteHopBlinded(ctx context.Context, arg InsertRouteHopBlindedParams) error