From e1685cb44b34e939a4e6b1c624ee345de067bdd4 Mon Sep 17 00:00:00 2001 From: Jeroen Op 't Eynde Date: Tue, 28 May 2024 16:16:20 +0200 Subject: [PATCH] fix: set schemaVersion on dashboard schema (CUE) (#87712) * fix: set schemaVersion on dashboard schema (CUE) * docs: add comment to migration code * fix: run make gen-cue --- kinds/dashboard/dashboard_kind.cue | 2 +- .../grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts | 2 +- public/app/features/dashboard/state/DashboardMigrator.ts | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kinds/dashboard/dashboard_kind.cue b/kinds/dashboard/dashboard_kind.cue index b366e2c96ff..04e9d4f1322 100644 --- a/kinds/dashboard/dashboard_kind.cue +++ b/kinds/dashboard/dashboard_kind.cue @@ -74,7 +74,7 @@ lineage: schemas: [{ // Version of the JSON schema, incremented each time a Grafana update brings // changes to said schema. - schemaVersion: uint16 | *36 + schemaVersion: uint16 | *39 // Version of the dashboard, incremented each time the dashboard is updated. version?: uint32 diff --git a/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts b/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts index 9b3d3b54504..46e58446be2 100644 --- a/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts +++ b/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts @@ -1182,7 +1182,7 @@ export const defaultDashboard: Partial = { graphTooltip: DashboardCursorSync.Off, links: [], panels: [], - schemaVersion: 36, + schemaVersion: 39, tags: [], timezone: 'browser', }; diff --git a/public/app/features/dashboard/state/DashboardMigrator.ts b/public/app/features/dashboard/state/DashboardMigrator.ts index ad6735d8c8b..bd04031eebd 100644 --- a/public/app/features/dashboard/state/DashboardMigrator.ts +++ b/public/app/features/dashboard/state/DashboardMigrator.ts @@ -76,6 +76,10 @@ type PanelSchemeUpgradeHandler = (panel: PanelModel) => PanelModel; * To add a dashboard migration increment this number * and then add your migration at the bottom of 'updateSchema' * hint: search "Add migration here" + * + * This number also needs to be updated on the CUE schema: + * kinds/dashboard/dashboard_kind.cue + * Example PR: #87712 */ export const DASHBOARD_SCHEMA_VERSION = 39; export class DashboardMigrator {