multi: rename MigrationStream names to MigrationSet

This commit is contained in:
Viktor Torstensson 2026-03-26 11:57:14 +01:00
parent 10337691cb
commit f78ddf1702
No known key found for this signature in database
GPG key ID: 961CC8259AE675D4
11 changed files with 34 additions and 35 deletions

View file

@ -128,7 +128,7 @@ func accountBenchBackends(b *testing.B) []accountBenchBackend {
b,
sqldb.ApplyAllMigrations(
sqlStore,
db.MakeTestMigrationStreams(),
db.MakeTestMigrationSets(),
),
)
@ -157,7 +157,7 @@ func accountBenchBackends(b *testing.B) []accountBenchBackend {
sqlStore := sqldb.NewTestPostgresDB(
b, fixture,
db.MakeTestMigrationStreams(),
db.MakeTestMigrationSets(),
)
queries := sqlc.NewForType(

View file

@ -19,7 +19,7 @@ var ErrDBClosed = errors.New("database is closed")
func NewTestDB(t *testing.T, clock clock.Clock) Store {
return createStore(
t,
sqldb.NewTestSqliteDB(t, db.MakeTestMigrationStreams()).BaseDB,
sqldb.NewTestSqliteDB(t, db.MakeTestMigrationSets()).BaseDB,
clock,
)
}
@ -30,7 +30,7 @@ func NewTestDBFromPath(t *testing.T, dbPath string,
clock clock.Clock) Store {
tDb := sqldb.NewTestSqliteDBFromPath(
t, dbPath, db.MakeTestMigrationStreams(),
t, dbPath, db.MakeTestMigrationSets(),
)
return createStore(t, tDb.BaseDB, clock)

View file

@ -119,7 +119,7 @@ func NewStores(ctx context.Context, cfg *Config,
if !cfg.Sqlite.SkipMigrations {
err = sqldb.ApplyAllMigrations(
sqlStore,
migstreams.MakeMigrationStreams(
migstreams.MakeMigrationSets(
ctx, basicClient, cfg.MacaroonPath,
clock,
),
@ -165,7 +165,7 @@ func NewStores(ctx context.Context, cfg *Config,
if !cfg.Postgres.SkipMigrations {
err = sqldb.ApplyAllMigrations(
sqlStore,
migstreams.MakeMigrationStreams(
migstreams.MakeMigrationSets(
ctx, basicClient, cfg.MacaroonPath,
clock,
),

View file

@ -24,14 +24,14 @@ const (
LatestDevMigrationVersion = 1
)
// MakeTestMigrationStreams creates the migration streams for the unit test
// MakeTestMigrationSets creates the migration sets for the unit test
// environment.
//
// NOTE: This function is not located in the migstreams package to avoid
// cyclic dependencies. This test migration stream does not run the kvdb to sql
// cyclic dependencies. This test migration set does not run the kvdb to sql
// migration, as we already have separate unit tests which tests the migration.
func MakeTestMigrationStreams() []sqldb.MigrationSet {
migStream := sqldb.MigrationSet{
func MakeTestMigrationSets() []sqldb.MigrationSet {
migSet := sqldb.MigrationSet{
TrackingTableName: pgx.DefaultMigrationsTable,
SQLFileDirectory: "sqlc/migrations",
SQLFiles: SqlSchemas,
@ -50,7 +50,7 @@ func MakeTestMigrationStreams() []sqldb.MigrationSet {
},
}
migStreamDev := sqldb.MigrationSet{
migSetDev := sqldb.MigrationSet{
TrackingTableName: pgx.DefaultMigrationsTable + "_dev",
SQLFileDirectory: "sqlc/migrations_dev",
SQLFiles: SqlSchemas,
@ -69,5 +69,5 @@ func MakeTestMigrationStreams() []sqldb.MigrationSet {
},
}
return []sqldb.MigrationSet{migStream, migStreamDev}
return []sqldb.MigrationSet{migSet, migSetDev}
}

View file

@ -13,14 +13,13 @@ import (
"github.com/lightningnetwork/lnd/sqldb/v2"
)
// MakeMigrationStreams creates the migration streams for production
// environments.
func MakeMigrationStreams(_ context.Context, _ lnrpc.LightningClient, _ string,
// MakeMigrationSets creates the migration sets for production environments.
func MakeMigrationSets(_ context.Context, _ lnrpc.LightningClient, _ string,
_ clock.Clock) []sqldb.MigrationSet {
// migStream defines the SQL migration stream used to create
// and upgrade LiT's SQL schema.
migStream := sqldb.MigrationSet{
// migSet defines the SQL migration set used to create and upgrade LiT's
// SQL schema.
migSet := sqldb.MigrationSet{
TrackingTableName: pgx.DefaultMigrationsTable,
SQLFileDirectory: "sqlc/migrations",
SQLFiles: db.SqlSchemas,
@ -39,5 +38,5 @@ func MakeMigrationStreams(_ context.Context, _ lnrpc.LightningClient, _ string,
},
}
return []sqldb.MigrationSet{migStream}
return []sqldb.MigrationSet{migSet}
}

View file

@ -23,13 +23,13 @@ const (
KVDBtoSQLMigVersion = 1
)
// MakeMigrationStreams creates the migration streams for the dev environments.
func MakeMigrationStreams(ctx context.Context,
// MakeMigrationSets creates the migration sets for the dev environments.
func MakeMigrationSets(ctx context.Context,
basicClient lnrpc.LightningClient, macPath string,
clock clock.Clock) []sqldb.MigrationSet {
// Create the prod migration stream.
migStream := sqldb.MigrationSet{
// Create the prod migration set.
migSet := sqldb.MigrationSet{
TrackingTableName: pgx.DefaultMigrationsTable,
SQLFileDirectory: "sqlc/migrations",
SQLFiles: db.SqlSchemas,
@ -48,8 +48,8 @@ func MakeMigrationStreams(ctx context.Context,
},
}
// Create the dev migration stream.
migStreamDev := sqldb.MigrationSet{
// Create the dev migration set.
migSetDev := sqldb.MigrationSet{
TrackingTableName: pgx.DefaultMigrationsTable + "_dev",
SQLFileDirectory: "sqlc/migrations_dev",
SQLFiles: db.SqlSchemas,
@ -83,5 +83,5 @@ func MakeMigrationStreams(ctx context.Context,
},
}
return []sqldb.MigrationSet{migStream, migStreamDev}
return []sqldb.MigrationSet{migSet, migSetDev}
}

View file

@ -69,6 +69,6 @@ func NewTestPostgresDB(t *testing.T) *sqldb.PostgresStore {
})
return sqldb.NewTestPostgresDB(
t, sqlFixture, MakeTestMigrationStreams(),
t, sqlFixture, MakeTestMigrationSets(),
)
}

View file

@ -149,7 +149,7 @@ func firewallBenchBackends(b *testing.B) []firewallBenchBackend {
b,
sqldb.ApplyAllMigrations(
sqlStore,
db.MakeTestMigrationStreams(),
db.MakeTestMigrationSets(),
),
)
@ -191,7 +191,7 @@ func firewallBenchBackends(b *testing.B) []firewallBenchBackend {
sqlStore := sqldb.NewTestPostgresDB(
b, fixture,
db.MakeTestMigrationStreams(),
db.MakeTestMigrationSets(),
)
queries := sqlc.NewForType(

View file

@ -17,7 +17,7 @@ var isSqlite = true
func NewTestDB(t *testing.T, clock clock.Clock) FirewallDBs {
return createStore(
t,
sqldb.NewTestSqliteDB(t, db.MakeTestMigrationStreams()).BaseDB,
sqldb.NewTestSqliteDB(t, db.MakeTestMigrationSets()).BaseDB,
clock,
)
}
@ -28,7 +28,7 @@ func NewTestDBFromPath(t *testing.T, dbPath string,
clock clock.Clock) FirewallDBs {
tDb := sqldb.NewTestSqliteDBFromPath(
t, dbPath, db.MakeTestMigrationStreams(),
t, dbPath, db.MakeTestMigrationSets(),
)
return createStore(t, tDb.BaseDB, clock)

View file

@ -136,7 +136,7 @@ func sessionBenchBackends(b *testing.B) []sessionBenchBackend {
b,
sqldb.ApplyAllMigrations(
sqlStore,
db.MakeTestMigrationStreams(),
db.MakeTestMigrationSets(),
),
)
@ -171,7 +171,7 @@ func sessionBenchBackends(b *testing.B) []sessionBenchBackend {
sqlStore := sqldb.NewTestPostgresDB(
b, fixture,
db.MakeTestMigrationStreams(),
db.MakeTestMigrationSets(),
)
queries := sqlc.NewForType(

View file

@ -19,7 +19,7 @@ var ErrDBClosed = errors.New("database is closed")
func NewTestDB(t *testing.T, clock clock.Clock) Store {
return createStore(
t,
sqldb.NewTestSqliteDB(t, db.MakeTestMigrationStreams()).BaseDB,
sqldb.NewTestSqliteDB(t, db.MakeTestMigrationSets()).BaseDB,
clock,
)
}
@ -30,7 +30,7 @@ func NewTestDBFromPath(t *testing.T, dbPath string,
clock clock.Clock) Store {
tDb := sqldb.NewTestSqliteDBFromPath(
t, dbPath, db.MakeTestMigrationStreams(),
t, dbPath, db.MakeTestMigrationSets(),
)
return createStore(t, tDb.BaseDB, clock)