Files
grafana/pkg/storage/unified/sql/db/migrations/migrator.go
T
grafana-delivery-bot[bot] 577c29d0dc [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>
2025-05-23 15:37:30 +02:00

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(),
)
}