Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-12-11 15:13:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-11 15:13:09 +0300
commitee2024d964d1742a8ec01da89e0b34351c9303ab (patch)
tree7c8108788f3db88c579974951bb2cb1b792e871e /db/post_migrate
parent5f6fe673fa797f46ee747df4553a9c216224bb85 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/post_migrate')
-rw-r--r--db/post_migrate/20220601110011_schedule_remove_self_managed_wiki_notes.rb35
-rw-r--r--db/post_migrate/20220606054503_add_tmp_index_job_artifacts_id_and_expire_at.rb29
-rw-r--r--db/post_migrate/20220606080509_fix_incorrect_job_artifacts_expire_at.rb31
-rw-r--r--db/post_migrate/20220615154500_schedule_backfill_cluster_agents_has_vulnerabilities.rb30
-rw-r--r--db/post_migrate/20220616171355_update_vulnerabilities_project_id_id_active_cis_index.rb24
-rw-r--r--db/post_migrate/20220706145113_backfill_namespace_id_on_issues.rb28
-rw-r--r--db/post_migrate/20220707192420_remove_tmp_idx_merge_requests_draft_and_status.rb18
-rw-r--r--db/post_migrate/20220726225114_remove_tmp_index_group_membership_namespace_id_column.rb17
-rw-r--r--db/post_migrate/20220801155858_schedule_disable_legacy_open_source_licence_for_recent_public_projects.rb33
-rw-r--r--db/post_migrate/20220809002011_schedule_destroy_invalid_group_members.rb22
-rw-r--r--db/post_migrate/20220809214730_add_note_metadata_temp_index_on_id_where_task.rb15
-rw-r--r--db/post_migrate/20220809223215_change_task_system_note_wording_to_checklist_item.rb28
-rw-r--r--db/post_migrate/20220815061621_rename_web_hooks_service_id_to_integration_id.rb13
-rw-r--r--db/post_migrate/20220816075638_drop_uuid_and_id_index_from_security_findings.rb15
-rw-r--r--db/post_migrate/20220816163444_update_start_date_for_iterations_cadences.rb53
-rw-r--r--db/post_migrate/20220820221036_update_tmp_non_migrated_index_on_container_repositories.rb25
-rw-r--r--db/post_migrate/20220822071909_remove_other_role_from_user_details.rb9
-rw-r--r--db/post_migrate/20220822090656_drop_build_coverage_regex_from_project.rb13
-rw-r--r--db/post_migrate/20220822094804_add_issues_authorization_index.rb15
-rw-r--r--db/post_migrate/20220823084747_prepare_removal_partial_trigram_indexes_for_issues.rb16
-rw-r--r--db/post_migrate/20220824114218_add_tmp_index_approval_merge_request_rules.rb19
-rw-r--r--db/post_migrate/20220825061250_drop_tmp_index_todos_attention_request_action_idx.rb18
-rw-r--r--db/post_migrate/20220825142324_replace_issues_authorization_index.rb18
-rw-r--r--db/post_migrate/20220826165048_drop_temporary_job_trace_index.rb13
-rw-r--r--db/post_migrate/20220826175058_fully_remove_temporary_job_trace_index.rb15
-rw-r--r--db/post_migrate/20220830051704_add_temporary_index_for_orphaned_invited_members.rb21
-rw-r--r--db/post_migrate/20220830061704_orphaned_invited_members_cleanup.rb29
-rw-r--r--db/post_migrate/20220830071704_remove_temporary_index_for_orphaned_invited_members.rb21
-rw-r--r--db/post_migrate/20220830172142_reschedule_issue_work_item_type_id_backfill.rb40
-rw-r--r--db/post_migrate/20220831021358_add_index_on_issue_health_status.rb16
-rw-r--r--db/post_migrate/20220831090454_cleanup_web_hooks_service_id.rb13
-rw-r--r--db/post_migrate/20220831132802_delete_approval_rules_for_vulnerability.rb42
-rw-r--r--db/post_migrate/20220901035725_schedule_destroy_invalid_project_members.rb20
-rw-r--r--db/post_migrate/20220901071310_add_tmp_index_user_callouts_on_attention_request_feature_names.rb18
-rw-r--r--db/post_migrate/20220901071355_cleanup_attention_request_user_callouts.rb18
-rw-r--r--db/post_migrate/20220901073300_remove_partial_trigram_indexes_for_issues.rb25
-rw-r--r--db/post_migrate/20220901184106_add_not_null_to_board_group_recent_visits.rb17
-rw-r--r--db/post_migrate/20220901184246_add_not_null_to_board_project_recent_visits.rb17
-rw-r--r--db/post_migrate/20220902111016_delete_null_records_from_board_group_recent_visits.rb15
-rw-r--r--db/post_migrate/20220902111038_delete_null_records_from_board_project_recent_visits.rb15
-rw-r--r--db/post_migrate/20220902204048_move_security_findings_table_to_gitlab_partitions_dynamic_schema.rb230
-rw-r--r--db/post_migrate/20220904173342_validate_not_null_constraint_board_group_recent_visits.rb15
-rw-r--r--db/post_migrate/20220904173430_validate_not_null_constraint_board_project_recent_visits.rb15
-rw-r--r--db/post_migrate/20220905090300_add_tmp_index_merge_request_reviewers_attention_request_state.rb18
-rw-r--r--db/post_migrate/20220905090339_reset_attention_requested_merge_requests_reviewers_state_to_unreviewed.rb30
-rw-r--r--db/post_migrate/20220905112710_add_async_index_to_todos_to_cover_pending_query.rb16
-rw-r--r--db/post_migrate/20220905120848_backfill_epic_cache_counts.rb29
-rw-r--r--db/post_migrate/20220906074449_schedule_disable_legacy_open_source_license_for_projects_less_than_one_mb.rb33
-rw-r--r--db/post_migrate/20220906212931_add_partial_index_for_ci_pipeline_artifacts_unlocked_with_expire_at.rb17
-rw-r--r--db/post_migrate/20220907122648_populate_security_orchestration_policy_configuration_id.rb38
-rw-r--r--db/post_migrate/20220908125146_remove_free_user_cap_remediation_worker.rb11
-rw-r--r--db/post_migrate/20220909114220_drop_environments_project_name_lower_pattern_ops_index.rb16
-rw-r--r--db/post_migrate/20220912085047_add_index_to_todos_pending_query.rb16
-rw-r--r--db/post_migrate/20220912110433_prepare_create_internal_notes_index_on_id.rb13
-rw-r--r--db/post_migrate/20220913030552_add_tmp_index_system_note_metadata_on_attention_request_actions.rb17
-rw-r--r--db/post_migrate/20220913030624_cleanup_attention_request_related_system_notes.rb30
-rw-r--r--db/post_migrate/20220913083015_clean_up_rename_iterations_cadences_last_run_date_to_next_run_date.rb13
-rw-r--r--db/post_migrate/20220914093408_add_unique_id_partition_id_index_to_ci_build_metadata.rb14
-rw-r--r--db/post_migrate/20220915103831_add_unique_build_id_partition_id_index_to_ci_build_metadata.rb14
-rw-r--r--db/post_migrate/20220915192521_prepare_async_trigram_index_for_vulnerability_reads_container_images.rb19
-rw-r--r--db/post_migrate/20220916054103_remove_experience_level_column.rb13
-rw-r--r--db/post_migrate/20220916065418_add_index_id_partition_id_to_ci_builds_metadata.rb16
-rw-r--r--db/post_migrate/20220916070101_add_index_build_id_partition_id_to_ci_build_metadata.rb16
-rw-r--r--db/post_migrate/20220916112841_remove_unused_aggregation_columns.rb59
-rw-r--r--db/post_migrate/20220919023208_drop_unused_fields_from_merge_request_assignees.rb40
-rw-r--r--db/post_migrate/20220919041604_drop_unused_fields_from_merge_request_reviewers.rb26
-rw-r--r--db/post_migrate/20220919050555_drop_tmp_index_user_callouts_on_attention_request_feature_names.rb18
-rw-r--r--db/post_migrate/20220919080303_delete_migrate_shared_vulnerability_scanners.rb44
-rw-r--r--db/post_migrate/20220919080304_reschedule_migrate_shared_vulnerability_scanners.rb29
-rw-r--r--db/post_migrate/20220920081631_prepare_ci_builds_metadata_for_partitioning_primary_key.rb36
-rw-r--r--db/post_migrate/20220920122121_schedule_index_removal_for_ci_builds_metadata.rb16
-rw-r--r--db/post_migrate/20220920124709_backfill_internal_on_notes_renamed.rb28
-rw-r--r--db/post_migrate/20220920135356_tiebreak_user_type_index.rb20
-rw-r--r--db/post_migrate/20220920141001_add_index_on_internal_notes.rb15
-rw-r--r--db/post_migrate/20220920213504_finalize_task_system_note_renaming.rb11
-rw-r--r--db/post_migrate/20220920214524_remove_task_system_note_rename_temp_index.rb11
-rw-r--r--db/post_migrate/20220921093355_schedule_backfill_namespace_details.rb29
-rw-r--r--db/post_migrate/20220921111823_remove_and_add_ci_pipeline_variables_raw_with_new_default.rb10
-rw-r--r--db/post_migrate/20220921111831_remove_and_add_ci_group_variables_raw_with_new_default.rb10
-rw-r--r--db/post_migrate/20220921111840_remove_and_add_ci_instance_variables_raw_with_new_default.rb10
-rw-r--r--db/post_migrate/20220921111849_remove_and_add_ci_job_variables_raw_with_new_default.rb10
-rw-r--r--db/post_migrate/20220921111857_remove_and_add_ci_pipeline_schedule_variables_raw_with_new_default.rb10
-rw-r--r--db/post_migrate/20220921111907_remove_and_add_ci_variables_raw_with_new_default.rb10
-rw-r--r--db/post_migrate/20220921144258_remove_orphan_group_token_users.rb40
-rw-r--r--db/post_migrate/20220922090236_remove_trace_column_from_ci_builds.rb9
-rw-r--r--db/post_migrate/20220922143143_schedule_reset_duplicate_ci_runners_token_values.rb28
-rw-r--r--db/post_migrate/20220922143634_schedule_reset_duplicate_ci_runners_token_encrypted_values.rb28
-rw-r--r--db/post_migrate/20220922204106_remove_index_for_requested_non_invited_awaiting_members.rb17
-rw-r--r--db/post_migrate/20220923052531_remove_tmp_index_merge_request_reviewers_on_attention_requested_state.rb18
-rw-r--r--db/post_migrate/20220923060226_remove_tmp_index_system_note_metadata_on_attention_request_actions.rb17
-rw-r--r--db/post_migrate/20220927171740_prepare_for_vulnerability_occurrences_uuid_type_transition.rb26
-rw-r--r--db/post_migrate/20220928225711_schedule_update_ci_pipeline_artifacts_locked_status.rb27
-rw-r--r--db/post_migrate/20220929081645_tmp_idx_null_member_namespace_id.rb17
-rw-r--r--db/post_migrate/20220929091500_add_tmp_index_vulns_on_report_type.rb22
-rw-r--r--db/post_migrate/20220929101947_delete_remove_invalid_member_migration.rb19
-rw-r--r--db/post_migrate/20220929194453_add_index_releases_project_id_id.rb15
-rw-r--r--db/post_migrate/20220929213730_schedule_delete_orphaned_operational_vulnerabilities.rb25
-rw-r--r--db/post_migrate/20220930110127_remove_unique_index_build_id_to_ci_builds_metadata.rb16
-rw-r--r--db/post_migrate/20221002234454_finalize_group_member_namespace_id_migration.rb22
-rw-r--r--db/post_migrate/20221003192827_add_index_resolved_on_default_branch_to_vulnerabilities_read.rb18
-rw-r--r--db/post_migrate/20221004074910_routing_table_prepare_constraint_for_builds_metadata.rb30
-rw-r--r--db/post_migrate/20221004074914_create_routing_table_for_builds_metadata.rb7
-rw-r--r--db/post_migrate/20221004092038_tmp_index_members_on_id_where_namespace_id_null.rb17
-rw-r--r--db/post_migrate/20221004094814_schedule_destroy_invalid_members.rb27
-rw-r--r--db/post_migrate/20221005103000_add_index_merge_request_id_on_scan_finding_approval_merge_request_rules.rb17
-rw-r--r--db/post_migrate/20221006070927_finalize_invalid_member_cleanup.rb22
-rw-r--r--db/post_migrate/20221006083240_prepare_partial_trigram_indexes_for_issues_attempt_2.rb25
-rw-r--r--db/post_migrate/20221006172302_adjust_task_note_rename_background_migration_values.rb72
-rw-r--r--db/post_migrate/20221010074914_migrate_security_findings_delete_queues.rb16
-rw-r--r--db/post_migrate/20221010121510_prepare_async_index_author_id_target_project_id_on_merge_requests.rb15
-rw-r--r--db/post_migrate/20221010122138_add_async_index_author_id_target_project_id_on_merge_requests.rb15
-rw-r--r--db/post_migrate/20221010122352_add_index_to_namespace_settings_on_default_compliance_framework_id.rb15
-rw-r--r--db/post_migrate/20221010123040_add_compliance_framework_fk_to_namespace_settings.rb16
-rw-r--r--db/post_migrate/20221010141500_add_index_author_id_target_project_id_on_merge_requests.rb15
-rw-r--r--db/post_migrate/20221010162137_add_index_author_id_and_id_on_merge_requests.rb15
-rw-r--r--db/post_migrate/20221011062254_sync_new_amount_used_for_ci_project_monthly_usages.rb19
-rw-r--r--db/post_migrate/20221011113928_redo_remove_and_add_ci_job_variables_raw_with_new_default.rb12
-rw-r--r--db/post_migrate/20221012182701_remove_namespace_settings_cohort_free_user_cap_columns.rb15
-rw-r--r--db/post_migrate/20221013154159_update_invalid_dormant_user_setting.rb17
-rw-r--r--db/post_migrate/20221013215832_cleanup_vulnerability_state_transitions_with_same_from_state_to_state.rb19
-rw-r--r--db/post_migrate/20221017084227_cleanup_rename_ci_pipeline_metadata_title.rb13
-rw-r--r--db/post_migrate/20221018062308_schedule_backfill_project_namespace_details.rb29
-rw-r--r--db/post_migrate/20221018193635_ensure_task_note_renaming_background_migration_finished.rb22
-rw-r--r--db/post_migrate/20221018193827_drop_tmp_index_system_note_metadata_on_id_where_task.rb15
-rw-r--r--db/post_migrate/20221018232820_add_temp_index_for_user_details_fields.rb24
-rw-r--r--db/post_migrate/20221019002459_queue_backfill_user_details_fields.rb16
-rw-r--r--db/post_migrate/20221019102426_remove_tmp_index_approval_merge_request_rules_on_report_type.rb18
-rw-r--r--db/post_migrate/20221019105041_queue_populate_projects_star_count.rb22
-rw-r--r--db/post_migrate/20221019141508_add_index_to_test_reports_issue_id_created_at_and_id.rb16
-rw-r--r--db/post_migrate/20221019194751_disable_fastupdate_on_issues_title_gin_index.rb27
-rw-r--r--db/post_migrate/20221019195754_disable_fastupdate_on_issues_description_gin_index.rb27
-rw-r--r--db/post_migrate/20221019200033_disable_fastupdate_on_merge_requests_title_gin_index.rb27
-rw-r--r--db/post_migrate/20221019200206_disable_fastupdate_on_merge_requests_description_gin_index.rb27
-rw-r--r--db/post_migrate/20221021082720_drop_index_on_ci_runners_token.rb17
-rw-r--r--db/post_migrate/20221021082734_drop_index_on_ci_runners_token_encrypted.rb17
-rw-r--r--db/post_migrate/20221021145820_create_routing_table_for_builds_metadata_v2.rb41
-rw-r--r--db/post_migrate/20221021160735_add_index_for_common_finder_query_desc_with_namespace_id.rb18
-rw-r--r--db/post_migrate/20221024034228_remove_sprints_project_id_column.rb38
-rw-r--r--db/post_migrate/20221024121500_drop_fingerprint_from_sbom_sources.rb9
-rw-r--r--db/post_migrate/20221025115006_check_vulnerabilities_state_transition_from_state_not_equal_to_state.rb19
-rw-r--r--db/post_migrate/20221025220607_add_index_id_on_scan_finding_approval_merge_request_rules.rb17
-rw-r--r--db/post_migrate/20221027203556_delete_experiment_user_foreign_keys.rb20
-rw-r--r--db/post_migrate/20221027203951_drop_experiment_users_table.rb21
-rw-r--r--db/post_migrate/20221028000041_remove_invalid_partial_trigram_indexes_for_issues.rb15
-rw-r--r--db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb25
-rw-r--r--db/post_migrate/20221028022627_add_index_on_password_last_changed_at_to_user_details.rb15
-rw-r--r--db/post_migrate/20221102090940_create_next_ci_partitions_record.rb29
-rw-r--r--db/post_migrate/20221102090943_create_second_partition_for_builds_metadata.rb62
-rw-r--r--db/post_migrate/20221103073328_change_member_namespace_id_not_null.rb13
-rw-r--r--db/post_migrate/20221103084213_remove_tmp_index_members_on_id_where_namespace_id_null.rb15
-rw-r--r--db/post_migrate/20221103150250_migrate_sidekiq_queued_jobs.rb11
-rw-r--r--db/post_migrate/20221104042137_add_partial_trigram_index_for_issue_title_attempt_2.rb19
-rw-r--r--db/post_migrate/20221104042159_add_partial_trigram_index_for_issue_description_attempt_2.rb19
-rw-r--r--db/post_migrate/20221104074652_add_temp_index_for_project_statistics_upload_size_migration.rb19
-rw-r--r--db/post_migrate/20221104100203_recreate_async_trigram_index_for_vulnerability_reads_container_images.rb21
-rw-r--r--db/post_migrate/20221104170500_add_vulnerability_reads_all_status_index.rb14
-rw-r--r--db/post_migrate/20221104190203_validate_environment_id_on_deployments.rb11
-rw-r--r--db/post_migrate/20221107094359_recount_epic_cache_counts.rb29
-rw-r--r--db/post_migrate/20221107184758_sync_new_amount_used_for_ci_namespace_monthly_usages.rb19
-rw-r--r--db/post_migrate/20221107220420_validate_not_null_constraint_on_member_namespace_id.rb15
-rw-r--r--db/post_migrate/20221107220526_validate_fk_member_namespace_id.rb13
-rw-r--r--db/post_migrate/20221107222213_remove_old_member_namespace_id_fk.rb28
-rw-r--r--db/post_migrate/20221108045019_truncate_timeline_event_tags_table.rb15
-rw-r--r--db/post_migrate/20221108121322_add_supporting_index_for_vulnerabilities_feedback_migration.rb24
-rw-r--r--db/post_migrate/20221108222015_remove_temp_index_on_project_features_where_releases_access_level_gt_repository.rb18
-rw-r--r--db/post_migrate/20221110045406_sanitize_confidential_note_todos.rb15
-rw-r--r--db/post_migrate/20221111070314_prepare_removal_of_issue_trigram_indexes.rb16
167 files changed, 0 insertions, 3720 deletions
diff --git a/db/post_migrate/20220601110011_schedule_remove_self_managed_wiki_notes.rb b/db/post_migrate/20220601110011_schedule_remove_self_managed_wiki_notes.rb
deleted file mode 100644
index 9e6594bb9b6..00000000000
--- a/db/post_migrate/20220601110011_schedule_remove_self_managed_wiki_notes.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleRemoveSelfManagedWikiNotes < Gitlab::Database::Migration[2.0]
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- MIGRATION = 'RemoveSelfManagedWikiNotes'
- INTERVAL = 2.minutes
-
- disable_ddl_transaction!
-
- def up
- return if skip_migration?
-
- queue_batched_background_migration(
- MIGRATION,
- :notes,
- :id,
- job_interval: INTERVAL,
- batch_size: 10_000,
- sub_batch_size: 1_000
- )
- end
-
- def down
- return if skip_migration?
-
- delete_batched_background_migration(MIGRATION, :notes, :id, [])
- end
-
- private
-
- def skip_migration?
- Gitlab.staging? || Gitlab.com?
- end
-end
diff --git a/db/post_migrate/20220606054503_add_tmp_index_job_artifacts_id_and_expire_at.rb b/db/post_migrate/20220606054503_add_tmp_index_job_artifacts_id_and_expire_at.rb
deleted file mode 100644
index 28346eb1a97..00000000000
--- a/db/post_migrate/20220606054503_add_tmp_index_job_artifacts_id_and_expire_at.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class AddTmpIndexJobArtifactsIdAndExpireAt < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'tmp_index_ci_job_artifacts_on_id_expire_at_file_type_trace'
-
- EXPIRE_AT_ON_22_MIDNIGHT_IN_TIMEZONE_OR_TRACE = <<~SQL
- (EXTRACT(day FROM timezone('UTC', expire_at)) IN (21, 22, 23)
- AND EXTRACT(minute FROM timezone('UTC', expire_at)) IN (0, 30, 45)
- AND EXTRACT(second FROM timezone('UTC', expire_at)) = 0)
- OR file_type = 3
- SQL
-
- def up
- return if Gitlab.com?
- return if index_exists_by_name?(:ci_job_artifacts, INDEX_NAME)
-
- add_concurrent_index :ci_job_artifacts, :id,
- where: EXPIRE_AT_ON_22_MIDNIGHT_IN_TIMEZONE_OR_TRACE, name: INDEX_NAME
- end
-
- def down
- return if Gitlab.com?
- return unless index_exists_by_name?(:ci_job_artifacts, INDEX_NAME)
-
- remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220606080509_fix_incorrect_job_artifacts_expire_at.rb b/db/post_migrate/20220606080509_fix_incorrect_job_artifacts_expire_at.rb
deleted file mode 100644
index 8fea22f5579..00000000000
--- a/db/post_migrate/20220606080509_fix_incorrect_job_artifacts_expire_at.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-class FixIncorrectJobArtifactsExpireAt < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_ci
-
- MIGRATION = 'RemoveBackfilledJobArtifactsExpireAt'
- BATCH_CLASS = 'RemoveBackfilledJobArtifactsExpireAtBatchingStrategy'
- BATCH_SIZE = 500
- INTERVAL = 2.minutes.freeze
-
- def up
- return if Gitlab.com?
-
- queue_batched_background_migration(
- MIGRATION,
- :ci_job_artifacts,
- :id,
- job_interval: INTERVAL,
- batch_class_name: BATCH_CLASS,
- batch_size: BATCH_SIZE
- )
- end
-
- def down
- return if Gitlab.com?
-
- delete_batched_background_migration(MIGRATION, :ci_job_artifacts, :id, [])
- end
-end
diff --git a/db/post_migrate/20220615154500_schedule_backfill_cluster_agents_has_vulnerabilities.rb b/db/post_migrate/20220615154500_schedule_backfill_cluster_agents_has_vulnerabilities.rb
deleted file mode 100644
index 74aeb2947a9..00000000000
--- a/db/post_migrate/20220615154500_schedule_backfill_cluster_agents_has_vulnerabilities.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleBackfillClusterAgentsHasVulnerabilities < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- MIGRATION = 'BackfillClusterAgentsHasVulnerabilities'
- DELAY_INTERVAL = 2.minutes
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- ensure_batched_background_migration_is_finished(
- job_class_name: 'BackfillVulnerabilityReadsClusterAgent',
- table_name: :vulnerability_reads,
- column_name: :id,
- job_arguments: []
- )
-
- queue_batched_background_migration(
- MIGRATION,
- :cluster_agents,
- :id,
- job_interval: DELAY_INTERVAL
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :cluster_agents, :id, [])
- end
-end
diff --git a/db/post_migrate/20220616171355_update_vulnerabilities_project_id_id_active_cis_index.rb b/db/post_migrate/20220616171355_update_vulnerabilities_project_id_id_active_cis_index.rb
deleted file mode 100644
index 047ae0d1132..00000000000
--- a/db/post_migrate/20220616171355_update_vulnerabilities_project_id_id_active_cis_index.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class UpdateVulnerabilitiesProjectIdIdActiveCisIndex < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- NEW_INDEX_NAME = 'idx_vulnerabilities_on_project_id_and_id_active_cis_dft_branch'
- OLD_INDEX_NAME = 'index_vulnerabilities_on_project_id_and_id_active_cis'
- OLD_INDEX_FILTER_CONDITION = 'report_type = 7 AND state = ANY(ARRAY[1, 4])'
- NEW_INDEX_FILTER_CONDITION = 'report_type = 7 AND state = ANY(ARRAY[1, 4]) AND present_on_default_branch IS TRUE'
-
- def up
- add_concurrent_index :vulnerabilities, [:project_id, :id],
- where: NEW_INDEX_FILTER_CONDITION,
- name: NEW_INDEX_NAME
-
- remove_concurrent_index_by_name(:vulnerabilities, OLD_INDEX_NAME)
- end
-
- def down
- add_concurrent_index :vulnerabilities, [:project_id, :id], where: OLD_INDEX_FILTER_CONDITION, name: OLD_INDEX_NAME
-
- remove_concurrent_index_by_name(:vulnerabilities, NEW_INDEX_NAME)
- end
-end
diff --git a/db/post_migrate/20220706145113_backfill_namespace_id_on_issues.rb b/db/post_migrate/20220706145113_backfill_namespace_id_on_issues.rb
deleted file mode 100644
index 8114967ac8e..00000000000
--- a/db/post_migrate/20220706145113_backfill_namespace_id_on_issues.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-class BackfillNamespaceIdOnIssues < Gitlab::Database::Migration[2.0]
- restrict_gitlab_migration gitlab_schema: :gitlab_main
- disable_ddl_transaction!
-
- MIGRATION = 'BackfillProjectNamespaceOnIssues'
- DELAY_INTERVAL = 2.minutes
- BATCH_SIZE = 500
- MAX_BATCH_SIZE = 10_000
- SUB_BATCH_SIZE = 10
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- :issues,
- :id,
- job_interval: DELAY_INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :issues, :id, [])
- end
-end
diff --git a/db/post_migrate/20220707192420_remove_tmp_idx_merge_requests_draft_and_status.rb b/db/post_migrate/20220707192420_remove_tmp_idx_merge_requests_draft_and_status.rb
deleted file mode 100644
index a8cfea02463..00000000000
--- a/db/post_migrate/20220707192420_remove_tmp_idx_merge_requests_draft_and_status.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveTmpIdxMergeRequestsDraftAndStatus < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = "tmp_index_merge_requests_draft_and_status"
- CORRECTED_REGEXP_STR = "^(\\[draft\\]|\\(draft\\)|draft:|draft|\\[WIP\\]|WIP:|WIP)"
-
- def up
- remove_concurrent_index_by_name :merge_requests, INDEX_NAME
- end
-
- def down
- add_concurrent_index :merge_requests, :id,
- where: "draft = false AND state_id = 1 AND ((title)::text ~* '#{CORRECTED_REGEXP_STR}'::text)",
- name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220726225114_remove_tmp_index_group_membership_namespace_id_column.rb b/db/post_migrate/20220726225114_remove_tmp_index_group_membership_namespace_id_column.rb
deleted file mode 100644
index db47be6a1e3..00000000000
--- a/db/post_migrate/20220726225114_remove_tmp_index_group_membership_namespace_id_column.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveTmpIndexGroupMembershipNamespaceIdColumn < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'tmp_index_for_namespace_id_migration_on_group_members'
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :members, INDEX_NAME
- end
-
- def down
- add_concurrent_index :members, :id,
- where: "members.member_namespace_id IS NULL and members.type = 'GroupMember'",
- name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220801155858_schedule_disable_legacy_open_source_licence_for_recent_public_projects.rb b/db/post_migrate/20220801155858_schedule_disable_legacy_open_source_licence_for_recent_public_projects.rb
deleted file mode 100644
index a662cfe4be3..00000000000
--- a/db/post_migrate/20220801155858_schedule_disable_legacy_open_source_licence_for_recent_public_projects.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleDisableLegacyOpenSourceLicenceForRecentPublicProjects < Gitlab::Database::Migration[2.0]
- MIGRATION = 'DisableLegacyOpenSourceLicenceForRecentPublicProjects'
- INTERVAL = 2.minutes
- BATCH_SIZE = 1_000
- MAX_BATCH_SIZE = 5_000
- SUB_BATCH_SIZE = 200
-
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- return unless Gitlab.com?
-
- queue_batched_background_migration(
- MIGRATION,
- :projects,
- :id,
- job_interval: INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
-
- def down
- return unless Gitlab.com?
-
- delete_batched_background_migration(MIGRATION, :projects, :id, [])
- end
-end
diff --git a/db/post_migrate/20220809002011_schedule_destroy_invalid_group_members.rb b/db/post_migrate/20220809002011_schedule_destroy_invalid_group_members.rb
deleted file mode 100644
index e5d97d890ab..00000000000
--- a/db/post_migrate/20220809002011_schedule_destroy_invalid_group_members.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleDestroyInvalidGroupMembers < Gitlab::Database::Migration[2.0]
- MIGRATION = 'DestroyInvalidGroupMembers'
- DELAY_INTERVAL = 2.minutes
- BATCH_SIZE = 1_000
- MAX_BATCH_SIZE = 2_000
- SUB_BATCH_SIZE = 50
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- disable_ddl_transaction!
-
- def up
- # no-op
- # We want to no-op this due to potential inconsistencies in SM upgrade path
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20220809214730_add_note_metadata_temp_index_on_id_where_task.rb b/db/post_migrate/20220809214730_add_note_metadata_temp_index_on_id_where_task.rb
deleted file mode 100644
index 1c5a1b68041..00000000000
--- a/db/post_migrate/20220809214730_add_note_metadata_temp_index_on_id_where_task.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddNoteMetadataTempIndexOnIdWhereTask < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'tmp_index_system_note_metadata_on_id_where_task'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :system_note_metadata, [:id, :action], where: "action = 'task'", name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :system_note_metadata, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220809223215_change_task_system_note_wording_to_checklist_item.rb b/db/post_migrate/20220809223215_change_task_system_note_wording_to_checklist_item.rb
deleted file mode 100644
index df7c2d325d2..00000000000
--- a/db/post_migrate/20220809223215_change_task_system_note_wording_to_checklist_item.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeTaskSystemNoteWordingToChecklistItem < Gitlab::Database::Migration[2.0]
- restrict_gitlab_migration gitlab_schema: :gitlab_main
- disable_ddl_transaction!
-
- MIGRATION = 'RenameTaskSystemNoteToChecklistItem'
- DELAY_INTERVAL = 2.minutes
- BATCH_SIZE = 10_000
- MAX_BATCH_SIZE = 20_000
- SUB_BATCH_SIZE = 100
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- :system_note_metadata,
- :id,
- job_interval: DELAY_INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :system_note_metadata, :id, [])
- end
-end
diff --git a/db/post_migrate/20220815061621_rename_web_hooks_service_id_to_integration_id.rb b/db/post_migrate/20220815061621_rename_web_hooks_service_id_to_integration_id.rb
deleted file mode 100644
index 6bcee7f51df..00000000000
--- a/db/post_migrate/20220815061621_rename_web_hooks_service_id_to_integration_id.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class RenameWebHooksServiceIdToIntegrationId < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- rename_column_concurrently :web_hooks, :service_id, :integration_id
- end
-
- def down
- undo_rename_column_concurrently :web_hooks, :service_id, :integration_id
- end
-end
diff --git a/db/post_migrate/20220816075638_drop_uuid_and_id_index_from_security_findings.rb b/db/post_migrate/20220816075638_drop_uuid_and_id_index_from_security_findings.rb
deleted file mode 100644
index 7a41e0b7835..00000000000
--- a/db/post_migrate/20220816075638_drop_uuid_and_id_index_from_security_findings.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class DropUuidAndIdIndexFromSecurityFindings < Gitlab::Database::Migration[2.0]
- INDEX_NAME = :index_on_security_findings_uuid_and_id_order_desc
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :security_findings, name: INDEX_NAME
- end
-
- def down
- add_concurrent_index :security_findings, [:uuid, :id], order: { id: :desc }, name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220816163444_update_start_date_for_iterations_cadences.rb b/db/post_migrate/20220816163444_update_start_date_for_iterations_cadences.rb
deleted file mode 100644
index 631e8941add..00000000000
--- a/db/post_migrate/20220816163444_update_start_date_for_iterations_cadences.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-# frozen_string_literal: true
-
-class UpdateStartDateForIterationsCadences < Gitlab::Database::Migration[2.0]
- include ::Gitlab::Database::DynamicModelHelpers
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
- disable_ddl_transaction!
-
- def up
- each_batch_range('iterations_cadences', connection: connection) do |min, max|
- execute(<<~SQL)
- UPDATE iterations_cadences
- SET start_date=ic.first_upcoming_iteration_start_date
- FROM (
- SELECT ic.id, sprints2.first_upcoming_iteration_start_date
- FROM iterations_cadences as ic,
- LATERAL (
- -- For each cadence, query for the due date of its current iteration
- SELECT due_date as current_iteration_due_date FROM sprints
- WHERE iterations_cadence_id=ic.id AND start_date <= current_date AND due_date >= current_date
- LIMIT 1
- ) as sprints1,
- LATERAL (
- -- For each cadence, query for the start date of the first upcoming iteration (i.e, it starts after the current iteration)
- SELECT start_date as first_upcoming_iteration_start_date FROM sprints
- WHERE iterations_cadence_id=ic.id AND start_date > sprints1.current_iteration_due_date
- ORDER BY start_date ASC LIMIT 1
- ) as sprints2
- WHERE ic.automatic=true AND ic.id BETWEEN #{min} AND #{max}
- ) as ic
- WHERE iterations_cadences.id=ic.id;
- SQL
- end
- end
-
- def down
- each_batch_range('iterations_cadences', connection: connection) do |min, max|
- execute(<<~SQL)
- UPDATE iterations_cadences
- SET start_date=ic.first_iteration_start_date
- FROM (
- SELECT ic.id, sprints.start_date as first_iteration_start_date
- FROM iterations_cadences as ic,
- LATERAL (
- SELECT start_date FROM sprints WHERE iterations_cadence_id=ic.id ORDER BY start_date ASC LIMIT 1
- ) as sprints
- WHERE ic.automatic=true AND ic.id BETWEEN #{min} AND #{max}
- ) as ic
- WHERE iterations_cadences.id=ic.id;
- SQL
- end
- end
-end
diff --git a/db/post_migrate/20220820221036_update_tmp_non_migrated_index_on_container_repositories.rb b/db/post_migrate/20220820221036_update_tmp_non_migrated_index_on_container_repositories.rb
deleted file mode 100644
index eea58ad7951..00000000000
--- a/db/post_migrate/20220820221036_update_tmp_non_migrated_index_on_container_repositories.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class UpdateTmpNonMigratedIndexOnContainerRepositories < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- NEW_INDEX_NAME = 'tmp_index_container_repos_on_non_migrated'
- OLD_INDEX_NAME = 'tmp_idx_container_repos_on_non_migrated'
- MIGRATION_PHASE_1_ENDED_AT = '2022-01-23'
-
- def up
- add_concurrent_index :container_repositories,
- [:project_id, :id],
- name: NEW_INDEX_NAME,
- where: "migration_state != 'import_done'"
- remove_concurrent_index_by_name :container_repositories, OLD_INDEX_NAME
- end
-
- def down
- add_concurrent_index :container_repositories,
- [:project_id, :id],
- name: OLD_INDEX_NAME,
- where: "migration_state != 'import_done' AND created_at < '#{MIGRATION_PHASE_1_ENDED_AT}'"
- remove_concurrent_index_by_name :container_repositories, NEW_INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220822071909_remove_other_role_from_user_details.rb b/db/post_migrate/20220822071909_remove_other_role_from_user_details.rb
deleted file mode 100644
index a0177bf2605..00000000000
--- a/db/post_migrate/20220822071909_remove_other_role_from_user_details.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveOtherRoleFromUserDetails < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- def change
- remove_column :user_details, :other_role, :text
- end
-end
diff --git a/db/post_migrate/20220822090656_drop_build_coverage_regex_from_project.rb b/db/post_migrate/20220822090656_drop_build_coverage_regex_from_project.rb
deleted file mode 100644
index 70c6b660318..00000000000
--- a/db/post_migrate/20220822090656_drop_build_coverage_regex_from_project.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class DropBuildCoverageRegexFromProject < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- def up
- remove_column :projects, :build_coverage_regex
- end
-
- def down
- add_column :projects, :build_coverage_regex, :string # rubocop: disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/post_migrate/20220822094804_add_issues_authorization_index.rb b/db/post_migrate/20220822094804_add_issues_authorization_index.rb
deleted file mode 100644
index e09b5f8d93b..00000000000
--- a/db/post_migrate/20220822094804_add_issues_authorization_index.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddIssuesAuthorizationIndex < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'idx_open_issues_on_project_and_confidential_and_author_and_id'
-
- def up
- prepare_async_index :issues, [:project_id, :confidential, :author_id, :id], name: INDEX_NAME, where: 'state_id = 1'
- end
-
- def down
- unprepare_async_index :issues, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220823084747_prepare_removal_partial_trigram_indexes_for_issues.rb b/db/post_migrate/20220823084747_prepare_removal_partial_trigram_indexes_for_issues.rb
deleted file mode 100644
index a8ea6abdcba..00000000000
--- a/db/post_migrate/20220823084747_prepare_removal_partial_trigram_indexes_for_issues.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class PrepareRemovalPartialTrigramIndexesForIssues < Gitlab::Database::Migration[2.0]
- TITLE_INDEX_NAME = 'index_issues_on_title_trigram_non_latin'
- DESCRIPTION_INDEX_NAME = 'index_issues_on_description_trigram_non_latin'
-
- def up
- prepare_async_index_removal :issues, :title, name: TITLE_INDEX_NAME
- prepare_async_index_removal :issues, :description, name: DESCRIPTION_INDEX_NAME
- end
-
- def down
- unprepare_async_index_by_name :issues, DESCRIPTION_INDEX_NAME
- unprepare_async_index_by_name :issues, TITLE_INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220824114218_add_tmp_index_approval_merge_request_rules.rb b/db/post_migrate/20220824114218_add_tmp_index_approval_merge_request_rules.rb
deleted file mode 100644
index 64171b3053e..00000000000
--- a/db/post_migrate/20220824114218_add_tmp_index_approval_merge_request_rules.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddTmpIndexApprovalMergeRequestRules < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- TMP_INDEX_NAME = 'tmp_index_approval_merge_request_rules_on_report_type_equal_one'
-
- def up
- # to be removed as part of https://gitlab.com/gitlab-org/gitlab/-/issues/372224
- add_concurrent_index :approval_merge_request_rules,
- [:id, :report_type],
- name: TMP_INDEX_NAME,
- where: "report_type = 1"
- end
-
- def down
- remove_concurrent_index_by_name :approval_merge_request_rules, TMP_INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220825061250_drop_tmp_index_todos_attention_request_action_idx.rb b/db/post_migrate/20220825061250_drop_tmp_index_todos_attention_request_action_idx.rb
deleted file mode 100644
index 091de49e1c9..00000000000
--- a/db/post_migrate/20220825061250_drop_tmp_index_todos_attention_request_action_idx.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class DropTmpIndexTodosAttentionRequestActionIdx < Gitlab::Database::Migration[2.0]
- INDEX_NAME = "tmp_index_todos_attention_request_action"
- ATTENTION_REQUESTED = 10
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :todos, INDEX_NAME
- end
-
- def down
- add_concurrent_index :todos, [:id],
- where: "action = #{ATTENTION_REQUESTED}",
- name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220825142324_replace_issues_authorization_index.rb b/db/post_migrate/20220825142324_replace_issues_authorization_index.rb
deleted file mode 100644
index b033cb22490..00000000000
--- a/db/post_migrate/20220825142324_replace_issues_authorization_index.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class ReplaceIssuesAuthorizationIndex < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'idx_open_issues_on_project_and_confidential_and_author_and_id'
- OLD_INDEX_NAME = 'idx_open_issues_on_project_id_and_confidential'
-
- def up
- add_concurrent_index :issues, [:project_id, :confidential, :author_id, :id], name: INDEX_NAME, where: 'state_id = 1'
- remove_concurrent_index_by_name :issues, OLD_INDEX_NAME
- end
-
- def down
- add_concurrent_index :issues, [:project_id, :confidential], name: OLD_INDEX_NAME, where: 'state_id = 1'
- remove_concurrent_index_by_name :issues, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220826165048_drop_temporary_job_trace_index.rb b/db/post_migrate/20220826165048_drop_temporary_job_trace_index.rb
deleted file mode 100644
index 0cad7cd1968..00000000000
--- a/db/post_migrate/20220826165048_drop_temporary_job_trace_index.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class DropTemporaryJobTraceIndex < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'tmp_index_ci_job_artifacts_on_id_where_trace_and_expire_at'
-
- def up
- prepare_async_index_removal :ci_job_artifacts, :id, name: INDEX_NAME
- end
-
- def down
- unprepare_async_index_by_name :ci_job_artifacts, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220826175058_fully_remove_temporary_job_trace_index.rb b/db/post_migrate/20220826175058_fully_remove_temporary_job_trace_index.rb
deleted file mode 100644
index 2a18e63106a..00000000000
--- a/db/post_migrate/20220826175058_fully_remove_temporary_job_trace_index.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class FullyRemoveTemporaryJobTraceIndex < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'tmp_index_ci_job_artifacts_on_id_where_trace_and_expire_at'
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :ci_job_artifacts, name: INDEX_NAME
- end
-
- def down
- add_concurrent_index :ci_job_artifacts, :id, name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220830051704_add_temporary_index_for_orphaned_invited_members.rb b/db/post_migrate/20220830051704_add_temporary_index_for_orphaned_invited_members.rb
deleted file mode 100644
index 90254ac3d86..00000000000
--- a/db/post_migrate/20220830051704_add_temporary_index_for_orphaned_invited_members.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddTemporaryIndexForOrphanedInvitedMembers < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- TMP_INDEX_NAME = 'tmp_idx_orphaned_invited_members'
-
- def up
- add_concurrent_index('members', :id, where: query_condition, name: TMP_INDEX_NAME)
- end
-
- def down
- remove_concurrent_index_by_name('members', TMP_INDEX_NAME) if index_exists_by_name?('members', TMP_INDEX_NAME)
- end
-
- private
-
- def query_condition
- 'invite_token IS NULL and invite_accepted_at IS NOT NULL AND user_id IS NULL'
- end
-end
diff --git a/db/post_migrate/20220830061704_orphaned_invited_members_cleanup.rb b/db/post_migrate/20220830061704_orphaned_invited_members_cleanup.rb
deleted file mode 100644
index c5249510164..00000000000
--- a/db/post_migrate/20220830061704_orphaned_invited_members_cleanup.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class OrphanedInvitedMembersCleanup < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- # rubocop:disable Style/SymbolProc
- membership.where(query_condition).each_batch(of: 100) do |relation|
- relation.delete_all
- end
- # rubocop:enable Style/SymbolProc
- end
-
- def down
- # This migration is irreversible
- end
-
- private
-
- def membership
- @membership ||= define_batchable_model('members')
- end
-
- def query_condition
- 'invite_token IS NULL and invite_accepted_at IS NOT NULL AND user_id IS NULL'
- end
-end
diff --git a/db/post_migrate/20220830071704_remove_temporary_index_for_orphaned_invited_members.rb b/db/post_migrate/20220830071704_remove_temporary_index_for_orphaned_invited_members.rb
deleted file mode 100644
index c6b712da4c0..00000000000
--- a/db/post_migrate/20220830071704_remove_temporary_index_for_orphaned_invited_members.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveTemporaryIndexForOrphanedInvitedMembers < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- TMP_INDEX_NAME = 'tmp_idx_orphaned_invited_members'
-
- def up
- remove_concurrent_index_by_name('members', TMP_INDEX_NAME) if index_exists_by_name?('members', TMP_INDEX_NAME)
- end
-
- def down
- add_concurrent_index('members', :id, where: query_condition, name: TMP_INDEX_NAME)
- end
-
- private
-
- def query_condition
- 'invite_token IS NULL and invite_accepted_at IS NOT NULL AND user_id IS NULL'
- end
-end
diff --git a/db/post_migrate/20220830172142_reschedule_issue_work_item_type_id_backfill.rb b/db/post_migrate/20220830172142_reschedule_issue_work_item_type_id_backfill.rb
deleted file mode 100644
index 5495f0e53b4..00000000000
--- a/db/post_migrate/20220830172142_reschedule_issue_work_item_type_id_backfill.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# frozen_string_literal: true
-
-class RescheduleIssueWorkItemTypeIdBackfill < Gitlab::Database::Migration[2.0]
- MIGRATION = 'BackfillWorkItemTypeIdForIssues'
- BATCH_SIZE = 10_000
- MAX_BATCH_SIZE = 30_000
- SUB_BATCH_SIZE = 100
- INTERVAL = 1.minute
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- class MigrationWorkItemType < MigrationRecord
- self.table_name = 'work_item_types'
-
- def self.id_by_type
- where(namespace_id: nil).order(:base_type).pluck(:base_type, :id).to_h
- end
- end
-
- def up
- # We expect no more than 5 types. Only 3 of them are expected to have associated issues at the moment
- MigrationWorkItemType.id_by_type.each do |base_type, type_id|
- queue_batched_background_migration(
- MIGRATION,
- :issues,
- :id,
- base_type,
- type_id,
- job_interval: INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
- end
-
- def down
- Gitlab::Database::BackgroundMigration::BatchedMigration.where(job_class_name: MIGRATION).delete_all
- end
-end
diff --git a/db/post_migrate/20220831021358_add_index_on_issue_health_status.rb b/db/post_migrate/20220831021358_add_index_on_issue_health_status.rb
deleted file mode 100644
index 940bf6b5c38..00000000000
--- a/db/post_migrate/20220831021358_add_index_on_issue_health_status.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnIssueHealthStatus < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- TABLE_NAME = :issues
- INDEX_NAME = 'index_issues_on_project_id_health_status_created_at_id'
-
- def up
- add_concurrent_index TABLE_NAME, [:project_id, :health_status, :created_at, :id], name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index TABLE_NAME, [:project_id, :health_status, :created_at, :id], name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220831090454_cleanup_web_hooks_service_id.rb b/db/post_migrate/20220831090454_cleanup_web_hooks_service_id.rb
deleted file mode 100644
index 7beb89038e5..00000000000
--- a/db/post_migrate/20220831090454_cleanup_web_hooks_service_id.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class CleanupWebHooksServiceId < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- cleanup_concurrent_column_rename :web_hooks, :service_id, :integration_id
- end
-
- def down
- undo_cleanup_concurrent_column_rename :web_hooks, :service_id, :integration_id
- end
-end
diff --git a/db/post_migrate/20220831132802_delete_approval_rules_for_vulnerability.rb b/db/post_migrate/20220831132802_delete_approval_rules_for_vulnerability.rb
deleted file mode 100644
index b29678f1826..00000000000
--- a/db/post_migrate/20220831132802_delete_approval_rules_for_vulnerability.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-# frozen_string_literal: true
-
-class DeleteApprovalRulesForVulnerability < Gitlab::Database::Migration[2.0]
- restrict_gitlab_migration gitlab_schema: :gitlab_main
- disable_ddl_transaction!
-
- BATCH_SIZE = 500
- MAX_BATCH_SIZE = 1_000
- SUB_BATCH_SIZE = 10
- MIGRATION = 'DeleteApprovalRulesWithVulnerability'
- INTERVAL = 2.minutes
-
- def up
- return unless Gitlab.ee?
-
- queue_batched_background_migration(
- MIGRATION,
- :approval_project_rules,
- :id,
- job_interval: INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
-
- queue_batched_background_migration(
- MIGRATION,
- :approval_merge_request_rules,
- :id,
- job_interval: INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
-
- def down
- # the data deleted is related to a feature removed in 15.0: https://gitlab.com/gitlab-org/gitlab/-/issues/357300
- delete_batched_background_migration(MIGRATION, :approval_project_rules, :id, [])
- delete_batched_background_migration(MIGRATION, :approval_merge_request_rules, :id, [])
- end
-end
diff --git a/db/post_migrate/20220901035725_schedule_destroy_invalid_project_members.rb b/db/post_migrate/20220901035725_schedule_destroy_invalid_project_members.rb
deleted file mode 100644
index 9de3ac34669..00000000000
--- a/db/post_migrate/20220901035725_schedule_destroy_invalid_project_members.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleDestroyInvalidProjectMembers < Gitlab::Database::Migration[2.0]
- MIGRATION = 'DestroyInvalidProjectMembers'
- DELAY_INTERVAL = 2.minutes
- BATCH_SIZE = 50_000
- MAX_BATCH_SIZE = 100_000
- SUB_BATCH_SIZE = 200
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- # no-op
- # We want to no-op this due to potential inconsistencies in SM upgrade path
- end
-
- def down
- # no-op
- end
-end
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
deleted file mode 100644
index 10b339b90c1..00000000000
--- a/db/post_migrate/20220901071310_add_tmp_index_user_callouts_on_attention_request_feature_names.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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
deleted file mode 100644
index cbd0d120bb8..00000000000
--- a/db/post_migrate/20220901071355_cleanup_attention_request_user_callouts.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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/post_migrate/20220901073300_remove_partial_trigram_indexes_for_issues.rb b/db/post_migrate/20220901073300_remove_partial_trigram_indexes_for_issues.rb
deleted file mode 100644
index 096b74bc1c6..00000000000
--- a/db/post_migrate/20220901073300_remove_partial_trigram_indexes_for_issues.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class RemovePartialTrigramIndexesForIssues < Gitlab::Database::Migration[2.0]
- TITLE_INDEX_NAME = 'index_issues_on_title_trigram_non_latin'
- DESCRIPTION_INDEX_NAME = 'index_issues_on_description_trigram_non_latin'
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :issues, TITLE_INDEX_NAME
- remove_concurrent_index_by_name :issues, DESCRIPTION_INDEX_NAME
- end
-
- def down
- add_concurrent_index :issues, :title,
- name: TITLE_INDEX_NAME,
- using: :gin, opclass: { description: :gin_trgm_ops },
- where: "title NOT SIMILAR TO '[\\u0000-\\u218F]*' OR description NOT SIMILAR TO '[\\u0000-\\u218F]*'"
-
- add_concurrent_index :issues, :description,
- name: DESCRIPTION_INDEX_NAME,
- using: :gin, opclass: { description: :gin_trgm_ops },
- where: "title NOT SIMILAR TO '[\\u0000-\\u218F]*' OR description NOT SIMILAR TO '[\\u0000-\\u218F]*'"
- end
-end
diff --git a/db/post_migrate/20220901184106_add_not_null_to_board_group_recent_visits.rb b/db/post_migrate/20220901184106_add_not_null_to_board_group_recent_visits.rb
deleted file mode 100644
index 1dead32efb6..00000000000
--- a/db/post_migrate/20220901184106_add_not_null_to_board_group_recent_visits.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddNotNullToBoardGroupRecentVisits < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- add_not_null_constraint :board_group_recent_visits, :user_id, validate: false
- add_not_null_constraint :board_group_recent_visits, :group_id, validate: false
- add_not_null_constraint :board_group_recent_visits, :board_id, validate: false
- end
-
- def down
- remove_not_null_constraint :board_group_recent_visits, :user_id
- remove_not_null_constraint :board_group_recent_visits, :board_id
- remove_not_null_constraint :board_group_recent_visits, :group_id
- end
-end
diff --git a/db/post_migrate/20220901184246_add_not_null_to_board_project_recent_visits.rb b/db/post_migrate/20220901184246_add_not_null_to_board_project_recent_visits.rb
deleted file mode 100644
index 4f0cb4d3d68..00000000000
--- a/db/post_migrate/20220901184246_add_not_null_to_board_project_recent_visits.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddNotNullToBoardProjectRecentVisits < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- add_not_null_constraint :board_project_recent_visits, :user_id, validate: false
- add_not_null_constraint :board_project_recent_visits, :project_id, validate: false
- add_not_null_constraint :board_project_recent_visits, :board_id, validate: false
- end
-
- def down
- remove_not_null_constraint :board_project_recent_visits, :user_id
- remove_not_null_constraint :board_project_recent_visits, :project_id
- remove_not_null_constraint :board_project_recent_visits, :board_id
- end
-end
diff --git a/db/post_migrate/20220902111016_delete_null_records_from_board_group_recent_visits.rb b/db/post_migrate/20220902111016_delete_null_records_from_board_group_recent_visits.rb
deleted file mode 100644
index 4b55ecc013d..00000000000
--- a/db/post_migrate/20220902111016_delete_null_records_from_board_group_recent_visits.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class DeleteNullRecordsFromBoardGroupRecentVisits < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- execute('DELETE FROM board_group_recent_visits WHERE user_id is null OR group_id is null OR board_id is null')
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20220902111038_delete_null_records_from_board_project_recent_visits.rb b/db/post_migrate/20220902111038_delete_null_records_from_board_project_recent_visits.rb
deleted file mode 100644
index bb261f80f73..00000000000
--- a/db/post_migrate/20220902111038_delete_null_records_from_board_project_recent_visits.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class DeleteNullRecordsFromBoardProjectRecentVisits < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- execute('DELETE FROM board_project_recent_visits WHERE user_id is null OR project_id is null OR board_id is null')
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20220902204048_move_security_findings_table_to_gitlab_partitions_dynamic_schema.rb b/db/post_migrate/20220902204048_move_security_findings_table_to_gitlab_partitions_dynamic_schema.rb
deleted file mode 100644
index 62511e0e616..00000000000
--- a/db/post_migrate/20220902204048_move_security_findings_table_to_gitlab_partitions_dynamic_schema.rb
+++ /dev/null
@@ -1,230 +0,0 @@
-# frozen_string_literal: true
-
-# rubocop:disable Migration/WithLockRetriesDisallowedMethod
-class MoveSecurityFindingsTableToGitlabPartitionsDynamicSchema < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_MAPPING_OF_PARTITION = {
- index_security_findings_on_unique_columns: :security_findings_1_uuid_scan_id_partition_number_idx,
- index_security_findings_on_confidence: :security_findings_1_confidence_idx,
- index_security_findings_on_project_fingerprint: :security_findings_1_project_fingerprint_idx,
- index_security_findings_on_scan_id_and_deduplicated: :security_findings_1_scan_id_deduplicated_idx,
- index_security_findings_on_scan_id_and_id: :security_findings_1_scan_id_id_idx,
- index_security_findings_on_scanner_id: :security_findings_1_scanner_id_idx,
- index_security_findings_on_severity: :security_findings_1_severity_idx
- }.freeze
-
- INDEX_MAPPING_AFTER_CREATING_FROM_PARTITION = {
- partition_name_placeholder_pkey: :security_findings_pkey,
- partition_name_placeholder_uuid_scan_id_partition_number_idx: :index_security_findings_on_unique_columns,
- partition_name_placeholder_confidence_idx: :index_security_findings_on_confidence,
- partition_name_placeholder_project_fingerprint_idx: :index_security_findings_on_project_fingerprint,
- partition_name_placeholder_scan_id_deduplicated_idx: :index_security_findings_on_scan_id_and_deduplicated,
- partition_name_placeholder_scan_id_id_idx: :index_security_findings_on_scan_id_and_id,
- partition_name_placeholder_scanner_id_idx: :index_security_findings_on_scanner_id,
- partition_name_placeholder_severity_idx: :index_security_findings_on_severity
- }.freeze
-
- INDEX_MAPPING_AFTER_CREATING_FROM_ITSELF = {
- security_findings_pkey1: :security_findings_pkey,
- security_findings_uuid_scan_id_partition_number_idx1: :index_security_findings_on_unique_columns,
- security_findings_confidence_idx1: :index_security_findings_on_confidence,
- security_findings_project_fingerprint_idx1: :index_security_findings_on_project_fingerprint,
- security_findings_scan_id_deduplicated_idx1: :index_security_findings_on_scan_id_and_deduplicated,
- security_findings_scan_id_id_idx1: :index_security_findings_on_scan_id_and_id,
- security_findings_scanner_id_idx1: :index_security_findings_on_scanner_id,
- security_findings_severity_idx1: :index_security_findings_on_severity
- }.freeze
-
- LATEST_PARTITION_SQL = <<~SQL
- SELECT
- partitions.relname AS partition_name
- FROM pg_inherits
- JOIN pg_class parent ON pg_inherits.inhparent = parent.oid
- JOIN pg_class partitions ON pg_inherits.inhrelid = partitions.oid
- WHERE
- parent.relname = 'security_findings'
- ORDER BY (regexp_matches(partitions.relname, 'security_findings_(\\d+)'))[1]::int DESC
- LIMIT 1
- SQL
-
- CURRENT_CHECK_CONSTRAINT_SQL = <<~SQL
- SELECT
- pg_get_constraintdef(pg_catalog.pg_constraint.oid)
- FROM
- pg_catalog.pg_constraint
- INNER JOIN pg_class ON pg_class.oid = pg_catalog.pg_constraint.conrelid
- WHERE
- conname = 'check_partition_number' AND
- pg_class.relname = 'security_findings'
- SQL
-
- def up
- with_lock_retries do
- lock_tables
-
- execute(<<~SQL)
- ALTER TABLE security_findings RENAME TO security_findings_#{candidate_partition_number};
- SQL
-
- execute(<<~SQL)
- ALTER INDEX security_findings_pkey RENAME TO security_findings_#{candidate_partition_number}_pkey;
- SQL
-
- execute(<<~SQL)
- CREATE TABLE security_findings (
- LIKE security_findings_#{candidate_partition_number} INCLUDING ALL
- ) PARTITION BY LIST (partition_number);
- SQL
-
- execute(<<~SQL)
- ALTER SEQUENCE security_findings_id_seq OWNED BY #{connection.current_schema}.security_findings.id;
- SQL
-
- execute(<<~SQL)
- ALTER TABLE security_findings
- ADD CONSTRAINT fk_rails_729b763a54 FOREIGN KEY (scanner_id) REFERENCES vulnerability_scanners(id) ON DELETE CASCADE;
- SQL
-
- execute(<<~SQL)
- ALTER TABLE security_findings
- ADD CONSTRAINT fk_rails_bb63863cf1 FOREIGN KEY (scan_id) REFERENCES security_scans(id) ON DELETE CASCADE;
- SQL
-
- execute(<<~SQL)
- ALTER TABLE security_findings_#{candidate_partition_number} SET SCHEMA gitlab_partitions_dynamic;
- SQL
-
- execute(<<~SQL)
- ALTER TABLE security_findings ATTACH PARTITION gitlab_partitions_dynamic.security_findings_#{candidate_partition_number} FOR VALUES IN (#{candidate_partition_number});
- SQL
-
- execute(<<~SQL)
- ALTER TABLE security_findings DROP CONSTRAINT check_partition_number;
- SQL
-
- index_mapping = INDEX_MAPPING_OF_PARTITION.transform_values do |value|
- value.to_s.sub('partition_name_placeholder', "security_findings_#{candidate_partition_number}")
- end
-
- rename_indices('gitlab_partitions_dynamic', index_mapping)
- end
- end
-
- def down
- # If there is already a partition for the `security_findings` table,
- # we can promote that table to be the original one to save the data.
- # Otherwise, we have to bring back the non-partitioned `security_findings`
- # table from the partitioned one.
- if latest_partition
- create_non_partitioned_security_findings_with_data
- else
- create_non_partitioned_security_findings_without_data
- end
- end
-
- private
-
- def lock_tables
- execute(<<~SQL)
- LOCK TABLE vulnerability_scanners, security_scans, security_findings IN ACCESS EXCLUSIVE MODE
- SQL
- end
-
- def current_check_constraint
- execute(CURRENT_CHECK_CONSTRAINT_SQL).first['pg_get_constraintdef']
- end
-
- def candidate_partition_number
- @candidate_partition_number ||= current_check_constraint.match(/partition_number\s?=\s?(\d+)/).captures.first
- end
-
- def latest_partition
- @latest_partition ||= execute(LATEST_PARTITION_SQL).first&.fetch('partition_name', nil)
- end
-
- def latest_partition_number
- latest_partition.match(/security_findings_(\d+)/).captures.first
- end
-
- def create_non_partitioned_security_findings_with_data
- with_lock_retries do
- lock_tables
-
- execute(<<~SQL)
- ALTER TABLE security_findings DETACH PARTITION gitlab_partitions_dynamic.#{latest_partition};
- SQL
-
- execute(<<~SQL)
- ALTER TABLE gitlab_partitions_dynamic.#{latest_partition} SET SCHEMA #{connection.current_schema};
- SQL
-
- execute(<<~SQL)
- ALTER SEQUENCE security_findings_id_seq OWNED BY #{latest_partition}.id;
- SQL
-
- execute(<<~SQL)
- DROP TABLE security_findings;
- SQL
-
- execute(<<~SQL)
- ALTER TABLE #{latest_partition} RENAME TO security_findings;
- SQL
-
- index_mapping = INDEX_MAPPING_AFTER_CREATING_FROM_PARTITION.transform_keys do |key|
- key.to_s.sub('partition_name_placeholder', latest_partition)
- end
-
- rename_indices(connection.current_schema, index_mapping)
- end
-
- add_check_constraint(:security_findings, "(partition_number = #{latest_partition_number})", :check_partition_number)
- end
-
- def create_non_partitioned_security_findings_without_data
- with_lock_retries do
- lock_tables
-
- execute(<<~SQL)
- ALTER TABLE security_findings RENAME TO security_findings_1;
- SQL
-
- execute(<<~SQL)
- CREATE TABLE security_findings (
- LIKE security_findings_1 INCLUDING ALL
- );
- SQL
-
- execute(<<~SQL)
- ALTER SEQUENCE security_findings_id_seq OWNED BY #{connection.current_schema}.security_findings.id;
- SQL
-
- execute(<<~SQL)
- DROP TABLE security_findings_1;
- SQL
-
- execute(<<~SQL)
- ALTER TABLE ONLY security_findings
- ADD CONSTRAINT fk_rails_729b763a54 FOREIGN KEY (scanner_id) REFERENCES vulnerability_scanners(id) ON DELETE CASCADE;
- SQL
-
- execute(<<~SQL)
- ALTER TABLE ONLY security_findings
- ADD CONSTRAINT fk_rails_bb63863cf1 FOREIGN KEY (scan_id) REFERENCES security_scans(id) ON DELETE CASCADE;
- SQL
-
- rename_indices(connection.current_schema, INDEX_MAPPING_AFTER_CREATING_FROM_ITSELF)
- end
-
- add_check_constraint(:security_findings, "(partition_number = 1)", :check_partition_number)
- end
-
- def rename_indices(schema, mapping)
- mapping.each do |index_name, new_index_name|
- execute(<<~SQL)
- ALTER INDEX #{schema}.#{index_name} RENAME TO #{new_index_name};
- SQL
- end
- end
-end
-# rubocop:enable Migration/WithLockRetriesDisallowedMethod
diff --git a/db/post_migrate/20220904173342_validate_not_null_constraint_board_group_recent_visits.rb b/db/post_migrate/20220904173342_validate_not_null_constraint_board_group_recent_visits.rb
deleted file mode 100644
index 0e5a504d0eb..00000000000
--- a/db/post_migrate/20220904173342_validate_not_null_constraint_board_group_recent_visits.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class ValidateNotNullConstraintBoardGroupRecentVisits < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- validate_not_null_constraint :board_group_recent_visits, :user_id
- validate_not_null_constraint :board_group_recent_visits, :group_id
- validate_not_null_constraint :board_group_recent_visits, :board_id
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20220904173430_validate_not_null_constraint_board_project_recent_visits.rb b/db/post_migrate/20220904173430_validate_not_null_constraint_board_project_recent_visits.rb
deleted file mode 100644
index ff73a179f69..00000000000
--- a/db/post_migrate/20220904173430_validate_not_null_constraint_board_project_recent_visits.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class ValidateNotNullConstraintBoardProjectRecentVisits < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- validate_not_null_constraint :board_project_recent_visits, :user_id
- validate_not_null_constraint :board_project_recent_visits, :project_id
- validate_not_null_constraint :board_project_recent_visits, :board_id
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20220905090300_add_tmp_index_merge_request_reviewers_attention_request_state.rb b/db/post_migrate/20220905090300_add_tmp_index_merge_request_reviewers_attention_request_state.rb
deleted file mode 100644
index e192f76484c..00000000000
--- a/db/post_migrate/20220905090300_add_tmp_index_merge_request_reviewers_attention_request_state.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddTmpIndexMergeRequestReviewersAttentionRequestState < Gitlab::Database::Migration[2.0]
- INDEX_NAME = "tmp_index_merge_request_reviewers_on_attention_requested_state"
- ATTENTION_REQUESTED_STATE = 2
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :merge_request_reviewers, [:id],
- where: "state = #{ATTENTION_REQUESTED_STATE}",
- name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :merge_request_reviewers, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220905090339_reset_attention_requested_merge_requests_reviewers_state_to_unreviewed.rb b/db/post_migrate/20220905090339_reset_attention_requested_merge_requests_reviewers_state_to_unreviewed.rb
deleted file mode 100644
index d335095e674..00000000000
--- a/db/post_migrate/20220905090339_reset_attention_requested_merge_requests_reviewers_state_to_unreviewed.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-class ResetAttentionRequestedMergeRequestsReviewersStateToUnreviewed < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- BATCH_SIZE = 500
-
- class MergeRequestReviewer < MigrationRecord
- self.table_name = 'merge_request_reviewers'
-
- enum state: {
- unreviewed: 0,
- reviewed: 1,
- attention_requested: 2
- }
-
- include ::EachBatch
- end
-
- def up
- MergeRequestReviewer
- .where(state: MergeRequestReviewer.states['attention_requested'])
- .each_batch(of: BATCH_SIZE) { |batch| batch.update_all(state: MergeRequestReviewer.states['unreviewed']) }
- end
-
- def down
- # no op
- end
-end
diff --git a/db/post_migrate/20220905112710_add_async_index_to_todos_to_cover_pending_query.rb b/db/post_migrate/20220905112710_add_async_index_to_todos_to_cover_pending_query.rb
deleted file mode 100644
index e2bca2fae1a..00000000000
--- a/db/post_migrate/20220905112710_add_async_index_to_todos_to_cover_pending_query.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddAsyncIndexToTodosToCoverPendingQuery < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_on_todos_user_project_target_and_state'
- COLUMNS = %i[user_id project_id target_type target_id id].freeze
-
- def up
- prepare_async_index :todos, COLUMNS, name: INDEX_NAME, where: "state = 'pending'"
- end
-
- def down
- unprepare_async_index :todos, COLUMNS, name: INDEX_NAME, where: "state='pending'"
- end
-end
diff --git a/db/post_migrate/20220905120848_backfill_epic_cache_counts.rb b/db/post_migrate/20220905120848_backfill_epic_cache_counts.rb
deleted file mode 100644
index 32fe04eb99c..00000000000
--- a/db/post_migrate/20220905120848_backfill_epic_cache_counts.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class BackfillEpicCacheCounts < Gitlab::Database::Migration[2.0]
- MIGRATION = 'BackfillEpicCacheCounts'
- DELAY_INTERVAL = 2.minutes.to_i
- BATCH_SIZE = 200
- MAX_BATCH_SIZE = 1000
- SUB_BATCH_SIZE = 20
-
- disable_ddl_transaction!
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- :epics,
- :id,
- job_interval: DELAY_INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE,
- gitlab_schema: :gitlab_main
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :epics, :id, [])
- end
-end
diff --git a/db/post_migrate/20220906074449_schedule_disable_legacy_open_source_license_for_projects_less_than_one_mb.rb b/db/post_migrate/20220906074449_schedule_disable_legacy_open_source_license_for_projects_less_than_one_mb.rb
deleted file mode 100644
index ee48ace13e0..00000000000
--- a/db/post_migrate/20220906074449_schedule_disable_legacy_open_source_license_for_projects_less_than_one_mb.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleDisableLegacyOpenSourceLicenseForProjectsLessThanOneMb < Gitlab::Database::Migration[2.0]
- MIGRATION = 'DisableLegacyOpenSourceLicenseForProjectsLessThanOneMb'
- INTERVAL = 2.minutes
- BATCH_SIZE = 4_000
- MAX_BATCH_SIZE = 50_000
- SUB_BATCH_SIZE = 250
-
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- return unless Gitlab.com?
-
- queue_batched_background_migration(
- MIGRATION,
- :project_settings,
- :project_id,
- job_interval: INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
-
- def down
- return unless Gitlab.com?
-
- delete_batched_background_migration(MIGRATION, :project_settings, :project_id, [])
- end
-end
diff --git a/db/post_migrate/20220906212931_add_partial_index_for_ci_pipeline_artifacts_unlocked_with_expire_at.rb b/db/post_migrate/20220906212931_add_partial_index_for_ci_pipeline_artifacts_unlocked_with_expire_at.rb
deleted file mode 100644
index a24187dd56b..00000000000
--- a/db/post_migrate/20220906212931_add_partial_index_for_ci_pipeline_artifacts_unlocked_with_expire_at.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddPartialIndexForCiPipelineArtifactsUnlockedWithExpireAt < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- TABLE_NAME = 'ci_pipeline_artifacts'
- INDEX_NAME = 'ci_pipeline_artifacts_on_expire_at_for_removal'
- CONDITIONS = 'locked = 0 AND expire_at IS NOT NULL'
-
- def up
- add_concurrent_index TABLE_NAME, [:expire_at], where: CONDITIONS, name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220907122648_populate_security_orchestration_policy_configuration_id.rb b/db/post_migrate/20220907122648_populate_security_orchestration_policy_configuration_id.rb
deleted file mode 100644
index 441113c0ba3..00000000000
--- a/db/post_migrate/20220907122648_populate_security_orchestration_policy_configuration_id.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# frozen_string_literal: true
-
-class PopulateSecurityOrchestrationPolicyConfigurationId < Gitlab::Database::Migration[2.0]
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- BATCH_SIZE = 1000
- SUB_BATCH_SIZE = 500
- MERGE_REQUEST_MIGRATION = 'PopulateApprovalMergeRequestRulesWithSecurityOrchestration'
- PROJECT_MIGRATION = 'PopulateApprovalProjectRulesWithSecurityOrchestration'
- INTERVAL = 2.minutes
-
- def up
- return unless Gitlab.ee?
-
- queue_batched_background_migration(
- PROJECT_MIGRATION,
- :approval_project_rules,
- :id,
- job_interval: INTERVAL,
- batch_size: BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
-
- queue_batched_background_migration(
- MERGE_REQUEST_MIGRATION,
- :approval_merge_request_rules,
- :id,
- job_interval: INTERVAL,
- batch_size: BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
-
- def down
- delete_batched_background_migration(PROJECT_MIGRATION, :approval_project_rules, :id, [])
- delete_batched_background_migration(MERGE_REQUEST_MIGRATION, :approval_merge_request_rules, :id, [])
- end
-end
diff --git a/db/post_migrate/20220908125146_remove_free_user_cap_remediation_worker.rb b/db/post_migrate/20220908125146_remove_free_user_cap_remediation_worker.rb
deleted file mode 100644
index e95ea9c58b4..00000000000
--- a/db/post_migrate/20220908125146_remove_free_user_cap_remediation_worker.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveFreeUserCapRemediationWorker < Gitlab::Database::Migration[2.0]
- def up
- Sidekiq::Cron::Job.find('free_user_cap_data_remediation')&.destroy
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20220909114220_drop_environments_project_name_lower_pattern_ops_index.rb b/db/post_migrate/20220909114220_drop_environments_project_name_lower_pattern_ops_index.rb
deleted file mode 100644
index 3ab71809039..00000000000
--- a/db/post_migrate/20220909114220_drop_environments_project_name_lower_pattern_ops_index.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-# reverts db/migrate/20220901131828_add_environments_project_name_lower_pattern_ops_index.rb
-class DropEnvironmentsProjectNameLowerPatternOpsIndex < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_environments_on_project_name_varchar_pattern_ops'
-
- def up
- remove_concurrent_index_by_name :environments, INDEX_NAME
- end
-
- def down
- add_concurrent_index :environments, 'project_id, lower(name) varchar_pattern_ops', name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220912085047_add_index_to_todos_pending_query.rb b/db/post_migrate/20220912085047_add_index_to_todos_pending_query.rb
deleted file mode 100644
index 7d721421463..00000000000
--- a/db/post_migrate/20220912085047_add_index_to_todos_pending_query.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToTodosPendingQuery < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_on_todos_user_project_target_and_state'
- COLUMNS = %i[user_id project_id target_type target_id id].freeze
-
- def up
- add_concurrent_index :todos, COLUMNS, name: INDEX_NAME, where: "state = 'pending'"
- end
-
- def down
- remove_concurrent_index_by_name :todos, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220912110433_prepare_create_internal_notes_index_on_id.rb b/db/post_migrate/20220912110433_prepare_create_internal_notes_index_on_id.rb
deleted file mode 100644
index 241bdfa4715..00000000000
--- a/db/post_migrate/20220912110433_prepare_create_internal_notes_index_on_id.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class PrepareCreateInternalNotesIndexOnId < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'index_notes_on_id_where_internal'
-
- def up
- prepare_async_index :notes, :id, where: 'internal = true', name: INDEX_NAME
- end
-
- def down
- unprepare_async_index_by_name :notes, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220913030552_add_tmp_index_system_note_metadata_on_attention_request_actions.rb b/db/post_migrate/20220913030552_add_tmp_index_system_note_metadata_on_attention_request_actions.rb
deleted file mode 100644
index 3418dabc0e9..00000000000
--- a/db/post_migrate/20220913030552_add_tmp_index_system_note_metadata_on_attention_request_actions.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddTmpIndexSystemNoteMetadataOnAttentionRequestActions < Gitlab::Database::Migration[2.0]
- INDEX_NAME = "tmp_index_system_note_metadata_on_attention_request_actions"
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :system_note_metadata, [:id],
- where: "action IN ('attention_requested', 'attention_request_removed')",
- name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :system_note_metadata, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220913030624_cleanup_attention_request_related_system_notes.rb b/db/post_migrate/20220913030624_cleanup_attention_request_related_system_notes.rb
deleted file mode 100644
index b7d6908696b..00000000000
--- a/db/post_migrate/20220913030624_cleanup_attention_request_related_system_notes.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-class CleanupAttentionRequestRelatedSystemNotes < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- BATCH_SIZE = 100
-
- class SystemNoteMetadata < MigrationRecord
- include EachBatch
-
- self.table_name = 'system_note_metadata'
- end
-
- class Note < MigrationRecord
- self.table_name = 'notes'
- end
-
- def up
- SystemNoteMetadata
- .where(action: %w[attention_requested attention_request_removed])
- .each_batch(of: BATCH_SIZE) do |batch|
- Note.where(id: batch.pluck(:note_id)).delete_all
- end
- end
-
- def down
- # no op
- end
-end
diff --git a/db/post_migrate/20220913083015_clean_up_rename_iterations_cadences_last_run_date_to_next_run_date.rb b/db/post_migrate/20220913083015_clean_up_rename_iterations_cadences_last_run_date_to_next_run_date.rb
deleted file mode 100644
index 7618e1841bd..00000000000
--- a/db/post_migrate/20220913083015_clean_up_rename_iterations_cadences_last_run_date_to_next_run_date.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class CleanUpRenameIterationsCadencesLastRunDateToNextRunDate < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- cleanup_concurrent_column_rename :iterations_cadences, :last_run_date, :next_run_date
- end
-
- def down
- undo_cleanup_concurrent_column_rename :iterations_cadences, :last_run_date, :next_run_date
- end
-end
diff --git a/db/post_migrate/20220914093408_add_unique_id_partition_id_index_to_ci_build_metadata.rb b/db/post_migrate/20220914093408_add_unique_id_partition_id_index_to_ci_build_metadata.rb
deleted file mode 100644
index 1f40118c809..00000000000
--- a/db/post_migrate/20220914093408_add_unique_id_partition_id_index_to_ci_build_metadata.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class AddUniqueIdPartitionIdIndexToCiBuildMetadata < Gitlab::Database::Migration[2.0]
- TABLE_NAME = :ci_builds_metadata
- INDEX_NAME = :index_ci_builds_metadata_on_id_partition_id_unique
-
- def up
- prepare_async_index(TABLE_NAME, %i[id partition_id], unique: true, name: INDEX_NAME)
- end
-
- def down
- unprepare_async_index(:ci_builds_metadata, %i[id partition_id], name: INDEX_NAME)
- end
-end
diff --git a/db/post_migrate/20220915103831_add_unique_build_id_partition_id_index_to_ci_build_metadata.rb b/db/post_migrate/20220915103831_add_unique_build_id_partition_id_index_to_ci_build_metadata.rb
deleted file mode 100644
index 74b60390057..00000000000
--- a/db/post_migrate/20220915103831_add_unique_build_id_partition_id_index_to_ci_build_metadata.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class AddUniqueBuildIdPartitionIdIndexToCiBuildMetadata < Gitlab::Database::Migration[2.0]
- TABLE_NAME = :ci_builds_metadata
- INDEX_NAME = :index_ci_builds_metadata_on_build_id_partition_id_unique
-
- def up
- prepare_async_index(TABLE_NAME, %i[build_id partition_id], unique: true, name: INDEX_NAME)
- end
-
- def down
- unprepare_async_index(:ci_builds_metadata, %i[build_id partition_id], name: INDEX_NAME)
- end
-end
diff --git a/db/post_migrate/20220915192521_prepare_async_trigram_index_for_vulnerability_reads_container_images.rb b/db/post_migrate/20220915192521_prepare_async_trigram_index_for_vulnerability_reads_container_images.rb
deleted file mode 100644
index 18ed1b2cd2b..00000000000
--- a/db/post_migrate/20220915192521_prepare_async_trigram_index_for_vulnerability_reads_container_images.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class PrepareAsyncTrigramIndexForVulnerabilityReadsContainerImages < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_vulnerability_reads_on_location_image_trigram'
- REPORT_TYPES = { container_scanning: 2, cluster_image_scanning: 7 }.freeze
-
- def up
- prepare_async_index :vulnerability_reads, :location_image,
- name: INDEX_NAME,
- using: :gin, opclass: { location_image: :gin_trgm_ops },
- where: "report_type = ANY (ARRAY[#{REPORT_TYPES.values.join(', ')}]) AND location_image IS NOT NULL"
- end
-
- def down
- unprepare_async_index :vulnerability_reads, :location_image, name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220916054103_remove_experience_level_column.rb b/db/post_migrate/20220916054103_remove_experience_level_column.rb
deleted file mode 100644
index dff5a9a6580..00000000000
--- a/db/post_migrate/20220916054103_remove_experience_level_column.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveExperienceLevelColumn < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- def up
- remove_column :user_preferences, :experience_level
- end
-
- def down
- add_column :user_preferences, :experience_level, :integer, limit: 2
- end
-end
diff --git a/db/post_migrate/20220916065418_add_index_id_partition_id_to_ci_builds_metadata.rb b/db/post_migrate/20220916065418_add_index_id_partition_id_to_ci_builds_metadata.rb
deleted file mode 100644
index c781f2a9ef9..00000000000
--- a/db/post_migrate/20220916065418_add_index_id_partition_id_to_ci_builds_metadata.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexIdPartitionIdToCiBuildsMetadata < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- TABLE_NAME = :ci_builds_metadata
- INDEX_NAME = :index_ci_builds_metadata_on_id_partition_id_unique
-
- def up
- add_concurrent_index(TABLE_NAME, %i[id partition_id], unique: true, name: INDEX_NAME)
- end
-
- def down
- remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME)
- end
-end
diff --git a/db/post_migrate/20220916070101_add_index_build_id_partition_id_to_ci_build_metadata.rb b/db/post_migrate/20220916070101_add_index_build_id_partition_id_to_ci_build_metadata.rb
deleted file mode 100644
index 18c24c47325..00000000000
--- a/db/post_migrate/20220916070101_add_index_build_id_partition_id_to_ci_build_metadata.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexBuildIdPartitionIdToCiBuildMetadata < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- TABLE_NAME = :ci_builds_metadata
- INDEX_NAME = :index_ci_builds_metadata_on_build_id_partition_id_unique
-
- def up
- add_concurrent_index(TABLE_NAME, %i[build_id partition_id], unique: true, name: INDEX_NAME)
- end
-
- def down
- remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME)
- end
-end
diff --git a/db/post_migrate/20220916112841_remove_unused_aggregation_columns.rb b/db/post_migrate/20220916112841_remove_unused_aggregation_columns.rb
deleted file mode 100644
index f5333c84042..00000000000
--- a/db/post_migrate/20220916112841_remove_unused_aggregation_columns.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveUnusedAggregationColumns < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- with_lock_retries do
- remove_column :analytics_cycle_analytics_aggregations, :last_full_run_processed_records
- remove_column :analytics_cycle_analytics_aggregations, :last_full_run_runtimes_in_seconds
- remove_column :analytics_cycle_analytics_aggregations, :last_full_run_issues_updated_at
- remove_column :analytics_cycle_analytics_aggregations, :last_full_run_mrs_updated_at
- remove_column :analytics_cycle_analytics_aggregations, :last_full_run_issues_id
- remove_column :analytics_cycle_analytics_aggregations, :last_full_run_merge_requests_id
- end
- end
-
- def down
- with_lock_retries do
- add_column(:analytics_cycle_analytics_aggregations,
- :last_full_run_processed_records,
- :integer,
- array: true,
- default: [],
- null: false,
- if_not_exists: true)
- add_column(:analytics_cycle_analytics_aggregations,
- :last_full_run_runtimes_in_seconds,
- :integer,
- array: true,
- default: [],
- null: false,
- if_not_exists: true)
- add_column(:analytics_cycle_analytics_aggregations,
- :last_full_run_issues_updated_at,
- :datetime_with_timezone,
- if_not_exists: true)
- add_column(:analytics_cycle_analytics_aggregations,
- :last_full_run_mrs_updated_at,
- :datetime_with_timezone,
- if_not_exists: true)
- add_column(:analytics_cycle_analytics_aggregations,
- :last_full_run_issues_id,
- :integer,
- if_not_exists: true)
- add_column(:analytics_cycle_analytics_aggregations,
- :last_full_run_merge_requests_id,
- :integer,
- if_not_exists: true)
- end
-
- add_check_constraint(:analytics_cycle_analytics_aggregations,
- 'CARDINALITY(last_full_run_runtimes_in_seconds) <= 10',
- 'chk_rails_7810292ec9')
-
- add_check_constraint(:analytics_cycle_analytics_aggregations,
- 'CARDINALITY(last_full_run_processed_records) <= 10',
- 'chk_rails_8b9e89687c')
- end
-end
diff --git a/db/post_migrate/20220919023208_drop_unused_fields_from_merge_request_assignees.rb b/db/post_migrate/20220919023208_drop_unused_fields_from_merge_request_assignees.rb
deleted file mode 100644
index f1afbb41893..00000000000
--- a/db/post_migrate/20220919023208_drop_unused_fields_from_merge_request_assignees.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# frozen_string_literal: true
-
-class DropUnusedFieldsFromMergeRequestAssignees < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- with_lock_retries do
- if column_exists?(:merge_request_assignees, :state) # rubocop:disable Style/IfUnlessModifier
- remove_column :merge_request_assignees, :state
- end
-
- if column_exists?(:merge_request_assignees, :updated_state_by_user_id)
- remove_column :merge_request_assignees, :updated_state_by_user_id
- end
- end
- end
-
- def down
- with_lock_retries do
- unless column_exists?(:merge_request_assignees, :state)
- add_column :merge_request_assignees, :state, :smallint, default: 0, null: false
- end
-
- unless column_exists?(:merge_request_assignees, :updated_state_by_user_id)
- add_column :merge_request_assignees, :updated_state_by_user_id, :bigint
- end
- end
-
- add_concurrent_index :merge_request_assignees, [:user_id, :state],
- where: 'state = 2',
- name: 'index_on_merge_request_assignees_user_id_and_state'
-
- add_concurrent_index :merge_request_assignees, :updated_state_by_user_id,
- name: 'index_on_merge_request_assignees_updated_state_by_user_id'
-
- add_concurrent_foreign_key :merge_request_assignees, :users,
- column: :updated_state_by_user_id,
- on_delete: :nullify
- end
-end
diff --git a/db/post_migrate/20220919041604_drop_unused_fields_from_merge_request_reviewers.rb b/db/post_migrate/20220919041604_drop_unused_fields_from_merge_request_reviewers.rb
deleted file mode 100644
index d9f98557f75..00000000000
--- a/db/post_migrate/20220919041604_drop_unused_fields_from_merge_request_reviewers.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class DropUnusedFieldsFromMergeRequestReviewers < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- with_lock_retries do
- if column_exists?(:merge_request_reviewers, :updated_state_by_user_id)
- remove_column :merge_request_reviewers, :updated_state_by_user_id
- end
- end
- end
-
- def down
- with_lock_retries do
- unless column_exists?(:merge_request_reviewers, :updated_state_by_user_id)
- add_column :merge_request_reviewers, :updated_state_by_user_id, :bigint
- end
- end
-
- add_concurrent_index :merge_request_reviewers, :updated_state_by_user_id,
- name: 'index_on_merge_request_reviewers_updated_state_by_user_id'
-
- add_concurrent_foreign_key :merge_request_reviewers, :users, column: :updated_state_by_user_id, on_delete: :nullify
- end
-end
diff --git a/db/post_migrate/20220919050555_drop_tmp_index_user_callouts_on_attention_request_feature_names.rb b/db/post_migrate/20220919050555_drop_tmp_index_user_callouts_on_attention_request_feature_names.rb
deleted file mode 100644
index e456a91fe3f..00000000000
--- a/db/post_migrate/20220919050555_drop_tmp_index_user_callouts_on_attention_request_feature_names.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class DropTmpIndexUserCalloutsOnAttentionRequestFeatureNames < 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
- remove_concurrent_index_by_name :user_callouts, INDEX_NAME
- end
-
- def down
- add_concurrent_index :user_callouts, [:id],
- where: "feature_name IN (#{ATTENTION_REQUEST_CALLOUTS.join(',')})",
- name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220919080303_delete_migrate_shared_vulnerability_scanners.rb b/db/post_migrate/20220919080303_delete_migrate_shared_vulnerability_scanners.rb
deleted file mode 100644
index 4aedfcf1699..00000000000
--- a/db/post_migrate/20220919080303_delete_migrate_shared_vulnerability_scanners.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# frozen_string_literal: true
-
-class DeleteMigrateSharedVulnerabilityScanners < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- MIGRATION = "MigrateSharedVulnerabilityScanners"
- TABLE_NAME = :vulnerability_occurrences
- BATCH_COLUMN = :id
- BATCH_SIZE = 250
-
- class BatchedBackgroundMigration < MigrationRecord
- self.table_name = "batched_background_migrations"
- end
-
- class BatchedBackgroundMigrationJob < MigrationRecord
- include ::EachBatch
-
- self.table_name = "batched_background_migration_jobs"
-
- belongs_to :batched_background_migration
- end
-
- def up
- return unless migration_id = BatchedBackgroundMigration.find_by(job_class_name: MIGRATION)&.id
-
- # rubocop:disable Style/SymbolProc
- BatchedBackgroundMigrationJob
- .where(batched_background_migration_id: migration_id)
- .each_batch(of: BATCH_SIZE) do |relation|
- relation.delete_all
- end
- # rubocop:enable Style/SymbolProc
-
- delete_batched_background_migration(MIGRATION,
- TABLE_NAME,
- BATCH_COLUMN,
- [])
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20220919080304_reschedule_migrate_shared_vulnerability_scanners.rb b/db/post_migrate/20220919080304_reschedule_migrate_shared_vulnerability_scanners.rb
deleted file mode 100644
index 69757085587..00000000000
--- a/db/post_migrate/20220919080304_reschedule_migrate_shared_vulnerability_scanners.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class RescheduleMigrateSharedVulnerabilityScanners < Gitlab::Database::Migration[2.0]
- MIGRATION = "MigrateSharedVulnerabilityScanners"
- TABLE_NAME = :vulnerability_occurrences
- BATCH_COLUMN = :id
- DELAY_INTERVAL = 5.minutes
- BATCH_SIZE = 1000
- SUB_BATCH_SIZE = 100
-
- disable_ddl_transaction!
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- TABLE_NAME,
- BATCH_COLUMN,
- job_interval: DELAY_INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, TABLE_NAME, BATCH_COLUMN, [])
- end
-end
diff --git a/db/post_migrate/20220920081631_prepare_ci_builds_metadata_for_partitioning_primary_key.rb b/db/post_migrate/20220920081631_prepare_ci_builds_metadata_for_partitioning_primary_key.rb
deleted file mode 100644
index 90727178624..00000000000
--- a/db/post_migrate/20220920081631_prepare_ci_builds_metadata_for_partitioning_primary_key.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# frozen_string_literal: true
-
-class PrepareCiBuildsMetadataForPartitioningPrimaryKey < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- TABLE_NAME = 'ci_builds_metadata'
- PRIMARY_KEY = 'ci_builds_metadata_pkey'
- NEW_INDEX_NAME = 'index_ci_builds_metadata_on_id_partition_id_unique'
- OLD_INDEX_NAME = 'index_ci_builds_metadata_on_id_unique'
-
- def up
- with_lock_retries(raise_on_exhaustion: true) do
- execute("ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT #{PRIMARY_KEY} CASCADE")
-
- rename_index(TABLE_NAME, NEW_INDEX_NAME, PRIMARY_KEY)
-
- execute("ALTER TABLE #{TABLE_NAME} ADD CONSTRAINT #{PRIMARY_KEY} " \
- "PRIMARY KEY USING INDEX #{PRIMARY_KEY}")
- end
- end
-
- # rolling back this migration is time consuming with the creation of these two indexes
- def down
- add_concurrent_index(TABLE_NAME, :id, unique: true, name: OLD_INDEX_NAME)
- add_concurrent_index(TABLE_NAME, [:id, :partition_id], unique: true, name: NEW_INDEX_NAME)
-
- with_lock_retries(raise_on_exhaustion: true) do
- execute("ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT #{PRIMARY_KEY} CASCADE")
-
- rename_index(TABLE_NAME, OLD_INDEX_NAME, PRIMARY_KEY)
-
- execute("ALTER TABLE #{TABLE_NAME} ADD CONSTRAINT #{PRIMARY_KEY} " \
- "PRIMARY KEY USING INDEX #{PRIMARY_KEY}")
- end
- end
-end
diff --git a/db/post_migrate/20220920122121_schedule_index_removal_for_ci_builds_metadata.rb b/db/post_migrate/20220920122121_schedule_index_removal_for_ci_builds_metadata.rb
deleted file mode 100644
index 57475a08c93..00000000000
--- a/db/post_migrate/20220920122121_schedule_index_removal_for_ci_builds_metadata.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleIndexRemovalForCiBuildsMetadata < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- TABLE_NAME = :ci_builds_metadata
- INDEX_NAME = :index_ci_builds_metadata_on_build_id
-
- def up
- prepare_async_index_removal(TABLE_NAME, :build_id, name: INDEX_NAME)
- end
-
- def down
- unprepare_async_index(TABLE_NAME, :build_id, name: INDEX_NAME)
- end
-end
diff --git a/db/post_migrate/20220920124709_backfill_internal_on_notes_renamed.rb b/db/post_migrate/20220920124709_backfill_internal_on_notes_renamed.rb
deleted file mode 100644
index a9de69243f6..00000000000
--- a/db/post_migrate/20220920124709_backfill_internal_on_notes_renamed.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-# Renamed from BackfillInternalOnNotes to BackfillInternalOnNotesRenamed to avoid collision with an Elasticsearch
-# migration from the same name. See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/129012
-class BackfillInternalOnNotesRenamed < Gitlab::Database::Migration[2.0]
- MIGRATION = 'BackfillInternalOnNotes'
- DELAY_INTERVAL = 2.minutes
- TABLE = :notes
- BATCH_SIZE = 2000
- SUB_BATCH_SIZE = 10
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- TABLE,
- :id,
- job_interval: DELAY_INTERVAL,
- batch_size: BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, TABLE, :id, [])
- end
-end
diff --git a/db/post_migrate/20220920135356_tiebreak_user_type_index.rb b/db/post_migrate/20220920135356_tiebreak_user_type_index.rb
deleted file mode 100644
index 489196c8eab..00000000000
--- a/db/post_migrate/20220920135356_tiebreak_user_type_index.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class TiebreakUserTypeIndex < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- NEW_INDEX_NAME = 'index_users_on_user_type_and_id'
- OLD_INDEX_NAME = 'index_users_on_user_type'
-
- def up
- # rubocop:disable Migration/PreventIndexCreation
- add_concurrent_index :users, [:user_type, :id], name: NEW_INDEX_NAME
- # rubocop:enable Migration/PreventIndexCreation
- remove_concurrent_index_by_name :users, OLD_INDEX_NAME
- end
-
- def down
- add_concurrent_index :users, :user_type, name: OLD_INDEX_NAME
- remove_concurrent_index_by_name :users, NEW_INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220920141001_add_index_on_internal_notes.rb b/db/post_migrate/20220920141001_add_index_on_internal_notes.rb
deleted file mode 100644
index 466ad7b5a8d..00000000000
--- a/db/post_migrate/20220920141001_add_index_on_internal_notes.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnInternalNotes < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'index_notes_on_id_where_internal'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :notes, :id, where: 'internal = true', name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :notes, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220920213504_finalize_task_system_note_renaming.rb b/db/post_migrate/20220920213504_finalize_task_system_note_renaming.rb
deleted file mode 100644
index d9307c14ccb..00000000000
--- a/db/post_migrate/20220920213504_finalize_task_system_note_renaming.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class FinalizeTaskSystemNoteRenaming < Gitlab::Database::Migration[2.0]
- def up
- # no-op
- end
-
- def down
- # noop
- end
-end
diff --git a/db/post_migrate/20220920214524_remove_task_system_note_rename_temp_index.rb b/db/post_migrate/20220920214524_remove_task_system_note_rename_temp_index.rb
deleted file mode 100644
index d3671d24578..00000000000
--- a/db/post_migrate/20220920214524_remove_task_system_note_rename_temp_index.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveTaskSystemNoteRenameTempIndex < Gitlab::Database::Migration[2.0]
- def up
- # no-op
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20220921093355_schedule_backfill_namespace_details.rb b/db/post_migrate/20220921093355_schedule_backfill_namespace_details.rb
deleted file mode 100644
index 16ce9bd5c85..00000000000
--- a/db/post_migrate/20220921093355_schedule_backfill_namespace_details.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleBackfillNamespaceDetails < Gitlab::Database::Migration[2.0]
- MIGRATION = 'BackfillNamespaceDetails'
- INTERVAL = 2.minutes
- BATCH_SIZE = 1_000
- MAX_BATCH_SIZE = 10_000
- SUB_BATCH_SIZE = 200
-
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- :namespaces,
- :id,
- job_interval: INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :namespaces, :id, [])
- end
-end
diff --git a/db/post_migrate/20220921111823_remove_and_add_ci_pipeline_variables_raw_with_new_default.rb b/db/post_migrate/20220921111823_remove_and_add_ci_pipeline_variables_raw_with_new_default.rb
deleted file mode 100644
index fd56a8f320a..00000000000
--- a/db/post_migrate/20220921111823_remove_and_add_ci_pipeline_variables_raw_with_new_default.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveAndAddCiPipelineVariablesRawWithNewDefault < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- def change
- remove_column :ci_pipeline_variables, :raw, :boolean, null: false, default: true
- add_column :ci_pipeline_variables, :raw, :boolean, null: false, default: false
- end
-end
diff --git a/db/post_migrate/20220921111831_remove_and_add_ci_group_variables_raw_with_new_default.rb b/db/post_migrate/20220921111831_remove_and_add_ci_group_variables_raw_with_new_default.rb
deleted file mode 100644
index f4b7de3faf4..00000000000
--- a/db/post_migrate/20220921111831_remove_and_add_ci_group_variables_raw_with_new_default.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveAndAddCiGroupVariablesRawWithNewDefault < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- def change
- remove_column :ci_group_variables, :raw, :boolean, null: false, default: true
- add_column :ci_group_variables, :raw, :boolean, null: false, default: false
- end
-end
diff --git a/db/post_migrate/20220921111840_remove_and_add_ci_instance_variables_raw_with_new_default.rb b/db/post_migrate/20220921111840_remove_and_add_ci_instance_variables_raw_with_new_default.rb
deleted file mode 100644
index 019db1bbaa3..00000000000
--- a/db/post_migrate/20220921111840_remove_and_add_ci_instance_variables_raw_with_new_default.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveAndAddCiInstanceVariablesRawWithNewDefault < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- def change
- remove_column :ci_instance_variables, :raw, :boolean, null: false, default: true
- add_column :ci_instance_variables, :raw, :boolean, null: false, default: false
- end
-end
diff --git a/db/post_migrate/20220921111849_remove_and_add_ci_job_variables_raw_with_new_default.rb b/db/post_migrate/20220921111849_remove_and_add_ci_job_variables_raw_with_new_default.rb
deleted file mode 100644
index 736cd46382d..00000000000
--- a/db/post_migrate/20220921111849_remove_and_add_ci_job_variables_raw_with_new_default.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveAndAddCiJobVariablesRawWithNewDefault < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- def change
- remove_column :ci_job_variables, :raw, :boolean, null: false, default: true
- add_column :ci_job_variables, :raw, :boolean, null: false, default: false
- end
-end
diff --git a/db/post_migrate/20220921111857_remove_and_add_ci_pipeline_schedule_variables_raw_with_new_default.rb b/db/post_migrate/20220921111857_remove_and_add_ci_pipeline_schedule_variables_raw_with_new_default.rb
deleted file mode 100644
index 159b0303d71..00000000000
--- a/db/post_migrate/20220921111857_remove_and_add_ci_pipeline_schedule_variables_raw_with_new_default.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveAndAddCiPipelineScheduleVariablesRawWithNewDefault < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- def change
- remove_column :ci_pipeline_schedule_variables, :raw, :boolean, null: false, default: true
- add_column :ci_pipeline_schedule_variables, :raw, :boolean, null: false, default: false
- end
-end
diff --git a/db/post_migrate/20220921111907_remove_and_add_ci_variables_raw_with_new_default.rb b/db/post_migrate/20220921111907_remove_and_add_ci_variables_raw_with_new_default.rb
deleted file mode 100644
index 129e5b1f020..00000000000
--- a/db/post_migrate/20220921111907_remove_and_add_ci_variables_raw_with_new_default.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveAndAddCiVariablesRawWithNewDefault < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- def change
- remove_column :ci_variables, :raw, :boolean, null: false, default: true
- add_column :ci_variables, :raw, :boolean, null: false, default: false
- end
-end
diff --git a/db/post_migrate/20220921144258_remove_orphan_group_token_users.rb b/db/post_migrate/20220921144258_remove_orphan_group_token_users.rb
deleted file mode 100644
index a2483f611a3..00000000000
--- a/db/post_migrate/20220921144258_remove_orphan_group_token_users.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveOrphanGroupTokenUsers < Gitlab::Database::Migration[2.0]
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- disable_ddl_transaction!
-
- class MigrationUser < MigrationRecord
- include EachBatch
-
- self.table_name = 'users'
-
- scope :project_bots, -> { where(user_type: 6) }
- scope :without_memberships, -> { where("NOT EXISTS (SELECT 1 FROM members where members.user_id = users.id)") }
- end
-
- class MigrationPersonalAccessToken < MigrationRecord
- self.table_name = 'personal_access_tokens'
- end
-
- def up
- delete_worker = 'DeleteUserWorker'.safe_constantize
-
- MigrationUser.project_bots.each_batch(of: 1000) do |batch|
- bot_ids = batch.without_memberships.pluck(:id)
-
- MigrationPersonalAccessToken.where(user_id: bot_ids).delete_all
-
- next unless delete_worker && delete_worker.respond_to?(:perform_async)
-
- bot_ids.each do |bot_id|
- delete_worker.perform_async(bot_id, bot_id, skip_authorization: true)
- end
- end
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20220922090236_remove_trace_column_from_ci_builds.rb b/db/post_migrate/20220922090236_remove_trace_column_from_ci_builds.rb
deleted file mode 100644
index e1871a9799f..00000000000
--- a/db/post_migrate/20220922090236_remove_trace_column_from_ci_builds.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveTraceColumnFromCiBuilds < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- def change
- remove_column :ci_builds, :trace, :text
- end
-end
diff --git a/db/post_migrate/20220922143143_schedule_reset_duplicate_ci_runners_token_values.rb b/db/post_migrate/20220922143143_schedule_reset_duplicate_ci_runners_token_values.rb
deleted file mode 100644
index fd02bda8004..00000000000
--- a/db/post_migrate/20220922143143_schedule_reset_duplicate_ci_runners_token_values.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleResetDuplicateCiRunnersTokenValues < Gitlab::Database::Migration[2.0]
- restrict_gitlab_migration gitlab_schema: :gitlab_ci
- disable_ddl_transaction!
-
- MIGRATION = 'ResetDuplicateCiRunnersTokenValues'
- DELAY_INTERVAL = 2.minutes
- BATCH_SIZE = 2_000
- MAX_BATCH_SIZE = 100_000
- SUB_BATCH_SIZE = 500
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- :ci_runners,
- :id,
- job_interval: DELAY_INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :ci_runners, :id, [])
- end
-end
diff --git a/db/post_migrate/20220922143634_schedule_reset_duplicate_ci_runners_token_encrypted_values.rb b/db/post_migrate/20220922143634_schedule_reset_duplicate_ci_runners_token_encrypted_values.rb
deleted file mode 100644
index bbbf9a1db44..00000000000
--- a/db/post_migrate/20220922143634_schedule_reset_duplicate_ci_runners_token_encrypted_values.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleResetDuplicateCiRunnersTokenEncryptedValues < Gitlab::Database::Migration[2.0]
- restrict_gitlab_migration gitlab_schema: :gitlab_ci
- disable_ddl_transaction!
-
- MIGRATION = 'ResetDuplicateCiRunnersTokenEncryptedValues'
- DELAY_INTERVAL = 2.minutes
- BATCH_SIZE = 2_000
- MAX_BATCH_SIZE = 100_000
- SUB_BATCH_SIZE = 500
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- :ci_runners,
- :id,
- job_interval: DELAY_INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :ci_runners, :id, [])
- end
-end
diff --git a/db/post_migrate/20220922204106_remove_index_for_requested_non_invited_awaiting_members.rb b/db/post_migrate/20220922204106_remove_index_for_requested_non_invited_awaiting_members.rb
deleted file mode 100644
index 033b04a75f8..00000000000
--- a/db/post_migrate/20220922204106_remove_index_for_requested_non_invited_awaiting_members.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveIndexForRequestedNonInvitedAwaitingMembers < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'index_members_on_non_requested_non_invited_and_state_awaiting'
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :members, INDEX_NAME
- end
-
- def down
- clause = '((requested_at IS NULL) AND (invite_token IS NULL) AND (access_level > 5) AND (state = 1))'
-
- add_concurrent_index :members, :source_id, where: clause, name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220923052531_remove_tmp_index_merge_request_reviewers_on_attention_requested_state.rb b/db/post_migrate/20220923052531_remove_tmp_index_merge_request_reviewers_on_attention_requested_state.rb
deleted file mode 100644
index 27d9c1641bc..00000000000
--- a/db/post_migrate/20220923052531_remove_tmp_index_merge_request_reviewers_on_attention_requested_state.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveTmpIndexMergeRequestReviewersOnAttentionRequestedState < Gitlab::Database::Migration[2.0]
- INDEX_NAME = "tmp_index_merge_request_reviewers_on_attention_requested_state"
- ATTENTION_REQUESTED_STATE = 2
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :merge_request_reviewers, INDEX_NAME
- end
-
- def down
- add_concurrent_index :merge_request_reviewers, [:id],
- where: "state = #{ATTENTION_REQUESTED_STATE}",
- name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220923060226_remove_tmp_index_system_note_metadata_on_attention_request_actions.rb b/db/post_migrate/20220923060226_remove_tmp_index_system_note_metadata_on_attention_request_actions.rb
deleted file mode 100644
index 40e8c1cfdb5..00000000000
--- a/db/post_migrate/20220923060226_remove_tmp_index_system_note_metadata_on_attention_request_actions.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveTmpIndexSystemNoteMetadataOnAttentionRequestActions < Gitlab::Database::Migration[2.0]
- INDEX_NAME = "tmp_index_system_note_metadata_on_attention_request_actions"
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :system_note_metadata, INDEX_NAME
- end
-
- def down
- add_concurrent_index :system_note_metadata, [:id],
- where: "action IN ('attention_requested', 'attention_request_removed')",
- name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220927171740_prepare_for_vulnerability_occurrences_uuid_type_transition.rb b/db/post_migrate/20220927171740_prepare_for_vulnerability_occurrences_uuid_type_transition.rb
deleted file mode 100644
index e6f3384514d..00000000000
--- a/db/post_migrate/20220927171740_prepare_for_vulnerability_occurrences_uuid_type_transition.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class PrepareForVulnerabilityOccurrencesUuidTypeTransition < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- TABLE = :vulnerability_occurrences
- MAPPINGS = {
- uuid: {
- from_type: :string,
- to_type: :uuid,
- default_value: '00000000-0000-0000-0000-000000000000'
- }
- }
-
- def up
- create_temporary_columns_and_triggers(TABLE, MAPPINGS)
- end
-
- def down
- columns = MAPPINGS.keys
- temporary_columns = columns.map { |column| convert_to_type_column(column, :string, :uuid) }
- trigger_name = rename_trigger_name(TABLE, columns, temporary_columns)
- remove_rename_triggers(TABLE, trigger_name)
- temporary_columns.each { |column| remove_column(TABLE, column) }
- end
-end
diff --git a/db/post_migrate/20220928225711_schedule_update_ci_pipeline_artifacts_locked_status.rb b/db/post_migrate/20220928225711_schedule_update_ci_pipeline_artifacts_locked_status.rb
deleted file mode 100644
index 0d7a5dc4bec..00000000000
--- a/db/post_migrate/20220928225711_schedule_update_ci_pipeline_artifacts_locked_status.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleUpdateCiPipelineArtifactsLockedStatus < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- MIGRATION = 'UpdateCiPipelineArtifactsUnknownLockedStatus'
- DELAY_INTERVAL = 2.minutes
- BATCH_SIZE = 1_000
- SUB_BATCH_SIZE = 500
-
- restrict_gitlab_migration gitlab_schema: :gitlab_ci
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- :ci_pipeline_artifacts,
- :id,
- job_interval: DELAY_INTERVAL,
- batch_size: BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :ci_pipeline_artifacts, :id, [])
- end
-end
diff --git a/db/post_migrate/20220929081645_tmp_idx_null_member_namespace_id.rb b/db/post_migrate/20220929081645_tmp_idx_null_member_namespace_id.rb
deleted file mode 100644
index 58d6c653e6f..00000000000
--- a/db/post_migrate/20220929081645_tmp_idx_null_member_namespace_id.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class TmpIdxNullMemberNamespaceId < Gitlab::Database::Migration[2.0]
- TMP_INDEX_FOR_NULL_MEMBER_NAMESPACE_ID = 'tmp_index_for_null_member_namespace_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :members, :member_namespace_id,
- name: TMP_INDEX_FOR_NULL_MEMBER_NAMESPACE_ID,
- where: 'member_namespace_id IS NULL'
- end
-
- def down
- remove_concurrent_index_by_name :members, name: TMP_INDEX_FOR_NULL_MEMBER_NAMESPACE_ID
- end
-end
diff --git a/db/post_migrate/20220929091500_add_tmp_index_vulns_on_report_type.rb b/db/post_migrate/20220929091500_add_tmp_index_vulns_on_report_type.rb
deleted file mode 100644
index 19100e1d0cc..00000000000
--- a/db/post_migrate/20220929091500_add_tmp_index_vulns_on_report_type.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-class AddTmpIndexVulnsOnReportType < Gitlab::Database::Migration[2.0]
- # Temporary index to perform migration removing invalid vulnerabilities
- INDEX_NAME = 'tmp_idx_vulnerabilities_on_id_where_report_type_7_99'
-
- REPORT_TYPES = {
- cluster_image_scanning: 7,
- custom: 99
- }
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :vulnerabilities, :id,
- where: "report_type IN (#{REPORT_TYPES.values.join(', ')})",
- name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220929101947_delete_remove_invalid_member_migration.rb b/db/post_migrate/20220929101947_delete_remove_invalid_member_migration.rb
deleted file mode 100644
index 6fb358e57ab..00000000000
--- a/db/post_migrate/20220929101947_delete_remove_invalid_member_migration.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class DeleteRemoveInvalidMemberMigration < Gitlab::Database::Migration[2.0]
- PROJECT_MEMBER_MIGRATION = 'ScheduleDestroyInvalidProjectMembers'
- GROUP_MEMBER_MIGRATION = 'ScheduleDestroyInvalidGroupMembers'
-
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- delete_batched_background_migration(PROJECT_MEMBER_MIGRATION, :members, :id, [])
- delete_batched_background_migration(GROUP_MEMBER_MIGRATION, :members, :id, [])
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20220929194453_add_index_releases_project_id_id.rb b/db/post_migrate/20220929194453_add_index_releases_project_id_id.rb
deleted file mode 100644
index 179b5a636f0..00000000000
--- a/db/post_migrate/20220929194453_add_index_releases_project_id_id.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexReleasesProjectIdId < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'index_releases_on_project_id_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :releases, %i[project_id id], name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :releases, name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20220929213730_schedule_delete_orphaned_operational_vulnerabilities.rb b/db/post_migrate/20220929213730_schedule_delete_orphaned_operational_vulnerabilities.rb
deleted file mode 100644
index c03358b1fda..00000000000
--- a/db/post_migrate/20220929213730_schedule_delete_orphaned_operational_vulnerabilities.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleDeleteOrphanedOperationalVulnerabilities < Gitlab::Database::Migration[2.0]
- MIGRATION = 'DeleteOrphanedOperationalVulnerabilities'
- INTERVAL = 2.minutes
- BATCH_SIZE = 10_000
-
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- :vulnerabilities,
- :id,
- job_interval: INTERVAL,
- batch_size: BATCH_SIZE
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :vulnerabilities, :id, [])
- end
-end
diff --git a/db/post_migrate/20220930110127_remove_unique_index_build_id_to_ci_builds_metadata.rb b/db/post_migrate/20220930110127_remove_unique_index_build_id_to_ci_builds_metadata.rb
deleted file mode 100644
index 4c23cdc5284..00000000000
--- a/db/post_migrate/20220930110127_remove_unique_index_build_id_to_ci_builds_metadata.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveUniqueIndexBuildIdToCiBuildsMetadata < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- TABLE_NAME = :ci_builds_metadata
- INDEX_NAME = :index_ci_builds_metadata_on_build_id
-
- def up
- remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME)
- end
-
- def down
- add_concurrent_index(TABLE_NAME, :build_id, unique: true, name: INDEX_NAME)
- end
-end
diff --git a/db/post_migrate/20221002234454_finalize_group_member_namespace_id_migration.rb b/db/post_migrate/20221002234454_finalize_group_member_namespace_id_migration.rb
deleted file mode 100644
index 9c5ca6cbb42..00000000000
--- a/db/post_migrate/20221002234454_finalize_group_member_namespace_id_migration.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class FinalizeGroupMemberNamespaceIdMigration < Gitlab::Database::Migration[2.0]
- MIGRATION = 'BackfillMemberNamespaceForGroupMembers'
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- ensure_batched_background_migration_is_finished(
- job_class_name: MIGRATION,
- table_name: :members,
- column_name: :id,
- job_arguments: [],
- finalize: true
- )
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20221003192827_add_index_resolved_on_default_branch_to_vulnerabilities_read.rb b/db/post_migrate/20221003192827_add_index_resolved_on_default_branch_to_vulnerabilities_read.rb
deleted file mode 100644
index e352e324187..00000000000
--- a/db/post_migrate/20221003192827_add_index_resolved_on_default_branch_to_vulnerabilities_read.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexResolvedOnDefaultBranchToVulnerabilitiesRead < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_vuln_reads_on_resolved_on_default_branch'
- COLUMNS = %i[project_id state id]
-
- def up
- add_concurrent_index :vulnerability_reads, COLUMNS,
- where: 'resolved_on_default_branch IS TRUE',
- name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221004074910_routing_table_prepare_constraint_for_builds_metadata.rb b/db/post_migrate/20221004074910_routing_table_prepare_constraint_for_builds_metadata.rb
deleted file mode 100644
index 013984154ae..00000000000
--- a/db/post_migrate/20221004074910_routing_table_prepare_constraint_for_builds_metadata.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-class RoutingTablePrepareConstraintForBuildsMetadata < Gitlab::Database::Migration[2.0]
- include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers
-
- disable_ddl_transaction!
-
- TABLE_NAME = :ci_builds_metadata
- PARENT_TABLE_NAME = :p_ci_builds_metadata
- FIRST_PARTITION = 100
- PARTITION_COLUMN = :partition_id
-
- def up
- prepare_constraint_for_list_partitioning(
- table_name: TABLE_NAME,
- partitioning_column: PARTITION_COLUMN,
- parent_table_name: PARENT_TABLE_NAME,
- initial_partitioning_value: FIRST_PARTITION
- )
- end
-
- def down
- revert_preparing_constraint_for_list_partitioning(
- table_name: TABLE_NAME,
- partitioning_column: PARTITION_COLUMN,
- parent_table_name: PARENT_TABLE_NAME,
- initial_partitioning_value: FIRST_PARTITION
- )
- end
-end
diff --git a/db/post_migrate/20221004074914_create_routing_table_for_builds_metadata.rb b/db/post_migrate/20221004074914_create_routing_table_for_builds_metadata.rb
deleted file mode 100644
index a792fc91d3d..00000000000
--- a/db/post_migrate/20221004074914_create_routing_table_for_builds_metadata.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class CreateRoutingTableForBuildsMetadata < Gitlab::Database::Migration[2.0]
- def up; end
-
- def down; end
-end
diff --git a/db/post_migrate/20221004092038_tmp_index_members_on_id_where_namespace_id_null.rb b/db/post_migrate/20221004092038_tmp_index_members_on_id_where_namespace_id_null.rb
deleted file mode 100644
index 68a707e99c2..00000000000
--- a/db/post_migrate/20221004092038_tmp_index_members_on_id_where_namespace_id_null.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class TmpIndexMembersOnIdWhereNamespaceIdNull < Gitlab::Database::Migration[2.0]
- TMP_INDEX = 'tmp_index_members_on_id_where_namespace_id_null'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :members, :id,
- name: TMP_INDEX,
- where: 'member_namespace_id IS NULL'
- end
-
- def down
- remove_concurrent_index_by_name :members, name: TMP_INDEX
- end
-end
diff --git a/db/post_migrate/20221004094814_schedule_destroy_invalid_members.rb b/db/post_migrate/20221004094814_schedule_destroy_invalid_members.rb
deleted file mode 100644
index fa6a1fd5f72..00000000000
--- a/db/post_migrate/20221004094814_schedule_destroy_invalid_members.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-class ScheduleDestroyInvalidMembers < Gitlab::Database::Migration[2.0]
- MIGRATION = 'DestroyInvalidMembers'
- DELAY_INTERVAL = 2.minutes
- BATCH_SIZE = 1_000
- MAX_BATCH_SIZE = 10_000
- SUB_BATCH_SIZE = 200
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- :members,
- :id,
- job_interval: DELAY_INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE,
- gitlab_schema: :gitlab_main
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :members, :id, [])
- end
-end
diff --git a/db/post_migrate/20221005103000_add_index_merge_request_id_on_scan_finding_approval_merge_request_rules.rb b/db/post_migrate/20221005103000_add_index_merge_request_id_on_scan_finding_approval_merge_request_rules.rb
deleted file mode 100644
index 06bf21b894a..00000000000
--- a/db/post_migrate/20221005103000_add_index_merge_request_id_on_scan_finding_approval_merge_request_rules.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexMergeRequestIdOnScanFindingApprovalMergeRequestRules < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'scan_finding_approval_mr_rule_index_merge_request_id'
- SCAN_FINDING_REPORT_TYPE = 4
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :approval_merge_request_rules, :merge_request_id,
- where: "report_type = #{SCAN_FINDING_REPORT_TYPE}", name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :approval_merge_request_rules, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221006070927_finalize_invalid_member_cleanup.rb b/db/post_migrate/20221006070927_finalize_invalid_member_cleanup.rb
deleted file mode 100644
index 78786e46f5c..00000000000
--- a/db/post_migrate/20221006070927_finalize_invalid_member_cleanup.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class FinalizeInvalidMemberCleanup < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- MIGRATION = 'DestroyInvalidMembers'
-
- def up
- ensure_batched_background_migration_is_finished(
- job_class_name: MIGRATION,
- table_name: :members,
- column_name: :id,
- job_arguments: []
- )
- end
-
- def down
- # noop
- end
-end
diff --git a/db/post_migrate/20221006083240_prepare_partial_trigram_indexes_for_issues_attempt_2.rb b/db/post_migrate/20221006083240_prepare_partial_trigram_indexes_for_issues_attempt_2.rb
deleted file mode 100644
index 6ca2ba222ae..00000000000
--- a/db/post_migrate/20221006083240_prepare_partial_trigram_indexes_for_issues_attempt_2.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class PreparePartialTrigramIndexesForIssuesAttempt2 < Gitlab::Database::Migration[2.0]
- TITLE_INDEX_NAME = 'index_issues_on_title_trigram_non_latin'
- DESCRIPTION_INDEX_NAME = 'index_issues_on_description_trigram_non_latin'
-
- def up
- prepare_async_index :issues, :title,
- name: TITLE_INDEX_NAME,
- using: :gin, opclass: { description: :gin_trgm_ops },
- where: "title NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*' " \
- "OR description NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*'"
-
- prepare_async_index :issues, :description,
- name: DESCRIPTION_INDEX_NAME,
- using: :gin, opclass: { description: :gin_trgm_ops },
- where: "title NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*' " \
- "OR description NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*'"
- end
-
- def down
- unprepare_async_index_by_name :issues, DESCRIPTION_INDEX_NAME
- unprepare_async_index_by_name :issues, TITLE_INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221006172302_adjust_task_note_rename_background_migration_values.rb b/db/post_migrate/20221006172302_adjust_task_note_rename_background_migration_values.rb
deleted file mode 100644
index b582b163e2d..00000000000
--- a/db/post_migrate/20221006172302_adjust_task_note_rename_background_migration_values.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-# frozen_string_literal: true
-
-class AdjustTaskNoteRenameBackgroundMigrationValues < Gitlab::Database::Migration[2.0]
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- JOB_CLASS_NAME = 'RenameTaskSystemNoteToChecklistItem'
- MIGRATION_FAILED_STATUS = 4
- MIGRATION_FINISHED_STATUS = 3
- MIGRATION_ACTIVE_STATUS = 1
- JOB_FAILED_STATUS = 2
-
- OLD_BATCH_SIZE = 10_000
- NEW_BATCH_SIZE = 5_000
-
- OLD_SUB_BATCH_SIZE = 100
- NEW_SUB_BATCH_SIZE = 10
-
- class InlineBatchedMigration < MigrationRecord
- self.table_name = :batched_background_migrations
-
- scope :for_configuration, ->(job_class_name, table_name, column_name, job_arguments) do
- where(job_class_name: job_class_name, table_name: table_name, column_name: column_name)
- .where("job_arguments = ?", Gitlab::Json.dump(job_arguments)) # rubocop:disable Rails/WhereEquals
- end
- end
-
- class InlineBatchedJob < MigrationRecord
- include EachBatch
- self.table_name = :batched_background_migration_jobs
- end
-
- def up
- migration = InlineBatchedMigration.for_configuration(
- JOB_CLASS_NAME,
- :system_note_metadata,
- :id,
- []
- ).first
- return if migration.blank? || migration.status == MIGRATION_FINISHED_STATUS
-
- InlineBatchedJob.where(
- batched_background_migration_id: migration.id,
- status: JOB_FAILED_STATUS
- ).each_batch(of: 100) do |batch|
- batch.update_all(attempts: 0, sub_batch_size: NEW_SUB_BATCH_SIZE)
- end
-
- update_params = { batch_size: NEW_BATCH_SIZE, sub_batch_size: NEW_SUB_BATCH_SIZE }
-
- if migration.status == MIGRATION_FAILED_STATUS
- update_params[:status] = MIGRATION_ACTIVE_STATUS
- update_params[:started_at] = Time.zone.now if migration.respond_to?(:started_at)
- end
-
- migration.update!(**update_params)
- end
-
- def down
- migration = InlineBatchedMigration.for_configuration(
- JOB_CLASS_NAME,
- :system_note_metadata,
- :id,
- []
- ).first
- return if migration.blank?
-
- migration.update!(
- batch_size: OLD_BATCH_SIZE,
- sub_batch_size: OLD_SUB_BATCH_SIZE
- )
- end
-end
diff --git a/db/post_migrate/20221010074914_migrate_security_findings_delete_queues.rb b/db/post_migrate/20221010074914_migrate_security_findings_delete_queues.rb
deleted file mode 100644
index ce593e19859..00000000000
--- a/db/post_migrate/20221010074914_migrate_security_findings_delete_queues.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class MigrateSecurityFindingsDeleteQueues < Gitlab::Database::Migration[2.0]
- restrict_gitlab_migration gitlab_schema: :gitlab_main
- disable_ddl_transaction!
-
- def up
- sidekiq_queue_migrate 'security_findings_delete_by_job_id', to: 'security_scans_purge_by_job_id'
- sidekiq_queue_migrate 'cronjob:security_findings_cleanup', to: 'cronjob:security_scans_purge'
- end
-
- def down
- sidekiq_queue_migrate 'security_scans_purge_by_job_id', to: 'security_findings_delete_by_job_id'
- sidekiq_queue_migrate 'cronjob:security_scans_purge', to: 'cronjob:security_findings_cleanup'
- end
-end
diff --git a/db/post_migrate/20221010121510_prepare_async_index_author_id_target_project_id_on_merge_requests.rb b/db/post_migrate/20221010121510_prepare_async_index_author_id_target_project_id_on_merge_requests.rb
deleted file mode 100644
index cd9035dd9f9..00000000000
--- a/db/post_migrate/20221010121510_prepare_async_index_author_id_target_project_id_on_merge_requests.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class PrepareAsyncIndexAuthorIdTargetProjectIdOnMergeRequests < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'index_merge_requests_on_author_id_and_target_project_id'
-
- disable_ddl_transaction!
-
- def up
- prepare_async_index :merge_requests, %i[author_id target_project_id], name: INDEX_NAME
- end
-
- def down
- unprepare_async_index :merge_requests, %i[author_id target_project_id], name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221010122138_add_async_index_author_id_target_project_id_on_merge_requests.rb b/db/post_migrate/20221010122138_add_async_index_author_id_target_project_id_on_merge_requests.rb
deleted file mode 100644
index 0689c090d09..00000000000
--- a/db/post_migrate/20221010122138_add_async_index_author_id_target_project_id_on_merge_requests.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddAsyncIndexAuthorIdTargetProjectIdOnMergeRequests < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'index_merge_requests_on_author_id_and_id'
-
- disable_ddl_transaction!
-
- def up
- prepare_async_index :merge_requests, %i[author_id id], name: INDEX_NAME
- end
-
- def down
- unprepare_async_index :merge_requests, %i[author_id id], name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221010122352_add_index_to_namespace_settings_on_default_compliance_framework_id.rb b/db/post_migrate/20221010122352_add_index_to_namespace_settings_on_default_compliance_framework_id.rb
deleted file mode 100644
index 63de7942208..00000000000
--- a/db/post_migrate/20221010122352_add_index_to_namespace_settings_on_default_compliance_framework_id.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToNamespaceSettingsOnDefaultComplianceFrameworkId < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'idx_namespace_settings_on_default_compliance_framework_id'
-
- def up
- add_concurrent_index :namespace_settings, :default_compliance_framework_id, unique: true, name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index :namespace_settings, :default_compliance_framework_id, name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221010123040_add_compliance_framework_fk_to_namespace_settings.rb b/db/post_migrate/20221010123040_add_compliance_framework_fk_to_namespace_settings.rb
deleted file mode 100644
index 5d4966fd580..00000000000
--- a/db/post_migrate/20221010123040_add_compliance_framework_fk_to_namespace_settings.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddComplianceFrameworkFkToNamespaceSettings < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :namespace_settings, :compliance_management_frameworks,
- column: :default_compliance_framework_id, on_delete: :nullify, reverse_lock_order: true
- end
-
- def down
- with_lock_retries do
- remove_foreign_key :namespace_settings, column: :default_compliance_framework_id
- end
- end
-end
diff --git a/db/post_migrate/20221010141500_add_index_author_id_target_project_id_on_merge_requests.rb b/db/post_migrate/20221010141500_add_index_author_id_target_project_id_on_merge_requests.rb
deleted file mode 100644
index 5b9d5be2b3f..00000000000
--- a/db/post_migrate/20221010141500_add_index_author_id_target_project_id_on_merge_requests.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexAuthorIdTargetProjectIdOnMergeRequests < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'index_merge_requests_on_author_id_and_target_project_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :merge_requests, %i[author_id target_project_id], name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :merge_requests, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221010162137_add_index_author_id_and_id_on_merge_requests.rb b/db/post_migrate/20221010162137_add_index_author_id_and_id_on_merge_requests.rb
deleted file mode 100644
index 36184b5f573..00000000000
--- a/db/post_migrate/20221010162137_add_index_author_id_and_id_on_merge_requests.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexAuthorIdAndIdOnMergeRequests < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'index_merge_requests_on_author_id_and_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :merge_requests, %i[author_id id], name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :merge_requests, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221011062254_sync_new_amount_used_for_ci_project_monthly_usages.rb b/db/post_migrate/20221011062254_sync_new_amount_used_for_ci_project_monthly_usages.rb
deleted file mode 100644
index 32943f10fcf..00000000000
--- a/db/post_migrate/20221011062254_sync_new_amount_used_for_ci_project_monthly_usages.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class SyncNewAmountUsedForCiProjectMonthlyUsages < Gitlab::Database::Migration[2.0]
- restrict_gitlab_migration gitlab_schema: :gitlab_ci
-
- def up
- project_usages = define_batchable_model('ci_project_monthly_usages')
-
- project_usages.each_batch(of: 500) do |batch|
- batch.where('amount_used > 0').update_all('new_amount_used = amount_used')
- end
- end
-
- def down
- # Non reversible migration.
- # This data migration keeps `new_amount_used` in sync with the old `amount_used`.
- # In case of failure or interruption the migration can be retried.
- end
-end
diff --git a/db/post_migrate/20221011113928_redo_remove_and_add_ci_job_variables_raw_with_new_default.rb b/db/post_migrate/20221011113928_redo_remove_and_add_ci_job_variables_raw_with_new_default.rb
deleted file mode 100644
index a377b78803e..00000000000
--- a/db/post_migrate/20221011113928_redo_remove_and_add_ci_job_variables_raw_with_new_default.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-class RedoRemoveAndAddCiJobVariablesRawWithNewDefault < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- # We are removing and adding the same column with the same parameters to refresh the table
- # because we have some wrong `ci_job_variables.raw` data (`TRUE`) in the database.
- def change
- remove_column :ci_job_variables, :raw, :boolean, null: false, default: false
- add_column :ci_job_variables, :raw, :boolean, null: false, default: false
- end
-end
diff --git a/db/post_migrate/20221012182701_remove_namespace_settings_cohort_free_user_cap_columns.rb b/db/post_migrate/20221012182701_remove_namespace_settings_cohort_free_user_cap_columns.rb
deleted file mode 100644
index 36408ad19ed..00000000000
--- a/db/post_migrate/20221012182701_remove_namespace_settings_cohort_free_user_cap_columns.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveNamespaceSettingsCohortFreeUserCapColumns < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- def up
- remove_column :namespace_settings, :exclude_from_free_user_cap
- remove_column :namespace_settings, :include_for_free_user_cap_preview
- end
-
- def down
- add_column :namespace_settings, :exclude_from_free_user_cap, :boolean, null: false, default: false
- add_column :namespace_settings, :include_for_free_user_cap_preview, :boolean, null: false, default: false
- end
-end
diff --git a/db/post_migrate/20221013154159_update_invalid_dormant_user_setting.rb b/db/post_migrate/20221013154159_update_invalid_dormant_user_setting.rb
deleted file mode 100644
index 1f1e47fdac1..00000000000
--- a/db/post_migrate/20221013154159_update_invalid_dormant_user_setting.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class UpdateInvalidDormantUserSetting < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- # rubocop:disable Layout/LineLength
- def up
- execute("update application_settings set deactivate_dormant_users_period=90 where deactivate_dormant_users_period < 90")
- end
- # rubocop:enable Layout/LineLength
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20221013215832_cleanup_vulnerability_state_transitions_with_same_from_state_to_state.rb b/db/post_migrate/20221013215832_cleanup_vulnerability_state_transitions_with_same_from_state_to_state.rb
deleted file mode 100644
index a81a80deb25..00000000000
--- a/db/post_migrate/20221013215832_cleanup_vulnerability_state_transitions_with_same_from_state_to_state.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class CleanupVulnerabilityStateTransitionsWithSameFromStateToState < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- class VulnerabilityStateTransition < MigrationRecord
- self.table_name = 'vulnerability_state_transitions'
- end
-
- def up
- VulnerabilityStateTransition.where('from_state = to_state').delete_all
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20221017084227_cleanup_rename_ci_pipeline_metadata_title.rb b/db/post_migrate/20221017084227_cleanup_rename_ci_pipeline_metadata_title.rb
deleted file mode 100644
index 0829f3d8734..00000000000
--- a/db/post_migrate/20221017084227_cleanup_rename_ci_pipeline_metadata_title.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class CleanupRenameCiPipelineMetadataTitle < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- cleanup_concurrent_column_rename :ci_pipeline_metadata, :title, :name
- end
-
- def down
- undo_cleanup_concurrent_column_rename :ci_pipeline_metadata, :title, :name, batch_column_name: :pipeline_id
- end
-end
diff --git a/db/post_migrate/20221018062308_schedule_backfill_project_namespace_details.rb b/db/post_migrate/20221018062308_schedule_backfill_project_namespace_details.rb
deleted file mode 100644
index 74c8ef37ac2..00000000000
--- a/db/post_migrate/20221018062308_schedule_backfill_project_namespace_details.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleBackfillProjectNamespaceDetails < Gitlab::Database::Migration[2.0]
- MIGRATION = 'BackfillProjectNamespaceDetails'
- INTERVAL = 2.minutes
- BATCH_SIZE = 1_000
- MAX_BATCH_SIZE = 10_000
- SUB_BATCH_SIZE = 200
-
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- :projects,
- :id,
- job_interval: INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :projects, :id, [])
- end
-end
diff --git a/db/post_migrate/20221018193635_ensure_task_note_renaming_background_migration_finished.rb b/db/post_migrate/20221018193635_ensure_task_note_renaming_background_migration_finished.rb
deleted file mode 100644
index c6ae0f185d8..00000000000
--- a/db/post_migrate/20221018193635_ensure_task_note_renaming_background_migration_finished.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class EnsureTaskNoteRenamingBackgroundMigrationFinished < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- MIGRATION = 'RenameTaskSystemNoteToChecklistItem'
-
- def up
- ensure_batched_background_migration_is_finished(
- job_class_name: MIGRATION,
- table_name: :system_note_metadata,
- column_name: :id,
- job_arguments: []
- )
- end
-
- def down
- # noop
- end
-end
diff --git a/db/post_migrate/20221018193827_drop_tmp_index_system_note_metadata_on_id_where_task.rb b/db/post_migrate/20221018193827_drop_tmp_index_system_note_metadata_on_id_where_task.rb
deleted file mode 100644
index 5cc70c530c6..00000000000
--- a/db/post_migrate/20221018193827_drop_tmp_index_system_note_metadata_on_id_where_task.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class DropTmpIndexSystemNoteMetadataOnIdWhereTask < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'tmp_index_system_note_metadata_on_id_where_task'
-
- def up
- remove_concurrent_index_by_name :system_note_metadata, INDEX_NAME
- end
-
- def down
- add_concurrent_index :system_note_metadata, [:id, :action], where: "action = 'task'", name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221018232820_add_temp_index_for_user_details_fields.rb b/db/post_migrate/20221018232820_add_temp_index_for_user_details_fields.rb
deleted file mode 100644
index 1cb93886ca3..00000000000
--- a/db/post_migrate/20221018232820_add_temp_index_for_user_details_fields.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class AddTempIndexForUserDetailsFields < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'tmp_idx_where_user_details_fields_filled'
-
- disable_ddl_transaction!
-
- def up
- # rubocop:disable Migration/PreventIndexCreation
- add_concurrent_index :users, :id, name: INDEX_NAME, where: <<~QUERY
- (COALESCE(linkedin, '') IS DISTINCT FROM '')
- OR (COALESCE(twitter, '') IS DISTINCT FROM '')
- OR (COALESCE(skype, '') IS DISTINCT FROM '')
- OR (COALESCE(website_url, '') IS DISTINCT FROM '')
- OR (COALESCE(location, '') IS DISTINCT FROM '')
- OR (COALESCE(organization, '') IS DISTINCT FROM '')
- QUERY
- # rubocop:enable Migration/PreventIndexCreation
- end
-
- def down
- remove_concurrent_index_by_name :users, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221019002459_queue_backfill_user_details_fields.rb b/db/post_migrate/20221019002459_queue_backfill_user_details_fields.rb
deleted file mode 100644
index 8ed4416a98d..00000000000
--- a/db/post_migrate/20221019002459_queue_backfill_user_details_fields.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class QueueBackfillUserDetailsFields < Gitlab::Database::Migration[2.0]
- MIGRATION = 'BackfillUserDetailsFields'
- INTERVAL = 2.minutes
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- queue_batched_background_migration(MIGRATION, :users, :id, job_interval: INTERVAL)
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :users, :id, [])
- end
-end
diff --git a/db/post_migrate/20221019102426_remove_tmp_index_approval_merge_request_rules_on_report_type.rb b/db/post_migrate/20221019102426_remove_tmp_index_approval_merge_request_rules_on_report_type.rb
deleted file mode 100644
index 7203d35de92..00000000000
--- a/db/post_migrate/20221019102426_remove_tmp_index_approval_merge_request_rules_on_report_type.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveTmpIndexApprovalMergeRequestRulesOnReportType < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'tmp_index_approval_merge_request_rules_on_report_type_equal_one'
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :approval_merge_request_rules, INDEX_NAME
- end
-
- def down
- add_concurrent_index :approval_merge_request_rules,
- [:id, :report_type],
- name: INDEX_NAME,
- where: "report_type = 1"
- end
-end
diff --git a/db/post_migrate/20221019105041_queue_populate_projects_star_count.rb b/db/post_migrate/20221019105041_queue_populate_projects_star_count.rb
deleted file mode 100644
index 768e0c7826f..00000000000
--- a/db/post_migrate/20221019105041_queue_populate_projects_star_count.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class QueuePopulateProjectsStarCount < Gitlab::Database::Migration[2.0]
- MIGRATION = 'PopulateProjectsStarCount'
- DELAY_INTERVAL = 2.minutes
-
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- :projects,
- :id,
- job_interval: DELAY_INTERVAL,
- sub_batch_size: 50
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :projects, :id, [])
- end
-end
diff --git a/db/post_migrate/20221019141508_add_index_to_test_reports_issue_id_created_at_and_id.rb b/db/post_migrate/20221019141508_add_index_to_test_reports_issue_id_created_at_and_id.rb
deleted file mode 100644
index 054512adf2e..00000000000
--- a/db/post_migrate/20221019141508_add_index_to_test_reports_issue_id_created_at_and_id.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToTestReportsIssueIdCreatedAtAndId < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- TABLE_NAME = 'requirements_management_test_reports'
- INDEX_NAME = 'idx_test_reports_on_issue_id_created_at_and_id'
-
- def up
- add_concurrent_index TABLE_NAME, [:issue_id, :created_at, :id], name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221019194751_disable_fastupdate_on_issues_title_gin_index.rb b/db/post_migrate/20221019194751_disable_fastupdate_on_issues_title_gin_index.rb
deleted file mode 100644
index 64d935489c2..00000000000
--- a/db/post_migrate/20221019194751_disable_fastupdate_on_issues_title_gin_index.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class DisableFastupdateOnIssuesTitleGinIndex < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_issues_on_title_trigram'
-
- def up
- return unless index_exists_by_name?(:issues, INDEX_NAME)
-
- with_lock_retries do
- execute <<~SQL
- ALTER INDEX #{INDEX_NAME} SET ( fastupdate = false ) ;
- SQL
- end
- end
-
- def down
- return unless index_exists_by_name?(:issues, INDEX_NAME)
-
- with_lock_retries do
- execute <<~SQL
- ALTER INDEX #{INDEX_NAME} RESET ( fastupdate ) ;
- SQL
- end
- end
-end
diff --git a/db/post_migrate/20221019195754_disable_fastupdate_on_issues_description_gin_index.rb b/db/post_migrate/20221019195754_disable_fastupdate_on_issues_description_gin_index.rb
deleted file mode 100644
index 8822cb3b414..00000000000
--- a/db/post_migrate/20221019195754_disable_fastupdate_on_issues_description_gin_index.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class DisableFastupdateOnIssuesDescriptionGinIndex < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_issues_on_description_trigram'
-
- def up
- return unless index_exists_by_name?(:issues, INDEX_NAME)
-
- with_lock_retries do
- execute <<~SQL
- ALTER INDEX #{INDEX_NAME} SET ( fastupdate = false ) ;
- SQL
- end
- end
-
- def down
- return unless index_exists_by_name?(:issues, INDEX_NAME)
-
- with_lock_retries do
- execute <<~SQL
- ALTER INDEX #{INDEX_NAME} RESET ( fastupdate ) ;
- SQL
- end
- end
-end
diff --git a/db/post_migrate/20221019200033_disable_fastupdate_on_merge_requests_title_gin_index.rb b/db/post_migrate/20221019200033_disable_fastupdate_on_merge_requests_title_gin_index.rb
deleted file mode 100644
index 3e1124dc2bb..00000000000
--- a/db/post_migrate/20221019200033_disable_fastupdate_on_merge_requests_title_gin_index.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class DisableFastupdateOnMergeRequestsTitleGinIndex < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_merge_requests_on_title_trigram'
-
- def up
- return unless index_exists_by_name?(:merge_requests, INDEX_NAME)
-
- with_lock_retries do
- execute <<~SQL
- ALTER INDEX #{INDEX_NAME} SET ( fastupdate = false ) ;
- SQL
- end
- end
-
- def down
- return unless index_exists_by_name?(:merge_requests, INDEX_NAME)
-
- with_lock_retries do
- execute <<~SQL
- ALTER INDEX #{INDEX_NAME} RESET ( fastupdate ) ;
- SQL
- end
- end
-end
diff --git a/db/post_migrate/20221019200206_disable_fastupdate_on_merge_requests_description_gin_index.rb b/db/post_migrate/20221019200206_disable_fastupdate_on_merge_requests_description_gin_index.rb
deleted file mode 100644
index 7ab6f40e206..00000000000
--- a/db/post_migrate/20221019200206_disable_fastupdate_on_merge_requests_description_gin_index.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class DisableFastupdateOnMergeRequestsDescriptionGinIndex < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_merge_requests_on_description_trigram'
-
- def up
- return unless index_exists_by_name?(:merge_requests, INDEX_NAME)
-
- with_lock_retries do
- execute <<~SQL
- ALTER INDEX #{INDEX_NAME} SET ( fastupdate = false ) ;
- SQL
- end
- end
-
- def down
- return unless index_exists_by_name?(:merge_requests, INDEX_NAME)
-
- with_lock_retries do
- execute <<~SQL
- ALTER INDEX #{INDEX_NAME} RESET ( fastupdate ) ;
- SQL
- end
- end
-end
diff --git a/db/post_migrate/20221021082720_drop_index_on_ci_runners_token.rb b/db/post_migrate/20221021082720_drop_index_on_ci_runners_token.rb
deleted file mode 100644
index 9125831fbf3..00000000000
--- a/db/post_migrate/20221021082720_drop_index_on_ci_runners_token.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class DropIndexOnCiRunnersToken < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_ci_runners_on_token'
-
- def up
- remove_concurrent_index_by_name :ci_runners, INDEX_NAME
- end
-
- def down
- add_concurrent_index :ci_runners,
- :token,
- name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221021082734_drop_index_on_ci_runners_token_encrypted.rb b/db/post_migrate/20221021082734_drop_index_on_ci_runners_token_encrypted.rb
deleted file mode 100644
index 39771fb5f85..00000000000
--- a/db/post_migrate/20221021082734_drop_index_on_ci_runners_token_encrypted.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class DropIndexOnCiRunnersTokenEncrypted < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_ci_runners_on_token_encrypted'
-
- def up
- remove_concurrent_index_by_name :ci_runners, INDEX_NAME
- end
-
- def down
- add_concurrent_index :ci_runners,
- :token_encrypted,
- name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221021145820_create_routing_table_for_builds_metadata_v2.rb b/db/post_migrate/20221021145820_create_routing_table_for_builds_metadata_v2.rb
deleted file mode 100644
index e5f1ba5cb87..00000000000
--- a/db/post_migrate/20221021145820_create_routing_table_for_builds_metadata_v2.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-# frozen_string_literal: true
-
-class CreateRoutingTableForBuildsMetadataV2 < Gitlab::Database::Migration[2.0]
- include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers
-
- disable_ddl_transaction!
-
- TABLE_NAME = :ci_builds_metadata
- PARENT_TABLE_NAME = :p_ci_builds_metadata
- FIRST_PARTITION = 100
- PARTITION_COLUMN = :partition_id
-
- def up
- return if connection.table_exists?(PARENT_TABLE_NAME) && partition_attached?
-
- convert_table_to_first_list_partition(
- table_name: TABLE_NAME,
- partitioning_column: PARTITION_COLUMN,
- parent_table_name: PARENT_TABLE_NAME,
- initial_partitioning_value: FIRST_PARTITION,
- lock_tables: [:ci_builds, :ci_builds_metadata]
- )
- end
-
- def down
- revert_converting_table_to_first_list_partition(
- table_name: TABLE_NAME,
- partitioning_column: PARTITION_COLUMN,
- parent_table_name: PARENT_TABLE_NAME,
- initial_partitioning_value: FIRST_PARTITION
- )
- end
-
- private
-
- def partition_attached?
- connection.select_value(<<~SQL)
- SELECT true FROM postgres_partitions WHERE name = '#{TABLE_NAME}';
- SQL
- end
-end
diff --git a/db/post_migrate/20221021160735_add_index_for_common_finder_query_desc_with_namespace_id.rb b/db/post_migrate/20221021160735_add_index_for_common_finder_query_desc_with_namespace_id.rb
deleted file mode 100644
index d7c50010b72..00000000000
--- a/db/post_migrate/20221021160735_add_index_for_common_finder_query_desc_with_namespace_id.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexForCommonFinderQueryDescWithNamespaceId < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'index_group_vulnerability_reads_common_finder_query_desc'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :vulnerability_reads,
- [:namespace_id, :state, :report_type, :severity, :vulnerability_id],
- name: INDEX_NAME,
- order: { severity: :desc, vulnerability_id: :desc }
- end
-
- def down
- remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221024034228_remove_sprints_project_id_column.rb b/db/post_migrate/20221024034228_remove_sprints_project_id_column.rb
deleted file mode 100644
index e30d6dce497..00000000000
--- a/db/post_migrate/20221024034228_remove_sprints_project_id_column.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveSprintsProjectIdColumn < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- DATERANGE_CONSTRAINT_NAME = 'iteration_start_and_due_daterange_project_id_constraint'
-
- def up
- with_lock_retries do
- remove_column :sprints, :project_id, :bigint if column_exists?(:sprints, :project_id)
- end
- end
-
- def down
- with_lock_retries do
- add_column :sprints, :project_id, :bigint unless column_exists?(:sprints, :project_id)
- end
-
- with_lock_retries do
- next if check_constraint_exists?(:sprints, DATERANGE_CONSTRAINT_NAME)
-
- execute(<<~SQL)
- ALTER TABLE sprints
- ADD CONSTRAINT #{DATERANGE_CONSTRAINT_NAME}
- EXCLUDE USING gist (project_id WITH =, daterange(start_date, due_date, '[]'::text) WITH &&)
- WHERE (project_id IS NOT NULL)
- SQL
- end
-
- add_check_constraint(:sprints,
- 'project_id <> NULL::bigint AND group_id IS NULL OR group_id <> NULL::bigint AND project_id IS NULL',
- 'sprints_must_belong_to_project_or_group')
-
- add_concurrent_index :sprints, [:project_id, :iid], unique: true, name: 'index_sprints_on_project_id_and_iid'
-
- add_concurrent_foreign_key :sprints, :projects, column: :project_id, on_delete: :cascade
- end
-end
diff --git a/db/post_migrate/20221024121500_drop_fingerprint_from_sbom_sources.rb b/db/post_migrate/20221024121500_drop_fingerprint_from_sbom_sources.rb
deleted file mode 100644
index 83856cbe5dd..00000000000
--- a/db/post_migrate/20221024121500_drop_fingerprint_from_sbom_sources.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class DropFingerprintFromSbomSources < Gitlab::Database::Migration[2.0]
- enable_lock_retries!
-
- def change
- remove_column :sbom_sources, :fingerprint, :bytea
- end
-end
diff --git a/db/post_migrate/20221025115006_check_vulnerabilities_state_transition_from_state_not_equal_to_state.rb b/db/post_migrate/20221025115006_check_vulnerabilities_state_transition_from_state_not_equal_to_state.rb
deleted file mode 100644
index 2ab7f8a9c04..00000000000
--- a/db/post_migrate/20221025115006_check_vulnerabilities_state_transition_from_state_not_equal_to_state.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class CheckVulnerabilitiesStateTransitionFromStateNotEqualToState < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- add_check_constraint(:vulnerability_state_transitions, '(from_state != to_state)', constraint_name)
- end
-
- def down
- remove_check_constraint(:vulnerability_state_transitions, constraint_name)
- end
-
- private
-
- def constraint_name
- check_constraint_name('vulnerability_state_transitions', 'fully_qualified_table_name', 'state_not_equal')
- end
-end
diff --git a/db/post_migrate/20221025220607_add_index_id_on_scan_finding_approval_merge_request_rules.rb b/db/post_migrate/20221025220607_add_index_id_on_scan_finding_approval_merge_request_rules.rb
deleted file mode 100644
index 4e72e7f95ec..00000000000
--- a/db/post_migrate/20221025220607_add_index_id_on_scan_finding_approval_merge_request_rules.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexIdOnScanFindingApprovalMergeRequestRules < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'scan_finding_approval_mr_rule_index_id'
- SCAN_FINDING_REPORT_TYPE = 4
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :approval_merge_request_rules, :id,
- where: "report_type = #{SCAN_FINDING_REPORT_TYPE}", name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :approval_merge_request_rules, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221027203556_delete_experiment_user_foreign_keys.rb b/db/post_migrate/20221027203556_delete_experiment_user_foreign_keys.rb
deleted file mode 100644
index 564dc3d4899..00000000000
--- a/db/post_migrate/20221027203556_delete_experiment_user_foreign_keys.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class DeleteExperimentUserForeignKeys < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- with_lock_retries do
- remove_foreign_key_if_exists :experiment_users, :experiments, name: 'fk_rails_56d4708b4a'
- end
-
- with_lock_retries do
- remove_foreign_key_if_exists :experiment_users, :users, name: 'fk_rails_fd805f771a'
- end
- end
-
- def down
- add_concurrent_foreign_key :experiment_users, :experiments, column: :experiment_id, name: 'fk_rails_56d4708b4a'
- add_concurrent_foreign_key :experiment_users, :users, column: :user_id, name: 'fk_rails_fd805f771a'
- end
-end
diff --git a/db/post_migrate/20221027203951_drop_experiment_users_table.rb b/db/post_migrate/20221027203951_drop_experiment_users_table.rb
deleted file mode 100644
index 838a9605740..00000000000
--- a/db/post_migrate/20221027203951_drop_experiment_users_table.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class DropExperimentUsersTable < Gitlab::Database::Migration[2.0]
- def up
- drop_table :experiment_users
- end
-
- def down
- create_table :experiment_users do |t|
- t.bigint :experiment_id, null: false
- t.bigint :user_id, null: false
- t.integer :group_type, limit: 2, null: false, default: 0
- t.timestamps_with_timezone null: false
- t.datetime_with_timezone :converted_at
- t.jsonb :context, null: false, default: {}
- end
-
- add_index :experiment_users, :experiment_id
- add_index :experiment_users, :user_id
- end
-end
diff --git a/db/post_migrate/20221028000041_remove_invalid_partial_trigram_indexes_for_issues.rb b/db/post_migrate/20221028000041_remove_invalid_partial_trigram_indexes_for_issues.rb
deleted file mode 100644
index 9b46647047a..00000000000
--- a/db/post_migrate/20221028000041_remove_invalid_partial_trigram_indexes_for_issues.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveInvalidPartialTrigramIndexesForIssues < Gitlab::Database::Migration[2.0]
- TITLE_INDEX_NAME = 'index_issues_on_title_trigram_non_latin'
- DESCRIPTION_INDEX_NAME = 'index_issues_on_description_trigram_non_latin'
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :issues, TITLE_INDEX_NAME
- remove_concurrent_index_by_name :issues, DESCRIPTION_INDEX_NAME
- end
-
- def down; end
-end
diff --git a/db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb b/db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb
deleted file mode 100644
index 199a7a22d5b..00000000000
--- a/db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class PreparePartialTrigramIndexesForIssuesAttempt3 < Gitlab::Database::Migration[2.0]
- TITLE_INDEX_NAME = 'index_issues_on_title_trigram_non_latin'
- DESCRIPTION_INDEX_NAME = 'index_issues_on_description_trigram_non_latin'
-
- def up
- prepare_async_index :issues, :title,
- name: TITLE_INDEX_NAME,
- using: :gin, opclass: { description: :gin_trgm_ops },
- where: "title NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*' " \
- "OR description NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*'"
-
- prepare_async_index :issues, :description,
- name: DESCRIPTION_INDEX_NAME,
- using: :gin, opclass: { description: :gin_trgm_ops },
- where: "title NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*' " \
- "OR description NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*'"
- end
-
- def down
- unprepare_async_index_by_name :issues, DESCRIPTION_INDEX_NAME
- unprepare_async_index_by_name :issues, TITLE_INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221028022627_add_index_on_password_last_changed_at_to_user_details.rb b/db/post_migrate/20221028022627_add_index_on_password_last_changed_at_to_user_details.rb
deleted file mode 100644
index 8314767ade1..00000000000
--- a/db/post_migrate/20221028022627_add_index_on_password_last_changed_at_to_user_details.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnPasswordLastChangedAtToUserDetails < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'index_user_details_on_password_last_changed_at'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :user_details, :password_last_changed_at, name: INDEX_NAME, comment: 'JiHu-specific index'
- end
-
- def down
- remove_concurrent_index_by_name :user_details, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221102090940_create_next_ci_partitions_record.rb b/db/post_migrate/20221102090940_create_next_ci_partitions_record.rb
deleted file mode 100644
index 4bd89a70daa..00000000000
--- a/db/post_migrate/20221102090940_create_next_ci_partitions_record.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class CreateNextCiPartitionsRecord < Gitlab::Database::Migration[2.0]
- NEXT_PARTITION_ID = 101
-
- disable_ddl_transaction!
- restrict_gitlab_migration gitlab_schema: :gitlab_ci
-
- def up
- return unless Gitlab.com?
-
- execute(<<~SQL)
- INSERT INTO "ci_partitions" ("id", "created_at", "updated_at")
- VALUES (#{NEXT_PARTITION_ID}, now(), now())
- ON CONFLICT DO NOTHING;
- SQL
-
- reset_pk_sequence!('ci_partitions')
- end
-
- def down
- return unless Gitlab.com?
-
- execute(<<~SQL)
- DELETE FROM "ci_partitions"
- WHERE "ci_partitions"."id" = #{NEXT_PARTITION_ID};
- SQL
- end
-end
diff --git a/db/post_migrate/20221102090943_create_second_partition_for_builds_metadata.rb b/db/post_migrate/20221102090943_create_second_partition_for_builds_metadata.rb
deleted file mode 100644
index 6923e6f6cba..00000000000
--- a/db/post_migrate/20221102090943_create_second_partition_for_builds_metadata.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-# frozen_string_literal: true
-
-class CreateSecondPartitionForBuildsMetadata < Gitlab::Database::Migration[2.0]
- TABLE_NAME = 'p_ci_builds_metadata'
- BUILDS_TABLE = 'ci_builds'
- NEXT_PARTITION_ID = 101
- PARTITION_NAME = 'gitlab_partitions_dynamic.ci_builds_metadata_101'
-
- disable_ddl_transaction!
-
- def up
- return unless Gitlab.com?
-
- with_lock_retries(**lock_args) do
- connection.execute(<<~SQL)
- LOCK TABLE #{BUILDS_TABLE} IN SHARE UPDATE EXCLUSIVE MODE;
- LOCK TABLE ONLY #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE;
- SQL
-
- connection.execute(<<~SQL)
- CREATE TABLE IF NOT EXISTS #{PARTITION_NAME}
- PARTITION OF #{TABLE_NAME}
- FOR VALUES IN (#{NEXT_PARTITION_ID});
- SQL
- end
- end
-
- def down
- return unless Gitlab.com?
- return unless table_exists?(PARTITION_NAME)
-
- with_lock_retries(**lock_args) do
- connection.execute(<<~SQL)
- LOCK TABLE #{BUILDS_TABLE}, #{TABLE_NAME}, #{PARTITION_NAME} IN ACCESS EXCLUSIVE MODE;
- SQL
-
- connection.execute(<<~SQL)
- ALTER TABLE #{TABLE_NAME} DETACH PARTITION #{PARTITION_NAME};
- SQL
-
- connection.execute(<<~SQL)
- DROP TABLE IF EXISTS #{PARTITION_NAME} CASCADE;
- SQL
- end
- end
-
- private
-
- def lock_args
- {
- raise_on_exhaustion: true,
- timing_configuration: lock_timing_configuration
- }
- end
-
- def lock_timing_configuration
- iterations = Gitlab::Database::WithLockRetries::DEFAULT_TIMING_CONFIGURATION
- aggressive_iterations = Array.new(5) { [10.seconds, 1.minute] }
-
- iterations + aggressive_iterations
- end
-end
diff --git a/db/post_migrate/20221103073328_change_member_namespace_id_not_null.rb b/db/post_migrate/20221103073328_change_member_namespace_id_not_null.rb
deleted file mode 100644
index ef493e12f38..00000000000
--- a/db/post_migrate/20221103073328_change_member_namespace_id_not_null.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeMemberNamespaceIdNotNull < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- add_not_null_constraint :members, :member_namespace_id, validate: false
- end
-
- def down
- remove_not_null_constraint :members, :member_namespace_id
- end
-end
diff --git a/db/post_migrate/20221103084213_remove_tmp_index_members_on_id_where_namespace_id_null.rb b/db/post_migrate/20221103084213_remove_tmp_index_members_on_id_where_namespace_id_null.rb
deleted file mode 100644
index 07908e697f5..00000000000
--- a/db/post_migrate/20221103084213_remove_tmp_index_members_on_id_where_namespace_id_null.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveTmpIndexMembersOnIdWhereNamespaceIdNull < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'tmp_index_members_on_id_where_namespace_id_null'
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :members, INDEX_NAME
- end
-
- def down
- add_concurrent_index :members, :id, name: INDEX_NAME, where: 'member_namespace_id IS NULL'
- end
-end
diff --git a/db/post_migrate/20221103150250_migrate_sidekiq_queued_jobs.rb b/db/post_migrate/20221103150250_migrate_sidekiq_queued_jobs.rb
deleted file mode 100644
index 1934711f9ef..00000000000
--- a/db/post_migrate/20221103150250_migrate_sidekiq_queued_jobs.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class MigrateSidekiqQueuedJobs < Gitlab::Database::Migration[2.0]
- def up
- # no-op because of https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/1991
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20221104042137_add_partial_trigram_index_for_issue_title_attempt_2.rb b/db/post_migrate/20221104042137_add_partial_trigram_index_for_issue_title_attempt_2.rb
deleted file mode 100644
index 24204577959..00000000000
--- a/db/post_migrate/20221104042137_add_partial_trigram_index_for_issue_title_attempt_2.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddPartialTrigramIndexForIssueTitleAttempt2 < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_issues_on_title_trigram_non_latin'
-
- def up
- add_concurrent_index :issues, :title,
- name: INDEX_NAME,
- using: :gin, opclass: { description: :gin_trgm_ops },
- where: "title NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*' " \
- "OR description NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*'"
- end
-
- def down
- remove_concurrent_index_by_name :issues, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221104042159_add_partial_trigram_index_for_issue_description_attempt_2.rb b/db/post_migrate/20221104042159_add_partial_trigram_index_for_issue_description_attempt_2.rb
deleted file mode 100644
index 36b595d1067..00000000000
--- a/db/post_migrate/20221104042159_add_partial_trigram_index_for_issue_description_attempt_2.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddPartialTrigramIndexForIssueDescriptionAttempt2 < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_issues_on_description_trigram_non_latin'
-
- def up
- add_concurrent_index :issues, :description,
- name: INDEX_NAME,
- using: :gin, opclass: { description: :gin_trgm_ops },
- where: "title NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*' " \
- "OR description NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*'"
- end
-
- def down
- remove_concurrent_index_by_name :issues, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221104074652_add_temp_index_for_project_statistics_upload_size_migration.rb b/db/post_migrate/20221104074652_add_temp_index_for_project_statistics_upload_size_migration.rb
deleted file mode 100644
index b6ee636fa9b..00000000000
--- a/db/post_migrate/20221104074652_add_temp_index_for_project_statistics_upload_size_migration.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddTempIndexForProjectStatisticsUploadSizeMigration < Gitlab::Database::Migration[2.0]
- INDEX_PROJECT_STATSISTICS_UPLOADS_SIZE = 'tmp_index_project_statistics_uploads_size'
-
- disable_ddl_transaction!
-
- def up
- # Temporary index is to be used to trigger refresh for all project_statistics with
- # upload_size <> 0
- add_concurrent_index :project_statistics, [:project_id],
- name: INDEX_PROJECT_STATSISTICS_UPLOADS_SIZE,
- where: "uploads_size <> 0"
- end
-
- def down
- remove_concurrent_index_by_name :project_statistics, INDEX_PROJECT_STATSISTICS_UPLOADS_SIZE
- end
-end
diff --git a/db/post_migrate/20221104100203_recreate_async_trigram_index_for_vulnerability_reads_container_images.rb b/db/post_migrate/20221104100203_recreate_async_trigram_index_for_vulnerability_reads_container_images.rb
deleted file mode 100644
index ea2914f4dc4..00000000000
--- a/db/post_migrate/20221104100203_recreate_async_trigram_index_for_vulnerability_reads_container_images.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class RecreateAsyncTrigramIndexForVulnerabilityReadsContainerImages < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_vulnerability_reads_on_location_image_trigram'
- REPORT_TYPES = { container_scanning: 2, cluster_image_scanning: 7 }.freeze
-
- def up
- remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME
-
- prepare_async_index :vulnerability_reads, :location_image,
- name: INDEX_NAME,
- using: :gin, opclass: { location_image: :gin_trgm_ops },
- where: "report_type = ANY (ARRAY[#{REPORT_TYPES.values.join(', ')}]) AND location_image IS NOT NULL"
- end
-
- def down
- unprepare_async_index :vulnerability_reads, :location_image, name: INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221104170500_add_vulnerability_reads_all_status_index.rb b/db/post_migrate/20221104170500_add_vulnerability_reads_all_status_index.rb
deleted file mode 100644
index 1dc1921ebaa..00000000000
--- a/db/post_migrate/20221104170500_add_vulnerability_reads_all_status_index.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-class AddVulnerabilityReadsAllStatusIndex < Gitlab::Database::Migration[2.0]
- INDEX_NAME = 'index_vulnerability_reads_on_namespace_type_severity_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :vulnerability_reads, %i[namespace_id report_type severity vulnerability_id], name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME
- end
-end
diff --git a/db/post_migrate/20221104190203_validate_environment_id_on_deployments.rb b/db/post_migrate/20221104190203_validate_environment_id_on_deployments.rb
deleted file mode 100644
index 9546daa3975..00000000000
--- a/db/post_migrate/20221104190203_validate_environment_id_on_deployments.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class ValidateEnvironmentIdOnDeployments < Gitlab::Database::Migration[2.0]
- def up
- validate_foreign_key :deployments, :environment_id
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20221107094359_recount_epic_cache_counts.rb b/db/post_migrate/20221107094359_recount_epic_cache_counts.rb
deleted file mode 100644
index 37ab952edba..00000000000
--- a/db/post_migrate/20221107094359_recount_epic_cache_counts.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class RecountEpicCacheCounts < Gitlab::Database::Migration[2.0]
- MIGRATION = 'RecountEpicCacheCounts'
- DELAY_INTERVAL = 2.minutes.to_i
- BATCH_SIZE = 200
- MAX_BATCH_SIZE = 1000
- SUB_BATCH_SIZE = 20
-
- disable_ddl_transaction!
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- queue_batched_background_migration(
- MIGRATION,
- :epics,
- :id,
- job_interval: DELAY_INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: MAX_BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE,
- gitlab_schema: :gitlab_main
- )
- end
-
- def down
- delete_batched_background_migration(MIGRATION, :epics, :id, [])
- end
-end
diff --git a/db/post_migrate/20221107184758_sync_new_amount_used_for_ci_namespace_monthly_usages.rb b/db/post_migrate/20221107184758_sync_new_amount_used_for_ci_namespace_monthly_usages.rb
deleted file mode 100644
index 9a6014b5c94..00000000000
--- a/db/post_migrate/20221107184758_sync_new_amount_used_for_ci_namespace_monthly_usages.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class SyncNewAmountUsedForCiNamespaceMonthlyUsages < Gitlab::Database::Migration[2.0]
- restrict_gitlab_migration gitlab_schema: :gitlab_ci
-
- def up
- namespace_usages = define_batchable_model('ci_namespace_monthly_usages')
-
- namespace_usages.each_batch(of: 500) do |batch|
- batch.where('amount_used > 0').update_all('new_amount_used = amount_used')
- end
- end
-
- def down
- # Non reversible migration.
- # This data migration keeps `new_amount_used` in sync with the old `amount_used`.
- # In case of failure or interruption the migration can be retried.
- end
-end
diff --git a/db/post_migrate/20221107220420_validate_not_null_constraint_on_member_namespace_id.rb b/db/post_migrate/20221107220420_validate_not_null_constraint_on_member_namespace_id.rb
deleted file mode 100644
index 48da0c1fd09..00000000000
--- a/db/post_migrate/20221107220420_validate_not_null_constraint_on_member_namespace_id.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class ValidateNotNullConstraintOnMemberNamespaceId < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- CONSTRAINT_NAME = 'check_508774aac0'
-
- def up
- validate_not_null_constraint :members, :member_namespace_id, constraint_name: CONSTRAINT_NAME
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20221107220526_validate_fk_member_namespace_id.rb b/db/post_migrate/20221107220526_validate_fk_member_namespace_id.rb
deleted file mode 100644
index f78dc5a36fd..00000000000
--- a/db/post_migrate/20221107220526_validate_fk_member_namespace_id.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class ValidateFkMemberNamespaceId < Gitlab::Database::Migration[2.0]
- CONSTRAINT_NAME = 'fk_2f85abf8f1'
-
- def up
- validate_foreign_key :members, :member_namespace_id, name: CONSTRAINT_NAME
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20221107222213_remove_old_member_namespace_id_fk.rb b/db/post_migrate/20221107222213_remove_old_member_namespace_id_fk.rb
deleted file mode 100644
index d46fa80336e..00000000000
--- a/db/post_migrate/20221107222213_remove_old_member_namespace_id_fk.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveOldMemberNamespaceIdFk < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- TARGET_COLUMN = :member_namespace_id
-
- def up
- with_lock_retries do
- remove_foreign_key_if_exists(:members, column: TARGET_COLUMN, name: fk_name(TARGET_COLUMN))
- end
- end
-
- def down
- add_concurrent_foreign_key(
- :members,
- :namespaces,
- column: TARGET_COLUMN,
- name: fk_name(TARGET_COLUMN),
- on_delete: :nullify
- )
- end
-
- def fk_name(column_name)
- # generate a FK name
- concurrent_foreign_key_name(:members, column_name)
- end
-end
diff --git a/db/post_migrate/20221108045019_truncate_timeline_event_tags_table.rb b/db/post_migrate/20221108045019_truncate_timeline_event_tags_table.rb
deleted file mode 100644
index a576f9e860f..00000000000
--- a/db/post_migrate/20221108045019_truncate_timeline_event_tags_table.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class TruncateTimelineEventTagsTable < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- def up
- return unless Gitlab::Database.gitlab_schemas_for_connection(connection).include?(:gitlab_main)
-
- execute('TRUNCATE TABLE incident_management_timeline_event_tags, incident_management_timeline_event_tag_links')
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20221108121322_add_supporting_index_for_vulnerabilities_feedback_migration.rb b/db/post_migrate/20221108121322_add_supporting_index_for_vulnerabilities_feedback_migration.rb
deleted file mode 100644
index c77930512d2..00000000000
--- a/db/post_migrate/20221108121322_add_supporting_index_for_vulnerabilities_feedback_migration.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class AddSupportingIndexForVulnerabilitiesFeedbackMigration < Gitlab::Database::Migration[2.0]
- INDEX_NAME = "tmp_idx_for_vulnerability_feedback_migration"
- WHERE_CLAUSE = "migrated_to_state_transition = false AND feedback_type = 0"
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(
- :vulnerability_feedback,
- %i[migrated_to_state_transition feedback_type],
- where: WHERE_CLAUSE,
- name: INDEX_NAME
- )
- end
-
- def down
- remove_concurrent_index_by_name(
- :vulnerability_feedback,
- INDEX_NAME
- )
- end
-end
diff --git a/db/post_migrate/20221108222015_remove_temp_index_on_project_features_where_releases_access_level_gt_repository.rb b/db/post_migrate/20221108222015_remove_temp_index_on_project_features_where_releases_access_level_gt_repository.rb
deleted file mode 100644
index e7cc6786b4b..00000000000
--- a/db/post_migrate/20221108222015_remove_temp_index_on_project_features_where_releases_access_level_gt_repository.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveTempIndexOnProjectFeaturesWhereReleasesAccessLevelGtRepository < Gitlab::Database::Migration[2.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'tmp_idx_project_features_on_releases_al_and_repo_al_partial'
-
- def up
- remove_concurrent_index_by_name :project_features, INDEX_NAME
- end
-
- def down
- add_concurrent_index :project_features,
- [:releases_access_level, :repository_access_level],
- name: INDEX_NAME,
- where: 'releases_access_level > repository_access_level'
- end
-end
diff --git a/db/post_migrate/20221110045406_sanitize_confidential_note_todos.rb b/db/post_migrate/20221110045406_sanitize_confidential_note_todos.rb
deleted file mode 100644
index d409a4dfdd1..00000000000
--- a/db/post_migrate/20221110045406_sanitize_confidential_note_todos.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class SanitizeConfidentialNoteTodos < Gitlab::Database::Migration[2.0]
- restrict_gitlab_migration gitlab_schema: :gitlab_main
-
- def up
- # no-op: this empty migration is left here only for compatibility reasons.
- # It was a temporary migration which used not-isolated code.
- # https://gitlab.com/gitlab-org/gitlab/-/issues/382557
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20221111070314_prepare_removal_of_issue_trigram_indexes.rb b/db/post_migrate/20221111070314_prepare_removal_of_issue_trigram_indexes.rb
deleted file mode 100644
index c4cae19497e..00000000000
--- a/db/post_migrate/20221111070314_prepare_removal_of_issue_trigram_indexes.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class PrepareRemovalOfIssueTrigramIndexes < Gitlab::Database::Migration[2.0]
- TITLE_INDEX_NAME = 'index_issues_on_title_trigram'
- DESCRIPTION_INDEX_NAME = 'index_issues_on_description_trigram'
-
- def up
- prepare_async_index_removal :issues, :title, name: TITLE_INDEX_NAME
- prepare_async_index_removal :issues, :description, name: DESCRIPTION_INDEX_NAME
- end
-
- def down
- unprepare_async_index_by_name :issues, DESCRIPTION_INDEX_NAME
- unprepare_async_index_by_name :issues, TITLE_INDEX_NAME
- end
-end