Add cloud_license_auth_token to ApplicationSettings
What does this MR do?
As part of the MVP to add Cloud License support, an authentication token will be stored within an instance's ApplicationSettings table.
This MR adds the columns encrypted_cloud_license_auth_token
and encrypted_cloud_license_auth_token_iv
to the ApplicationSettings
table and is as yet unused. In future it will be populated via a new API endpoint (implemented in https://gitlab.com/gitlab-org/gitlab/-/issues/273501).
Refs https://gitlab.com/gitlab-org/gitlab/-/issues/273504
The first migration (20201111110318_add_cloud_license_auth_token_to_settings
) adds the text column
The second migration (20201111110918_add_cloud_license_auth_token_application_settings_text_limit
) adds the text limit
Migrate Up
bin/rails db:migrate
== 20201111110318 AddCloudLicenseAuthTokenToSettings: migrating ===============
-- add_column(:application_settings, :encrypted_cloud_license_auth_token, :text)
-> 0.0017s
-- add_column(:application_settings, :encrypted_cloud_license_auth_token_iv, :text)
-> 0.0005s
== 20201111110318 AddCloudLicenseAuthTokenToSettings: migrated (0.0023s) ======
== 20201111110918 AddCloudLicenseAuthTokenApplicationSettingsTextLimit: migrating
-- transaction_open?()
-> 0.0000s
-- current_schema()
-> 0.0003s
-- execute("ALTER TABLE application_settings\nADD CONSTRAINT check_ef6176834f\nCHECK ( char_length(encrypted_cloud_license_auth_token_iv) <= 255 )\nNOT VALID;\n")
-> 0.0019s
-- current_schema()
-> 0.0002s
-- execute("SET statement_timeout TO 0")
-> 0.0002s
-- execute("ALTER TABLE application_settings VALIDATE CONSTRAINT check_ef6176834f;")
-> 0.0007s
-- execute("RESET ALL")
-> 0.0001s
== 20201111110918 AddCloudLicenseAuthTokenApplicationSettingsTextLimit: migrated (0.0106s)
Migrate Down
bin/rails db:rollback STEP=2
== 20201111110918 AddCloudLicenseAuthTokenApplicationSettingsTextLimit: reverting
-- execute("ALTER TABLE application_settings\nDROP CONSTRAINT IF EXISTS check_ef6176834f\n")
-> 0.0012s
== 20201111110918 AddCloudLicenseAuthTokenApplicationSettingsTextLimit: reverted (0.0063s)
== 20201111110318 AddCloudLicenseAuthTokenToSettings: reverting ===============
-- remove_column(:application_settings, :encrypted_cloud_license_auth_token_iv, :text)
-> 0.0008s
-- remove_column(:application_settings, :encrypted_cloud_license_auth_token, :text)
-> 0.0004s
== 20201111110318 AddCloudLicenseAuthTokenToSettings: reverted (0.0031s) ======
Does this MR meet the acceptance criteria?
Conformity
Edited by Vijay Hawoldar