From 2a4a57b55bd7e071f2d68673f4ad0ead47bf61a8 Mon Sep 17 00:00:00 2001 From: ziggie Date: Fri, 10 Jul 2026 19:01:41 -0300 Subject: [PATCH] build: bump sqldb/v2 to v2.0.0 --- accounts/store_sql.go | 4 +--- db/migrations.go | 38 ++++++++++++++++++++++++++++++++ db/migsets/sql_migrations.go | 1 + db/migsets/sql_migrations_dev.go | 1 + firewalldb/sql_store.go | 4 +--- go.mod | 2 +- go.sum | 4 ++-- session/sql_store.go | 4 +--- 8 files changed, 46 insertions(+), 12 deletions(-) diff --git a/accounts/store_sql.go b/accounts/store_sql.go index dba24dbf..61780c12 100644 --- a/accounts/store_sql.go +++ b/accounts/store_sql.go @@ -33,8 +33,6 @@ const ( // //nolint:ll type SQLQueries interface { - sqldb.BaseQuerier - AddAccountInvoice(ctx context.Context, arg sqlc.AddAccountInvoiceParams) error DeleteAccount(ctx context.Context, id int64) error DeleteAccountPayment(ctx context.Context, arg sqlc.DeleteAccountPaymentParams) error @@ -79,7 +77,7 @@ type SQLStore struct { clock clock.Clock } -type sqlQueriesExecutor[T sqldb.BaseQuerier] struct { +type sqlQueriesExecutor[T any] struct { *sqldb.TransactionExecutor[T] SQLQueries diff --git a/db/migrations.go b/db/migrations.go index 5943b7fb..3aef6b9d 100644 --- a/db/migrations.go +++ b/db/migrations.go @@ -37,6 +37,43 @@ const ( LatestDevMigrationVersion = 0 ) +// MakeMigrationDescriptors returns the ordered migration descriptors for LiT's +// production SQL schema. +func MakeMigrationDescriptors() []sqldb.MigrationDescriptor { + return []sqldb.MigrationDescriptor{ + { + Name: "accounts", + Version: 1, + SchemaVersion: 1, + }, + { + Name: "sessions", + Version: 2, + SchemaVersion: 2, + }, + { + Name: "kvstores", + Version: 3, + SchemaVersion: 3, + }, + { + Name: "privacy_pairs", + Version: 4, + SchemaVersion: 4, + }, + { + Name: "actions", + Version: 5, + SchemaVersion: 5, + }, + { + Name: "kvdb_to_sql", + Version: 6, + SchemaVersion: 6, + }, + } +} + // HasDevMigrations reports whether any dev SQL migration files are embedded in // the current build. This lets dev builds omit the separate dev migration set // cleanly when the directory exists but currently contains no migration files. @@ -67,6 +104,7 @@ func MakeTestMigrationSets() []sqldb.MigrationSet { // // NOTE: This MUST be updated when a new migration is added. LatestMigrationVersion: LatestMigrationVersion, + Descriptors: MakeMigrationDescriptors(), MakeProgrammaticMigrations: func(db *sqldb.BaseDB) ( map[uint]migrate.ProgrammaticMigrEntry, error) { diff --git a/db/migsets/sql_migrations.go b/db/migsets/sql_migrations.go index 0a6b1d69..6fde04ac 100644 --- a/db/migsets/sql_migrations.go +++ b/db/migsets/sql_migrations.go @@ -35,6 +35,7 @@ func MakeMigrationSets(ctx context.Context, basicClient lnrpc.LightningClient, // // NOTE: This MUST be updated when a new migration is added. LatestMigrationVersion: db.LatestMigrationVersion, + Descriptors: db.MakeMigrationDescriptors(), MakeProgrammaticMigrations: func(baseDB *sqldb.BaseDB) ( map[uint]migrate.ProgrammaticMigrEntry, error) { diff --git a/db/migsets/sql_migrations_dev.go b/db/migsets/sql_migrations_dev.go index 5e07d29a..569eae33 100644 --- a/db/migsets/sql_migrations_dev.go +++ b/db/migsets/sql_migrations_dev.go @@ -34,6 +34,7 @@ func MakeMigrationSets(ctx context.Context, // // NOTE: This MUST be updated when a new migration is added. LatestMigrationVersion: db.LatestMigrationVersion, + Descriptors: db.MakeMigrationDescriptors(), MakeProgrammaticMigrations: func(baseDB *sqldb.BaseDB) ( map[uint]migrate.ProgrammaticMigrEntry, error) { diff --git a/firewalldb/sql_store.go b/firewalldb/sql_store.go index 72d54cf1..d3192927 100644 --- a/firewalldb/sql_store.go +++ b/firewalldb/sql_store.go @@ -20,8 +20,6 @@ type SQLSessionQueries interface { // SQLQueries is a subset of the sqlc.Queries interface that can be used to // interact with various firewalldb tables. type SQLQueries interface { - sqldb.BaseQuerier - SQLKVStoreQueries SQLPrivacyPairQueries SQLActionQueries @@ -48,7 +46,7 @@ type SQLDB struct { clock clock.Clock } -type sqlQueriesExecutor[T sqldb.BaseQuerier] struct { +type sqlQueriesExecutor[T any] struct { *sqldb.TransactionExecutor[T] SQLQueries diff --git a/go.mod b/go.mod index 5527b361..c60bcc3c 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,7 @@ require ( github.com/lightningnetwork/lnd/fn v1.2.5 github.com/lightningnetwork/lnd/fn/v2 v2.0.9 github.com/lightningnetwork/lnd/kvdb v1.4.16 - github.com/lightningnetwork/lnd/sqldb/v2 v2.0.0-20260326184657-f7cc56305bae + github.com/lightningnetwork/lnd/sqldb/v2 v2.0.0 github.com/lightningnetwork/lnd/tlv v1.3.2 github.com/lightningnetwork/lnd/tor v1.1.7 github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f diff --git a/go.sum b/go.sum index 0396e3b4..066f7e10 100644 --- a/go.sum +++ b/go.sum @@ -1189,8 +1189,8 @@ github.com/lightningnetwork/lnd/queue v1.2.0 h1:sSrn+u84OLuOT/F+xGxgg8VfknXeIZEA github.com/lightningnetwork/lnd/queue v1.2.0/go.mod h1:qLNP0L3B7piRGvDyhAyJKic4xTt+Mw4D7mWrQeuAwxY= github.com/lightningnetwork/lnd/sqldb v1.0.13 h1:CcG9mrHNW/hIuZnqgosdiNmS7QhjSyfR/XkSFJB7EC8= github.com/lightningnetwork/lnd/sqldb v1.0.13/go.mod h1:ew3kMfknA0B4djTtrQSAkxvro+8+c++L8LuNaoT7GQA= -github.com/lightningnetwork/lnd/sqldb/v2 v2.0.0-20260326184657-f7cc56305bae h1:ICRuZIkXed43iuqcJaayubPTcQolttttwNZFrapdwIo= -github.com/lightningnetwork/lnd/sqldb/v2 v2.0.0-20260326184657-f7cc56305bae/go.mod h1:T2F1Sfb0oSpZyylIEE3ijiSejaXvIExER5xEdoe5wEE= +github.com/lightningnetwork/lnd/sqldb/v2 v2.0.0 h1:c0tt+rlsXCPmPlw641ruOe+EmeyFPWmD+E4sONaj0lc= +github.com/lightningnetwork/lnd/sqldb/v2 v2.0.0/go.mod h1:TyfjJz1iAKJA3uw3Tk7Mto0FJZY/MR5mAUc5qI80zB4= github.com/lightningnetwork/lnd/ticker v1.1.1 h1:J/b6N2hibFtC7JLV77ULQp++QLtCwT6ijJlbdiZFbSM= github.com/lightningnetwork/lnd/ticker v1.1.1/go.mod h1:waPTRAAcwtu7Ji3+3k+u/xH5GHovTsCoSVpho0KDvdA= github.com/lightningnetwork/lnd/tlv v1.3.2 h1:MO4FCk7F4k5xPMqVZF6Nb/kOpxlwPrUQpYjmyKny5s0= diff --git a/session/sql_store.go b/session/sql_store.go index f8286e3f..58d21c64 100644 --- a/session/sql_store.go +++ b/session/sql_store.go @@ -24,8 +24,6 @@ import ( // // nolint:ll type SQLQueries interface { - sqldb.BaseQuerier - GetAliasBySessionID(ctx context.Context, id int64) ([]byte, error) GetSessionByID(ctx context.Context, id int64) (sqlc.Session, error) GetSessionsInGroup(ctx context.Context, groupID sql.NullInt64) ([]sqlc.Session, error) @@ -78,7 +76,7 @@ type SQLStore struct { clock clock.Clock } -type sqlQueriesExecutor[T sqldb.BaseQuerier] struct { +type sqlQueriesExecutor[T any] struct { *sqldb.TransactionExecutor[T] SQLQueries