From f78ddf170243de85bc72db4179dd5697f30bdd4a Mon Sep 17 00:00:00 2001 From: Viktor Torstensson Date: Thu, 26 Mar 2026 11:57:14 +0100 Subject: [PATCH] multi: rename MigrationStream names to MigrationSet --- accounts/benchmark_test.go | 4 ++-- accounts/test_sqlite.go | 4 ++-- config_dev.go | 4 ++-- db/migrations.go | 12 ++++++------ db/migstreams/sql_migrations.go | 13 ++++++------- db/migstreams/sql_migrations_dev.go | 14 +++++++------- db/postgres.go | 2 +- firewalldb/benchmark_test.go | 4 ++-- firewalldb/test_sqlite.go | 4 ++-- session/benchmark_test.go | 4 ++-- session/test_sqlite.go | 4 ++-- 11 files changed, 34 insertions(+), 35 deletions(-) diff --git a/accounts/benchmark_test.go b/accounts/benchmark_test.go index 0b1521e7..8a8502a8 100644 --- a/accounts/benchmark_test.go +++ b/accounts/benchmark_test.go @@ -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( diff --git a/accounts/test_sqlite.go b/accounts/test_sqlite.go index b1e8be87..b6343de0 100644 --- a/accounts/test_sqlite.go +++ b/accounts/test_sqlite.go @@ -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) diff --git a/config_dev.go b/config_dev.go index 54599496..e52d4809 100644 --- a/config_dev.go +++ b/config_dev.go @@ -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, ), diff --git a/db/migrations.go b/db/migrations.go index d998bffa..46609bdd 100644 --- a/db/migrations.go +++ b/db/migrations.go @@ -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} } diff --git a/db/migstreams/sql_migrations.go b/db/migstreams/sql_migrations.go index 9aad768c..e0cda8fa 100644 --- a/db/migstreams/sql_migrations.go +++ b/db/migstreams/sql_migrations.go @@ -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} } diff --git a/db/migstreams/sql_migrations_dev.go b/db/migstreams/sql_migrations_dev.go index 67d4f6ab..bffbc152 100644 --- a/db/migstreams/sql_migrations_dev.go +++ b/db/migstreams/sql_migrations_dev.go @@ -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} } diff --git a/db/postgres.go b/db/postgres.go index ee9cc140..720269c9 100644 --- a/db/postgres.go +++ b/db/postgres.go @@ -69,6 +69,6 @@ func NewTestPostgresDB(t *testing.T) *sqldb.PostgresStore { }) return sqldb.NewTestPostgresDB( - t, sqlFixture, MakeTestMigrationStreams(), + t, sqlFixture, MakeTestMigrationSets(), ) } diff --git a/firewalldb/benchmark_test.go b/firewalldb/benchmark_test.go index 779e39fc..49d2b4ea 100644 --- a/firewalldb/benchmark_test.go +++ b/firewalldb/benchmark_test.go @@ -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( diff --git a/firewalldb/test_sqlite.go b/firewalldb/test_sqlite.go index be1d5c1e..c4af53ce 100644 --- a/firewalldb/test_sqlite.go +++ b/firewalldb/test_sqlite.go @@ -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) diff --git a/session/benchmark_test.go b/session/benchmark_test.go index d34c5130..091a7791 100644 --- a/session/benchmark_test.go +++ b/session/benchmark_test.go @@ -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( diff --git a/session/test_sqlite.go b/session/test_sqlite.go index c9dbc593..7d8c4a0f 100644 --- a/session/test_sqlite.go +++ b/session/test_sqlite.go @@ -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)