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

+19
View File
@@ -87,6 +87,25 @@ type SQLQueries interface {
// DeleteFailedAttempts removes all failed HTLCs from the db for a
// given payment.
DeleteFailedAttempts(ctx context.Context, paymentID int64) error
/*
Migration specific queries.
These queries are used ONLY for the one-time migration from KV
to SQL.
*/
// FetchPaymentsByIDsMig is a migration-only batch fetch that returns
// payment data along with HTLC attempt counts for structural
// validation.
FetchPaymentsByIDsMig(ctx context.Context, paymentIDs []int64) ([]sqlc.FetchPaymentsByIDsMigRow, error)
// InsertPaymentMig is a migration-only variant of InsertPayment that
// allows setting fail_reason when inserting historical payments, since
// for real payments they have not failed at creation time and so no
// failure reason would exist yet.
InsertPaymentMig(ctx context.Context, arg sqlc.InsertPaymentMigParams) (int64, error)
}
// BatchedSQLQueries is a version of the SQLQueries that's capable