Copy over all the code that the graph SQL migration needs to a separate folder. This will let us advance the main graph SQL CRUD code without worrying about changing the sql migration code. It will also let us change the SQL queries without changing the migration. In this commit, only the migration logic is "frozen" but in an upcoming commit, the sqlc queries & models will be frozen too.
24 lines
503 B
Go
24 lines
503 B
Go
//go:build !test_db_sqlite && !test_db_postgres
|
|
|
|
package migration1
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/lightningnetwork/lnd/kvdb"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// NewTestDB is a helper function that creates an BBolt database for testing.
|
|
func NewTestDB(t testing.TB) V1Store {
|
|
backend, backendCleanup, err := kvdb.GetTestBackend(t.TempDir(), "cgr")
|
|
require.NoError(t, err)
|
|
|
|
t.Cleanup(backendCleanup)
|
|
|
|
graphStore, err := NewKVStore(backend)
|
|
require.NoError(t, err)
|
|
|
|
return graphStore
|
|
}
|