diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-08 03:12:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-08 03:12:22 +0300 |
commit | 1a35cd021a02aec1cf98dac843359837e3a1affd (patch) | |
tree | 87e6ce1841d4329fae46b9a9f8dba6f0eaf0619b /db | |
parent | c12e8312f6021bc8b2d9aa796fde9abc428b6a74 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/fixtures/development/33_triage_ops.rb | 66 | ||||
-rw-r--r-- | db/post_migrate/20220901071310_add_tmp_index_user_callouts_on_attention_request_feature_names.rb | 18 | ||||
-rw-r--r-- | db/post_migrate/20220901071355_cleanup_attention_request_user_callouts.rb | 18 | ||||
-rw-r--r-- | db/schema_migrations/20220901071310 | 1 | ||||
-rw-r--r-- | db/schema_migrations/20220901071355 | 1 | ||||
-rw-r--r-- | db/structure.sql | 2 |
6 files changed, 83 insertions, 23 deletions
diff --git a/db/fixtures/development/33_triage_ops.rb b/db/fixtures/development/33_triage_ops.rb index b2dd3861169..14832ee4af9 100644 --- a/db/fixtures/development/33_triage_ops.rb +++ b/db/fixtures/development/33_triage_ops.rb @@ -7,6 +7,42 @@ class Gitlab::Seeder::TriageOps WEBHOOK_URL = 'http://0.0.0.0:$PORT$' WEBHOOK_TOKEN = "triage-ops-webhook-token" + WORK_TYPE_LABELS = %w( + bug::availability + bug::mobile + bug::performance + bug::vulnerability + feature::addition + feature::consolidation + feature::enhancement + feature::removal + maintenance::dependency + maintenance::pipelines + maintenance::refactor + maintenance::test-gap + maintenance::usability + maintenance::workflow + type::bug + type::feature + type::maintenance + ) + + WORKFLOW_LABELS = %w( + workflow::blocked + workflow::design + workflow::in dev + workflow::in review + workflow::planning breakdown + workflow::production + workflow::ready + workflow::ready for design + workflow::ready for development + workflow::ready for review + workflow::refinement + workflow::validation backlog + workflow::verification + ) + def seed! puts "Updating settings to allow web hooks to localhost" ApplicationSetting.current_without_cache.update!(allow_local_requests_from_web_hooks_and_services: true) @@ -33,8 +69,12 @@ class Gitlab::Seeder::TriageOps ensure_webhook_for('gitlab-org') puts "Ensuring work type labels" - ensure_work_type_labels_for('gitlab-com') - ensure_work_type_labels_for('gitlab-org') + ensure_labels_for(WORK_TYPE_LABELS, 'gitlab-com') + ensure_labels_for(WORK_TYPE_LABELS, 'gitlab-org') + + puts "Ensuring workflow type labels" + ensure_labels_for(WORKFLOW_LABELS, 'gitlab-com') + ensure_labels_for(WORKFLOW_LABELS, 'gitlab-org') end end end @@ -89,27 +129,7 @@ class Gitlab::Seeder::TriageOps puts "Hook with url '#{hook.url}' and token '#{hook.token}' for '#{group_path}' is present now." end - def ensure_work_type_labels_for(group_path) - label_titles = [ - 'bug::availability', - 'bug::mobile', - 'bug::performance', - 'bug::vulnerability', - 'feature::addition', - 'feature::consolidation', - 'feature::enhancement', - 'feature::removal', - 'maintenance::dependency', - 'maintenance::pipelines', - 'maintenance::refactor', - 'maintenance::test-gap', - 'maintenance::usability', - 'maintenance::workflow', - 'type::bug', - 'type::feature', - 'type::maintenance', - ] - + def ensure_labels_for(label_titles, group_path) group = Group.find_by_full_path(group_path) label_titles.each do |label_title| diff --git a/db/post_migrate/20220901071310_add_tmp_index_user_callouts_on_attention_request_feature_names.rb b/db/post_migrate/20220901071310_add_tmp_index_user_callouts_on_attention_request_feature_names.rb new file mode 100644 index 00000000000..10b339b90c1 --- /dev/null +++ b/db/post_migrate/20220901071310_add_tmp_index_user_callouts_on_attention_request_feature_names.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddTmpIndexUserCalloutsOnAttentionRequestFeatureNames < Gitlab::Database::Migration[2.0] + INDEX_NAME = "tmp_index_user_callouts_on_attention_request_feature_names" + ATTENTION_REQUEST_CALLOUTS = [47, 48] + + disable_ddl_transaction! + + def up + add_concurrent_index :user_callouts, [:id], + where: "feature_name IN (#{ATTENTION_REQUEST_CALLOUTS.join(',')})", + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :user_callouts, INDEX_NAME + end +end diff --git a/db/post_migrate/20220901071355_cleanup_attention_request_user_callouts.rb b/db/post_migrate/20220901071355_cleanup_attention_request_user_callouts.rb new file mode 100644 index 00000000000..cbd0d120bb8 --- /dev/null +++ b/db/post_migrate/20220901071355_cleanup_attention_request_user_callouts.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true +class CleanupAttentionRequestUserCallouts < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + ATTENTION_REQUEST_CALLOUTS = [47, 48] + # 47 and 48 were removed with https://gitlab.com/gitlab-org/gitlab/-/merge_requests/95446 + + def up + define_batchable_model('user_callouts') + .where(feature_name: ATTENTION_REQUEST_CALLOUTS) + .each_batch { |batch| batch.delete_all } # rubocop:disable Style/SymbolProc + end + + def down + # Attention request feature has been reverted. + end +end diff --git a/db/schema_migrations/20220901071310 b/db/schema_migrations/20220901071310 new file mode 100644 index 00000000000..9134d6669a0 --- /dev/null +++ b/db/schema_migrations/20220901071310 @@ -0,0 +1 @@ +dee16fbf6edef6da0c9c55b0dca290bc1a1939b8d747ace6594a4d73a70adc7d
\ No newline at end of file diff --git a/db/schema_migrations/20220901071355 b/db/schema_migrations/20220901071355 new file mode 100644 index 00000000000..5e8681b9ff0 --- /dev/null +++ b/db/schema_migrations/20220901071355 @@ -0,0 +1 @@ +3fe94b8d0102c5b5ed7824477cf4a535e42da9a232a320f770442530c77eb960
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 6723db0147d..5ead436e51a 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -30795,6 +30795,8 @@ CREATE INDEX tmp_index_project_statistics_cont_registry_size ON project_statisti CREATE INDEX tmp_index_system_note_metadata_on_id_where_task ON system_note_metadata USING btree (id, action) WHERE ((action)::text = 'task'::text); +CREATE INDEX tmp_index_user_callouts_on_attention_request_feature_names ON user_callouts USING btree (id) WHERE (feature_name = ANY (ARRAY[47, 48])); + CREATE INDEX tmp_index_vulnerability_occurrences_on_id_and_scanner_id ON vulnerability_occurrences USING btree (id, scanner_id) WHERE (report_type = ANY (ARRAY[7, 99])); CREATE UNIQUE INDEX uniq_pkgs_deb_grp_architectures_on_distribution_id_and_name ON packages_debian_group_architectures USING btree (distribution_id, name); |