insights: one time migration for all insights
Created by: coury-clark
Currently, insights migrate on a schedule every 10 minutes from settings to the DB. In order to deprecate this process we need to disable these migrations and perform a one time out of band migration. In this OOB migration we should do the following:
- In global settings
- Determine if global has any insights (any kind) defined in the settings
- If so, migrate each insight to the database
- If so, create a private dashboard with global grant named
Global insights
and attach all insights found in the global settings. - Create any custom dashboards that do not exist, and attach any insights that are associated. These dashboards should have
global
grant
- For each org
- Determine if they have any insights (any kind) defined in their settings
- If so, migrate each insight to the database
- If so, create a private dashboard with the org grant named
${org name}'s insights
and attach all insights found in the org settings - Create any custom dashboards that do not exist, and attach any insights that are associated. These dashboards should have the
org
grant
- For each user
- Determine if they have any insights (any kind) defined in their settings
- If so, migrate each insight to the database
- If so, create a private dashboard with the user grant named
${username}'s insights
and attach all insights found in their settings - Create any custom dashboards that do not exist, and attach any insights that are associated. These dashboards should have the
user
grant
As long as we go from global -> org -> user we should never find a situation where an insight on a dashboard cannot be referenced.