7
7
"errors"
8
8
"fmt"
9
9
10
- "github.com/lightninglabs/lightning-terminal/db/sqlc "
10
+ "github.com/lightninglabs/lightning-terminal/db/sqlcmig6 "
11
11
"github.com/lightningnetwork/lnd/fn"
12
12
"github.com/lightningnetwork/lnd/sqldb"
13
13
"go.etcd.io/bbolt"
@@ -78,7 +78,7 @@ func (e *kvEntry) namespacedKey() string {
78
78
// NOTE: As sessions may contain linked sessions and accounts, the sessions and
79
79
// accounts sql migration MUST be run prior to this migration.
80
80
func MigrateFirewallDBToSQL (ctx context.Context , kvStore * bbolt.DB ,
81
- sqlTx SQLQueries ) error {
81
+ sqlTx SQLMig6Queries ) error {
82
82
83
83
log .Infof ("Starting migration of the rules DB to SQL" )
84
84
@@ -99,7 +99,7 @@ func MigrateFirewallDBToSQL(ctx context.Context, kvStore *bbolt.DB,
99
99
// database to the SQL database. The function also asserts that the
100
100
// migrated values match the original values in the KV store.
101
101
func migrateKVStoresDBToSQL (ctx context.Context , kvStore * bbolt.DB ,
102
- sqlTx SQLQueries ) error {
102
+ sqlTx SQLMig6Queries ) error {
103
103
104
104
log .Infof ("Starting migration of the KV stores to SQL" )
105
105
@@ -361,15 +361,15 @@ func collectKVPairs(bkt *bbolt.Bucket, errorOnBuckets, perm bool,
361
361
}
362
362
363
363
// insertPair inserts a single key-value pair into the SQL database.
364
- func insertPair (ctx context.Context , tx SQLQueries ,
364
+ func insertPair (ctx context.Context , tx SQLMig6Queries ,
365
365
entry * kvEntry ) (* sqlKvEntry , error ) {
366
366
367
367
ruleID , err := tx .GetOrInsertRuleID (ctx , entry .ruleName )
368
368
if err != nil {
369
369
return nil , err
370
370
}
371
371
372
- p := sqlc .InsertKVStoreRecordParams {
372
+ p := sqlcmig6 .InsertKVStoreRecordParams {
373
373
Perm : entry .perm ,
374
374
RuleID : ruleID ,
375
375
EntryKey : entry .key ,
@@ -421,13 +421,13 @@ func insertPair(ctx context.Context, tx SQLQueries,
421
421
422
422
// getSQLValue retrieves the key value for the given kvEntry from the SQL
423
423
// database.
424
- func getSQLValue (ctx context.Context , tx SQLQueries ,
424
+ func getSQLValue (ctx context.Context , tx SQLMig6Queries ,
425
425
entry * sqlKvEntry ) ([]byte , error ) {
426
426
427
427
switch {
428
428
case entry .featureID .Valid && entry .groupID .Valid :
429
429
return tx .GetFeatureKVStoreRecord (
430
- ctx , sqlc .GetFeatureKVStoreRecordParams {
430
+ ctx , sqlcmig6 .GetFeatureKVStoreRecordParams {
431
431
Perm : entry .perm ,
432
432
RuleID : entry .ruleID ,
433
433
GroupID : entry .groupID ,
@@ -437,7 +437,7 @@ func getSQLValue(ctx context.Context, tx SQLQueries,
437
437
)
438
438
case entry .groupID .Valid :
439
439
return tx .GetGroupKVStoreRecord (
440
- ctx , sqlc .GetGroupKVStoreRecordParams {
440
+ ctx , sqlcmig6 .GetGroupKVStoreRecordParams {
441
441
Perm : entry .perm ,
442
442
RuleID : entry .ruleID ,
443
443
GroupID : entry .groupID ,
@@ -446,7 +446,7 @@ func getSQLValue(ctx context.Context, tx SQLQueries,
446
446
)
447
447
case ! entry .featureID .Valid && ! entry .groupID .Valid :
448
448
return tx .GetGlobalKVStoreRecord (
449
- ctx , sqlc .GetGlobalKVStoreRecordParams {
449
+ ctx , sqlcmig6 .GetGlobalKVStoreRecordParams {
450
450
Perm : entry .perm ,
451
451
RuleID : entry .ruleID ,
452
452
Key : entry .key ,
0 commit comments