2025-06-23 10:05:03 +02:00
|
|
|
//go:build test_native_sql
|
|
|
|
|
|
|
|
|
|
package lnd
|
|
|
|
|
|
|
|
|
|
import (
|
2025-07-11 13:35:00 +02:00
|
|
|
"context"
|
2025-06-23 10:05:03 +02:00
|
|
|
|
|
|
|
|
"github.com/lightningnetwork/lnd/kvdb"
|
2025-07-11 13:35:00 +02:00
|
|
|
"github.com/lightningnetwork/lnd/sqldb/sqlc"
|
2025-06-23 10:05:03 +02:00
|
|
|
)
|
|
|
|
|
|
2025-07-12 07:59:37 +02:00
|
|
|
// RunTestSQLMigration is a build tag that indicates whether the test_native_sql
|
|
|
|
|
// build tag is set.
|
|
|
|
|
var RunTestSQLMigration = true
|
|
|
|
|
|
2025-07-11 13:35:00 +02:00
|
|
|
// getSQLMigration returns a migration function for the given version.
|
2025-08-15 13:41:36 +02:00
|
|
|
func (d *DefaultDatabaseBuilder) getSQLMigration(_ context.Context,
|
|
|
|
|
version int, _ kvdb.Backend) (func(tx *sqlc.Queries) error,
|
2025-08-13 09:30:09 +02:00
|
|
|
bool) {
|
|
|
|
|
|
2025-07-11 13:35:00 +02:00
|
|
|
switch version {
|
2025-08-15 13:41:36 +02:00
|
|
|
default:
|
|
|
|
|
// No version was matched, so we return false to indicate that
|
|
|
|
|
// no migration is known for the given version.
|
|
|
|
|
return nil, false
|
2025-07-11 13:35:00 +02:00
|
|
|
}
|
|
|
|
|
}
|