Skip to content
代码片段 群组 项目
未验证 提交 c3078082 编辑于 作者: Brian Williams's avatar Brian Williams 提交者: GitLab
浏览文件

Merge branch 'bwill/removed-unused-tmp-indexes' into 'master'

Drop old temporary vulnerability management indices

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/170488



Merged-by: default avatarBrian Williams <bwilliams@gitlab.com>
Approved-by: default avatarAdie (she/her) <avpfestin@gitlab.com>
Approved-by: default avatarAbdul Wadood <awadood@gitlab.com>
Approved-by: default avatarMohamed Hamda <mhamda@gitlab.com>
Approved-by: default avatarAdam Hegyi <ahegyi@gitlab.com>
No related branches found
No related tags found
无相关合并请求
显示
140 个添加14 个删除
......@@ -5,4 +5,4 @@ feature_category: vulnerability_management
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/161962
milestone: '17.4'
queued_migration_version: 20240806205657
finalized_by: # version of the migration that finalized this BBM
finalized_by: 20241024183136
# frozen_string_literal: true
class FinalizeUpdateOwaspTop10DefaultOfVulnerabilityReads < Gitlab::Database::Migration[2.2]
milestone '17.6'
disable_ddl_transaction!
restrict_gitlab_migration gitlab_schema: :gitlab_main
def up
ensure_batched_background_migration_is_finished(
job_class_name: "UpdateOwaspTop10DefaultOfVulnerabilityReads",
table_name: :vulnerability_reads,
column_name: :vulnerability_id,
job_arguments: []
)
end
def down; end
end
# frozen_string_literal: true
class DropTmpIndexForOwaspNullOnVulnerabilityReads < Gitlab::Database::Migration[2.2]
milestone '17.6'
disable_ddl_transaction!
TABLE_NAME = 'vulnerability_reads'
INDEX_NAME = 'tmp_index_for_owasp_null_on_vulnerability_reads'
def up
remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
end
def down
add_concurrent_index TABLE_NAME, [:vulnerability_id], name: INDEX_NAME, where: 'owasp_top_10 IS NULL'
end
end
# frozen_string_literal: true
class DropTmpIdxForFeedbackCommentProcessing < Gitlab::Database::Migration[2.2]
milestone '17.6'
disable_ddl_transaction!
TABLE_NAME = 'vulnerability_feedback'
INDEX_NAME = 'tmp_idx_for_feedback_comment_processing'
def up
remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
end
def down
add_concurrent_index TABLE_NAME, [:id], name: INDEX_NAME, where: 'char_length(comment) > 50000'
end
end
# frozen_string_literal: true
class DropTmpIdxForVulnerabilityFeedbackMigration < Gitlab::Database::Migration[2.2]
milestone '17.6'
disable_ddl_transaction!
TABLE_NAME = 'vulnerability_feedback'
INDEX_NAME = 'tmp_idx_for_vulnerability_feedback_migration'
def up
remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
end
def down
add_concurrent_index TABLE_NAME, [:id], name: INDEX_NAME,
where: '(migrated_to_state_transition = false) AND (feedback_type = 0)'
end
end
# frozen_string_literal: true
class DropTmpIndexForSucceededSecurityScans < Gitlab::Database::Migration[2.2]
milestone '17.6'
disable_ddl_transaction!
TABLE_NAME = 'security_scans'
INDEX_NAME = 'tmp_index_for_succeeded_security_scans'
def up
remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
end
def down
add_concurrent_index TABLE_NAME, [:id], name: INDEX_NAME, where: 'status = 1'
end
end
# frozen_string_literal: true
class DropTmpIndexOnVulnerabilitiesNonDismissed < Gitlab::Database::Migration[2.2]
milestone '17.6'
disable_ddl_transaction!
TABLE_NAME = 'vulnerabilities'
INDEX_NAME = 'tmp_index_on_vulnerabilities_non_dismissed'
def up
remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
end
def down
add_concurrent_index TABLE_NAME, [:id], name: INDEX_NAME, where: 'state <> 2'
end
end
# frozen_string_literal: true
class DropTmpIndexVulnerabilityOverlongTitleHtml < Gitlab::Database::Migration[2.2]
milestone '17.6'
disable_ddl_transaction!
TABLE_NAME = 'vulnerabilities'
INDEX_NAME = 'tmp_index_vulnerability_overlong_title_html'
def up
remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
end
def down
add_concurrent_index TABLE_NAME, [:id], name: INDEX_NAME, where: 'length(title_html) > 800'
end
end
dc555f7bd357fa57a44d53496126c96cbb55c08165f65b1c245edd0fd8fc6762
\ No newline at end of file
f60e353f87d6dce6e4c2c056d510db7408334f6c6373d010999202ede2761a05
\ No newline at end of file
546aaaf617e43d4b33dc80ec78ae71cc28f299561f731156ee6c9350d5ae8dcf
\ No newline at end of file
f9983661931c3e3658c9e6c735332e83f63240b0af8fb1f4e6621fb458e29523
\ No newline at end of file
9219385757dc068902e484030dc7fab4db833d6048f2183d810df5ea0013c958
\ No newline at end of file
63540e74ccbf820dfe63970a621251561d79f2a5aef791d0cbbe4d2c177e1739
\ No newline at end of file
e1727dbe662a718aaed60c38c611bb57baebc5eedc484cb38b55b735ac6e2bf0
\ No newline at end of file
......@@ -32596,10 +32596,6 @@ CREATE INDEX temp_index_on_users_where_dark_theme ON users USING btree (id) WHER
 
CREATE UNIQUE INDEX term_agreements_unique_index ON term_agreements USING btree (user_id, term_id);
 
CREATE INDEX tmp_idx_for_feedback_comment_processing ON vulnerability_feedback USING btree (id) WHERE (char_length(comment) > 50000);
CREATE INDEX tmp_idx_for_vulnerability_feedback_migration ON vulnerability_feedback USING btree (id) WHERE ((migrated_to_state_transition = false) AND (feedback_type = 0));
CREATE INDEX tmp_idx_orphaned_approval_merge_request_rules ON approval_merge_request_rules USING btree (id) WHERE ((report_type = ANY (ARRAY[2, 4])) AND (security_orchestration_policy_configuration_id IS NULL));
 
CREATE INDEX tmp_idx_orphaned_approval_project_rules ON approval_project_rules USING btree (id) WHERE ((report_type = ANY (ARRAY[2, 4])) AND (security_orchestration_policy_configuration_id IS NULL));
......@@ -32610,24 +32606,16 @@ CREATE INDEX tmp_index_ci_job_artifacts_on_expire_at_where_locked_unknown ON ci_
 
CREATE INDEX tmp_index_for_null_member_namespace_id ON members USING btree (member_namespace_id) WHERE (member_namespace_id IS NULL);
 
CREATE INDEX tmp_index_for_owasp_null_on_vulnerability_reads ON vulnerability_reads USING btree (vulnerability_id) WHERE (owasp_top_10 IS NULL);
CREATE INDEX tmp_index_for_project_namespace_id_migration_on_routes ON routes USING btree (id) WHERE ((namespace_id IS NULL) AND ((source_type)::text = 'Project'::text));
 
CREATE INDEX tmp_index_for_succeeded_security_scans ON security_scans USING btree (id) WHERE (status = 1);
CREATE UNIQUE INDEX tmp_index_issues_on_tmp_epic_id ON issues USING btree (tmp_epic_id);
 
CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING btree (id) WHERE (state <> 2);
CREATE INDEX tmp_index_packages_dependencies_on_id_without_project_id ON packages_dependencies USING btree (id) WHERE (project_id IS NULL);
 
CREATE INDEX tmp_index_pats_on_notification_columns_and_expires_at ON personal_access_tokens USING btree (id) WHERE ((expire_notification_delivered IS TRUE) AND (seven_days_notification_sent_at IS NULL) AND (expires_at IS NOT NULL));
 
CREATE INDEX tmp_index_project_statistics_cont_registry_size ON project_statistics USING btree (project_id) WHERE (container_registry_size = 0);
 
CREATE INDEX tmp_index_vulnerability_overlong_title_html ON vulnerabilities USING btree (id) WHERE (length(title_html) > 800);
CREATE UNIQUE INDEX u_compliance_requirements_for_framework ON compliance_requirements USING btree (framework_id, name);
 
CREATE UNIQUE INDEX u_project_compliance_standards_adherence_for_reporting ON project_compliance_standards_adherence USING btree (project_id, check_name, standard);
......@@ -2,7 +2,9 @@
require 'spec_helper'
RSpec.describe Gitlab::BackgroundMigration::UpdateOwaspTop10DefaultOfVulnerabilityReads, feature_category: :vulnerability_management do
RSpec.describe Gitlab::BackgroundMigration::UpdateOwaspTop10DefaultOfVulnerabilityReads,
schema: 20241024183136,
feature_category: :vulnerability_management do
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
let(:users) { table(:users) }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册