From 4bc8cd1b90e3505880d2a040682f5c8512b6e00b Mon Sep 17 00:00:00 2001 From: Baodong Date: Thu, 11 Nov 2021 08:36:05 +0800 Subject: [PATCH 1/2] Add has_shimo to project_settings table Add a boolean column to project_settings to allow caching the status of the new Shimo integration as has_shimo. Changelog: added --- .../20211110100050_add_has_shimo_to_project_settings.rb | 7 +++++++ db/schema_migrations/20211110100050 | 1 + db/structure.sql | 1 + spec/lib/gitlab/import_export/safe_model_attributes.yml | 1 + spec/requests/api/project_attributes.yml | 1 + 5 files changed, 11 insertions(+) create mode 100644 db/migrate/20211110100050_add_has_shimo_to_project_settings.rb create mode 100644 db/schema_migrations/20211110100050 diff --git a/db/migrate/20211110100050_add_has_shimo_to_project_settings.rb b/db/migrate/20211110100050_add_has_shimo_to_project_settings.rb new file mode 100644 index 00000000000000..af25521e4e8e78 --- /dev/null +++ b/db/migrate/20211110100050_add_has_shimo_to_project_settings.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddHasShimoToProjectSettings < Gitlab::Database::Migration[1.0] + def change + add_column :project_settings, :has_shimo, :boolean, default: false, null: false + end +end diff --git a/db/schema_migrations/20211110100050 b/db/schema_migrations/20211110100050 new file mode 100644 index 00000000000000..eed0afbac1c670 --- /dev/null +++ b/db/schema_migrations/20211110100050 @@ -0,0 +1 @@ +54b83ba1f8e8aa8a23f230664bcd6cc068a2df2d669e395713f0805d0f054f9c \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index f74fa143972de1..6a6083bd7cfb31 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -18301,6 +18301,7 @@ CREATE TABLE project_settings ( previous_default_branch text, warn_about_potentially_unwanted_characters boolean DEFAULT true NOT NULL, merge_commit_template text, + has_shimo boolean DEFAULT false NOT NULL, CONSTRAINT check_3a03e7557a CHECK ((char_length(previous_default_branch) <= 4096)), CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL)), CONSTRAINT check_eaf7cfb6a7 CHECK ((char_length(merge_commit_template) <= 500)) diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml index 7aa21d7bc0f4a2..9daa3b32fd121f 100644 --- a/spec/lib/gitlab/import_export/safe_model_attributes.yml +++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml @@ -693,6 +693,7 @@ ProjectCiCdSetting: ProjectSetting: - allow_merge_on_skipped_pipeline - has_confluence +- has_shimo - has_vulnerabilities ProtectedEnvironment: - id diff --git a/spec/requests/api/project_attributes.yml b/spec/requests/api/project_attributes.yml index dd00d413664c9d..01d2fb18f0043c 100644 --- a/spec/requests/api/project_attributes.yml +++ b/spec/requests/api/project_attributes.yml @@ -137,6 +137,7 @@ project_setting: unexposed_attributes: - created_at - has_confluence + - has_shimo - has_vulnerabilities - prevent_merge_without_jira_issue - warn_about_potentially_unwanted_characters -- GitLab From d163b0c6d7c32389c2a9da165b3a840c0f5eb44e Mon Sep 17 00:00:00 2001 From: Baodong Date: Thu, 11 Nov 2021 14:53:06 +0800 Subject: [PATCH 2/2] Add enable_lock_retries! to AddHasShimoToProjectSettings --- db/migrate/20211110100050_add_has_shimo_to_project_settings.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/migrate/20211110100050_add_has_shimo_to_project_settings.rb b/db/migrate/20211110100050_add_has_shimo_to_project_settings.rb index af25521e4e8e78..01507908e0fe33 100644 --- a/db/migrate/20211110100050_add_has_shimo_to_project_settings.rb +++ b/db/migrate/20211110100050_add_has_shimo_to_project_settings.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class AddHasShimoToProjectSettings < Gitlab::Database::Migration[1.0] + enable_lock_retries! + def change add_column :project_settings, :has_shimo, :boolean, default: false, null: false end -- GitLab