* extract function
* use context logger
* put alert to general folder if folder is missing
* move folderHelper init
* add test
* Update pkg/services/sqlstore/migrations/ualert/ualert.go
Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
---------
Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com>
mg.Logger.Info("create a new folder for alerts that belongs to dashboard because it has custom permissions","org",dash.OrgId,"dashboard_uid",dash.Uid,"folder",folderName)
l.Info("create a new folder for alerts that belongs to dashboard because it has custom permissions","folder",folderName)
// create folder and assign the permissions of the dashboard (included default and inherited)
// If folder does not exist then the dashboard is an orphan and we migrate the alert to the general folder.
l.Warn("Failed to find folder for dashboard. Migrate rule to the default folder","rule_name",da.Name,"dashboard_uid",da.DashboardUID,"missing_folder_id",dash.FolderId)