Skip to content

Add database column and setting logic for license_usage_data_exported

What does this MR do and why?

Part of https://gitlab.com/gitlab-org/gitlab/-/issues/353804+

For an upcoming banner implementation, it has to be known if the license usage data has been exported (see issue for more info). To track this, a new boolean attribute is added to the ApplicationSetting model that will be set to true if the export has been triggered.

Note: In an upcoming merge request, this attribute will be reset (set to false) on a specific date to reset the banner logic.

Migration Output

Up

main: == 20220531100920 AddLicenseUsageDataExportedToApplicationSettings: migrating =
main: -- add_column(:application_settings, :license_usage_data_exported, :boolean, {:default=>false, :null=>false})
main:    -> 0.0175s
main: == 20220531100920 AddLicenseUsageDataExportedToApplicationSettings: migrated (0.0208s) 

Down

main: == 20220531100920 AddLicenseUsageDataExportedToApplicationSettings: reverting =
main: -- remove_column(:application_settings, :license_usage_data_exported, :boolean, {:default=>false, :null=>false})
main:    -> 0.0049s
main: == 20220531100920 AddLicenseUsageDataExportedToApplicationSettings: reverted (0.0099s) 

Screenshots or screen recordings

Not applicable.

How to set up and validate locally

  1. Make sure you have a current license in your instance.
  2. Log in as an admin and visit the Subscription page in the Admin area (/admin/subscription)
  3. Click the Export license usage data button.
  4. Open a rails console and check that Gitlab::CurrentSettings.license_usage_data_exported returns true.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports