Skip to content

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:

  1. In global settings
    1. Determine if global has any insights (any kind) defined in the settings
    2. If so, migrate each insight to the database
    3. If so, create a private dashboard with global grant named Global insights and attach all insights found in the global settings.
    4. Create any custom dashboards that do not exist, and attach any insights that are associated. These dashboards should have global grant
  2. For each org
    1. Determine if they have any insights (any kind) defined in their settings
    2. If so, migrate each insight to the database
    3. If so, create a private dashboard with the org grant named ${org name}'s insights and attach all insights found in the org settings
    4. Create any custom dashboards that do not exist, and attach any insights that are associated. These dashboards should have the org grant
  3. For each user
    1. Determine if they have any insights (any kind) defined in their settings
    2. If so, migrate each insight to the database
    3. If so, create a private dashboard with the user grant named ${username}'s insights and attach all insights found in their settings
    4. 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.