build: bump sqldb/v2 to v2.0.0

This commit is contained in:
ziggie 2026-07-10 19:01:41 -03:00
parent 41a6c8b3f7
commit 2a4a57b55b
No known key found for this signature in database
GPG key ID: 1AFF9C4DCED6D666
8 changed files with 46 additions and 12 deletions

View file

@ -33,8 +33,6 @@ const (
// //
//nolint:ll //nolint:ll
type SQLQueries interface { type SQLQueries interface {
sqldb.BaseQuerier
AddAccountInvoice(ctx context.Context, arg sqlc.AddAccountInvoiceParams) error AddAccountInvoice(ctx context.Context, arg sqlc.AddAccountInvoiceParams) error
DeleteAccount(ctx context.Context, id int64) error DeleteAccount(ctx context.Context, id int64) error
DeleteAccountPayment(ctx context.Context, arg sqlc.DeleteAccountPaymentParams) error DeleteAccountPayment(ctx context.Context, arg sqlc.DeleteAccountPaymentParams) error
@ -79,7 +77,7 @@ type SQLStore struct {
clock clock.Clock clock clock.Clock
} }
type sqlQueriesExecutor[T sqldb.BaseQuerier] struct { type sqlQueriesExecutor[T any] struct {
*sqldb.TransactionExecutor[T] *sqldb.TransactionExecutor[T]
SQLQueries SQLQueries

View file

@ -37,6 +37,43 @@ const (
LatestDevMigrationVersion = 0 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 // HasDevMigrations reports whether any dev SQL migration files are embedded in
// the current build. This lets dev builds omit the separate dev migration set // the current build. This lets dev builds omit the separate dev migration set
// cleanly when the directory exists but currently contains no migration files. // 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. // NOTE: This MUST be updated when a new migration is added.
LatestMigrationVersion: LatestMigrationVersion, LatestMigrationVersion: LatestMigrationVersion,
Descriptors: MakeMigrationDescriptors(),
MakeProgrammaticMigrations: func(db *sqldb.BaseDB) ( MakeProgrammaticMigrations: func(db *sqldb.BaseDB) (
map[uint]migrate.ProgrammaticMigrEntry, error) { map[uint]migrate.ProgrammaticMigrEntry, error) {

View file

@ -35,6 +35,7 @@ func MakeMigrationSets(ctx context.Context, basicClient lnrpc.LightningClient,
// //
// NOTE: This MUST be updated when a new migration is added. // NOTE: This MUST be updated when a new migration is added.
LatestMigrationVersion: db.LatestMigrationVersion, LatestMigrationVersion: db.LatestMigrationVersion,
Descriptors: db.MakeMigrationDescriptors(),
MakeProgrammaticMigrations: func(baseDB *sqldb.BaseDB) ( MakeProgrammaticMigrations: func(baseDB *sqldb.BaseDB) (
map[uint]migrate.ProgrammaticMigrEntry, error) { map[uint]migrate.ProgrammaticMigrEntry, error) {

View file

@ -34,6 +34,7 @@ func MakeMigrationSets(ctx context.Context,
// //
// NOTE: This MUST be updated when a new migration is added. // NOTE: This MUST be updated when a new migration is added.
LatestMigrationVersion: db.LatestMigrationVersion, LatestMigrationVersion: db.LatestMigrationVersion,
Descriptors: db.MakeMigrationDescriptors(),
MakeProgrammaticMigrations: func(baseDB *sqldb.BaseDB) ( MakeProgrammaticMigrations: func(baseDB *sqldb.BaseDB) (
map[uint]migrate.ProgrammaticMigrEntry, error) { map[uint]migrate.ProgrammaticMigrEntry, error) {

View file

@ -20,8 +20,6 @@ type SQLSessionQueries interface {
// SQLQueries is a subset of the sqlc.Queries interface that can be used to // SQLQueries is a subset of the sqlc.Queries interface that can be used to
// interact with various firewalldb tables. // interact with various firewalldb tables.
type SQLQueries interface { type SQLQueries interface {
sqldb.BaseQuerier
SQLKVStoreQueries SQLKVStoreQueries
SQLPrivacyPairQueries SQLPrivacyPairQueries
SQLActionQueries SQLActionQueries
@ -48,7 +46,7 @@ type SQLDB struct {
clock clock.Clock clock clock.Clock
} }
type sqlQueriesExecutor[T sqldb.BaseQuerier] struct { type sqlQueriesExecutor[T any] struct {
*sqldb.TransactionExecutor[T] *sqldb.TransactionExecutor[T]
SQLQueries SQLQueries

2
go.mod
View file

@ -38,7 +38,7 @@ require (
github.com/lightningnetwork/lnd/fn v1.2.5 github.com/lightningnetwork/lnd/fn v1.2.5
github.com/lightningnetwork/lnd/fn/v2 v2.0.9 github.com/lightningnetwork/lnd/fn/v2 v2.0.9
github.com/lightningnetwork/lnd/kvdb v1.4.16 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/tlv v1.3.2
github.com/lightningnetwork/lnd/tor v1.1.7 github.com/lightningnetwork/lnd/tor v1.1.7
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f

4
go.sum
View file

@ -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/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 h1:CcG9mrHNW/hIuZnqgosdiNmS7QhjSyfR/XkSFJB7EC8=
github.com/lightningnetwork/lnd/sqldb v1.0.13/go.mod h1:ew3kMfknA0B4djTtrQSAkxvro+8+c++L8LuNaoT7GQA= 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 h1:c0tt+rlsXCPmPlw641ruOe+EmeyFPWmD+E4sONaj0lc=
github.com/lightningnetwork/lnd/sqldb/v2 v2.0.0-20260326184657-f7cc56305bae/go.mod h1:T2F1Sfb0oSpZyylIEE3ijiSejaXvIExER5xEdoe5wEE= 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 h1:J/b6N2hibFtC7JLV77ULQp++QLtCwT6ijJlbdiZFbSM=
github.com/lightningnetwork/lnd/ticker v1.1.1/go.mod h1:waPTRAAcwtu7Ji3+3k+u/xH5GHovTsCoSVpho0KDvdA= 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= github.com/lightningnetwork/lnd/tlv v1.3.2 h1:MO4FCk7F4k5xPMqVZF6Nb/kOpxlwPrUQpYjmyKny5s0=

View file

@ -24,8 +24,6 @@ import (
// //
// nolint:ll // nolint:ll
type SQLQueries interface { type SQLQueries interface {
sqldb.BaseQuerier
GetAliasBySessionID(ctx context.Context, id int64) ([]byte, error) GetAliasBySessionID(ctx context.Context, id int64) ([]byte, error)
GetSessionByID(ctx context.Context, id int64) (sqlc.Session, error) GetSessionByID(ctx context.Context, id int64) (sqlc.Session, error)
GetSessionsInGroup(ctx context.Context, groupID sql.NullInt64) ([]sqlc.Session, error) GetSessionsInGroup(ctx context.Context, groupID sql.NullInt64) ([]sqlc.Session, error)
@ -78,7 +76,7 @@ type SQLStore struct {
clock clock.Clock clock clock.Clock
} }
type sqlQueriesExecutor[T sqldb.BaseQuerier] struct { type sqlQueriesExecutor[T any] struct {
*sqldb.TransactionExecutor[T] *sqldb.TransactionExecutor[T]
SQLQueries SQLQueries