mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-07 14:00:08 +02:00
sqldb: add support for test migrations
Add `migrations_dev.go` and `migrations_prod.go` files which each define a `migrationAdditions` slice to be appended to the `migrationConfig` slice. The `migrations_dev.go` file is only built if either the `test_db_postgres` or `test_db_sqlite` build flags are used. This slice will be used to add any migrations that are still under development that we want access to via unit tests and itests but do not want to expose to our release build.
This commit is contained in:
@ -30,7 +30,7 @@ var (
|
||||
//
|
||||
// NOTE: The migration function may have runtime dependencies, which
|
||||
// must be injected during runtime.
|
||||
migrationConfig = []MigrationConfig{
|
||||
migrationConfig = append([]MigrationConfig{
|
||||
{
|
||||
Name: "000001_invoices",
|
||||
Version: 1,
|
||||
@ -70,7 +70,7 @@ var (
|
||||
// schema. This is optional and can be disabled by the
|
||||
// user if necessary.
|
||||
},
|
||||
}
|
||||
}, migrationAdditions...)
|
||||
)
|
||||
|
||||
// MigrationConfig is a configuration struct that describes SQL migrations. Each
|
||||
|
5
sqldb/migrations_dev.go
Normal file
5
sqldb/migrations_dev.go
Normal file
@ -0,0 +1,5 @@
|
||||
//go:build test_db_postgres || test_db_sqlite
|
||||
|
||||
package sqldb
|
||||
|
||||
var migrationAdditions = []MigrationConfig{}
|
5
sqldb/migrations_prod.go
Normal file
5
sqldb/migrations_prod.go
Normal file
@ -0,0 +1,5 @@
|
||||
//go:build !test_db_postgres && !test_db_sqlite
|
||||
|
||||
package sqldb
|
||||
|
||||
var migrationAdditions []MigrationConfig
|
Reference in New Issue
Block a user