mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-04 09:54:28 +01:00
sqldb: add support for custom in-code migrations
This commit introduces support for custom, in-code migrations, allowing a specific Go function to be executed at a designated database version during sqlc migrations. If the current database version surpasses the specified version, the migration will be skipped.
This commit is contained in:
@@ -148,7 +148,7 @@ func NewTestPostgresDB(t *testing.T, fixture *TestPgFixture) *PostgresStore {
|
||||
require.NoError(t, err)
|
||||
|
||||
cfg := fixture.GetConfig(dbName)
|
||||
store, err := NewPostgresStore(cfg)
|
||||
store, err := NewPostgresStore(cfg, GetMigrations())
|
||||
require.NoError(t, err)
|
||||
|
||||
return store
|
||||
@@ -172,7 +172,7 @@ func NewTestPostgresDBWithVersion(t *testing.T, fixture *TestPgFixture,
|
||||
|
||||
storeCfg := fixture.GetConfig(dbName)
|
||||
storeCfg.SkipMigrations = true
|
||||
store, err := NewPostgresStore(storeCfg)
|
||||
store, err := NewPostgresStore(storeCfg, GetMigrations())
|
||||
require.NoError(t, err)
|
||||
|
||||
err = store.ExecuteMigrations(TargetVersion(version))
|
||||
|
||||
Reference in New Issue
Block a user