577c29d0dc
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>
25 lines
541 B
Go
25 lines
541 B
Go
package migrations
|
|
|
|
import (
|
|
"context"
|
|
|
|
"xorm.io/xorm"
|
|
|
|
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
)
|
|
|
|
func MigrateResourceStore(ctx context.Context, engine *xorm.Engine, cfg *setting.Cfg) error {
|
|
mg := migrator.NewScopedMigrator(engine, cfg, "resource")
|
|
mg.AddCreateMigration()
|
|
|
|
initResourceTables(mg)
|
|
|
|
sec := cfg.Raw.Section("database")
|
|
return mg.RunMigrations(
|
|
ctx,
|
|
sec.Key("migration_locking").MustBool(true),
|
|
sec.Key("locking_attempt_timeout_sec").MustInt(),
|
|
)
|
|
}
|