sqldb: move native SQL payments migrations into mainline
What changed, and why it matters
This commit moves five database upgrade steps from a test-only file into the normal production upgrade path for LND. It is a code-organization change that makes new payment-related database features available in release builds. There is no direct evidence in the commit that this fixes a security vulnerability; it appears to be a feature-enablement change.
Treat as a normal feature/enablement commit. Review the actual migration SQL files referenced by name (000010_payments, 000011_payment_duplicates, kv_payments_migration, 000012_drop_redundant_invoice_indexes, 000013_payments_index_improvements) separately if security assessment of the schema changes is needed. No immediate security action is indicated by this diff alone.
Security signals we found
No security-relevant code changes visible in the diff
Migration definitions moved from test/dev build tag file to production build path
Optional KV-to-SQL migration remains optional and user-configurable
No advisory, CVE, or security attribution present in commit or supplied references
Evidence from the diff
The commit promotes five SQL migration definitions from sqldb/migrations_dev.go (which is compiled only with test/dev build tags) into sqldb/migrations.go (the main migration registry). The migrations cover the native SQL payments schema, duplicate payment support, an optional KV-to-SQL payment migration, invoice index cleanup, and payment index improvements. The dev file now leaves migrationAdditions as an empty slice with a comment stating all migrations are in the main line. No migration logic is changed; only their registration location changes.
Changed components
sqldb/migrations.gosqldb/migrations_dev.goLND database migration registryInspect captured patch +35 / −31
diff --git a/sqldb/migrations.go b/sqldb/migrations.go
index 28d45f3..c2a3ac2 100644
--- a/sqldb/migrations.go
+++ b/sqldb/migrations.go
@@ -97,6 +97,35 @@ var (
Version: 11,
SchemaVersion: 9,
},
+ {
+ Name: "000010_payments",
+ Version: 12,
+ SchemaVersion: 10,
+ },
+ {
+ Name: "000011_payment_duplicates",
+ Version: 13,
+ SchemaVersion: 11,
+ },
+ {
+ Name: "kv_payments_migration",
+ Version: 14,
+ SchemaVersion: 11,
+ // A migration function may be attached to this
+ // migration to migrate KV payments to the native SQL
+ // schema. This is optional and can be disabled by the
+ // user if necessary.
+ },
+ {
+ Name: "000012_drop_redundant_invoice_indexes",
+ Version: 15,
+ SchemaVersion: 12,
+ },
+ {
+ Name: "000013_payments_index_improvements",
+ Version: 16,
+ SchemaVersion: 13,
+ },
}, migrationAdditions...)
// ErrMigrationMismatch is returned when a migrated record does not
diff --git a/sqldb/migrations_dev.go b/sqldb/migrations_dev.go
index 729160d..60c7b3c 100644
--- a/sqldb/migrations_dev.go
+++ b/sqldb/migrations_dev.go
@@ -2,34 +2,9 @@
package sqldb
-var migrationAdditions = []MigrationConfig{
- {
- Name: "000010_payments",
- Version: 12,
- SchemaVersion: 10,
- },
- {
- Name: "000011_payment_duplicates",
- Version: 13,
- SchemaVersion: 11,
- },
- {
- Name: "kv_payments_migration",
- Version: 14,
- SchemaVersion: 11,
- // A migration function may be attached to this
- // migration to migrate KV payments to the native SQL
- // schema. This is optional and can be disabled by the
- // user if necessary.
- },
- {
- Name: "000012_drop_redundant_invoice_indexes",
- Version: 15,
- SchemaVersion: 12,
- },
- {
- Name: "000013_payments_index_improvements",
- Version: 16,
- SchemaVersion: 13,
- },
-}
+// migrationAdditions is a list of migrations that are added to the
+// migrationConfig slice.
+//
+// NOTE: This should always be empty as all migrations are now included in the
+// main line (see migrations.go).
+var migrationAdditions []MigrationConfig
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.