mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
migstreams: introduce migstreams package
The upcoming kvdb to sql code migration will be added to as part of the `sqldb/v2` migration stream. However, since the kvdb to sql migration will need to use the migration functions present in the `accounts`, `firewalldb`, and `session` packages, the migration will need to referernce those packages. That would lead to a circular dependency though if the migration stream was defined in the `db` package, as those packages need to import the `db` package. To avoid this, we introduce a new `migstreams` package that contains the migration streams, and ensure that the `db` package doesn't import the `migstreams` package.
This commit is contained in:
parent
f77ae5dcf2
commit
83f3e223fb
5 changed files with 40 additions and 5 deletions
|
|
@ -8,6 +8,7 @@ import (
|
|||
|
||||
"github.com/lightninglabs/lightning-terminal/accounts"
|
||||
"github.com/lightninglabs/lightning-terminal/db"
|
||||
"github.com/lightninglabs/lightning-terminal/db/migstreams"
|
||||
"github.com/lightninglabs/lightning-terminal/db/sqlc"
|
||||
"github.com/lightninglabs/lightning-terminal/firewalldb"
|
||||
"github.com/lightninglabs/lightning-terminal/session"
|
||||
|
|
@ -113,7 +114,7 @@ func NewStores(cfg *Config, clock clock.Clock) (*stores, error) {
|
|||
|
||||
if !cfg.Sqlite.SkipMigrations {
|
||||
err = sqldb.ApplyAllMigrations(
|
||||
sqlStore, db.LitdMigrationStreams,
|
||||
sqlStore, migstreams.LitdMigrationStreams,
|
||||
)
|
||||
if err != nil {
|
||||
return stores, fmt.Errorf("error applying "+
|
||||
|
|
@ -155,7 +156,7 @@ func NewStores(cfg *Config, clock clock.Clock) (*stores, error) {
|
|||
|
||||
if !cfg.Postgres.SkipMigrations {
|
||||
err = sqldb.ApplyAllMigrations(
|
||||
sqlStore, db.LitdMigrationStreams,
|
||||
sqlStore, migstreams.LitdMigrationStreams,
|
||||
)
|
||||
if err != nil {
|
||||
return stores, fmt.Errorf("error applying "+
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue