Previews: fix dashboard.thumbnails.ds_uids migration (#52960)

This commit is contained in:
Artur Wierzbicki
2022-07-28 21:50:02 +04:00
committed by GitHub
parent 165efcd9cc
commit 449acb56a9
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ func (ss *SQLStore) FindDashboardsWithStaleThumbnails(ctx context.Context, cmd *
args := []interface{}{models.ThumbnailStateStale} args := []interface{}{models.ThumbnailStateStale}
if cmd.IncludeThumbnailsWithEmptyDsUIDs { if cmd.IncludeThumbnailsWithEmptyDsUIDs {
query += " OR dashboard_thumbnail.ds_uids = ?" query += " OR dashboard_thumbnail.ds_uids = ? OR dashboard_thumbnail.ds_uids IS NULL"
args = append(args, "") args = append(args, "")
} }
sess.Where(query+")", args...) sess.Where(query+")", args...)
@@ -26,6 +26,6 @@ func addDashboardThumbsMigrations(mg *migrator.Migrator) {
mg.AddMigration("add unique indexes for dashboard_thumbnail", migrator.NewAddIndexMigration(dashThumbs, dashThumbs.Indices[0])) mg.AddMigration("add unique indexes for dashboard_thumbnail", migrator.NewAddIndexMigration(dashThumbs, dashThumbs.Indices[0]))
mg.AddMigration("Add ds_uids column to dashboard_thumbnail table", migrator.NewAddColumnMigration(dashThumbs, mg.AddMigration("Add ds_uids column to dashboard_thumbnail table", migrator.NewAddColumnMigration(dashThumbs,
// uids of datasources used in the dashboard when taking preview // uids of datasources used in the dashboard when taking preview
&migrator.Column{Name: "ds_uids", Type: migrator.DB_Text, Nullable: false, Default: ""}, &migrator.Column{Name: "ds_uids", Type: migrator.DB_Text, Nullable: true, Default: ""},
)) ))
} }