Dashboard: Do not run backend migrations if schemaVersion < min_version migration implemented in the backend (#102088)

This commit is contained in:
Ivan Ortega Alba
2025-03-14 08:55:40 +00:00
committed by GitHub
parent d3a9c04562
commit 0e5c436288
4 changed files with 33 additions and 1 deletions
+6
View File
@@ -9,6 +9,12 @@ func Migrate(dash map[string]interface{}, targetVersion int) error {
inputVersion := schemaversion.GetSchemaVersion(dash)
dash["schemaVersion"] = inputVersion
// If the schema version is older than the minimum version, with migration support,
// we don't migrate the dashboard.
if inputVersion < schemaversion.MIN_VERSION {
return schemaversion.NewMigrationError("schema version is too old", inputVersion, schemaversion.MIN_VERSION)
}
for nextVersion := inputVersion + 1; nextVersion <= targetVersion; nextVersion++ {
if migration, ok := schemaversion.Migrations[nextVersion]; ok {
if err := migration(dash); err != nil {