Dashboard Migrations: v11 - no-op (#111273)
* migrate to v19 * migrate to v18 * Migration to be verified: v17 Convert minSpan to maxPerRow in panels * Migration to be verified: 16 Grid layout migration * Refactor v17 and v19 migrations to use shared helper functions * Migration to be verified: 15 No-op migration for schema consistency * Migration to be verified: 14 Shared crosshair to graph tooltip migration * cleanup * wip * complete migration * fix lint issues * refactor and test with minimal graph config * update tests * migrate to v12 * extract defaults outside the func * lint * lint * add missing showValues prop * migrate to v11 * add test files * update * add context and fix latest version * add context * add context * generate snapshots * v13 should be no-op * clean up * fix tests * snapshots * fix test * remove v28 * remove singlestat migraiton from frontend migrator because this is an automigration * remove unused function * Remove v24 table plugin logic * cleanup * remove plugin version for automigrate as it was used only in v24 and v28 that have been removed * cleanup * update snapshot * es lint --------- Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
This commit is contained in:
co-authored by
Dominik Prokop
parent
5cfb641ddf
commit
bba720557c
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
MIN_VERSION = 11
|
||||
MIN_VERSION = 10
|
||||
LATEST_VERSION = 42
|
||||
)
|
||||
|
||||
@@ -35,6 +35,7 @@ type PanelPluginInfo struct {
|
||||
|
||||
func GetMigrations(dsInfoProvider DataSourceInfoProvider) map[int]SchemaVersionMigrationFunc {
|
||||
return map[int]SchemaVersionMigrationFunc{
|
||||
11: V11,
|
||||
12: V12,
|
||||
13: V13,
|
||||
14: V14,
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package schemaversion
|
||||
|
||||
import "context"
|
||||
|
||||
// V11 migration is a no-op migration
|
||||
// It only updates the schema version to 11
|
||||
// It's created to keep the migration history consistent
|
||||
// Frontend migrator doesn't have a migration for schema version 11
|
||||
// No specific migration logic is needed between schema version 10 and 11
|
||||
|
||||
// Example before migration:
|
||||
// {
|
||||
// "schemaVersion": 10,
|
||||
// "title": "My Dashboard",
|
||||
// "panels": [...]
|
||||
// }
|
||||
|
||||
// Example after migration:
|
||||
// {
|
||||
// "schemaVersion": 11,
|
||||
// "title": "My Dashboard",
|
||||
// "panels": [...]
|
||||
// }
|
||||
|
||||
func V11(_ context.Context, dashboard map[string]interface{}) error {
|
||||
dashboard["schemaVersion"] = 11
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package schemaversion_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/apps/dashboard/pkg/migration/schemaversion"
|
||||
)
|
||||
|
||||
func TestV11(t *testing.T) {
|
||||
tests := []migrationTestCase{
|
||||
{
|
||||
name: "v11 no-op migration, updates schema version only",
|
||||
input: map[string]interface{}{
|
||||
"title": "V11 No-Op Migration Test Dashboard",
|
||||
"schemaVersion": 10,
|
||||
"panels": []interface{}{
|
||||
map[string]interface{}{
|
||||
"type": "graph",
|
||||
"title": "Panel remains unchanged",
|
||||
"id": 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
expected: map[string]interface{}{
|
||||
"title": "V11 No-Op Migration Test Dashboard",
|
||||
"schemaVersion": 11,
|
||||
"panels": []interface{}{
|
||||
map[string]interface{}{
|
||||
"type": "graph",
|
||||
"title": "Panel remains unchanged",
|
||||
"id": 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
runMigrationTests(t, tests, schemaversion.V11)
|
||||
}
|
||||
Reference in New Issue
Block a user