summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20210302025305_add_excluded_urls_and_request_headers_to_dast_site_profiles.rb17
-rw-r--r--db/migrate/20210302103851_add_deployed_deployment_id_index_to_project_pages_metadata.rb19
-rw-r--r--db/migrate/20210302155904_remove_index_for_security_orchestration_policy.rb18
-rw-r--r--db/migrate/20210302160544_add_index_to_security_orchestration_policy.rb18
-rw-r--r--db/migrate/20210302212623_rename_vuln_fingerprints_indexes.rb35
-rw-r--r--db/migrate/20210303053341_add_last_edited_at_and_last_edited_by_id_to_notes.rb19
-rw-r--r--db/migrate/20210303091651_add_index_to_environments_tier.rb19
-rw-r--r--db/migrate/20210303165201_add_index_for_succeeded_deployments.rb18
-rw-r--r--db/migrate/20210303165301_add_not_null_constraint_to_cluster_token_name.rb18
-rw-r--r--db/migrate/20210303193544_add_concurrent_fields_to_bulk_imports_trackers.rb21
-rw-r--r--db/migrate/20210303193605_add_text_limits_to_bulk_imports_trackers_jid_and_pipeline_name.rb16
-rw-r--r--db/migrate/20210305002016_update_terraform_states_locked_by_user_id_foreign_key.rb29
-rw-r--r--db/migrate/20210305013509_add_text_limit_to_group_ci_variables_environment_scope.rb17
-rw-r--r--db/migrate/20210305031822_create_dast_site_profile_variables.rb40
-rw-r--r--db/migrate/20210305145622_add_terraform_module_max_file_size_to_plan_limits.rb9
-rw-r--r--db/migrate/20210305180331_create_ci_unit_tests.rb31
-rw-r--r--db/migrate/20210305182740_add_projects_fk_to_ci_unit_tests.rb19
-rw-r--r--db/migrate/20210305182855_create_ci_unit_test_failures.rb24
-rw-r--r--db/migrate/20210305183904_add_ci_builds_fk_to_ci_unit_test_failures.rb19
-rw-r--r--db/migrate/20210306121300_partition_web_hook_logs.rb19
-rw-r--r--db/migrate/20210308125742_add_info_column_into_security_scans_table.rb9
-rw-r--r--db/migrate/20210308175224_change_namespace_settings_delayed_project_removal_null.rb14
-rw-r--r--db/migrate/20210308175225_add_lock_delayed_project_removal_to_namespace_settings.rb9
-rw-r--r--db/migrate/20210308175226_add_delayed_project_removal_to_application_settings.rb9
-rw-r--r--db/migrate/20210308175227_add_lock_delayed_project_removal_to_application_settings.rb9
-rw-r--r--db/migrate/20210308190413_change_batched_background_migrations_batch_class_name_default.rb10
-rw-r--r--db/migrate/20210309160106_add_admin_mode_to_application_setting.rb9
-rw-r--r--db/migrate/20210309181019_add_last_used_at_to_cluster_agent_token.rb9
-rw-r--r--db/migrate/20210310000627_add_idx_vulnerability_occurrences_dedup.rb24
-rw-r--r--db/migrate/20210310111009_add_settings_to_group_merge_request_approval_settings.rb14
-rw-r--r--db/migrate/20210311022012_add_text_limits_to_dast_site_profiles.rb24
-rw-r--r--db/migrate/20210311120152_add_metrics_to_batched_background_migration_jobs.rb9
-rw-r--r--db/migrate/20210311120153_initialize_conversion_of_events_id_to_bigint.rb21
-rw-r--r--db/migrate/20210311120154_initialize_conversion_of_push_event_payloads_event_id_to_bigint.rb21
-rw-r--r--db/migrate/20210312140029_add_owner_and_id_index_on_active_ci_pipeline_schedules.rb18
-rw-r--r--db/migrate/20210312174321_add_enforced_git_check_to_saml_provider.rb13
-rw-r--r--db/migrate/20210312193532_add_resource_access_token_creation_allowed_to_namespace_settings.rb19
-rw-r--r--db/migrate/20210313045617_add_verification_state_and_started_at_to_snippet_repositories.rb12
-rw-r--r--db/migrate/20210313045845_add_verification_indexes_to_snippet_repositories.rb27
-rw-r--r--db/migrate/20210316094047_add_trial_extension_type_to_gitlab_subscription_histories.rb9
-rw-r--r--db/migrate/20210316094323_add_trial_extension_type_to_gitlab_subscriptions.rb21
-rw-r--r--db/migrate/20210316152500_add_index_ci_stages_on_pipeline_id_and_id.rb18
-rw-r--r--db/migrate/20210316171009_create_packages_helm_file_metadata.rb26
-rw-r--r--db/migrate/20210317035357_create_dast_profiles_pipelines.rb20
-rw-r--r--db/migrate/20210317100520_create_elastic_index_settings.rb23
-rw-r--r--db/migrate/20210317104301_create_in_product_marketing_emails.rb33
-rw-r--r--db/migrate/20210317105904_add_user_foreign_key_to_in_product_marketing_emails.rb19
-rw-r--r--db/migrate/20210317123054_add_throttle_package_registry_columns.rb14
-rw-r--r--db/migrate/20210317192943_add_expiry_notification_delivered_to_keys.rb9
-rw-r--r--db/migrate/20210317210338_add_valid_runner_registrars.rb7
-rw-r--r--db/migrate/20210318134427_delete_security_findings_without_uuid.rb25
-rw-r--r--db/migrate/20210319071214_add_helm_max_file_size_to_plan_limits.rb9
-rw-r--r--db/migrate/20210322063407_add_dast_profile_id_fk_to_dast_profiles_pipelines.rb19
-rw-r--r--db/migrate/20210322063450_add_ci_pipeline_id_fk_to_dast_profiles_pipelines.rb19
-rw-r--r--db/migrate/20210322182751_add_index_to_keys_on_expires_at_and_expiry_notification_undelivered.rb19
-rw-r--r--db/migrate/20210323064751_add_namespace_traversal_ids_index.rb18
-rw-r--r--db/migrate/20210323125809_create_status_check_responses_table.rb19
-rw-r--r--db/migrate/20210323130831_add_merge_request_foreign_key_to_status_check_responses.rb17
-rw-r--r--db/migrate/20210323131543_add_external_approval_rule_foreign_key_to_status_check_responses.rb17
-rw-r--r--db/migrate/20210323155010_populate_dismissal_information_for_vulnerabilities.rb37
-rw-r--r--db/migrate/20210323182846_add_project_status_date_index_to_merge_requests.rb18
-rw-r--r--db/migrate/20210324112439_add_index_mirror_data_on_retry_next_execution_where_status.rb28
-rw-r--r--db/migrate/20210324131727_migrate_elastic_index_settings.rb31
-rw-r--r--db/migrate/20210325092215_add_not_valid_foreign_key_to_group_hooks.rb19
-rw-r--r--db/migrate/20210325113129_validate_foreign_key_on_service_hooks.rb17
-rw-r--r--db/migrate/20210325150837_add_verification_state_to_ci_pipeline_artifact.rb18
-rw-r--r--db/migrate/20210325151758_add_verification_failure_limit_to_ci_pipeline_artifact.rb19
-rw-r--r--db/migrate/20210325152011_add_verification_indexes_to_ci_pipeline_artifacts.rb27
-rw-r--r--db/migrate/20210326035553_add_index_for_project_deployments_with_environment_id_and_updated_at.rb19
-rw-r--r--db/migrate/20210326190903_create_vulnerability_finding_evidences.rb26
-rw-r--r--db/migrate/20210329095548_add_target_project_and_source_branch_index_to_merge_request.rb18
-rw-r--r--db/migrate/20210329191850_add_finding_signature_table.rb40
-rw-r--r--db/migrate/20210329192716_add_composite_index_to_award_emoji.rb18
-rw-r--r--db/migrate/20210330015805_add_cloud_to_licenses.rb9
-rw-r--r--db/migrate/20210331000934_add_config_to_ci_runners.rb7
-rw-r--r--db/migrate/20210331125111_add_default_target_project.rb17
-rw-r--r--db/migrate/20210331145548_add_index_for_last_deployment.rb18
-rw-r--r--db/migrate/20210331180118_remove_deprecated_index_from_award_emoji.rb19
-rw-r--r--db/migrate/20210401134157_add_index_to_pages_deployments.rb18
-rw-r--r--db/migrate/20210401134455_remove_index_mirror_data_on_next_execution_and_retry_count.rb30
-rw-r--r--db/migrate/20210401175134_add_before_expiry_notification_delivered_to_keys.rb9
-rw-r--r--db/migrate/20210401192808_add_index_to_keys_on_expires_at_and_before_expiry_notification_undelivered.rb19
-rw-r--r--db/migrate/20210406063442_create_namespaces_id_parent_id_partial_index.rb18
-rw-r--r--db/migrate/20210406140057_add_total_tuple_count_to_batched_migrations.rb13
-rw-r--r--db/migrate/20210407002511_add_type_to_dast_site_profile.rb7
-rw-r--r--db/migrate/20210407111027_add_whats_new_application_setting.rb7
-rw-r--r--db/migrate/20210407140539_add_verification_state_and_started_at_to_terraform_state_version_table.rb10
-rw-r--r--db/migrate/20210409084242_create_index_on_notes_for_cherry_picked_merge_requests.rb18
-rw-r--r--db/migrate/20210411212813_add_clusters_integrations_prometheus.rb21
-rw-r--r--db/migrate/20210412111213_create_security_orchestration_policy_rule_schedule.rb33
-rw-r--r--db/migrate/20210412132736_add_instance_url_to_jira_connect_installations.rb16
-rw-r--r--db/migrate/20210412132824_add_text_limit_to_jira_connect_installations_instance_url.rb17
-rw-r--r--db/migrate/20210412142223_add_user_index_on_spam_logs.rb17
-rw-r--r--db/migrate/20210412172030_add_configured_at_to_security_orchestration_policy.rb9
-rw-r--r--db/migrate/20210413121101_add_created_at_web_hook_id_index_to_partitioned_web_hook_log.rb21
-rw-r--r--db/migrate/20210413123832_add_index_on_web_hook_id_to_partitioned_web_hook_log.rb21
-rw-r--r--db/migrate/20210413155324_add_pause_seconds_to_batched_background_migrations.rb7
-rw-r--r--db/migrate/20210414045322_add_pause_seconds_to_batched_background_migration_jobs.rb7
-rw-r--r--db/migrate/20210414095944_add_index_services_on_project_and_type_where_inherit_null.rb17
-rw-r--r--db/migrate/20210414100914_add_bulk_import_exports_table.rb25
-rw-r--r--db/migrate/20210414130017_add_foreign_key_to_bulk_import_exports_on_project.rb17
-rw-r--r--db/migrate/20210414130526_add_foreign_key_to_bulk_import_exports_on_group.rb17
-rw-r--r--db/migrate/20210414131600_add_external_pipeline_validation_to_application_setting.rb19
-rw-r--r--db/migrate/20210414131807_add_bulk_import_exports_table_indexes.rb29
-rw-r--r--db/migrate/20210414133310_add_bulk_import_export_uploads_table.rb19
-rw-r--r--db/migrate/20210415100159_initialize_conversion_of_ci_build_needs_to_bigint.rb17
-rw-r--r--db/migrate/20210415142700_add_url_limit_to_pipeline_validation.rb17
-rw-r--r--db/migrate/20210415144538_remove_index_epics_on_group_id_from_epics.rb17
-rw-r--r--db/migrate/20210415172516_create_vulnerability_finding_evidence_requests.rb28
-rw-r--r--db/migrate/20210416172516_create_vulnerability_finding_evidence_responses.rb27
-rw-r--r--db/migrate/20210419090412_remove_debian_group_architectures_distribution_id_index.rb19
-rw-r--r--db/migrate/20210419090542_remove_debian_project_architectures_distribution_id_index.rb19
-rw-r--r--db/migrate/20210419203017_add_remote_import_url_to_import_export_upload.rb8
-rw-r--r--db/migrate/20210419203018_add_remote_text_limit_to_import_url_in_import_export_upload.rb15
-rw-r--r--db/migrate/20210419224834_update_issues_iteration_foreign_key.rb23
-rw-r--r--db/migrate/20210420012444_change_web_hook_events_default.rb15
-rw-r--r--db/migrate/20210420012909_index_cluster_agent_tokens_on_last_used_at.rb20
-rw-r--r--db/migrate/20210420120734_initialize_conversion_of_ci_job_artifacts_to_bigint.rb22
-rw-r--r--db/migrate/20210420173030_add_verification_indexes_to_terraform_state_versions.rb26
-rw-r--r--db/migrate/20210420210642_recreate_index_for_project_deployments_with_environment_id_and_date_at.rb23
-rw-r--r--db/migrate/20210420221106_update_merge_requests_iteration_foreign_key.rb23
-rw-r--r--db/migrate/20210421021510_add_deactivate_dormant_users_to_application_settings.rb7
-rw-r--r--db/migrate/20210421022010_add_index_for_dormant_users.rb19
-rw-r--r--db/migrate/20210421081724_add_codeowners_devops_adoption_snapshot.rb8
-rw-r--r--db/migrate/20210421190157_remove_elastic_task_null_constraint_from_elastic_reindexing_subtasks.rb19
-rw-r--r--db/migrate/20210422022825_initialize_conversion_of_ci_sources_pipelines_source_job_id_to_bigint.rb18
-rw-r--r--db/migrate/20210422142647_add_project_id_next_run_at_index_to_container_expiration_policies.rb17
-rw-r--r--db/migrate/20210422181809_add_project_to_timelogs.rb19
-rw-r--r--db/migrate/20210422195929_create_elastic_reindexing_slices.rb44
-rw-r--r--db/migrate/20210423054022_create_dast_site_profiles_pipelines.rb18
-rw-r--r--db/migrate/20210423054537_add_dast_site_profile_id_fk_to_dast_site_profiles_pipelines.rb19
-rw-r--r--db/migrate/20210423054846_add_ci_pipeline_id_fk_to_dast_site_profiles_pipelines.rb19
-rw-r--r--db/migrate/20210423155059_add_runner_registration_to_plan_limits.rb8
-rw-r--r--db/migrate/20210423164702_insert_runner_registration_plan_limits.rb26
-rw-r--r--db/migrate/20210423171304_re_order_fk_source_project_id_in_merge_requests.rb24
-rw-r--r--db/migrate/20210424115725_swap_partitioned_web_hook_logs.rb15
-rw-r--r--db/migrate/20210424163400_add_project_id_fk_to_timelogs.rb22
-rw-r--r--db/migrate/20210426094524_initialize_conversion_of_ci_builds_to_bigint.rb17
-rw-r--r--db/migrate/20210427045604_initialize_conversion_of_ci_build_trace_chunks_to_bigint.rb16
-rw-r--r--db/migrate/20210427062807_add_index_to_batched_migration_jobs_status.rb17
-rw-r--r--db/migrate/20210427084924_initialize_conversion_of_ci_builds_runner_session_to_bigint.rb16
-rw-r--r--db/migrate/20210427094931_add_execution_order_index_to_batched_background_migration_jobs.rb17
-rw-r--r--db/migrate/20210427125400_add_spamcheck_api_key_to_application_setting.rb13
-rw-r--r--db/migrate/20210427194958_add_description_roll_over_to_iterations_cadences.rb19
-rw-r--r--db/migrate/20210427200840_add_text_limit_to_iterations_cadences_description.rb15
-rw-r--r--db/migrate/20210428151144_update_invalid_web_hooks.rb24
-rw-r--r--db/migrate/20210428151238_validate_foreign_key_on_group_hooks.rb15
-rw-r--r--db/migrate/20210429024843_add_escalation_policies.rb25
-rw-r--r--db/migrate/20210429032320_add_escalation_rules.rb19
-rw-r--r--db/migrate/20210429131525_create_user_credit_card_validations.rb22
-rw-r--r--db/migrate/20210429181325_add_failure_tracking_to_web_hooks.rb11
-rw-r--r--db/migrate/20210429192653_add_generic_package_duplicate_settings_to_namespace_package_settings.rb11
-rw-r--r--db/migrate/20210429193106_add_text_limit_to_namespace_package_settings_generic_duplicate_exception_regex.rb15
-rw-r--r--db/migrate/20210430034712_add_alert_manager_token_to_clusters_integration_prometheus.rb10
-rw-r--r--db/migrate/20210430100947_add_elasticsearch_username_password_to_application_settings.rb13
-rw-r--r--db/migrate/20210430121522_initialize_conversion_of_ci_build_trace_sections_to_bigint.rb16
-rw-r--r--db/migrate/20210430122951_add_snapshot_namespace_id.rb7
-rw-r--r--db/migrate/20210430124212_add_display_namespace_id_to_segments.rb7
-rw-r--r--db/migrate/20210430124630_add_devops_adoption_indexes.rb32
-rw-r--r--db/migrate/20210430154631_add_slice_multiplier_and_max_slices_to_elastic_reindexing_task.rb18
-rw-r--r--db/migrate/20210503105022_create_project_value_streams.rb27
-rw-r--r--db/migrate/20210503105845_add_project_value_stream_id_to_project_stages.rb30
-rw-r--r--db/migrate/20210503131747_add_web_hook_calls_to_plan_limits.rb7
-rw-r--r--db/migrate/20210504085144_add_index_on_web_hook_project_id_recent_failures.rb17
-rw-r--r--db/migrate/20210504135823_add_floc_application_settings.rb7
-rw-r--r--db/migrate/20210504143128_add_verification_state_and_started_at_to_mr_diff_details_table.rb10
-rw-r--r--db/migrate/20210504153354_create_clusters_integration_elasticstack.rb21
-rw-r--r--db/migrate/20210504164429_create_partial_indexes_for_pending_and_running_builds.rb20
-rw-r--r--db/migrate/20210505070612_create_packages_debian_group_distribution_keys.rb37
-rw-r--r--db/migrate/20210505070812_create_packages_debian_project_distribution_keys.rb37
-rw-r--r--db/migrate/20210505124816_add_text_limit_to_elasticsearch_username.rb15
-rw-r--r--db/migrate/20210505170152_add_verification_indexes_to_merge_request_diff_details_table.rb26
-rw-r--r--db/migrate/20210506150833_create_vulnerability_finding_evidence_headers.rb29
-rw-r--r--db/migrate/20210507191949_add_remove_on_issue_close_to_labels.rb11
-rw-r--r--db/migrate/20210510083845_add_sha_to_status_check_response.rb13
-rw-r--r--db/migrate/20210510191551_add_body_to_findings_evidences_request.rb10
-rw-r--r--db/migrate/20210510191552_add_limit_to_findings_evidences_request_body.rb17
-rw-r--r--db/migrate/20210511104929_add_epic_board_recent_visits_table.rb24
-rw-r--r--db/migrate/20210511104930_add_index_to_epic_board_recent_visits.rb20
-rw-r--r--db/migrate/20210511165250_add_foreign_key_to_lfs_objects_projects.rb19
-rw-r--r--db/migrate/20210512120122_add_pending_builds_table.rb15
-rw-r--r--db/migrate/20210512183309_add_body_to_findings_evidences_response.rb10
-rw-r--r--db/migrate/20210512183310_add_limit_to_findings_evidences_response_body.rb17
-rw-r--r--db/migrate/20210513093418_add_draft_column_to_merge_requests.rb17
-rw-r--r--db/migrate/20210517130723_make_snapshot_segment_id_optional.rb11
-rw-r--r--db/migrate/20210517144856_require_snapshot_namespace.rb19
-rw-r--r--db/migrate/20210517221612_add_default_value_to_merge_requests_author_approval_on_projects.rb17
-rw-r--r--db/migrate/20210519132109_initialize_conversion_of_ci_builds_metadata_to_bigint.rb16
-rw-r--r--db/migrate/20210519154058_schedule_update_users_where_two_factor_auth_required_from_group.rb34
-rw-r--r--db/migrate/20210520102039_group_protected_environments_add_column.rb15
-rw-r--r--db/migrate/20210520133032_initialize_conversion_of_taggings_to_bigint.rb16
-rw-r--r--db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb18
-rw-r--r--db/migrate/20210521073920_drop_devops_adoption_namespace_uniqueness.rb23
-rw-r--r--db/migrate/20210525085158_initialize_conversion_of_deployments_to_bigint.rb16
-rw-r--r--db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb18
-rw-r--r--db/migrate/20210525100539_initialize_conversion_of_geo_job_artifact_deleted_events_to_bigint.rb16
-rw-r--r--db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb18
-rw-r--r--db/migrate/20210525184900_add_latest_pipeline_id_into_vulnerability_statistics_table.rb7
-rw-r--r--db/migrate/20210526135911_create_ci_minutes_additional_packs.rb25
-rw-r--r--db/migrate/20210526155257_rename_sync_security_report_approval_rules_sidekiq_queue.rb15
-rw-r--r--db/migrate/20210526181820_add_index_to_vulnerability_statistics_on_latest_pipeline_id.rb17
-rw-r--r--db/migrate/20210526181821_add_foreign_key_for_latest_pipeline_id_to_ci_pipelines.rb17
-rw-r--r--db/migrate/20210526190259_add_ci_daily_pipeline_schedule_triggers_to_plan_limits.rb7
-rw-r--r--db/migrate/20210526190553_insert_ci_daily_pipeline_schedule_triggers_plan_limits.rb26
-rw-r--r--db/migrate/20210527065005_add_index_for_cadence_iterations_automation.rb17
-rw-r--r--db/migrate/20210527130524_rename_experiment_subjects_group_id_to_namespace_id.rb15
-rw-r--r--db/migrate/20210527133919_add_diff_max_lines_to_application_settings.rb11
-rw-r--r--db/migrate/20210527134019_add_diff_max_files_to_application_settings.rb11
-rw-r--r--db/migrate/20210527185542_add_prevent_sharing_groups_outside_hierarchy_to_namespace_settings.rb17
-rw-r--r--db/migrate/20210527194558_create_ci_job_token_project_scope_links.rb24
-rw-r--r--db/migrate/20210529164247_change_iterations_title_uniqueness_index.rb20
-rw-r--r--db/migrate/20210531053916_rename_instance_statistics_measurements.rb13
-rw-r--r--db/migrate/20210531070452_default_enforce_ssh_key_expiration.rb7
-rw-r--r--db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb15
-rw-r--r--db/migrate/20210601080039_group_protected_environments_add_index_and_constraint.rb35
-rw-r--r--db/migrate/20210601123341_add_running_builds_table.rb17
-rw-r--r--db/migrate/20210601125410_add_runners_created_at_index.rb20
-rw-r--r--db/migrate/20210601131742_update_web_hook_calls_limit.rb17
-rw-r--r--db/migrate/20210601132134_remove_partial_index_for_hashed_storage_migration.rb15
-rw-r--r--db/migrate/20210601133459_replace_runners_contacted_at_index.rb26
-rw-r--r--db/migrate/20210602122213_add_upcoming_reconciliations.rb23
-rw-r--r--db/migrate/20210602122233_add_runners_description_index.rb17
-rw-r--r--db/migrate/20210602155056_add_merge_request_diff_commit_users.rb31
-rw-r--r--db/migrate/20210602155110_add_merge_request_diff_commit_user_columns.rb25
-rw-r--r--db/migrate/20210602155110_init_schema.rb (renamed from db/migrate/20210301200959_init_schema.rb)4
-rw-r--r--db/migrate/20221010191136_add_access_level_to_ci_job_artifacts.rb9
-rw-r--r--db/migrate/20221122210711_add_columns_to_postgres_foreign_keys.rb54
-rw-r--r--db/migrate/20221204090437_add_category_to_abuse_report.rb7
-rw-r--r--db/migrate/20221209174132_remove_sbom_occurrences_unique_index.rb22
-rw-r--r--db/migrate/20221209174157_truncate_sbom_occurrences.rb28
-rw-r--r--db/migrate/20221212054640_add_reported_from_to_abuse_reports.rb21
-rw-r--r--db/migrate/20221212192452_add_uuid_column_to_sbom_occurrences.rb7
-rw-r--r--db/migrate/20221212192527_index_sbom_occurrences_on_uuid.rb15
-rw-r--r--db/migrate/20221213105028_add_sync_part_step_2_of_index_namespaces_on_path_for_top_level_non_projects.rb18
-rw-r--r--db/migrate/20221214201256_create_user_achievements.rb33
-rw-r--r--db/migrate/20221214204247_user_achievements_foreign_keys.rb19
-rw-r--r--db/migrate/20221215210347_partition_pm_package_metadata_tables.rb13
-rw-r--r--db/migrate/20221219103007_add_name_to_ml_candidates.rb6
-rw-r--r--db/migrate/20221219112528_add_text_limit_to_name_on_ml_candidates.rb13
-rw-r--r--db/migrate/20221219135535_add_user_defaults_to_private_profile_to_application_settings.rb7
-rw-r--r--db/migrate/20221221134116_create_elastic_group_index_statuses.rb18
-rw-r--r--db/migrate/20221221171239_rename_amount_used_column.rb22
-rw-r--r--db/migrate/20221222144954_create_analytics_dashboards_configuration_pointers.rb19
-rw-r--r--db/migrate/20221223114543_add_pwa_icon_to_appearances.rb13
-rw-r--r--db/migrate/20221226105323_add_registration_columns_to_ci_runners.rb10
-rw-r--r--db/migrate/20221226132038_index_ci_runners_on_creator_id.rb15
-rw-r--r--db/migrate/20221226163203_create_ci_runner_machines.rb21
-rw-r--r--db/migrate/20221227080606_add_text_limit_to_pwa_icon.rb13
-rw-r--r--db/migrate/20221227100846_add_allow_registration_token_to_application_settings.rb9
-rw-r--r--db/migrate/20221227100908_add_allow_registration_token_to_namespace_settings.rb9
-rw-r--r--db/migrate/20221228063845_add_incident_events_to_integrations.rb7
-rw-r--r--db/migrate/20221228083452_remove_check_constraint_on_chat_names_on_integration.rb15
-rw-r--r--db/migrate/20221228161214_rename_appearances_short_title_to_pwa_short_name.rb13
-rw-r--r--db/migrate/20230104150600_add_machine_id_to_builds_metadata.rb9
-rw-r--r--db/migrate/20230105170414_rename_amount_used_column_on_ci_namespace_monthly_usages_table.rb24
-rw-r--r--db/migrate/20230106125945_add_user_to_ssh_signatures.rb11
-rw-r--r--db/migrate/20230106131659_add_fingerprint_to_ssh_signatures.rb13
-rw-r--r--db/migrate/20230106142239_add_config_column_to_ci_runner_machines.rb9
-rw-r--r--db/migrate/20230109095159_add_runner_machines_created_at_index.rb15
-rw-r--r--db/migrate/20230109121313_add_runner_machines_contacted_at_index.rb16
-rw-r--r--db/migrate/20230109215921_add_storage_admin_control_columns_to_plan_limits.rb11
-rw-r--r--db/migrate/20230110031131_add_uses_legacy_iid_to_test_reports.rb7
-rw-r--r--db/migrate/20230111092510_add_migrate_projects_to_bulk_import_entities.rb7
-rw-r--r--db/migrate/20230111124512_remove_tmp_index_vulns_on_report_type.rb22
-rw-r--r--db/migrate/20230111132621_unpartition_pm_package_metadata_tables.rb54
-rw-r--r--db/migrate/20230112014822_add_user_index_and_fk_to_ssh_signatures.rb20
-rw-r--r--db/migrate/20230112104253_add_tmp_index_to_ci_build_runner_session.rb23
-rw-r--r--db/migrate/20230112104526_add_tmp_index_to_ci_pending_build.rb23
-rw-r--r--db/migrate/20230112104636_add_tmp_index_to_ci_running_build.rb23
269 files changed, 745 insertions, 4113 deletions
diff --git a/db/migrate/20210302025305_add_excluded_urls_and_request_headers_to_dast_site_profiles.rb b/db/migrate/20210302025305_add_excluded_urls_and_request_headers_to_dast_site_profiles.rb
deleted file mode 100644
index 167b8d2c509..00000000000
--- a/db/migrate/20210302025305_add_excluded_urls_and_request_headers_to_dast_site_profiles.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddExcludedUrlsAndRequestHeadersToDastSiteProfiles < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- # rubocop:disable Migration/AddLimitToTextColumns
- # limit is added in 20210311022012_add_text_limits_to_dast_site_profiles
- def change
- add_column :dast_site_profiles, :excluded_urls, :text, array: true, default: [], null: false
- add_column :dast_site_profiles, :auth_enabled, :boolean, default: false, null: false
- add_column :dast_site_profiles, :auth_url, :text
- add_column :dast_site_profiles, :auth_username_field, :text
- add_column :dast_site_profiles, :auth_password_field, :text
- add_column :dast_site_profiles, :auth_username, :text
- end
- # rubocop:enable Migration/AddLimitToTextColumns
-end
diff --git a/db/migrate/20210302103851_add_deployed_deployment_id_index_to_project_pages_metadata.rb b/db/migrate/20210302103851_add_deployed_deployment_id_index_to_project_pages_metadata.rb
deleted file mode 100644
index e10e9a912cc..00000000000
--- a/db/migrate/20210302103851_add_deployed_deployment_id_index_to_project_pages_metadata.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddDeployedDeploymentIdIndexToProjectPagesMetadata < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_on_pages_metadata_not_migrated'
-
- def up
- add_concurrent_index :project_pages_metadata, :project_id, where: "deployed = TRUE AND pages_deployment_id is NULL", name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :project_pages_metadata, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210302155904_remove_index_for_security_orchestration_policy.rb b/db/migrate/20210302155904_remove_index_for_security_orchestration_policy.rb
deleted file mode 100644
index 5d2594f2b9e..00000000000
--- a/db/migrate/20210302155904_remove_index_for_security_orchestration_policy.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveIndexForSecurityOrchestrationPolicy < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_sop_configs_on_security_policy_management_project_id'
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name(:security_orchestration_policy_configurations, INDEX_NAME)
- end
-
- def down
- add_concurrent_index(:security_orchestration_policy_configurations, :security_policy_management_project_id, name: INDEX_NAME)
- end
-end
diff --git a/db/migrate/20210302160544_add_index_to_security_orchestration_policy.rb b/db/migrate/20210302160544_add_index_to_security_orchestration_policy.rb
deleted file mode 100644
index 4750e2bdb79..00000000000
--- a/db/migrate/20210302160544_add_index_to_security_orchestration_policy.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToSecurityOrchestrationPolicy < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX = 'index_sop_configurations_project_id_policy_project_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :security_orchestration_policy_configurations, [:security_policy_management_project_id, :project_id], name: INDEX
- end
-
- def down
- remove_concurrent_index_by_name :security_orchestration_policy_configurations, INDEX
- end
-end
diff --git a/db/migrate/20210302212623_rename_vuln_fingerprints_indexes.rb b/db/migrate/20210302212623_rename_vuln_fingerprints_indexes.rb
deleted file mode 100644
index 0f431fbeda5..00000000000
--- a/db/migrate/20210302212623_rename_vuln_fingerprints_indexes.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# frozen_string_literal: true
-
-class RenameVulnFingerprintsIndexes < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- FINGERPRINT_IDX = :idx_vuln_fingerprints_on_occurrences_id_and_fingerprint
- FINGERPRINT_IDX_RENAMED = :idx_vuln_fingerprints_on_occurrences_id_and_fingerprint_sha256
- UNIQ_IDX = :idx_vuln_fingerprints_uniqueness
- UNIQ_IDX_RENAMED = :idx_vuln_fingerprints_uniqueness_fingerprint_sha256
-
- disable_ddl_transaction!
-
- def up
- # These `unless` checks are necessary for re-running the migrations multiple times
- unless index_exists_by_name?(:vulnerability_finding_fingerprints, FINGERPRINT_IDX_RENAMED)
- rename_index :vulnerability_finding_fingerprints, FINGERPRINT_IDX, FINGERPRINT_IDX_RENAMED
- end
-
- unless index_exists_by_name?(:vulnerability_finding_fingerprints, UNIQ_IDX_RENAMED)
- rename_index :vulnerability_finding_fingerprints, UNIQ_IDX, UNIQ_IDX_RENAMED
- end
- end
-
- def down
- unless index_exists_by_name?(:vulnerability_finding_fingerprints, FINGERPRINT_IDX)
- rename_index :vulnerability_finding_fingerprints, FINGERPRINT_IDX_RENAMED, FINGERPRINT_IDX
- end
-
- unless index_exists_by_name?(:vulnerability_finding_fingerprints, UNIQ_IDX)
- rename_index :vulnerability_finding_fingerprints, UNIQ_IDX_RENAMED, UNIQ_IDX
- end
- end
-end
diff --git a/db/migrate/20210303053341_add_last_edited_at_and_last_edited_by_id_to_notes.rb b/db/migrate/20210303053341_add_last_edited_at_and_last_edited_by_id_to_notes.rb
deleted file mode 100644
index b6f4da202fa..00000000000
--- a/db/migrate/20210303053341_add_last_edited_at_and_last_edited_by_id_to_notes.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddLastEditedAtAndLastEditedByIdToNotes < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- with_lock_retries do
- add_column :notes, :last_edited_at, :datetime_with_timezone
- end
- end
-
- def down
- with_lock_retries do
- remove_column :notes, :last_edited_at
- end
- end
-end
diff --git a/db/migrate/20210303091651_add_index_to_environments_tier.rb b/db/migrate/20210303091651_add_index_to_environments_tier.rb
deleted file mode 100644
index 0ec876945d9..00000000000
--- a/db/migrate/20210303091651_add_index_to_environments_tier.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToEnvironmentsTier < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_environments_on_project_id_and_tier'
-
- DOWNTIME = false
-
- def up
- add_concurrent_index :environments, [:project_id, :tier], where: 'tier IS NOT NULL', name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index :environments, :state, name: INDEX_NAME
- end
-end
diff --git a/db/migrate/20210303165201_add_index_for_succeeded_deployments.rb b/db/migrate/20210303165201_add_index_for_succeeded_deployments.rb
deleted file mode 100644
index 1ae5b36d2f2..00000000000
--- a/db/migrate/20210303165201_add_index_for_succeeded_deployments.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexForSucceededDeployments < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_deployments_on_environment_id_status_and_finished_at'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:deployments, %i[environment_id status finished_at], name: INDEX_NAME)
- end
-
- def down
- remove_concurrent_index_by_name(:deployments, INDEX_NAME)
- end
-end
diff --git a/db/migrate/20210303165301_add_not_null_constraint_to_cluster_token_name.rb b/db/migrate/20210303165301_add_not_null_constraint_to_cluster_token_name.rb
deleted file mode 100644
index 5fc8970b8f9..00000000000
--- a/db/migrate/20210303165301_add_not_null_constraint_to_cluster_token_name.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddNotNullConstraintToClusterTokenName < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- # This will add the `NOT NULL` constraint WITHOUT validating it
- add_not_null_constraint :cluster_agent_tokens, :name, validate: false
- end
-
- def down
- remove_not_null_constraint :cluster_agent_tokens, :name
- end
-end
diff --git a/db/migrate/20210303193544_add_concurrent_fields_to_bulk_imports_trackers.rb b/db/migrate/20210303193544_add_concurrent_fields_to_bulk_imports_trackers.rb
deleted file mode 100644
index a2d3d6daf09..00000000000
--- a/db/migrate/20210303193544_add_concurrent_fields_to_bulk_imports_trackers.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddConcurrentFieldsToBulkImportsTrackers < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- # rubocop:disable Migration/AddLimitToTextColumns
- # rubocop:disable Rails/NotNullColumn
- def up
- add_column :bulk_import_trackers, :jid, :text
- add_column :bulk_import_trackers, :stage, :smallint, default: 0, null: false
- add_column :bulk_import_trackers, :status, :smallint, default: 0, null: false
- end
- # rubocop:enable Migration/AddLimitToTextColumns
- # rubocop:enable Rails/NotNullColumn
-
- def down
- remove_column :bulk_import_trackers, :jid, :text
- remove_column :bulk_import_trackers, :stage, :smallint
- remove_column :bulk_import_trackers, :status, :smallint
- end
-end
diff --git a/db/migrate/20210303193605_add_text_limits_to_bulk_imports_trackers_jid_and_pipeline_name.rb b/db/migrate/20210303193605_add_text_limits_to_bulk_imports_trackers_jid_and_pipeline_name.rb
deleted file mode 100644
index 7686dd0343b..00000000000
--- a/db/migrate/20210303193605_add_text_limits_to_bulk_imports_trackers_jid_and_pipeline_name.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddTextLimitsToBulkImportsTrackersJidAndPipelineName < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_text_limit :bulk_import_trackers, :jid, 255
- end
-
- def down
- remove_text_limit :bulk_import_trackers, :jid
- end
-end
diff --git a/db/migrate/20210305002016_update_terraform_states_locked_by_user_id_foreign_key.rb b/db/migrate/20210305002016_update_terraform_states_locked_by_user_id_foreign_key.rb
deleted file mode 100644
index aa4a4e9c928..00000000000
--- a/db/migrate/20210305002016_update_terraform_states_locked_by_user_id_foreign_key.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class UpdateTerraformStatesLockedByUserIdForeignKey < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- OLD_FOREIGN_KEY = 'fk_rails_558901b030'
- NEW_FOREIGN_KEY = 'fk_558901b030'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :terraform_states, :users,
- column: :locked_by_user_id, on_delete: :nullify, name: NEW_FOREIGN_KEY
-
- with_lock_retries do
- remove_foreign_key :terraform_states, :users, name: OLD_FOREIGN_KEY
- end
- end
-
- def down
- add_concurrent_foreign_key :terraform_states, :users,
- column: :locked_by_user_id, on_delete: nil, name: OLD_FOREIGN_KEY
-
- with_lock_retries do
- remove_foreign_key :terraform_states, :users, name: NEW_FOREIGN_KEY
- end
- end
-end
diff --git a/db/migrate/20210305013509_add_text_limit_to_group_ci_variables_environment_scope.rb b/db/migrate/20210305013509_add_text_limit_to_group_ci_variables_environment_scope.rb
deleted file mode 100644
index f5fa073b954..00000000000
--- a/db/migrate/20210305013509_add_text_limit_to_group_ci_variables_environment_scope.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddTextLimitToGroupCiVariablesEnvironmentScope < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_text_limit :ci_group_variables, :environment_scope, 255
- end
-
- def down
- remove_text_limit :ci_group_variables, :environment_scope
- end
-end
diff --git a/db/migrate/20210305031822_create_dast_site_profile_variables.rb b/db/migrate/20210305031822_create_dast_site_profile_variables.rb
deleted file mode 100644
index 4b8fc982d86..00000000000
--- a/db/migrate/20210305031822_create_dast_site_profile_variables.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# frozen_string_literal: true
-
-class CreateDastSiteProfileVariables < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- table_comment = { owner: 'group::dynamic analysis', description: 'Secret variables used in DAST on-demand scans' }
-
- encrypted_value_constraint_name = check_constraint_name(:dast_site_profile_secret_variables, 'encrypted_value', 'max_length')
- encrypted_value_iv_constraint_name = check_constraint_name(:dast_site_profile_secret_variables, 'encrypted_value_iv', 'max_length')
-
- create_table_with_constraints :dast_site_profile_secret_variables, comment: Gitlab::Json.dump(table_comment) do |t|
- t.references :dast_site_profile, null: false, foreign_key: { on_delete: :cascade }, index: false
-
- t.timestamps_with_timezone
-
- t.integer :variable_type, null: false, default: 1, limit: 2
-
- t.text :key, null: false
- t.binary :encrypted_value, null: false
- t.binary :encrypted_value_iv, null: false, unique: true
-
- t.index [:dast_site_profile_id, :key], unique: true, name: :index_site_profile_secret_variables_on_site_profile_id_and_key
-
- t.text_limit :key, 255
-
- # This does not currently have first-class support via create_table_with_constraints
- t.check_constraint encrypted_value_constraint_name, 'length(encrypted_value) <= 13352'
- t.check_constraint encrypted_value_iv_constraint_name, 'length(encrypted_value_iv) <= 17'
- end
- end
-
- def down
- drop_table :dast_site_profile_secret_variables
- end
-end
diff --git a/db/migrate/20210305145622_add_terraform_module_max_file_size_to_plan_limits.rb b/db/migrate/20210305145622_add_terraform_module_max_file_size_to_plan_limits.rb
deleted file mode 100644
index d2342a66549..00000000000
--- a/db/migrate/20210305145622_add_terraform_module_max_file_size_to_plan_limits.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddTerraformModuleMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :plan_limits, :terraform_module_max_file_size, :bigint, default: 1.gigabyte, null: false
- end
-end
diff --git a/db/migrate/20210305180331_create_ci_unit_tests.rb b/db/migrate/20210305180331_create_ci_unit_tests.rb
deleted file mode 100644
index 970834a025b..00000000000
--- a/db/migrate/20210305180331_create_ci_unit_tests.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-class CreateCiUnitTests < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- unless table_exists?(:ci_unit_tests)
- create_table :ci_unit_tests do |t|
- t.bigint :project_id, null: false
- t.text :key_hash, null: false
- t.text :name, null: false
- t.text :suite_name, null: false
-
- t.index [:project_id, :key_hash], unique: true
- # NOTE: FK for projects will be added on a separate migration as per guidelines
- end
- end
-
- add_text_limit :ci_unit_tests, :key_hash, 64
- add_text_limit :ci_unit_tests, :name, 255
- add_text_limit :ci_unit_tests, :suite_name, 255
- end
-
- def down
- drop_table :ci_unit_tests
- end
-end
diff --git a/db/migrate/20210305182740_add_projects_fk_to_ci_unit_tests.rb b/db/migrate/20210305182740_add_projects_fk_to_ci_unit_tests.rb
deleted file mode 100644
index 5e750d78a24..00000000000
--- a/db/migrate/20210305182740_add_projects_fk_to_ci_unit_tests.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectsFkToCiUnitTests < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :ci_unit_tests, :projects, column: :project_id, on_delete: :cascade
- end
-
- def down
- with_lock_retries do
- remove_foreign_key :ci_unit_tests, column: :project_id
- end
- end
-end
diff --git a/db/migrate/20210305182855_create_ci_unit_test_failures.rb b/db/migrate/20210305182855_create_ci_unit_test_failures.rb
deleted file mode 100644
index b3f68cdba4a..00000000000
--- a/db/migrate/20210305182855_create_ci_unit_test_failures.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class CreateCiUnitTestFailures < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def up
- create_table :ci_unit_test_failures do |t|
- t.datetime_with_timezone :failed_at, null: false
- t.bigint :unit_test_id, null: false
- t.bigint :build_id, null: false
-
- t.index [:unit_test_id, :failed_at, :build_id], name: 'index_unit_test_failures_unique_columns', unique: true, order: { failed_at: :desc }
- t.index :build_id
- # NOTE: Adding the index for failed_at now for later use when we do scheduled clean up
- t.index :failed_at, order: { failed_at: :desc }, name: 'index_unit_test_failures_failed_at'
- t.foreign_key :ci_unit_tests, column: :unit_test_id, on_delete: :cascade
- # NOTE: FK for ci_builds will be added on a separate migration as per guidelines
- end
- end
-
- def down
- drop_table :ci_unit_test_failures
- end
-end
diff --git a/db/migrate/20210305183904_add_ci_builds_fk_to_ci_unit_test_failures.rb b/db/migrate/20210305183904_add_ci_builds_fk_to_ci_unit_test_failures.rb
deleted file mode 100644
index 9cf75ba6059..00000000000
--- a/db/migrate/20210305183904_add_ci_builds_fk_to_ci_unit_test_failures.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddCiBuildsFkToCiUnitTestFailures < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :ci_unit_test_failures, :ci_builds, column: :build_id, on_delete: :cascade
- end
-
- def down
- with_lock_retries do
- remove_foreign_key :ci_unit_test_failures, column: :build_id
- end
- end
-end
diff --git a/db/migrate/20210306121300_partition_web_hook_logs.rb b/db/migrate/20210306121300_partition_web_hook_logs.rb
deleted file mode 100644
index ff35a19648e..00000000000
--- a/db/migrate/20210306121300_partition_web_hook_logs.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class PartitionWebHookLogs < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
- include Gitlab::Database::PartitioningMigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- partition_table_by_date :web_hook_logs, :created_at
- end
-
- def down
- drop_partitioned_table_for :web_hook_logs
- end
-end
diff --git a/db/migrate/20210308125742_add_info_column_into_security_scans_table.rb b/db/migrate/20210308125742_add_info_column_into_security_scans_table.rb
deleted file mode 100644
index d701fa98259..00000000000
--- a/db/migrate/20210308125742_add_info_column_into_security_scans_table.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddInfoColumnIntoSecurityScansTable < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :security_scans, :info, :jsonb, null: false, default: {}
- end
-end
diff --git a/db/migrate/20210308175224_change_namespace_settings_delayed_project_removal_null.rb b/db/migrate/20210308175224_change_namespace_settings_delayed_project_removal_null.rb
deleted file mode 100644
index 5b731b78117..00000000000
--- a/db/migrate/20210308175224_change_namespace_settings_delayed_project_removal_null.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeNamespaceSettingsDelayedProjectRemovalNull < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def up
- change_column :namespace_settings, :delayed_project_removal, :boolean, null: true, default: nil
- end
-
- def down
- change_column_default :namespace_settings, :delayed_project_removal, false
- change_column_null :namespace_settings, :delayed_project_removal, false, false
- end
-end
diff --git a/db/migrate/20210308175225_add_lock_delayed_project_removal_to_namespace_settings.rb b/db/migrate/20210308175225_add_lock_delayed_project_removal_to_namespace_settings.rb
deleted file mode 100644
index e88f3e7ea0d..00000000000
--- a/db/migrate/20210308175225_add_lock_delayed_project_removal_to_namespace_settings.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddLockDelayedProjectRemovalToNamespaceSettings < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :namespace_settings, :lock_delayed_project_removal, :boolean, default: false, null: false
- end
-end
diff --git a/db/migrate/20210308175226_add_delayed_project_removal_to_application_settings.rb b/db/migrate/20210308175226_add_delayed_project_removal_to_application_settings.rb
deleted file mode 100644
index 1ccb25878e4..00000000000
--- a/db/migrate/20210308175226_add_delayed_project_removal_to_application_settings.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddDelayedProjectRemovalToApplicationSettings < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :application_settings, :delayed_project_removal, :boolean, default: false, null: false
- end
-end
diff --git a/db/migrate/20210308175227_add_lock_delayed_project_removal_to_application_settings.rb b/db/migrate/20210308175227_add_lock_delayed_project_removal_to_application_settings.rb
deleted file mode 100644
index c63175493de..00000000000
--- a/db/migrate/20210308175227_add_lock_delayed_project_removal_to_application_settings.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddLockDelayedProjectRemovalToApplicationSettings < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :application_settings, :lock_delayed_project_removal, :boolean, default: false, null: false
- end
-end
diff --git a/db/migrate/20210308190413_change_batched_background_migrations_batch_class_name_default.rb b/db/migrate/20210308190413_change_batched_background_migrations_batch_class_name_default.rb
deleted file mode 100644
index f841c1e9bd5..00000000000
--- a/db/migrate/20210308190413_change_batched_background_migrations_batch_class_name_default.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeBatchedBackgroundMigrationsBatchClassNameDefault < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- change_column_default :batched_background_migrations, :batch_class_name,
- from: 'Gitlab::Database::BackgroundMigration::PrimaryKeyBatchingStrategy', to: 'PrimaryKeyBatchingStrategy'
- end
-end
diff --git a/db/migrate/20210309160106_add_admin_mode_to_application_setting.rb b/db/migrate/20210309160106_add_admin_mode_to_application_setting.rb
deleted file mode 100644
index a7b634596d2..00000000000
--- a/db/migrate/20210309160106_add_admin_mode_to_application_setting.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddAdminModeToApplicationSetting < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :application_settings, :admin_mode, :boolean, default: false, null: false
- end
-end
diff --git a/db/migrate/20210309181019_add_last_used_at_to_cluster_agent_token.rb b/db/migrate/20210309181019_add_last_used_at_to_cluster_agent_token.rb
deleted file mode 100644
index 2a29ab374e5..00000000000
--- a/db/migrate/20210309181019_add_last_used_at_to_cluster_agent_token.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddLastUsedAtToClusterAgentToken < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :cluster_agent_tokens, :last_used_at, :datetime_with_timezone
- end
-end
diff --git a/db/migrate/20210310000627_add_idx_vulnerability_occurrences_dedup.rb b/db/migrate/20210310000627_add_idx_vulnerability_occurrences_dedup.rb
deleted file mode 100644
index 5ffcc005225..00000000000
--- a/db/migrate/20210310000627_add_idx_vulnerability_occurrences_dedup.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddIdxVulnerabilityOccurrencesDedup < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- TABLE = :vulnerability_occurrences
- INDEX_NAME = 'index_vulnerability_occurrences_deduplication'
- COLUMNS = %i[project_id report_type project_fingerprint]
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index TABLE, COLUMNS, name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index TABLE, COLUMNS, name: INDEX_NAME
- end
-end
diff --git a/db/migrate/20210310111009_add_settings_to_group_merge_request_approval_settings.rb b/db/migrate/20210310111009_add_settings_to_group_merge_request_approval_settings.rb
deleted file mode 100644
index 088f400efb9..00000000000
--- a/db/migrate/20210310111009_add_settings_to_group_merge_request_approval_settings.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class AddSettingsToGroupMergeRequestApprovalSettings < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- change_table(:group_merge_request_approval_settings, bulk: true) do |t|
- t.column :allow_committer_approval, :boolean, null: false, default: false
- t.column :allow_overrides_to_approver_list_per_merge_request, :boolean, null: false, default: false
- t.column :retain_approvals_on_push, :boolean, null: false, default: false
- t.column :require_password_to_approve, :boolean, null: false, default: false
- end
- end
-end
diff --git a/db/migrate/20210311022012_add_text_limits_to_dast_site_profiles.rb b/db/migrate/20210311022012_add_text_limits_to_dast_site_profiles.rb
deleted file mode 100644
index 7858449be14..00000000000
--- a/db/migrate/20210311022012_add_text_limits_to_dast_site_profiles.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class AddTextLimitsToDastSiteProfiles < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_text_limit :dast_site_profiles, :auth_url, 1024
- add_text_limit :dast_site_profiles, :auth_username_field, 255
- add_text_limit :dast_site_profiles, :auth_password_field, 255
- add_text_limit :dast_site_profiles, :auth_username, 255
- end
-
- def down
- remove_text_limit :dast_site_profiles, :auth_username
- remove_text_limit :dast_site_profiles, :auth_password_field
- remove_text_limit :dast_site_profiles, :auth_username_field
- remove_text_limit :dast_site_profiles, :auth_url
- end
-end
diff --git a/db/migrate/20210311120152_add_metrics_to_batched_background_migration_jobs.rb b/db/migrate/20210311120152_add_metrics_to_batched_background_migration_jobs.rb
deleted file mode 100644
index 523010a4aea..00000000000
--- a/db/migrate/20210311120152_add_metrics_to_batched_background_migration_jobs.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddMetricsToBatchedBackgroundMigrationJobs < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :batched_background_migration_jobs, :metrics, :jsonb, null: false, default: {}
- end
-end
diff --git a/db/migrate/20210311120153_initialize_conversion_of_events_id_to_bigint.rb b/db/migrate/20210311120153_initialize_conversion_of_events_id_to_bigint.rb
deleted file mode 100644
index f5ff0816047..00000000000
--- a/db/migrate/20210311120153_initialize_conversion_of_events_id_to_bigint.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class InitializeConversionOfEventsIdToBigint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- # Initialize the conversion of events.id to bigint
- # Primary Key of the Events table
- initialize_conversion_of_integer_to_bigint :events, :id
- end
-
- def down
- trigger_name = rename_trigger_name(:events, :id, :id_convert_to_bigint)
-
- remove_rename_triggers :events, trigger_name
-
- remove_column :events, :id_convert_to_bigint
- end
-end
diff --git a/db/migrate/20210311120154_initialize_conversion_of_push_event_payloads_event_id_to_bigint.rb b/db/migrate/20210311120154_initialize_conversion_of_push_event_payloads_event_id_to_bigint.rb
deleted file mode 100644
index 651c9ed993d..00000000000
--- a/db/migrate/20210311120154_initialize_conversion_of_push_event_payloads_event_id_to_bigint.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class InitializeConversionOfPushEventPayloadsEventIdToBigint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- # Foreign key that references events.id
- # Also Primary key of the push_event_payloads table
- initialize_conversion_of_integer_to_bigint :push_event_payloads, :event_id, primary_key: :event_id
- end
-
- def down
- trigger_name = rename_trigger_name(:push_event_payloads, :event_id, :event_id_convert_to_bigint)
-
- remove_rename_triggers :push_event_payloads, trigger_name
-
- remove_column :push_event_payloads, :event_id_convert_to_bigint
- end
-end
diff --git a/db/migrate/20210312140029_add_owner_and_id_index_on_active_ci_pipeline_schedules.rb b/db/migrate/20210312140029_add_owner_and_id_index_on_active_ci_pipeline_schedules.rb
deleted file mode 100644
index 111486a17ab..00000000000
--- a/db/migrate/20210312140029_add_owner_and_id_index_on_active_ci_pipeline_schedules.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddOwnerAndIdIndexOnActiveCiPipelineSchedules < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_ci_pipeline_schedules_on_owner_id_and_id_and_active'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_pipeline_schedules, [:owner_id, :id], where: "active = TRUE", name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :ci_pipeline_schedules, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210312174321_add_enforced_git_check_to_saml_provider.rb b/db/migrate/20210312174321_add_enforced_git_check_to_saml_provider.rb
deleted file mode 100644
index 89553a53084..00000000000
--- a/db/migrate/20210312174321_add_enforced_git_check_to_saml_provider.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddEnforcedGitCheckToSamlProvider < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def up
- add_column :saml_providers, :git_check_enforced, :boolean, default: false, null: false
- end
-
- def down
- remove_column :saml_providers, :git_check_enforced
- end
-end
diff --git a/db/migrate/20210312193532_add_resource_access_token_creation_allowed_to_namespace_settings.rb b/db/migrate/20210312193532_add_resource_access_token_creation_allowed_to_namespace_settings.rb
deleted file mode 100644
index 1de9d87cf25..00000000000
--- a/db/migrate/20210312193532_add_resource_access_token_creation_allowed_to_namespace_settings.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-class AddResourceAccessTokenCreationAllowedToNamespaceSettings < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- with_lock_retries do
- add_column :namespace_settings, :resource_access_token_creation_allowed, :boolean, default: true, null: false
- end
- end
-
- def down
- with_lock_retries do
- remove_column :namespace_settings, :resource_access_token_creation_allowed
- end
- end
-end
diff --git a/db/migrate/20210313045617_add_verification_state_and_started_at_to_snippet_repositories.rb b/db/migrate/20210313045617_add_verification_state_and_started_at_to_snippet_repositories.rb
deleted file mode 100644
index e2d6dff23fa..00000000000
--- a/db/migrate/20210313045617_add_verification_state_and_started_at_to_snippet_repositories.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-class AddVerificationStateAndStartedAtToSnippetRepositories < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- change_table(:snippet_repositories) do |t|
- t.integer :verification_state, default: 0, limit: 2, null: false
- t.column :verification_started_at, :datetime_with_timezone
- end
- end
-end
diff --git a/db/migrate/20210313045845_add_verification_indexes_to_snippet_repositories.rb b/db/migrate/20210313045845_add_verification_indexes_to_snippet_repositories.rb
deleted file mode 100644
index ebbc1126aa2..00000000000
--- a/db/migrate/20210313045845_add_verification_indexes_to_snippet_repositories.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class AddVerificationIndexesToSnippetRepositories < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- VERIFICATION_STATE_INDEX_NAME = "index_snippet_repositories_verification_state"
- PENDING_VERIFICATION_INDEX_NAME = "index_snippet_repositories_pending_verification"
- FAILED_VERIFICATION_INDEX_NAME = "index_snippet_repositories_failed_verification"
- NEEDS_VERIFICATION_INDEX_NAME = "index_snippet_repositories_needs_verification"
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :snippet_repositories, :verification_state, name: VERIFICATION_STATE_INDEX_NAME
- add_concurrent_index :snippet_repositories, :verified_at, where: "(verification_state = 0)", order: { verified_at: 'ASC NULLS FIRST' }, name: PENDING_VERIFICATION_INDEX_NAME
- add_concurrent_index :snippet_repositories, :verification_retry_at, where: "(verification_state = 3)", order: { verification_retry_at: 'ASC NULLS FIRST' }, name: FAILED_VERIFICATION_INDEX_NAME
- add_concurrent_index :snippet_repositories, :verification_state, where: "(verification_state = 0 OR verification_state = 3)", name: NEEDS_VERIFICATION_INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :snippet_repositories, VERIFICATION_STATE_INDEX_NAME
- remove_concurrent_index_by_name :snippet_repositories, PENDING_VERIFICATION_INDEX_NAME
- remove_concurrent_index_by_name :snippet_repositories, FAILED_VERIFICATION_INDEX_NAME
- remove_concurrent_index_by_name :snippet_repositories, NEEDS_VERIFICATION_INDEX_NAME
- end
-end
diff --git a/db/migrate/20210316094047_add_trial_extension_type_to_gitlab_subscription_histories.rb b/db/migrate/20210316094047_add_trial_extension_type_to_gitlab_subscription_histories.rb
deleted file mode 100644
index 3915689e0af..00000000000
--- a/db/migrate/20210316094047_add_trial_extension_type_to_gitlab_subscription_histories.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddTrialExtensionTypeToGitlabSubscriptionHistories < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :gitlab_subscription_histories, :trial_extension_type, :smallint
- end
-end
diff --git a/db/migrate/20210316094323_add_trial_extension_type_to_gitlab_subscriptions.rb b/db/migrate/20210316094323_add_trial_extension_type_to_gitlab_subscriptions.rb
deleted file mode 100644
index fb0ee789277..00000000000
--- a/db/migrate/20210316094323_add_trial_extension_type_to_gitlab_subscriptions.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddTrialExtensionTypeToGitlabSubscriptions < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- with_lock_retries do
- add_column :gitlab_subscriptions, :trial_extension_type, :smallint
- end
- end
-
- def down
- with_lock_retries do
- remove_column :gitlab_subscriptions, :trial_extension_type
- end
- end
-end
diff --git a/db/migrate/20210316152500_add_index_ci_stages_on_pipeline_id_and_id.rb b/db/migrate/20210316152500_add_index_ci_stages_on_pipeline_id_and_id.rb
deleted file mode 100644
index 1128bf586ae..00000000000
--- a/db/migrate/20210316152500_add_index_ci_stages_on_pipeline_id_and_id.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexCiStagesOnPipelineIdAndId < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_ci_stages_on_pipeline_id_and_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_stages, %i[pipeline_id id], where: 'status IN (0, 1, 2, 8, 9, 10)', name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :ci_stages, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210316171009_create_packages_helm_file_metadata.rb b/db/migrate/20210316171009_create_packages_helm_file_metadata.rb
deleted file mode 100644
index 47a9b808e63..00000000000
--- a/db/migrate/20210316171009_create_packages_helm_file_metadata.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class CreatePackagesHelmFileMetadata < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- create_table_with_constraints :packages_helm_file_metadata, id: false do |t|
- t.timestamps_with_timezone
- t.references :package_file, primary_key: true, index: false, default: nil, null: false, foreign_key: { to_table: :packages_package_files, on_delete: :cascade }, type: :bigint
- t.text :channel, null: false
- t.jsonb :metadata
-
- t.text_limit :channel, 63
-
- t.index :channel
- end
- end
-
- def down
- with_lock_retries do
- drop_table :packages_helm_file_metadata
- end
- end
-end
diff --git a/db/migrate/20210317035357_create_dast_profiles_pipelines.rb b/db/migrate/20210317035357_create_dast_profiles_pipelines.rb
deleted file mode 100644
index f84e1237643..00000000000
--- a/db/migrate/20210317035357_create_dast_profiles_pipelines.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class CreateDastProfilesPipelines < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def up
- table_comment = { owner: 'group::dynamic analysis', description: 'Join table between DAST Profiles and CI Pipelines' }
-
- create_table :dast_profiles_pipelines, primary_key: [:dast_profile_id, :ci_pipeline_id], comment: Gitlab::Json.dump(table_comment) do |t|
- t.bigint :dast_profile_id, null: false
- t.bigint :ci_pipeline_id, null: false
-
- t.index :ci_pipeline_id, unique: true, name: :index_dast_profiles_pipelines_on_ci_pipeline_id
- end
- end
-
- def down
- drop_table :dast_profiles_pipelines
- end
-end
diff --git a/db/migrate/20210317100520_create_elastic_index_settings.rb b/db/migrate/20210317100520_create_elastic_index_settings.rb
deleted file mode 100644
index 61c1cbb3518..00000000000
--- a/db/migrate/20210317100520_create_elastic_index_settings.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class CreateElasticIndexSettings < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- create_table_with_constraints :elastic_index_settings do |t|
- t.timestamps_with_timezone null: false
- t.integer :number_of_replicas, null: false, default: 1, limit: 2
- t.integer :number_of_shards, null: false, default: 5, limit: 2
- t.text :alias_name, null: false
-
- t.text_limit :alias_name, 255
- t.index :alias_name, unique: true
- end
- end
-
- def down
- drop_table :elastic_index_settings
- end
-end
diff --git a/db/migrate/20210317104301_create_in_product_marketing_emails.rb b/db/migrate/20210317104301_create_in_product_marketing_emails.rb
deleted file mode 100644
index b8c6b952c97..00000000000
--- a/db/migrate/20210317104301_create_in_product_marketing_emails.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-class CreateInProductMarketingEmails < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- UNIQUE_INDEX_NAME = 'index_in_product_marketing_emails_on_user_track_series'
-
- disable_ddl_transaction!
-
- def up
- with_lock_retries do
- create_table :in_product_marketing_emails do |t|
- t.bigint :user_id, null: false
- t.datetime_with_timezone :cta_clicked_at
- t.integer :track, null: false, limit: 2
- t.integer :series, null: false, limit: 2
-
- t.timestamps_with_timezone
- end
- end
-
- add_index :in_product_marketing_emails, :user_id
- add_index :in_product_marketing_emails, [:user_id, :track, :series], unique: true, name: UNIQUE_INDEX_NAME
- end
-
- def down
- with_lock_retries do
- drop_table :in_product_marketing_emails
- end
- end
-end
diff --git a/db/migrate/20210317105904_add_user_foreign_key_to_in_product_marketing_emails.rb b/db/migrate/20210317105904_add_user_foreign_key_to_in_product_marketing_emails.rb
deleted file mode 100644
index f0b4d97d2cf..00000000000
--- a/db/migrate/20210317105904_add_user_foreign_key_to_in_product_marketing_emails.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddUserForeignKeyToInProductMarketingEmails < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :in_product_marketing_emails, :users, column: :user_id, on_delete: :cascade
- end
-
- def down
- with_lock_retries do
- remove_foreign_key :in_product_marketing_emails, column: :user_id
- end
- end
-end
diff --git a/db/migrate/20210317123054_add_throttle_package_registry_columns.rb b/db/migrate/20210317123054_add_throttle_package_registry_columns.rb
deleted file mode 100644
index 0bb731306c0..00000000000
--- a/db/migrate/20210317123054_add_throttle_package_registry_columns.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class AddThrottlePackageRegistryColumns < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :application_settings, :throttle_unauthenticated_packages_api_requests_per_period, :integer, default: 800, null: false
- add_column :application_settings, :throttle_unauthenticated_packages_api_period_in_seconds, :integer, default: 15, null: false
- add_column :application_settings, :throttle_authenticated_packages_api_requests_per_period, :integer, default: 1000, null: false
- add_column :application_settings, :throttle_authenticated_packages_api_period_in_seconds, :integer, default: 15, null: false
- add_column :application_settings, :throttle_unauthenticated_packages_api_enabled, :boolean, default: false, null: false
- add_column :application_settings, :throttle_authenticated_packages_api_enabled, :boolean, default: false, null: false
- end
-end
diff --git a/db/migrate/20210317192943_add_expiry_notification_delivered_to_keys.rb b/db/migrate/20210317192943_add_expiry_notification_delivered_to_keys.rb
deleted file mode 100644
index 15f319b3965..00000000000
--- a/db/migrate/20210317192943_add_expiry_notification_delivered_to_keys.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddExpiryNotificationDeliveredToKeys < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :keys, :expiry_notification_delivered_at, :datetime_with_timezone
- end
-end
diff --git a/db/migrate/20210317210338_add_valid_runner_registrars.rb b/db/migrate/20210317210338_add_valid_runner_registrars.rb
deleted file mode 100644
index 61663836d39..00000000000
--- a/db/migrate/20210317210338_add_valid_runner_registrars.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class AddValidRunnerRegistrars < ActiveRecord::Migration[6.0]
- def change
- add_column :application_settings, :valid_runner_registrars, :string, array: true, default: %w(project group)
- end
-end
diff --git a/db/migrate/20210318134427_delete_security_findings_without_uuid.rb b/db/migrate/20210318134427_delete_security_findings_without_uuid.rb
deleted file mode 100644
index f8e0f0fb32b..00000000000
--- a/db/migrate/20210318134427_delete_security_findings_without_uuid.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class DeleteSecurityFindingsWithoutUuid < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- class SecurityFinding < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'security_findings'
-
- scope :without_uuid, -> { where(uuid: nil) }
- end
-
- def up
- SecurityFinding.without_uuid.each_batch(of: 10_000) do |relation|
- relation.delete_all
- end
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20210319071214_add_helm_max_file_size_to_plan_limits.rb b/db/migrate/20210319071214_add_helm_max_file_size_to_plan_limits.rb
deleted file mode 100644
index 9a4789b5c1a..00000000000
--- a/db/migrate/20210319071214_add_helm_max_file_size_to_plan_limits.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddHelmMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :plan_limits, :helm_max_file_size, :bigint, default: 5.megabyte, null: false
- end
-end
diff --git a/db/migrate/20210322063407_add_dast_profile_id_fk_to_dast_profiles_pipelines.rb b/db/migrate/20210322063407_add_dast_profile_id_fk_to_dast_profiles_pipelines.rb
deleted file mode 100644
index 4e9b3ddd41c..00000000000
--- a/db/migrate/20210322063407_add_dast_profile_id_fk_to_dast_profiles_pipelines.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddDastProfileIdFkToDastProfilesPipelines < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :dast_profiles_pipelines, :dast_profiles, column: :dast_profile_id, on_delete: :cascade
- end
-
- def down
- with_lock_retries do
- remove_foreign_key :dast_profiles_pipelines, column: :dast_profile_id
- end
- end
-end
diff --git a/db/migrate/20210322063450_add_ci_pipeline_id_fk_to_dast_profiles_pipelines.rb b/db/migrate/20210322063450_add_ci_pipeline_id_fk_to_dast_profiles_pipelines.rb
deleted file mode 100644
index f1dce7f0cd8..00000000000
--- a/db/migrate/20210322063450_add_ci_pipeline_id_fk_to_dast_profiles_pipelines.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddCiPipelineIdFkToDastProfilesPipelines < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :dast_profiles_pipelines, :ci_pipelines, column: :ci_pipeline_id, on_delete: :cascade
- end
-
- def down
- with_lock_retries do
- remove_foreign_key :dast_profiles_pipelines, column: :ci_pipeline_id
- end
- end
-end
diff --git a/db/migrate/20210322182751_add_index_to_keys_on_expires_at_and_expiry_notification_undelivered.rb b/db/migrate/20210322182751_add_index_to_keys_on_expires_at_and_expiry_notification_undelivered.rb
deleted file mode 100644
index 6387d8a6a43..00000000000
--- a/db/migrate/20210322182751_add_index_to_keys_on_expires_at_and_expiry_notification_undelivered.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToKeysOnExpiresAtAndExpiryNotificationUndelivered < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_keys_on_expires_at_and_expiry_notification_undelivered'
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :keys,
- "date(timezone('UTC', expires_at)), expiry_notification_delivered_at",
- where: 'expiry_notification_delivered_at IS NULL', name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name(:keys, INDEX_NAME)
- end
-end
diff --git a/db/migrate/20210323064751_add_namespace_traversal_ids_index.rb b/db/migrate/20210323064751_add_namespace_traversal_ids_index.rb
deleted file mode 100644
index 162173f6629..00000000000
--- a/db/migrate/20210323064751_add_namespace_traversal_ids_index.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddNamespaceTraversalIdsIndex < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_namespaces_on_traversal_ids'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :namespaces, :traversal_ids, using: :gin, name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :namespaces, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210323125809_create_status_check_responses_table.rb b/db/migrate/20210323125809_create_status_check_responses_table.rb
deleted file mode 100644
index 3fa7ff7165c..00000000000
--- a/db/migrate/20210323125809_create_status_check_responses_table.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class CreateStatusCheckResponsesTable < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- create_table :status_check_responses do |t|
- t.bigint :merge_request_id, null: false
- t.bigint :external_approval_rule_id, null: false
- end
-
- add_index :status_check_responses, :merge_request_id
- add_index :status_check_responses, :external_approval_rule_id
- end
-
- def down
- drop_table :status_check_responses
- end
-end
diff --git a/db/migrate/20210323130831_add_merge_request_foreign_key_to_status_check_responses.rb b/db/migrate/20210323130831_add_merge_request_foreign_key_to_status_check_responses.rb
deleted file mode 100644
index cee0b9a231e..00000000000
--- a/db/migrate/20210323130831_add_merge_request_foreign_key_to_status_check_responses.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddMergeRequestForeignKeyToStatusCheckResponses < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :status_check_responses, :merge_requests, column: :merge_request_id, on_delete: :cascade
- end
-
- def down
- with_lock_retries do
- remove_foreign_key :status_check_responses, column: :merge_request_id
- end
- end
-end
diff --git a/db/migrate/20210323131543_add_external_approval_rule_foreign_key_to_status_check_responses.rb b/db/migrate/20210323131543_add_external_approval_rule_foreign_key_to_status_check_responses.rb
deleted file mode 100644
index ab28c20dbb1..00000000000
--- a/db/migrate/20210323131543_add_external_approval_rule_foreign_key_to_status_check_responses.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddExternalApprovalRuleForeignKeyToStatusCheckResponses < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :status_check_responses, :external_approval_rules, column: :external_approval_rule_id, on_delete: :cascade
- end
-
- def down
- with_lock_retries do
- remove_foreign_key :status_check_responses, column: :external_approval_rule_id
- end
- end
-end
diff --git a/db/migrate/20210323155010_populate_dismissal_information_for_vulnerabilities.rb b/db/migrate/20210323155010_populate_dismissal_information_for_vulnerabilities.rb
deleted file mode 100644
index aee6d5484d5..00000000000
--- a/db/migrate/20210323155010_populate_dismissal_information_for_vulnerabilities.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# frozen_string_literal: true
-
-class PopulateDismissalInformationForVulnerabilities < ActiveRecord::Migration[6.0]
- DOWNTIME = false
- BATCH_SIZE = 100
- UPDATE_QUERY = <<~SQL
- UPDATE
- vulnerabilities
- SET
- dismissed_at = COALESCE(dismissed_at, updated_at),
- dismissed_by_id = COALESCE(dismissed_by_id, updated_by_id, last_edited_by_id, author_id)
- WHERE
- vulnerabilities.id IN (%{ids})
- SQL
-
- class Vulnerability < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'vulnerabilities'
-
- enum state: { detected: 1, confirmed: 4, resolved: 3, dismissed: 2 }
-
- scope :broken, -> { dismissed.where('dismissed_at IS NULL OR dismissed_by_id IS NULL') }
- end
-
- def up
- Vulnerability.broken.each_batch(of: BATCH_SIZE) do |batch|
- query = format(UPDATE_QUERY, ids: batch.select(:id).to_sql)
-
- connection.execute(query)
- end
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20210323182846_add_project_status_date_index_to_merge_requests.rb b/db/migrate/20210323182846_add_project_status_date_index_to_merge_requests.rb
deleted file mode 100644
index 1ec6bc0bf2e..00000000000
--- a/db/migrate/20210323182846_add_project_status_date_index_to_merge_requests.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectStatusDateIndexToMergeRequests < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = "idx_mrs_on_target_id_and_created_at_and_state_id"
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :merge_requests, %i[target_project_id state_id created_at id], name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :merge_requests, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210324112439_add_index_mirror_data_on_retry_next_execution_where_status.rb b/db/migrate/20210324112439_add_index_mirror_data_on_retry_next_execution_where_status.rb
deleted file mode 100644
index 68ce5363b70..00000000000
--- a/db/migrate/20210324112439_add_index_mirror_data_on_retry_next_execution_where_status.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddIndexMirrorDataOnRetryNextExecutionWhereStatus < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- INDEX_NAME = 'index_mirror_data_non_scheduled_or_started'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :project_mirror_data,
- [:next_execution_timestamp, :retry_count],
- where: "(status)::text <> ALL ('{scheduled,started}'::text[])",
- name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index :project_mirror_data,
- [:next_execution_timestamp, :retry_count],
- where: "(status)::text <> ALL ('{scheduled,started}'::text[])",
- name: INDEX_NAME
- end
-end
diff --git a/db/migrate/20210324131727_migrate_elastic_index_settings.rb b/db/migrate/20210324131727_migrate_elastic_index_settings.rb
deleted file mode 100644
index 4dcfc6cf952..00000000000
--- a/db/migrate/20210324131727_migrate_elastic_index_settings.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-class MigrateElasticIndexSettings < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- ALIAS_NAME = [Rails.application.class.module_parent_name.downcase, Rails.env].join('-')
-
- class ElasticIndexSetting < ActiveRecord::Base
- end
-
- class ApplicationSetting < ActiveRecord::Base
- end
-
- def up
- setting = ApplicationSetting.first
- number_of_replicas = setting&.elasticsearch_replicas || 1
- number_of_shards = setting&.elasticsearch_shards || 5
-
- return if ElasticIndexSetting.exists?(alias_name: ALIAS_NAME)
-
- ElasticIndexSetting.create!(
- alias_name: ALIAS_NAME,
- number_of_replicas: number_of_replicas,
- number_of_shards: number_of_shards
- )
- end
-
- def down
- ElasticIndexSetting.where(alias_name: ALIAS_NAME).delete_all
- end
-end
diff --git a/db/migrate/20210325092215_add_not_valid_foreign_key_to_group_hooks.rb b/db/migrate/20210325092215_add_not_valid_foreign_key_to_group_hooks.rb
deleted file mode 100644
index 2389f90d498..00000000000
--- a/db/migrate/20210325092215_add_not_valid_foreign_key_to_group_hooks.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddNotValidForeignKeyToGroupHooks < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- with_lock_retries do
- add_foreign_key :web_hooks, :namespaces, column: :group_id, on_delete: :cascade, validate: false
- end
- end
-
- def down
- with_lock_retries do
- remove_foreign_key_if_exists :web_hooks, column: :group_id
- end
- end
-end
diff --git a/db/migrate/20210325113129_validate_foreign_key_on_service_hooks.rb b/db/migrate/20210325113129_validate_foreign_key_on_service_hooks.rb
deleted file mode 100644
index 17dd4cad6ae..00000000000
--- a/db/migrate/20210325113129_validate_foreign_key_on_service_hooks.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class ValidateForeignKeyOnServiceHooks < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- CONSTRAINT_NAME = 'fk_d47999a98a'
-
- def up
- validate_foreign_key :web_hooks, :service_id, name: CONSTRAINT_NAME
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20210325150837_add_verification_state_to_ci_pipeline_artifact.rb b/db/migrate/20210325150837_add_verification_state_to_ci_pipeline_artifact.rb
deleted file mode 100644
index f6c506e59b7..00000000000
--- a/db/migrate/20210325150837_add_verification_state_to_ci_pipeline_artifact.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddVerificationStateToCiPipelineArtifact < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- change_table(:ci_pipeline_artifacts, bulk: true) do |t|
- t.column :verification_started_at, :datetime_with_timezone
- t.column :verification_retry_at, :datetime_with_timezone
- t.column :verified_at, :datetime_with_timezone
- t.integer :verification_state, default: 0, limit: 2, null: false
- t.integer :verification_retry_count, limit: 2
- t.binary :verification_checksum, using: 'verification_checksum::bytea'
-
- t.text :verification_failure # rubocop:disable Migration/AddLimitToTextColumns
- end
- end
-end
diff --git a/db/migrate/20210325151758_add_verification_failure_limit_to_ci_pipeline_artifact.rb b/db/migrate/20210325151758_add_verification_failure_limit_to_ci_pipeline_artifact.rb
deleted file mode 100644
index bc4dee2181f..00000000000
--- a/db/migrate/20210325151758_add_verification_failure_limit_to_ci_pipeline_artifact.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddVerificationFailureLimitToCiPipelineArtifact < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- CONSTRAINT_NAME = 'ci_pipeline_artifacts_verification_failure_text_limit'
-
- def up
- add_text_limit :ci_pipeline_artifacts, :verification_failure, 255, constraint_name: CONSTRAINT_NAME
- end
-
- def down
- remove_check_constraint(:ci_pipeline_artifacts, CONSTRAINT_NAME)
- end
-end
diff --git a/db/migrate/20210325152011_add_verification_indexes_to_ci_pipeline_artifacts.rb b/db/migrate/20210325152011_add_verification_indexes_to_ci_pipeline_artifacts.rb
deleted file mode 100644
index 0822aee35a4..00000000000
--- a/db/migrate/20210325152011_add_verification_indexes_to_ci_pipeline_artifacts.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class AddVerificationIndexesToCiPipelineArtifacts < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- VERIFICATION_STATE_INDEX_NAME = "index_ci_pipeline_artifacts_verification_state"
- PENDING_VERIFICATION_INDEX_NAME = "index_ci_pipeline_artifacts_pending_verification"
- FAILED_VERIFICATION_INDEX_NAME = "index_ci_pipeline_artifacts_failed_verification"
- NEEDS_VERIFICATION_INDEX_NAME = "index_ci_pipeline_artifacts_needs_verification"
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_pipeline_artifacts, :verification_state, name: VERIFICATION_STATE_INDEX_NAME
- add_concurrent_index :ci_pipeline_artifacts, :verified_at, where: "(verification_state = 0)", order: { verified_at: 'ASC NULLS FIRST' }, name: PENDING_VERIFICATION_INDEX_NAME
- add_concurrent_index :ci_pipeline_artifacts, :verification_retry_at, where: "(verification_state = 3)", order: { verification_retry_at: 'ASC NULLS FIRST' }, name: FAILED_VERIFICATION_INDEX_NAME
- add_concurrent_index :ci_pipeline_artifacts, :verification_state, where: "(verification_state = 0 OR verification_state = 3)", name: NEEDS_VERIFICATION_INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :ci_pipeline_artifacts, VERIFICATION_STATE_INDEX_NAME
- remove_concurrent_index_by_name :ci_pipeline_artifacts, PENDING_VERIFICATION_INDEX_NAME
- remove_concurrent_index_by_name :ci_pipeline_artifacts, FAILED_VERIFICATION_INDEX_NAME
- remove_concurrent_index_by_name :ci_pipeline_artifacts, NEEDS_VERIFICATION_INDEX_NAME
- end
-end
diff --git a/db/migrate/20210326035553_add_index_for_project_deployments_with_environment_id_and_updated_at.rb b/db/migrate/20210326035553_add_index_for_project_deployments_with_environment_id_and_updated_at.rb
deleted file mode 100644
index d10c9401a31..00000000000
--- a/db/migrate/20210326035553_add_index_for_project_deployments_with_environment_id_and_updated_at.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexForProjectDeploymentsWithEnvironmentIdAndUpdatedAt < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_deployments_on_project_and_environment_and_updated_at'
-
- def up
- add_concurrent_index :deployments, [:project_id, :environment_id, :updated_at], name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :deployments, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210326190903_create_vulnerability_finding_evidences.rb b/db/migrate/20210326190903_create_vulnerability_finding_evidences.rb
deleted file mode 100644
index 4de02a6762e..00000000000
--- a/db/migrate/20210326190903_create_vulnerability_finding_evidences.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class CreateVulnerabilityFindingEvidences < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- create_table_with_constraints :vulnerability_finding_evidences do |t|
- t.timestamps_with_timezone null: false
-
- t.references :vulnerability_occurrence, index: { name: 'finding_evidences_on_vulnerability_occurrence_id' }, null: false, foreign_key: { on_delete: :cascade }
- t.text :summary
-
- t.text_limit :summary, 8_000_000
- end
- end
-
- def down
- with_lock_retries do
- drop_table :vulnerability_finding_evidences
- end
- end
-end
diff --git a/db/migrate/20210329095548_add_target_project_and_source_branch_index_to_merge_request.rb b/db/migrate/20210329095548_add_target_project_and_source_branch_index_to_merge_request.rb
deleted file mode 100644
index d351de6bd77..00000000000
--- a/db/migrate/20210329095548_add_target_project_and_source_branch_index_to_merge_request.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddTargetProjectAndSourceBranchIndexToMergeRequest < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_merge_requests_on_target_project_id_and_source_branch'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :merge_requests, [:target_project_id, :source_branch], name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :epic_issues, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210329191850_add_finding_signature_table.rb b/db/migrate/20210329191850_add_finding_signature_table.rb
deleted file mode 100644
index 74a12d54a8e..00000000000
--- a/db/migrate/20210329191850_add_finding_signature_table.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# frozen_string_literal: true
-
-class AddFindingSignatureTable < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- SIGNATURE_IDX = :idx_vuln_signatures_on_occurrences_id_and_signature_sha
- UNIQ_IDX = :idx_vuln_signatures_uniqueness_signature_sha
-
- def up
- with_lock_retries do
- create_table :vulnerability_finding_signatures do |t|
- t.references :finding,
- index: true,
- null: false,
- foreign_key: { to_table: :vulnerability_occurrences, column: :finding_id, on_delete: :cascade }
-
- t.timestamps_with_timezone null: false
-
- t.integer :algorithm_type, null: false, limit: 2
- t.binary :signature_sha, null: false
-
- t.index %i[finding_id signature_sha],
- name: SIGNATURE_IDX,
- unique: true # only one link should exist between occurrence and the signature
-
- t.index %i[finding_id algorithm_type signature_sha],
- name: UNIQ_IDX,
- unique: true # these should be unique
- end
- end
- end
-
- def down
- with_lock_retries do
- drop_table :vulnerability_finding_signatures
- end
- end
-end
diff --git a/db/migrate/20210329192716_add_composite_index_to_award_emoji.rb b/db/migrate/20210329192716_add_composite_index_to_award_emoji.rb
deleted file mode 100644
index ce37afdbc29..00000000000
--- a/db/migrate/20210329192716_add_composite_index_to_award_emoji.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddCompositeIndexToAwardEmoji < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'idx_award_emoji_on_user_emoji_name_awardable_type_awardable_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :award_emoji, %i[user_id name awardable_type awardable_id], name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :award_emoji, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210330015805_add_cloud_to_licenses.rb b/db/migrate/20210330015805_add_cloud_to_licenses.rb
deleted file mode 100644
index d0c7112d0b0..00000000000
--- a/db/migrate/20210330015805_add_cloud_to_licenses.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddCloudToLicenses < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :licenses, :cloud, :boolean, default: false
- end
-end
diff --git a/db/migrate/20210331000934_add_config_to_ci_runners.rb b/db/migrate/20210331000934_add_config_to_ci_runners.rb
deleted file mode 100644
index e9a5fadc613..00000000000
--- a/db/migrate/20210331000934_add_config_to_ci_runners.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class AddConfigToCiRunners < ActiveRecord::Migration[6.0]
- def change
- add_column :ci_runners, :config, :jsonb, default: {}, null: false
- end
-end
diff --git a/db/migrate/20210331125111_add_default_target_project.rb b/db/migrate/20210331125111_add_default_target_project.rb
deleted file mode 100644
index 1a2c5ccca7d..00000000000
--- a/db/migrate/20210331125111_add_default_target_project.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddDefaultTargetProject < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- with_lock_retries do
- add_column :project_settings, :mr_default_target_self, :boolean, default: false, null: false
- end
- end
-
- def down
- with_lock_retries do
- remove_column :project_settings, :mr_default_target_self
- end
- end
-end
diff --git a/db/migrate/20210331145548_add_index_for_last_deployment.rb b/db/migrate/20210331145548_add_index_for_last_deployment.rb
deleted file mode 100644
index a50d8ea403a..00000000000
--- a/db/migrate/20210331145548_add_index_for_last_deployment.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexForLastDeployment < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_deployments_on_environment_id_status_and_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :deployments, [:environment_id, :status, :id], name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :deployments, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210331180118_remove_deprecated_index_from_award_emoji.rb b/db/migrate/20210331180118_remove_deprecated_index_from_award_emoji.rb
deleted file mode 100644
index b8787eb171c..00000000000
--- a/db/migrate/20210331180118_remove_deprecated_index_from_award_emoji.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveDeprecatedIndexFromAwardEmoji < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_award_emoji_on_user_id_and_name'
-
- disable_ddl_transaction!
-
- def up
- # Index deprecated in favor of idx_award_emoji_on_user_emoji_name_awardable_type_awardable_id
- remove_concurrent_index_by_name(:award_emoji, INDEX_NAME)
- end
-
- def down
- add_concurrent_index(:award_emoji, [:user_id, :name], name: INDEX_NAME)
- end
-end
diff --git a/db/migrate/20210401134157_add_index_to_pages_deployments.rb b/db/migrate/20210401134157_add_index_to_pages_deployments.rb
deleted file mode 100644
index aef27c7c6f9..00000000000
--- a/db/migrate/20210401134157_add_index_to_pages_deployments.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToPagesDeployments < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_pages_deployments_on_file_store_and_id'
-
- def up
- add_concurrent_index :pages_deployments, [:file_store, :id], name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :pages_deployments, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210401134455_remove_index_mirror_data_on_next_execution_and_retry_count.rb b/db/migrate/20210401134455_remove_index_mirror_data_on_next_execution_and_retry_count.rb
deleted file mode 100644
index ee59e72e398..00000000000
--- a/db/migrate/20210401134455_remove_index_mirror_data_on_next_execution_and_retry_count.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class RemoveIndexMirrorDataOnNextExecutionAndRetryCount < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- INDEX_NAME = 'index_mirror_data_on_next_execution_and_retry_count'
-
- def up
- remove_concurrent_index(
- :project_mirror_data,
- %i[next_execution_timestamp retry_count],
- name: INDEX_NAME
- )
- end
-
- def down
- add_concurrent_index(
- :project_mirror_data,
- %i[next_execution_timestamp retry_count],
- name: INDEX_NAME
- )
- end
-end
diff --git a/db/migrate/20210401175134_add_before_expiry_notification_delivered_to_keys.rb b/db/migrate/20210401175134_add_before_expiry_notification_delivered_to_keys.rb
deleted file mode 100644
index 6a2ea0e738c..00000000000
--- a/db/migrate/20210401175134_add_before_expiry_notification_delivered_to_keys.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddBeforeExpiryNotificationDeliveredToKeys < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :keys, :before_expiry_notification_delivered_at, :datetime_with_timezone
- end
-end
diff --git a/db/migrate/20210401192808_add_index_to_keys_on_expires_at_and_before_expiry_notification_undelivered.rb b/db/migrate/20210401192808_add_index_to_keys_on_expires_at_and_before_expiry_notification_undelivered.rb
deleted file mode 100644
index ff792d2e6e6..00000000000
--- a/db/migrate/20210401192808_add_index_to_keys_on_expires_at_and_before_expiry_notification_undelivered.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToKeysOnExpiresAtAndBeforeExpiryNotificationUndelivered < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'idx_keys_expires_at_and_before_expiry_notification_undelivered'
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :keys,
- "date(timezone('UTC', expires_at)), before_expiry_notification_delivered_at",
- where: 'before_expiry_notification_delivered_at IS NULL', name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name(:keys, INDEX_NAME)
- end
-end
diff --git a/db/migrate/20210406063442_create_namespaces_id_parent_id_partial_index.rb b/db/migrate/20210406063442_create_namespaces_id_parent_id_partial_index.rb
deleted file mode 100644
index 073d1ee2bc5..00000000000
--- a/db/migrate/20210406063442_create_namespaces_id_parent_id_partial_index.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class CreateNamespacesIdParentIdPartialIndex < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- NAME = 'index_namespaces_id_parent_id_is_null'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :namespaces, :id, where: 'parent_id IS NULL', name: NAME
- end
-
- def down
- remove_concurrent_index :namespaces, :id, name: NAME
- end
-end
diff --git a/db/migrate/20210406140057_add_total_tuple_count_to_batched_migrations.rb b/db/migrate/20210406140057_add_total_tuple_count_to_batched_migrations.rb
deleted file mode 100644
index 32b5f27a577..00000000000
--- a/db/migrate/20210406140057_add_total_tuple_count_to_batched_migrations.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddTotalTupleCountToBatchedMigrations < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def up
- add_column :batched_background_migrations, :total_tuple_count, :bigint
- end
-
- def down
- remove_column :batched_background_migrations, :total_tuple_count
- end
-end
diff --git a/db/migrate/20210407002511_add_type_to_dast_site_profile.rb b/db/migrate/20210407002511_add_type_to_dast_site_profile.rb
deleted file mode 100644
index 99d9970a2a8..00000000000
--- a/db/migrate/20210407002511_add_type_to_dast_site_profile.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class AddTypeToDastSiteProfile < ActiveRecord::Migration[6.0]
- def change
- add_column :dast_site_profiles, :target_type, :integer, limit: 2, default: 0, null: false
- end
-end
diff --git a/db/migrate/20210407111027_add_whats_new_application_setting.rb b/db/migrate/20210407111027_add_whats_new_application_setting.rb
deleted file mode 100644
index 450c26e2199..00000000000
--- a/db/migrate/20210407111027_add_whats_new_application_setting.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class AddWhatsNewApplicationSetting < ActiveRecord::Migration[6.0]
- def change
- add_column :application_settings, :whats_new_variant, :integer, limit: 2, default: 0
- end
-end
diff --git a/db/migrate/20210407140539_add_verification_state_and_started_at_to_terraform_state_version_table.rb b/db/migrate/20210407140539_add_verification_state_and_started_at_to_terraform_state_version_table.rb
deleted file mode 100644
index 987be4ab1f0..00000000000
--- a/db/migrate/20210407140539_add_verification_state_and_started_at_to_terraform_state_version_table.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class AddVerificationStateAndStartedAtToTerraformStateVersionTable < ActiveRecord::Migration[6.0]
- def change
- change_table(:terraform_state_versions) do |t|
- t.column :verification_started_at, :datetime_with_timezone
- t.integer :verification_state, default: 0, limit: 2, null: false
- end
- end
-end
diff --git a/db/migrate/20210409084242_create_index_on_notes_for_cherry_picked_merge_requests.rb b/db/migrate/20210409084242_create_index_on_notes_for_cherry_picked_merge_requests.rb
deleted file mode 100644
index 2bcdf4c8982..00000000000
--- a/db/migrate/20210409084242_create_index_on_notes_for_cherry_picked_merge_requests.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class CreateIndexOnNotesForCherryPickedMergeRequests < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- NAME = 'index_notes_for_cherry_picked_merge_requests'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :notes, [:project_id, :commit_id], where: "((noteable_type)::text = 'MergeRequest'::text)", name: NAME
- end
-
- def down
- remove_concurrent_index_by_name :notes, name: NAME
- end
-end
diff --git a/db/migrate/20210411212813_add_clusters_integrations_prometheus.rb b/db/migrate/20210411212813_add_clusters_integrations_prometheus.rb
deleted file mode 100644
index 7b7894fdcc8..00000000000
--- a/db/migrate/20210411212813_add_clusters_integrations_prometheus.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddClustersIntegrationsPrometheus < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- with_lock_retries do
- create_table :clusters_integration_prometheus, id: false do |t|
- t.timestamps_with_timezone null: false
- t.references :cluster, primary_key: true, default: nil, index: false, foreign_key: { on_delete: :cascade }
- t.boolean :enabled, null: false, default: false
- end
- end
- end
-
- def down
- with_lock_retries do
- drop_table :clusters_integration_prometheus
- end
- end
-end
diff --git a/db/migrate/20210412111213_create_security_orchestration_policy_rule_schedule.rb b/db/migrate/20210412111213_create_security_orchestration_policy_rule_schedule.rb
deleted file mode 100644
index 365fa36f11b..00000000000
--- a/db/migrate/20210412111213_create_security_orchestration_policy_rule_schedule.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-class CreateSecurityOrchestrationPolicyRuleSchedule < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_PREFIX = 'index_sop_schedules_'
-
- disable_ddl_transaction!
-
- def up
- table_comment = { owner: 'group::container security', description: 'Schedules used to store relationship between project and security policy repository' }
-
- create_table_with_constraints :security_orchestration_policy_rule_schedules, comment: Gitlab::Json.dump(table_comment) do |t|
- t.timestamps_with_timezone
- t.datetime_with_timezone :next_run_at, null: true
-
- t.references :security_orchestration_policy_configuration, null: false, foreign_key: { to_table: :security_orchestration_policy_configurations, on_delete: :cascade }, index: { name: INDEX_PREFIX + 'on_sop_configuration_id' }
- t.references :user, null: false, foreign_key: { on_delete: :cascade }, index: { name: INDEX_PREFIX + 'on_user_id' }
-
- t.integer :policy_index, null: false
- t.text :cron, null: false
-
- t.text_limit :cron, 255
- end
- end
-
- def down
- with_lock_retries do
- drop_table :security_orchestration_policy_rule_schedules
- end
- end
-end
diff --git a/db/migrate/20210412132736_add_instance_url_to_jira_connect_installations.rb b/db/migrate/20210412132736_add_instance_url_to_jira_connect_installations.rb
deleted file mode 100644
index 78b5e7d5d35..00000000000
--- a/db/migrate/20210412132736_add_instance_url_to_jira_connect_installations.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddInstanceUrlToJiraConnectInstallations < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- # rubocop:disable Migration/AddLimitToTextColumns
- # limit is added in db/migrate/20210216163811_add_text_limit_to_jira_connect_installations_instance_url.rb
- def up
- add_column :jira_connect_installations, :instance_url, :text
- end
- # rubocop:enable Migration/AddLimitToTextColumns
-
- def down
- remove_column :jira_connect_installations, :instance_url
- end
-end
diff --git a/db/migrate/20210412132824_add_text_limit_to_jira_connect_installations_instance_url.rb b/db/migrate/20210412132824_add_text_limit_to_jira_connect_installations_instance_url.rb
deleted file mode 100644
index 22c82ccd223..00000000000
--- a/db/migrate/20210412132824_add_text_limit_to_jira_connect_installations_instance_url.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddTextLimitToJiraConnectInstallationsInstanceUrl < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_text_limit :jira_connect_installations, :instance_url, 255
- end
-
- def down
- remove_text_limit :jira_connect_installations, :instance_url
- end
-end
diff --git a/db/migrate/20210412142223_add_user_index_on_spam_logs.rb b/db/migrate/20210412142223_add_user_index_on_spam_logs.rb
deleted file mode 100644
index 0a12f0f1a87..00000000000
--- a/db/migrate/20210412142223_add_user_index_on_spam_logs.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddUserIndexOnSpamLogs < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_spam_logs_on_user_id'
-
- def up
- add_concurrent_index :spam_logs, :user_id, name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :spam_logs, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210412172030_add_configured_at_to_security_orchestration_policy.rb b/db/migrate/20210412172030_add_configured_at_to_security_orchestration_policy.rb
deleted file mode 100644
index 8e21e0f5182..00000000000
--- a/db/migrate/20210412172030_add_configured_at_to_security_orchestration_policy.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddConfiguredAtToSecurityOrchestrationPolicy < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- def change
- add_column :security_orchestration_policy_configurations, :configured_at, :datetime_with_timezone, null: true
- end
-end
diff --git a/db/migrate/20210413121101_add_created_at_web_hook_id_index_to_partitioned_web_hook_log.rb b/db/migrate/20210413121101_add_created_at_web_hook_id_index_to_partitioned_web_hook_log.rb
deleted file mode 100644
index 344f4859b47..00000000000
--- a/db/migrate/20210413121101_add_created_at_web_hook_id_index_to_partitioned_web_hook_log.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddCreatedAtWebHookIdIndexToPartitionedWebHookLog < ActiveRecord::Migration[6.0]
- include Gitlab::Database::PartitioningMigrationHelpers
-
- DOWNTIME = false
-
- CREATED_AT_WEB_HOOK_ID_INDEX_NAME = 'index_web_hook_logs_part_on_created_at_and_web_hook_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_partitioned_index :web_hook_logs_part_0c5294f417,
- [:created_at, :web_hook_id],
- name: CREATED_AT_WEB_HOOK_ID_INDEX_NAME
- end
-
- def down
- remove_concurrent_partitioned_index_by_name :web_hook_logs_part_0c5294f417, CREATED_AT_WEB_HOOK_ID_INDEX_NAME
- end
-end
diff --git a/db/migrate/20210413123832_add_index_on_web_hook_id_to_partitioned_web_hook_log.rb b/db/migrate/20210413123832_add_index_on_web_hook_id_to_partitioned_web_hook_log.rb
deleted file mode 100644
index 300c19d3e51..00000000000
--- a/db/migrate/20210413123832_add_index_on_web_hook_id_to_partitioned_web_hook_log.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnWebHookIdToPartitionedWebHookLog < ActiveRecord::Migration[6.0]
- include Gitlab::Database::PartitioningMigrationHelpers
-
- DOWNTIME = false
-
- WEB_HOOK_ID_INDEX_NAME = 'index_web_hook_logs_part_on_web_hook_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_partitioned_index :web_hook_logs_part_0c5294f417,
- :web_hook_id,
- name: WEB_HOOK_ID_INDEX_NAME
- end
-
- def down
- remove_concurrent_partitioned_index_by_name :web_hook_logs_part_0c5294f417, WEB_HOOK_ID_INDEX_NAME
- end
-end
diff --git a/db/migrate/20210413155324_add_pause_seconds_to_batched_background_migrations.rb b/db/migrate/20210413155324_add_pause_seconds_to_batched_background_migrations.rb
deleted file mode 100644
index ca73c85963e..00000000000
--- a/db/migrate/20210413155324_add_pause_seconds_to_batched_background_migrations.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class AddPauseSecondsToBatchedBackgroundMigrations < ActiveRecord::Migration[6.0]
- def change
- add_column :batched_background_migrations, :pause_ms, :integer, null: false, default: 100
- end
-end
diff --git a/db/migrate/20210414045322_add_pause_seconds_to_batched_background_migration_jobs.rb b/db/migrate/20210414045322_add_pause_seconds_to_batched_background_migration_jobs.rb
deleted file mode 100644
index d232f9c0305..00000000000
--- a/db/migrate/20210414045322_add_pause_seconds_to_batched_background_migration_jobs.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class AddPauseSecondsToBatchedBackgroundMigrationJobs < ActiveRecord::Migration[6.0]
- def change
- add_column :batched_background_migration_jobs, :pause_ms, :integer, null: false, default: 100
- end
-end
diff --git a/db/migrate/20210414095944_add_index_services_on_project_and_type_where_inherit_null.rb b/db/migrate/20210414095944_add_index_services_on_project_and_type_where_inherit_null.rb
deleted file mode 100644
index 395742318e2..00000000000
--- a/db/migrate/20210414095944_add_index_services_on_project_and_type_where_inherit_null.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexServicesOnProjectAndTypeWhereInheritNull < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_services_on_project_and_type_where_inherit_null'
-
- def up
- add_concurrent_index(:services, [:project_id, :type], where: 'inherit_from_id IS NULL', name: INDEX_NAME)
- end
-
- def down
- remove_concurrent_index_by_name(:services, INDEX_NAME)
- end
-end
diff --git a/db/migrate/20210414100914_add_bulk_import_exports_table.rb b/db/migrate/20210414100914_add_bulk_import_exports_table.rb
deleted file mode 100644
index 14a7421c1e4..00000000000
--- a/db/migrate/20210414100914_add_bulk_import_exports_table.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class AddBulkImportExportsTable < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- create_table_with_constraints :bulk_import_exports do |t|
- t.bigint :group_id
- t.bigint :project_id
- t.timestamps_with_timezone null: false
- t.integer :status, limit: 2, null: false, default: 0
- t.text :relation, null: false
- t.text :jid, unique: true
- t.text :error
-
- t.text_limit :relation, 255
- t.text_limit :jid, 255
- t.text_limit :error, 255
- end
- end
-
- def down
- drop_table :bulk_import_exports
- end
-end
diff --git a/db/migrate/20210414130017_add_foreign_key_to_bulk_import_exports_on_project.rb b/db/migrate/20210414130017_add_foreign_key_to_bulk_import_exports_on_project.rb
deleted file mode 100644
index 2f7d3713302..00000000000
--- a/db/migrate/20210414130017_add_foreign_key_to_bulk_import_exports_on_project.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddForeignKeyToBulkImportExportsOnProject < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :bulk_import_exports, :projects, column: :project_id, on_delete: :cascade
- end
-
- def down
- with_lock_retries do
- remove_foreign_key :bulk_import_exports, column: :project_id
- end
- end
-end
diff --git a/db/migrate/20210414130526_add_foreign_key_to_bulk_import_exports_on_group.rb b/db/migrate/20210414130526_add_foreign_key_to_bulk_import_exports_on_group.rb
deleted file mode 100644
index b7172c6987e..00000000000
--- a/db/migrate/20210414130526_add_foreign_key_to_bulk_import_exports_on_group.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddForeignKeyToBulkImportExportsOnGroup < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :bulk_import_exports, :namespaces, column: :group_id, on_delete: :cascade
- end
-
- def down
- with_lock_retries do
- remove_foreign_key :bulk_import_exports, column: :group_id
- end
- end
-end
diff --git a/db/migrate/20210414131600_add_external_pipeline_validation_to_application_setting.rb b/db/migrate/20210414131600_add_external_pipeline_validation_to_application_setting.rb
deleted file mode 100644
index 537f7727691..00000000000
--- a/db/migrate/20210414131600_add_external_pipeline_validation_to_application_setting.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddExternalPipelineValidationToApplicationSetting < ActiveRecord::Migration[6.0]
- def up
- add_column :application_settings, :external_pipeline_validation_service_timeout, :integer
- # rubocop:disable Migration/AddLimitToTextColumns
- add_column :application_settings, :encrypted_external_pipeline_validation_service_token, :text
- add_column :application_settings, :encrypted_external_pipeline_validation_service_token_iv, :text
- add_column :application_settings, :external_pipeline_validation_service_url, :text
- # rubocop:enable Migration/AddLimitToTextColumns
- end
-
- def down
- remove_column :application_settings, :external_pipeline_validation_service_timeout
- remove_column :application_settings, :encrypted_external_pipeline_validation_service_token
- remove_column :application_settings, :encrypted_external_pipeline_validation_service_token_iv
- remove_column :application_settings, :external_pipeline_validation_service_url
- end
-end
diff --git a/db/migrate/20210414131807_add_bulk_import_exports_table_indexes.rb b/db/migrate/20210414131807_add_bulk_import_exports_table_indexes.rb
deleted file mode 100644
index 1cbd1cadf5e..00000000000
--- a/db/migrate/20210414131807_add_bulk_import_exports_table_indexes.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class AddBulkImportExportsTableIndexes < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- GROUP_INDEX_NAME = 'partial_index_bulk_import_exports_on_group_id_and_relation'
- PROJECT_INDEX_NAME = 'partial_index_bulk_import_exports_on_project_id_and_relation'
-
- def up
- add_concurrent_index :bulk_import_exports,
- [:group_id, :relation],
- unique: true,
- where: 'group_id IS NOT NULL',
- name: GROUP_INDEX_NAME
-
- add_concurrent_index :bulk_import_exports,
- [:project_id, :relation],
- unique: true,
- where: 'project_id IS NOT NULL',
- name: PROJECT_INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name(:bulk_import_exports, GROUP_INDEX_NAME)
- remove_concurrent_index_by_name(:bulk_import_exports, PROJECT_INDEX_NAME)
- end
-end
diff --git a/db/migrate/20210414133310_add_bulk_import_export_uploads_table.rb b/db/migrate/20210414133310_add_bulk_import_export_uploads_table.rb
deleted file mode 100644
index d20e57848e9..00000000000
--- a/db/migrate/20210414133310_add_bulk_import_export_uploads_table.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddBulkImportExportUploadsTable < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- create_table_with_constraints :bulk_import_export_uploads do |t|
- t.references :export, index: true, null: false, foreign_key: { to_table: :bulk_import_exports, on_delete: :cascade }
- t.datetime_with_timezone :updated_at, null: false
- t.text :export_file
-
- t.text_limit :export_file, 255
- end
- end
-
- def down
- drop_table :bulk_import_export_uploads
- end
-end
diff --git a/db/migrate/20210415100159_initialize_conversion_of_ci_build_needs_to_bigint.rb b/db/migrate/20210415100159_initialize_conversion_of_ci_build_needs_to_bigint.rb
deleted file mode 100644
index 068dceda272..00000000000
--- a/db/migrate/20210415100159_initialize_conversion_of_ci_build_needs_to_bigint.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class InitializeConversionOfCiBuildNeedsToBigint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- initialize_conversion_of_integer_to_bigint :ci_build_needs, :build_id
- end
-
- def down
- trigger_name = rename_trigger_name(:ci_build_needs, :build_id, :build_id_convert_to_bigint)
-
- remove_rename_triggers :ci_build_needs, trigger_name
-
- remove_column :ci_build_needs, :build_id_convert_to_bigint
- end
-end
diff --git a/db/migrate/20210415142700_add_url_limit_to_pipeline_validation.rb b/db/migrate/20210415142700_add_url_limit_to_pipeline_validation.rb
deleted file mode 100644
index 9c38e04a96b..00000000000
--- a/db/migrate/20210415142700_add_url_limit_to_pipeline_validation.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddUrlLimitToPipelineValidation < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- CONSTRAINT_NAME = 'app_settings_ext_pipeline_validation_service_url_text_limit'
-
- def up
- add_text_limit :application_settings, :external_pipeline_validation_service_url, 255, constraint_name: CONSTRAINT_NAME
- end
-
- def down
- remove_check_constraint(:application_settings, CONSTRAINT_NAME)
- end
-end
diff --git a/db/migrate/20210415144538_remove_index_epics_on_group_id_from_epics.rb b/db/migrate/20210415144538_remove_index_epics_on_group_id_from_epics.rb
deleted file mode 100644
index f691af4d8d2..00000000000
--- a/db/migrate/20210415144538_remove_index_epics_on_group_id_from_epics.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveIndexEpicsOnGroupIdFromEpics < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- INDEX_NAME = 'index_epics_on_group_id'
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :epics, INDEX_NAME
- end
-
- def down
- add_concurrent_index :epics, :group_id, name: INDEX_NAME
- end
-end
diff --git a/db/migrate/20210415172516_create_vulnerability_finding_evidence_requests.rb b/db/migrate/20210415172516_create_vulnerability_finding_evidence_requests.rb
deleted file mode 100644
index 2fe33ff23ba..00000000000
--- a/db/migrate/20210415172516_create_vulnerability_finding_evidence_requests.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-class CreateVulnerabilityFindingEvidenceRequests < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- create_table_with_constraints :vulnerability_finding_evidence_requests do |t|
- t.timestamps_with_timezone null: false
-
- t.references :vulnerability_finding_evidence, index: { name: 'finding_evidence_requests_on_finding_evidence_id' }, null: false, foreign_key: { on_delete: :cascade }
- t.text :method
- t.text :url
-
- t.text_limit :method, 32
- t.text_limit :url, 2048
- end
- end
-
- def down
- with_lock_retries do
- drop_table :vulnerability_finding_evidence_requests
- end
- end
-end
diff --git a/db/migrate/20210416172516_create_vulnerability_finding_evidence_responses.rb b/db/migrate/20210416172516_create_vulnerability_finding_evidence_responses.rb
deleted file mode 100644
index c9740a48117..00000000000
--- a/db/migrate/20210416172516_create_vulnerability_finding_evidence_responses.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class CreateVulnerabilityFindingEvidenceResponses < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- create_table_with_constraints :vulnerability_finding_evidence_responses do |t|
- t.timestamps_with_timezone null: false
-
- t.references :vulnerability_finding_evidence, index: { name: 'finding_evidence_responses_on_finding_evidences_id' }, null: false, foreign_key: { on_delete: :cascade }
- t.integer :status_code
- t.text :reason_phrase
-
- t.text_limit :reason_phrase, 2048
- end
- end
-
- def down
- with_lock_retries do
- drop_table :vulnerability_finding_evidence_responses
- end
- end
-end
diff --git a/db/migrate/20210419090412_remove_debian_group_architectures_distribution_id_index.rb b/db/migrate/20210419090412_remove_debian_group_architectures_distribution_id_index.rb
deleted file mode 100644
index 1df56742480..00000000000
--- a/db/migrate/20210419090412_remove_debian_group_architectures_distribution_id_index.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveDebianGroupArchitecturesDistributionIdIndex < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- INDEX_NAME = 'idx_pkgs_deb_grp_architectures_on_distribution_id'
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index :packages_debian_group_architectures, :distribution_id, name: INDEX_NAME
- end
-
- def down
- add_concurrent_index :packages_debian_group_architectures, :distribution_id, name: INDEX_NAME
- end
-end
diff --git a/db/migrate/20210419090542_remove_debian_project_architectures_distribution_id_index.rb b/db/migrate/20210419090542_remove_debian_project_architectures_distribution_id_index.rb
deleted file mode 100644
index 1f918bd4dec..00000000000
--- a/db/migrate/20210419090542_remove_debian_project_architectures_distribution_id_index.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveDebianProjectArchitecturesDistributionIdIndex < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- INDEX_NAME = 'idx_pkgs_deb_proj_architectures_on_distribution_id'
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index :packages_debian_project_architectures, :distribution_id, name: INDEX_NAME
- end
-
- def down
- add_concurrent_index :packages_debian_project_architectures, :distribution_id, name: INDEX_NAME
- end
-end
diff --git a/db/migrate/20210419203017_add_remote_import_url_to_import_export_upload.rb b/db/migrate/20210419203017_add_remote_import_url_to_import_export_upload.rb
deleted file mode 100644
index 00c5329406e..00000000000
--- a/db/migrate/20210419203017_add_remote_import_url_to_import_export_upload.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: true
-
-class AddRemoteImportUrlToImportExportUpload < ActiveRecord::Migration[6.0]
- # limit is added in 20210419203018_add_remote_text_limit_to_import_url_in_import_export_upload.rb
- def change
- add_column :import_export_uploads, :remote_import_url, :text # rubocop:disable Migration/AddLimitToTextColumns
- end
-end
diff --git a/db/migrate/20210419203018_add_remote_text_limit_to_import_url_in_import_export_upload.rb b/db/migrate/20210419203018_add_remote_text_limit_to_import_url_in_import_export_upload.rb
deleted file mode 100644
index 81b4e76b8d9..00000000000
--- a/db/migrate/20210419203018_add_remote_text_limit_to_import_url_in_import_export_upload.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddRemoteTextLimitToImportUrlInImportExportUpload < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- add_text_limit :import_export_uploads, :remote_import_url, 512
- end
-
- def down
- remove_text_limit :import_export_uploads, :remote_import_url
- end
-end
diff --git a/db/migrate/20210419224834_update_issues_iteration_foreign_key.rb b/db/migrate/20210419224834_update_issues_iteration_foreign_key.rb
deleted file mode 100644
index d071ac8d1d4..00000000000
--- a/db/migrate/20210419224834_update_issues_iteration_foreign_key.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class UpdateIssuesIterationForeignKey < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- with_lock_retries do
- remove_foreign_key_if_exists(:issues, column: :sprint_id)
- end
-
- add_concurrent_foreign_key(:issues, :sprints, column: :sprint_id, on_delete: :nullify)
- end
-
- def down
- with_lock_retries do
- remove_foreign_key_if_exists(:issues, column: :sprint_id)
- end
-
- add_concurrent_foreign_key(:issues, :sprints, column: :sprint_id, on_delete: :cascade)
- end
-end
diff --git a/db/migrate/20210420012444_change_web_hook_events_default.rb b/db/migrate/20210420012444_change_web_hook_events_default.rb
deleted file mode 100644
index b5a63a5a2a8..00000000000
--- a/db/migrate/20210420012444_change_web_hook_events_default.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeWebHookEventsDefault < ActiveRecord::Migration[6.0]
- def up
- change_column_default :web_hooks, :push_events, true
- change_column_default :web_hooks, :issues_events, false
- change_column_default :web_hooks, :merge_requests_events, false
- change_column_default :web_hooks, :tag_push_events, false
- end
-
- # This is a NOP because this migration is supposed to restore the
- # intended schema, not revert it.
- def down
- end
-end
diff --git a/db/migrate/20210420012909_index_cluster_agent_tokens_on_last_used_at.rb b/db/migrate/20210420012909_index_cluster_agent_tokens_on_last_used_at.rb
deleted file mode 100644
index c1715d8ac29..00000000000
--- a/db/migrate/20210420012909_index_cluster_agent_tokens_on_last_used_at.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class IndexClusterAgentTokensOnLastUsedAt < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- OLD_INDEX = 'index_cluster_agent_tokens_on_agent_id'
- NEW_INDEX = 'index_cluster_agent_tokens_on_agent_id_and_last_used_at'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :cluster_agent_tokens, 'agent_id, last_used_at DESC NULLS LAST', name: NEW_INDEX
- remove_concurrent_index_by_name :cluster_agent_tokens, OLD_INDEX
- end
-
- def down
- add_concurrent_index :cluster_agent_tokens, :agent_id, name: OLD_INDEX
- remove_concurrent_index_by_name :cluster_agent_tokens, NEW_INDEX
- end
-end
diff --git a/db/migrate/20210420120734_initialize_conversion_of_ci_job_artifacts_to_bigint.rb b/db/migrate/20210420120734_initialize_conversion_of_ci_job_artifacts_to_bigint.rb
deleted file mode 100644
index cc8f0686841..00000000000
--- a/db/migrate/20210420120734_initialize_conversion_of_ci_job_artifacts_to_bigint.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class InitializeConversionOfCiJobArtifactsToBigint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- TABLE = :ci_job_artifacts
- COLUMNS = %i(id job_id)
- TARGET_COLUMNS = COLUMNS.map { |col| "#{col}_convert_to_bigint" }
-
- def up
- initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
- end
-
- def down
- trigger_name = rename_trigger_name(TABLE, COLUMNS, TARGET_COLUMNS)
- remove_rename_triggers TABLE, trigger_name
-
- TARGET_COLUMNS.each do |column|
- remove_column TABLE, column
- end
- end
-end
diff --git a/db/migrate/20210420173030_add_verification_indexes_to_terraform_state_versions.rb b/db/migrate/20210420173030_add_verification_indexes_to_terraform_state_versions.rb
deleted file mode 100644
index 2c0d0bee39d..00000000000
--- a/db/migrate/20210420173030_add_verification_indexes_to_terraform_state_versions.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class AddVerificationIndexesToTerraformStateVersions < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- VERIFICATION_STATE_INDEX_NAME = "index_terraform_state_versions_on_verification_state"
- PENDING_VERIFICATION_INDEX_NAME = "index_terraform_state_versions_pending_verification"
- FAILED_VERIFICATION_INDEX_NAME = "index_terraform_state_versions_failed_verification"
- NEEDS_VERIFICATION_INDEX_NAME = "index_terraform_state_versions_needs_verification"
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :terraform_state_versions, :verification_state, name: VERIFICATION_STATE_INDEX_NAME
- add_concurrent_index :terraform_state_versions, :verified_at, where: "(verification_state = 0)", order: { verified_at: 'ASC NULLS FIRST' }, name: PENDING_VERIFICATION_INDEX_NAME
- add_concurrent_index :terraform_state_versions, :verification_retry_at, where: "(verification_state = 3)", order: { verification_retry_at: 'ASC NULLS FIRST' }, name: FAILED_VERIFICATION_INDEX_NAME
- add_concurrent_index :terraform_state_versions, :verification_state, where: "(verification_state = 0 OR verification_state = 3)", name: NEEDS_VERIFICATION_INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :terraform_state_versions, VERIFICATION_STATE_INDEX_NAME
- remove_concurrent_index_by_name :terraform_state_versions, PENDING_VERIFICATION_INDEX_NAME
- remove_concurrent_index_by_name :terraform_state_versions, FAILED_VERIFICATION_INDEX_NAME
- remove_concurrent_index_by_name :terraform_state_versions, NEEDS_VERIFICATION_INDEX_NAME
- end
-end
diff --git a/db/migrate/20210420210642_recreate_index_for_project_deployments_with_environment_id_and_date_at.rb b/db/migrate/20210420210642_recreate_index_for_project_deployments_with_environment_id_and_date_at.rb
deleted file mode 100644
index 2674d9e50c8..00000000000
--- a/db/migrate/20210420210642_recreate_index_for_project_deployments_with_environment_id_and_date_at.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-# This migration recreates the index that introduced in 20210326035553_add_index_for_project_deployments_with_environment_id_and_updated_at.rb.
-class RecreateIndexForProjectDeploymentsWithEnvironmentIdAndDateAt < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- OLD_INDEX_NAME = 'index_deployments_on_project_and_environment_and_updated_at'
- NEW_INDEX_NAME = 'index_deployments_on_project_and_environment_and_updated_at_id'
-
- def up
- add_concurrent_index :deployments, [:project_id, :environment_id, :updated_at, :id], name: NEW_INDEX_NAME
- remove_concurrent_index_by_name :deployments, OLD_INDEX_NAME
- end
-
- def down
- add_concurrent_index :deployments, [:project_id, :environment_id, :updated_at], name: OLD_INDEX_NAME
- remove_concurrent_index_by_name :deployments, NEW_INDEX_NAME
- end
-end
diff --git a/db/migrate/20210420221106_update_merge_requests_iteration_foreign_key.rb b/db/migrate/20210420221106_update_merge_requests_iteration_foreign_key.rb
deleted file mode 100644
index 64786f0b20c..00000000000
--- a/db/migrate/20210420221106_update_merge_requests_iteration_foreign_key.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class UpdateMergeRequestsIterationForeignKey < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- with_lock_retries do
- remove_foreign_key_if_exists(:merge_requests, column: :sprint_id)
- end
-
- add_concurrent_foreign_key(:merge_requests, :sprints, column: :sprint_id, on_delete: :nullify)
- end
-
- def down
- with_lock_retries do
- remove_foreign_key_if_exists(:merge_requests, column: :sprint_id)
- end
-
- add_concurrent_foreign_key(:merge_requests, :sprints, column: :sprint_id, on_delete: :cascade)
- end
-end
diff --git a/db/migrate/20210421021510_add_deactivate_dormant_users_to_application_settings.rb b/db/migrate/20210421021510_add_deactivate_dormant_users_to_application_settings.rb
deleted file mode 100644
index 74d197cd3b8..00000000000
--- a/db/migrate/20210421021510_add_deactivate_dormant_users_to_application_settings.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class AddDeactivateDormantUsersToApplicationSettings < ActiveRecord::Migration[6.0]
- def change
- add_column :application_settings, :deactivate_dormant_users, :boolean, default: false, null: false
- end
-end
diff --git a/db/migrate/20210421022010_add_index_for_dormant_users.rb b/db/migrate/20210421022010_add_index_for_dormant_users.rb
deleted file mode 100644
index 48eff184ca0..00000000000
--- a/db/migrate/20210421022010_add_index_for_dormant_users.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexForDormantUsers < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- INDEX_NAME = 'index_users_on_id_and_last_activity_on_for_non_internal_active'
-
- disable_ddl_transaction!
-
- def up
- index_condition = "state = 'active' AND (users.user_type IS NULL OR users.user_type IN (NULL, 6, 4))"
-
- add_concurrent_index :users, [:id, :last_activity_on], where: index_condition, name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :users, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210421081724_add_codeowners_devops_adoption_snapshot.rb b/db/migrate/20210421081724_add_codeowners_devops_adoption_snapshot.rb
deleted file mode 100644
index 3d65abc5608..00000000000
--- a/db/migrate/20210421081724_add_codeowners_devops_adoption_snapshot.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: true
-
-class AddCodeownersDevopsAdoptionSnapshot < ActiveRecord::Migration[6.0]
- def change
- add_column :analytics_devops_adoption_snapshots, :total_projects_count, :integer
- add_column :analytics_devops_adoption_snapshots, :code_owners_used_count, :integer
- end
-end
diff --git a/db/migrate/20210421190157_remove_elastic_task_null_constraint_from_elastic_reindexing_subtasks.rb b/db/migrate/20210421190157_remove_elastic_task_null_constraint_from_elastic_reindexing_subtasks.rb
deleted file mode 100644
index 301e75aa093..00000000000
--- a/db/migrate/20210421190157_remove_elastic_task_null_constraint_from_elastic_reindexing_subtasks.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveElasticTaskNullConstraintFromElasticReindexingSubtasks < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
- ELASTIC_TASK = 'elastic_task'
-
- disable_ddl_transaction!
-
- def up
- remove_not_null_constraint :elastic_reindexing_subtasks, :elastic_task
- change_column_null(:elastic_reindexing_subtasks, :elastic_task, true)
- end
-
- def down
- # there may be elastic_task values which are null so we fill them with a dummy value
- change_column_null(:elastic_reindexing_subtasks, :elastic_task, false, ELASTIC_TASK)
- add_not_null_constraint :elastic_reindexing_subtasks, :elastic_task, validate: false
- end
-end
diff --git a/db/migrate/20210422022825_initialize_conversion_of_ci_sources_pipelines_source_job_id_to_bigint.rb b/db/migrate/20210422022825_initialize_conversion_of_ci_sources_pipelines_source_job_id_to_bigint.rb
deleted file mode 100644
index ea716afe84b..00000000000
--- a/db/migrate/20210422022825_initialize_conversion_of_ci_sources_pipelines_source_job_id_to_bigint.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class InitializeConversionOfCiSourcesPipelinesSourceJobIdToBigint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- # Foreign key that references ci_builds.id
- initialize_conversion_of_integer_to_bigint :ci_sources_pipelines, :source_job_id
- end
-
- def down
- trigger_name = rename_trigger_name(:ci_sources_pipelines, :source_job_id, :source_job_id_convert_to_bigint)
-
- remove_rename_triggers :ci_sources_pipelines, trigger_name
-
- remove_column :ci_sources_pipelines, :source_job_id_convert_to_bigint
- end
-end
diff --git a/db/migrate/20210422142647_add_project_id_next_run_at_index_to_container_expiration_policies.rb b/db/migrate/20210422142647_add_project_id_next_run_at_index_to_container_expiration_policies.rb
deleted file mode 100644
index bd38b5660b4..00000000000
--- a/db/migrate/20210422142647_add_project_id_next_run_at_index_to_container_expiration_policies.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectIdNextRunAtIndexToContainerExpirationPolicies < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- INDEX_NAME = 'idx_container_exp_policies_on_project_id_next_run_at'
-
- def up
- add_concurrent_index :container_expiration_policies, [:project_id, :next_run_at], name: INDEX_NAME, where: 'enabled = true'
- end
-
- def down
- remove_concurrent_index :container_expiration_policies, [:project_id, :next_run_at], name: INDEX_NAME
- end
-end
diff --git a/db/migrate/20210422181809_add_project_to_timelogs.rb b/db/migrate/20210422181809_add_project_to_timelogs.rb
deleted file mode 100644
index 1f98e440d15..00000000000
--- a/db/migrate/20210422181809_add_project_to_timelogs.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectToTimelogs < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- with_lock_retries do
- add_column :timelogs, :project_id, :integer
- end
- end
-
- def down
- with_lock_retries do
- remove_column :timelogs, :project_id
- end
- end
-end
diff --git a/db/migrate/20210422195929_create_elastic_reindexing_slices.rb b/db/migrate/20210422195929_create_elastic_reindexing_slices.rb
deleted file mode 100644
index a535402186c..00000000000
--- a/db/migrate/20210422195929_create_elastic_reindexing_slices.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# frozen_string_literal: true
-
-class CreateElasticReindexingSlices < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- class ReindexingSubtask < ActiveRecord::Base
- self.table_name = 'elastic_reindexing_subtasks'
- end
-
- class ReindexingSlice < ActiveRecord::Base
- self.table_name = 'elastic_reindexing_slices'
- end
-
- def up
- unless table_exists?(:elastic_reindexing_slices)
- create_table_with_constraints :elastic_reindexing_slices do |t|
- t.timestamps_with_timezone null: false
- t.references :elastic_reindexing_subtask, foreign_key: { on_delete: :cascade }, null: false, index: { name: 'idx_elastic_reindexing_slices_on_elastic_reindexing_subtask_id' }
- t.integer :elastic_slice, null: false, limit: 2, default: 0
- t.integer :elastic_max_slice, null: false, limit: 2, default: 0
- t.integer :retry_attempt, null: false, limit: 2, default: 0
- t.text :elastic_task
-
- t.text_limit :elastic_task, 255
- end
- end
-
- ReindexingSubtask.find_each do |subtask|
- next if ReindexingSlice.where(elastic_reindexing_subtask_id: subtask.id).exists?
-
- ReindexingSlice.create(
- elastic_reindexing_subtask_id: subtask.id,
- elastic_task: subtask.elastic_task,
- retry_attempt: 0
- )
- end
- end
-
- def down
- drop_table :elastic_reindexing_slices
- end
-end
diff --git a/db/migrate/20210423054022_create_dast_site_profiles_pipelines.rb b/db/migrate/20210423054022_create_dast_site_profiles_pipelines.rb
deleted file mode 100644
index 80b97ff5afe..00000000000
--- a/db/migrate/20210423054022_create_dast_site_profiles_pipelines.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class CreateDastSiteProfilesPipelines < ActiveRecord::Migration[6.0]
- def up
- table_comment = { owner: 'group::dynamic analysis', description: 'Join table between DAST Site Profiles and CI Pipelines' }
-
- create_table :dast_site_profiles_pipelines, primary_key: [:dast_site_profile_id, :ci_pipeline_id], comment: Gitlab::Json.dump(table_comment) do |t|
- t.bigint :dast_site_profile_id, null: false
- t.bigint :ci_pipeline_id, null: false
-
- t.index :ci_pipeline_id, unique: true, name: :index_dast_site_profiles_pipelines_on_ci_pipeline_id
- end
- end
-
- def down
- drop_table :dast_site_profiles_pipelines
- end
-end
diff --git a/db/migrate/20210423054537_add_dast_site_profile_id_fk_to_dast_site_profiles_pipelines.rb b/db/migrate/20210423054537_add_dast_site_profile_id_fk_to_dast_site_profiles_pipelines.rb
deleted file mode 100644
index eb3a5168609..00000000000
--- a/db/migrate/20210423054537_add_dast_site_profile_id_fk_to_dast_site_profiles_pipelines.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddDastSiteProfileIdFkToDastSiteProfilesPipelines < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :dast_site_profiles_pipelines, :dast_site_profiles, column: :dast_site_profile_id, on_delete: :cascade
- end
-
- def down
- with_lock_retries do
- remove_foreign_key :dast_site_profiles_pipelines, column: :dast_site_profile_id
- end
- end
-end
diff --git a/db/migrate/20210423054846_add_ci_pipeline_id_fk_to_dast_site_profiles_pipelines.rb b/db/migrate/20210423054846_add_ci_pipeline_id_fk_to_dast_site_profiles_pipelines.rb
deleted file mode 100644
index ed2a7ff859c..00000000000
--- a/db/migrate/20210423054846_add_ci_pipeline_id_fk_to_dast_site_profiles_pipelines.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddCiPipelineIdFkToDastSiteProfilesPipelines < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :dast_site_profiles_pipelines, :ci_pipelines, column: :ci_pipeline_id, on_delete: :cascade
- end
-
- def down
- with_lock_retries do
- remove_foreign_key :dast_site_profiles_pipelines, column: :ci_pipeline_id
- end
- end
-end
diff --git a/db/migrate/20210423155059_add_runner_registration_to_plan_limits.rb b/db/migrate/20210423155059_add_runner_registration_to_plan_limits.rb
deleted file mode 100644
index 5382e596d8c..00000000000
--- a/db/migrate/20210423155059_add_runner_registration_to_plan_limits.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: true
-
-class AddRunnerRegistrationToPlanLimits < ActiveRecord::Migration[6.0]
- def change
- add_column(:plan_limits, :ci_registered_group_runners, :integer, default: 1000, null: false)
- add_column(:plan_limits, :ci_registered_project_runners, :integer, default: 1000, null: false)
- end
-end
diff --git a/db/migrate/20210423164702_insert_runner_registration_plan_limits.rb b/db/migrate/20210423164702_insert_runner_registration_plan_limits.rb
deleted file mode 100644
index 36d13dfa120..00000000000
--- a/db/migrate/20210423164702_insert_runner_registration_plan_limits.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class InsertRunnerRegistrationPlanLimits < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- create_or_update_plan_limit('ci_registered_group_runners', 'free', 50)
- create_or_update_plan_limit('ci_registered_group_runners', 'bronze', 1000)
- create_or_update_plan_limit('ci_registered_group_runners', 'silver', 1000)
- create_or_update_plan_limit('ci_registered_group_runners', 'gold', 1000)
-
- create_or_update_plan_limit('ci_registered_project_runners', 'free', 50)
- create_or_update_plan_limit('ci_registered_project_runners', 'bronze', 1000)
- create_or_update_plan_limit('ci_registered_project_runners', 'silver', 1000)
- create_or_update_plan_limit('ci_registered_project_runners', 'gold', 1000)
- end
-
- def down
- %w[group project].each do |scope|
- create_or_update_plan_limit("ci_registered_#{scope}_runners", 'free', 1000)
- create_or_update_plan_limit("ci_registered_#{scope}_runners", 'bronze', 1000)
- create_or_update_plan_limit("ci_registered_#{scope}_runners", 'silver', 1000)
- create_or_update_plan_limit("ci_registered_#{scope}_runners", 'gold', 1000)
- end
- end
-end
diff --git a/db/migrate/20210423171304_re_order_fk_source_project_id_in_merge_requests.rb b/db/migrate/20210423171304_re_order_fk_source_project_id_in_merge_requests.rb
deleted file mode 100644
index ee9e444c792..00000000000
--- a/db/migrate/20210423171304_re_order_fk_source_project_id_in_merge_requests.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class ReOrderFkSourceProjectIdInMergeRequests < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- OLD_SOURCE_PROJECT_FK = 'fk_3308fe130c'
- NEW_SOURCE_PROJECT_FK = 'fk_source_project'
-
- def up
- add_concurrent_foreign_key :merge_requests, :projects, column: :source_project_id, on_delete: :nullify, name: NEW_SOURCE_PROJECT_FK
-
- remove_foreign_key_if_exists :merge_requests, column: :source_project_id, name: OLD_SOURCE_PROJECT_FK
- end
-
- def down
- add_concurrent_foreign_key :merge_requests, :projects, column: :source_project_id, on_delete: :nullify
-
- remove_foreign_key_if_exists :merge_requests, column: :source_project_id, name: NEW_SOURCE_PROJECT_FK
- end
-end
diff --git a/db/migrate/20210424115725_swap_partitioned_web_hook_logs.rb b/db/migrate/20210424115725_swap_partitioned_web_hook_logs.rb
deleted file mode 100644
index 47b2f81cfae..00000000000
--- a/db/migrate/20210424115725_swap_partitioned_web_hook_logs.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class SwapPartitionedWebHookLogs < ActiveRecord::Migration[6.0]
- include Gitlab::Database::PartitioningMigrationHelpers
-
- DOWNTIME = false
-
- def up
- replace_with_partitioned_table :web_hook_logs
- end
-
- def down
- rollback_replace_with_partitioned_table :web_hook_logs
- end
-end
diff --git a/db/migrate/20210424163400_add_project_id_fk_to_timelogs.rb b/db/migrate/20210424163400_add_project_id_fk_to_timelogs.rb
deleted file mode 100644
index 69542e7627d..00000000000
--- a/db/migrate/20210424163400_add_project_id_fk_to_timelogs.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectIdFkToTimelogs < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_timelogs_on_project_id_and_spent_at'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :timelogs, [:project_id, :spent_at], name: INDEX_NAME
- add_concurrent_foreign_key :timelogs, :projects, column: :project_id, on_delete: :cascade
- end
-
- def down
- with_lock_retries do
- remove_foreign_key_if_exists :timelogs, column: :project_id
- end
- remove_concurrent_index_by_name :timelogs, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210426094524_initialize_conversion_of_ci_builds_to_bigint.rb b/db/migrate/20210426094524_initialize_conversion_of_ci_builds_to_bigint.rb
deleted file mode 100644
index e2f82557387..00000000000
--- a/db/migrate/20210426094524_initialize_conversion_of_ci_builds_to_bigint.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class InitializeConversionOfCiBuildsToBigint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- TABLE = :ci_builds
- COLUMNS = %i(id stage_id)
- TARGET_COLUMNS = COLUMNS.map { |col| "#{col}_convert_to_bigint" }
-
- def up
- initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
- end
-
- def down
- revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
- end
-end
diff --git a/db/migrate/20210427045604_initialize_conversion_of_ci_build_trace_chunks_to_bigint.rb b/db/migrate/20210427045604_initialize_conversion_of_ci_build_trace_chunks_to_bigint.rb
deleted file mode 100644
index ec3bb0b7e45..00000000000
--- a/db/migrate/20210427045604_initialize_conversion_of_ci_build_trace_chunks_to_bigint.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class InitializeConversionOfCiBuildTraceChunksToBigint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- TABLE = :ci_build_trace_chunks
- COLUMNS = %i(build_id)
-
- def up
- initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
- end
-
- def down
- revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
- end
-end
diff --git a/db/migrate/20210427062807_add_index_to_batched_migration_jobs_status.rb b/db/migrate/20210427062807_add_index_to_batched_migration_jobs_status.rb
deleted file mode 100644
index c429094762e..00000000000
--- a/db/migrate/20210427062807_add_index_to_batched_migration_jobs_status.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToBatchedMigrationJobsStatus < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_batched_jobs_on_batched_migration_id_and_status'
-
- def up
- add_concurrent_index :batched_background_migration_jobs, [:batched_background_migration_id, :status], name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :batched_background_migration_jobs, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210427084924_initialize_conversion_of_ci_builds_runner_session_to_bigint.rb b/db/migrate/20210427084924_initialize_conversion_of_ci_builds_runner_session_to_bigint.rb
deleted file mode 100644
index ffa653604df..00000000000
--- a/db/migrate/20210427084924_initialize_conversion_of_ci_builds_runner_session_to_bigint.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class InitializeConversionOfCiBuildsRunnerSessionToBigint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- TABLE = :ci_builds_runner_session
- COLUMNS = %i(build_id)
-
- def up
- initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
- end
-
- def down
- revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
- end
-end
diff --git a/db/migrate/20210427094931_add_execution_order_index_to_batched_background_migration_jobs.rb b/db/migrate/20210427094931_add_execution_order_index_to_batched_background_migration_jobs.rb
deleted file mode 100644
index 3622dddd27f..00000000000
--- a/db/migrate/20210427094931_add_execution_order_index_to_batched_background_migration_jobs.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddExecutionOrderIndexToBatchedBackgroundMigrationJobs < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_migration_jobs_on_migration_id_and_finished_at'
-
- def up
- add_concurrent_index :batched_background_migration_jobs, %i(batched_background_migration_id finished_at), name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :batched_background_migration_jobs, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210427125400_add_spamcheck_api_key_to_application_setting.rb b/db/migrate/20210427125400_add_spamcheck_api_key_to_application_setting.rb
deleted file mode 100644
index 9f411a61e5c..00000000000
--- a/db/migrate/20210427125400_add_spamcheck_api_key_to_application_setting.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddSpamcheckApiKeyToApplicationSetting < ActiveRecord::Migration[6.0]
- def up
- add_column :application_settings, :encrypted_spam_check_api_key, :binary
- add_column :application_settings, :encrypted_spam_check_api_key_iv, :binary
- end
-
- def down
- remove_column :application_settings, :encrypted_spam_check_api_key
- remove_column :application_settings, :encrypted_spam_check_api_key_iv
- end
-end
diff --git a/db/migrate/20210427194958_add_description_roll_over_to_iterations_cadences.rb b/db/migrate/20210427194958_add_description_roll_over_to_iterations_cadences.rb
deleted file mode 100644
index fbae2a14d2d..00000000000
--- a/db/migrate/20210427194958_add_description_roll_over_to_iterations_cadences.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddDescriptionRollOverToIterationsCadences < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- with_lock_retries do
- add_column :iterations_cadences, :roll_over, :boolean, null: false, default: false
- add_column :iterations_cadences, :description, :text # rubocop:disable Migration/AddLimitToTextColumns
- end
- end
-
- def down
- with_lock_retries do
- remove_column :iterations_cadences, :roll_over
- remove_column :iterations_cadences, :description
- end
- end
-end
diff --git a/db/migrate/20210427200840_add_text_limit_to_iterations_cadences_description.rb b/db/migrate/20210427200840_add_text_limit_to_iterations_cadences_description.rb
deleted file mode 100644
index a146f295de3..00000000000
--- a/db/migrate/20210427200840_add_text_limit_to_iterations_cadences_description.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddTextLimitToIterationsCadencesDescription < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- add_text_limit :iterations_cadences, :description, 5000
- end
-
- def down
- remove_text_limit :iterations_cadences, :description
- end
-end
diff --git a/db/migrate/20210428151144_update_invalid_web_hooks.rb b/db/migrate/20210428151144_update_invalid_web_hooks.rb
deleted file mode 100644
index 4f45e7aaa9b..00000000000
--- a/db/migrate/20210428151144_update_invalid_web_hooks.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class UpdateInvalidWebHooks < ActiveRecord::Migration[6.0]
- disable_ddl_transaction!
-
- class WebHook < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'web_hooks'
- end
-
- def up
- WebHook.each_batch(of: 10_000, column: :id) do |relation|
- relation.where(type: 'ProjectHook')
- .where.not(project_id: nil)
- .where.not(group_id: nil)
- .update_all(group_id: nil)
- end
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20210428151238_validate_foreign_key_on_group_hooks.rb b/db/migrate/20210428151238_validate_foreign_key_on_group_hooks.rb
deleted file mode 100644
index e7020665b25..00000000000
--- a/db/migrate/20210428151238_validate_foreign_key_on_group_hooks.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class ValidateForeignKeyOnGroupHooks < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- CONSTRAINT_NAME = 'fk_rails_d35697648e'
-
- def up
- validate_foreign_key :web_hooks, :group_id, name: CONSTRAINT_NAME
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20210429024843_add_escalation_policies.rb b/db/migrate/20210429024843_add_escalation_policies.rb
deleted file mode 100644
index 63bd558acfb..00000000000
--- a/db/migrate/20210429024843_add_escalation_policies.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class AddEscalationPolicies < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- UNIQUE_INDEX_NAME = 'index_on_project_id_escalation_policy_name_unique'
-
- def up
- create_table_with_constraints :incident_management_escalation_policies do |t|
- t.references :project, index: false, null: false, foreign_key: { on_delete: :cascade }
- t.text :name, null: false
- t.text :description, null: true
-
- t.text_limit :name, 72
- t.text_limit :description, 160
- t.index [:project_id, :name], unique: true, name: UNIQUE_INDEX_NAME
- end
- end
-
- def down
- drop_table :incident_management_escalation_policies
- end
-end
diff --git a/db/migrate/20210429032320_add_escalation_rules.rb b/db/migrate/20210429032320_add_escalation_rules.rb
deleted file mode 100644
index 2297f7511a6..00000000000
--- a/db/migrate/20210429032320_add_escalation_rules.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddEscalationRules < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- RULE_SCHEDULE_INDEX_NAME = 'index_on_oncall_schedule_escalation_rule'
- UNIQUENESS_INDEX_NAME = 'index_on_policy_schedule_status_elapsed_time_escalation_rules'
-
- def change
- create_table :incident_management_escalation_rules do |t|
- t.belongs_to :policy, index: false, null: false, foreign_key: { on_delete: :cascade, to_table: :incident_management_escalation_policies }
- t.belongs_to :oncall_schedule, index: { name: RULE_SCHEDULE_INDEX_NAME }, null: false, foreign_key: { on_delete: :cascade, to_table: :incident_management_oncall_schedules }
- t.integer :status, null: false, limit: 2
- t.integer :elapsed_time_seconds, null: false, limit: 4
-
- t.index [:policy_id, :oncall_schedule_id, :status, :elapsed_time_seconds], unique: true, name: UNIQUENESS_INDEX_NAME
- end
- end
-end
diff --git a/db/migrate/20210429131525_create_user_credit_card_validations.rb b/db/migrate/20210429131525_create_user_credit_card_validations.rb
deleted file mode 100644
index 8548274b29a..00000000000
--- a/db/migrate/20210429131525_create_user_credit_card_validations.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class CreateUserCreditCardValidations < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- with_lock_retries do
- create_table :user_credit_card_validations, id: false do |t|
- t.references :user, foreign_key: { on_delete: :cascade }, index: false, primary_key: true, default: nil
- t.datetime_with_timezone :credit_card_validated_at, null: false
- end
- end
- end
-
- def down
- with_lock_retries do
- drop_table :user_credit_card_validations
- end
- end
-end
diff --git a/db/migrate/20210429181325_add_failure_tracking_to_web_hooks.rb b/db/migrate/20210429181325_add_failure_tracking_to_web_hooks.rb
deleted file mode 100644
index 4a34c2dd307..00000000000
--- a/db/migrate/20210429181325_add_failure_tracking_to_web_hooks.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddFailureTrackingToWebHooks < ActiveRecord::Migration[6.0]
- def change
- change_table(:web_hooks, bulk: true) do |t|
- t.integer :recent_failures, null: false, limit: 2, default: 0
- t.integer :backoff_count, null: false, limit: 2, default: 0
- t.column :disabled_until, :timestamptz
- end
- end
-end
diff --git a/db/migrate/20210429192653_add_generic_package_duplicate_settings_to_namespace_package_settings.rb b/db/migrate/20210429192653_add_generic_package_duplicate_settings_to_namespace_package_settings.rb
deleted file mode 100644
index 8c328eb52fc..00000000000
--- a/db/migrate/20210429192653_add_generic_package_duplicate_settings_to_namespace_package_settings.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddGenericPackageDuplicateSettingsToNamespacePackageSettings < ActiveRecord::Migration[6.0]
- # rubocop:disable Migration/AddLimitToTextColumns
- # limit is added in 20210429193106_add_text_limit_to_namespace_package_settings_generic_duplicate_exception_regex
- def change
- add_column :namespace_package_settings, :generic_duplicates_allowed, :boolean, null: false, default: true
- add_column :namespace_package_settings, :generic_duplicate_exception_regex, :text, null: false, default: ''
- end
- # rubocop:enable Migration/AddLimitToTextColumns
-end
diff --git a/db/migrate/20210429193106_add_text_limit_to_namespace_package_settings_generic_duplicate_exception_regex.rb b/db/migrate/20210429193106_add_text_limit_to_namespace_package_settings_generic_duplicate_exception_regex.rb
deleted file mode 100644
index 5d02ad3e2f5..00000000000
--- a/db/migrate/20210429193106_add_text_limit_to_namespace_package_settings_generic_duplicate_exception_regex.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddTextLimitToNamespacePackageSettingsGenericDuplicateExceptionRegex < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- add_text_limit :namespace_package_settings, :generic_duplicate_exception_regex, 255
- end
-
- def down
- remove_text_limit :namespace_package_settings, :generic_duplicate_exception_regex
- end
-end
diff --git a/db/migrate/20210430034712_add_alert_manager_token_to_clusters_integration_prometheus.rb b/db/migrate/20210430034712_add_alert_manager_token_to_clusters_integration_prometheus.rb
deleted file mode 100644
index 48ab860a63b..00000000000
--- a/db/migrate/20210430034712_add_alert_manager_token_to_clusters_integration_prometheus.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class AddAlertManagerTokenToClustersIntegrationPrometheus < ActiveRecord::Migration[6.0]
- def change
- change_table :clusters_integration_prometheus do |t|
- t.text :encrypted_alert_manager_token
- t.text :encrypted_alert_manager_token_iv
- end
- end
-end
diff --git a/db/migrate/20210430100947_add_elasticsearch_username_password_to_application_settings.rb b/db/migrate/20210430100947_add_elasticsearch_username_password_to_application_settings.rb
deleted file mode 100644
index 446ac93c75b..00000000000
--- a/db/migrate/20210430100947_add_elasticsearch_username_password_to_application_settings.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddElasticsearchUsernamePasswordToApplicationSettings < ActiveRecord::Migration[6.0]
- def change
- # rubocop:disable Migration/AddLimitToTextColumns
- # limit is added in 20210505124816_add_text_limit_to_elasticsearch_username
- add_column :application_settings, :elasticsearch_username, :text
- # rubocop:enable Migration/AddLimitToTextColumns
-
- add_column :application_settings, :encrypted_elasticsearch_password, :binary
- add_column :application_settings, :encrypted_elasticsearch_password_iv, :binary
- end
-end
diff --git a/db/migrate/20210430121522_initialize_conversion_of_ci_build_trace_sections_to_bigint.rb b/db/migrate/20210430121522_initialize_conversion_of_ci_build_trace_sections_to_bigint.rb
deleted file mode 100644
index c51ae67ebee..00000000000
--- a/db/migrate/20210430121522_initialize_conversion_of_ci_build_trace_sections_to_bigint.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class InitializeConversionOfCiBuildTraceSectionsToBigint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- TABLE = :ci_build_trace_sections
- COLUMN = :build_id
-
- def up
- initialize_conversion_of_integer_to_bigint(TABLE, COLUMN, primary_key: COLUMN)
- end
-
- def down
- revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMN)
- end
-end
diff --git a/db/migrate/20210430122951_add_snapshot_namespace_id.rb b/db/migrate/20210430122951_add_snapshot_namespace_id.rb
deleted file mode 100644
index 9017bcdde53..00000000000
--- a/db/migrate/20210430122951_add_snapshot_namespace_id.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class AddSnapshotNamespaceId < ActiveRecord::Migration[6.0]
- def change
- add_column :analytics_devops_adoption_snapshots, :namespace_id, :integer
- end
-end
diff --git a/db/migrate/20210430124212_add_display_namespace_id_to_segments.rb b/db/migrate/20210430124212_add_display_namespace_id_to_segments.rb
deleted file mode 100644
index 43be5c719fb..00000000000
--- a/db/migrate/20210430124212_add_display_namespace_id_to_segments.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class AddDisplayNamespaceIdToSegments < ActiveRecord::Migration[6.0]
- def change
- add_column :analytics_devops_adoption_segments, :display_namespace_id, :integer
- end
-end
diff --git a/db/migrate/20210430124630_add_devops_adoption_indexes.rb b/db/migrate/20210430124630_add_devops_adoption_indexes.rb
deleted file mode 100644
index 4531e6b5e4c..00000000000
--- a/db/migrate/20210430124630_add_devops_adoption_indexes.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# frozen_string_literal: true
-
-class AddDevopsAdoptionIndexes < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- SEGMENTS_INDEX_NAME = 'idx_devops_adoption_segments_namespaces_pair'
- SNAPSHOT_END_TIME_INDEX_NAME = 'idx_devops_adoption_segments_namespace_end_time'
- SNAPSHOT_RECORDED_AT_INDEX_NAME = 'idx_devops_adoption_segments_namespace_recorded_at'
-
- def up
- add_concurrent_index :analytics_devops_adoption_snapshots, [:namespace_id, :end_time],
- name: SNAPSHOT_END_TIME_INDEX_NAME
- add_concurrent_index :analytics_devops_adoption_snapshots, [:namespace_id, :recorded_at],
- name: SNAPSHOT_RECORDED_AT_INDEX_NAME
- add_concurrent_index :analytics_devops_adoption_segments, [:display_namespace_id, :namespace_id],
- unique: true, name: SEGMENTS_INDEX_NAME
-
- add_concurrent_foreign_key :analytics_devops_adoption_snapshots, :namespaces, column: :namespace_id
- add_concurrent_foreign_key :analytics_devops_adoption_segments, :namespaces, column: :display_namespace_id
- end
-
- def down
- remove_foreign_key :analytics_devops_adoption_segments, :namespaces, column: :display_namespace_id
- remove_foreign_key :analytics_devops_adoption_snapshots, :namespaces, column: :namespace_id
-
- remove_concurrent_index_by_name :analytics_devops_adoption_segments, SEGMENTS_INDEX_NAME
- remove_concurrent_index_by_name :analytics_devops_adoption_snapshots, SNAPSHOT_RECORDED_AT_INDEX_NAME
- remove_concurrent_index_by_name :analytics_devops_adoption_snapshots, SNAPSHOT_END_TIME_INDEX_NAME
- end
-end
diff --git a/db/migrate/20210430154631_add_slice_multiplier_and_max_slices_to_elastic_reindexing_task.rb b/db/migrate/20210430154631_add_slice_multiplier_and_max_slices_to_elastic_reindexing_task.rb
deleted file mode 100644
index be022c1b973..00000000000
--- a/db/migrate/20210430154631_add_slice_multiplier_and_max_slices_to_elastic_reindexing_task.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-class AddSliceMultiplierAndMaxSlicesToElasticReindexingTask < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DEFAULT_MAX_TOTAL_SLICES_RUNNING = 60
- DEFAULT_SLICE_MULTIPLIER = 2
-
- def change
- add_column :elastic_reindexing_tasks, :max_slices_running, :integer,
- limit: 2,
- default: DEFAULT_MAX_TOTAL_SLICES_RUNNING,
- null: false
- add_column :elastic_reindexing_tasks, :slice_multiplier, :integer,
- limit: 2,
- default: DEFAULT_SLICE_MULTIPLIER,
- null: false
- end
-end
diff --git a/db/migrate/20210503105022_create_project_value_streams.rb b/db/migrate/20210503105022_create_project_value_streams.rb
deleted file mode 100644
index 775ab03ad4b..00000000000
--- a/db/migrate/20210503105022_create_project_value_streams.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class CreateProjectValueStreams < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- INDEX_NAME = 'index_analytics_ca_project_value_streams_on_project_id_and_name'
-
- def up
- create_table_with_constraints :analytics_cycle_analytics_project_value_streams do |t|
- t.timestamps_with_timezone
- t.references(:project,
- null: false,
- index: false,
- foreign_key: { to_table: :projects, on_delete: :cascade }
- )
- t.text :name, null: false
- t.index [:project_id, :name], unique: true, name: INDEX_NAME
- t.text_limit :name, 100
- end
- end
-
- def down
- with_lock_retries do
- drop_table :analytics_cycle_analytics_project_value_streams
- end
- end
-end
diff --git a/db/migrate/20210503105845_add_project_value_stream_id_to_project_stages.rb b/db/migrate/20210503105845_add_project_value_stream_id_to_project_stages.rb
deleted file mode 100644
index d888ab4943c..00000000000
--- a/db/migrate/20210503105845_add_project_value_stream_id_to_project_stages.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectValueStreamIdToProjectStages < ActiveRecord::Migration[6.0]
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_analytics_ca_project_stages_on_value_stream_id'
-
- class ProjectValueStream < ActiveRecord::Base
- self.table_name = 'analytics_cycle_analytics_project_stages'
-
- include EachBatch
- end
-
- def up
- ProjectValueStream.reset_column_information
- # The table was never used, there is no user-facing code that modifies the table, it should be empty.
- # Since there is no functionality present that depends on this data, it's safe to delete the rows.
- ProjectValueStream.each_batch(of: 100) do |relation|
- relation.delete_all
- end
-
- transaction do
- add_reference :analytics_cycle_analytics_project_stages, :project_value_stream, null: false, index: { name: INDEX_NAME }, foreign_key: { on_delete: :cascade, to_table: :analytics_cycle_analytics_project_value_streams }, type: :bigint # rubocop: disable Migration/AddReference, Rails/NotNullColumn
- end
- end
-
- def down
- remove_reference :analytics_cycle_analytics_project_stages, :project_value_stream
- end
-end
diff --git a/db/migrate/20210503131747_add_web_hook_calls_to_plan_limits.rb b/db/migrate/20210503131747_add_web_hook_calls_to_plan_limits.rb
deleted file mode 100644
index cb23c9391ea..00000000000
--- a/db/migrate/20210503131747_add_web_hook_calls_to_plan_limits.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class AddWebHookCallsToPlanLimits < ActiveRecord::Migration[6.0]
- def change
- add_column :plan_limits, :web_hook_calls, :integer, null: false, default: 0
- end
-end
diff --git a/db/migrate/20210504085144_add_index_on_web_hook_project_id_recent_failures.rb b/db/migrate/20210504085144_add_index_on_web_hook_project_id_recent_failures.rb
deleted file mode 100644
index 898a0ccd1c5..00000000000
--- a/db/migrate/20210504085144_add_index_on_web_hook_project_id_recent_failures.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnWebHookProjectIdRecentFailures < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- INDEX_NAME = 'index_web_hooks_on_project_id_recent_failures'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:web_hooks, [:project_id, :recent_failures], name: INDEX_NAME)
- end
-
- def down
- remove_concurrent_index_by_name(:web_hooks, INDEX_NAME)
- end
-end
diff --git a/db/migrate/20210504135823_add_floc_application_settings.rb b/db/migrate/20210504135823_add_floc_application_settings.rb
deleted file mode 100644
index a5e3aad6b8c..00000000000
--- a/db/migrate/20210504135823_add_floc_application_settings.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class AddFlocApplicationSettings < ActiveRecord::Migration[6.0]
- def change
- add_column :application_settings, :floc_enabled, :boolean, default: false, null: false
- end
-end
diff --git a/db/migrate/20210504143128_add_verification_state_and_started_at_to_mr_diff_details_table.rb b/db/migrate/20210504143128_add_verification_state_and_started_at_to_mr_diff_details_table.rb
deleted file mode 100644
index 7999ea14a12..00000000000
--- a/db/migrate/20210504143128_add_verification_state_and_started_at_to_mr_diff_details_table.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class AddVerificationStateAndStartedAtToMrDiffDetailsTable < ActiveRecord::Migration[6.0]
- def change
- change_table(:merge_request_diff_details) do |t|
- t.integer :verification_state, default: 0, limit: 2, null: false
- t.column :verification_started_at, :datetime_with_timezone
- end
- end
-end
diff --git a/db/migrate/20210504153354_create_clusters_integration_elasticstack.rb b/db/migrate/20210504153354_create_clusters_integration_elasticstack.rb
deleted file mode 100644
index 79680821060..00000000000
--- a/db/migrate/20210504153354_create_clusters_integration_elasticstack.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class CreateClustersIntegrationElasticstack < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- create_table_with_constraints :clusters_integration_elasticstack, id: false do |t|
- t.timestamps_with_timezone null: false
- t.references :cluster, primary_key: true, default: nil, index: false, foreign_key: { on_delete: :cascade }
- t.boolean :enabled, null: false, default: false
- t.text :chart_version
- t.text_limit :chart_version, 10
- end
- end
-
- def down
- with_lock_retries do
- drop_table :clusters_integration_elasticstack
- end
- end
-end
diff --git a/db/migrate/20210504164429_create_partial_indexes_for_pending_and_running_builds.rb b/db/migrate/20210504164429_create_partial_indexes_for_pending_and_running_builds.rb
deleted file mode 100644
index af403faa278..00000000000
--- a/db/migrate/20210504164429_create_partial_indexes_for_pending_and_running_builds.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class CreatePartialIndexesForPendingAndRunningBuilds < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- INDEX_PENDING = 'index_ci_builds_runner_id_pending'
- INDEX_RUNNING = 'index_ci_builds_runner_id_running'
-
- def up
- add_concurrent_index :ci_builds, :runner_id, where: "status = 'pending' AND type = 'Ci::Build'", name: INDEX_PENDING
- add_concurrent_index :ci_builds, :runner_id, where: "status = 'running' AND type = 'Ci::Build'", name: INDEX_RUNNING
- end
-
- def down
- remove_concurrent_index_by_name :ci_builds, INDEX_PENDING
- remove_concurrent_index_by_name :ci_builds, INDEX_RUNNING
- end
-end
diff --git a/db/migrate/20210505070612_create_packages_debian_group_distribution_keys.rb b/db/migrate/20210505070612_create_packages_debian_group_distribution_keys.rb
deleted file mode 100644
index 1e79b4e29b0..00000000000
--- a/db/migrate/20210505070612_create_packages_debian_group_distribution_keys.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# frozen_string_literal: true
-
-class CreatePackagesDebianGroupDistributionKeys < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- INDEX_DISTRIBUTION = 'idx_pkgs_debian_group_distribution_keys_on_distribution_id'
-
- disable_ddl_transaction!
-
- def up
- create_table_with_constraints :packages_debian_group_distribution_keys do |t|
- t.timestamps_with_timezone
- t.references :distribution,
- foreign_key: { to_table: :packages_debian_group_distributions, on_delete: :cascade },
- index: { name: INDEX_DISTRIBUTION },
- null: false
-
- t.text :encrypted_private_key, null: false
- t.text :encrypted_private_key_iv, null: false
- t.text :encrypted_passphrase, null: false
- t.text :encrypted_passphrase_iv, null: false
- t.text :public_key, null: false
- t.text :fingerprint, null: false
-
- t.text_limit :public_key, 512.kilobytes
- t.text_limit :fingerprint, 255
- end
- end
-
- def down
- with_lock_retries do
- drop_table :packages_debian_group_distribution_keys
- end
- end
-end
diff --git a/db/migrate/20210505070812_create_packages_debian_project_distribution_keys.rb b/db/migrate/20210505070812_create_packages_debian_project_distribution_keys.rb
deleted file mode 100644
index f5ec01ec0d6..00000000000
--- a/db/migrate/20210505070812_create_packages_debian_project_distribution_keys.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# frozen_string_literal: true
-
-class CreatePackagesDebianProjectDistributionKeys < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- INDEX_DISTRIBUTION = 'idx_pkgs_debian_project_distribution_keys_on_distribution_id'
-
- disable_ddl_transaction!
-
- def up
- create_table_with_constraints :packages_debian_project_distribution_keys do |t|
- t.timestamps_with_timezone
- t.references :distribution,
- foreign_key: { to_table: :packages_debian_project_distributions, on_delete: :cascade },
- index: { name: INDEX_DISTRIBUTION },
- null: false
-
- t.text :encrypted_private_key, null: false
- t.text :encrypted_private_key_iv, null: false
- t.text :encrypted_passphrase, null: false
- t.text :encrypted_passphrase_iv, null: false
- t.text :public_key, null: false
- t.text :fingerprint, null: false
-
- t.text_limit :public_key, 512.kilobytes
- t.text_limit :fingerprint, 255
- end
- end
-
- def down
- with_lock_retries do
- drop_table :packages_debian_project_distribution_keys
- end
- end
-end
diff --git a/db/migrate/20210505124816_add_text_limit_to_elasticsearch_username.rb b/db/migrate/20210505124816_add_text_limit_to_elasticsearch_username.rb
deleted file mode 100644
index 324b9193efb..00000000000
--- a/db/migrate/20210505124816_add_text_limit_to_elasticsearch_username.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddTextLimitToElasticsearchUsername < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- add_text_limit :application_settings, :elasticsearch_username, 255
- end
-
- def down
- remove_text_limit :application_settings, :elasticsearch_username
- end
-end
diff --git a/db/migrate/20210505170152_add_verification_indexes_to_merge_request_diff_details_table.rb b/db/migrate/20210505170152_add_verification_indexes_to_merge_request_diff_details_table.rb
deleted file mode 100644
index e85a28e3fa7..00000000000
--- a/db/migrate/20210505170152_add_verification_indexes_to_merge_request_diff_details_table.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class AddVerificationIndexesToMergeRequestDiffDetailsTable < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- VERIFICATION_STATE_INDEX_NAME = "index_merge_request_diff_details_on_verification_state"
- PENDING_VERIFICATION_INDEX_NAME = "index_merge_request_diff_details_pending_verification"
- FAILED_VERIFICATION_INDEX_NAME = "index_merge_request_diff_details_failed_verification"
- NEEDS_VERIFICATION_INDEX_NAME = "index_merge_request_diff_details_needs_verification"
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :merge_request_diff_details, :verification_state, name: VERIFICATION_STATE_INDEX_NAME
- add_concurrent_index :merge_request_diff_details, :verified_at, where: "(verification_state = 0)", order: { verified_at: 'ASC NULLS FIRST' }, name: PENDING_VERIFICATION_INDEX_NAME
- add_concurrent_index :merge_request_diff_details, :verification_retry_at, where: "(verification_state = 3)", order: { verification_retry_at: 'ASC NULLS FIRST' }, name: FAILED_VERIFICATION_INDEX_NAME
- add_concurrent_index :merge_request_diff_details, :verification_state, where: "(verification_state = 0 OR verification_state = 3)", name: NEEDS_VERIFICATION_INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :merge_request_diff_details, VERIFICATION_STATE_INDEX_NAME
- remove_concurrent_index_by_name :merge_request_diff_details, PENDING_VERIFICATION_INDEX_NAME
- remove_concurrent_index_by_name :merge_request_diff_details, FAILED_VERIFICATION_INDEX_NAME
- remove_concurrent_index_by_name :merge_request_diff_details, NEEDS_VERIFICATION_INDEX_NAME
- end
-end
diff --git a/db/migrate/20210506150833_create_vulnerability_finding_evidence_headers.rb b/db/migrate/20210506150833_create_vulnerability_finding_evidence_headers.rb
deleted file mode 100644
index 0e584303e51..00000000000
--- a/db/migrate/20210506150833_create_vulnerability_finding_evidence_headers.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class CreateVulnerabilityFindingEvidenceHeaders < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- create_table_with_constraints :vulnerability_finding_evidence_headers do |t|
- t.timestamps_with_timezone null: false
-
- t.references :vulnerability_finding_evidence_request, index: { name: 'finding_evidence_header_on_finding_evidence_request_id' }, null: true, foreign_key: { on_delete: :cascade }
- t.references :vulnerability_finding_evidence_response, index: { name: 'finding_evidence_header_on_finding_evidence_response_id' }, null: true, foreign_key: { on_delete: :cascade }
- t.text :name, null: false
- t.text :value, null: false
-
- t.text_limit :name, 255
- t.text_limit :value, 8192
- end
- end
-
- def down
- with_lock_retries do
- drop_table :vulnerability_finding_evidence_headers
- end
- end
-end
diff --git a/db/migrate/20210507191949_add_remove_on_issue_close_to_labels.rb b/db/migrate/20210507191949_add_remove_on_issue_close_to_labels.rb
deleted file mode 100644
index 131edb20164..00000000000
--- a/db/migrate/20210507191949_add_remove_on_issue_close_to_labels.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddRemoveOnIssueCloseToLabels < ActiveRecord::Migration[6.0]
- # This migration was reverted in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62056
-
- def up
- end
-
- def down
- end
-end
diff --git a/db/migrate/20210510083845_add_sha_to_status_check_response.rb b/db/migrate/20210510083845_add_sha_to_status_check_response.rb
deleted file mode 100644
index 202f5ca00c1..00000000000
--- a/db/migrate/20210510083845_add_sha_to_status_check_response.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddShaToStatusCheckResponse < ActiveRecord::Migration[6.0]
- def up
- execute('DELETE FROM status_check_responses')
-
- add_column :status_check_responses, :sha, :binary, null: false # rubocop:disable Rails/NotNullColumn
- end
-
- def down
- remove_column :status_check_responses, :sha
- end
-end
diff --git a/db/migrate/20210510191551_add_body_to_findings_evidences_request.rb b/db/migrate/20210510191551_add_body_to_findings_evidences_request.rb
deleted file mode 100644
index 9b0054dbd22..00000000000
--- a/db/migrate/20210510191551_add_body_to_findings_evidences_request.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class AddBodyToFindingsEvidencesRequest < ActiveRecord::Migration[6.0]
- # rubocop:disable Migration/AddLimitToTextColumns
- # limit is added in 20210510191552_add_limit_to_findings_evidences_request_body.rb
- def change
- add_column :vulnerability_finding_evidence_requests, :body, :text
- end
- # rubocop:enable Migration/AddLimitToTextColumns
-end
diff --git a/db/migrate/20210510191552_add_limit_to_findings_evidences_request_body.rb b/db/migrate/20210510191552_add_limit_to_findings_evidences_request_body.rb
deleted file mode 100644
index 84c8acdb10d..00000000000
--- a/db/migrate/20210510191552_add_limit_to_findings_evidences_request_body.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddLimitToFindingsEvidencesRequestBody < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_text_limit :vulnerability_finding_evidence_requests, :body, 2048
- end
-
- def down
- remove_text_limit :vulnerability_finding_evidence_requests, :body
- end
-end
diff --git a/db/migrate/20210511104929_add_epic_board_recent_visits_table.rb b/db/migrate/20210511104929_add_epic_board_recent_visits_table.rb
deleted file mode 100644
index 9822276f9c4..00000000000
--- a/db/migrate/20210511104929_add_epic_board_recent_visits_table.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class AddEpicBoardRecentVisitsTable < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- with_lock_retries do
- unless table_exists?(:boards_epic_board_recent_visits)
- create_table :boards_epic_board_recent_visits do |t|
- t.references :user, index: true, null: false, foreign_key: { on_delete: :cascade }
- t.references :epic_board, index: true, foreign_key: { to_table: :boards_epic_boards, on_delete: :cascade }, null: false
- t.references :group, index: true, foreign_key: { to_table: :namespaces, on_delete: :cascade }, null: false
- t.timestamps_with_timezone null: false
- end
- end
- end
- end
-
- def down
- with_lock_retries do
- drop_table :boards_epic_board_recent_visits
- end
- end
-end
diff --git a/db/migrate/20210511104930_add_index_to_epic_board_recent_visits.rb b/db/migrate/20210511104930_add_index_to_epic_board_recent_visits.rb
deleted file mode 100644
index 1341886c50c..00000000000
--- a/db/migrate/20210511104930_add_index_to_epic_board_recent_visits.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToEpicBoardRecentVisits < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- INDEX_NAME = 'index_epic_board_recent_visits_on_user_group_and_board'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :boards_epic_board_recent_visits,
- [:user_id, :group_id, :epic_board_id],
- name: INDEX_NAME,
- unique: true
- end
-
- def down
- remove_concurrent_index_by_name :boards_epic_board_recent_visits, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210511165250_add_foreign_key_to_lfs_objects_projects.rb b/db/migrate/20210511165250_add_foreign_key_to_lfs_objects_projects.rb
deleted file mode 100644
index 4163499a553..00000000000
--- a/db/migrate/20210511165250_add_foreign_key_to_lfs_objects_projects.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddForeignKeyToLfsObjectsProjects < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :lfs_objects_projects, :lfs_objects, column: :lfs_object_id, on_delete: :restrict, validate: false
- add_concurrent_foreign_key :lfs_objects_projects, :projects, column: :project_id, on_delete: :cascade, validate: false
- end
-
- def down
- with_lock_retries do
- remove_foreign_key :lfs_objects_projects, column: :lfs_object_id
- remove_foreign_key :lfs_objects_projects, column: :project_id
- end
- end
-end
diff --git a/db/migrate/20210512120122_add_pending_builds_table.rb b/db/migrate/20210512120122_add_pending_builds_table.rb
deleted file mode 100644
index 38e13d43b38..00000000000
--- a/db/migrate/20210512120122_add_pending_builds_table.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddPendingBuildsTable < ActiveRecord::Migration[6.0]
- def up
- create_table :ci_pending_builds do |t|
- t.references :build, index: { unique: true }, null: false, foreign_key: { to_table: :ci_builds, on_delete: :cascade }
- t.references :project, index: true, null: false, foreign_key: { on_delete: :cascade }
- t.datetime_with_timezone :created_at, null: false, default: -> { 'NOW()' }
- end
- end
-
- def down
- drop_table :ci_pending_builds
- end
-end
diff --git a/db/migrate/20210512183309_add_body_to_findings_evidences_response.rb b/db/migrate/20210512183309_add_body_to_findings_evidences_response.rb
deleted file mode 100644
index 6884d339b9c..00000000000
--- a/db/migrate/20210512183309_add_body_to_findings_evidences_response.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class AddBodyToFindingsEvidencesResponse < ActiveRecord::Migration[6.0]
- # rubocop:disable Migration/AddLimitToTextColumns
- # limit is added in 20210512183310_add_limit_to_findings_evidences_response_body.rb
- def change
- add_column :vulnerability_finding_evidence_responses, :body, :text
- end
- # rubocop:enable Migration/AddLimitToTextColumns
-end
diff --git a/db/migrate/20210512183310_add_limit_to_findings_evidences_response_body.rb b/db/migrate/20210512183310_add_limit_to_findings_evidences_response_body.rb
deleted file mode 100644
index bdd15163809..00000000000
--- a/db/migrate/20210512183310_add_limit_to_findings_evidences_response_body.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddLimitToFindingsEvidencesResponseBody < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_text_limit :vulnerability_finding_evidence_responses, :body, 2048
- end
-
- def down
- remove_text_limit :vulnerability_finding_evidence_responses, :body
- end
-end
diff --git a/db/migrate/20210513093418_add_draft_column_to_merge_requests.rb b/db/migrate/20210513093418_add_draft_column_to_merge_requests.rb
deleted file mode 100644
index 67e2cc0eea0..00000000000
--- a/db/migrate/20210513093418_add_draft_column_to_merge_requests.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddDraftColumnToMergeRequests < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- with_lock_retries do
- add_column :merge_requests, :draft, :boolean, default: false, null: false
- end
- end
-
- def down
- with_lock_retries do
- remove_column :merge_requests, :draft
- end
- end
-end
diff --git a/db/migrate/20210517130723_make_snapshot_segment_id_optional.rb b/db/migrate/20210517130723_make_snapshot_segment_id_optional.rb
deleted file mode 100644
index a05be71a243..00000000000
--- a/db/migrate/20210517130723_make_snapshot_segment_id_optional.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class MakeSnapshotSegmentIdOptional < ActiveRecord::Migration[6.0]
- def up
- change_column_null(:analytics_devops_adoption_snapshots, :segment_id, true)
- end
-
- def down
- change_column_null(:analytics_devops_adoption_snapshots, :segment_id, false)
- end
-end
diff --git a/db/migrate/20210517144856_require_snapshot_namespace.rb b/db/migrate/20210517144856_require_snapshot_namespace.rb
deleted file mode 100644
index ec25c13383f..00000000000
--- a/db/migrate/20210517144856_require_snapshot_namespace.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-require Rails.root.join('db', 'post_migrate', '20210430134202_copy_adoption_snapshot_namespace.rb')
-
-class RequireSnapshotNamespace < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- CopyAdoptionSnapshotNamespace.new.up
-
- add_not_null_constraint(:analytics_devops_adoption_snapshots, :namespace_id)
- end
-
- def down
- remove_not_null_constraint(:analytics_devops_adoption_snapshots, :namespace_id)
- end
-end
diff --git a/db/migrate/20210517221612_add_default_value_to_merge_requests_author_approval_on_projects.rb b/db/migrate/20210517221612_add_default_value_to_merge_requests_author_approval_on_projects.rb
deleted file mode 100644
index 1c017a366c8..00000000000
--- a/db/migrate/20210517221612_add_default_value_to_merge_requests_author_approval_on_projects.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddDefaultValueToMergeRequestsAuthorApprovalOnProjects < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- with_lock_retries do
- change_column_default :projects, :merge_requests_author_approval, false
- end
- end
-
- def down
- with_lock_retries do
- change_column_default :projects, :merge_requests_author_approval, nil
- end
- end
-end
diff --git a/db/migrate/20210519132109_initialize_conversion_of_ci_builds_metadata_to_bigint.rb b/db/migrate/20210519132109_initialize_conversion_of_ci_builds_metadata_to_bigint.rb
deleted file mode 100644
index 7ff0276b4b5..00000000000
--- a/db/migrate/20210519132109_initialize_conversion_of_ci_builds_metadata_to_bigint.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class InitializeConversionOfCiBuildsMetadataToBigint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- TABLE = :ci_builds_metadata
- COLUMN = :build_id
-
- def up
- initialize_conversion_of_integer_to_bigint(TABLE, COLUMN)
- end
-
- def down
- revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMN)
- end
-end
diff --git a/db/migrate/20210519154058_schedule_update_users_where_two_factor_auth_required_from_group.rb b/db/migrate/20210519154058_schedule_update_users_where_two_factor_auth_required_from_group.rb
deleted file mode 100644
index 2da84301a72..00000000000
--- a/db/migrate/20210519154058_schedule_update_users_where_two_factor_auth_required_from_group.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleUpdateUsersWhereTwoFactorAuthRequiredFromGroup < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- MIGRATION = 'UpdateUsersWhereTwoFactorAuthRequiredFromGroup'
- DELAY_INTERVAL = 2.minutes
- BATCH_SIZE = 10_000
- INDEX_NAME = 'index_users_require_two_factor_authentication_from_group_false'
-
- disable_ddl_transaction!
-
- class User < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'users'
- end
-
- def up
- add_concurrent_index :users,
- :require_two_factor_authentication_from_group,
- where: 'require_two_factor_authentication_from_group = FALSE',
- name: INDEX_NAME
-
- relation = User.where(require_two_factor_authentication_from_group: false)
-
- queue_background_migration_jobs_by_range_at_intervals(
- relation, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE)
- end
-
- def down
- remove_concurrent_index_by_name :users, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210520102039_group_protected_environments_add_column.rb b/db/migrate/20210520102039_group_protected_environments_add_column.rb
deleted file mode 100644
index 642e22c5f48..00000000000
--- a/db/migrate/20210520102039_group_protected_environments_add_column.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class GroupProtectedEnvironmentsAddColumn < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- add_column :protected_environments, :group_id, :bigint
- change_column_null :protected_environments, :project_id, true
- end
-
- def down
- change_column_null :protected_environments, :project_id, false
- remove_column :protected_environments, :group_id
- end
-end
diff --git a/db/migrate/20210520133032_initialize_conversion_of_taggings_to_bigint.rb b/db/migrate/20210520133032_initialize_conversion_of_taggings_to_bigint.rb
deleted file mode 100644
index e154c25b082..00000000000
--- a/db/migrate/20210520133032_initialize_conversion_of_taggings_to_bigint.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class InitializeConversionOfTaggingsToBigint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- TABLE = :taggings
- COLUMNS = %i(id taggable_id)
-
- def up
- initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
- end
-
- def down
- revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
- end
-end
diff --git a/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb b/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb
deleted file mode 100644
index 778e186eb9c..00000000000
--- a/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class BackfillTaggingsForBigintConversion < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- TABLE = :taggings
- COLUMNS = %i(id taggable_id)
-
- def up
- backfill_conversion_of_integer_to_bigint TABLE, COLUMNS, batch_size: 15000, sub_batch_size: 100
- end
-
- def down
- revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
- end
-end
diff --git a/db/migrate/20210521073920_drop_devops_adoption_namespace_uniqueness.rb b/db/migrate/20210521073920_drop_devops_adoption_namespace_uniqueness.rb
deleted file mode 100644
index d255ce844e2..00000000000
--- a/db/migrate/20210521073920_drop_devops_adoption_namespace_uniqueness.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class DropDevopsAdoptionNamespaceUniqueness < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_analytics_devops_adoption_segments_on_namespace_id'
- NEW_INDEX_NAME = 'idx_analytics_devops_adoption_segments_on_namespace_id'
-
- def up
- add_concurrent_index :analytics_devops_adoption_segments, :namespace_id, name: NEW_INDEX_NAME
- remove_concurrent_index_by_name :analytics_devops_adoption_segments, INDEX_NAME
- end
-
- def down
- # Clean up duplicated records
- execute "DELETE FROM analytics_devops_adoption_segments WHERE id NOT IN (SELECT MIN(id) FROM analytics_devops_adoption_segments GROUP BY namespace_id)"
-
- add_concurrent_index :analytics_devops_adoption_segments, :namespace_id, name: INDEX_NAME, unique: true
- remove_concurrent_index_by_name :analytics_devops_adoption_segments, NEW_INDEX_NAME
- end
-end
diff --git a/db/migrate/20210525085158_initialize_conversion_of_deployments_to_bigint.rb b/db/migrate/20210525085158_initialize_conversion_of_deployments_to_bigint.rb
deleted file mode 100644
index 70775eb3bb5..00000000000
--- a/db/migrate/20210525085158_initialize_conversion_of_deployments_to_bigint.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class InitializeConversionOfDeploymentsToBigint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- TABLE = :deployments
- COLUMNS = %i(deployable_id)
-
- def up
- initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
- end
-
- def down
- revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
- end
-end
diff --git a/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb b/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb
deleted file mode 100644
index 0795abf19d4..00000000000
--- a/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class BackfillDeploymentsForBigintConversion < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- TABLE = :deployments
- COLUMNS = %i(deployable_id)
-
- def up
- backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
- end
-
- def down
- revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
- end
-end
diff --git a/db/migrate/20210525100539_initialize_conversion_of_geo_job_artifact_deleted_events_to_bigint.rb b/db/migrate/20210525100539_initialize_conversion_of_geo_job_artifact_deleted_events_to_bigint.rb
deleted file mode 100644
index 3e8bcf1851a..00000000000
--- a/db/migrate/20210525100539_initialize_conversion_of_geo_job_artifact_deleted_events_to_bigint.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class InitializeConversionOfGeoJobArtifactDeletedEventsToBigint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- TABLE = :geo_job_artifact_deleted_events
- COLUMNS = %i(job_artifact_id)
-
- def up
- initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
- end
-
- def down
- revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
- end
-end
diff --git a/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb b/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb
deleted file mode 100644
index c2845760b5c..00000000000
--- a/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class BackfillGeoJobArtifactDeletedEventsForBigintConversion < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- TABLE = :geo_job_artifact_deleted_events
- COLUMNS = %i(job_artifact_id)
-
- def up
- backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
- end
-
- def down
- revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
- end
-end
diff --git a/db/migrate/20210525184900_add_latest_pipeline_id_into_vulnerability_statistics_table.rb b/db/migrate/20210525184900_add_latest_pipeline_id_into_vulnerability_statistics_table.rb
deleted file mode 100644
index 508ad92f9e5..00000000000
--- a/db/migrate/20210525184900_add_latest_pipeline_id_into_vulnerability_statistics_table.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class AddLatestPipelineIdIntoVulnerabilityStatisticsTable < ActiveRecord::Migration[6.0]
- def change
- add_column :vulnerability_statistics, :latest_pipeline_id, :bigint
- end
-end
diff --git a/db/migrate/20210526135911_create_ci_minutes_additional_packs.rb b/db/migrate/20210526135911_create_ci_minutes_additional_packs.rb
deleted file mode 100644
index 3464268a77f..00000000000
--- a/db/migrate/20210526135911_create_ci_minutes_additional_packs.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class CreateCiMinutesAdditionalPacks < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- create_table_with_constraints :ci_minutes_additional_packs, if_not_exists: true do |t|
- t.timestamps_with_timezone
-
- t.references :namespace, index: false, null: false, foreign_key: { on_delete: :cascade }
- t.date :expires_at, null: true
- t.integer :number_of_minutes, null: false
- t.text :purchase_xid, null: true
- t.text_limit :purchase_xid, 32
-
- t.index [:namespace_id, :purchase_xid], name: 'index_ci_minutes_additional_packs_on_namespace_id_purchase_xid'
- end
- end
-
- def down
- with_lock_retries do
- drop_table :ci_minutes_additional_packs
- end
- end
-end
diff --git a/db/migrate/20210526155257_rename_sync_security_report_approval_rules_sidekiq_queue.rb b/db/migrate/20210526155257_rename_sync_security_report_approval_rules_sidekiq_queue.rb
deleted file mode 100644
index 51f234166de..00000000000
--- a/db/migrate/20210526155257_rename_sync_security_report_approval_rules_sidekiq_queue.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class RenameSyncSecurityReportApprovalRulesSidekiqQueue < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- sidekiq_queue_migrate 'sync_security_reports_to_report_approval_rules', to: 'ci_sync_reports_to_report_approval_rules' # rubocop:disable Migration/SidekiqQueueMigrate
- end
-
- def down
- sidekiq_queue_migrate 'ci_sync_reports_to_report_approval_rules', to: 'sync_security_reports_to_report_approval_rules' # rubocop:disable Migration/SidekiqQueueMigrate
- end
-end
diff --git a/db/migrate/20210526181820_add_index_to_vulnerability_statistics_on_latest_pipeline_id.rb b/db/migrate/20210526181820_add_index_to_vulnerability_statistics_on_latest_pipeline_id.rb
deleted file mode 100644
index dd11b1e6f11..00000000000
--- a/db/migrate/20210526181820_add_index_to_vulnerability_statistics_on_latest_pipeline_id.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToVulnerabilityStatisticsOnLatestPipelineId < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- INDEX_NAME = 'index_vulnerability_statistics_on_latest_pipeline_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :vulnerability_statistics, :latest_pipeline_id, name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :vulnerability_statistics, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210526181821_add_foreign_key_for_latest_pipeline_id_to_ci_pipelines.rb b/db/migrate/20210526181821_add_foreign_key_for_latest_pipeline_id_to_ci_pipelines.rb
deleted file mode 100644
index adcac5e2637..00000000000
--- a/db/migrate/20210526181821_add_foreign_key_for_latest_pipeline_id_to_ci_pipelines.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddForeignKeyForLatestPipelineIdToCiPipelines < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :vulnerability_statistics, :ci_pipelines, column: :latest_pipeline_id, on_delete: :nullify
- end
-
- def down
- with_lock_retries do
- remove_foreign_key_if_exists :vulnerability_statistics, :ci_pipelines
- end
- end
-end
diff --git a/db/migrate/20210526190259_add_ci_daily_pipeline_schedule_triggers_to_plan_limits.rb b/db/migrate/20210526190259_add_ci_daily_pipeline_schedule_triggers_to_plan_limits.rb
deleted file mode 100644
index 074bec31160..00000000000
--- a/db/migrate/20210526190259_add_ci_daily_pipeline_schedule_triggers_to_plan_limits.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class AddCiDailyPipelineScheduleTriggersToPlanLimits < ActiveRecord::Migration[6.0]
- def change
- add_column(:plan_limits, :ci_daily_pipeline_schedule_triggers, :integer, default: 0, null: false)
- end
-end
diff --git a/db/migrate/20210526190553_insert_ci_daily_pipeline_schedule_triggers_plan_limits.rb b/db/migrate/20210526190553_insert_ci_daily_pipeline_schedule_triggers_plan_limits.rb
deleted file mode 100644
index fe0969c15fb..00000000000
--- a/db/migrate/20210526190553_insert_ci_daily_pipeline_schedule_triggers_plan_limits.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class InsertCiDailyPipelineScheduleTriggersPlanLimits < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- EVERY_5_MINUTES = (1.day.in_minutes / 5).to_i
- EVERY_HOUR = 1.day.in_hours.to_i
-
- def up
- return unless Gitlab.com?
-
- create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'free', EVERY_HOUR)
- create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'bronze', EVERY_5_MINUTES)
- create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'silver', EVERY_5_MINUTES)
- create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'gold', EVERY_5_MINUTES)
- end
-
- def down
- return unless Gitlab.com?
-
- create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'free', 0)
- create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'bronze', 0)
- create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'silver', 0)
- create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'gold', 0)
- end
-end
diff --git a/db/migrate/20210527065005_add_index_for_cadence_iterations_automation.rb b/db/migrate/20210527065005_add_index_for_cadence_iterations_automation.rb
deleted file mode 100644
index 62ccdb6a4fd..00000000000
--- a/db/migrate/20210527065005_add_index_for_cadence_iterations_automation.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexForCadenceIterationsAutomation < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- INDEX_NAME = 'cadence_create_iterations_automation'
-
- disable_ddl_transaction!
-
- def up
- # no-op
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20210527130524_rename_experiment_subjects_group_id_to_namespace_id.rb b/db/migrate/20210527130524_rename_experiment_subjects_group_id_to_namespace_id.rb
deleted file mode 100644
index 5f60a7f25c2..00000000000
--- a/db/migrate/20210527130524_rename_experiment_subjects_group_id_to_namespace_id.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class RenameExperimentSubjectsGroupIdToNamespaceId < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers::V2
-
- disable_ddl_transaction!
-
- def up
- rename_column_concurrently :experiment_subjects, :group_id, :namespace_id
- end
-
- def down
- undo_rename_column_concurrently :experiment_subjects, :group_id, :namespace_id
- end
-end
diff --git a/db/migrate/20210527133919_add_diff_max_lines_to_application_settings.rb b/db/migrate/20210527133919_add_diff_max_lines_to_application_settings.rb
deleted file mode 100644
index 9c1cd94dbaa..00000000000
--- a/db/migrate/20210527133919_add_diff_max_lines_to_application_settings.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddDiffMaxLinesToApplicationSettings < ActiveRecord::Migration[6.0]
- def change
- add_column(:application_settings,
- :diff_max_lines,
- :integer,
- default: 50000,
- null: false)
- end
-end
diff --git a/db/migrate/20210527134019_add_diff_max_files_to_application_settings.rb b/db/migrate/20210527134019_add_diff_max_files_to_application_settings.rb
deleted file mode 100644
index 60b1f74cfd0..00000000000
--- a/db/migrate/20210527134019_add_diff_max_files_to_application_settings.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddDiffMaxFilesToApplicationSettings < ActiveRecord::Migration[6.0]
- def change
- add_column(:application_settings,
- :diff_max_files,
- :integer,
- default: 1000,
- null: false)
- end
-end
diff --git a/db/migrate/20210527185542_add_prevent_sharing_groups_outside_hierarchy_to_namespace_settings.rb b/db/migrate/20210527185542_add_prevent_sharing_groups_outside_hierarchy_to_namespace_settings.rb
deleted file mode 100644
index 8fb489ac537..00000000000
--- a/db/migrate/20210527185542_add_prevent_sharing_groups_outside_hierarchy_to_namespace_settings.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddPreventSharingGroupsOutsideHierarchyToNamespaceSettings < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- with_lock_retries do
- add_column :namespace_settings, :prevent_sharing_groups_outside_hierarchy, :boolean, null: false, default: false
- end
- end
-
- def down
- with_lock_retries do
- remove_column :namespace_settings, :prevent_sharing_groups_outside_hierarchy
- end
- end
-end
diff --git a/db/migrate/20210527194558_create_ci_job_token_project_scope_links.rb b/db/migrate/20210527194558_create_ci_job_token_project_scope_links.rb
deleted file mode 100644
index aaa94b9a231..00000000000
--- a/db/migrate/20210527194558_create_ci_job_token_project_scope_links.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class CreateCiJobTokenProjectScopeLinks < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- with_lock_retries do
- create_table :ci_job_token_project_scope_links, if_not_exists: true do |t|
- t.belongs_to :source_project, index: false, null: false, foreign_key: { to_table: :projects, on_delete: :cascade }
- t.belongs_to :target_project, null: false, foreign_key: { to_table: :projects, on_delete: :cascade }
- t.belongs_to :added_by, foreign_key: { to_table: :users, on_delete: :nullify }
- t.datetime_with_timezone :created_at, null: false
-
- t.index [:source_project_id, :target_project_id], unique: true, name: 'i_ci_job_token_project_scope_links_on_source_and_target_project'
- end
- end
- end
-
- def down
- with_lock_retries do
- drop_table :ci_job_token_project_scope_links, if_exists: true
- end
- end
-end
diff --git a/db/migrate/20210529164247_change_iterations_title_uniqueness_index.rb b/db/migrate/20210529164247_change_iterations_title_uniqueness_index.rb
deleted file mode 100644
index 47e7e2c757d..00000000000
--- a/db/migrate/20210529164247_change_iterations_title_uniqueness_index.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeIterationsTitleUniquenessIndex < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- INDEX_NAME = 'index_sprints_on_iterations_cadence_id_and_title'
- OLD_INDEX_NAME = 'index_sprints_on_group_id_and_title'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :sprints, [:iterations_cadence_id, :title], name: INDEX_NAME, unique: true
- remove_concurrent_index_by_name :sprints, OLD_INDEX_NAME
- end
-
- def down
- # noop
- # rollback would not work as we can have duplicate records once the unique `index_sprints_on_group_id_and_title` index is removed
- end
-end
diff --git a/db/migrate/20210531053916_rename_instance_statistics_measurements.rb b/db/migrate/20210531053916_rename_instance_statistics_measurements.rb
deleted file mode 100644
index 733ca296952..00000000000
--- a/db/migrate/20210531053916_rename_instance_statistics_measurements.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class RenameInstanceStatisticsMeasurements < Gitlab::Database::Migration[1.0]
- enable_lock_retries!
-
- def up
- rename_table_safely(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
- end
-
- def down
- undo_rename_table_safely(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
- end
-end
diff --git a/db/migrate/20210531070452_default_enforce_ssh_key_expiration.rb b/db/migrate/20210531070452_default_enforce_ssh_key_expiration.rb
deleted file mode 100644
index 8ddbb528962..00000000000
--- a/db/migrate/20210531070452_default_enforce_ssh_key_expiration.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-class DefaultEnforceSshKeyExpiration < ActiveRecord::Migration[6.0]
- def change
- change_column_default(:application_settings, :enforce_ssh_key_expiration, from: false, to: true)
- end
-end
diff --git a/db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb b/db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb
deleted file mode 100644
index c164183fbf8..00000000000
--- a/db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class EnableEnforceSshKeyExpiration < ActiveRecord::Migration[6.0]
- class ApplicationSetting < ActiveRecord::Base
- self.table_name = 'application_settings'
- end
-
- def up
- ApplicationSetting.reset_column_information
-
- ApplicationSetting.where.not(enforce_ssh_key_expiration: true).each do |application_setting|
- application_setting.update!(enforce_ssh_key_expiration: true)
- end
- end
-end
diff --git a/db/migrate/20210601080039_group_protected_environments_add_index_and_constraint.rb b/db/migrate/20210601080039_group_protected_environments_add_index_and_constraint.rb
deleted file mode 100644
index 1109d814ee9..00000000000
--- a/db/migrate/20210601080039_group_protected_environments_add_index_and_constraint.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-# frozen_string_literal: true
-
-class GroupProtectedEnvironmentsAddIndexAndConstraint < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- INDEX_NAME = 'index_protected_environments_on_group_id_and_name'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :protected_environments, [:group_id, :name], unique: true,
- name: INDEX_NAME, where: 'group_id IS NOT NULL'
- add_concurrent_foreign_key :protected_environments, :namespaces, column: :group_id, on_delete: :cascade
-
- add_check_constraint :protected_environments,
- "((project_id IS NULL) != (group_id IS NULL))",
- :protected_environments_project_or_group_existence
- end
-
- def down
- remove_group_protected_environments!
-
- remove_check_constraint :protected_environments, :protected_environments_project_or_group_existence
- remove_foreign_key_if_exists :protected_environments, column: :group_id
- remove_concurrent_index_by_name :protected_environments, name: INDEX_NAME
- end
-
- private
-
- def remove_group_protected_environments!
- execute <<-SQL
- DELETE FROM protected_environments WHERE group_id IS NOT NULL
- SQL
- end
-end
diff --git a/db/migrate/20210601123341_add_running_builds_table.rb b/db/migrate/20210601123341_add_running_builds_table.rb
deleted file mode 100644
index 4093619d2c3..00000000000
--- a/db/migrate/20210601123341_add_running_builds_table.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddRunningBuildsTable < ActiveRecord::Migration[6.0]
- def up
- create_table :ci_running_builds do |t|
- t.references :build, index: { unique: true }, null: false, foreign_key: { to_table: :ci_builds, on_delete: :cascade }
- t.references :project, index: true, null: false, foreign_key: { on_delete: :cascade }
- t.references :runner, index: true, null: false, foreign_key: { to_table: :ci_runners, on_delete: :cascade }
- t.datetime_with_timezone :created_at, null: false, default: -> { 'NOW()' }
- t.integer :runner_type, limit: 2, null: false
- end
- end
-
- def down
- drop_table :ci_running_builds
- end
-end
diff --git a/db/migrate/20210601125410_add_runners_created_at_index.rb b/db/migrate/20210601125410_add_runners_created_at_index.rb
deleted file mode 100644
index 6a6be6d8480..00000000000
--- a/db/migrate/20210601125410_add_runners_created_at_index.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddRunnersCreatedAtIndex < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_runners, [:created_at, :id], order: { id: :desc }, name: 'index_ci_runners_on_created_at_and_id_desc'
- add_concurrent_index :ci_runners, [:created_at, :id], order: { created_at: :desc, id: :desc }, name: 'index_ci_runners_on_created_at_desc_and_id_desc'
- end
-
- def down
- remove_concurrent_index :ci_runners, [:created_at, :id], order: { id: :desc }, name: 'index_ci_runners_on_created_at_and_id_desc'
- remove_concurrent_index :ci_runners, [:created_at, :id], order: { created_at: :desc, id: :desc }, name: 'index_ci_runners_on_created_at_desc_and_id_desc'
- end
-end
diff --git a/db/migrate/20210601131742_update_web_hook_calls_limit.rb b/db/migrate/20210601131742_update_web_hook_calls_limit.rb
deleted file mode 100644
index 6af0facd17d..00000000000
--- a/db/migrate/20210601131742_update_web_hook_calls_limit.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class UpdateWebHookCallsLimit < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- def up
- return unless Gitlab.com?
-
- create_or_update_plan_limit('web_hook_calls', 'free', 120)
- end
-
- def down
- return unless Gitlab.com?
-
- create_or_update_plan_limit('web_hook_calls', 'free', 0)
- end
-end
diff --git a/db/migrate/20210601132134_remove_partial_index_for_hashed_storage_migration.rb b/db/migrate/20210601132134_remove_partial_index_for_hashed_storage_migration.rb
deleted file mode 100644
index d9793832d8c..00000000000
--- a/db/migrate/20210601132134_remove_partial_index_for_hashed_storage_migration.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class RemovePartialIndexForHashedStorageMigration < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index :projects, :id, name: 'index_on_id_partial_with_legacy_storage'
- end
-
- def down
- add_concurrent_index :projects, :id, where: 'storage_version < 2 or storage_version IS NULL', name: 'index_on_id_partial_with_legacy_storage'
- end
-end
diff --git a/db/migrate/20210601133459_replace_runners_contacted_at_index.rb b/db/migrate/20210601133459_replace_runners_contacted_at_index.rb
deleted file mode 100644
index a0a933721f0..00000000000
--- a/db/migrate/20210601133459_replace_runners_contacted_at_index.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-# See https://docs.gitlab.com/ee/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class ReplaceRunnersContactedAtIndex < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- OLD_INDEX_NAME = 'index_ci_runners_on_contacted_at'
-
- def up
- add_concurrent_index :ci_runners, [:contacted_at, :id], order: { id: :desc }, name: 'index_ci_runners_on_contacted_at_and_id_desc', using: 'btree'
- add_concurrent_index :ci_runners, [:contacted_at, :id], order: { contacted_at: :desc, id: :desc }, name: 'index_ci_runners_on_contacted_at_desc_and_id_desc', using: 'btree'
-
- remove_concurrent_index_by_name :ci_runners, OLD_INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :ci_runners, 'index_ci_runners_on_contacted_at_and_id_desc'
- remove_concurrent_index_by_name :ci_runners, 'index_ci_runners_on_contacted_at_desc_and_id_desc'
-
- add_concurrent_index :ci_runners, :contacted_at, name: OLD_INDEX_NAME, using: 'btree'
- end
-end
diff --git a/db/migrate/20210602122213_add_upcoming_reconciliations.rb b/db/migrate/20210602122213_add_upcoming_reconciliations.rb
deleted file mode 100644
index 90d0013b357..00000000000
--- a/db/migrate/20210602122213_add_upcoming_reconciliations.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class AddUpcomingReconciliations < ActiveRecord::Migration[6.1]
- include Gitlab::Database::MigrationHelpers
-
- def up
- with_lock_retries do
- create_table :upcoming_reconciliations do |t|
- t.references :namespace, index: { unique: true }, null: true, foreign_key: { on_delete: :cascade }
- t.date :next_reconciliation_date, null: false
- t.date :display_alert_from, null: false
-
- t.timestamps_with_timezone
- end
- end
- end
-
- def down
- with_lock_retries do
- drop_table :upcoming_reconciliations
- end
- end
-end
diff --git a/db/migrate/20210602122233_add_runners_description_index.rb b/db/migrate/20210602122233_add_runners_description_index.rb
deleted file mode 100644
index ae779e62f0f..00000000000
--- a/db/migrate/20210602122233_add_runners_description_index.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddRunnersDescriptionIndex < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- INDEX_NAME = 'index_ci_runners_on_description_trigram'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_runners, :description, name: INDEX_NAME, using: :gin, opclass: { description: :gin_trgm_ops }
- end
-
- def down
- remove_concurrent_index_by_name :ci_runners, INDEX_NAME
- end
-end
diff --git a/db/migrate/20210602155056_add_merge_request_diff_commit_users.rb b/db/migrate/20210602155056_add_merge_request_diff_commit_users.rb
deleted file mode 100644
index f99790e0eca..00000000000
--- a/db/migrate/20210602155056_add_merge_request_diff_commit_users.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-class AddMergeRequestDiffCommitUsers < ActiveRecord::Migration[6.1]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- create_table_with_constraints :merge_request_diff_commit_users, id: :bigint do |t|
- t.text :name
- t.text :email
-
- t.text_limit :name, 512
- t.text_limit :email, 512
-
- t.index [:name, :email], unique: true
- end
-
- # Names or Emails can be optional, so in some cases one of these may be
- # null. But if both are NULL/empty, no row should exist in this table.
- add_check_constraint(
- :merge_request_diff_commit_users,
- "(COALESCE(name, '') != '') OR (COALESCE(email, '') != '')",
- :merge_request_diff_commit_users_name_or_email_existence
- )
- end
-
- def down
- drop_table :merge_request_diff_commit_users
- end
-end
diff --git a/db/migrate/20210602155110_add_merge_request_diff_commit_user_columns.rb b/db/migrate/20210602155110_add_merge_request_diff_commit_user_columns.rb
deleted file mode 100644
index 8cc86c7e73c..00000000000
--- a/db/migrate/20210602155110_add_merge_request_diff_commit_user_columns.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class AddMergeRequestDiffCommitUserColumns < ActiveRecord::Migration[6.1]
- include Gitlab::Database::MigrationHelpers
-
- def up
- # NOTE: these columns are _not_ indexed, nor do they use foreign keys.
- #
- # This is deliberate, as creating these indexes on GitLab.com takes a _very_
- # long time. In addition, there's no real need for them either based on how
- # this data is used.
- #
- # For more information, refer to the following:
- #
- # - https://gitlab.com/gitlab-com/gl-infra/production/-/issues/5038#note_614592881
- # - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/63669
- add_column(:merge_request_diff_commits, :commit_author_id, :bigint)
- add_column(:merge_request_diff_commits, :committer_id, :bigint)
- end
-
- def down
- remove_column(:merge_request_diff_commits, :commit_author_id)
- remove_column(:merge_request_diff_commits, :committer_id)
- end
-end
diff --git a/db/migrate/20210301200959_init_schema.rb b/db/migrate/20210602155110_init_schema.rb
index df68927d79a..971a3e0e2db 100644
--- a/db/migrate/20210301200959_init_schema.rb
+++ b/db/migrate/20210602155110_init_schema.rb
@@ -4,10 +4,10 @@ class InitSchema < ActiveRecord::Migration[6.0]
DOWNTIME = false
def up
- execute(IO.read("db/init_structure.sql"))
+ execute(File.read("db/init_structure.sql"))
end
def down
- raise ActiveRecord::IrreversibleMigration, "The initial migration is not revertable"
+ raise ActiveRecord::IrreversibleMigration, "The initial migration is not able to be reverted."
end
end
diff --git a/db/migrate/20221010191136_add_access_level_to_ci_job_artifacts.rb b/db/migrate/20221010191136_add_access_level_to_ci_job_artifacts.rb
new file mode 100644
index 00000000000..d69965ed8ec
--- /dev/null
+++ b/db/migrate/20221010191136_add_access_level_to_ci_job_artifacts.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddAccessLevelToCiJobArtifacts < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ add_column :ci_job_artifacts, :accessibility, :integer, default: 0, limit: 2, null: false
+ end
+end
diff --git a/db/migrate/20221122210711_add_columns_to_postgres_foreign_keys.rb b/db/migrate/20221122210711_add_columns_to_postgres_foreign_keys.rb
new file mode 100644
index 00000000000..bef05e52a3a
--- /dev/null
+++ b/db/migrate/20221122210711_add_columns_to_postgres_foreign_keys.rb
@@ -0,0 +1,54 @@
+# frozen_string_literal: true
+
+class AddColumnsToPostgresForeignKeys < Gitlab::Database::Migration[2.0]
+ def up
+ execute(<<~SQL)
+ CREATE OR REPLACE VIEW postgres_foreign_keys AS
+ SELECT
+ pg_constraint.oid AS oid,
+ pg_constraint.conname AS name,
+ constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,
+ referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier,
+ constrained_table.relname::text AS constrained_table_name,
+ referenced_table.relname::text AS referenced_table_name,
+ constrained_cols.constrained_columns,
+ referenced_cols.referenced_columns,
+ pg_constraint.confdeltype AS on_delete_action,
+ pg_constraint.coninhcount > 0 as is_inherited
+ FROM pg_constraint
+ INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid
+ INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid
+ INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid
+ INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid
+ CROSS JOIN LATERAL (
+ SELECT array_agg(pg_attribute.attname ORDER BY conkey.idx) -- must order here so that attributes are in correct order in array
+ FROM unnest(pg_constraint.conkey) WITH ORDINALITY conkey(attnum, idx)
+ INNER JOIN pg_attribute ON pg_attribute.attnum = conkey.attnum AND pg_attribute.attrelid = constrained_table.oid
+ ) constrained_cols(constrained_columns)
+ CROSS JOIN LATERAL (
+ SELECT array_agg(pg_attribute.attname ORDER BY confkey.idx)
+ FROM unnest(pg_constraint.confkey) WITH ORDINALITY confkey(attnum, idx)
+ INNER JOIN pg_attribute ON pg_attribute.attnum = confkey.attnum AND pg_attribute.attrelid = referenced_table.oid
+ ) referenced_cols(referenced_columns)
+ WHERE contype = 'f';
+ SQL
+ end
+
+ def down
+ execute(<<~SQL)
+ DROP VIEW IF EXISTS postgres_foreign_keys;
+ CREATE OR REPLACE VIEW postgres_foreign_keys AS
+ SELECT
+ pg_constraint.oid AS oid,
+ pg_constraint.conname AS name,
+ constrained_namespace.nspname::text || '.'::text || constrained_table.relname::text AS constrained_table_identifier,
+ referenced_namespace.nspname::text || '.'::text || referenced_table.relname::text AS referenced_table_identifier
+ FROM pg_constraint
+ INNER JOIN pg_class constrained_table ON constrained_table.oid = pg_constraint.conrelid
+ INNER JOIN pg_class referenced_table ON referenced_table.oid = pg_constraint.confrelid
+ INNER JOIN pg_namespace constrained_namespace ON constrained_table.relnamespace = constrained_namespace.oid
+ INNER JOIN pg_namespace referenced_namespace ON referenced_table.relnamespace = referenced_namespace.oid
+ WHERE contype = 'f';
+ SQL
+ end
+end
diff --git a/db/migrate/20221204090437_add_category_to_abuse_report.rb b/db/migrate/20221204090437_add_category_to_abuse_report.rb
new file mode 100644
index 00000000000..e908f3354bb
--- /dev/null
+++ b/db/migrate/20221204090437_add_category_to_abuse_report.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddCategoryToAbuseReport < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :abuse_reports, :category, :integer, limit: 2, default: 1, null: false
+ end
+end
diff --git a/db/migrate/20221209174132_remove_sbom_occurrences_unique_index.rb b/db/migrate/20221209174132_remove_sbom_occurrences_unique_index.rb
new file mode 100644
index 00000000000..1bee62b5b1f
--- /dev/null
+++ b/db/migrate/20221209174132_remove_sbom_occurrences_unique_index.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class RemoveSbomOccurrencesUniqueIndex < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'index_sbom_occurrences_on_ingestion_attributes'
+ ATTRIBUTES = %i[
+ project_id
+ component_id
+ component_version_id
+ source_id
+ commit_sha
+ ].freeze
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :sbom_occurrences, name: INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :sbom_occurrences, ATTRIBUTES, unique: true, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221209174157_truncate_sbom_occurrences.rb b/db/migrate/20221209174157_truncate_sbom_occurrences.rb
new file mode 100644
index 00000000000..e9db6526e2d
--- /dev/null
+++ b/db/migrate/20221209174157_truncate_sbom_occurrences.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class TruncateSbomOccurrences < Gitlab::Database::Migration[2.1]
+ def up
+ # Because existing data in the table violates the new
+ # uniqueness constraints, we need to remove the non-distinct rows.
+ # Rather than do an expensive and error-prone batch migration
+ # to find and remove the duplicates, we'll just remove all records
+ # from the table.
+ #
+ # The `cyclonedx_sbom_ingestion` feature flag should
+ # be OFF in all environments to avoid having more duplicate records
+ # added between this migration and the one where the new unqiue index
+ # is added.
+
+ # TRUNCATE is a DDL statement (it drops the table and re-creates it), so we want to run the
+ # migration in DDL mode, but we also don't want to execute it against all schemas because
+ # it's considered a write operation. So, we'll manually check and skip the migration if
+ # it's on not `:gitlab_main`.
+ return unless Gitlab::Database.gitlab_schemas_for_connection(connection).include?(:gitlab_main)
+
+ execute('TRUNCATE sbom_occurrences')
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20221212054640_add_reported_from_to_abuse_reports.rb b/db/migrate/20221212054640_add_reported_from_to_abuse_reports.rb
new file mode 100644
index 00000000000..701c0fa2e2c
--- /dev/null
+++ b/db/migrate/20221212054640_add_reported_from_to_abuse_reports.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddReportedFromToAbuseReports < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ unless column_exists?(:abuse_reports, :reported_from_url)
+ add_column :abuse_reports, :reported_from_url, :text, null: false, default: ''
+ end
+ end
+
+ add_text_limit :abuse_reports, :reported_from_url, 512
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :abuse_reports, :reported_from_url if column_exists?(:abuse_reports, :reported_from_url)
+ end
+ end
+end
diff --git a/db/migrate/20221212192452_add_uuid_column_to_sbom_occurrences.rb b/db/migrate/20221212192452_add_uuid_column_to_sbom_occurrences.rb
new file mode 100644
index 00000000000..4b7162d66f1
--- /dev/null
+++ b/db/migrate/20221212192452_add_uuid_column_to_sbom_occurrences.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddUuidColumnToSbomOccurrences < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :sbom_occurrences, :uuid, :uuid, null: false # rubocop:disable Rails/NotNullColumn
+ end
+end
diff --git a/db/migrate/20221212192527_index_sbom_occurrences_on_uuid.rb b/db/migrate/20221212192527_index_sbom_occurrences_on_uuid.rb
new file mode 100644
index 00000000000..7dbf6f25ab4
--- /dev/null
+++ b/db/migrate/20221212192527_index_sbom_occurrences_on_uuid.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class IndexSbomOccurrencesOnUuid < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'index_sbom_occurrences_on_uuid'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :sbom_occurrences, :uuid, unique: true, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :sbom_occurrences, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221213105028_add_sync_part_step_2_of_index_namespaces_on_path_for_top_level_non_projects.rb b/db/migrate/20221213105028_add_sync_part_step_2_of_index_namespaces_on_path_for_top_level_non_projects.rb
new file mode 100644
index 00000000000..c16cf3dd940
--- /dev/null
+++ b/db/migrate/20221213105028_add_sync_part_step_2_of_index_namespaces_on_path_for_top_level_non_projects.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddSyncPartStep2OfIndexNamespacesOnPathForTopLevelNonProjects < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'namespaces'
+ INDEX_NAME = 'index_namespaces_on_path_for_top_level_non_projects'
+ COLUMN = "lower((path)::text)"
+ CONDITIONS = "(parent_id IS NULL AND type::text <> 'Project'::text)"
+
+ def up
+ add_concurrent_index TABLE_NAME, COLUMN, name: INDEX_NAME, where: CONDITIONS
+ end
+
+ def down
+ remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221214201256_create_user_achievements.rb b/db/migrate/20221214201256_create_user_achievements.rb
new file mode 100644
index 00000000000..6e82cd255cd
--- /dev/null
+++ b/db/migrate/20221214201256_create_user_achievements.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class CreateUserAchievements < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def up
+ create_table :user_achievements do |t|
+ t.references :achievement,
+ null: false,
+ index: false,
+ foreign_key: { on_delete: :cascade }
+ t.bigint :user_id,
+ null: false
+ t.bigint :awarded_by_user_id,
+ null: true
+ t.bigint :revoked_by_user_id,
+ index: true,
+ null: true
+ t.timestamps_with_timezone null: false
+ t.datetime_with_timezone :revoked_at, null: true
+ t.index 'achievement_id, (revoked_by_user_id IS NULL)',
+ name: 'index_user_achievements_on_achievement_id_revoked_by_is_null'
+ t.index 'user_id, (revoked_by_user_id IS NULL)',
+ name: 'index_user_achievements_on_user_id_revoked_by_is_null'
+ t.index 'awarded_by_user_id, (revoked_by_user_id IS NULL)',
+ name: 'index_user_achievements_on_awarded_by_revoked_by_is_null'
+ end
+ end
+
+ def down
+ drop_table :user_achievements
+ end
+end
diff --git a/db/migrate/20221214204247_user_achievements_foreign_keys.rb b/db/migrate/20221214204247_user_achievements_foreign_keys.rb
new file mode 100644
index 00000000000..d65d3800dab
--- /dev/null
+++ b/db/migrate/20221214204247_user_achievements_foreign_keys.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class UserAchievementsForeignKeys < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :user_achievements, :users, column: :user_id, on_delete: :cascade
+ add_concurrent_foreign_key :user_achievements, :users, column: :awarded_by_user_id, on_delete: :nullify
+ add_concurrent_foreign_key :user_achievements, :users, column: :revoked_by_user_id, on_delete: :nullify
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :user_achievements, column: :user_id
+ remove_foreign_key :user_achievements, column: :awarded_by_user_id
+ remove_foreign_key :user_achievements, column: :revoked_by_user_id
+ end
+ end
+end
diff --git a/db/migrate/20221215210347_partition_pm_package_metadata_tables.rb b/db/migrate/20221215210347_partition_pm_package_metadata_tables.rb
new file mode 100644
index 00000000000..ebf2b8395b6
--- /dev/null
+++ b/db/migrate/20221215210347_partition_pm_package_metadata_tables.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class PartitionPmPackageMetadataTables < Gitlab::Database::Migration[2.1]
+ def up
+ # no-op
+ # This migration was reverted as part of https://gitlab.com/gitlab-org/gitlab/-/merge_requests/108644
+ # The migration file is re-added to ensure that all environments have the same list of migrations.
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20221219103007_add_name_to_ml_candidates.rb b/db/migrate/20221219103007_add_name_to_ml_candidates.rb
new file mode 100644
index 00000000000..2c56279de73
--- /dev/null
+++ b/db/migrate/20221219103007_add_name_to_ml_candidates.rb
@@ -0,0 +1,6 @@
+# frozen_string_literal: true
+class AddNameToMlCandidates < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :ml_candidates, :name, :text # rubocop:disable Migration/AddLimitToTextColumns
+ end
+end
diff --git a/db/migrate/20221219112528_add_text_limit_to_name_on_ml_candidates.rb b/db/migrate/20221219112528_add_text_limit_to_name_on_ml_candidates.rb
new file mode 100644
index 00000000000..c8f0de3b826
--- /dev/null
+++ b/db/migrate/20221219112528_add_text_limit_to_name_on_ml_candidates.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddTextLimitToNameOnMlCandidates < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :ml_candidates, :name, 255
+ end
+
+ def down
+ remove_text_limit :ml_candidates, :name
+ end
+end
diff --git a/db/migrate/20221219135535_add_user_defaults_to_private_profile_to_application_settings.rb b/db/migrate/20221219135535_add_user_defaults_to_private_profile_to_application_settings.rb
new file mode 100644
index 00000000000..2770456c46f
--- /dev/null
+++ b/db/migrate/20221219135535_add_user_defaults_to_private_profile_to_application_settings.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddUserDefaultsToPrivateProfileToApplicationSettings < Gitlab::Database::Migration[2.1]
+ def change
+ add_column(:application_settings, :user_defaults_to_private_profile, :boolean, default: false, null: false)
+ end
+end
diff --git a/db/migrate/20221221134116_create_elastic_group_index_statuses.rb b/db/migrate/20221221134116_create_elastic_group_index_statuses.rb
new file mode 100644
index 00000000000..6084b7e9557
--- /dev/null
+++ b/db/migrate/20221221134116_create_elastic_group_index_statuses.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateElasticGroupIndexStatuses < Gitlab::Database::Migration[2.1]
+ def change
+ create_table :elastic_group_index_statuses, id: false do |t|
+ t.references :namespace,
+ primary_key: true,
+ foreign_key: { on_delete: :cascade },
+ index: false,
+ default: nil
+
+ t.timestamps_with_timezone null: false
+ t.datetime_with_timezone :wiki_indexed_at
+
+ t.binary :last_wiki_commit
+ end
+ end
+end
diff --git a/db/migrate/20221221171239_rename_amount_used_column.rb b/db/migrate/20221221171239_rename_amount_used_column.rb
new file mode 100644
index 00000000000..f25407a85af
--- /dev/null
+++ b/db/migrate/20221221171239_rename_amount_used_column.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class RenameAmountUsedColumn < Gitlab::Database::Migration[2.1]
+ TRIGGER_NAME = 'sync_projects_amount_used_columns'
+ def up
+ rename_column :ci_project_monthly_usages, :amount_used, :tmp_amount_used
+ rename_column :ci_project_monthly_usages, :new_amount_used, :amount_used
+ rename_column :ci_project_monthly_usages, :tmp_amount_used, :new_amount_used
+
+ remove_rename_triggers(:ci_project_monthly_usages, TRIGGER_NAME)
+ install_rename_triggers(:ci_project_monthly_usages, :amount_used, :new_amount_used, trigger_name: TRIGGER_NAME)
+ end
+
+ def down
+ rename_column :ci_project_monthly_usages, :amount_used, :tmp_amount_used
+ rename_column :ci_project_monthly_usages, :new_amount_used, :amount_used
+ rename_column :ci_project_monthly_usages, :tmp_amount_used, :new_amount_used
+
+ remove_rename_triggers(:ci_project_monthly_usages, TRIGGER_NAME)
+ install_rename_triggers(:ci_project_monthly_usages, :amount_used, :new_amount_used, trigger_name: TRIGGER_NAME)
+ end
+end
diff --git a/db/migrate/20221222144954_create_analytics_dashboards_configuration_pointers.rb b/db/migrate/20221222144954_create_analytics_dashboards_configuration_pointers.rb
new file mode 100644
index 00000000000..b3df3ea281b
--- /dev/null
+++ b/db/migrate/20221222144954_create_analytics_dashboards_configuration_pointers.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class CreateAnalyticsDashboardsConfigurationPointers < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ create_table :analytics_dashboards_pointers do |t|
+ t.belongs_to :namespace,
+ null: false,
+ index: { unique: true },
+ foreign_key: { to_table: :namespaces, on_delete: :cascade }
+ t.belongs_to :project, null: false, foreign_key: { to_table: :projects, on_delete: :cascade }
+ end
+ end
+
+ def down
+ drop_table :analytics_dashboards_pointers
+ end
+end
diff --git a/db/migrate/20221223114543_add_pwa_icon_to_appearances.rb b/db/migrate/20221223114543_add_pwa_icon_to_appearances.rb
new file mode 100644
index 00000000000..9a1711be75d
--- /dev/null
+++ b/db/migrate/20221223114543_add_pwa_icon_to_appearances.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddPwaIconToAppearances < Gitlab::Database::Migration[2.1]
+ # rubocop:disable Migration/AddLimitToTextColumns
+ def up
+ add_column :appearances, :pwa_icon, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+
+ def down
+ remove_column :appearances, :pwa_icon
+ end
+end
diff --git a/db/migrate/20221226105323_add_registration_columns_to_ci_runners.rb b/db/migrate/20221226105323_add_registration_columns_to_ci_runners.rb
new file mode 100644
index 00000000000..6788f154a5c
--- /dev/null
+++ b/db/migrate/20221226105323_add_registration_columns_to_ci_runners.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddRegistrationColumnsToCiRunners < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ add_column :ci_runners, :registration_type, :integer, limit: 1, default: 0, null: false
+ add_column :ci_runners, :creator_id, :bigint, null: true
+ end
+end
diff --git a/db/migrate/20221226132038_index_ci_runners_on_creator_id.rb b/db/migrate/20221226132038_index_ci_runners_on_creator_id.rb
new file mode 100644
index 00000000000..e163380533b
--- /dev/null
+++ b/db/migrate/20221226132038_index_ci_runners_on_creator_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class IndexCiRunnersOnCreatorId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_ci_runners_on_creator_id_where_creator_id_not_null'
+
+ def up
+ add_concurrent_index :ci_runners, :creator_id, where: 'creator_id IS NOT NULL', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_runners, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221226163203_create_ci_runner_machines.rb b/db/migrate/20221226163203_create_ci_runner_machines.rb
new file mode 100644
index 00000000000..21ebeb898f4
--- /dev/null
+++ b/db/migrate/20221226163203_create_ci_runner_machines.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class CreateCiRunnerMachines < Gitlab::Database::Migration[2.1]
+ def change
+ create_table :ci_runner_machines do |t|
+ t.belongs_to :runner, index: false, null: false, foreign_key: { to_table: :ci_runners, on_delete: :cascade }
+ t.integer :executor_type, limit: 2
+ t.text :machine_xid, null: false, limit: 64
+ t.timestamps_with_timezone null: false
+ t.datetime_with_timezone :contacted_at
+ t.text :version, limit: 2048
+ t.text :revision, limit: 255
+ t.text :platform, limit: 255
+ t.text :architecture, limit: 255
+ t.text :ip_address, limit: 1024
+
+ t.index [:runner_id, :machine_xid], unique: true
+ t.index :version
+ end
+ end
+end
diff --git a/db/migrate/20221227080606_add_text_limit_to_pwa_icon.rb b/db/migrate/20221227080606_add_text_limit_to_pwa_icon.rb
new file mode 100644
index 00000000000..66edad4f53e
--- /dev/null
+++ b/db/migrate/20221227080606_add_text_limit_to_pwa_icon.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddTextLimitToPwaIcon < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :appearances, :pwa_icon, 1024
+ end
+
+ def down
+ remove_text_limit :appearances, :pwa_icon
+ end
+end
diff --git a/db/migrate/20221227100846_add_allow_registration_token_to_application_settings.rb b/db/migrate/20221227100846_add_allow_registration_token_to_application_settings.rb
new file mode 100644
index 00000000000..f6f055ef865
--- /dev/null
+++ b/db/migrate/20221227100846_add_allow_registration_token_to_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddAllowRegistrationTokenToApplicationSettings < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ add_column :application_settings, :allow_runner_registration_token, :boolean, default: true, null: false
+ end
+end
diff --git a/db/migrate/20221227100908_add_allow_registration_token_to_namespace_settings.rb b/db/migrate/20221227100908_add_allow_registration_token_to_namespace_settings.rb
new file mode 100644
index 00000000000..46456fcfbdf
--- /dev/null
+++ b/db/migrate/20221227100908_add_allow_registration_token_to_namespace_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddAllowRegistrationTokenToNamespaceSettings < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ add_column :namespace_settings, :allow_runner_registration_token, :boolean, default: true, null: false
+ end
+end
diff --git a/db/migrate/20221228063845_add_incident_events_to_integrations.rb b/db/migrate/20221228063845_add_incident_events_to_integrations.rb
new file mode 100644
index 00000000000..521ffce0724
--- /dev/null
+++ b/db/migrate/20221228063845_add_incident_events_to_integrations.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddIncidentEventsToIntegrations < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :integrations, :incident_events, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20221228083452_remove_check_constraint_on_chat_names_on_integration.rb b/db/migrate/20221228083452_remove_check_constraint_on_chat_names_on_integration.rb
new file mode 100644
index 00000000000..6a75bd1badd
--- /dev/null
+++ b/db/migrate/20221228083452_remove_check_constraint_on_chat_names_on_integration.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class RemoveCheckConstraintOnChatNamesOnIntegration < Gitlab::Database::Migration[2.1]
+ CONSTRAINT_NAME = 'check_2b0a0d0f0f'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_check_constraint(:chat_names, CONSTRAINT_NAME)
+ end
+
+ def down
+ # noop: rollback would not work as we can have records where `integration_id` IS NULL
+ end
+end
diff --git a/db/migrate/20221228161214_rename_appearances_short_title_to_pwa_short_name.rb b/db/migrate/20221228161214_rename_appearances_short_title_to_pwa_short_name.rb
new file mode 100644
index 00000000000..76dfbb56f65
--- /dev/null
+++ b/db/migrate/20221228161214_rename_appearances_short_title_to_pwa_short_name.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class RenameAppearancesShortTitleToPwaShortName < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ rename_column_concurrently :appearances, :short_title, :pwa_short_name
+ end
+
+ def down
+ undo_rename_column_concurrently :appearances, :short_title, :pwa_short_name
+ end
+end
diff --git a/db/migrate/20230104150600_add_machine_id_to_builds_metadata.rb b/db/migrate/20230104150600_add_machine_id_to_builds_metadata.rb
new file mode 100644
index 00000000000..838ccbff754
--- /dev/null
+++ b/db/migrate/20230104150600_add_machine_id_to_builds_metadata.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddMachineIdToBuildsMetadata < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ add_column :p_ci_builds_metadata, :runner_machine_id, :bigint
+ end
+end
diff --git a/db/migrate/20230105170414_rename_amount_used_column_on_ci_namespace_monthly_usages_table.rb b/db/migrate/20230105170414_rename_amount_used_column_on_ci_namespace_monthly_usages_table.rb
new file mode 100644
index 00000000000..ff59b1e5987
--- /dev/null
+++ b/db/migrate/20230105170414_rename_amount_used_column_on_ci_namespace_monthly_usages_table.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class RenameAmountUsedColumnOnCiNamespaceMonthlyUsagesTable < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ TRIGGER_NAME = 'sync_namespaces_amount_used_columns'
+ def up
+ rename_column :ci_namespace_monthly_usages, :amount_used, :tmp_amount_used
+ rename_column :ci_namespace_monthly_usages, :new_amount_used, :amount_used
+ rename_column :ci_namespace_monthly_usages, :tmp_amount_used, :new_amount_used
+
+ remove_rename_triggers(:ci_namespace_monthly_usages, TRIGGER_NAME)
+ install_rename_triggers(:ci_namespace_monthly_usages, :amount_used, :new_amount_used, trigger_name: TRIGGER_NAME)
+ end
+
+ def down
+ rename_column :ci_namespace_monthly_usages, :amount_used, :tmp_amount_used
+ rename_column :ci_namespace_monthly_usages, :new_amount_used, :amount_used
+ rename_column :ci_namespace_monthly_usages, :tmp_amount_used, :new_amount_used
+
+ remove_rename_triggers(:ci_namespace_monthly_usages, TRIGGER_NAME)
+ install_rename_triggers(:ci_namespace_monthly_usages, :amount_used, :new_amount_used, trigger_name: TRIGGER_NAME)
+ end
+end
diff --git a/db/migrate/20230106125945_add_user_to_ssh_signatures.rb b/db/migrate/20230106125945_add_user_to_ssh_signatures.rb
new file mode 100644
index 00000000000..9e487287b66
--- /dev/null
+++ b/db/migrate/20230106125945_add_user_to_ssh_signatures.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddUserToSshSignatures < Gitlab::Database::Migration[2.1]
+ def up
+ add_column :ssh_signatures, :user_id, :bigint, if_not_exists: true, null: true
+ end
+
+ def down
+ remove_column :ssh_signatures, :user_id, if_exists: true
+ end
+end
diff --git a/db/migrate/20230106131659_add_fingerprint_to_ssh_signatures.rb b/db/migrate/20230106131659_add_fingerprint_to_ssh_signatures.rb
new file mode 100644
index 00000000000..ba792a1ae43
--- /dev/null
+++ b/db/migrate/20230106131659_add_fingerprint_to_ssh_signatures.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddFingerprintToSshSignatures < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ add_column :ssh_signatures, :key_fingerprint_sha256, :bytea, if_not_exists: true
+ end
+
+ def down
+ remove_column :ssh_signatures, :key_fingerprint_sha256, :bytea, if_exists: true
+ end
+end
diff --git a/db/migrate/20230106142239_add_config_column_to_ci_runner_machines.rb b/db/migrate/20230106142239_add_config_column_to_ci_runner_machines.rb
new file mode 100644
index 00000000000..29fee4d7b56
--- /dev/null
+++ b/db/migrate/20230106142239_add_config_column_to_ci_runner_machines.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddConfigColumnToCiRunnerMachines < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ add_column :ci_runner_machines, :config, :jsonb, default: {}, null: false
+ end
+end
diff --git a/db/migrate/20230109095159_add_runner_machines_created_at_index.rb b/db/migrate/20230109095159_add_runner_machines_created_at_index.rb
new file mode 100644
index 00000000000..e9ca4851497
--- /dev/null
+++ b/db/migrate/20230109095159_add_runner_machines_created_at_index.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddRunnerMachinesCreatedAtIndex < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_ci_runner_machines_on_created_at_and_id_desc'
+
+ def up
+ add_concurrent_index :ci_runner_machines, [:created_at, :id], order: { id: :desc }, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_runner_machines, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230109121313_add_runner_machines_contacted_at_index.rb b/db/migrate/20230109121313_add_runner_machines_contacted_at_index.rb
new file mode 100644
index 00000000000..667a4309c51
--- /dev/null
+++ b/db/migrate/20230109121313_add_runner_machines_contacted_at_index.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class AddRunnerMachinesContactedAtIndex < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_ci_runner_machines_on_contacted_at_desc_and_id_desc'
+
+ def up
+ add_concurrent_index :ci_runner_machines, [:contacted_at, :id], order: { contacted_at: :desc, id: :desc },
+ name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_runner_machines, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230109215921_add_storage_admin_control_columns_to_plan_limits.rb b/db/migrate/20230109215921_add_storage_admin_control_columns_to_plan_limits.rb
new file mode 100644
index 00000000000..cf4879e4b89
--- /dev/null
+++ b/db/migrate/20230109215921_add_storage_admin_control_columns_to_plan_limits.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddStorageAdminControlColumnsToPlanLimits < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ add_column(:plan_limits, :enforcement_limit, :integer, default: 0, null: false)
+ add_column(:plan_limits, :notification_limit, :integer, default: 0, null: false)
+ add_column(:plan_limits, :dashboard_limit_enabled_at, :datetime_with_timezone)
+ end
+end
diff --git a/db/migrate/20230110031131_add_uses_legacy_iid_to_test_reports.rb b/db/migrate/20230110031131_add_uses_legacy_iid_to_test_reports.rb
new file mode 100644
index 00000000000..e327a4d43a4
--- /dev/null
+++ b/db/migrate/20230110031131_add_uses_legacy_iid_to_test_reports.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddUsesLegacyIidToTestReports < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :requirements_management_test_reports, :uses_legacy_iid, :boolean, null: false, default: true
+ end
+end
diff --git a/db/migrate/20230111092510_add_migrate_projects_to_bulk_import_entities.rb b/db/migrate/20230111092510_add_migrate_projects_to_bulk_import_entities.rb
new file mode 100644
index 00000000000..d09a796ba5c
--- /dev/null
+++ b/db/migrate/20230111092510_add_migrate_projects_to_bulk_import_entities.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddMigrateProjectsToBulkImportEntities < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :bulk_import_entities, :migrate_projects, :boolean, null: false, default: true
+ end
+end
diff --git a/db/migrate/20230111124512_remove_tmp_index_vulns_on_report_type.rb b/db/migrate/20230111124512_remove_tmp_index_vulns_on_report_type.rb
new file mode 100644
index 00000000000..e1254d237ba
--- /dev/null
+++ b/db/migrate/20230111124512_remove_tmp_index_vulns_on_report_type.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+class RemoveTmpIndexVulnsOnReportType < 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
+ remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :vulnerabilities, :id,
+ where: "report_type IN (#{REPORT_TYPES.values.join(', ')})",
+ name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230111132621_unpartition_pm_package_metadata_tables.rb b/db/migrate/20230111132621_unpartition_pm_package_metadata_tables.rb
new file mode 100644
index 00000000000..9fbd04734d3
--- /dev/null
+++ b/db/migrate/20230111132621_unpartition_pm_package_metadata_tables.rb
@@ -0,0 +1,54 @@
+# frozen_string_literal: true
+
+class UnpartitionPmPackageMetadataTables < Gitlab::Database::Migration[2.1]
+ def up
+ return unless Gitlab.dev_or_test_env? || Gitlab.staging?
+
+ drop_table(:pm_package_version_licenses, force: :cascade) # rubocop:disable Migration/DropTable
+ drop_table(:pm_package_versions, force: :cascade) # rubocop:disable Migration/DropTable
+ drop_table(:pm_packages, force: :cascade) # rubocop:disable Migration/DropTable
+
+ create_table :pm_packages do |t|
+ t.integer :purl_type, limit: 2, null: false
+ t.text :name, null: false, limit: 255
+ t.index [:purl_type, :name], name: 'i_pm_packages_purl_type_and_name', unique: true
+ end
+
+ create_table :pm_package_versions do |t|
+ t.references :pm_package,
+ index: false,
+ foreign_key: {
+ to_table: :pm_packages,
+ column: :pm_package_id,
+ name: 'fk_rails_cf94c3e601',
+ on_delete: :cascade
+ }
+ t.text :version, null: false, limit: 255
+ t.index [:pm_package_id, :version], name: 'i_pm_package_versions_on_package_id_and_version', unique: true
+ t.index :pm_package_id, name: 'index_pm_package_versions_on_pm_package_id'
+ end
+
+ create_table :pm_package_version_licenses, primary_key: [:pm_package_version_id, :pm_license_id] do |t|
+ t.references :pm_package_version,
+ index: false,
+ null: false,
+ foreign_key: {
+ to_table: :pm_package_versions,
+ column: :pm_package_version_id,
+ name: 'fk_rails_30ddb7f837',
+ on_delete: :cascade
+ }
+ t.references :pm_license,
+ index: false,
+ null: false,
+ foreign_key: { name: 'fk_rails_7520ea026d', on_delete: :cascade }
+ t.index :pm_license_id, name: 'index_pm_package_version_licenses_on_pm_license_id'
+ t.index :pm_package_version_id, name: 'index_pm_package_version_licenses_on_pm_package_version_id'
+ end
+ end
+
+ # partitioned tables can't be restored because
+ # foreign keys to partitioned tables are not supported by Postgres 11
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/387761
+ def down; end
+end
diff --git a/db/migrate/20230112014822_add_user_index_and_fk_to_ssh_signatures.rb b/db/migrate/20230112014822_add_user_index_and_fk_to_ssh_signatures.rb
new file mode 100644
index 00000000000..31df4b98274
--- /dev/null
+++ b/db/migrate/20230112014822_add_user_index_and_fk_to_ssh_signatures.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddUserIndexAndFkToSshSignatures < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_ssh_signatures_on_user_id'
+
+ def up
+ add_concurrent_index :ssh_signatures, :user_id, name: INDEX_NAME
+ add_concurrent_foreign_key :ssh_signatures, :users, column: :user_id, on_delete: :nullify
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :ssh_signatures, column: :user_id
+ end
+
+ remove_concurrent_index_by_name :ssh_signatures, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230112104253_add_tmp_index_to_ci_build_runner_session.rb b/db/migrate/20230112104253_add_tmp_index_to_ci_build_runner_session.rb
new file mode 100644
index 00000000000..62f202c1ee2
--- /dev/null
+++ b/db/migrate/20230112104253_add_tmp_index_to_ci_build_runner_session.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class AddTmpIndexToCiBuildRunnerSession < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = :tmp_index_ci_builds_runner_session_on_partition_id_and_id
+ TABLE_NAME = :ci_builds_runner_session
+
+ def up
+ return unless Gitlab.com?
+
+ add_concurrent_index(
+ TABLE_NAME,
+ [:partition_id, :id],
+ where: 'partition_id = 101',
+ name: INDEX_NAME
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20230112104526_add_tmp_index_to_ci_pending_build.rb b/db/migrate/20230112104526_add_tmp_index_to_ci_pending_build.rb
new file mode 100644
index 00000000000..3666e03a8b5
--- /dev/null
+++ b/db/migrate/20230112104526_add_tmp_index_to_ci_pending_build.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class AddTmpIndexToCiPendingBuild < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = :tmp_index_ci_pending_builds_on_partition_id_and_id
+ TABLE_NAME = :ci_pending_builds
+
+ def up
+ return unless Gitlab.com?
+
+ add_concurrent_index(
+ TABLE_NAME,
+ [:partition_id, :id],
+ where: 'partition_id = 101',
+ name: INDEX_NAME
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20230112104636_add_tmp_index_to_ci_running_build.rb b/db/migrate/20230112104636_add_tmp_index_to_ci_running_build.rb
new file mode 100644
index 00000000000..66c66cc1cd9
--- /dev/null
+++ b/db/migrate/20230112104636_add_tmp_index_to_ci_running_build.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class AddTmpIndexToCiRunningBuild < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = :tmp_index_ci_running_builds_on_partition_id_and_id
+ TABLE_NAME = :ci_running_builds
+
+ def up
+ return unless Gitlab.com?
+
+ add_concurrent_index(
+ TABLE_NAME,
+ [:partition_id, :id],
+ where: 'partition_id = 101',
+ name: INDEX_NAME
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME)
+ end
+end