mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 14:11:04 +02:00
lnd: plug in graph SQL migration into dev build
This commit plugs in the graph kvdb-to-sql migration for builds containing the `test_native_sql` tag. This will allow us to perform local tests and write itests for the migration without exposing it to the production release build.
This commit is contained in:
@@ -3,9 +3,13 @@
|
||||
package lnd
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
graphdb "github.com/lightningnetwork/lnd/graph/db"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
"github.com/lightningnetwork/lnd/sqldb"
|
||||
"github.com/lightningnetwork/lnd/sqldb/sqlc"
|
||||
)
|
||||
|
||||
// getGraphStore returns a graphdb.V1Store backed by a graphdb.KVStore
|
||||
@@ -16,3 +20,15 @@ func (d *DefaultDatabaseBuilder) getGraphStore(_ *sqldb.BaseDB,
|
||||
|
||||
return graphdb.NewKVStore(kvBackend, opts...)
|
||||
}
|
||||
|
||||
// getSQLMigration returns a migration function for the given version.
|
||||
//
|
||||
// NOTE: this is a no-op for the production build since all migrations that are
|
||||
// in production will also be in development builds, and so they are not
|
||||
// defined behind a build tag.
|
||||
func getSQLMigration(ctx context.Context, version int,
|
||||
kvBackend kvdb.Backend,
|
||||
chain chainhash.Hash) (func(tx *sqlc.Queries) error, bool) {
|
||||
|
||||
return nil, false
|
||||
}
|
||||
|
Reference in New Issue
Block a user