[release-12.0.1] Storage: Take migration_locking setting into account (#105951)
Storage: Take `migration_locking` setting into account (#105938)
(cherry picked from commit 392c1a71c9)
Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
7a61c3d1b8
commit
577c29d0dc
@@ -9,14 +9,16 @@ import (
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
func MigrateResourceStore(_ context.Context, engine *xorm.Engine, cfg *setting.Cfg) error {
|
||||
// TODO: use the context.Context
|
||||
|
||||
func MigrateResourceStore(ctx context.Context, engine *xorm.Engine, cfg *setting.Cfg) error {
|
||||
mg := migrator.NewScopedMigrator(engine, cfg, "resource")
|
||||
mg.AddCreateMigration()
|
||||
|
||||
initResourceTables(mg)
|
||||
|
||||
// since it's a new feature enable migration locking by default
|
||||
return mg.Start(true, 0)
|
||||
sec := cfg.Raw.Section("database")
|
||||
return mg.RunMigrations(
|
||||
ctx,
|
||||
sec.Key("migration_locking").MustBool(true),
|
||||
sec.Key("locking_attempt_timeout_sec").MustInt(),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user