mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 07:00:55 +02:00
sqldb: add support for custom in-code migrations
This commit introduces support for custom, in-code migrations, allowing a specific Go function to be executed at a designated database version during sqlc migrations. If the current database version surpasses the specified version, the migration will be skipped.
This commit is contained in:
@@ -452,7 +452,7 @@ func (db *DB) GetBackends(ctx context.Context, chanDBPath,
|
||||
var nativeSQLStore *sqldb.BaseDB
|
||||
if db.UseNativeSQL {
|
||||
nativePostgresStore, err := sqldb.NewPostgresStore(
|
||||
db.Postgres,
|
||||
db.Postgres, sqldb.GetMigrations(),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error opening "+
|
||||
@@ -576,6 +576,7 @@ func (db *DB) GetBackends(ctx context.Context, chanDBPath,
|
||||
nativeSQLiteStore, err := sqldb.NewSqliteStore(
|
||||
db.Sqlite,
|
||||
path.Join(chanDBPath, SqliteNativeDBName),
|
||||
sqldb.GetMigrations(),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error opening "+
|
||||
|
Reference in New Issue
Block a user