From a93b8a03cb1a36243cc1b986e035bc9f43ed0e6c Mon Sep 17 00:00:00 2001 From: juanicabanas Date: Tue, 22 Nov 2022 19:11:06 -0300 Subject: [PATCH] PublicDashboards: Orphaned public dashboard deletion script added (#57917) * Adds migration to remove orphaned public dashboards. Co-authored-by: Jeff Levin --- pkg/services/sqlstore/migrations/dashboard_public_mig.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/services/sqlstore/migrations/dashboard_public_mig.go b/pkg/services/sqlstore/migrations/dashboard_public_mig.go index 1dfc3512018e..abbdd1367511 100644 --- a/pkg/services/sqlstore/migrations/dashboard_public_mig.go +++ b/pkg/services/sqlstore/migrations/dashboard_public_mig.go @@ -74,4 +74,7 @@ func addPublicDashboardMigration(mg *Migrator) { Nullable: false, Default: "0", })) + + mg.AddMigration("delete orphaned public dashboards", NewRawSQLMigration( + "DELETE FROM dashboard_public WHERE dashboard_uid NOT IN (SELECT uid FROM dashboard)")) }