diff --git a/db/migrate/20231031114050_add_highest_severity_and_vulnerability_count_into_sbom_occurrences.rb b/db/migrate/20231031114050_add_highest_severity_and_vulnerability_count_into_sbom_occurrences.rb index 621db3aea567b92cdcfbc6a99fd80b48c7b6098b..7b33d31b642f9d14cffbc7143fbac324db0ba826 100644 --- a/db/migrate/20231031114050_add_highest_severity_and_vulnerability_count_into_sbom_occurrences.rb +++ b/db/migrate/20231031114050_add_highest_severity_and_vulnerability_count_into_sbom_occurrences.rb @@ -4,9 +4,7 @@ class AddHighestSeverityAndVulnerabilityCountIntoSbomOccurrences < Gitlab::Datab milestone '16.7' def change - add_column :sbom_occurrences, :highest_severity, :smallint, null: true # rubocop:disable Migration/PreventAddingColumns -- Legacy migration - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration + add_column :sbom_occurrences, :highest_severity, :smallint, null: true add_column :sbom_occurrences, :vulnerability_count, :integer, null: false, default: 0 - # rubocop:enable Migration/PreventAddingColumns end end diff --git a/db/migrate/20231221033539_create_sbom_source_packages_table.rb b/db/migrate/20231221033539_create_sbom_source_packages_table.rb index 382fe22d60e73b7a0969044b3bb45da6c518ea2f..2528102270c315474c8bde1e31028ef7cfa1f123 100644 --- a/db/migrate/20231221033539_create_sbom_source_packages_table.rb +++ b/db/migrate/20231221033539_create_sbom_source_packages_table.rb @@ -13,9 +13,7 @@ class CreateSbomSourcePackagesTable < Gitlab::Database::Migration[2.2] # rubocop:disable Migration/PreventIndexCreation -- Legacy migration def up with_lock_retries do - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column :sbom_occurrences, :source_package_id, :bigint, if_not_exists: true - # rubocop:enable Migration/PreventAddingColumns end create_table :sbom_source_packages, if_not_exists: true do |t| diff --git a/db/migrate/20240104142200_add_index_sent_notifications_on_issue_email_participant_id.rb b/db/migrate/20240104142200_add_index_sent_notifications_on_issue_email_participant_id.rb index f7d17a28c12a8d13d6da4936b18bc3e90740803e..c9b755294702da0cf3831b565266ff3daae05ceb 100644 --- a/db/migrate/20240104142200_add_index_sent_notifications_on_issue_email_participant_id.rb +++ b/db/migrate/20240104142200_add_index_sent_notifications_on_issue_email_participant_id.rb @@ -7,11 +7,9 @@ class AddIndexSentNotificationsOnIssueEmailParticipantId < Gitlab::Database::Mig INDEX_NAME = 'index_sent_notifications_on_issue_email_participant_id' - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration def up add_concurrent_index :sent_notifications, :issue_email_participant_id, name: INDEX_NAME end - # rubocop:enable Migration/PreventIndexCreation def down remove_concurrent_index_by_name :sent_notifications, INDEX_NAME diff --git a/db/migrate/20240109145839_add_partition_id_to_pipeline_config.rb b/db/migrate/20240109145839_add_partition_id_to_pipeline_config.rb index 943ff8d60802b1bfc27cf250fccbea7652d9b9d1..e4f661a5e31e302a4c5ac3d174d3aafc3933382a 100644 --- a/db/migrate/20240109145839_add_partition_id_to_pipeline_config.rb +++ b/db/migrate/20240109145839_add_partition_id_to_pipeline_config.rb @@ -5,8 +5,6 @@ class AddPartitionIdToPipelineConfig < Gitlab::Database::Migration[2.2] enable_lock_retries! def change - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column(:ci_pipelines_config, :partition_id, :bigint, default: 100, null: false) - # rubocop:enable Migration/PreventAddingColumns end end diff --git a/db/migrate/20240129175101_add_archived_and_traversal_ids_columns_to_sbom_occurrences.rb b/db/migrate/20240129175101_add_archived_and_traversal_ids_columns_to_sbom_occurrences.rb index fa95155580fb7d1098c9fad9ad240870676d98de..4e5cc8736da5235acfcaa2deabb34f843a701aeb 100644 --- a/db/migrate/20240129175101_add_archived_and_traversal_ids_columns_to_sbom_occurrences.rb +++ b/db/migrate/20240129175101_add_archived_and_traversal_ids_columns_to_sbom_occurrences.rb @@ -4,11 +4,7 @@ class AddArchivedAndTraversalIdsColumnsToSbomOccurrences < Gitlab::Database::Mig milestone '16.9' def change - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column :sbom_occurrences, :archived, :boolean, default: false, null: false - # rubocop:enable Migration/PreventAddingColumns - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column :sbom_occurrences, :traversal_ids, 'bigint[]', default: [], null: false - # rubocop:enable Migration/PreventAddingColumns end end diff --git a/db/migrate/20240212170304_add_ancestors_column_to_sbom_occurrences.rb b/db/migrate/20240212170304_add_ancestors_column_to_sbom_occurrences.rb index d5ba53f31122a2e5dfd9d271b2b98bf2bb9356f8..459ce27da3812a16324100daa12e84a9bc148990 100644 --- a/db/migrate/20240212170304_add_ancestors_column_to_sbom_occurrences.rb +++ b/db/migrate/20240212170304_add_ancestors_column_to_sbom_occurrences.rb @@ -6,9 +6,7 @@ class AddAncestorsColumnToSbomOccurrences < Gitlab::Database::Migration[2.2] enable_lock_retries! def up - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column :sbom_occurrences, :ancestors, :jsonb, default: [], null: false - # rubocop:enable Migration/PreventAddingColumns end def down diff --git a/db/migrate/20240320110318_add_file_final_path_to_packages_package_files.rb b/db/migrate/20240320110318_add_file_final_path_to_packages_package_files.rb index 0bd245137bcf46e3212ce39cd816b6e996e3bc02..2f9c166ea2523c68b9dc82fb26d344e43ef744e8 100644 --- a/db/migrate/20240320110318_add_file_final_path_to_packages_package_files.rb +++ b/db/migrate/20240320110318_add_file_final_path_to_packages_package_files.rb @@ -6,9 +6,7 @@ class AddFileFinalPathToPackagesPackageFiles < Gitlab::Database::Migration[2.2] def up with_lock_retries do - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column :packages_package_files, :file_final_path, :text, if_not_exists: true - # rubocop:enable Migration/PreventAddingColumns end add_text_limit :packages_package_files, :file_final_path, 1024 diff --git a/db/migrate/20240516133122_add_partition_id_to_ci_pipeline_message.rb b/db/migrate/20240516133122_add_partition_id_to_ci_pipeline_message.rb index 11e39dd06407e01ce83909ee052c91f15c1b3db9..1b29d339e63ec609d476ac6288691f436cef52d8 100644 --- a/db/migrate/20240516133122_add_partition_id_to_ci_pipeline_message.rb +++ b/db/migrate/20240516133122_add_partition_id_to_ci_pipeline_message.rb @@ -4,8 +4,6 @@ class AddPartitionIdToCiPipelineMessage < Gitlab::Database::Migration[2.2] milestone '17.1' def change - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column(:ci_pipeline_messages, :partition_id, :bigint, default: 100, null: false) - # rubocop:enable Migration/PreventAddingColumns end end diff --git a/db/migrate/20240517192053_add_advanced_token_scope.rb b/db/migrate/20240517192053_add_advanced_token_scope.rb index e6b85b9fc64f156494afbee75ee428c43f9ca718..fb34cdcaea94f4fab13ed75f382952ed694ebff5 100644 --- a/db/migrate/20240517192053_add_advanced_token_scope.rb +++ b/db/migrate/20240517192053_add_advanced_token_scope.rb @@ -7,9 +7,7 @@ class AddAdvancedTokenScope < Gitlab::Database::Migration[2.2] def up with_lock_retries do - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column :personal_access_tokens, :advanced_scopes, :text, if_not_exists: true - # rubocop:enable Migration/PreventAddingColumns end add_text_limit :personal_access_tokens, :advanced_scopes, 4096 diff --git a/db/migrate/20240627121919_add_auto_canceled_by_partition_id_to_ci_pipelines.rb b/db/migrate/20240627121919_add_auto_canceled_by_partition_id_to_ci_pipelines.rb index 035046c0d39607c5c2ca82d4d78aed01dd881ce0..10e95433bb213fda5ffb07e52f64c04d00fbc1a4 100644 --- a/db/migrate/20240627121919_add_auto_canceled_by_partition_id_to_ci_pipelines.rb +++ b/db/migrate/20240627121919_add_auto_canceled_by_partition_id_to_ci_pipelines.rb @@ -4,6 +4,8 @@ class AddAutoCanceledByPartitionIdToCiPipelines < Gitlab::Database::Migration[2. milestone '17.2' def change - add_column :ci_pipelines, :auto_canceled_by_partition_id, :bigint # rubocop:disable Migration/PreventAddingColumns -- Legacy migration + # rubocop:disable Migration/PreventAddingColumns -- Legacy migration + add_column :ci_pipelines, :auto_canceled_by_partition_id, :bigint + # rubocop:enable Migration/PreventAddingColumns end end diff --git a/db/migrate/20240729130349_add_project_id_to_packages_package_files.rb b/db/migrate/20240729130349_add_project_id_to_packages_package_files.rb index 97b5f22de226ee039276a66518f014eedf581c51..264f28f888610f4c99960958bb528b64dff4d219 100644 --- a/db/migrate/20240729130349_add_project_id_to_packages_package_files.rb +++ b/db/migrate/20240729130349_add_project_id_to_packages_package_files.rb @@ -4,6 +4,6 @@ class AddProjectIdToPackagesPackageFiles < Gitlab::Database::Migration[2.2] milestone '17.3' def change - add_column :packages_package_files, :project_id, :bigint # rubocop:disable Migration/PreventAddingColumns -- Legacy migration + add_column :packages_package_files, :project_id, :bigint end end diff --git a/db/migrate/20240730172815_add_project_id_to_vulnerability_occurrence_pipelines.rb b/db/migrate/20240730172815_add_project_id_to_vulnerability_occurrence_pipelines.rb index 32cfb192daf3c5dc1365e0ae80fe6b7166b5927b..5b54c0fc3a267bbe2efb6ed1875b1269de79c726 100644 --- a/db/migrate/20240730172815_add_project_id_to_vulnerability_occurrence_pipelines.rb +++ b/db/migrate/20240730172815_add_project_id_to_vulnerability_occurrence_pipelines.rb @@ -4,6 +4,6 @@ class AddProjectIdToVulnerabilityOccurrencePipelines < Gitlab::Database::Migrati milestone '17.3' def change - add_column :vulnerability_occurrence_pipelines, :project_id, :bigint # rubocop:disable Migration/PreventAddingColumns -- Legacy migration + add_column :vulnerability_occurrence_pipelines, :project_id, :bigint end end diff --git a/db/migrate/20240802194745_add_project_id_to_merge_request_diff_commits_b5377a7a34.rb b/db/migrate/20240802194745_add_project_id_to_merge_request_diff_commits_b5377a7a34.rb index 8c52ceb9141e62f28ae3f82cc7a4c1b74b2b7cbf..9072b546eeeba81ed0e6bd39b76a1810567e90a1 100644 --- a/db/migrate/20240802194745_add_project_id_to_merge_request_diff_commits_b5377a7a34.rb +++ b/db/migrate/20240802194745_add_project_id_to_merge_request_diff_commits_b5377a7a34.rb @@ -4,9 +4,7 @@ class AddProjectIdToMergeRequestDiffCommitsB5377a7a34 < Gitlab::Database::Migrat milestone '17.3' def up - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column :merge_request_diff_commits_b5377a7a34, :project_id, :bigint - # rubocop:enable Migration/PreventAddingColumns end def down diff --git a/db/migrate/20240802203135_add_project_id_to_merge_request_diff_files99208b8fac.rb b/db/migrate/20240802203135_add_project_id_to_merge_request_diff_files99208b8fac.rb index 63067fa28351f67fd9e5c9f473afa9e03f9d764e..77520c16be63dc51f1fdf0f0481d51adb0162072 100644 --- a/db/migrate/20240802203135_add_project_id_to_merge_request_diff_files99208b8fac.rb +++ b/db/migrate/20240802203135_add_project_id_to_merge_request_diff_files99208b8fac.rb @@ -4,7 +4,7 @@ class AddProjectIdToMergeRequestDiffFiles99208b8fac < Gitlab::Database::Migratio milestone '17.3' def up - add_column :merge_request_diff_files_99208b8fac, :project_id, :bigint # rubocop:disable Migration/PreventAddingColumns -- Legacy migration + add_column :merge_request_diff_files_99208b8fac, :project_id, :bigint end def down diff --git a/db/migrate/20240805080941_add_organization_id_to_personal_access_tokens.rb b/db/migrate/20240805080941_add_organization_id_to_personal_access_tokens.rb index 495cbc2ae3301967a77b157742ece5e972a48e13..e0fe35d7ad7fb3e9ff46e39a9c5d85ed776901a0 100644 --- a/db/migrate/20240805080941_add_organization_id_to_personal_access_tokens.rb +++ b/db/migrate/20240805080941_add_organization_id_to_personal_access_tokens.rb @@ -9,9 +9,7 @@ class AddOrganizationIdToPersonalAccessTokens < Gitlab::Database::Migration[2.2] def up with_lock_retries do - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column :personal_access_tokens, :organization_id, :bigint, default: DEFAULT_ORGANIZATION_ID, null: false, - # rubocop:enable Migration/PreventAddingColumns if_not_exists: true end # rubocop:disable Migration/PreventIndexCreation -- Legacy migration diff --git a/db/migrate/20240805081832_add_reachability_column_to_sbom_occurances_table.rb b/db/migrate/20240805081832_add_reachability_column_to_sbom_occurances_table.rb index d0b413f5059b63eef7f89fd49ef895dc4d0a52e8..7648f1da32dd590f098f74b55f5c38d26cc8c592 100644 --- a/db/migrate/20240805081832_add_reachability_column_to_sbom_occurances_table.rb +++ b/db/migrate/20240805081832_add_reachability_column_to_sbom_occurances_table.rb @@ -4,7 +4,7 @@ class AddReachabilityColumnToSbomOccurancesTable < Gitlab::Database::Migration[2 milestone '17.4' def up with_lock_retries do - add_column :sbom_occurrences, :reachability, :smallint, default: 0 # rubocop:disable Migration/PreventAddingColumns -- Legacy migration + add_column :sbom_occurrences, :reachability, :smallint, default: 0 # -- Legacy migration end end diff --git a/db/migrate/20240822195511_add_notification_cols_to_personal_access_tokens.rb b/db/migrate/20240822195511_add_notification_cols_to_personal_access_tokens.rb index 0df734bcbf095a1662c4a97cf9cebdf7af7367ac..e934da182fd1a166794ed0103348be2c126ead88 100644 --- a/db/migrate/20240822195511_add_notification_cols_to_personal_access_tokens.rb +++ b/db/migrate/20240822195511_add_notification_cols_to_personal_access_tokens.rb @@ -4,15 +4,9 @@ class AddNotificationColsToPersonalAccessTokens < Gitlab::Database::Migration[2. milestone '17.4' def up - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column :personal_access_tokens, :seven_days_notification_sent_at, :datetime_with_timezone - # rubocop:enable Migration/PreventAddingColumns - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column :personal_access_tokens, :thirty_days_notification_sent_at, :datetime_with_timezone - # rubocop:enable Migration/PreventAddingColumns - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column :personal_access_tokens, :sixty_days_notification_sent_at, :datetime_with_timezone - # rubocop:enable Migration/PreventAddingColumns end def down diff --git a/db/migrate/20241014081022_add_project_id_to_ci_pipeline_messages.rb b/db/migrate/20241014081022_add_project_id_to_ci_pipeline_messages.rb index 08a283122caaf4ecf3b4ff79c8fc11b686f28fb5..804ada9dcfb499e541081785a7449d2f6f4b4f88 100644 --- a/db/migrate/20241014081022_add_project_id_to_ci_pipeline_messages.rb +++ b/db/migrate/20241014081022_add_project_id_to_ci_pipeline_messages.rb @@ -4,6 +4,6 @@ class AddProjectIdToCiPipelineMessages < Gitlab::Database::Migration[2.2] milestone '17.6' def change - add_column(:ci_pipeline_messages, :project_id, :bigint) # rubocop:disable Migration/PreventAddingColumns -- Legacy migration + add_column(:ci_pipeline_messages, :project_id, :bigint) end end diff --git a/db/migrate/20241021141853_add_auto_resolved_to_vulnerabilities.rb b/db/migrate/20241021141853_add_auto_resolved_to_vulnerabilities.rb index e026853857df920262f89d6e72cd3f3e95db7b5c..e94c532cff61e12d82dfc712e266a40d6bd694dd 100644 --- a/db/migrate/20241021141853_add_auto_resolved_to_vulnerabilities.rb +++ b/db/migrate/20241021141853_add_auto_resolved_to_vulnerabilities.rb @@ -4,8 +4,6 @@ class AddAutoResolvedToVulnerabilities < Gitlab::Database::Migration[2.2] milestone '17.6' def change - # rubocop:disable Migration/PreventAddingColumns -- Legacy migration add_column :vulnerabilities, :auto_resolved, :boolean, null: false, default: false, if_not_exists: true - # rubocop:enable Migration/PreventAddingColumns end end diff --git a/db/post_migrate/20231114034507_add_merge_request_diffs_project_id_index_async.rb b/db/post_migrate/20231114034507_add_merge_request_diffs_project_id_index_async.rb index 7cb1ed3e8f13b684c048505d2b620624f569983c..1c783b922ae86dc5373b2e99e8eda716b2dd6dac 100644 --- a/db/post_migrate/20231114034507_add_merge_request_diffs_project_id_index_async.rb +++ b/db/post_migrate/20231114034507_add_merge_request_diffs_project_id_index_async.rb @@ -6,11 +6,9 @@ class AddMergeRequestDiffsProjectIdIndexAsync < Gitlab::Database::Migration[2.2] INDEX_NAME = 'index_merge_request_diffs_on_project_id' - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration def up prepare_async_index :merge_request_diffs, :project_id, name: INDEX_NAME end - # rubocop:enable Migration/PreventIndexCreation def down unprepare_async_index :merge_request_diffs, :project_id, name: INDEX_NAME diff --git a/db/post_migrate/20231121040153_add_merge_request_diffs_project_id_index.rb b/db/post_migrate/20231121040153_add_merge_request_diffs_project_id_index.rb index 29171cc501cbce0c95d9f6556c972517171c59a4..5576e9d534e8f36d47fab61b8ca33f6401cbdeb5 100644 --- a/db/post_migrate/20231121040153_add_merge_request_diffs_project_id_index.rb +++ b/db/post_migrate/20231121040153_add_merge_request_diffs_project_id_index.rb @@ -6,11 +6,9 @@ class AddMergeRequestDiffsProjectIdIndex < Gitlab::Database::Migration[2.2] INDEX_NAME = 'index_merge_request_diffs_on_project_id' - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration def up add_concurrent_index :merge_request_diffs, :project_id, name: INDEX_NAME end - # rubocop:enable Migration/PreventIndexCreation def down remove_concurrent_index_by_name :merge_request_diffs, name: INDEX_NAME diff --git a/db/post_migrate/20231207155340_prepare_iid_namespace_unique_index_in_issues.rb b/db/post_migrate/20231207155340_prepare_iid_namespace_unique_index_in_issues.rb index ea6149612e0b7660b00d580b4274f857caa7bfbd..a0149a79f83f915fbf1e8a7c5e3cac48644be89b 100644 --- a/db/post_migrate/20231207155340_prepare_iid_namespace_unique_index_in_issues.rb +++ b/db/post_migrate/20231207155340_prepare_iid_namespace_unique_index_in_issues.rb @@ -6,11 +6,9 @@ class PrepareIidNamespaceUniqueIndexInIssues < Gitlab::Database::Migration[2.2] milestone '16.8' # TODO: Index to be created synchronously in https://gitlab.com/gitlab-org/gitlab/-/issues/435856 - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration def up prepare_async_index :issues, [:namespace_id, :iid], unique: true, name: INDEX_NAME end - # rubocop:enable Migration/PreventIndexCreation def down unprepare_async_index :issues, [:namespace_id, :iid], unique: true, name: INDEX_NAME diff --git a/db/post_migrate/20231207211418_add_iid_namespace_unique_index_to_issues.rb b/db/post_migrate/20231207211418_add_iid_namespace_unique_index_to_issues.rb index 6fb51f02d4f9cd526f096634b69847bf9416209c..4c2439f33ea77bfa45a891494c862e1bb7ac9a19 100644 --- a/db/post_migrate/20231207211418_add_iid_namespace_unique_index_to_issues.rb +++ b/db/post_migrate/20231207211418_add_iid_namespace_unique_index_to_issues.rb @@ -7,11 +7,9 @@ class AddIidNamespaceUniqueIndexToIssues < Gitlab::Database::Migration[2.2] milestone '16.8' - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration def up add_concurrent_index :issues, [:namespace_id, :iid], name: INDEX_NAME, unique: true end - # rubocop:enable Migration/PreventIndexCreation def down remove_concurrent_index_by_name :issues, INDEX_NAME diff --git a/db/post_migrate/20231215130625_schedule_index_to_events_author_group_action_target_type_created_at.rb b/db/post_migrate/20231215130625_schedule_index_to_events_author_group_action_target_type_created_at.rb index 09864109e9571ea7669d11cf5d08abd7930ae6bd..1e3658aa69741c843ed05a27808f90f8449d4663 100644 --- a/db/post_migrate/20231215130625_schedule_index_to_events_author_group_action_target_type_created_at.rb +++ b/db/post_migrate/20231215130625_schedule_index_to_events_author_group_action_target_type_created_at.rb @@ -6,11 +6,9 @@ class ScheduleIndexToEventsAuthorGroupActionTargetTypeCreatedAt < Gitlab::Databa INDEX_NAME = 'index_events_author_id_group_id_action_target_type_created_at' COLUMNS = [:author_id, :group_id, :action, :target_type, :created_at] - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration def up prepare_async_index :events, COLUMNS, name: INDEX_NAME end - # rubocop:enable Migration/PreventIndexCreation def down unprepare_async_index :events, COLUMNS, name: INDEX_NAME diff --git a/db/post_migrate/20231218074237_add_index_to_ci_job_artifact_states.rb b/db/post_migrate/20231218074237_add_index_to_ci_job_artifact_states.rb index bd0a46f14ba223d7505fd2a2617f0269f5c947df..7179607fda4b776fef5063bbb120356573ac0204 100644 --- a/db/post_migrate/20231218074237_add_index_to_ci_job_artifact_states.rb +++ b/db/post_migrate/20231218074237_add_index_to_ci_job_artifact_states.rb @@ -7,7 +7,9 @@ class AddIndexToCiJobArtifactStates < Gitlab::Database::Migration[2.2] TABLE_NAME = :ci_job_artifact_states def up + # rubocop:disable Migration/PreventIndexCreation -- Legacy migration add_concurrent_index(TABLE_NAME, [:job_artifact_id, :partition_id], name: INDEX_NAME) + # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20231218074508_add_index_to_ci_build_trace_metadata.rb b/db/post_migrate/20231218074508_add_index_to_ci_build_trace_metadata.rb index e3d324716075dd1b3b894bc4aa7fdc99180f9950..574c71034feb7fc3135e5f2937fd64f99b8b3e66 100644 --- a/db/post_migrate/20231218074508_add_index_to_ci_build_trace_metadata.rb +++ b/db/post_migrate/20231218074508_add_index_to_ci_build_trace_metadata.rb @@ -7,9 +7,7 @@ class AddIndexToCiBuildTraceMetadata < Gitlab::Database::Migration[2.2] TABLE_NAME = :ci_build_trace_metadata def up - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration add_concurrent_index(TABLE_NAME, [:trace_artifact_id, :partition_id], name: INDEX_NAME) - # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20240104223119_add_index_owasp_top_10_with_project_id_on_vulnerability_reads.rb b/db/post_migrate/20240104223119_add_index_owasp_top_10_with_project_id_on_vulnerability_reads.rb index 7af57a7f40082907afb0ccd426e89e48466470fd..99a2dccc8f54ddd006cdfa29db09f130bc4ea8e1 100644 --- a/db/post_migrate/20240104223119_add_index_owasp_top_10_with_project_id_on_vulnerability_reads.rb +++ b/db/post_migrate/20240104223119_add_index_owasp_top_10_with_project_id_on_vulnerability_reads.rb @@ -8,9 +8,7 @@ class AddIndexOwaspTop10WithProjectIdOnVulnerabilityReads < Gitlab::Database::Mi INDEX_NAME = 'index_vuln_reads_on_project_id_owasp_top_10' def up - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration add_concurrent_index :vulnerability_reads, [:project_id, :owasp_top_10], name: INDEX_NAME - # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20240112143548_add_index_to_events_author_group_action_target_type.rb b/db/post_migrate/20240112143548_add_index_to_events_author_group_action_target_type.rb index 36b75d0e7d8341dc624a256744b32df44bb2af90..88e5f95ef68fef44cefedee57ec28a5781bf5645 100644 --- a/db/post_migrate/20240112143548_add_index_to_events_author_group_action_target_type.rb +++ b/db/post_migrate/20240112143548_add_index_to_events_author_group_action_target_type.rb @@ -8,11 +8,9 @@ class AddIndexToEventsAuthorGroupActionTargetType < Gitlab::Database::Migration[ INDEX_NAME = 'index_events_author_id_group_id_action_target_type_created_at' COLUMNS = [:author_id, :group_id, :action, :target_type, :created_at] - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration def up add_concurrent_index :events, COLUMNS, name: INDEX_NAME end - # rubocop:enable Migration/PreventIndexCreation def down remove_concurrent_index_by_name :events, INDEX_NAME diff --git a/db/post_migrate/20240201111294_add_index_on_issues_table_tmp_epic_id_column.rb b/db/post_migrate/20240201111294_add_index_on_issues_table_tmp_epic_id_column.rb index 32d33fe9e8167ff6e324ab0cecccb85ee0c3b838..76e8323973b9c29b906c76fb26e4f3191b4708c6 100644 --- a/db/post_migrate/20240201111294_add_index_on_issues_table_tmp_epic_id_column.rb +++ b/db/post_migrate/20240201111294_add_index_on_issues_table_tmp_epic_id_column.rb @@ -6,11 +6,9 @@ class AddIndexOnIssuesTableTmpEpicIdColumn < Gitlab::Database::Migration[2.2] INDEX_NAME = "tmp_index_issues_on_tmp_epic_id" - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration def up add_concurrent_index :issues, :tmp_epic_id, unique: true, name: INDEX_NAME end - # rubocop:enable Migration/PreventIndexCreation def down remove_concurrent_index_by_name :issues, name: INDEX_NAME diff --git a/db/post_migrate/20240213125429_schedule_index_merge_requests_on_unmerged_state_id.rb b/db/post_migrate/20240213125429_schedule_index_merge_requests_on_unmerged_state_id.rb index bf1f60c809fac7d6402da78650381ebac1584d0d..e7b1fbe68a48e822ffa379e36bcca06033564da2 100644 --- a/db/post_migrate/20240213125429_schedule_index_merge_requests_on_unmerged_state_id.rb +++ b/db/post_migrate/20240213125429_schedule_index_merge_requests_on_unmerged_state_id.rb @@ -6,11 +6,9 @@ class ScheduleIndexMergeRequestsOnUnmergedStateId < Gitlab::Database::Migration[ INDEX_NAME = :idx_merge_requests_on_unmerged_state_id TABLE_NAME = :merge_requests - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration def up prepare_async_index(TABLE_NAME, :id, name: INDEX_NAME, where: "state_id <> 3") end - # rubocop:enable Migration/PreventIndexCreation def down unprepare_async_index(TABLE_NAME, :id, name: INDEX_NAME) diff --git a/db/post_migrate/20240325085542_add_index_merge_requests_on_unmerged_state_id.rb b/db/post_migrate/20240325085542_add_index_merge_requests_on_unmerged_state_id.rb index 4af2eb942f34c060a471c6c799f2bdd7718c06c6..800dc23e7e56225b9015cc8ab224792af43ee148 100644 --- a/db/post_migrate/20240325085542_add_index_merge_requests_on_unmerged_state_id.rb +++ b/db/post_migrate/20240325085542_add_index_merge_requests_on_unmerged_state_id.rb @@ -8,11 +8,9 @@ class AddIndexMergeRequestsOnUnmergedStateId < Gitlab::Database::Migration[2.2] INDEX_NAME = :idx_merge_requests_on_unmerged_state_id TABLE_NAME = :merge_requests - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration def up add_concurrent_index(TABLE_NAME, :id, name: INDEX_NAME, where: "state_id <> 3") end - # rubocop:enable Migration/PreventIndexCreation def down remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME) diff --git a/db/post_migrate/20240410104838_index_vulnerability_reads_on_state_report_type_severity_traversal_ids_archived.rb b/db/post_migrate/20240410104838_index_vulnerability_reads_on_state_report_type_severity_traversal_ids_archived.rb index 599612f72019bd5b2c08ae5ad486c2d035ed8947..6b750eb3fe0185fe68052aecddbab6f6804d5664 100644 --- a/db/post_migrate/20240410104838_index_vulnerability_reads_on_state_report_type_severity_traversal_ids_archived.rb +++ b/db/post_migrate/20240410104838_index_vulnerability_reads_on_state_report_type_severity_traversal_ids_archived.rb @@ -8,9 +8,7 @@ class IndexVulnerabilityReadsOnStateReportTypeSeverityTraversalIdsArchived < Git COLUMNS = %i[resolved_on_default_branch state report_type severity traversal_ids vulnerability_id].freeze def up - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration add_concurrent_index :vulnerability_reads, COLUMNS, name: INDEX_NAME, where: 'archived = false' - # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20240502120047_index_vulnerability_reads_for_common_group_level_query.rb b/db/post_migrate/20240502120047_index_vulnerability_reads_for_common_group_level_query.rb index 5f3ab47f2c2d881dfb97ff84872cf19fe5c0557f..7f1eb48e627dd54a63f890cedf56cc5f981562aa 100644 --- a/db/post_migrate/20240502120047_index_vulnerability_reads_for_common_group_level_query.rb +++ b/db/post_migrate/20240502120047_index_vulnerability_reads_for_common_group_level_query.rb @@ -8,9 +8,7 @@ class IndexVulnerabilityReadsForCommonGroupLevelQuery < Gitlab::Database::Migrat milestone '17.0' def up - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration add_concurrent_index :vulnerability_reads, COLUMNS, name: INDEX_NAME, where: 'archived = false' - # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20240514121644_replace_issues_milestone_index.rb b/db/post_migrate/20240514121644_replace_issues_milestone_index.rb index a1d07d06bf5c45da6cc2ae2161d6b5b66a575a06..eb3d67ae8dfa4067128ddeb175ea0aeb270f291a 100644 --- a/db/post_migrate/20240514121644_replace_issues_milestone_index.rb +++ b/db/post_migrate/20240514121644_replace_issues_milestone_index.rb @@ -6,11 +6,9 @@ class ReplaceIssuesMilestoneIndex < Gitlab::Database::Migration[2.2] INDEX_NAME = 'index_issues_on_milestone_id_and_id' # TODO: Index to be created synchronously in https://gitlab.com/gitlab-org/gitlab/-/issues/461627 - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration def up prepare_async_index :issues, %i[milestone_id id], name: INDEX_NAME end - # rubocop:enable Migration/PreventIndexCreation def down unprepare_async_index :issues, %i[milestone_id id], name: INDEX_NAME diff --git a/db/post_migrate/20240531140131_add_issues_milestone_and_id_index_concurrently.rb b/db/post_migrate/20240531140131_add_issues_milestone_and_id_index_concurrently.rb index f044d91cb6b84d3c0fbe42a1b9abdb866ff8b15c..94f234f67b912098313b27811839c59a6f625340 100644 --- a/db/post_migrate/20240531140131_add_issues_milestone_and_id_index_concurrently.rb +++ b/db/post_migrate/20240531140131_add_issues_milestone_and_id_index_concurrently.rb @@ -7,11 +7,9 @@ class AddIssuesMilestoneAndIdIndexConcurrently < Gitlab::Database::Migration[2.2 disable_ddl_transaction! - # rubocop: disable Migration/PreventIndexCreation -- Replacing an existing index def up add_concurrent_index :issues, %i[milestone_id id], name: INDEX_NAME end - # rubocop: enable Migration/PreventIndexCreation def down remove_concurrent_index_by_name :issues, INDEX_NAME diff --git a/db/post_migrate/20240610125054_create_idx_vulnerability_occurences_on_prim_iden_id.rb b/db/post_migrate/20240610125054_create_idx_vulnerability_occurences_on_prim_iden_id.rb index 26b91086a0c6eb97af5ae00e86f724d8650e3b3a..e1ca68e1f4046c3b4086738ed83626c6c415db87 100644 --- a/db/post_migrate/20240610125054_create_idx_vulnerability_occurences_on_prim_iden_id.rb +++ b/db/post_migrate/20240610125054_create_idx_vulnerability_occurences_on_prim_iden_id.rb @@ -7,14 +7,13 @@ class CreateIdxVulnerabilityOccurencesOnPrimIdenId < Gitlab::Database::Migration NEW_INDEX_NAME = 'index_vulnerability_occurrences_prim_iden_id_and_vuln_id' TABLE_NAME = :vulnerability_occurrences - # rubocop:disable Migration/PreventIndexCreation -- This index was created async previously, check https://gitlab.com/gitlab-org/gitlab/-/merge_requests/131647 + # -- This index was created async previously, check https://gitlab.com/gitlab-org/gitlab/-/merge_requests/131647 def up add_concurrent_index( TABLE_NAME, [:primary_identifier_id, :vulnerability_id], name: NEW_INDEX_NAME ) end - # rubocop:enable Migration/PreventIndexCreation def down remove_concurrent_index_by_name TABLE_NAME, NEW_INDEX_NAME diff --git a/db/post_migrate/20240703142511_add_index_owasp_top_10_for_group_level_reports.rb b/db/post_migrate/20240703142511_add_index_owasp_top_10_for_group_level_reports.rb index 4b205d9364fab988d8eff9ecccd807e7194b709d..a2631fe43db0aa0e7613974755319c3708a9f8b3 100644 --- a/db/post_migrate/20240703142511_add_index_owasp_top_10_for_group_level_reports.rb +++ b/db/post_migrate/20240703142511_add_index_owasp_top_10_for_group_level_reports.rb @@ -6,13 +6,12 @@ class AddIndexOwaspTop10ForGroupLevelReports < Gitlab::Database::Migration[2.2] INDEX_NAME = 'index_for_owasp_top_10_group_level_reports' + # -- Legacy migration def up - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration add_concurrent_index :vulnerability_reads, [:owasp_top_10, :state, :report_type, :severity, :traversal_ids, :vulnerability_id, :resolved_on_default_branch], where: 'archived = false', name: INDEX_NAME - # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20240719033346_tmp_index_on_vulnerability_reads.rb b/db/post_migrate/20240719033346_tmp_index_on_vulnerability_reads.rb index ba2556dcaf88f73d069becf3e4850bb313cdcc64..c7117461ac57580242f70f8669fbfabb36bdd61d 100644 --- a/db/post_migrate/20240719033346_tmp_index_on_vulnerability_reads.rb +++ b/db/post_migrate/20240719033346_tmp_index_on_vulnerability_reads.rb @@ -11,10 +11,9 @@ class TmpIndexOnVulnerabilityReads < Gitlab::Database::Migration[2.2] INDEX_NAME = 'tmp_index_vulnerability_reads_where_state_is_detected' TABLE_NAME = :vulnerability_reads + # -- Legacy migration def up - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration add_concurrent_index TABLE_NAME, :id, name: INDEX_NAME, where: "state = 1" - # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20240729133633_prepare_index_vulnerability_finding_links_on_project_id.rb b/db/post_migrate/20240729133633_prepare_index_vulnerability_finding_links_on_project_id.rb index 95bb399285a53cb052c38ec1a1263d337b1d7bdb..145fb53ad9480fa6be21e385b509531901e6514b 100644 --- a/db/post_migrate/20240729133633_prepare_index_vulnerability_finding_links_on_project_id.rb +++ b/db/post_migrate/20240729133633_prepare_index_vulnerability_finding_links_on_project_id.rb @@ -6,10 +6,9 @@ class PrepareIndexVulnerabilityFindingLinksOnProjectId < Gitlab::Database::Migra INDEX_NAME = 'index_vulnerability_finding_links_on_project_id' + # -- Legacy migration def up - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration prepare_async_index :vulnerability_finding_links, :project_id, name: INDEX_NAME - # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20240730172816_prepare_index_vulnerability_occurrence_pipelines_on_project_id.rb b/db/post_migrate/20240730172816_prepare_index_vulnerability_occurrence_pipelines_on_project_id.rb index c204bea56287f7b5711fcfa59cd31da7379cbeaa..78294f0eb0fbf590c81307c26765a9fec73a5c03 100644 --- a/db/post_migrate/20240730172816_prepare_index_vulnerability_occurrence_pipelines_on_project_id.rb +++ b/db/post_migrate/20240730172816_prepare_index_vulnerability_occurrence_pipelines_on_project_id.rb @@ -6,10 +6,9 @@ class PrepareIndexVulnerabilityOccurrencePipelinesOnProjectId < Gitlab::Database INDEX_NAME = 'index_vulnerability_occurrence_pipelines_on_project_id' + # -- Legacy migration def up - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration prepare_async_index :vulnerability_occurrence_pipelines, :project_id, name: INDEX_NAME - # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20240805205657_tmp_index_for_owasp_on_vulnerability_reads.rb b/db/post_migrate/20240805205657_tmp_index_for_owasp_on_vulnerability_reads.rb index c79e98178f84e9369f6b00c621ebef3d53eda3d4..3158fc7a8e9186a0528fddf24be0e381aaa0ee52 100644 --- a/db/post_migrate/20240805205657_tmp_index_for_owasp_on_vulnerability_reads.rb +++ b/db/post_migrate/20240805205657_tmp_index_for_owasp_on_vulnerability_reads.rb @@ -8,10 +8,9 @@ class TmpIndexForOwaspOnVulnerabilityReads < Gitlab::Database::Migration[2.2] COLUMNS = %i[vulnerability_id].freeze WHERE_CLAUSE = 'owasp_top_10 IS NULL' + # -- Legacy migration def up - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration add_concurrent_index :vulnerability_reads, COLUMNS, name: INDEX_NAME, where: WHERE_CLAUSE - # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20240828173211_add_revised_idx_owasp_top_10_for_group_level_reports.rb b/db/post_migrate/20240828173211_add_revised_idx_owasp_top_10_for_group_level_reports.rb index 7333acfad1f30cae5254f07eabe3d0cf349734f3..7074e911f7b7f0e530952fdec72766f3d752a56f 100644 --- a/db/post_migrate/20240828173211_add_revised_idx_owasp_top_10_for_group_level_reports.rb +++ b/db/post_migrate/20240828173211_add_revised_idx_owasp_top_10_for_group_level_reports.rb @@ -9,13 +9,12 @@ class AddRevisedIdxOwaspTop10ForGroupLevelReports < Gitlab::Database::Migration[ INDEX_NAME = 'revised_idx_for_owasp_top_10_group_level_reports' + # -- Legacy migration def up - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration add_concurrent_index :vulnerability_reads, [:owasp_top_10, :state, :report_type, :resolved_on_default_branch, :severity, :traversal_ids, :vulnerability_id], where: 'archived = false', name: INDEX_NAME - # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20240905023750_async_add_index_on_events_personal_namespace_id_2.rb b/db/post_migrate/20240905023750_async_add_index_on_events_personal_namespace_id_2.rb index 34b55998ad61178c423efd280098ae2121b101ff..7d1d9648d156bee75f78a9a95d879dc9235aea7e 100644 --- a/db/post_migrate/20240905023750_async_add_index_on_events_personal_namespace_id_2.rb +++ b/db/post_migrate/20240905023750_async_add_index_on_events_personal_namespace_id_2.rb @@ -5,14 +5,13 @@ class AsyncAddIndexOnEventsPersonalNamespaceId2 < Gitlab::Database::Migration[2. INDEX_NAME = 'index_events_on_personal_namespace_id' - # rubocop:disable Migration/PreventIndexCreation -- https://gitlab.com/gitlab-org/gitlab/-/issues/462801#note_2081632603 + # -- https://gitlab.com/gitlab-org/gitlab/-/issues/462801#note_2081632603 def up return unless Gitlab.com_except_jh? prepare_async_index :events, :personal_namespace_id, name: INDEX_NAME, where: 'personal_namespace_id IS NOT NULL' end - # rubocop:enable Migration/PreventIndexCreation def down return unless Gitlab.com_except_jh? diff --git a/db/post_migrate/20240909230748_add_index_on_events_personal_namespace_id_self_managed.rb b/db/post_migrate/20240909230748_add_index_on_events_personal_namespace_id_self_managed.rb index bdb2a75f62ec493f2c116a3f22016d9c0f06c5bd..a36498752de5dc6a9c5e20ec26e9525b2d8ab5a1 100644 --- a/db/post_migrate/20240909230748_add_index_on_events_personal_namespace_id_self_managed.rb +++ b/db/post_migrate/20240909230748_add_index_on_events_personal_namespace_id_self_managed.rb @@ -7,7 +7,7 @@ class AddIndexOnEventsPersonalNamespaceIdSelfManaged < Gitlab::Database::Migrati INDEX = 'index_events_on_personal_namespace_id' - # rubocop:disable Migration/PreventIndexCreation -- https://gitlab.com/gitlab-org/gitlab/-/issues/462801#note_2081632603 + # -- https://gitlab.com/gitlab-org/gitlab/-/issues/462801#note_2081632603 def up return if Gitlab.com_except_jh? @@ -16,7 +16,6 @@ def up where: 'personal_namespace_id IS NOT NULL', name: INDEX end - # rubocop:enable Migration/PreventIndexCreation def down return if Gitlab.com_except_jh? diff --git a/db/post_migrate/20240912122438_prepare_index_ci_job_artifact_states_on_project_id.rb b/db/post_migrate/20240912122438_prepare_index_ci_job_artifact_states_on_project_id.rb index b9cacd0b850d926ebb55d888dbbbe239733f49fe..4954335338aa94c86bdc2f279d2e6c3133f7165d 100644 --- a/db/post_migrate/20240912122438_prepare_index_ci_job_artifact_states_on_project_id.rb +++ b/db/post_migrate/20240912122438_prepare_index_ci_job_artifact_states_on_project_id.rb @@ -7,7 +7,9 @@ class PrepareIndexCiJobArtifactStatesOnProjectId < Gitlab::Database::Migration[2 INDEX_NAME = 'index_ci_job_artifact_states_on_project_id' def up + # rubocop:disable Migration/PreventIndexCreation -- Legacy migration prepare_async_index :ci_job_artifact_states, :project_id, name: INDEX_NAME + # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20240923114603_add_index_on_vulnerability_reads_for_filtered_removal.rb b/db/post_migrate/20240923114603_add_index_on_vulnerability_reads_for_filtered_removal.rb index 5b0fdc4aeb1b0e067d5909258d20dd0880489002..1d3e5f10a62b6bbfa8600c7ba4852f2e8813f5f2 100644 --- a/db/post_migrate/20240923114603_add_index_on_vulnerability_reads_for_filtered_removal.rb +++ b/db/post_migrate/20240923114603_add_index_on_vulnerability_reads_for_filtered_removal.rb @@ -7,10 +7,9 @@ class AddIndexOnVulnerabilityReadsForFilteredRemoval < Gitlab::Database::Migrati milestone '17.5' + # -- Legacy migration def up - # rubocop:disable Migration/PreventIndexCreation -- Legacy migration add_concurrent_index :vulnerability_reads, %i[project_id resolved_on_default_branch], name: INDEX_NAME - # rubocop:enable Migration/PreventIndexCreation end def down diff --git a/db/post_migrate/20241021221146_prepare_async_index_on_issues_by_project_correct_type_where_closed.rb b/db/post_migrate/20241021221146_prepare_async_index_on_issues_by_project_correct_type_where_closed.rb index 742bdba756f634b8140e0238ee48b028e8d3cb1f..2f08cec6b0215a299a7b9d75525640989700d4cd 100644 --- a/db/post_migrate/20241021221146_prepare_async_index_on_issues_by_project_correct_type_where_closed.rb +++ b/db/post_migrate/20241021221146_prepare_async_index_on_issues_by_project_correct_type_where_closed.rb @@ -8,7 +8,7 @@ class PrepareAsyncIndexOnIssuesByProjectCorrectTypeWhereClosed < Gitlab::Databas def up # Temporary index to be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/500165 # TODO: Index to be created synchronously in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/170005 - prepare_async_index :issues, # rubocop:disable Migration/PreventIndexCreation -- Tmp index needed to fix work item type ids + prepare_async_index :issues, # -- Tmp index needed to fix work item type ids [:project_id, :correct_work_item_type_id, :closed_at], where: 'state_id = 2', name: INDEX_NAME diff --git a/db/post_migrate/20241021221626_prepare_async_index_on_issues_project_health_id_desc_state_correct_type.rb b/db/post_migrate/20241021221626_prepare_async_index_on_issues_project_health_id_desc_state_correct_type.rb index f95f4634dbc9320649c7cd2878dcae9cd6a8216d..4c20d1fe744a7387e988f985d6cf3aba545b6412 100644 --- a/db/post_migrate/20241021221626_prepare_async_index_on_issues_project_health_id_desc_state_correct_type.rb +++ b/db/post_migrate/20241021221626_prepare_async_index_on_issues_project_health_id_desc_state_correct_type.rb @@ -9,7 +9,7 @@ class PrepareAsyncIndexOnIssuesProjectHealthIdDescStateCorrectType < Gitlab::Dat def up # Temporary index to be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/500165 # TODO: Index to be created synchronously in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/170005 - prepare_async_index :issues, # rubocop:disable Migration/PreventIndexCreation -- Tmp index needed to fix work item type ids + prepare_async_index :issues, # -- Tmp index needed to fix work item type ids [:project_id, :health_status, :id, :state_id, :correct_work_item_type_id], order: { health_status: 'DESC NULLS LAST', id: :desc }, name: INDEX_NAME diff --git a/db/post_migrate/20241021221755_prepare_async_index_on_issues_project_health_id_asc_state_correct_type.rb b/db/post_migrate/20241021221755_prepare_async_index_on_issues_project_health_id_asc_state_correct_type.rb index 5afcaa4cf6d70d5fb6c1061c7b349f82102e1471..a32e782a7ddd86a7a92a677c25377c5109dac1b5 100644 --- a/db/post_migrate/20241021221755_prepare_async_index_on_issues_project_health_id_asc_state_correct_type.rb +++ b/db/post_migrate/20241021221755_prepare_async_index_on_issues_project_health_id_asc_state_correct_type.rb @@ -9,7 +9,7 @@ class PrepareAsyncIndexOnIssuesProjectHealthIdAscStateCorrectType < Gitlab::Data def up # Temporary index to be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/500165 # TODO: Index to be created synchronously in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/170005 - prepare_async_index :issues, # rubocop:disable Migration/PreventIndexCreation -- Tmp index needed to fix work item type ids + prepare_async_index :issues, # -- Tmp index needed to fix work item type ids [:project_id, :health_status, :id, :state_id, :correct_work_item_type_id], order: { health_status: 'ASC NULLS LAST', id: :desc }, name: INDEX_NAME diff --git a/db/post_migrate/20241021221938_prepare_async_index_on_issues_correct_type_project_created_at_state.rb b/db/post_migrate/20241021221938_prepare_async_index_on_issues_correct_type_project_created_at_state.rb index 15214d865d2d2589c3b913176f81f0e741e9598f..3103ceebc8dafba6272535fc1d59d33c6a6796ce 100644 --- a/db/post_migrate/20241021221938_prepare_async_index_on_issues_correct_type_project_created_at_state.rb +++ b/db/post_migrate/20241021221938_prepare_async_index_on_issues_correct_type_project_created_at_state.rb @@ -9,7 +9,7 @@ class PrepareAsyncIndexOnIssuesCorrectTypeProjectCreatedAtState < Gitlab::Databa def up # Temporary index to be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/500165 # TODO: Index to be created synchronously in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/170005 - prepare_async_index :issues, # rubocop:disable Migration/PreventIndexCreation -- Tmp index needed to fix work item type ids + prepare_async_index :issues, # -- Tmp index needed to fix work item type ids [:correct_work_item_type_id, :project_id, :created_at, :state_id], name: INDEX_NAME end diff --git a/db/post_migrate/20241105213841_create_tmp_index_on_issues_by_project_correct_type_where_closed.rb b/db/post_migrate/20241105213841_create_tmp_index_on_issues_by_project_correct_type_where_closed.rb index dcec3980862f775c823fe6f7ff514e8c43f3b2f9..17a47df2d91e2a4c42f1e3b4e16b25d7d3dd0399 100644 --- a/db/post_migrate/20241105213841_create_tmp_index_on_issues_by_project_correct_type_where_closed.rb +++ b/db/post_migrate/20241105213841_create_tmp_index_on_issues_by_project_correct_type_where_closed.rb @@ -8,7 +8,7 @@ class CreateTmpIndexOnIssuesByProjectCorrectTypeWhereClosed < Gitlab::Database:: def up # Temporary index to be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/500165 - add_concurrent_index :issues, # rubocop:disable Migration/PreventIndexCreation -- Tmp index needed to fix work item type ids + add_concurrent_index :issues, # -- Tmp index needed to fix work item type ids [:project_id, :correct_work_item_type_id, :closed_at], where: 'state_id = 2', name: INDEX_NAME diff --git a/db/post_migrate/20241105215409_create_tmp_index_on_issues_project_health_id_desc_state_correct_type.rb b/db/post_migrate/20241105215409_create_tmp_index_on_issues_project_health_id_desc_state_correct_type.rb index 630ba61252666bd8285814c1a5b13d7170ef568d..c6e1e462b2be8625c7f96b834fff9217f9fc5aa7 100644 --- a/db/post_migrate/20241105215409_create_tmp_index_on_issues_project_health_id_desc_state_correct_type.rb +++ b/db/post_migrate/20241105215409_create_tmp_index_on_issues_project_health_id_desc_state_correct_type.rb @@ -8,7 +8,7 @@ class CreateTmpIndexOnIssuesProjectHealthIdDescStateCorrectType < Gitlab::Databa def up # Temporary index to be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/500165 - add_concurrent_index :issues, # rubocop:disable Migration/PreventIndexCreation -- Tmp index needed to fix work item type ids + add_concurrent_index :issues, # -- Tmp index needed to fix work item type ids [:project_id, :health_status, :id, :state_id, :correct_work_item_type_id], order: { health_status: 'DESC NULLS LAST', id: :desc }, name: INDEX_NAME diff --git a/db/post_migrate/20241105215907_create_tmp_index_on_issues_project_health_id_asc_state_correct_type.rb b/db/post_migrate/20241105215907_create_tmp_index_on_issues_project_health_id_asc_state_correct_type.rb index 2628d272ef94737e8aad456ef7860f6673050bac..a4091559d2ceda235b22ec6d7265bb4035a7017d 100644 --- a/db/post_migrate/20241105215907_create_tmp_index_on_issues_project_health_id_asc_state_correct_type.rb +++ b/db/post_migrate/20241105215907_create_tmp_index_on_issues_project_health_id_asc_state_correct_type.rb @@ -8,7 +8,7 @@ class CreateTmpIndexOnIssuesProjectHealthIdAscStateCorrectType < Gitlab::Databas def up # Temporary index to be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/500165 - add_concurrent_index :issues, # rubocop:disable Migration/PreventIndexCreation -- Tmp index needed to fix work item type ids + add_concurrent_index :issues, # -- Tmp index needed to fix work item type ids [:project_id, :health_status, :id, :state_id, :correct_work_item_type_id], order: { health_status: 'ASC NULLS LAST', id: :desc }, name: INDEX_NAME diff --git a/db/post_migrate/20241105220155_create_tmp_index_on_issues_correct_type_project_created_at_state.rb b/db/post_migrate/20241105220155_create_tmp_index_on_issues_correct_type_project_created_at_state.rb index f345fa9ae9f251b7aec6e242b831269e9901f805..33dd94372625349b4a473d155c49875820fa867c 100644 --- a/db/post_migrate/20241105220155_create_tmp_index_on_issues_correct_type_project_created_at_state.rb +++ b/db/post_migrate/20241105220155_create_tmp_index_on_issues_correct_type_project_created_at_state.rb @@ -8,7 +8,7 @@ class CreateTmpIndexOnIssuesCorrectTypeProjectCreatedAtState < Gitlab::Database: def up # Temporary index to be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/500165 - add_concurrent_index :issues, # rubocop:disable Migration/PreventIndexCreation -- Tmp index needed to fix work item type ids + add_concurrent_index :issues, # -- Tmp index needed to fix work item type ids [:correct_work_item_type_id, :project_id, :created_at, :state_id], name: INDEX_NAME end diff --git a/db/post_migrate/20241106125627_update_sent_notifications_index_on_noteable.rb b/db/post_migrate/20241106125627_update_sent_notifications_index_on_noteable.rb index 3cfb203d1f0f3dde5628c53dc06a7b8069eaae6a..dc4e4232d6aa6e6ca4eba8c65a26d602b1892605 100644 --- a/db/post_migrate/20241106125627_update_sent_notifications_index_on_noteable.rb +++ b/db/post_migrate/20241106125627_update_sent_notifications_index_on_noteable.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# rubocop: disable Migration/PreventIndexCreation -- update an existing index +# -- update an existing index class UpdateSentNotificationsIndexOnNoteable < Gitlab::Database::Migration[2.2] milestone '17.6' @@ -22,4 +22,3 @@ def down unprepare_async_index :sent_notifications, COLUMN_NAMES, name: INDEX_NAME end end -# rubocop: enable Migration/PreventIndexCreation diff --git a/rubocop/cop/migration/prevent_adding_columns.rb b/rubocop/cop/migration/prevent_adding_columns.rb index b99ee21db14b023345a770bbac0d91a37b32c961..004e356c6e1d483935b06db319a244faa62d58d0 100644 --- a/rubocop/cop/migration/prevent_adding_columns.rb +++ b/rubocop/cop/migration/prevent_adding_columns.rb @@ -10,7 +10,7 @@ class PreventAddingColumns < RuboCop::Cop::Base include MigrationHelpers MSG = <<~MSG - `%s` is a large table with several columns, adding more should be avoided unless absolutely necessary. + `%s` is over the limit authorized, adding more should be avoided unless absolutely necessary. Consider storing the column in a different table or creating a new one. The list of large tables is defined in rubocop/rubocop-migrations.yml. See https://docs.gitlab.com/ee/development/database/large_tables_limitations.html @@ -52,11 +52,11 @@ def table_matches?(table_name) return false unless valid_table_node?(table_name) table_value = table_name.value - wide_or_large_table?(table_value) + wide_or_over_limit_table?(table_value) end - def wide_or_large_table?(table_value) - WIDE_TABLES.include?(table_value) || large_tables.include?(table_value) + def wide_or_over_limit_table?(table_value) + WIDE_TABLES.include?(table_value) || over_limit_tables.include?(table_value) end def valid_table_node?(table_name) diff --git a/rubocop/migration_helpers.rb b/rubocop/migration_helpers.rb index 4344ed91c82b1f0ea5a4bf9008960416753b34a9..eb4d5491ff658eb69ff9437618fc3ac014ba374a 100644 --- a/rubocop/migration_helpers.rb +++ b/rubocop/migration_helpers.rb @@ -28,6 +28,10 @@ def high_traffic_tables @high_traffic_tables ||= rubocop_migrations_config.dig('Migration/UpdateLargeTable', 'HighTrafficTables') end + def over_limit_tables + @over_limit_table ||= rubocop_migrations_config.dig('Migration/UpdateLargeTable', 'OverLimitTables') + end + def large_tables @large_tables ||= rubocop_migrations_config.dig('Migration/UpdateLargeTable', 'LargeTables') end diff --git a/rubocop/rubocop-migrations.yml b/rubocop/rubocop-migrations.yml index 112a01892c33b80faf44fd72f696c5b8cd540fc1..67e205e02f5a761d1e4313fd9930853106d1fe0d 100644 --- a/rubocop/rubocop-migrations.yml +++ b/rubocop/rubocop-migrations.yml @@ -1,55 +1,66 @@ # Make sure to update the docs if this file moves. Docs URL: https://docs.gitlab.com/ee/development/migration_style_guide.html#when-to-use-the-helper-method Migration/UpdateLargeTable: Enabled: true - LargeTables: # all tables classified as large, or over_limit - - :approval_merge_request_rules_users - - :audit_events - - :ci_build_needs - - :ci_build_report_results - - :ci_build_trace_metadata - - :ci_builds + OverLimitTables: - :ci_builds_metadata - - :ci_job_artifacts - - :ci_job_variables - - :ci_pipeline_messages - - :ci_pipeline_variables + - :ci_builds_metadata_102 + - :ci_builds_metadata_101 + - :ci_builds - :ci_pipelines - - :ci_pipelines_config + - :ci_builds_102 + - :ci_builds_101 + - :taggings + - :ci_job_artifacts + - :ci_build_needs - :ci_stages + - :ci_pipeline_variables + - :ci_build_tags_100 + - :ci_job_artifacts_102 + - :ci_build_names_102 + - :ci_pipeline_variables_102 + - :ci_build_tags_102 + - :ci_build_tags_101 + - :ci_build_report_results + - :ci_job_variables + - :ci_stages_102 - :deployments - :description_versions - :events - :issues - :merge_request_diff_commits - - :merge_request_diff_commits_b5377a7a34 + - :merge_request_diff_commits_b5377a7a34_1000000001 + - :merge_request_diff_commits_b5377a7a34_800000001 - :merge_request_diff_files - - :merge_request_diff_files_99208b8fac + - :merge_request_diff_files_99208b8fac_1000000001 - :merge_request_diffs - :merge_request_metrics - :merge_requests - :note_diff_files - :notes - :oauth_access_tokens - - :packages_package_files - - :personal_access_tokens - :project_authorizations - - :projects - :push_event_payloads - :resource_label_events - - :sbom_occurrences - :security_findings - - :security_scans - :sent_notifications - :system_note_metadata - - :taggings - :todos - - :vulnerabilities - :vulnerability_finding_links - - :vulnerability_occurrence_pipelines - :vulnerability_occurrences - :vulnerability_reads - :web_hook_logs - HighTrafficTables: &high_traffic_tables # size in GB (>= 10 GB on GitLab.com as of 06/2022) and/or number of records + LargeTables: + - :ci_job_artifact_states + - :ci_pipeline_messages + - :approval_merge_request_rules_users + - :audit_events + - :packages_package_files + - :personal_access_tokens + - :projects + - :sbom_occurrences + - :security_scans + - :vulnerabilities + HighTrafficTables: - :alert_management_alerts - :approvals - :approval_merge_request_rules_users diff --git a/spec/rubocop/cop/migration/prevent_adding_columns_spec.rb b/spec/rubocop/cop/migration/prevent_adding_columns_spec.rb index 6b2ca1901880d50ac9dc334b93be3db95c70405e..b2f019c30f08e090946a086c81e12f7569888bd8 100644 --- a/spec/rubocop/cop/migration/prevent_adding_columns_spec.rb +++ b/spec/rubocop/cop/migration/prevent_adding_columns_spec.rb @@ -21,7 +21,7 @@ def up context 'with wide tables' do it 'registers an offense when adding a column to a wide table' do - offense = '`projects` is a large table with several columns, [...]' + offense = '`projects` is over the limit authorized, [...]' expect_offense(<<~RUBY) def up @@ -32,7 +32,7 @@ def up end it 'registers an offense when adding a column with default to a wide table' do - offense = '`users` is a large table with several columns, [...]' + offense = '`users` is over the limit authorized, [...]' expect_offense(<<~RUBY) def up @@ -43,7 +43,7 @@ def up end it 'registers an offense when adding a reference' do - offense = '`ci_builds` is a large table with several columns, [...]' + offense = '`ci_builds` is over the limit authorized, [...]' expect_offense(<<~RUBY) def up @@ -54,7 +54,7 @@ def up end it 'registers an offense when adding timestamps' do - offense = '`projects` is a large table with several columns, [...]' + offense = '`projects` is over the limit authorized, [...]' expect_offense(<<~RUBY) def up @@ -83,13 +83,13 @@ def up end end - context 'when targeting a large table' do - it 'registers an offense for audit_events' do - offense = '`audit_events` is a large table with several columns, [...]' + context 'when targeting an over limit table' do + it 'registers an offense for issues' do + offense = '`issues` is over the limit authorized, [...]' expect_offense(<<~RUBY) def up - add_column(:audit_events, :another_column, :boolean, default: false) + add_column(:issues, :another_column, :boolean, default: false) ^^^^^^^^^^ #{offense} end RUBY diff --git a/spec/rubocop/cop/migration/prevent_index_creation_spec.rb b/spec/rubocop/cop/migration/prevent_index_creation_spec.rb index 2daab714cadaf9887412fd87bc2c0b06ceb2e000..3a3409b67db87d7d32436f84e0c9113b1a838d89 100644 --- a/spec/rubocop/cop/migration/prevent_index_creation_spec.rb +++ b/spec/rubocop/cop/migration/prevent_index_creation_spec.rb @@ -3,30 +3,11 @@ require 'rubocop_spec_helper' require_relative '../../../../rubocop/cop/migration/prevent_index_creation' -RSpec.describe RuboCop::Cop::Migration::PreventIndexCreation do +RSpec.describe RuboCop::Cop::Migration::PreventIndexCreation, feature_category: :database do + include RuboCop::MigrationHelpers + let(:forbidden_tables) do - %w[ - ci_builds - namespaces - projects - users - merge_requests - merge_request_metrics - merge_request_diffs - merge_request_diff_commits - notes - web_hook_logs - events - project_statistics - sent_notifications - issues - issue_search_data - packages_packages - vulnerability_occurrences - sbom_occurrences - security_findings - deployments - ].freeze + described_class::FORBIDDEN_TABLES + large_tables end context 'when in migration' do @@ -121,7 +102,7 @@ def change it "registers an offense when add_concurrent_index is used", :aggregate_failures do expect_offense(<<~RUBY) INDEX_NAME = "index_name" - TABLE_NAME = :ci_builds + TABLE_NAME = :projects disable_ddl_transaction! def change @@ -134,7 +115,7 @@ def change it "registers an offense when prepare_async_index is used", :aggregate_failures do expect_offense(<<~RUBY) INDEX_NAME = "index_name" - TABLE_NAME = :ci_builds + TABLE_NAME = :projects disable_ddl_transaction! def change