summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20181228175414_init_schema.rb2551
-rw-r--r--db/migrate/20190103140724_make_legacy_false_default.rb9
-rw-r--r--db/migrate/20190104182041_cleanup_legacy_artifact_migration.rb34
-rw-r--r--db/migrate/20190107151020_add_services_type_index.rb20
-rw-r--r--db/migrate/20190108192941_remove_partial_index_from_ci_builds_artifacts_file.rb18
-rw-r--r--db/migrate/20190109153125_add_merge_request_external_diffs.rb25
-rw-r--r--db/migrate/20190114172110_add_domain_to_cluster.rb9
-rw-r--r--db/migrate/20190115054216_add_error_notification_sent_to_remote_mirrors.rb11
-rw-r--r--db/migrate/20190115092821_add_columns_project_error_tracking_settings.rb18
-rw-r--r--db/migrate/20190116234221_add_sorting_fields_to_user_preference.rb23
-rw-r--r--db/migrate/20190130091630_add_local_cached_markdown_version.rb11
-rw-r--r--db/migrate/20190206193120_add_index_to_tags.rb18
-rw-r--r--db/migrate/20190211131150_add_state_id_to_issuables.rb17
-rw-r--r--db/migrate/20190215154930_add_merge_pipelines_enabled_to_ci_cd_settings.rb11
-rw-r--r--db/migrate/20190218134158_add_masked_to_ci_variables.rb21
-rw-r--r--db/migrate/20190218134209_add_masked_to_ci_group_variables.rb21
-rw-r--r--db/migrate/20190219201635_add_asset_proxy_settings.rb20
-rw-r--r--db/migrate/20190220142344_add_email_header_and_footer_enabled_flag_to_appearances_table.rb17
-rw-r--r--db/migrate/20190220150130_add_extra_shas_to_ci_pipelines.rb12
-rw-r--r--db/migrate/20190222051615_add_indexes_for_merge_request_diffs_query.rb42
-rw-r--r--db/migrate/20190225152525_add_auto_dev_ops_enabled_to_namespaces.rb9
-rw-r--r--db/migrate/20190225160301_add_runner_tokens_indexes.rb24
-rw-r--r--db/migrate/20190228192410_add_multi_line_attributes_to_suggestion.rb19
-rw-r--r--db/migrate/20190301182457_add_external_hostname_to_ingress_and_knative.rb12
-rw-r--r--db/migrate/20190312071108_add_detected_repository_languages_to_projects.rb12
-rw-r--r--db/migrate/20190312113229_add_remove_at_to_pages_domains.rb10
-rw-r--r--db/migrate/20190312113634_add_remove_at_index_to_pages_domains.rb19
-rw-r--r--db/migrate/20190315191339_create_merge_request_assignees_table.rb22
-rw-r--r--db/migrate/20190320174702_add_lets_encrypt_notification_email_to_application_settings.rb17
-rw-r--r--db/migrate/20190322164830_add_auto_ssl_enabled_to_pages_domain.rb17
-rw-r--r--db/migrate/20190325080727_truncate_user_fullname.rb23
-rw-r--r--db/migrate/20190325105715_add_fields_to_user_preferences.rb24
-rw-r--r--db/migrate/20190325165127_add_managed_to_cluster.rb17
-rw-r--r--db/migrate/20190326164045_import_common_metrics_knative.rb15
-rw-r--r--db/migrate/20190327163904_add_notification_email_to_notification_settings.rb13
-rw-r--r--db/migrate/20190329085614_add_lets_encrypt_terms_of_service_accepted_to_application_settings.rb21
-rw-r--r--db/migrate/20190402150158_backport_enterprise_schema.rb2195
-rw-r--r--db/migrate/20190403161806_update_designs_index.rb21
-rw-r--r--db/migrate/20190408163745_prometheus_knative05_fix.rb18
-rw-r--r--db/migrate/20190409224933_add_name_to_geo_nodes.rb26
-rw-r--r--db/migrate/20190410173409_add_name_index_to_geo_nodes.rb21
-rw-r--r--db/migrate/20190412155659_add_merge_request_blocks.rb25
-rw-r--r--db/migrate/20190412183653_remove_url_index_from_geo_nodes.rb21
-rw-r--r--db/migrate/20190414185432_add_comment_to_vulnerability_feedback.rb17
-rw-r--r--db/migrate/20190415030217_add_variable_type_to_ci_variables.rb17
-rw-r--r--db/migrate/20190415095825_add_packages_size_to_project_statistics.rb11
-rw-r--r--db/migrate/20190415172035_update_insights_foreign_keys.rb25
-rw-r--r--db/migrate/20190416185130_add_merge_train_enabled_to_ci_cd_settings.rb21
-rw-r--r--db/migrate/20190416213556_add_variable_type_to_ci_group_variables.rb17
-rw-r--r--db/migrate/20190416213615_add_variable_type_to_ci_pipeline_variables.rb21
-rw-r--r--db/migrate/20190416213631_add_variable_type_to_ci_pipeline_schedule_variables.rb17
-rw-r--r--db/migrate/20190418132750_add_foreign_key_from_vulnerability_feedback_to_users.rb19
-rw-r--r--db/migrate/20190418182545_create_merge_request_trains_table.rb18
-rw-r--r--db/migrate/20190419121952_add_bridged_pipeline_id_to_bridges.rb15
-rw-r--r--db/migrate/20190419123057_add_bridged_pipeline_id_foreign_key.rb23
-rw-r--r--db/migrate/20190422082247_create_project_metrics_settings.rb14
-rw-r--r--db/migrate/20190423124640_add_index_to_projects_mirror_user_id.rb17
-rw-r--r--db/migrate/20190426180107_add_deployment_events_to_services.rb21
-rw-r--r--db/migrate/20190429082448_create_pages_domain_acme_orders.rb32
-rw-r--r--db/migrate/20190430131225_create_issue_tracker_data.rb25
-rw-r--r--db/migrate/20190430142025_create_jira_tracker_data.rb28
-rw-r--r--db/migrate/20190506135337_add_temporary_indexes_to_state_id.rb34
-rw-r--r--db/migrate/20190513174947_enable_create_incident_issues_by_default.rb19
-rw-r--r--db/migrate/20190514105711_create_ip_restriction.rb20
-rw-r--r--db/migrate/20190515125613_add_application_settings_elasticsearch_shards.rb10
-rw-r--r--db/migrate/20190516011213_add_build_queued_at_index.rb19
-rw-r--r--db/migrate/20190516151857_add_lets_encrypt_private_key_to_application_settings.rb18
-rw-r--r--db/migrate/20190516155724_change_packages_size_defaults_in_project_statistics.rb24
-rw-r--r--db/migrate/20190520200123_add_rule_type_to_approval_merge_request_approval_rules.rb21
-rw-r--r--db/migrate/20190521174505_add_report_type_to_approval_merge_request_rules.rb13
-rw-r--r--db/migrate/20190523112344_limit_milestone_date_years_to_4_digits.rb38
-rw-r--r--db/migrate/20190524062810_generate_lets_encrypt_private_key.rb18
-rw-r--r--db/migrate/20190524071727_add_ssl_valid_period_to_pages_domain.rb16
-rw-r--r--db/migrate/20190527011309_add_required_template_name_to_application_settings.rb17
-rw-r--r--db/migrate/20190527194830_add_wiki_size_to_statistics.rb9
-rw-r--r--db/migrate/20190528173628_add_index_for_code_owner_rule_type_on_approval_merge_request_rules.rb55
-rw-r--r--db/migrate/20190529142545_add_dns_rebinding_protection_enabled_to_application_settings.rb23
-rw-r--r--db/migrate/20190530042141_add_default_git_depth_to_ci_cd_settings.rb11
-rw-r--r--db/migrate/20190530154715_add_index_to_merge_requests_state_and_merge_status.rb21
-rw-r--r--db/migrate/20190531153110_create_namespace_root_storage_statistics.rb22
-rw-r--r--db/migrate/20190602014139_add_repository_type_to_lfs_objects_project.rb11
-rw-r--r--db/migrate/20190603124955_add_index_to_count_pending_mirror_updates.rb17
-rw-r--r--db/migrate/20190604091310_add_ldap_membership_lock.rb20
-rw-r--r--db/migrate/20190604184643_fix_pool_repository_source_project_id.rb19
-rw-r--r--db/migrate/20190605104727_add_default_project_deletion_protection_to_application_settings.rb22
-rw-r--r--db/migrate/20190605184422_create_namespace_aggregation_schedules.rb14
-rw-r--r--db/migrate/20190606014128_add_last_ci_minutes_notification_at_to_namespaces.rb12
-rw-r--r--db/migrate/20190606034427_add_lfs_object_id_index_to_lfs_objects_projects.rb17
-rw-r--r--db/migrate/20190606054649_change_operations_feature_flags_clients_token_not_null.rb11
-rw-r--r--db/migrate/20190606054742_add_token_encrypted_to_operations_feature_flags_clients.rb13
-rw-r--r--db/migrate/20190606054832_add_index_to_operations_feature_flags_clients_token_encrypted.rb18
-rw-r--r--db/migrate/20190606202100_add_name_to_badges.rb11
-rw-r--r--db/migrate/20190607085356_add_source_to_pages_domains.rb21
-rw-r--r--db/migrate/20190607145325_add_pages_domains_ssl_renew_index.rb25
-rw-r--r--db/migrate/20190607190856_add_index_to_users_public_emails.rb23
-rw-r--r--db/migrate/20190607205656_add_wiki_columns_to_index_status.rb12
-rw-r--r--db/migrate/20190610142825_add_index_to_members_invite_email.rb21
-rw-r--r--db/migrate/20190611090827_add_time_tracking_limit_to_hours_to_application_settings.rb23
-rw-r--r--db/migrate/20190611100201_add_geo_container_repository_updated_events_table.rb17
-rw-r--r--db/migrate/20190611100202_add_index_to_geo_event_log.rb17
-rw-r--r--db/migrate/20190611161641_add_target_project_id_to_merge_trains.rb18
-rw-r--r--db/migrate/20190612111201_add_geo_container_repository_counters.rb16
-rw-r--r--db/migrate/20190612111404_add_geo_container_sync_capacity.rb13
-rw-r--r--db/migrate/20190613030606_enable_hashed_storage_by_default.rb15
-rw-r--r--db/migrate/20190613044655_add_username_to_deploy_tokens.rb9
-rw-r--r--db/migrate/20190613073003_create_project_aliases.rb16
-rw-r--r--db/migrate/20190617123615_add_grafana_to_settings.rb18
-rw-r--r--db/migrate/20190620105427_change_null_private_profile_to_false.rb33
-rw-r--r--db/migrate/20190621022810_add_last_ci_minutes_usage_notification_level_to_namespaces.rb9
-rw-r--r--db/migrate/20190621151636_add_merge_request_rebase_jid.rb9
-rw-r--r--db/migrate/20190623212503_add_cluster_id_to_deployments.rb9
-rw-r--r--db/migrate/20190624123615_add_grafana_url_to_settings.rb20
-rw-r--r--db/migrate/20190625115224_add_description_to_services.rb14
-rw-r--r--db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb18
-rw-r--r--db/migrate/20190627051902_add_cluster_id_index_fk_to_deployments.rb21
-rw-r--r--db/migrate/20190627100221_add_mr_productivity_metrics.rb14
-rw-r--r--db/migrate/20190627122264_add_foreign_keys_for_container_repository.rb25
-rw-r--r--db/migrate/20190628145246_add_strategies_to_operations_feature_flag_scopes.rb19
-rw-r--r--db/migrate/20190628185000_add_released_at_to_releases_table.rb11
-rw-r--r--db/migrate/20190628185004_backfill_and_add_not_null_constraint_to_released_at_column_on_releases_table.rb18
-rw-r--r--db/migrate/20190703043358_add_commit_id_to_draft_notes.rb11
-rw-r--r--db/migrate/20190703130053_remove_gitaly_feature_flags.rb48
-rw-r--r--db/migrate/20190703171157_add_sourcing_epic_dates.rb10
-rw-r--r--db/migrate/20190703171555_add_sourcing_epic_dates_fks.rb25
-rw-r--r--db/migrate/20190709204413_add_rule_type_to_approval_project_rules.rb17
-rw-r--r--db/migrate/20190709220014_import_common_metrics_y_axis.rb13
-rw-r--r--db/migrate/20190709220143_add_index_to_issues_relative_position.rb20
-rw-r--r--db/migrate/20190710151229_add_index_to_approval_project_rules_rule_type.rb17
-rw-r--r--db/migrate/20190711124721_create_job_variables.rb27
-rw-r--r--db/migrate/20190711200053_change_deploy_tokens_token_not_null.rb11
-rw-r--r--db/migrate/20190711200508_add_token_encrypted_to_deploy_tokens.rb13
-rw-r--r--db/migrate/20190712040400_add_environment_id_to_clusters_kubernetes_namespaces.rb12
-rw-r--r--db/migrate/20190712040412_index_clusters_kubernetes_namespaces_on_environment_id.rb18
-rw-r--r--db/migrate/20190712064021_add_namespace_per_environment_flag_to_clusters.rb20
-rw-r--r--db/migrate/20190715042813_add_issue_id_to_versions.rb15
-rw-r--r--db/migrate/20190715043954_set_issue_id_for_all_versions.rb19
-rw-r--r--db/migrate/20190715140740_add_event_type_to_design_management_designs_versions.rb26
-rw-r--r--db/migrate/20190715142138_add_raw_blob_request_limit_to_application_settings.rb9
-rw-r--r--db/migrate/20190715173819_add_object_storage_flag_to_geo_node.rb21
-rw-r--r--db/migrate/20190715215532_add_project_emails_disabled.rb9
-rw-r--r--db/migrate/20190715215549_add_group_emails_disabled.rb9
-rw-r--r--db/migrate/20190716144222_create_analytics_cycle_analytics_project_stages.rb36
-rw-r--r--db/migrate/20190719122333_add_login_recaptcha_protection_enabled_to_application_settings.rb12
-rw-r--r--db/migrate/20190719174505_add_index_to_deploy_tokens_token_encrypted.rb17
-rw-r--r--db/migrate/20190722104947_add_static_object_token_to_users.rb22
-rw-r--r--db/migrate/20190722132830_add_static_objects_external_storage_columns_to_application_settings.rb16
-rw-r--r--db/migrate/20190722144316_create_milestone_releases_table.rb20
-rw-r--r--db/migrate/20190723153247_create_allowed_email_domains_for_groups.rb22
-rw-r--r--db/migrate/20190724112147_add_column_for_self_monitoring_project_id.rb16
-rw-r--r--db/migrate/20190725012225_change_outbound_local_requests_whitelist_default.rb30
-rw-r--r--db/migrate/20190725183432_add_index_to_index_on_static_object_token.rb21
-rw-r--r--db/migrate/20190726101050_rename_allow_local_requests_from_hooks_and_services_application_setting.rb17
-rw-r--r--db/migrate/20190726101133_add_allow_local_requests_from_system_hooks_to_application_settings.rb18
-rw-r--r--db/migrate/20190729062536_create_analytics_cycle_analytics_group_stages.rb36
-rw-r--r--db/migrate/20190729090456_add_index_on_environments_with_state.rb17
-rw-r--r--db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb31
-rw-r--r--db/migrate/20190731084415_add_build_need.rb20
-rw-r--r--db/migrate/20190801060809_delete_kubernetes_services.rb18
-rw-r--r--db/migrate/20190801142441_add_throttle_protected_path_columns.rb27
-rw-r--r--db/migrate/20190801193427_rename_application_settings_snowplow_collector_uri_column.rb17
-rw-r--r--db/migrate/20190802012622_reorder_issues_project_id_relative_position_index.rb24
-rw-r--r--db/migrate/20190802195602_add_timestamps_columns_to_geo_nodes.rb10
-rw-r--r--db/migrate/20190805140353_remove_rendundant_index_from_releases.rb24
-rw-r--r--db/migrate/20190806071559_remove_epic_issues_default_relative_position.rb25
-rw-r--r--db/migrate/20190807023052_design_issue_id_nullable.rb11
-rw-r--r--db/migrate/20190808152507_add_projects_sorting_field_to_user_preferences.rb15
-rw-r--r--db/migrate/20190814205640_import_common_metrics_line_charts.rb13
-rw-r--r--db/migrate/20190815093936_add_index_notes_on_project_id_and_id_and_system_false.rb30
-rw-r--r--db/migrate/20190815093949_remove_index_notes_on_noteable_type.rb29
-rw-r--r--db/migrate/20190816151221_add_active_jobs_limit_to_plans.rb17
-rw-r--r--db/migrate/20190819131155_add_cluster_status_index_to_deployments.rb17
-rw-r--r--db/migrate/20190820163320_add_first_last_name_to_user.rb18
-rw-r--r--db/migrate/20190821040941_create_cluster_providers_aws.rb37
-rw-r--r--db/migrate/20190822175441_rename_epics_state_to_state_id.rb17
-rw-r--r--db/migrate/20190822181528_create_list_user_preferences.rb16
-rw-r--r--db/migrate/20190823055948_change_clusters_namespace_per_environment_default.rb12
-rw-r--r--db/migrate/20190826090628_remove_redundant_deployments_index.rb18
-rw-r--r--db/migrate/20190826100605_add_group_column_to_events.rb19
-rw-r--r--db/migrate/20190827222124_add_sourcegraph_configuration_to_application_settings.rb23
-rw-r--r--db/migrate/20190828083843_add_index_to_ci_job_artifacts_on_project_id_for_security_reports.rb22
-rw-r--r--db/migrate/20190828110802_add_not_null_constraints_to_prometheus_metrics_y_label_and_unit.rb10
-rw-r--r--db/migrate/20190828170945_create_package_metadatum.rb14
-rw-r--r--db/migrate/20190828172831_create_package_tag.rb16
-rw-r--r--db/migrate/20190829131130_create_external_pull_requests.rb27
-rw-r--r--db/migrate/20190830075508_add_external_pull_request_id_to_ci_pipelines.rb15
-rw-r--r--db/migrate/20190830080123_add_index_to_ci_pipelines_external_pull_request.rb17
-rw-r--r--db/migrate/20190830080626_add_foreign_key_to_ci_pipelines_external_pull_request.rb17
-rw-r--r--db/migrate/20190830140240_add_duplicated_to_to_issue.rb27
-rw-r--r--db/migrate/20190901174200_add_max_issue_count_to_list.rb16
-rw-r--r--db/migrate/20190902131045_replace_indexes_for_counting_active_users.rb23
-rw-r--r--db/migrate/20190902152329_add_index_for_ci_builds_metrics.rb19
-rw-r--r--db/migrate/20190903150358_create_analytics_repository_files_table.rb23
-rw-r--r--db/migrate/20190903150435_create_analytics_repository_file_edits_table.rb29
-rw-r--r--db/migrate/20190904173203_add_index_on_users_unconfirmed_email.rb17
-rw-r--r--db/migrate/20190905022045_add_issues_prometheus_alert_event_join_table.rb22
-rw-r--r--db/migrate/20190905074652_index_timestamp_columns_for_issue_metrics.rb29
-rw-r--r--db/migrate/20190905140605_add_cloud_run_to_clusters_providers_gcp.rb17
-rw-r--r--db/migrate/20190905223800_add_interruptible_to_builds_metadata.rb9
-rw-r--r--db/migrate/20190905223900_add_concurrent_index_to_builds_metadata.rb19
-rw-r--r--db/migrate/20190906104555_create_alerts_service_data.rb17
-rw-r--r--db/migrate/20190907184714_add_show_whitespace_in_diffs_to_user_preferences.rb20
-rw-r--r--db/migrate/20190909045845_create_project_pages_metadata.rb14
-rw-r--r--db/migrate/20190910103144_replace_events_index_on_group_id_with_partial_index.rb19
-rw-r--r--db/migrate/20190910114843_exclude_nulls_from_index_on_namespaces_type.rb20
-rw-r--r--db/migrate/20190910125852_create_analytics_language_trend_repository_languages.rb34
-rw-r--r--db/migrate/20190910211526_create_packages_conan_file_metadata.rb20
-rw-r--r--db/migrate/20190910212256_add_any_approver_rule_unique_indexes.rb30
-rw-r--r--db/migrate/20190911115056_add_projects_max_pages_size.rb9
-rw-r--r--db/migrate/20190911115109_add_namespaces_max_pages_size.rb9
-rw-r--r--db/migrate/20190911115207_add_projects_max_artifacts_size.rb9
-rw-r--r--db/migrate/20190911115222_add_namespaces_max_artifacts_size.rb9
-rw-r--r--db/migrate/20190912061145_add_index_to_members_on_expires_at.rb17
-rw-r--r--db/migrate/20190912223232_add_role_to_users.rb12
-rw-r--r--db/migrate/20190913174707_add_spdx_id_to_software_licenses.rb15
-rw-r--r--db/migrate/20190913175827_add_index_to_software_licenses_on_spdx_id.rb17
-rw-r--r--db/migrate/20190914223900_modify_concurrent_index_to_builds_metadata.rb23
-rw-r--r--db/migrate/20190918025618_add_user_and_timestamps_to_design_management_versions.rb16
-rw-r--r--db/migrate/20190918102042_create_grafana_integrations.rb17
-rw-r--r--db/migrate/20190918104212_add_merge_request_metrics_merged_at_index.rb17
-rw-r--r--db/migrate/20190918104731_add_cleanup_status_to_cluster.rb21
-rw-r--r--db/migrate/20190918121135_add_cleanup_status_reason_to_cluster.rb12
-rw-r--r--db/migrate/20190919040324_add_successfull_pages_deploy_partial_index_on_ci_builds.rb23
-rw-r--r--db/migrate/20190919091300_create_evidences.rb14
-rw-r--r--db/migrate/20190919104119_index_timestamp_columns_for_merge_requests_creation_date.rb29
-rw-r--r--db/migrate/20190919162036_add_index_to_clusters_providers_gcp_on_cloud_run.rb17
-rw-r--r--db/migrate/20190919183411_add_index_packages_on_name_trigram_to_packages_packages.rb18
-rw-r--r--db/migrate/20190920122420_add_max_personal_access_token_lifetime_to_application_settings.rb9
-rw-r--r--db/migrate/20190920194925_backfill_releases_table_updated_at_and_add_not_null_constraints_to_timestamps.rb24
-rw-r--r--db/migrate/20190920224341_create_merge_request_context_commits_and_diffs.rb45
-rw-r--r--db/migrate/20190924124627_add_pull_mirror_branch_prefix_to_projects.rb13
-rw-r--r--db/migrate/20190925055714_default_request_access_groups.rb15
-rw-r--r--db/migrate/20190925055902_default_request_access_projects.rb15
-rw-r--r--db/migrate/20190926041216_add_user_indexes_to_design_management_versions.rb19
-rw-r--r--db/migrate/20190926225633_create_x509_signatures.rb43
-rw-r--r--db/migrate/20190927055500_create_description_versions.rb29
-rw-r--r--db/migrate/20190927055540_add_index_to_sytem_note_metadata_description_version_id.rb19
-rw-r--r--db/migrate/20190927074328_add_index_on_snippet_content.rb18
-rw-r--r--db/migrate/20190929180751_create_vulnerabilities.rb41
-rw-r--r--db/migrate/20190929180813_add_reference_from_vulnerability_occurrences_to_occurrences.rb14
-rw-r--r--db/migrate/20190929180827_add_foreign_keys_and_indexes_to_vulnerabilities.rb76
-rw-r--r--db/migrate/20190930025655_add_incident_management_throttle_columns_to_application_setting.rb30
-rw-r--r--db/migrate/20190930063627_add_management_project_id_to_clusters.rb9
-rw-r--r--db/migrate/20190930082942_add_new_release_to_notification_settings.rb9
-rw-r--r--db/migrate/20190930153535_create_zoom_meetings.rb24
-rw-r--r--db/migrate/20191001040549_add_management_project_id_index_fk_to_clusters.rb19
-rw-r--r--db/migrate/20191001170300_create_ci_ref.rb21
-rw-r--r--db/migrate/20191002123516_create_clusters_applications_elastic_stack.rb24
-rw-r--r--db/migrate/20191003015155_add_self_managed_prometheus_alerts.rb22
-rw-r--r--db/migrate/20191003060227_add_push_event_hooks_limit_to_application_settings.rb17
-rw-r--r--db/migrate/20191003064615_create_aws_roles.rb23
-rw-r--r--db/migrate/20191003130045_create_issue_user_mentions.rb19
-rw-r--r--db/migrate/20191003150045_create_merge_request_user_mentions.rb19
-rw-r--r--db/migrate/20191003161031_add_mark_for_deletion_to_projects.rb13
-rw-r--r--db/migrate/20191003161032_add_mark_for_deletion_indexes_to_projects.rb19
-rw-r--r--db/migrate/20191003195218_add_pendo_enabled_to_application_settings.rb17
-rw-r--r--db/migrate/20191003195620_add_pendo_url_to_application_settings.rb13
-rw-r--r--db/migrate/20191003200045_create_epic_user_mentions.rb19
-rw-r--r--db/migrate/20191003250045_create_commit_user_mentions.rb18
-rw-r--r--db/migrate/20191003300045_create_snippet_user_mentions.rb19
-rw-r--r--db/migrate/20191003350045_create_design_user_mentions.rb19
-rw-r--r--db/migrate/20191004080818_add_productivity_analytics_start_date.rb11
-rw-r--r--db/migrate/20191004081520_fill_productivity_analytics_start_date.rb31
-rw-r--r--db/migrate/20191004133612_create_analytics_repository_file_commits.rb19
-rw-r--r--db/migrate/20191004151428_add_auto_stop_in_to_environments.rb9
-rw-r--r--db/migrate/20191008013056_add_push_event_activities_limit_to_application_settings.rb17
-rw-r--r--db/migrate/20191008142331_add_ref_count_to_push_event_payloads.rb11
-rw-r--r--db/migrate/20191008180203_add_issuable_state_id_indexes.rb75
-rw-r--r--db/migrate/20191008200204_add_state_id_default_value.rb24
-rw-r--r--db/migrate/20191009100244_add_geo_design_repository_counters.rb16
-rw-r--r--db/migrate/20191009110124_add_has_exposed_artifacts_to_ci_builds_metadata.rb13
-rw-r--r--db/migrate/20191009110757_add_index_to_ci_builds_metadata_has_exposed_artifacts.rb17
-rw-r--r--db/migrate/20191009222222_add_custom_http_clone_url_root_to_application_settings.rb15
-rw-r--r--db/migrate/20191010174846_add_snowplow_iglu_registry_url_to_application_settings.rb11
-rw-r--r--db/migrate/20191011084019_add_project_deletion_adjourned_period_to_application_settings.rb11
-rw-r--r--db/migrate/20191013100213_add_squash_commit_sha_to_merge_requests.rb9
-rw-r--r--db/migrate/20191014025629_rename_design_management_version_user_to_author.rb17
-rw-r--r--db/migrate/20191014030730_add_author_index_to_design_management_versions.rb17
-rw-r--r--db/migrate/20191014084150_add_index_on_snippets_project_id_and_visibility_level.rb17
-rw-r--r--db/migrate/20191014123159_add_expire_notification_delivered_to_personal_access_tokens.rb17
-rw-r--r--db/migrate/20191014132931_remove_index_on_snippets_project_id.rb20
-rw-r--r--db/migrate/20191016072826_replace_ci_trigger_requests_index.rb32
-rw-r--r--db/migrate/20191016133352_create_ci_subscriptions_projects.rb21
-rw-r--r--db/migrate/20191016220135_add_join_table_for_self_managed_prometheus_alert_issues.rb22
-rw-r--r--db/migrate/20191017001326_create_users_security_dashboard_projects.rb15
-rw-r--r--db/migrate/20191017094449_add_remove_source_branch_after_merge_to_projects.rb17
-rw-r--r--db/migrate/20191017134513_add_deployment_merge_requests.rb33
-rw-r--r--db/migrate/20191017191341_create_clusters_applications_crossplane.rb21
-rw-r--r--db/migrate/20191023093207_add_comment_actions_to_services.rb21
-rw-r--r--db/migrate/20191023132005_add_merge_requests_index_on_target_project_and_branch.rb19
-rw-r--r--db/migrate/20191023152913_add_default_and_free_plans.rb29
-rw-r--r--db/migrate/20191024134020_add_index_to_zoom_meetings.rb17
-rw-r--r--db/migrate/20191025092748_add_secret_token_to_snippet.rb12
-rw-r--r--db/migrate/20191026041447_change_default_value_of_throttle_protected_paths.rb38
-rw-r--r--db/migrate/20191026120008_add_promoted_to_epic_to_issues.rb16
-rw-r--r--db/migrate/20191026120112_add_promoted_to_epic_to_issues_index.rb22
-rw-r--r--db/migrate/20191026124116_set_application_settings_default_project_and_snippet_visibility.rb15
-rw-r--r--db/migrate/20191028130054_add_max_issue_weight_to_list.rb17
-rw-r--r--db/migrate/20191028162543_add_setup_for_company_to_user_preferences.rb9
-rw-r--r--db/migrate/20191028184740_rename_snowplow_site_id_to_snowplow_app_id.rb17
-rw-r--r--db/migrate/20191029125305_create_packages_conan_metadata.rb18
-rw-r--r--db/migrate/20191029191901_add_enabled_to_grafana_integrations.rb23
-rw-r--r--db/migrate/20191030135044_create_plan_limits.rb14
-rw-r--r--db/migrate/20191030152934_move_limits_from_plans.rb17
-rw-r--r--db/migrate/20191031095636_create_project_settings.rb12
-rw-r--r--db/migrate/20191101092917_replace_index_on_metrics_merged_at.rb19
-rw-r--r--db/migrate/20191103202505_add_eks_credentials_to_application_settings.rb18
-rw-r--r--db/migrate/20191104205020_add_license_details_to_application_settings.rb11
-rw-r--r--db/migrate/20191105094558_add_report_type_to_vulnerabilities.rb9
-rw-r--r--db/migrate/20191105134413_create_service_desk_settings.rb20
-rw-r--r--db/migrate/20191105155113_add_secret_to_snippet.rb27
-rw-r--r--db/migrate/20191105193652_add_index_on_deployments_updated_at.rb18
-rw-r--r--db/migrate/20191106144901_add_state_to_merge_trains.rb18
-rw-r--r--db/migrate/20191106150931_add_timelog_spent_at_index.rb20
-rw-r--r--db/migrate/20191107064946_update_oauth_open_id_requests_foreign_keys.rb29
-rw-r--r--db/migrate/20191107173446_add_sourcegraph_admin_and_user_preferences.rb17
-rw-r--r--db/migrate/20191107220314_add_index_to_projects_on_marked_for_deletion.rb17
-rw-r--r--db/migrate/20191108031900_create_package_build_info.rb12
-rw-r--r--db/migrate/20191111115229_add_group_id_to_import_export_uploads.rb9
-rw-r--r--db/migrate/20191111115431_add_group_fk_to_import_export_uploads.rb19
-rw-r--r--db/migrate/20191111121500_default_ci_config_path.rb15
-rw-r--r--db/migrate/20191111165017_add_fixed_pipeline_to_notification_settings.rb9
-rw-r--r--db/migrate/20191111175230_add_index_on_ci_pipelines_updated_at.rb18
-rw-r--r--db/migrate/20191112090226_add_artifacts_to_ci_build_need.rb20
-rw-r--r--db/migrate/20191112105448_add_index_on_personal_access_tokens_user_id_and_expires_at.rb18
-rw-r--r--db/migrate/20191112115247_add_cached_markdown_version_to_vulnerabilities.rb9
-rw-r--r--db/migrate/20191112212815_create_web_authn_table.rb26
-rw-r--r--db/migrate/20191112214305_add_indexes_for_projects_api_default_params.rb19
-rw-r--r--db/migrate/20191112221821_add_indexes_for_projects_api_default_params_authenticated.rb19
-rw-r--r--db/migrate/20191112232338_ensure_no_empty_milestone_titles.rb18
-rw-r--r--db/migrate/20191114132259_add_mentions_disabled_to_namespaces.rb9
-rw-r--r--db/migrate/20191114173508_add_resolved_attributes_to_vulnerabilities.rb15
-rw-r--r--db/migrate/20191114173602_add_foreign_key_on_resolved_by_id_to_vulnerabilities.rb19
-rw-r--r--db/migrate/20191114201118_make_created_at_not_null_in_design_management_versions.rb15
-rw-r--r--db/migrate/20191115001123_add_index_to_mod_sec_ci_variables.rb17
-rw-r--r--db/migrate/20191115001843_add_index_to_mod_sec_ci_pipeline_variables.rb17
-rw-r--r--db/migrate/20191115091425_create_vulnerability_issue_links.rb23
-rw-r--r--db/migrate/20191115114032_add_processed_to_ci_builds.rb9
-rw-r--r--db/migrate/20191118053631_add_group_deletion_schedules.rb28
-rw-r--r--db/migrate/20191118155702_add_index_on_status_to_merge_trains.rb20
-rw-r--r--db/migrate/20191118173522_add_snippet_size_limit_to_application_settings.rb13
-rw-r--r--db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb21
-rw-r--r--db/migrate/20191119023952_add_created_at_index_to_snippets.rb17
-rw-r--r--db/migrate/20191119220425_rename_software_license_policies_approval_status_to_classification.rb17
-rw-r--r--db/migrate/20191119231621_create_container_expiration_policies.rb23
-rw-r--r--db/migrate/20191120084627_add_encrypted_fields_to_application_settings.rb34
-rw-r--r--db/migrate/20191120115530_encrypt_plaintext_attributes_on_application_settings.rb87
-rw-r--r--db/migrate/20191120200015_add_index_to_grafana_integrations.rb17
-rw-r--r--db/migrate/20191121111621_create_packages_dependencies.rb16
-rw-r--r--db/migrate/20191121121947_create_packages_dependency_links.rb15
-rw-r--r--db/migrate/20191121161018_add_project_id_name_version_package_type_index_to_packages_packages.rb22
-rw-r--r--db/migrate/20191121193110_add_issue_links_type.rb17
-rw-r--r--db/migrate/20191122161519_create_sentry_issues_table.rb15
-rw-r--r--db/migrate/20191123062354_add_minimum_password_length_to_application_settings.rb11
-rw-r--r--db/migrate/20191123081456_add_dismissable_to_broadcast_messages.rb9
-rw-r--r--db/migrate/20191124150431_change_label_id_index_to_include_action_on_label_events.rb21
-rw-r--r--db/migrate/20191125114345_add_admin_mode_protected_path.rb54
-rw-r--r--db/migrate/20191125133353_add_target_path_to_broadcast_message.rb11
-rw-r--r--db/migrate/20191125140458_create_import_failures.rb19
-rw-r--r--db/migrate/20191126134210_rename_packages_package_tags.rb9
-rw-r--r--db/migrate/20191127030005_create_serverless_domain_cluster.rb19
-rw-r--r--db/migrate/20191127151619_create_gitlab_subscription_histories.rb28
-rw-r--r--db/migrate/20191127151629_add_trial_starts_on_to_gitlab_subscriptions.rb10
-rw-r--r--db/migrate/20191127163053_add_confidential_to_doorkeeper_application.rb26
-rw-r--r--db/migrate/20191127221608_add_wildcard_and_domain_type_to_pages_domains.rb20
-rw-r--r--db/migrate/20191128145231_add_ci_resource_groups.rb22
-rw-r--r--db/migrate/20191128145232_add_fk_to_ci_resources_build_id.rb17
-rw-r--r--db/migrate/20191128145233_add_fk_to_ci_resource_groups_project_id.rb17
-rw-r--r--db/migrate/20191129134844_add_broadcast_type_to_broadcast_message.rb19
-rw-r--r--db/migrate/20191129144630_add_resource_group_id_to_ci_builds.rb27
-rw-r--r--db/migrate/20191129144631_add_index_to_resource_group_id.rb20
-rw-r--r--db/migrate/20191202181924_add_environment_auto_stop_in_to_ci_builds_metadata.rb15
-rw-r--r--db/migrate/20191203121729_update_group_deletion_schedules_foreign_keys.rb29
-rw-r--r--db/migrate/20191204070713_change_updated_at_index_and_add_index_to_id_on_deployments.rb29
-rw-r--r--db/migrate/20191204093410_add_label_project_group_partial_indexes.rb25
-rw-r--r--db/migrate/20191204192726_add_design_disk_path_to_geo_hashed_storage_migrated_events.rb14
-rw-r--r--db/migrate/20191205060723_add_index_to_keys.rb17
-rw-r--r--db/migrate/20191205094702_add_index_for_cross_projects_dependencies_to_ci_builds.rb19
-rw-r--r--db/migrate/20191205145647_add_index_to_projects_deploy_keys_deploy_key.rb17
-rw-r--r--db/migrate/20191205212923_support_multiple_milestones_for_issues.rb14
-rw-r--r--db/migrate/20191205212924_support_multiple_milestones_for_merge_requests.rb14
-rw-r--r--db/migrate/20191206014412_add_image_to_design_management_designs_versions.rb11
-rw-r--r--db/migrate/20191206022133_add_indexes_to_pages_domains_on_wildcard_and_domain_type.rb19
-rw-r--r--db/migrate/20191206122926_update_index_for_pool_repositories.rb24
-rw-r--r--db/migrate/20191207104000_add_render_whitespace_in_code_to_user_preference.rb17
-rw-r--r--db/migrate/20191208071111_add_fingerprint_sha256_to_key.rb13
-rw-r--r--db/migrate/20191208071112_add_fingerprint_sha256_index_to_key.rb17
-rw-r--r--db/migrate/20191208110214_add_suggestion_commit_message_to_projects.rb13
-rw-r--r--db/migrate/20191209143606_add_deleted_at_to_description_versions.rb9
-rw-r--r--db/migrate/20191210211253_create_resource_weight_event.rb18
-rw-r--r--db/migrate/20191212140117_change_commit_user_mentions_commit_id_column_type.rb38
-rw-r--r--db/migrate/20191213104838_add_service_desk_username.rb11
-rw-r--r--db/migrate/20191213120427_fix_max_pages_size.rb20
-rw-r--r--db/migrate/20191213143656_create_ci_pipelines_config.rb14
-rw-r--r--db/migrate/20191213184609_backfill_operations_feature_flags_active.rb20
-rw-r--r--db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb20
-rw-r--r--db/migrate/20191216074800_add_epic_date_sourcing_milestone_indexes.rb29
-rw-r--r--db/migrate/20191216074802_add_epic_start_date_sourcing_milestone_id_foreign_key.rb23
-rw-r--r--db/migrate/20191216074803_add_epic_due_date_sourcing_milestone_id_foreign_key.rb23
-rw-r--r--db/migrate/20191216094119_add_id_to_plan_limits.rb13
-rw-r--r--db/migrate/20191216183531_add_project_hooks_to_plan_limits.rb9
-rw-r--r--db/migrate/20191216183532_insert_project_hooks_plan_limits.rb25
-rw-r--r--db/migrate/20191217165641_add_saml_provider_prohibited_outer_forks.rb17
-rw-r--r--db/migrate/20191217212348_add_modsecurity_enabled_to_ingress_application.rb16
-rw-r--r--db/migrate/20191218084115_add_updating_name_disabled_for_users_to_application_settings.rb20
-rw-r--r--db/migrate/20191218122457_add_force_pages_access_control_to_application_settings.rb12
-rw-r--r--db/migrate/20191218124915_add_repository_storage_to_snippets.rb26
-rw-r--r--db/migrate/20191218125015_add_storage_version_to_snippets.rb23
-rw-r--r--db/migrate/20191218190253_add_tab_width_to_user_preferences.rb9
-rw-r--r--db/migrate/20191223124940_add_scheduling_type_to_ci_builds.rb11
-rw-r--r--db/migrate/20191225071320_add_index_to_elasticsearch_indexed_namespaces.rb17
-rw-r--r--db/migrate/20191227140254_update_personal_access_tokens_user_id_foreign_key.rb20
-rw-r--r--db/migrate/20191229140154_drop_index_ci_pipelines_on_project_id.rb20
-rw-r--r--db/migrate/20210629031900_associate_existing_dast_builds_with_variables.rb1
-rw-r--r--db/migrate/20210819185500_create_external_audit_event_destinations_table.rb15
-rw-r--r--db/migrate/20210908195506_add_data_to_vulnerability_finding_evidence.rb7
-rw-r--r--db/migrate/20210910014741_add_dependency_proxy_ttl_group_policy_worker_capacity_to_application_settings.rb11
-rw-r--r--db/migrate/20210910015047_add_app_settings_dep_proxy_ttl_worker_capacity_check_constraint.rb15
-rw-r--r--db/migrate/20210910192921_add_report_type_into_approval_project_rules.rb11
-rw-r--r--db/migrate/20210912034903_add_runner_features_to_ci_builds_metadata.rb9
-rw-r--r--db/migrate/20210913224558_update_dependency_proxy_manifests_uniqueness_constraint.rb18
-rw-r--r--db/migrate/20210914145810_add_throttle_deprecated_api_columns.rb13
-rw-r--r--db/migrate/20210914172202_add_status_index_to_dependency_proxy_tables.rb18
-rw-r--r--db/migrate/20210915000453_add_index_on_clusters_integration_prometheus_enabled.rb15
-rw-r--r--db/migrate/20210915001242_add_index_on_clusters_integration_elastic_stack_enabled.rb15
-rw-r--r--db/migrate/20210915070423_add_avatar_and_description_to_topic.rb15
-rw-r--r--db/migrate/20210916132547_add_process_mode_to_resource_groups.rb15
-rw-r--r--db/migrate/20210917134321_remove_temporary_index_for_project_topics_on_taggings.rb20
-rw-r--r--db/migrate/20210917153645_remove_pipeline_fk_from_packages_build_infos.rb15
-rw-r--r--db/migrate/20210917153905_remove_pipeline_fk_from_packages_package_file_build_infos.rb15
-rw-r--r--db/migrate/20210917224419_add_registration_objective_to_user_detail.rb7
-rw-r--r--db/migrate/20210920104446_add_text_limit_to_topics_description_and_avatar.rb15
-rw-r--r--db/migrate/20210921032008_add_suggest_pipeline_enabled_to_application_settings.rb7
-rw-r--r--db/migrate/20210921063924_index_labels_using_varchar_pattern_ops.rb39
-rw-r--r--db/migrate/20210921191010_add_report_type_index_into_approval_project_rules.rb15
-rw-r--r--db/migrate/20210922172056_add_unique_namespaces_index_on_name_parent_id_and_type.rb15
-rw-r--r--db/migrate/20210922172156_drop_unique_namespaces_index_on_name_and_parent_id.rb15
-rw-r--r--db/migrate/20210922215740_create_issue_customer_relations_contacts.rb14
-rw-r--r--db/migrate/20210922220104_add_issue_customer_relations_contacts_foreign_keys.rb20
-rw-r--r--db/migrate/20210923042323_add_meta_data_to_user_credit_card_validations.rb13
-rw-r--r--db/migrate/20210923042324_limit_holder_name_on_user_credit_card_validations.rb23
-rw-r--r--db/migrate/20210923042325_index_meta_data_on_user_credit_card_validations.rb19
-rw-r--r--db/migrate/20210923151641_change_default_for_integrated_error_tracking.rb11
-rw-r--r--db/migrate/20210928155022_improve_index_for_error_tracking.rb33
-rw-r--r--db/migrate/20210928171122_add_group_id_status_id_index_to_dependency_proxy_tables.rb18
-rw-r--r--db/migrate/20210929025600_add_phone_to_user_details.rb15
-rw-r--r--db/migrate/20210929030834_add_text_limit_to_user_details_phone.rb13
-rw-r--r--db/migrate/20210929031049_add_unique_index_phone_on_user_details.rb15
-rw-r--r--db/migrate/20210929032555_create_verification_codes.rb36
-rw-r--r--db/migrate/20210929115340_add_security_policy_configurations_management_project_id_foreign_key.rb18
-rw-r--r--db/migrate/20210929121516_add_releases_author_id_id_created_at_index.rb14
-rw-r--r--db/migrate/20210930081208_fix_deprecated_api_throttle_defaults.rb8
-rw-r--r--db/migrate/20211001001222_add_source_version_to_bulk_imports.rb7
-rw-r--r--db/migrate/20211004062942_create_coverage_fuzzing_corpuses.rb18
-rw-r--r--db/migrate/20211004075629_add_topics_name_gin_index.rb15
-rw-r--r--db/migrate/20211004081911_add_external_event_destination_limit_to_plan_limits.rb7
-rw-r--r--db/migrate/20211005063519_add_foreign_key_to_corpuses_on_project.rb15
-rw-r--r--db/migrate/20211005063616_add_foreign_key_to_corpuses_on_user.rb15
-rw-r--r--db/migrate/20211005063723_add_foreign_key_to_corpuses_on_package.rb15
-rw-r--r--db/migrate/20211005092428_drop_time_range_partitioned_loose_fk.rb27
-rw-r--r--db/migrate/20211005093558_add_range_partitioned_loose_fk_table.rb29
-rw-r--r--db/migrate/20211005100112_recreate_loose_fk_insert_function.rb40
-rw-r--r--db/migrate/20211006060254_add_topics_total_projects_count_cache.rb11
-rw-r--r--db/migrate/20211006103122_change_helm_channel_length.rb14
-rw-r--r--db/migrate/20211006122010_add_topics_total_projects_count_index.rb15
-rw-r--r--db/migrate/20211007113136_add_status_column_to_security_scans_table.rb7
-rw-r--r--db/migrate/20211008181451_add_shared_runners_duration_to_ci_namespace_monthly_usages.rb9
-rw-r--r--db/migrate/20211008182954_add_shared_runners_duration_to_ci_project_monthly_usages.rb9
-rw-r--r--db/migrate/20211012091822_add_text_limit_to_bulk_imports_source_version.rb13
468 files changed, 878 insertions, 12623 deletions
diff --git a/db/migrate/20181228175414_init_schema.rb b/db/migrate/20181228175414_init_schema.rb
index d4212f405d9..df68927d79a 100644
--- a/db/migrate/20181228175414_init_schema.rb
+++ b/db/migrate/20181228175414_init_schema.rb
@@ -1,2562 +1,13 @@
# frozen_string_literal: true
-# rubocop:disable Metrics/AbcSize
-# rubocop:disable Migration/AddConcurrentForeignKey
-# rubocop:disable Style/WordArray
-# rubocop:disable Migration/PreventStrings
-# rubocop:disable Migration/AddLimitToTextColumns
-# rubocop:disable Migration/Datetime
-
class InitSchema < ActiveRecord::Migration[6.0]
DOWNTIME = false
def up
- # These are extensions that must be enabled in order to support this database
- enable_extension "pg_trgm"
- enable_extension "plpgsql"
-
- create_table "abuse_reports", id: :serial, force: :cascade do |t|
- t.integer "reporter_id"
- t.integer "user_id"
- t.text "message"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.text "message_html"
- t.integer "cached_markdown_version"
- end
-
- create_table "appearances", id: :serial, force: :cascade do |t|
- t.string "title", null: false
- t.text "description", null: false
- t.string "header_logo"
- t.string "logo"
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.text "description_html"
- t.integer "cached_markdown_version"
- t.string "favicon"
- t.text "new_project_guidelines"
- t.text "new_project_guidelines_html"
- t.text "header_message"
- t.text "header_message_html"
- t.text "footer_message"
- t.text "footer_message_html"
- t.text "message_background_color"
- t.text "message_font_color"
- end
-
- create_table "application_setting_terms", id: :serial, force: :cascade do |t|
- t.integer "cached_markdown_version"
- t.text "terms", null: false
- t.text "terms_html"
- end
-
- create_table "application_settings", id: :serial, force: :cascade do |t|
- t.integer "default_projects_limit"
- t.boolean "signup_enabled"
- t.boolean "gravatar_enabled"
- t.text "sign_in_text"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "home_page_url"
- t.integer "default_branch_protection", default: 2
- t.text "restricted_visibility_levels"
- t.boolean "version_check_enabled", default: true
- t.integer "max_attachment_size", default: 10, null: false
- t.integer "default_project_visibility"
- t.integer "default_snippet_visibility"
- t.text "domain_whitelist"
- t.boolean "user_oauth_applications", default: true
- t.string "after_sign_out_path"
- t.integer "session_expire_delay", default: 10080, null: false
- t.text "import_sources"
- t.text "help_page_text"
- t.string "admin_notification_email"
- t.boolean "shared_runners_enabled", default: true, null: false
- t.integer "max_artifacts_size", default: 100, null: false
- t.string "runners_registration_token"
- t.integer "max_pages_size", default: 100, null: false
- t.boolean "require_two_factor_authentication", default: false
- t.integer "two_factor_grace_period", default: 48
- t.boolean "metrics_enabled", default: false
- t.string "metrics_host", default: "localhost"
- t.integer "metrics_pool_size", default: 16
- t.integer "metrics_timeout", default: 10
- t.integer "metrics_method_call_threshold", default: 10
- t.boolean "recaptcha_enabled", default: false
- t.string "recaptcha_site_key"
- t.string "recaptcha_private_key"
- t.integer "metrics_port", default: 8089
- t.boolean "akismet_enabled", default: false
- t.string "akismet_api_key"
- t.integer "metrics_sample_interval", default: 15
- t.boolean "sentry_enabled", default: false
- t.string "sentry_dsn"
- t.boolean "email_author_in_body", default: false
- t.integer "default_group_visibility"
- t.boolean "repository_checks_enabled", default: false
- t.text "shared_runners_text"
- t.integer "metrics_packet_size", default: 1
- t.text "disabled_oauth_sign_in_sources"
- t.string "health_check_access_token"
- t.boolean "send_user_confirmation_email", default: false
- t.integer "container_registry_token_expire_delay", default: 5
- t.text "after_sign_up_text"
- t.boolean "user_default_external", default: false, null: false
- t.string "repository_storages", default: "default"
- t.string "enabled_git_access_protocol"
- t.boolean "domain_blacklist_enabled", default: false
- t.text "domain_blacklist"
- t.boolean "usage_ping_enabled", default: true, null: false
- t.text "sign_in_text_html"
- t.text "help_page_text_html"
- t.text "shared_runners_text_html"
- t.text "after_sign_up_text_html"
- t.integer "rsa_key_restriction", default: 0, null: false
- t.integer "dsa_key_restriction", default: -1, null: false
- t.integer "ecdsa_key_restriction", default: 0, null: false
- t.integer "ed25519_key_restriction", default: 0, null: false
- t.boolean "housekeeping_enabled", default: true, null: false
- t.boolean "housekeeping_bitmaps_enabled", default: true, null: false
- t.integer "housekeeping_incremental_repack_period", default: 10, null: false
- t.integer "housekeeping_full_repack_period", default: 50, null: false
- t.integer "housekeeping_gc_period", default: 200, null: false
- t.boolean "html_emails_enabled", default: true
- t.string "plantuml_url"
- t.boolean "plantuml_enabled"
- t.integer "terminal_max_session_time", default: 0, null: false
- t.integer "unique_ips_limit_per_user"
- t.integer "unique_ips_limit_time_window"
- t.boolean "unique_ips_limit_enabled", default: false, null: false
- t.string "default_artifacts_expire_in", default: "0", null: false
- t.string "uuid"
- t.decimal "polling_interval_multiplier", default: "1.0", null: false
- t.integer "cached_markdown_version"
- t.boolean "clientside_sentry_enabled", default: false, null: false
- t.string "clientside_sentry_dsn"
- t.boolean "prometheus_metrics_enabled", default: true, null: false
- t.boolean "authorized_keys_enabled", default: true, null: false
- t.boolean "help_page_hide_commercial_content", default: false
- t.string "help_page_support_url"
- t.integer "performance_bar_allowed_group_id"
- t.boolean "hashed_storage_enabled", default: false, null: false
- t.boolean "project_export_enabled", default: true, null: false
- t.boolean "auto_devops_enabled", default: true, null: false
- t.boolean "throttle_unauthenticated_enabled", default: false, null: false
- t.integer "throttle_unauthenticated_requests_per_period", default: 3600, null: false
- t.integer "throttle_unauthenticated_period_in_seconds", default: 3600, null: false
- t.boolean "throttle_authenticated_api_enabled", default: false, null: false
- t.integer "throttle_authenticated_api_requests_per_period", default: 7200, null: false
- t.integer "throttle_authenticated_api_period_in_seconds", default: 3600, null: false
- t.boolean "throttle_authenticated_web_enabled", default: false, null: false
- t.integer "throttle_authenticated_web_requests_per_period", default: 7200, null: false
- t.integer "throttle_authenticated_web_period_in_seconds", default: 3600, null: false
- t.integer "gitaly_timeout_default", default: 55, null: false
- t.integer "gitaly_timeout_medium", default: 30, null: false
- t.integer "gitaly_timeout_fast", default: 10, null: false
- t.boolean "password_authentication_enabled_for_web"
- t.boolean "password_authentication_enabled_for_git", default: true, null: false
- t.boolean "external_authorization_service_enabled", default: false, null: false
- t.string "external_authorization_service_url"
- t.string "external_authorization_service_default_label"
- t.integer "default_project_creation", default: 2, null: false
- t.string "auto_devops_domain"
- t.boolean "pages_domain_verification_enabled", default: true, null: false
- t.boolean "allow_local_requests_from_hooks_and_services", default: false, null: false
- t.string "user_default_internal_regex"
- t.float "external_authorization_service_timeout", default: 0.5
- t.text "external_auth_client_cert"
- t.text "encrypted_external_auth_client_key"
- t.string "encrypted_external_auth_client_key_iv"
- t.string "encrypted_external_auth_client_key_pass"
- t.string "encrypted_external_auth_client_key_pass_iv"
- t.boolean "enforce_terms", default: false
- t.boolean "mirror_available", default: true, null: false
- t.boolean "hide_third_party_offers", default: false, null: false
- t.boolean "instance_statistics_visibility_private", default: false, null: false
- t.integer "receive_max_input_size"
- t.boolean "web_ide_clientside_preview_enabled", default: false, null: false
- t.boolean "user_show_add_ssh_key_message", default: true, null: false
- t.string "outbound_local_requests_whitelist", limit: 255, array: true
- t.integer "usage_stats_set_by_user_id"
- t.integer "diff_max_patch_bytes", default: 102400, null: false
- t.integer "archive_builds_in_seconds"
- t.string "commit_email_hostname"
- t.integer "first_day_of_week", default: 0, null: false
- t.boolean "protected_ci_variables", default: false, null: false
- t.string "runners_registration_token_encrypted"
- t.index ["usage_stats_set_by_user_id"], name: "index_application_settings_on_usage_stats_set_by_user_id"
- end
-
- create_table "audit_events", id: :serial, force: :cascade do |t|
- t.integer "author_id", null: false
- t.string "type", null: false
- t.integer "entity_id", null: false
- t.string "entity_type", null: false
- t.text "details"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index ["entity_id", "entity_type"], name: "index_audit_events_on_entity_id_and_entity_type"
- end
-
- create_table "award_emoji", id: :serial, force: :cascade do |t|
- t.string "name"
- t.integer "user_id"
- t.string "awardable_type"
- t.integer "awardable_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index ["awardable_type", "awardable_id"], name: "index_award_emoji_on_awardable_type_and_awardable_id"
- t.index ["user_id", "name"], name: "index_award_emoji_on_user_id_and_name"
- end
-
- create_table "badges", id: :serial, force: :cascade do |t|
- t.string "link_url", null: false
- t.string "image_url", null: false
- t.integer "project_id"
- t.integer "group_id"
- t.string "type", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.index ["group_id"], name: "index_badges_on_group_id"
- t.index ["project_id"], name: "index_badges_on_project_id"
- end
-
- create_table "board_group_recent_visits", force: :cascade do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "user_id"
- t.integer "board_id"
- t.integer "group_id"
- t.index ["board_id"], name: "index_board_group_recent_visits_on_board_id"
- t.index ["group_id"], name: "index_board_group_recent_visits_on_group_id"
- t.index ["user_id", "group_id", "board_id"], name: "index_board_group_recent_visits_on_user_group_and_board", unique: true
- t.index ["user_id"], name: "index_board_group_recent_visits_on_user_id"
- end
-
- create_table "board_project_recent_visits", force: :cascade do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "user_id"
- t.integer "project_id"
- t.integer "board_id"
- t.index ["board_id"], name: "index_board_project_recent_visits_on_board_id"
- t.index ["project_id"], name: "index_board_project_recent_visits_on_project_id"
- t.index ["user_id", "project_id", "board_id"], name: "index_board_project_recent_visits_on_user_project_and_board", unique: true
- t.index ["user_id"], name: "index_board_project_recent_visits_on_user_id"
- end
-
- create_table "boards", id: :serial, force: :cascade do |t|
- t.integer "project_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "group_id"
- t.index ["group_id"], name: "index_boards_on_group_id"
- t.index ["project_id"], name: "index_boards_on_project_id"
- end
-
- create_table "broadcast_messages", id: :serial, force: :cascade do |t|
- t.text "message", null: false
- t.datetime "starts_at", null: false
- t.datetime "ends_at", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.string "color"
- t.string "font"
- t.text "message_html", null: false
- t.integer "cached_markdown_version"
- t.index ["starts_at", "ends_at", "id"], name: "index_broadcast_messages_on_starts_at_and_ends_at_and_id"
- end
-
- create_table "chat_names", id: :serial, force: :cascade do |t|
- t.integer "user_id", null: false
- t.integer "service_id", null: false
- t.string "team_id", null: false
- t.string "team_domain"
- t.string "chat_id", null: false
- t.string "chat_name"
- t.datetime "last_used_at"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["service_id", "team_id", "chat_id"], name: "index_chat_names_on_service_id_and_team_id_and_chat_id", unique: true
- t.index ["user_id", "service_id"], name: "index_chat_names_on_user_id_and_service_id", unique: true
- end
-
- create_table "chat_teams", id: :serial, force: :cascade do |t|
- t.integer "namespace_id", null: false
- t.string "team_id"
- t.string "name"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["namespace_id"], name: "index_chat_teams_on_namespace_id", unique: true
- end
-
- create_table "ci_build_trace_chunks", force: :cascade do |t|
- t.integer "build_id", null: false
- t.integer "chunk_index", null: false
- t.integer "data_store", null: false
- t.binary "raw_data"
- t.index ["build_id", "chunk_index"], name: "index_ci_build_trace_chunks_on_build_id_and_chunk_index", unique: true
- end
-
- create_table "ci_build_trace_section_names", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.string "name", null: false
- t.index ["project_id", "name"], name: "index_ci_build_trace_section_names_on_project_id_and_name", unique: true
- end
-
- create_table "ci_build_trace_sections", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.datetime_with_timezone "date_start", null: false
- t.datetime_with_timezone "date_end", null: false
- t.bigint "byte_start", null: false
- t.bigint "byte_end", null: false
- t.integer "build_id", null: false
- t.integer "section_name_id", null: false
- t.index ["build_id", "section_name_id"], name: "index_ci_build_trace_sections_on_build_id_and_section_name_id", unique: true
- t.index ["project_id"], name: "index_ci_build_trace_sections_on_project_id"
- t.index ["section_name_id"], name: "index_ci_build_trace_sections_on_section_name_id"
- end
-
- create_table "ci_builds", id: :serial, force: :cascade do |t|
- t.string "status"
- t.datetime "finished_at"
- t.text "trace"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.datetime "started_at"
- t.integer "runner_id"
- t.float "coverage"
- t.integer "commit_id"
- t.text "commands"
- t.string "name"
- t.text "options"
- t.boolean "allow_failure", default: false, null: false
- t.string "stage"
- t.integer "trigger_request_id"
- t.integer "stage_idx"
- t.boolean "tag"
- t.string "ref"
- t.integer "user_id"
- t.string "type"
- t.string "target_url"
- t.string "description"
- t.text "artifacts_file"
- t.integer "project_id"
- t.text "artifacts_metadata"
- t.integer "erased_by_id"
- t.datetime "erased_at"
- t.datetime "artifacts_expire_at"
- t.string "environment"
- t.bigint "artifacts_size"
- t.string "when"
- t.text "yaml_variables"
- t.datetime "queued_at"
- t.string "token"
- t.integer "lock_version"
- t.string "coverage_regex"
- t.integer "auto_canceled_by_id"
- t.boolean "retried"
- t.integer "stage_id"
- t.integer "artifacts_file_store"
- t.integer "artifacts_metadata_store"
- t.boolean "protected"
- t.integer "failure_reason"
- t.datetime_with_timezone "scheduled_at"
- t.string "token_encrypted"
- t.index ["artifacts_expire_at"], name: "index_ci_builds_on_artifacts_expire_at", where: "(artifacts_file <> ''::text)"
- t.index ["auto_canceled_by_id"], name: "index_ci_builds_on_auto_canceled_by_id"
- t.index ["commit_id", "artifacts_expire_at", "id"], name: "index_ci_builds_on_commit_id_and_artifacts_expireatandidpartial", where: "(((type)::text = 'Ci::Build'::text) AND ((retried = false) OR (retried IS NULL)) AND ((name)::text = ANY (ARRAY[('sast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('sast:container'::character varying)::text, ('container_scanning'::character varying)::text, ('dast'::character varying)::text])))"
- t.index ["commit_id", "stage_idx", "created_at"], name: "index_ci_builds_on_commit_id_and_stage_idx_and_created_at"
- t.index ["commit_id", "status", "type"], name: "index_ci_builds_on_commit_id_and_status_and_type"
- t.index ["commit_id", "type", "name", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_name_and_ref"
- t.index ["commit_id", "type", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_ref"
- t.index ["id"], name: "partial_index_ci_builds_on_id_with_legacy_artifacts", where: "(artifacts_file <> ''::text)"
- t.index ["project_id", "id"], name: "index_ci_builds_on_project_id_and_id"
- t.index ["project_id", "status"], name: "index_ci_builds_project_id_and_status_for_live_jobs_partial2", where: "(((type)::text = 'Ci::Build'::text) AND ((status)::text = ANY (ARRAY[('running'::character varying)::text, ('pending'::character varying)::text, ('created'::character varying)::text])))"
- t.index ["protected"], name: "index_ci_builds_on_protected"
- t.index ["runner_id"], name: "index_ci_builds_on_runner_id"
- t.index ["scheduled_at"], name: "partial_index_ci_builds_on_scheduled_at_with_scheduled_jobs", where: "((scheduled_at IS NOT NULL) AND ((type)::text = 'Ci::Build'::text) AND ((status)::text = 'scheduled'::text))"
- t.index ["stage_id", "stage_idx"], name: "tmp_build_stage_position_index", where: "(stage_idx IS NOT NULL)"
- t.index ["stage_id"], name: "index_ci_builds_on_stage_id"
- t.index ["status", "type", "runner_id"], name: "index_ci_builds_on_status_and_type_and_runner_id"
- t.index ["token"], name: "index_ci_builds_on_token", unique: true
- t.index ["token_encrypted"], name: "index_ci_builds_on_token_encrypted", unique: true, where: "(token_encrypted IS NOT NULL)"
- t.index ["updated_at"], name: "index_ci_builds_on_updated_at"
- t.index ["user_id"], name: "index_ci_builds_on_user_id"
- end
-
- create_table "ci_builds_metadata", id: :serial, force: :cascade do |t|
- t.integer "build_id", null: false
- t.integer "project_id", null: false
- t.integer "timeout"
- t.integer "timeout_source", default: 1, null: false
- t.jsonb "config_options"
- t.jsonb "config_variables"
- t.index ["build_id"], name: "index_ci_builds_metadata_on_build_id", unique: true
- t.index ["project_id"], name: "index_ci_builds_metadata_on_project_id"
- end
-
- create_table "ci_builds_runner_session", force: :cascade do |t|
- t.integer "build_id", null: false
- t.string "url", null: false
- t.string "certificate"
- t.string "authorization"
- t.index ["build_id"], name: "index_ci_builds_runner_session_on_build_id", unique: true
- end
-
- create_table "ci_group_variables", id: :serial, force: :cascade do |t|
- t.string "key", null: false
- t.text "value"
- t.text "encrypted_value"
- t.string "encrypted_value_salt"
- t.string "encrypted_value_iv"
- t.integer "group_id", null: false
- t.boolean "protected", default: false, null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.index ["group_id", "key"], name: "index_ci_group_variables_on_group_id_and_key", unique: true
- end
-
- create_table "ci_job_artifacts", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "job_id", null: false
- t.integer "file_type", null: false
- t.bigint "size"
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.datetime_with_timezone "expire_at"
- t.string "file"
- t.integer "file_store"
- t.binary "file_sha256"
- t.integer "file_format", limit: 2
- t.integer "file_location", limit: 2
- t.index ["expire_at", "job_id"], name: "index_ci_job_artifacts_on_expire_at_and_job_id"
- t.index ["file_store"], name: "index_ci_job_artifacts_on_file_store"
- t.index ["job_id", "file_type"], name: "index_ci_job_artifacts_on_job_id_and_file_type", unique: true
- t.index ["project_id"], name: "index_ci_job_artifacts_on_project_id"
- end
-
- create_table "ci_pipeline_chat_data", force: :cascade do |t|
- t.integer "pipeline_id", null: false
- t.integer "chat_name_id", null: false
- t.text "response_url", null: false
- t.index ["chat_name_id"], name: "index_ci_pipeline_chat_data_on_chat_name_id"
- t.index ["pipeline_id"], name: "index_ci_pipeline_chat_data_on_pipeline_id", unique: true
- end
-
- create_table "ci_pipeline_schedule_variables", id: :serial, force: :cascade do |t|
- t.string "key", null: false
- t.text "value"
- t.text "encrypted_value"
- t.string "encrypted_value_salt"
- t.string "encrypted_value_iv"
- t.integer "pipeline_schedule_id", null: false
- t.datetime_with_timezone "created_at"
- t.datetime_with_timezone "updated_at"
- t.index ["pipeline_schedule_id", "key"], name: "index_ci_pipeline_schedule_variables_on_schedule_id_and_key", unique: true
- end
-
- create_table "ci_pipeline_schedules", id: :serial, force: :cascade do |t|
- t.string "description"
- t.string "ref"
- t.string "cron"
- t.string "cron_timezone"
- t.datetime "next_run_at"
- t.integer "project_id"
- t.integer "owner_id"
- t.boolean "active", default: true
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index ["next_run_at", "active"], name: "index_ci_pipeline_schedules_on_next_run_at_and_active"
- t.index ["owner_id"], name: "index_ci_pipeline_schedules_on_owner_id"
- t.index ["project_id"], name: "index_ci_pipeline_schedules_on_project_id"
- end
-
- create_table "ci_pipeline_variables", id: :serial, force: :cascade do |t|
- t.string "key", null: false
- t.text "value"
- t.text "encrypted_value"
- t.string "encrypted_value_salt"
- t.string "encrypted_value_iv"
- t.integer "pipeline_id", null: false
- t.index ["pipeline_id", "key"], name: "index_ci_pipeline_variables_on_pipeline_id_and_key", unique: true
- end
-
- create_table "ci_pipelines", id: :serial, force: :cascade do |t|
- t.string "ref"
- t.string "sha"
- t.string "before_sha"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.boolean "tag", default: false
- t.text "yaml_errors"
- t.datetime "committed_at"
- t.integer "project_id"
- t.string "status"
- t.datetime "started_at"
- t.datetime "finished_at"
- t.integer "duration"
- t.integer "user_id"
- t.integer "lock_version"
- t.integer "auto_canceled_by_id"
- t.integer "pipeline_schedule_id"
- t.integer "source"
- t.boolean "protected"
- t.integer "config_source"
- t.integer "failure_reason"
- t.integer "iid"
- t.integer "merge_request_id"
- t.index ["auto_canceled_by_id"], name: "index_ci_pipelines_on_auto_canceled_by_id"
- t.index ["merge_request_id"], name: "index_ci_pipelines_on_merge_request_id", where: "(merge_request_id IS NOT NULL)"
- t.index ["pipeline_schedule_id"], name: "index_ci_pipelines_on_pipeline_schedule_id"
- t.index ["project_id", "iid"], name: "index_ci_pipelines_on_project_id_and_iid", unique: true, where: "(iid IS NOT NULL)"
- t.index ["project_id", "ref", "id"], name: "index_ci_pipelines_on_project_idandrefandiddesc", order: { id: :desc }
- t.index ["project_id", "ref", "status", "id"], name: "index_ci_pipelines_on_project_id_and_ref_and_status_and_id"
- t.index ["project_id", "sha"], name: "index_ci_pipelines_on_project_id_and_sha"
- t.index ["project_id", "source"], name: "index_ci_pipelines_on_project_id_and_source"
- t.index ["project_id", "status", "config_source"], name: "index_ci_pipelines_on_project_id_and_status_and_config_source"
- t.index ["project_id"], name: "index_ci_pipelines_on_project_id"
- t.index ["status"], name: "index_ci_pipelines_on_status"
- t.index ["user_id"], name: "index_ci_pipelines_on_user_id"
- end
-
- create_table "ci_runner_namespaces", id: :serial, force: :cascade do |t|
- t.integer "runner_id"
- t.integer "namespace_id"
- t.index ["namespace_id"], name: "index_ci_runner_namespaces_on_namespace_id"
- t.index ["runner_id", "namespace_id"], name: "index_ci_runner_namespaces_on_runner_id_and_namespace_id", unique: true
- end
-
- create_table "ci_runner_projects", id: :serial, force: :cascade do |t|
- t.integer "runner_id", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "project_id"
- t.index ["project_id"], name: "index_ci_runner_projects_on_project_id"
- t.index ["runner_id"], name: "index_ci_runner_projects_on_runner_id"
- end
-
- create_table "ci_runners", id: :serial, force: :cascade do |t|
- t.string "token"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "description"
- t.datetime "contacted_at"
- t.boolean "active", default: true, null: false
- t.boolean "is_shared", default: false
- t.string "name"
- t.string "version"
- t.string "revision"
- t.string "platform"
- t.string "architecture"
- t.boolean "run_untagged", default: true, null: false
- t.boolean "locked", default: false, null: false
- t.integer "access_level", default: 0, null: false
- t.integer "maximum_timeout"
- t.string "ip_address"
- t.integer "runner_type", limit: 2, null: false
- t.string "token_encrypted"
- t.index ["contacted_at"], name: "index_ci_runners_on_contacted_at"
- t.index ["is_shared"], name: "index_ci_runners_on_is_shared"
- t.index ["locked"], name: "index_ci_runners_on_locked"
- t.index ["runner_type"], name: "index_ci_runners_on_runner_type"
- t.index ["token"], name: "index_ci_runners_on_token"
- end
-
- create_table "ci_stages", id: :serial, force: :cascade do |t|
- t.integer "project_id"
- t.integer "pipeline_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "name"
- t.integer "status"
- t.integer "lock_version"
- t.integer "position"
- t.index ["pipeline_id", "name"], name: "index_ci_stages_on_pipeline_id_and_name", unique: true
- t.index ["pipeline_id", "position"], name: "index_ci_stages_on_pipeline_id_and_position"
- t.index ["pipeline_id"], name: "index_ci_stages_on_pipeline_id"
- t.index ["project_id"], name: "index_ci_stages_on_project_id"
- end
-
- create_table "ci_trigger_requests", id: :serial, force: :cascade do |t|
- t.integer "trigger_id", null: false
- t.text "variables"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "commit_id"
- t.index ["commit_id"], name: "index_ci_trigger_requests_on_commit_id"
- t.index ["trigger_id"], name: "index_ci_trigger_requests_on_trigger_id"
- end
-
- create_table "ci_triggers", id: :serial, force: :cascade do |t|
- t.string "token"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "project_id"
- t.integer "owner_id"
- t.string "description"
- t.string "ref"
- t.index ["owner_id"], name: "index_ci_triggers_on_owner_id"
- t.index ["project_id"], name: "index_ci_triggers_on_project_id"
- end
-
- create_table "ci_variables", id: :serial, force: :cascade do |t|
- t.string "key", null: false
- t.text "value"
- t.text "encrypted_value"
- t.string "encrypted_value_salt"
- t.string "encrypted_value_iv"
- t.integer "project_id", null: false
- t.boolean "protected", default: false, null: false
- t.string "environment_scope", default: "*", null: false
- t.index ["project_id", "key", "environment_scope"], name: "index_ci_variables_on_project_id_and_key_and_environment_scope", unique: true
- end
-
- create_table "cluster_groups", id: :serial, force: :cascade do |t|
- t.integer "cluster_id", null: false
- t.integer "group_id", null: false
- t.index ["cluster_id", "group_id"], name: "index_cluster_groups_on_cluster_id_and_group_id", unique: true
- t.index ["group_id"], name: "index_cluster_groups_on_group_id"
- end
-
- create_table "cluster_platforms_kubernetes", id: :serial, force: :cascade do |t|
- t.integer "cluster_id", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.text "api_url"
- t.text "ca_cert"
- t.string "namespace"
- t.string "username"
- t.text "encrypted_password"
- t.string "encrypted_password_iv"
- t.text "encrypted_token"
- t.string "encrypted_token_iv"
- t.integer "authorization_type", limit: 2
- t.index ["cluster_id"], name: "index_cluster_platforms_kubernetes_on_cluster_id", unique: true
- end
-
- create_table "cluster_projects", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "cluster_id", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.index ["cluster_id"], name: "index_cluster_projects_on_cluster_id"
- t.index ["project_id"], name: "index_cluster_projects_on_project_id"
- end
-
- create_table "cluster_providers_gcp", id: :serial, force: :cascade do |t|
- t.integer "cluster_id", null: false
- t.integer "status"
- t.integer "num_nodes", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.text "status_reason"
- t.string "gcp_project_id", null: false
- t.string "zone", null: false
- t.string "machine_type"
- t.string "operation_id"
- t.string "endpoint"
- t.text "encrypted_access_token"
- t.string "encrypted_access_token_iv"
- t.boolean "legacy_abac", default: true, null: false
- t.index ["cluster_id"], name: "index_cluster_providers_gcp_on_cluster_id", unique: true
- end
-
- create_table "clusters", id: :serial, force: :cascade do |t|
- t.integer "user_id"
- t.integer "provider_type"
- t.integer "platform_type"
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.boolean "enabled", default: true
- t.string "name", null: false
- t.string "environment_scope", default: "*", null: false
- t.integer "cluster_type", limit: 2, default: 3, null: false
- t.index ["enabled"], name: "index_clusters_on_enabled"
- t.index ["user_id"], name: "index_clusters_on_user_id"
- end
-
- create_table "clusters_applications_cert_managers", id: :serial, force: :cascade do |t|
- t.integer "cluster_id", null: false
- t.integer "status", null: false
- t.string "version", null: false
- t.string "email", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.text "status_reason"
- t.index ["cluster_id"], name: "index_clusters_applications_cert_managers_on_cluster_id", unique: true
- end
-
- create_table "clusters_applications_helm", id: :serial, force: :cascade do |t|
- t.integer "cluster_id", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "status", null: false
- t.string "version", null: false
- t.text "status_reason"
- t.text "encrypted_ca_key"
- t.text "encrypted_ca_key_iv"
- t.text "ca_cert"
- t.index ["cluster_id"], name: "index_clusters_applications_helm_on_cluster_id", unique: true
- end
-
- create_table "clusters_applications_ingress", id: :serial, force: :cascade do |t|
- t.integer "cluster_id", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "status", null: false
- t.integer "ingress_type", null: false
- t.string "version", null: false
- t.string "cluster_ip"
- t.text "status_reason"
- t.string "external_ip"
- t.index ["cluster_id"], name: "index_clusters_applications_ingress_on_cluster_id", unique: true
- end
-
- create_table "clusters_applications_jupyter", id: :serial, force: :cascade do |t|
- t.integer "cluster_id", null: false
- t.integer "oauth_application_id"
- t.integer "status", null: false
- t.string "version", null: false
- t.string "hostname"
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.text "status_reason"
- t.index ["cluster_id"], name: "index_clusters_applications_jupyter_on_cluster_id", unique: true
- t.index ["oauth_application_id"], name: "index_clusters_applications_jupyter_on_oauth_application_id"
- end
-
- create_table "clusters_applications_knative", id: :serial, force: :cascade do |t|
- t.integer "cluster_id", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "status", null: false
- t.string "version", null: false
- t.string "hostname"
- t.text "status_reason"
- t.string "external_ip"
- t.index ["cluster_id"], name: "index_clusters_applications_knative_on_cluster_id", unique: true
- end
-
- create_table "clusters_applications_prometheus", id: :serial, force: :cascade do |t|
- t.integer "cluster_id", null: false
- t.integer "status", null: false
- t.string "version", null: false
- t.text "status_reason"
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.index ["cluster_id"], name: "index_clusters_applications_prometheus_on_cluster_id", unique: true
- end
-
- create_table "clusters_applications_runners", id: :serial, force: :cascade do |t|
- t.integer "cluster_id", null: false
- t.integer "runner_id"
- t.integer "status", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.string "version", null: false
- t.text "status_reason"
- t.boolean "privileged", default: true, null: false
- t.index ["cluster_id"], name: "index_clusters_applications_runners_on_cluster_id", unique: true
- t.index ["runner_id"], name: "index_clusters_applications_runners_on_runner_id"
- end
-
- create_table "clusters_kubernetes_namespaces", force: :cascade do |t|
- t.integer "cluster_id", null: false
- t.integer "project_id"
- t.integer "cluster_project_id"
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.string "encrypted_service_account_token_iv"
- t.string "namespace", null: false
- t.string "service_account_name"
- t.text "encrypted_service_account_token"
- t.index ["cluster_id", "namespace"], name: "kubernetes_namespaces_cluster_and_namespace", unique: true
- t.index ["cluster_id"], name: "index_clusters_kubernetes_namespaces_on_cluster_id"
- t.index ["cluster_project_id"], name: "index_clusters_kubernetes_namespaces_on_cluster_project_id"
- t.index ["project_id"], name: "index_clusters_kubernetes_namespaces_on_project_id"
- end
-
- create_table "container_repositories", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.string "name", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["project_id", "name"], name: "index_container_repositories_on_project_id_and_name", unique: true
- t.index ["project_id"], name: "index_container_repositories_on_project_id"
- end
-
- create_table "conversational_development_index_metrics", id: :serial, force: :cascade do |t|
- t.float "leader_issues", null: false
- t.float "instance_issues", null: false
- t.float "leader_notes", null: false
- t.float "instance_notes", null: false
- t.float "leader_milestones", null: false
- t.float "instance_milestones", null: false
- t.float "leader_boards", null: false
- t.float "instance_boards", null: false
- t.float "leader_merge_requests", null: false
- t.float "instance_merge_requests", null: false
- t.float "leader_ci_pipelines", null: false
- t.float "instance_ci_pipelines", null: false
- t.float "leader_environments", null: false
- t.float "instance_environments", null: false
- t.float "leader_deployments", null: false
- t.float "instance_deployments", null: false
- t.float "leader_projects_prometheus_active", null: false
- t.float "instance_projects_prometheus_active", null: false
- t.float "leader_service_desk_issues", null: false
- t.float "instance_service_desk_issues", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.float "percentage_boards", default: 0.0, null: false
- t.float "percentage_ci_pipelines", default: 0.0, null: false
- t.float "percentage_deployments", default: 0.0, null: false
- t.float "percentage_environments", default: 0.0, null: false
- t.float "percentage_issues", default: 0.0, null: false
- t.float "percentage_merge_requests", default: 0.0, null: false
- t.float "percentage_milestones", default: 0.0, null: false
- t.float "percentage_notes", default: 0.0, null: false
- t.float "percentage_projects_prometheus_active", default: 0.0, null: false
- t.float "percentage_service_desk_issues", default: 0.0, null: false
- end
-
- create_table "deploy_keys_projects", id: :serial, force: :cascade do |t|
- t.integer "deploy_key_id", null: false
- t.integer "project_id", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.boolean "can_push", default: false, null: false
- t.index ["project_id"], name: "index_deploy_keys_projects_on_project_id"
- end
-
- create_table "deploy_tokens", id: :serial, force: :cascade do |t|
- t.boolean "revoked", default: false
- t.boolean "read_repository", default: false, null: false
- t.boolean "read_registry", default: false, null: false
- t.datetime_with_timezone "expires_at", null: false
- t.datetime_with_timezone "created_at", null: false
- t.string "name", null: false
- t.string "token", null: false
- t.index ["token", "expires_at", "id"], name: "index_deploy_tokens_on_token_and_expires_at_and_id", where: "(revoked IS FALSE)"
- t.index ["token"], name: "index_deploy_tokens_on_token", unique: true
- end
-
- create_table "deployments", id: :serial, force: :cascade do |t|
- t.integer "iid", null: false
- t.integer "project_id", null: false
- t.integer "environment_id", null: false
- t.string "ref", null: false
- t.boolean "tag", null: false
- t.string "sha", null: false
- t.integer "user_id"
- t.integer "deployable_id"
- t.string "deployable_type"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "on_stop"
- t.datetime_with_timezone "finished_at"
- t.integer "status", limit: 2, null: false
- t.index ["created_at"], name: "index_deployments_on_created_at"
- t.index ["deployable_type", "deployable_id"], name: "index_deployments_on_deployable_type_and_deployable_id"
- t.index ["environment_id", "id"], name: "index_deployments_on_environment_id_and_id"
- t.index ["environment_id", "iid", "project_id"], name: "index_deployments_on_environment_id_and_iid_and_project_id"
- t.index ["environment_id", "status"], name: "index_deployments_on_environment_id_and_status"
- t.index ["id"], name: "partial_index_deployments_for_legacy_successful_deployments", where: "((finished_at IS NULL) AND (status = 2))"
- t.index ["project_id", "iid"], name: "index_deployments_on_project_id_and_iid", unique: true
- t.index ["project_id", "status", "created_at"], name: "index_deployments_on_project_id_and_status_and_created_at"
- t.index ["project_id", "status"], name: "index_deployments_on_project_id_and_status"
- end
-
- create_table "emails", id: :serial, force: :cascade do |t|
- t.integer "user_id", null: false
- t.string "email", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "confirmation_token"
- t.datetime_with_timezone "confirmed_at"
- t.datetime_with_timezone "confirmation_sent_at"
- t.index ["confirmation_token"], name: "index_emails_on_confirmation_token", unique: true
- t.index ["email"], name: "index_emails_on_email", unique: true
- t.index ["user_id"], name: "index_emails_on_user_id"
- end
-
- create_table "environments", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.string "name", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "external_url"
- t.string "environment_type"
- t.string "state", default: "available", null: false
- t.string "slug", null: false
- t.index ["project_id", "name"], name: "index_environments_on_project_id_and_name", unique: true
- t.index ["project_id", "slug"], name: "index_environments_on_project_id_and_slug", unique: true
- end
-
- create_table "events", id: :serial, force: :cascade do |t|
- t.integer "project_id"
- t.integer "author_id", null: false
- t.integer "target_id"
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "action", limit: 2, null: false
- t.string "target_type"
- t.index ["action"], name: "index_events_on_action"
- t.index ["author_id", "project_id"], name: "index_events_on_author_id_and_project_id"
- t.index ["project_id", "created_at"], name: "index_events_on_project_id_and_created_at"
- t.index ["project_id", "id"], name: "index_events_on_project_id_and_id"
- t.index ["target_type", "target_id"], name: "index_events_on_target_type_and_target_id"
- end
-
- create_table "feature_gates", id: :serial, force: :cascade do |t|
- t.string "feature_key", null: false
- t.string "key", null: false
- t.string "value"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["feature_key", "key", "value"], name: "index_feature_gates_on_feature_key_and_key_and_value", unique: true
- end
-
- create_table "features", id: :serial, force: :cascade do |t|
- t.string "key", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["key"], name: "index_features_on_key", unique: true
- end
-
- create_table "fork_network_members", id: :serial, force: :cascade do |t|
- t.integer "fork_network_id", null: false
- t.integer "project_id", null: false
- t.integer "forked_from_project_id"
- t.index ["fork_network_id"], name: "index_fork_network_members_on_fork_network_id"
- t.index ["forked_from_project_id"], name: "index_fork_network_members_on_forked_from_project_id"
- t.index ["project_id"], name: "index_fork_network_members_on_project_id", unique: true
- end
-
- create_table "fork_networks", id: :serial, force: :cascade do |t|
- t.integer "root_project_id"
- t.string "deleted_root_project_name"
- t.index ["root_project_id"], name: "index_fork_networks_on_root_project_id", unique: true
- end
-
- create_table "forked_project_links", id: :serial, force: :cascade do |t|
- t.integer "forked_to_project_id", null: false
- t.integer "forked_from_project_id", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true
- end
-
- create_table "gpg_key_subkeys", id: :serial, force: :cascade do |t|
- t.integer "gpg_key_id", null: false
- t.binary "keyid"
- t.binary "fingerprint"
- t.index ["fingerprint"], name: "index_gpg_key_subkeys_on_fingerprint", unique: true
- t.index ["gpg_key_id"], name: "index_gpg_key_subkeys_on_gpg_key_id"
- t.index ["keyid"], name: "index_gpg_key_subkeys_on_keyid", unique: true
- end
-
- create_table "gpg_keys", id: :serial, force: :cascade do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "user_id"
- t.binary "primary_keyid"
- t.binary "fingerprint"
- t.text "key"
- t.index ["fingerprint"], name: "index_gpg_keys_on_fingerprint", unique: true
- t.index ["primary_keyid"], name: "index_gpg_keys_on_primary_keyid", unique: true
- t.index ["user_id"], name: "index_gpg_keys_on_user_id"
- end
-
- create_table "gpg_signatures", id: :serial, force: :cascade do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "project_id"
- t.integer "gpg_key_id"
- t.binary "commit_sha"
- t.binary "gpg_key_primary_keyid"
- t.text "gpg_key_user_name"
- t.text "gpg_key_user_email"
- t.integer "verification_status", limit: 2, default: 0, null: false
- t.integer "gpg_key_subkey_id"
- t.index ["commit_sha"], name: "index_gpg_signatures_on_commit_sha", unique: true
- t.index ["gpg_key_id"], name: "index_gpg_signatures_on_gpg_key_id"
- t.index ["gpg_key_primary_keyid"], name: "index_gpg_signatures_on_gpg_key_primary_keyid"
- t.index ["gpg_key_subkey_id"], name: "index_gpg_signatures_on_gpg_key_subkey_id"
- t.index ["project_id"], name: "index_gpg_signatures_on_project_id"
- end
-
- create_table "group_custom_attributes", id: :serial, force: :cascade do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "group_id", null: false
- t.string "key", null: false
- t.string "value", null: false
- t.index ["group_id", "key"], name: "index_group_custom_attributes_on_group_id_and_key", unique: true
- t.index ["key", "value"], name: "index_group_custom_attributes_on_key_and_value"
- end
-
- create_table "group_group_links", force: :cascade do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.bigint "shared_group_id", null: false
- t.bigint "shared_with_group_id", null: false
- t.date "expires_at"
- t.integer "group_access", limit: 2, default: 30, null: false
- t.index ["shared_group_id", "shared_with_group_id"], name: "index_group_group_links_on_shared_group_and_shared_with_group", unique: true
- t.index ["shared_with_group_id"], name: "index_group_group_links_on_shared_with_group_id"
- end
-
- create_table "identities", id: :serial, force: :cascade do |t|
- t.string "extern_uid"
- t.string "provider"
- t.integer "user_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index ["user_id"], name: "index_identities_on_user_id"
- end
-
- create_table "import_export_uploads", id: :serial, force: :cascade do |t|
- t.datetime_with_timezone "updated_at", null: false
- t.integer "project_id"
- t.text "import_file"
- t.text "export_file"
- t.index ["project_id"], name: "index_import_export_uploads_on_project_id"
- t.index ["updated_at"], name: "index_import_export_uploads_on_updated_at"
- end
-
- create_table "internal_ids", force: :cascade do |t|
- t.integer "project_id"
- t.integer "usage", null: false
- t.integer "last_value", null: false
- t.integer "namespace_id"
- t.index ["namespace_id"], name: "index_internal_ids_on_namespace_id"
- t.index ["project_id"], name: "index_internal_ids_on_project_id"
- t.index ["usage", "namespace_id"], name: "index_internal_ids_on_usage_and_namespace_id", unique: true, where: "(namespace_id IS NOT NULL)"
- t.index ["usage", "project_id"], name: "index_internal_ids_on_usage_and_project_id", unique: true, where: "(project_id IS NOT NULL)"
- end
-
- create_table "issue_assignees", id: false, force: :cascade do |t|
- t.integer "user_id", null: false
- t.integer "issue_id", null: false
- t.index ["issue_id", "user_id"], name: "index_issue_assignees_on_issue_id_and_user_id", unique: true
- t.index ["user_id"], name: "index_issue_assignees_on_user_id"
- end
-
- create_table "issue_metrics", id: :serial, force: :cascade do |t|
- t.integer "issue_id", null: false
- t.datetime "first_mentioned_in_commit_at"
- t.datetime "first_associated_with_milestone_at"
- t.datetime "first_added_to_board_at"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["issue_id"], name: "index_issue_metrics"
- end
-
- create_table "issues", id: :serial, force: :cascade do |t|
- t.string "title"
- t.integer "author_id"
- t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.text "description"
- t.integer "milestone_id"
- t.string "state"
- t.integer "iid"
- t.integer "updated_by_id"
- t.boolean "confidential", default: false, null: false
- t.date "due_date"
- t.integer "moved_to_id"
- t.integer "lock_version"
- t.text "title_html"
- t.text "description_html"
- t.integer "time_estimate"
- t.integer "relative_position"
- t.integer "cached_markdown_version"
- t.datetime "last_edited_at"
- t.integer "last_edited_by_id"
- t.boolean "discussion_locked"
- t.datetime_with_timezone "closed_at"
- t.integer "closed_by_id"
- t.index ["author_id"], name: "index_issues_on_author_id"
- t.index ["closed_by_id"], name: "index_issues_on_closed_by_id"
- t.index ["confidential"], name: "index_issues_on_confidential"
- t.index ["description"], name: "index_issues_on_description_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["milestone_id"], name: "index_issues_on_milestone_id"
- t.index ["moved_to_id"], name: "index_issues_on_moved_to_id", where: "(moved_to_id IS NOT NULL)"
- t.index ["project_id", "created_at", "id", "state"], name: "index_issues_on_project_id_and_created_at_and_id_and_state"
- t.index ["project_id", "due_date", "id", "state"], name: "idx_issues_on_project_id_and_due_date_and_id_and_state_partial", where: "(due_date IS NOT NULL)"
- t.index ["project_id", "iid"], name: "index_issues_on_project_id_and_iid", unique: true
- t.index ["project_id", "updated_at", "id", "state"], name: "index_issues_on_project_id_and_updated_at_and_id_and_state"
- t.index ["relative_position"], name: "index_issues_on_relative_position"
- t.index ["state"], name: "index_issues_on_state"
- t.index ["title"], name: "index_issues_on_title_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["updated_at"], name: "index_issues_on_updated_at"
- t.index ["updated_by_id"], name: "index_issues_on_updated_by_id", where: "(updated_by_id IS NOT NULL)"
- end
-
- create_table "keys", id: :serial, force: :cascade do |t|
- t.integer "user_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.text "key"
- t.string "title"
- t.string "type"
- t.string "fingerprint"
- t.boolean "public", default: false, null: false
- t.datetime "last_used_at"
- t.index ["fingerprint"], name: "index_keys_on_fingerprint", unique: true
- t.index ["user_id"], name: "index_keys_on_user_id"
- end
-
- create_table "label_links", id: :serial, force: :cascade do |t|
- t.integer "label_id"
- t.integer "target_id"
- t.string "target_type"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index ["label_id"], name: "index_label_links_on_label_id"
- t.index ["target_id", "target_type"], name: "index_label_links_on_target_id_and_target_type"
- end
-
- create_table "label_priorities", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "label_id", null: false
- t.integer "priority", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["label_id"], name: "index_label_priorities_on_label_id"
- t.index ["priority"], name: "index_label_priorities_on_priority"
- t.index ["project_id", "label_id"], name: "index_label_priorities_on_project_id_and_label_id", unique: true
- end
-
- create_table "labels", id: :serial, force: :cascade do |t|
- t.string "title"
- t.string "color"
- t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.boolean "template", default: false
- t.string "description"
- t.text "description_html"
- t.string "type"
- t.integer "group_id"
- t.integer "cached_markdown_version"
- t.index ["group_id", "project_id", "title"], name: "index_labels_on_group_id_and_project_id_and_title", unique: true
- t.index ["project_id"], name: "index_labels_on_project_id"
- t.index ["template"], name: "index_labels_on_template", where: "template"
- t.index ["title"], name: "index_labels_on_title"
- t.index ["type", "project_id"], name: "index_labels_on_type_and_project_id"
- end
-
- create_table "lfs_file_locks", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "user_id", null: false
- t.datetime "created_at", null: false
- t.string "path", limit: 511
- t.index ["project_id", "path"], name: "index_lfs_file_locks_on_project_id_and_path", unique: true
- t.index ["user_id"], name: "index_lfs_file_locks_on_user_id"
- end
-
- create_table "lfs_objects", id: :serial, force: :cascade do |t|
- t.string "oid", null: false
- t.bigint "size", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "file"
- t.integer "file_store"
- t.index ["file_store"], name: "index_lfs_objects_on_file_store"
- t.index ["oid"], name: "index_lfs_objects_on_oid", unique: true
- end
-
- create_table "lfs_objects_projects", id: :serial, force: :cascade do |t|
- t.integer "lfs_object_id", null: false
- t.integer "project_id", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index ["project_id"], name: "index_lfs_objects_projects_on_project_id"
- end
-
- create_table "lists", id: :serial, force: :cascade do |t|
- t.integer "board_id", null: false
- t.integer "label_id"
- t.integer "list_type", default: 1, null: false
- t.integer "position"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["board_id", "label_id"], name: "index_lists_on_board_id_and_label_id", unique: true
- t.index ["label_id"], name: "index_lists_on_label_id"
- t.index ["list_type"], name: "index_lists_on_list_type"
- end
-
- create_table "members", id: :serial, force: :cascade do |t|
- t.integer "access_level", null: false
- t.integer "source_id", null: false
- t.string "source_type", null: false
- t.integer "user_id"
- t.integer "notification_level", null: false
- t.string "type"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "created_by_id"
- t.string "invite_email"
- t.string "invite_token"
- t.datetime "invite_accepted_at"
- t.datetime "requested_at"
- t.date "expires_at"
- t.index ["access_level"], name: "index_members_on_access_level"
- t.index ["invite_token"], name: "index_members_on_invite_token", unique: true
- t.index ["requested_at"], name: "index_members_on_requested_at"
- t.index ["source_id", "source_type"], name: "index_members_on_source_id_and_source_type"
- t.index ["user_id"], name: "index_members_on_user_id"
- end
-
- create_table "merge_request_diff_commits", id: false, force: :cascade do |t|
- t.datetime_with_timezone "authored_date"
- t.datetime_with_timezone "committed_date"
- t.integer "merge_request_diff_id", null: false
- t.integer "relative_order", null: false
- t.binary "sha", null: false
- t.text "author_name"
- t.text "author_email"
- t.text "committer_name"
- t.text "committer_email"
- t.text "message"
- t.index ["merge_request_diff_id", "relative_order"], name: "index_merge_request_diff_commits_on_mr_diff_id_and_order", unique: true
- t.index ["sha"], name: "index_merge_request_diff_commits_on_sha"
- end
-
- create_table "merge_request_diff_files", id: false, force: :cascade do |t|
- t.integer "merge_request_diff_id", null: false
- t.integer "relative_order", null: false
- t.boolean "new_file", null: false
- t.boolean "renamed_file", null: false
- t.boolean "deleted_file", null: false
- t.boolean "too_large", null: false
- t.string "a_mode", null: false
- t.string "b_mode", null: false
- t.text "new_path", null: false
- t.text "old_path", null: false
- t.text "diff", null: false
- t.boolean "binary"
- t.index ["merge_request_diff_id", "relative_order"], name: "index_merge_request_diff_files_on_mr_diff_id_and_order", unique: true
- end
-
- create_table "merge_request_diffs", id: :serial, force: :cascade do |t|
- t.string "state"
- t.integer "merge_request_id", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "base_commit_sha"
- t.string "real_size"
- t.string "head_commit_sha"
- t.string "start_commit_sha"
- t.integer "commits_count"
- t.index ["merge_request_id", "id"], name: "index_merge_request_diffs_on_merge_request_id_and_id"
- end
-
- create_table "merge_request_metrics", id: :serial, force: :cascade do |t|
- t.integer "merge_request_id", null: false
- t.datetime "latest_build_started_at"
- t.datetime "latest_build_finished_at"
- t.datetime "first_deployed_to_production_at"
- t.datetime "merged_at"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "pipeline_id"
- t.integer "merged_by_id"
- t.integer "latest_closed_by_id"
- t.datetime_with_timezone "latest_closed_at"
- t.index ["first_deployed_to_production_at"], name: "index_merge_request_metrics_on_first_deployed_to_production_at"
- t.index ["latest_closed_by_id"], name: "index_merge_request_metrics_on_latest_closed_by_id"
- t.index ["merge_request_id"], name: "index_merge_request_metrics"
- t.index ["merged_by_id"], name: "index_merge_request_metrics_on_merged_by_id"
- t.index ["pipeline_id"], name: "index_merge_request_metrics_on_pipeline_id"
- end
-
- create_table "merge_requests", id: :serial, force: :cascade do |t|
- t.string "target_branch", null: false
- t.string "source_branch", null: false
- t.integer "source_project_id"
- t.integer "author_id"
- t.integer "assignee_id"
- t.string "title"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "milestone_id"
- t.string "state", default: "opened", null: false
- t.string "merge_status", default: "unchecked", null: false
- t.integer "target_project_id", null: false
- t.integer "iid"
- t.text "description"
- t.integer "updated_by_id"
- t.text "merge_error"
- t.text "merge_params"
- t.boolean "merge_when_pipeline_succeeds", default: false, null: false
- t.integer "merge_user_id"
- t.string "merge_commit_sha"
- t.string "rebase_commit_sha"
- t.string "in_progress_merge_commit_sha"
- t.integer "lock_version"
- t.text "title_html"
- t.text "description_html"
- t.integer "time_estimate"
- t.integer "cached_markdown_version"
- t.datetime "last_edited_at"
- t.integer "last_edited_by_id"
- t.integer "head_pipeline_id"
- t.string "merge_jid"
- t.boolean "discussion_locked"
- t.integer "latest_merge_request_diff_id"
- t.boolean "allow_maintainer_to_push"
- t.boolean "squash", default: false, null: false
- t.index ["assignee_id"], name: "index_merge_requests_on_assignee_id"
- t.index ["author_id"], name: "index_merge_requests_on_author_id"
- t.index ["created_at"], name: "index_merge_requests_on_created_at"
- t.index ["description"], name: "index_merge_requests_on_description_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["head_pipeline_id"], name: "index_merge_requests_on_head_pipeline_id"
- t.index ["id", "merge_jid"], name: "index_merge_requests_on_id_and_merge_jid", where: "((merge_jid IS NOT NULL) AND ((state)::text = 'locked'::text))"
- t.index ["latest_merge_request_diff_id"], name: "index_merge_requests_on_latest_merge_request_diff_id"
- t.index ["merge_user_id"], name: "index_merge_requests_on_merge_user_id", where: "(merge_user_id IS NOT NULL)"
- t.index ["milestone_id"], name: "index_merge_requests_on_milestone_id"
- t.index ["source_branch"], name: "index_merge_requests_on_source_branch"
- t.index ["source_project_id", "source_branch"], name: "index_merge_requests_on_source_project_and_branch_state_opened", where: "((state)::text = 'opened'::text)"
- t.index ["source_project_id", "source_branch"], name: "index_merge_requests_on_source_project_id_and_source_branch"
- t.index ["target_branch"], name: "index_merge_requests_on_target_branch"
- t.index ["target_project_id", "iid"], name: "index_merge_requests_on_target_project_id_and_iid", unique: true
- t.index ["target_project_id", "iid"], name: "index_merge_requests_on_target_project_id_and_iid_opened", where: "((state)::text = 'opened'::text)"
- t.index ["target_project_id", "merge_commit_sha", "id"], name: "index_merge_requests_on_tp_id_and_merge_commit_sha_and_id"
- t.index ["title"], name: "index_merge_requests_on_title"
- t.index ["title"], name: "index_merge_requests_on_title_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["updated_by_id"], name: "index_merge_requests_on_updated_by_id", where: "(updated_by_id IS NOT NULL)"
- end
-
- create_table "merge_requests_closing_issues", id: :serial, force: :cascade do |t|
- t.integer "merge_request_id", null: false
- t.integer "issue_id", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["issue_id"], name: "index_merge_requests_closing_issues_on_issue_id"
- t.index ["merge_request_id"], name: "index_merge_requests_closing_issues_on_merge_request_id"
- end
-
- create_table "milestones", id: :serial, force: :cascade do |t|
- t.string "title", null: false
- t.integer "project_id"
- t.text "description"
- t.date "due_date"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "state"
- t.integer "iid"
- t.text "title_html"
- t.text "description_html"
- t.date "start_date"
- t.integer "cached_markdown_version"
- t.integer "group_id"
- t.index ["description"], name: "index_milestones_on_description_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["due_date"], name: "index_milestones_on_due_date"
- t.index ["group_id"], name: "index_milestones_on_group_id"
- t.index ["project_id", "iid"], name: "index_milestones_on_project_id_and_iid", unique: true
- t.index ["title"], name: "index_milestones_on_title"
- t.index ["title"], name: "index_milestones_on_title_trigram", opclass: :gin_trgm_ops, using: :gin
- end
-
- create_table "namespaces", id: :serial, force: :cascade do |t|
- t.string "name", null: false
- t.string "path", null: false
- t.integer "owner_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "type"
- t.string "description", default: "", null: false
- t.string "avatar"
- t.boolean "share_with_group_lock", default: false
- t.integer "visibility_level", default: 20, null: false
- t.boolean "request_access_enabled", default: false, null: false
- t.text "description_html"
- t.boolean "lfs_enabled"
- t.integer "parent_id"
- t.boolean "require_two_factor_authentication", default: false, null: false
- t.integer "two_factor_grace_period", default: 48, null: false
- t.integer "cached_markdown_version"
- t.string "runners_token"
- t.integer "project_creation_level"
- t.string "runners_token_encrypted"
- t.index ["created_at"], name: "index_namespaces_on_created_at"
- t.index ["name", "parent_id"], name: "index_namespaces_on_name_and_parent_id", unique: true
- t.index ["name"], name: "index_namespaces_on_name_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["owner_id"], name: "index_namespaces_on_owner_id"
- t.index ["parent_id", "id"], name: "index_namespaces_on_parent_id_and_id", unique: true
- t.index ["path"], name: "index_namespaces_on_path"
- t.index ["path"], name: "index_namespaces_on_path_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["require_two_factor_authentication"], name: "index_namespaces_on_require_two_factor_authentication"
- t.index ["runners_token"], name: "index_namespaces_on_runners_token", unique: true
- t.index ["type"], name: "index_namespaces_on_type"
- end
-
- create_table "note_diff_files", id: :serial, force: :cascade do |t|
- t.integer "diff_note_id", null: false
- t.text "diff", null: false
- t.boolean "new_file", null: false
- t.boolean "renamed_file", null: false
- t.boolean "deleted_file", null: false
- t.string "a_mode", null: false
- t.string "b_mode", null: false
- t.text "new_path", null: false
- t.text "old_path", null: false
- t.index ["diff_note_id"], name: "index_note_diff_files_on_diff_note_id", unique: true
- end
-
- create_table "notes", id: :serial, force: :cascade do |t|
- t.text "note"
- t.string "noteable_type"
- t.integer "author_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "project_id"
- t.string "attachment"
- t.string "line_code"
- t.string "commit_id"
- t.integer "noteable_id"
- t.boolean "system", default: false, null: false
- t.text "st_diff"
- t.integer "updated_by_id"
- t.string "type"
- t.text "position"
- t.text "original_position"
- t.datetime "resolved_at"
- t.integer "resolved_by_id"
- t.string "discussion_id"
- t.text "note_html"
- t.integer "cached_markdown_version"
- t.text "change_position"
- t.boolean "resolved_by_push"
- t.index ["author_id"], name: "index_notes_on_author_id"
- t.index ["commit_id"], name: "index_notes_on_commit_id"
- t.index ["created_at"], name: "index_notes_on_created_at"
- t.index ["discussion_id"], name: "index_notes_on_discussion_id"
- t.index ["line_code"], name: "index_notes_on_line_code"
- t.index ["note"], name: "index_notes_on_note_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["noteable_id", "noteable_type"], name: "index_notes_on_noteable_id_and_noteable_type"
- t.index ["noteable_type"], name: "index_notes_on_noteable_type"
- t.index ["project_id", "noteable_type"], name: "index_notes_on_project_id_and_noteable_type"
- end
-
- create_table "notification_settings", id: :serial, force: :cascade do |t|
- t.integer "user_id", null: false
- t.string "source_type"
- t.integer "source_id"
- t.integer "level", default: 0, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.boolean "new_note"
- t.boolean "new_issue"
- t.boolean "reopen_issue"
- t.boolean "close_issue"
- t.boolean "reassign_issue"
- t.boolean "new_merge_request"
- t.boolean "reopen_merge_request"
- t.boolean "close_merge_request"
- t.boolean "reassign_merge_request"
- t.boolean "merge_merge_request"
- t.boolean "failed_pipeline"
- t.boolean "success_pipeline"
- t.boolean "push_to_merge_request"
- t.boolean "issue_due"
- t.index ["source_id", "source_type"], name: "index_notification_settings_on_source_id_and_source_type"
- t.index ["user_id", "source_id", "source_type"], name: "index_notifications_on_user_id_and_source_id_and_source_type", unique: true
- t.index ["user_id"], name: "index_notification_settings_on_user_id"
- end
-
- create_table "oauth_access_grants", id: :serial, force: :cascade do |t|
- t.integer "resource_owner_id", null: false
- t.integer "application_id", null: false
- t.string "token", null: false
- t.integer "expires_in", null: false
- t.text "redirect_uri", null: false
- t.datetime "created_at", null: false
- t.datetime "revoked_at"
- t.string "scopes"
- t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true
- end
-
- create_table "oauth_access_tokens", id: :serial, force: :cascade do |t|
- t.integer "resource_owner_id"
- t.integer "application_id"
- t.string "token", null: false
- t.string "refresh_token"
- t.integer "expires_in"
- t.datetime "revoked_at"
- t.datetime "created_at", null: false
- t.string "scopes"
- t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true
- t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id"
- t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true
- end
-
- create_table "oauth_applications", id: :serial, force: :cascade do |t|
- t.string "name", null: false
- t.string "uid", null: false
- t.string "secret", null: false
- t.text "redirect_uri", null: false
- t.string "scopes", default: "", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "owner_id"
- t.string "owner_type"
- t.boolean "trusted", default: false, null: false
- t.index ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type"
- t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true
- end
-
- create_table "oauth_openid_requests", id: :serial, force: :cascade do |t|
- t.integer "access_grant_id", null: false
- t.string "nonce", null: false
- t.index ["access_grant_id"], name: "index_oauth_openid_requests_on_access_grant_id"
- end
-
- create_table "pages_domains", id: :serial, force: :cascade do |t|
- t.integer "project_id"
- t.text "certificate"
- t.text "encrypted_key"
- t.string "encrypted_key_iv"
- t.string "encrypted_key_salt"
- t.string "domain"
- t.datetime_with_timezone "verified_at"
- t.string "verification_code", null: false
- t.datetime_with_timezone "enabled_until"
- t.index ["domain"], name: "index_pages_domains_on_domain", unique: true
- t.index ["project_id", "enabled_until"], name: "index_pages_domains_on_project_id_and_enabled_until"
- t.index ["project_id"], name: "index_pages_domains_on_project_id"
- t.index ["verified_at", "enabled_until"], name: "index_pages_domains_on_verified_at_and_enabled_until"
- t.index ["verified_at"], name: "index_pages_domains_on_verified_at"
- end
-
- create_table "personal_access_tokens", id: :serial, force: :cascade do |t|
- t.integer "user_id", null: false
- t.string "name", null: false
- t.boolean "revoked", default: false
- t.date "expires_at"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.string "scopes", default: "--- []\n", null: false
- t.boolean "impersonation", default: false, null: false
- t.string "token_digest"
- t.index ["token_digest"], name: "index_personal_access_tokens_on_token_digest", unique: true
- t.index ["user_id"], name: "index_personal_access_tokens_on_user_id"
- end
-
- create_table "pool_repositories", force: :cascade do |t|
- t.integer "shard_id", null: false
- t.string "disk_path"
- t.string "state"
- t.integer "source_project_id"
- t.index ["disk_path"], name: "index_pool_repositories_on_disk_path", unique: true
- t.index ["shard_id"], name: "index_pool_repositories_on_shard_id"
- t.index ["source_project_id"], name: "index_pool_repositories_on_source_project_id", unique: true
- end
-
- create_table "programming_languages", id: :serial, force: :cascade do |t|
- t.string "name", null: false
- t.string "color", null: false
- t.datetime_with_timezone "created_at", null: false
- t.index ["name"], name: "index_programming_languages_on_name", unique: true
- end
-
- create_table "project_authorizations", id: false, force: :cascade do |t|
- t.integer "user_id", null: false
- t.integer "project_id", null: false
- t.integer "access_level", null: false
- t.index ["project_id"], name: "index_project_authorizations_on_project_id"
- t.index ["user_id", "project_id", "access_level"], name: "index_project_authorizations_on_user_id_project_id_access_level", unique: true
- end
-
- create_table "project_auto_devops", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.boolean "enabled"
- t.string "domain"
- t.integer "deploy_strategy", default: 0, null: false
- t.index ["project_id"], name: "index_project_auto_devops_on_project_id", unique: true
- end
-
- create_table "project_ci_cd_settings", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.boolean "group_runners_enabled", default: true, null: false
- t.index ["project_id"], name: "index_project_ci_cd_settings_on_project_id", unique: true
- end
-
- create_table "project_custom_attributes", id: :serial, force: :cascade do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "project_id", null: false
- t.string "key", null: false
- t.string "value", null: false
- t.index ["key", "value"], name: "index_project_custom_attributes_on_key_and_value"
- t.index ["project_id", "key"], name: "index_project_custom_attributes_on_project_id_and_key", unique: true
- end
-
- create_table "project_daily_statistics", force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "fetch_count", null: false
- t.date "date"
- t.index ["project_id", "date"], name: "index_project_daily_statistics_on_project_id_and_date", unique: true, order: { date: :desc }
- end
-
- create_table "project_deploy_tokens", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "deploy_token_id", null: false
- t.datetime_with_timezone "created_at", null: false
- t.index ["deploy_token_id"], name: "index_project_deploy_tokens_on_deploy_token_id"
- t.index ["project_id", "deploy_token_id"], name: "index_project_deploy_tokens_on_project_id_and_deploy_token_id", unique: true
- end
-
- create_table "project_error_tracking_settings", primary_key: "project_id", id: :integer, default: nil, force: :cascade do |t|
- t.boolean "enabled", default: true, null: false
- t.string "api_url", null: false
- t.string "encrypted_token"
- t.string "encrypted_token_iv"
- end
-
- create_table "project_features", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "merge_requests_access_level"
- t.integer "issues_access_level"
- t.integer "wiki_access_level"
- t.integer "snippets_access_level", default: 20, null: false
- t.integer "builds_access_level"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "repository_access_level", default: 20, null: false
- t.integer "pages_access_level", default: 20, null: false
- t.index ["project_id"], name: "index_project_features_on_project_id", unique: true
- end
-
- create_table "project_group_links", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "group_id", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "group_access", default: 30, null: false
- t.date "expires_at"
- t.index ["group_id"], name: "index_project_group_links_on_group_id"
- t.index ["project_id"], name: "index_project_group_links_on_project_id"
- end
-
- create_table "project_import_data", id: :serial, force: :cascade do |t|
- t.integer "project_id"
- t.text "data"
- t.text "encrypted_credentials"
- t.string "encrypted_credentials_iv"
- t.string "encrypted_credentials_salt"
- t.index ["project_id"], name: "index_project_import_data_on_project_id"
- end
-
- create_table "project_mirror_data", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.string "status"
- t.string "jid"
- t.text "last_error"
- t.index ["jid"], name: "index_project_mirror_data_on_jid"
- t.index ["project_id"], name: "index_project_mirror_data_on_project_id", unique: true
- t.index ["status"], name: "index_project_mirror_data_on_status"
- end
-
- create_table "project_repositories", force: :cascade do |t|
- t.integer "shard_id", null: false
- t.string "disk_path", null: false
- t.integer "project_id", null: false
- t.index ["disk_path"], name: "index_project_repositories_on_disk_path", unique: true
- t.index ["project_id"], name: "index_project_repositories_on_project_id", unique: true
- t.index ["shard_id"], name: "index_project_repositories_on_shard_id"
- end
-
- create_table "project_statistics", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "namespace_id", null: false
- t.bigint "commit_count", default: 0, null: false
- t.bigint "storage_size", default: 0, null: false
- t.bigint "repository_size", default: 0, null: false
- t.bigint "lfs_objects_size", default: 0, null: false
- t.bigint "build_artifacts_size", default: 0, null: false
- t.index ["namespace_id"], name: "index_project_statistics_on_namespace_id"
- t.index ["project_id"], name: "index_project_statistics_on_project_id", unique: true
- end
-
- create_table "projects", id: :serial, force: :cascade do |t|
- t.string "name"
- t.string "path"
- t.text "description"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "creator_id"
- t.integer "namespace_id", null: false
- t.datetime "last_activity_at"
- t.string "import_url"
- t.integer "visibility_level", default: 0, null: false
- t.boolean "archived", default: false, null: false
- t.string "avatar"
- t.string "import_status"
- t.integer "star_count", default: 0, null: false
- t.boolean "merge_requests_rebase_enabled", default: false, null: false
- t.string "import_type"
- t.string "import_source"
- t.boolean "merge_requests_ff_only_enabled", default: false, null: false
- t.text "import_error"
- t.integer "ci_id"
- t.boolean "shared_runners_enabled", default: true, null: false
- t.string "runners_token"
- t.string "build_coverage_regex"
- t.boolean "build_allow_git_fetch", default: true, null: false
- t.integer "build_timeout", default: 3600, null: false
- t.boolean "pending_delete", default: false
- t.boolean "public_builds", default: true, null: false
- t.boolean "last_repository_check_failed"
- t.datetime "last_repository_check_at"
- t.boolean "container_registry_enabled"
- t.boolean "only_allow_merge_if_pipeline_succeeds", default: false, null: false
- t.boolean "has_external_issue_tracker"
- t.string "repository_storage", default: "default", null: false
- t.boolean "repository_read_only"
- t.boolean "request_access_enabled", default: false, null: false
- t.boolean "has_external_wiki"
- t.string "ci_config_path"
- t.boolean "lfs_enabled"
- t.text "description_html"
- t.boolean "only_allow_merge_if_all_discussions_are_resolved"
- t.boolean "printing_merge_request_link_enabled", default: true, null: false
- t.integer "auto_cancel_pending_pipelines", default: 1, null: false
- t.string "import_jid"
- t.integer "cached_markdown_version"
- t.text "delete_error"
- t.datetime "last_repository_updated_at"
- t.integer "storage_version", limit: 2
- t.boolean "resolve_outdated_diff_discussions"
- t.string "external_authorization_classification_label"
- t.integer "jobs_cache_index"
- t.boolean "pages_https_only", default: true
- t.boolean "remote_mirror_available_overridden"
- t.bigint "pool_repository_id"
- t.string "runners_token_encrypted"
- t.string "bfg_object_map"
- t.index "lower((name)::text)", name: "index_projects_on_lower_name"
- t.index ["ci_id"], name: "index_projects_on_ci_id"
- t.index ["created_at"], name: "index_projects_on_created_at"
- t.index ["creator_id"], name: "index_projects_on_creator_id"
- t.index ["description"], name: "index_projects_on_description_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["id"], name: "index_projects_on_id_partial_for_visibility", unique: true, where: "(visibility_level = ANY (ARRAY[10, 20]))"
- t.index ["last_activity_at"], name: "index_projects_on_last_activity_at"
- t.index ["last_repository_check_at"], name: "index_projects_on_last_repository_check_at", where: "(last_repository_check_at IS NOT NULL)"
- t.index ["last_repository_check_failed"], name: "index_projects_on_last_repository_check_failed"
- t.index ["last_repository_updated_at"], name: "index_projects_on_last_repository_updated_at"
- t.index ["name"], name: "index_projects_on_name_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["namespace_id"], name: "index_projects_on_namespace_id"
- t.index ["path"], name: "index_projects_on_path"
- t.index ["path"], name: "index_projects_on_path_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["pending_delete"], name: "index_projects_on_pending_delete"
- t.index ["pool_repository_id"], name: "index_projects_on_pool_repository_id", where: "(pool_repository_id IS NOT NULL)"
- t.index ["repository_storage", "created_at"], name: "idx_project_repository_check_partial", where: "(last_repository_check_at IS NULL)"
- t.index ["repository_storage"], name: "index_projects_on_repository_storage"
- t.index ["runners_token"], name: "index_projects_on_runners_token"
- t.index ["star_count"], name: "index_projects_on_star_count"
- t.index ["visibility_level"], name: "index_projects_on_visibility_level"
- end
-
- create_table "prometheus_metrics", id: :serial, force: :cascade do |t|
- t.integer "project_id"
- t.string "title", null: false
- t.string "query", null: false
- t.string "y_label"
- t.string "unit"
- t.string "legend"
- t.integer "group", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.boolean "common", default: false, null: false
- t.string "identifier"
- t.index ["common"], name: "index_prometheus_metrics_on_common"
- t.index ["group"], name: "index_prometheus_metrics_on_group"
- t.index ["identifier"], name: "index_prometheus_metrics_on_identifier", unique: true
- t.index ["project_id"], name: "index_prometheus_metrics_on_project_id"
- end
-
- create_table "protected_branch_merge_access_levels", id: :serial, force: :cascade do |t|
- t.integer "protected_branch_id", null: false
- t.integer "access_level", default: 40, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["protected_branch_id"], name: "index_protected_branch_merge_access"
- end
-
- create_table "protected_branch_push_access_levels", id: :serial, force: :cascade do |t|
- t.integer "protected_branch_id", null: false
- t.integer "access_level", default: 40, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["protected_branch_id"], name: "index_protected_branch_push_access"
- end
-
- create_table "protected_branches", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.string "name", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index ["project_id"], name: "index_protected_branches_on_project_id"
- end
-
- create_table "protected_tag_create_access_levels", id: :serial, force: :cascade do |t|
- t.integer "protected_tag_id", null: false
- t.integer "access_level", default: 40
- t.integer "user_id"
- t.integer "group_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["group_id"], name: "index_protected_tag_create_access_levels_on_group_id"
- t.index ["protected_tag_id"], name: "index_protected_tag_create_access"
- t.index ["user_id"], name: "index_protected_tag_create_access_levels_on_user_id"
- end
-
- create_table "protected_tags", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.string "name", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["project_id", "name"], name: "index_protected_tags_on_project_id_and_name", unique: true
- t.index ["project_id"], name: "index_protected_tags_on_project_id"
- end
-
- create_table "push_event_payloads", id: false, force: :cascade do |t|
- t.bigint "commit_count", null: false
- t.integer "event_id", null: false
- t.integer "action", limit: 2, null: false
- t.integer "ref_type", limit: 2, null: false
- t.binary "commit_from"
- t.binary "commit_to"
- t.text "ref"
- t.string "commit_title", limit: 70
- t.index ["event_id"], name: "index_push_event_payloads_on_event_id", unique: true
- end
-
- create_table "redirect_routes", id: :serial, force: :cascade do |t|
- t.integer "source_id", null: false
- t.string "source_type", null: false
- t.string "path", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index "lower((path)::text) varchar_pattern_ops", name: "index_redirect_routes_on_path_unique_text_pattern_ops", unique: true
- t.index ["path"], name: "index_redirect_routes_on_path", unique: true
- t.index ["source_type", "source_id"], name: "index_redirect_routes_on_source_type_and_source_id"
- end
-
- create_table "release_links", force: :cascade do |t|
- t.integer "release_id", null: false
- t.string "url", null: false
- t.string "name", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.index ["release_id", "name"], name: "index_release_links_on_release_id_and_name", unique: true
- t.index ["release_id", "url"], name: "index_release_links_on_release_id_and_url", unique: true
- end
-
- create_table "releases", id: :serial, force: :cascade do |t|
- t.string "tag"
- t.text "description"
- t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.text "description_html"
- t.integer "cached_markdown_version"
- t.integer "author_id"
- t.string "name"
- t.string "sha"
- t.index ["author_id"], name: "index_releases_on_author_id"
- t.index ["project_id", "tag"], name: "index_releases_on_project_id_and_tag"
- t.index ["project_id"], name: "index_releases_on_project_id"
- end
-
- create_table "remote_mirrors", id: :serial, force: :cascade do |t|
- t.integer "project_id"
- t.string "url"
- t.boolean "enabled", default: false
- t.string "update_status"
- t.datetime "last_update_at"
- t.datetime "last_successful_update_at"
- t.datetime "last_update_started_at"
- t.string "last_error"
- t.boolean "only_protected_branches", default: false, null: false
- t.string "remote_name"
- t.text "encrypted_credentials"
- t.string "encrypted_credentials_iv"
- t.string "encrypted_credentials_salt"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["last_successful_update_at"], name: "index_remote_mirrors_on_last_successful_update_at"
- t.index ["project_id"], name: "index_remote_mirrors_on_project_id"
- end
-
- create_table "repository_languages", id: false, force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "programming_language_id", null: false
- t.float "share", null: false
- t.index ["project_id", "programming_language_id"], name: "index_repository_languages_on_project_and_languages_id", unique: true
- end
-
- create_table "resource_label_events", force: :cascade do |t|
- t.integer "action", null: false
- t.integer "issue_id"
- t.integer "merge_request_id"
- t.integer "label_id"
- t.integer "user_id"
- t.datetime_with_timezone "created_at", null: false
- t.integer "cached_markdown_version"
- t.text "reference"
- t.text "reference_html"
- t.index ["issue_id"], name: "index_resource_label_events_on_issue_id"
- t.index ["label_id"], name: "index_resource_label_events_on_label_id"
- t.index ["merge_request_id"], name: "index_resource_label_events_on_merge_request_id"
- t.index ["user_id"], name: "index_resource_label_events_on_user_id"
- end
-
- create_table "routes", id: :serial, force: :cascade do |t|
- t.integer "source_id", null: false
- t.string "source_type", null: false
- t.string "path", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "name"
- t.index ["path"], name: "index_routes_on_path", unique: true
- t.index ["path"], name: "index_routes_on_path_text_pattern_ops", opclass: :varchar_pattern_ops
- t.index ["source_type", "source_id"], name: "index_routes_on_source_type_and_source_id", unique: true
- end
-
- create_table "sent_notifications", id: :serial, force: :cascade do |t|
- t.integer "project_id"
- t.string "noteable_type"
- t.integer "noteable_id"
- t.integer "recipient_id"
- t.string "commit_id"
- t.string "reply_key", null: false
- t.string "line_code"
- t.string "note_type"
- t.text "position"
- t.string "in_reply_to_discussion_id"
- t.index ["reply_key"], name: "index_sent_notifications_on_reply_key", unique: true
- end
-
- create_table "services", id: :serial, force: :cascade do |t|
- t.string "type"
- t.string "title"
- t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.boolean "active", default: false, null: false
- t.text "properties"
- t.boolean "template", default: false
- t.boolean "push_events", default: true
- t.boolean "issues_events", default: true
- t.boolean "merge_requests_events", default: true
- t.boolean "tag_push_events", default: true
- t.boolean "note_events", default: true, null: false
- t.string "category", default: "common", null: false
- t.boolean "default", default: false
- t.boolean "wiki_page_events", default: true
- t.boolean "pipeline_events", default: false, null: false
- t.boolean "confidential_issues_events", default: true, null: false
- t.boolean "commit_events", default: true, null: false
- t.boolean "job_events", default: false, null: false
- t.boolean "confidential_note_events", default: true
- t.index ["project_id"], name: "index_services_on_project_id"
- t.index ["template"], name: "index_services_on_template"
- end
-
- create_table "shards", id: :serial, force: :cascade do |t|
- t.string "name", null: false
- t.index ["name"], name: "index_shards_on_name", unique: true
- end
-
- create_table "snippets", id: :serial, force: :cascade do |t|
- t.string "title"
- t.text "content"
- t.integer "author_id", null: false
- t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "file_name"
- t.string "type"
- t.integer "visibility_level", default: 0, null: false
- t.text "title_html"
- t.text "content_html"
- t.integer "cached_markdown_version"
- t.text "description"
- t.text "description_html"
- t.index ["author_id"], name: "index_snippets_on_author_id"
- t.index ["file_name"], name: "index_snippets_on_file_name_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["project_id"], name: "index_snippets_on_project_id"
- t.index ["title"], name: "index_snippets_on_title_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["updated_at"], name: "index_snippets_on_updated_at"
- t.index ["visibility_level"], name: "index_snippets_on_visibility_level"
- end
-
- create_table "spam_logs", id: :serial, force: :cascade do |t|
- t.integer "user_id"
- t.string "source_ip"
- t.string "user_agent"
- t.boolean "via_api"
- t.string "noteable_type"
- t.string "title"
- t.text "description"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.boolean "submitted_as_ham", default: false, null: false
- t.boolean "recaptcha_verified", default: false, null: false
- end
-
- create_table "subscriptions", id: :serial, force: :cascade do |t|
- t.integer "user_id"
- t.string "subscribable_type"
- t.integer "subscribable_id"
- t.boolean "subscribed"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "project_id"
- t.index ["project_id"], name: "index_subscriptions_on_project_id"
- t.index ["subscribable_id", "subscribable_type", "user_id", "project_id"], name: "index_subscriptions_on_subscribable_and_user_id_and_project_id", unique: true
- end
-
- create_table "suggestions", force: :cascade do |t|
- t.integer "note_id", null: false
- t.integer "relative_order", limit: 2, null: false
- t.boolean "applied", default: false, null: false
- t.string "commit_id"
- t.text "from_content", null: false
- t.text "to_content", null: false
- t.index ["note_id", "relative_order"], name: "index_suggestions_on_note_id_and_relative_order", unique: true
- t.index ["note_id"], name: "index_suggestions_on_note_id"
- end
-
- create_table "system_note_metadata", id: :serial, force: :cascade do |t|
- t.integer "note_id", null: false
- t.integer "commit_count"
- t.string "action"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["note_id"], name: "index_system_note_metadata_on_note_id", unique: true
- end
-
- create_table "taggings", id: :serial, force: :cascade do |t|
- t.integer "tag_id"
- t.integer "taggable_id"
- t.string "taggable_type"
- t.integer "tagger_id"
- t.string "tagger_type"
- t.string "context"
- t.datetime "created_at"
- t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true
- t.index ["tag_id"], name: "index_taggings_on_tag_id"
- t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context"
- t.index ["taggable_id", "taggable_type"], name: "index_taggings_on_taggable_id_and_taggable_type"
- end
-
- create_table "tags", id: :serial, force: :cascade do |t|
- t.string "name"
- t.integer "taggings_count", default: 0
- t.index ["name"], name: "index_tags_on_name", unique: true
- end
-
- create_table "term_agreements", id: :serial, force: :cascade do |t|
- t.integer "term_id", null: false
- t.integer "user_id", null: false
- t.boolean "accepted", default: false, null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.index ["term_id"], name: "index_term_agreements_on_term_id"
- t.index ["user_id", "term_id"], name: "term_agreements_unique_index", unique: true
- t.index ["user_id"], name: "index_term_agreements_on_user_id"
- end
-
- create_table "timelogs", id: :serial, force: :cascade do |t|
- t.integer "time_spent", null: false
- t.integer "user_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "issue_id"
- t.integer "merge_request_id"
- t.datetime_with_timezone "spent_at"
- t.index ["issue_id"], name: "index_timelogs_on_issue_id"
- t.index ["merge_request_id"], name: "index_timelogs_on_merge_request_id"
- t.index ["user_id"], name: "index_timelogs_on_user_id"
- end
-
- create_table "todos", id: :serial, force: :cascade do |t|
- t.integer "user_id", null: false
- t.integer "project_id"
- t.string "target_type", null: false
- t.integer "target_id"
- t.integer "author_id", null: false
- t.integer "action", null: false
- t.string "state", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "note_id"
- t.string "commit_id"
- t.integer "group_id"
- t.index ["author_id"], name: "index_todos_on_author_id"
- t.index ["commit_id"], name: "index_todos_on_commit_id"
- t.index ["group_id"], name: "index_todos_on_group_id"
- t.index ["note_id"], name: "index_todos_on_note_id"
- t.index ["project_id"], name: "index_todos_on_project_id"
- t.index ["target_type", "target_id"], name: "index_todos_on_target_type_and_target_id"
- t.index ["user_id", "id"], name: "index_todos_on_user_id_and_id_done", where: "((state)::text = 'done'::text)"
- t.index ["user_id", "id"], name: "index_todos_on_user_id_and_id_pending", where: "((state)::text = 'pending'::text)"
- t.index ["user_id"], name: "index_todos_on_user_id"
- end
-
- create_table "trending_projects", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.index ["project_id"], name: "index_trending_projects_on_project_id", unique: true
- end
-
- create_table "u2f_registrations", id: :serial, force: :cascade do |t|
- t.text "certificate"
- t.string "key_handle"
- t.string "public_key"
- t.integer "counter"
- t.integer "user_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.string "name"
- t.index ["key_handle"], name: "index_u2f_registrations_on_key_handle"
- t.index ["user_id"], name: "index_u2f_registrations_on_user_id"
- end
-
- create_table "uploads", id: :serial, force: :cascade do |t|
- t.bigint "size", null: false
- t.string "path", limit: 511, null: false
- t.string "checksum", limit: 64
- t.string "model_type"
- t.integer "model_id"
- t.string "uploader", null: false
- t.datetime "created_at", null: false
- t.integer "store"
- t.string "mount_point"
- t.string "secret"
- t.index ["checksum"], name: "index_uploads_on_checksum"
- t.index ["model_id", "model_type"], name: "index_uploads_on_model_id_and_model_type"
- t.index ["store"], name: "index_uploads_on_store"
- t.index ["uploader", "path"], name: "index_uploads_on_uploader_and_path"
- end
-
- create_table "user_agent_details", id: :serial, force: :cascade do |t|
- t.string "user_agent", null: false
- t.string "ip_address", null: false
- t.integer "subject_id", null: false
- t.string "subject_type", null: false
- t.boolean "submitted", default: false, null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["subject_id", "subject_type"], name: "index_user_agent_details_on_subject_id_and_subject_type"
- end
-
- create_table "user_callouts", id: :serial, force: :cascade do |t|
- t.integer "feature_name", null: false
- t.integer "user_id", null: false
- t.index ["user_id", "feature_name"], name: "index_user_callouts_on_user_id_and_feature_name", unique: true
- t.index ["user_id"], name: "index_user_callouts_on_user_id"
- end
-
- create_table "user_custom_attributes", id: :serial, force: :cascade do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "user_id", null: false
- t.string "key", null: false
- t.string "value", null: false
- t.index ["key", "value"], name: "index_user_custom_attributes_on_key_and_value"
- t.index ["user_id", "key"], name: "index_user_custom_attributes_on_user_id_and_key", unique: true
- end
-
- create_table "user_interacted_projects", id: false, force: :cascade do |t|
- t.integer "user_id", null: false
- t.integer "project_id", null: false
- t.index ["project_id", "user_id"], name: "index_user_interacted_projects_on_project_id_and_user_id", unique: true
- t.index ["user_id"], name: "index_user_interacted_projects_on_user_id"
- end
-
- create_table "user_preferences", id: :serial, force: :cascade do |t|
- t.integer "user_id", null: false
- t.integer "issue_notes_filter", limit: 2, default: 0, null: false
- t.integer "merge_request_notes_filter", limit: 2, default: 0, null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "first_day_of_week"
- t.index ["user_id"], name: "index_user_preferences_on_user_id", unique: true
- end
-
- create_table "user_statuses", primary_key: "user_id", id: :serial, force: :cascade do |t|
- t.integer "cached_markdown_version"
- t.string "emoji", default: "speech_balloon", null: false
- t.string "message", limit: 100
- t.string "message_html"
- t.index ["user_id"], name: "index_user_statuses_on_user_id"
- end
-
- create_table "user_synced_attributes_metadata", id: :serial, force: :cascade do |t|
- t.boolean "name_synced", default: false
- t.boolean "email_synced", default: false
- t.boolean "location_synced", default: false
- t.integer "user_id", null: false
- t.string "provider"
- t.index ["user_id"], name: "index_user_synced_attributes_metadata_on_user_id", unique: true
- end
-
- create_table "users", id: :serial, force: :cascade do |t|
- t.string "email", default: "", null: false
- t.string "encrypted_password", default: "", null: false
- t.string "reset_password_token"
- t.datetime "reset_password_sent_at"
- t.datetime "remember_created_at"
- t.integer "sign_in_count", default: 0
- t.datetime "current_sign_in_at"
- t.datetime "last_sign_in_at"
- t.string "current_sign_in_ip"
- t.string "last_sign_in_ip"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "name"
- t.boolean "admin", default: false, null: false
- t.integer "projects_limit", null: false
- t.string "skype", default: "", null: false
- t.string "linkedin", default: "", null: false
- t.string "twitter", default: "", null: false
- t.string "bio"
- t.integer "failed_attempts", default: 0
- t.datetime "locked_at"
- t.string "username"
- t.boolean "can_create_group", default: true, null: false
- t.boolean "can_create_team", default: true, null: false
- t.string "state"
- t.integer "color_scheme_id", default: 1, null: false
- t.datetime "password_expires_at"
- t.integer "created_by_id"
- t.datetime "last_credential_check_at"
- t.string "avatar"
- t.string "confirmation_token"
- t.datetime "confirmed_at"
- t.datetime "confirmation_sent_at"
- t.string "unconfirmed_email"
- t.boolean "hide_no_ssh_key", default: false
- t.string "website_url", default: "", null: false
- t.string "notification_email"
- t.boolean "hide_no_password", default: false
- t.boolean "password_automatically_set", default: false
- t.string "location"
- t.string "encrypted_otp_secret"
- t.string "encrypted_otp_secret_iv"
- t.string "encrypted_otp_secret_salt"
- t.boolean "otp_required_for_login", default: false, null: false
- t.text "otp_backup_codes"
- t.string "public_email", default: "", null: false
- t.integer "dashboard", default: 0
- t.integer "project_view", default: 0
- t.integer "consumed_timestep"
- t.integer "layout", default: 0
- t.boolean "hide_project_limit", default: false
- t.string "unlock_token"
- t.datetime "otp_grace_period_started_at"
- t.boolean "external", default: false
- t.string "incoming_email_token"
- t.string "organization"
- t.boolean "require_two_factor_authentication_from_group", default: false, null: false
- t.integer "two_factor_grace_period", default: 48, null: false
- t.boolean "ghost"
- t.date "last_activity_on"
- t.boolean "notified_of_own_activity"
- t.string "preferred_language"
- t.integer "theme_id", limit: 2
- t.boolean "include_private_contributions"
- t.string "feed_token"
- t.integer "accepted_term_id"
- t.boolean "private_profile"
- t.string "commit_email"
- t.index "lower((name)::text)", name: "index_on_users_name_lower"
- t.index ["accepted_term_id"], name: "index_users_on_accepted_term_id"
- t.index ["admin"], name: "index_users_on_admin"
- t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
- t.index ["created_at"], name: "index_users_on_created_at"
- t.index ["email"], name: "index_users_on_email", unique: true
- t.index ["email"], name: "index_users_on_email_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["feed_token"], name: "index_users_on_feed_token"
- t.index ["ghost"], name: "index_users_on_ghost"
- t.index ["incoming_email_token"], name: "index_users_on_incoming_email_token"
- t.index ["name"], name: "index_users_on_name"
- t.index ["name"], name: "index_users_on_name_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
- t.index ["state"], name: "index_users_on_state"
- t.index ["username"], name: "index_users_on_username"
- t.index ["username"], name: "index_users_on_username_trigram", opclass: :gin_trgm_ops, using: :gin
- end
-
- create_table "users_star_projects", id: :serial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "user_id", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index ["project_id"], name: "index_users_star_projects_on_project_id"
- t.index ["user_id", "project_id"], name: "index_users_star_projects_on_user_id_and_project_id", unique: true
- end
-
- create_table "web_hook_logs", id: :serial, force: :cascade do |t|
- t.integer "web_hook_id", null: false
- t.string "trigger"
- t.string "url"
- t.text "request_headers"
- t.text "request_data"
- t.text "response_headers"
- t.text "response_body"
- t.string "response_status"
- t.float "execution_duration"
- t.string "internal_error_message"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["created_at", "web_hook_id"], name: "index_web_hook_logs_on_created_at_and_web_hook_id"
- t.index ["web_hook_id"], name: "index_web_hook_logs_on_web_hook_id"
- end
-
- create_table "web_hooks", id: :serial, force: :cascade do |t|
- t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "type", default: "ProjectHook"
- t.integer "service_id"
- t.boolean "push_events", default: true, null: false
- t.boolean "issues_events", default: false, null: false
- t.boolean "merge_requests_events", default: false, null: false
- t.boolean "tag_push_events", default: false
- t.boolean "note_events", default: false, null: false
- t.boolean "enable_ssl_verification", default: true
- t.boolean "wiki_page_events", default: false, null: false
- t.boolean "pipeline_events", default: false, null: false
- t.boolean "confidential_issues_events", default: false, null: false
- t.boolean "repository_update_events", default: false, null: false
- t.boolean "job_events", default: false, null: false
- t.boolean "confidential_note_events"
- t.text "push_events_branch_filter"
- t.string "encrypted_token"
- t.string "encrypted_token_iv"
- t.string "encrypted_url"
- t.string "encrypted_url_iv"
- t.index ["project_id"], name: "index_web_hooks_on_project_id"
- t.index ["type"], name: "index_web_hooks_on_type"
- end
-
- add_foreign_key "application_settings", "users", column: "usage_stats_set_by_user_id", name: "fk_964370041d", on_delete: :nullify
- add_foreign_key "badges", "namespaces", column: "group_id", on_delete: :cascade
- add_foreign_key "badges", "projects", on_delete: :cascade
- add_foreign_key "board_group_recent_visits", "boards", on_delete: :cascade
- add_foreign_key "board_group_recent_visits", "namespaces", column: "group_id", on_delete: :cascade
- add_foreign_key "board_group_recent_visits", "users", on_delete: :cascade
- add_foreign_key "board_project_recent_visits", "boards", on_delete: :cascade
- add_foreign_key "board_project_recent_visits", "projects", on_delete: :cascade
- add_foreign_key "board_project_recent_visits", "users", on_delete: :cascade
- add_foreign_key "boards", "namespaces", column: "group_id", on_delete: :cascade
- add_foreign_key "boards", "projects", name: "fk_f15266b5f9", on_delete: :cascade
- add_foreign_key "chat_teams", "namespaces", on_delete: :cascade
- add_foreign_key "ci_build_trace_chunks", "ci_builds", column: "build_id", on_delete: :cascade
- add_foreign_key "ci_build_trace_section_names", "projects", on_delete: :cascade
- add_foreign_key "ci_build_trace_sections", "ci_build_trace_section_names", column: "section_name_id", name: "fk_264e112c66", on_delete: :cascade
- add_foreign_key "ci_build_trace_sections", "ci_builds", column: "build_id", name: "fk_4ebe41f502", on_delete: :cascade
- add_foreign_key "ci_build_trace_sections", "projects", on_delete: :cascade
- add_foreign_key "ci_builds", "ci_pipelines", column: "auto_canceled_by_id", name: "fk_a2141b1522", on_delete: :nullify
- add_foreign_key "ci_builds", "ci_pipelines", column: "commit_id", name: "fk_d3130c9a7f", on_delete: :cascade
- add_foreign_key "ci_builds", "ci_stages", column: "stage_id", name: "fk_3a9eaa254d", on_delete: :cascade
- add_foreign_key "ci_builds", "projects", name: "fk_befce0568a", on_delete: :cascade
- add_foreign_key "ci_builds_metadata", "ci_builds", column: "build_id", on_delete: :cascade
- add_foreign_key "ci_builds_metadata", "projects", on_delete: :cascade
- add_foreign_key "ci_builds_runner_session", "ci_builds", column: "build_id", on_delete: :cascade
- add_foreign_key "ci_group_variables", "namespaces", column: "group_id", name: "fk_33ae4d58d8", on_delete: :cascade
- add_foreign_key "ci_job_artifacts", "ci_builds", column: "job_id", on_delete: :cascade
- add_foreign_key "ci_job_artifacts", "projects", on_delete: :cascade
- add_foreign_key "ci_pipeline_chat_data", "chat_names", on_delete: :cascade
- add_foreign_key "ci_pipeline_chat_data", "ci_pipelines", column: "pipeline_id", on_delete: :cascade
- add_foreign_key "ci_pipeline_schedule_variables", "ci_pipeline_schedules", column: "pipeline_schedule_id", name: "fk_41c35fda51", on_delete: :cascade
- add_foreign_key "ci_pipeline_schedules", "projects", name: "fk_8ead60fcc4", on_delete: :cascade
- add_foreign_key "ci_pipeline_schedules", "users", column: "owner_id", name: "fk_9ea99f58d2", on_delete: :nullify
- add_foreign_key "ci_pipeline_variables", "ci_pipelines", column: "pipeline_id", name: "fk_f29c5f4380", on_delete: :cascade
- add_foreign_key "ci_pipelines", "ci_pipeline_schedules", column: "pipeline_schedule_id", name: "fk_3d34ab2e06", on_delete: :nullify
- add_foreign_key "ci_pipelines", "ci_pipelines", column: "auto_canceled_by_id", name: "fk_262d4c2d19", on_delete: :nullify
- add_foreign_key "ci_pipelines", "merge_requests", name: "fk_a23be95014", on_delete: :cascade
- add_foreign_key "ci_pipelines", "projects", name: "fk_86635dbd80", on_delete: :cascade
- add_foreign_key "ci_runner_namespaces", "ci_runners", column: "runner_id", on_delete: :cascade
- add_foreign_key "ci_runner_namespaces", "namespaces", on_delete: :cascade
- add_foreign_key "ci_runner_projects", "projects", name: "fk_4478a6f1e4", on_delete: :cascade
- add_foreign_key "ci_stages", "ci_pipelines", column: "pipeline_id", name: "fk_fb57e6cc56", on_delete: :cascade
- add_foreign_key "ci_stages", "projects", name: "fk_2360681d1d", on_delete: :cascade
- add_foreign_key "ci_trigger_requests", "ci_triggers", column: "trigger_id", name: "fk_b8ec8b7245", on_delete: :cascade
- add_foreign_key "ci_triggers", "projects", name: "fk_e3e63f966e", on_delete: :cascade
- add_foreign_key "ci_triggers", "users", column: "owner_id", name: "fk_e8e10d1964", on_delete: :cascade
- add_foreign_key "ci_variables", "projects", name: "fk_ada5eb64b3", on_delete: :cascade
- add_foreign_key "cluster_groups", "clusters", on_delete: :cascade
- add_foreign_key "cluster_groups", "namespaces", column: "group_id", on_delete: :cascade
- add_foreign_key "cluster_platforms_kubernetes", "clusters", on_delete: :cascade
- add_foreign_key "cluster_projects", "clusters", on_delete: :cascade
- add_foreign_key "cluster_projects", "projects", on_delete: :cascade
- add_foreign_key "cluster_providers_gcp", "clusters", on_delete: :cascade
- add_foreign_key "clusters", "users", on_delete: :nullify
- add_foreign_key "clusters_applications_cert_managers", "clusters", on_delete: :cascade
- add_foreign_key "clusters_applications_helm", "clusters", on_delete: :cascade
- add_foreign_key "clusters_applications_ingress", "clusters", on_delete: :cascade
- add_foreign_key "clusters_applications_jupyter", "clusters", on_delete: :cascade
- add_foreign_key "clusters_applications_jupyter", "oauth_applications", on_delete: :nullify
- add_foreign_key "clusters_applications_knative", "clusters", on_delete: :cascade
- add_foreign_key "clusters_applications_prometheus", "clusters", on_delete: :cascade
- add_foreign_key "clusters_applications_runners", "ci_runners", column: "runner_id", name: "fk_02de2ded36", on_delete: :nullify
- add_foreign_key "clusters_applications_runners", "clusters", on_delete: :cascade
- add_foreign_key "clusters_kubernetes_namespaces", "cluster_projects", on_delete: :nullify
- add_foreign_key "clusters_kubernetes_namespaces", "clusters", on_delete: :cascade
- add_foreign_key "clusters_kubernetes_namespaces", "projects", on_delete: :nullify
- add_foreign_key "container_repositories", "projects"
- add_foreign_key "deploy_keys_projects", "projects", name: "fk_58a901ca7e", on_delete: :cascade
- add_foreign_key "deployments", "projects", name: "fk_b9a3851b82", on_delete: :cascade
- add_foreign_key "environments", "projects", name: "fk_d1c8c1da6a", on_delete: :cascade
- add_foreign_key "events", "projects", on_delete: :cascade
- add_foreign_key "events", "users", column: "author_id", name: "fk_edfd187b6f", on_delete: :cascade
- add_foreign_key "fork_network_members", "fork_networks", on_delete: :cascade
- add_foreign_key "fork_network_members", "projects", column: "forked_from_project_id", name: "fk_b01280dae4", on_delete: :nullify
- add_foreign_key "fork_network_members", "projects", on_delete: :cascade
- add_foreign_key "fork_networks", "projects", column: "root_project_id", name: "fk_e7b436b2b5", on_delete: :nullify
- add_foreign_key "forked_project_links", "projects", column: "forked_to_project_id", name: "fk_434510edb0", on_delete: :cascade
- add_foreign_key "gpg_key_subkeys", "gpg_keys", on_delete: :cascade
- add_foreign_key "gpg_keys", "users", on_delete: :cascade
- add_foreign_key "gpg_signatures", "gpg_key_subkeys", on_delete: :nullify
- add_foreign_key "gpg_signatures", "gpg_keys", on_delete: :nullify
- add_foreign_key "gpg_signatures", "projects", on_delete: :cascade
- add_foreign_key "group_custom_attributes", "namespaces", column: "group_id", on_delete: :cascade
- add_foreign_key "group_group_links", "namespaces", column: "shared_group_id", on_delete: :cascade
- add_foreign_key "group_group_links", "namespaces", column: "shared_with_group_id", on_delete: :cascade
- add_foreign_key "import_export_uploads", "projects", on_delete: :cascade
- add_foreign_key "internal_ids", "namespaces", name: "fk_162941d509", on_delete: :cascade
- add_foreign_key "internal_ids", "projects", on_delete: :cascade
- add_foreign_key "issue_assignees", "issues", name: "fk_b7d881734a", on_delete: :cascade
- add_foreign_key "issue_assignees", "users", name: "fk_5e0c8d9154", on_delete: :cascade
- add_foreign_key "issue_metrics", "issues", on_delete: :cascade
- add_foreign_key "issues", "issues", column: "moved_to_id", name: "fk_a194299be1", on_delete: :nullify
- add_foreign_key "issues", "milestones", name: "fk_96b1dd429c", on_delete: :nullify
- add_foreign_key "issues", "projects", name: "fk_899c8f3231", on_delete: :cascade
- add_foreign_key "issues", "users", column: "author_id", name: "fk_05f1e72feb", on_delete: :nullify
- add_foreign_key "issues", "users", column: "closed_by_id", name: "fk_c63cbf6c25", on_delete: :nullify
- add_foreign_key "issues", "users", column: "updated_by_id", name: "fk_ffed080f01", on_delete: :nullify
- add_foreign_key "label_priorities", "labels", on_delete: :cascade
- add_foreign_key "label_priorities", "projects", on_delete: :cascade
- add_foreign_key "labels", "namespaces", column: "group_id", on_delete: :cascade
- add_foreign_key "labels", "projects", name: "fk_7de4989a69", on_delete: :cascade
- add_foreign_key "lfs_file_locks", "projects", on_delete: :cascade
- add_foreign_key "lfs_file_locks", "users", on_delete: :cascade
- add_foreign_key "lists", "boards", name: "fk_0d3f677137", on_delete: :cascade
- add_foreign_key "lists", "labels", name: "fk_7a5553d60f", on_delete: :cascade
- add_foreign_key "members", "users", name: "fk_2e88fb7ce9", on_delete: :cascade
- add_foreign_key "merge_request_diff_commits", "merge_request_diffs", on_delete: :cascade
- add_foreign_key "merge_request_diff_files", "merge_request_diffs", on_delete: :cascade
- add_foreign_key "merge_request_diffs", "merge_requests", name: "fk_8483f3258f", on_delete: :cascade
- add_foreign_key "merge_request_metrics", "ci_pipelines", column: "pipeline_id", on_delete: :cascade
- add_foreign_key "merge_request_metrics", "merge_requests", on_delete: :cascade
- add_foreign_key "merge_request_metrics", "users", column: "latest_closed_by_id", name: "fk_ae440388cc", on_delete: :nullify
- add_foreign_key "merge_request_metrics", "users", column: "merged_by_id", name: "fk_7f28d925f3", on_delete: :nullify
- add_foreign_key "merge_requests", "ci_pipelines", column: "head_pipeline_id", name: "fk_fd82eae0b9", on_delete: :nullify
- add_foreign_key "merge_requests", "merge_request_diffs", column: "latest_merge_request_diff_id", name: "fk_06067f5644", on_delete: :nullify
- add_foreign_key "merge_requests", "milestones", name: "fk_6a5165a692", on_delete: :nullify
- add_foreign_key "merge_requests", "projects", column: "source_project_id", name: "fk_3308fe130c", on_delete: :nullify
- add_foreign_key "merge_requests", "projects", column: "target_project_id", name: "fk_a6963e8447", on_delete: :cascade
- add_foreign_key "merge_requests", "users", column: "assignee_id", name: "fk_6149611a04", on_delete: :nullify
- add_foreign_key "merge_requests", "users", column: "author_id", name: "fk_e719a85f8a", on_delete: :nullify
- add_foreign_key "merge_requests", "users", column: "merge_user_id", name: "fk_ad525e1f87", on_delete: :nullify
- add_foreign_key "merge_requests", "users", column: "updated_by_id", name: "fk_641731faff", on_delete: :nullify
- add_foreign_key "merge_requests_closing_issues", "issues", on_delete: :cascade
- add_foreign_key "merge_requests_closing_issues", "merge_requests", on_delete: :cascade
- add_foreign_key "milestones", "namespaces", column: "group_id", name: "fk_95650a40d4", on_delete: :cascade
- add_foreign_key "milestones", "projects", name: "fk_9bd0a0c791", on_delete: :cascade
- add_foreign_key "note_diff_files", "notes", column: "diff_note_id", on_delete: :cascade
- add_foreign_key "notes", "projects", name: "fk_99e097b079", on_delete: :cascade
- add_foreign_key "notification_settings", "users", name: "fk_0c95e91db7", on_delete: :cascade
- add_foreign_key "oauth_openid_requests", "oauth_access_grants", column: "access_grant_id", name: "fk_oauth_openid_requests_oauth_access_grants_access_grant_id"
- add_foreign_key "pages_domains", "projects", name: "fk_ea2f6dfc6f", on_delete: :cascade
- add_foreign_key "personal_access_tokens", "users"
- add_foreign_key "pool_repositories", "projects", column: "source_project_id", on_delete: :nullify
- add_foreign_key "pool_repositories", "shards", on_delete: :restrict
- add_foreign_key "project_authorizations", "projects", on_delete: :cascade
- add_foreign_key "project_authorizations", "users", on_delete: :cascade
- add_foreign_key "project_auto_devops", "projects", on_delete: :cascade
- add_foreign_key "project_ci_cd_settings", "projects", name: "fk_24c15d2f2e", on_delete: :cascade
- add_foreign_key "project_custom_attributes", "projects", on_delete: :cascade
- add_foreign_key "project_daily_statistics", "projects", on_delete: :cascade
- add_foreign_key "project_deploy_tokens", "deploy_tokens", on_delete: :cascade
- add_foreign_key "project_deploy_tokens", "projects", on_delete: :cascade
- add_foreign_key "project_error_tracking_settings", "projects", on_delete: :cascade
- add_foreign_key "project_features", "projects", name: "fk_18513d9b92", on_delete: :cascade
- add_foreign_key "project_group_links", "projects", name: "fk_daa8cee94c", on_delete: :cascade
- add_foreign_key "project_import_data", "projects", name: "fk_ffb9ee3a10", on_delete: :cascade
- add_foreign_key "project_mirror_data", "projects", on_delete: :cascade
- add_foreign_key "project_repositories", "projects", on_delete: :cascade
- add_foreign_key "project_repositories", "shards", on_delete: :restrict
- add_foreign_key "project_statistics", "projects", on_delete: :cascade
- add_foreign_key "projects", "pool_repositories", name: "fk_6e5c14658a", on_delete: :nullify
- add_foreign_key "prometheus_metrics", "projects", on_delete: :cascade
- add_foreign_key "protected_branch_merge_access_levels", "protected_branches", name: "fk_8a3072ccb3", on_delete: :cascade
- add_foreign_key "protected_branch_push_access_levels", "protected_branches", name: "fk_9ffc86a3d9", on_delete: :cascade
- add_foreign_key "protected_branches", "projects", name: "fk_7a9c6d93e7", on_delete: :cascade
- add_foreign_key "protected_tag_create_access_levels", "namespaces", column: "group_id"
- add_foreign_key "protected_tag_create_access_levels", "protected_tags", name: "fk_f7dfda8c51", on_delete: :cascade
- add_foreign_key "protected_tag_create_access_levels", "users"
- add_foreign_key "protected_tags", "projects", name: "fk_8e4af87648", on_delete: :cascade
- add_foreign_key "push_event_payloads", "events", name: "fk_36c74129da", on_delete: :cascade
- add_foreign_key "release_links", "releases", on_delete: :cascade
- add_foreign_key "releases", "projects", name: "fk_47fe2a0596", on_delete: :cascade
- add_foreign_key "releases", "users", column: "author_id", name: "fk_8e4456f90f", on_delete: :nullify
- add_foreign_key "remote_mirrors", "projects", on_delete: :cascade
- add_foreign_key "repository_languages", "projects", on_delete: :cascade
- add_foreign_key "resource_label_events", "issues", on_delete: :cascade
- add_foreign_key "resource_label_events", "labels", on_delete: :nullify
- add_foreign_key "resource_label_events", "merge_requests", on_delete: :cascade
- add_foreign_key "resource_label_events", "users", on_delete: :nullify
- add_foreign_key "services", "projects", name: "fk_71cce407f9", on_delete: :cascade
- add_foreign_key "snippets", "projects", name: "fk_be41fd4bb7", on_delete: :cascade
- add_foreign_key "subscriptions", "projects", on_delete: :cascade
- add_foreign_key "suggestions", "notes", on_delete: :cascade
- add_foreign_key "system_note_metadata", "notes", name: "fk_d83a918cb1", on_delete: :cascade
- add_foreign_key "term_agreements", "application_setting_terms", column: "term_id"
- add_foreign_key "term_agreements", "users", on_delete: :cascade
- add_foreign_key "timelogs", "issues", name: "fk_timelogs_issues_issue_id", on_delete: :cascade
- add_foreign_key "timelogs", "merge_requests", name: "fk_timelogs_merge_requests_merge_request_id", on_delete: :cascade
- add_foreign_key "todos", "namespaces", column: "group_id", name: "fk_a27c483435", on_delete: :cascade
- add_foreign_key "todos", "notes", name: "fk_91d1f47b13", on_delete: :cascade
- add_foreign_key "todos", "projects", name: "fk_45054f9c45", on_delete: :cascade
- add_foreign_key "todos", "users", column: "author_id", name: "fk_ccf0373936", on_delete: :cascade
- add_foreign_key "todos", "users", name: "fk_d94154aa95", on_delete: :cascade
- add_foreign_key "trending_projects", "projects", on_delete: :cascade
- add_foreign_key "u2f_registrations", "users"
- add_foreign_key "user_callouts", "users", on_delete: :cascade
- add_foreign_key "user_custom_attributes", "users", on_delete: :cascade
- add_foreign_key "user_interacted_projects", "projects", on_delete: :cascade
- add_foreign_key "user_interacted_projects", "users", on_delete: :cascade
- add_foreign_key "user_preferences", "users", on_delete: :cascade
- add_foreign_key "user_statuses", "users", on_delete: :cascade
- add_foreign_key "user_synced_attributes_metadata", "users", on_delete: :cascade
- add_foreign_key "users", "application_setting_terms", column: "accepted_term_id", name: "fk_789cd90b35", on_delete: :cascade
- add_foreign_key "users_star_projects", "projects", name: "fk_22cd27ddfc", on_delete: :cascade
- add_foreign_key "web_hook_logs", "web_hooks", on_delete: :cascade
- add_foreign_key "web_hooks", "projects", name: "fk_0c8ca6d9d1", on_delete: :cascade
+ execute(IO.read("db/init_structure.sql"))
end
def down
raise ActiveRecord::IrreversibleMigration, "The initial migration is not revertable"
end
end
-
-# rubocop:enable Metrics/AbcSize
-# rubocop:enable Migration/AddConcurrentForeignKey
-# rubocop:enable Style/WordArray
-# rubocop:enable Migration/PreventStrings
-# rubocop:enable Migration/AddLimitToTextColumns
-# rubocop:enable Migration/Datetime
diff --git a/db/migrate/20190103140724_make_legacy_false_default.rb b/db/migrate/20190103140724_make_legacy_false_default.rb
deleted file mode 100644
index 154035f76cd..00000000000
--- a/db/migrate/20190103140724_make_legacy_false_default.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class MakeLegacyFalseDefault < ActiveRecord::Migration[5.0]
- DOWNTIME = false
-
- def change
- change_column_default :cluster_providers_gcp, :legacy_abac, from: true, to: false
- end
-end
diff --git a/db/migrate/20190104182041_cleanup_legacy_artifact_migration.rb b/db/migrate/20190104182041_cleanup_legacy_artifact_migration.rb
deleted file mode 100644
index 11659846a06..00000000000
--- a/db/migrate/20190104182041_cleanup_legacy_artifact_migration.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# frozen_string_literal: true
-
-class CleanupLegacyArtifactMigration < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- class Build < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'ci_builds'
- self.inheritance_column = :_type_disabled
-
- scope :with_legacy_artifacts, -> { where("artifacts_file <> ''") }
- end
-
- def up
- Gitlab::BackgroundMigration.steal('MigrateLegacyArtifacts')
-
- CleanupLegacyArtifactMigration::Build
- .with_legacy_artifacts
- .each_batch(of: 100) do |batch|
- range = batch.pluck('MIN(id)', 'MAX(id)').first
-
- Gitlab::BackgroundMigration::MigrateLegacyArtifacts.new.perform(*range)
- end
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20190107151020_add_services_type_index.rb b/db/migrate/20190107151020_add_services_type_index.rb
deleted file mode 100644
index 26b5bd58750..00000000000
--- a/db/migrate/20190107151020_add_services_type_index.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddServicesTypeIndex < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :services, :type unless index_exists?(:services, :type)
- end
-
- def down
- remove_concurrent_index :services, :type if index_exists?(:services, :type)
- end
-end
diff --git a/db/migrate/20190108192941_remove_partial_index_from_ci_builds_artifacts_file.rb b/db/migrate/20190108192941_remove_partial_index_from_ci_builds_artifacts_file.rb
deleted file mode 100644
index 86de78b831b..00000000000
--- a/db/migrate/20190108192941_remove_partial_index_from_ci_builds_artifacts_file.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class RemovePartialIndexFromCiBuildsArtifactsFile < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'partial_index_ci_builds_on_id_with_legacy_artifacts'
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name(:ci_builds, INDEX_NAME)
- end
-
- def down
- add_concurrent_index(:ci_builds, :id, where: "artifacts_file <> ''", name: INDEX_NAME)
- end
-end
diff --git a/db/migrate/20190109153125_add_merge_request_external_diffs.rb b/db/migrate/20190109153125_add_merge_request_external_diffs.rb
deleted file mode 100644
index d787e78142a..00000000000
--- a/db/migrate/20190109153125_add_merge_request_external_diffs.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddMergeRequestExternalDiffs < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def change
- # Allow the merge request diff to store details about an external file
- add_column :merge_request_diffs, :external_diff, :string # rubocop:disable Migration/PreventStrings
- add_column :merge_request_diffs, :external_diff_store, :integer
- add_column :merge_request_diffs, :stored_externally, :boolean
-
- # The diff for each file is mapped to a range in the external file
- add_column :merge_request_diff_files, :external_diff_offset, :integer
- add_column :merge_request_diff_files, :external_diff_size, :integer
-
- # If the diff is in object storage, it will be null in the database
- change_column_null :merge_request_diff_files, :diff, true
- end
-end
diff --git a/db/migrate/20190114172110_add_domain_to_cluster.rb b/db/migrate/20190114172110_add_domain_to_cluster.rb
deleted file mode 100644
index ebe588d8b77..00000000000
--- a/db/migrate/20190114172110_add_domain_to_cluster.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddDomainToCluster < ActiveRecord::Migration[5.0]
- DOWNTIME = false
-
- def change
- add_column :clusters, :domain, :string # rubocop:disable Migration/PreventStrings
- end
-end
diff --git a/db/migrate/20190115054216_add_error_notification_sent_to_remote_mirrors.rb b/db/migrate/20190115054216_add_error_notification_sent_to_remote_mirrors.rb
deleted file mode 100644
index d8f979a1848..00000000000
--- a/db/migrate/20190115054216_add_error_notification_sent_to_remote_mirrors.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddErrorNotificationSentToRemoteMirrors < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :remote_mirrors, :error_notification_sent, :boolean
- end
-end
diff --git a/db/migrate/20190115092821_add_columns_project_error_tracking_settings.rb b/db/migrate/20190115092821_add_columns_project_error_tracking_settings.rb
deleted file mode 100644
index ee6d63b558f..00000000000
--- a/db/migrate/20190115092821_add_columns_project_error_tracking_settings.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddColumnsProjectErrorTrackingSettings < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :project_error_tracking_settings, :project_name, :string
- add_column :project_error_tracking_settings, :organization_name, :string
-
- change_column_default :project_error_tracking_settings, :enabled, from: true, to: false
-
- change_column_null :project_error_tracking_settings, :api_url, true
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190116234221_add_sorting_fields_to_user_preference.rb b/db/migrate/20190116234221_add_sorting_fields_to_user_preference.rb
deleted file mode 100644
index 5d33f6f4339..00000000000
--- a/db/migrate/20190116234221_add_sorting_fields_to_user_preference.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddSortingFieldsToUserPreference < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def up
- add_column :user_preferences, :issues_sort, :string
- add_column :user_preferences, :merge_requests_sort, :string
- end
- # rubocop:enable Migration/PreventStrings
-
- def down
- remove_column :user_preferences, :issues_sort
- remove_column :user_preferences, :merge_requests_sort
- end
-end
diff --git a/db/migrate/20190130091630_add_local_cached_markdown_version.rb b/db/migrate/20190130091630_add_local_cached_markdown_version.rb
deleted file mode 100644
index 00570e6458c..00000000000
--- a/db/migrate/20190130091630_add_local_cached_markdown_version.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddLocalCachedMarkdownVersion < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :application_settings, :local_markdown_version, :integer, default: 0, null: false
- end
-end
diff --git a/db/migrate/20190206193120_add_index_to_tags.rb b/db/migrate/20190206193120_add_index_to_tags.rb
deleted file mode 100644
index d6c0270cb4f..00000000000
--- a/db/migrate/20190206193120_add_index_to_tags.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToTags < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_tags_on_name_trigram'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :tags, :name, name: INDEX_NAME, using: :gin, opclass: { name: :gin_trgm_ops }
- end
-
- def down
- remove_concurrent_index_by_name(:tags, INDEX_NAME)
- end
-end
diff --git a/db/migrate/20190211131150_add_state_id_to_issuables.rb b/db/migrate/20190211131150_add_state_id_to_issuables.rb
deleted file mode 100644
index c1173eb4249..00000000000
--- a/db/migrate/20190211131150_add_state_id_to_issuables.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddStateIdToIssuables < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- add_column :issues, :state_id, :integer, limit: 2
- add_column :merge_requests, :state_id, :integer, limit: 2
- end
-
- def down
- remove_column :issues, :state_id
- remove_column :merge_requests, :state_id
- end
-end
diff --git a/db/migrate/20190215154930_add_merge_pipelines_enabled_to_ci_cd_settings.rb b/db/migrate/20190215154930_add_merge_pipelines_enabled_to_ci_cd_settings.rb
deleted file mode 100644
index 2a2a216da7d..00000000000
--- a/db/migrate/20190215154930_add_merge_pipelines_enabled_to_ci_cd_settings.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddMergePipelinesEnabledToCiCdSettings < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :project_ci_cd_settings, :merge_pipelines_enabled, :boolean
- end
-end
diff --git a/db/migrate/20190218134158_add_masked_to_ci_variables.rb b/db/migrate/20190218134158_add_masked_to_ci_variables.rb
deleted file mode 100644
index 60dcc0d7af5..00000000000
--- a/db/migrate/20190218134158_add_masked_to_ci_variables.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddMaskedToCiVariables < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :ci_variables, :masked, :boolean, default: false, allow_null: false # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :ci_variables, :masked
- end
-end
diff --git a/db/migrate/20190218134209_add_masked_to_ci_group_variables.rb b/db/migrate/20190218134209_add_masked_to_ci_group_variables.rb
deleted file mode 100644
index c25881410d0..00000000000
--- a/db/migrate/20190218134209_add_masked_to_ci_group_variables.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddMaskedToCiGroupVariables < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :ci_group_variables, :masked, :boolean, default: false, allow_null: false # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :ci_group_variables, :masked
- end
-end
diff --git a/db/migrate/20190219201635_add_asset_proxy_settings.rb b/db/migrate/20190219201635_add_asset_proxy_settings.rb
deleted file mode 100644
index 173b2916c4d..00000000000
--- a/db/migrate/20190219201635_add_asset_proxy_settings.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class AddAssetProxySettings < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- add_column :application_settings, :asset_proxy_enabled, :boolean, default: false, null: false
- add_column :application_settings, :asset_proxy_url, :string
- add_column :application_settings, :asset_proxy_whitelist, :text
- add_column :application_settings, :encrypted_asset_proxy_secret_key, :text
- add_column :application_settings, :encrypted_asset_proxy_secret_key_iv, :string
- end
- # rubocop:enable Migration/AddLimitToTextColumns
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190220142344_add_email_header_and_footer_enabled_flag_to_appearances_table.rb b/db/migrate/20190220142344_add_email_header_and_footer_enabled_flag_to_appearances_table.rb
deleted file mode 100644
index 33fb6b8ef0d..00000000000
--- a/db/migrate/20190220142344_add_email_header_and_footer_enabled_flag_to_appearances_table.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddEmailHeaderAndFooterEnabledFlagToAppearancesTable < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- def up
- add_column_with_default(:appearances, :email_header_and_footer_enabled, :boolean, default: false) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:appearances, :email_header_and_footer_enabled)
- end
-end
diff --git a/db/migrate/20190220150130_add_extra_shas_to_ci_pipelines.rb b/db/migrate/20190220150130_add_extra_shas_to_ci_pipelines.rb
deleted file mode 100644
index 45c7c0949c6..00000000000
--- a/db/migrate/20190220150130_add_extra_shas_to_ci_pipelines.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-class AddExtraShasToCiPipelines < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :ci_pipelines, :source_sha, :binary
- add_column :ci_pipelines, :target_sha, :binary
- end
-end
diff --git a/db/migrate/20190222051615_add_indexes_for_merge_request_diffs_query.rb b/db/migrate/20190222051615_add_indexes_for_merge_request_diffs_query.rb
deleted file mode 100644
index bf7f7b44dec..00000000000
--- a/db/migrate/20190222051615_add_indexes_for_merge_request_diffs_query.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexesForMergeRequestDiffsQuery < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- INDEX_SPECS = [
- [
- :merge_request_metrics,
- :latest_closed_at,
- { where: 'latest_closed_at IS NOT NULL' }
- ],
- [
- :merge_request_metrics,
- [:merge_request_id, :merged_at],
- { where: 'merged_at IS NOT NULL' }
- ],
- [
- :merge_request_diffs,
- [:merge_request_id, :id],
- {
- name: 'index_merge_request_diffs_on_merge_request_id_and_id_partial',
- where: 'NOT stored_externally OR stored_externally IS NULL'
- }
- ]
- ].freeze
-
- disable_ddl_transaction!
-
- def up
- INDEX_SPECS.each do |spec|
- add_concurrent_index(*spec)
- end
- end
-
- def down
- INDEX_SPECS.reverse_each do |spec|
- remove_concurrent_index(*spec)
- end
- end
-end
diff --git a/db/migrate/20190225152525_add_auto_dev_ops_enabled_to_namespaces.rb b/db/migrate/20190225152525_add_auto_dev_ops_enabled_to_namespaces.rb
deleted file mode 100644
index e4757b6bada..00000000000
--- a/db/migrate/20190225152525_add_auto_dev_ops_enabled_to_namespaces.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddAutoDevOpsEnabledToNamespaces < ActiveRecord::Migration[5.0]
- DOWNTIME = false
-
- def change
- add_column :namespaces, :auto_devops_enabled, :boolean # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20190225160301_add_runner_tokens_indexes.rb b/db/migrate/20190225160301_add_runner_tokens_indexes.rb
deleted file mode 100644
index 3230c2809de..00000000000
--- a/db/migrate/20190225160301_add_runner_tokens_indexes.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class AddRunnerTokensIndexes < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- # It seems that `ci_runners.token_encrypted` and `projects.runners_token_encrypted`
- # are non-unique
-
- def up
- add_concurrent_index :ci_runners, :token_encrypted
- add_concurrent_index :projects, :runners_token_encrypted
- add_concurrent_index :namespaces, :runners_token_encrypted, unique: true
- end
-
- def down
- remove_concurrent_index :ci_runners, :token_encrypted
- remove_concurrent_index :projects, :runners_token_encrypted
- remove_concurrent_index :namespaces, :runners_token_encrypted, unique: true
- end
-end
diff --git a/db/migrate/20190228192410_add_multi_line_attributes_to_suggestion.rb b/db/migrate/20190228192410_add_multi_line_attributes_to_suggestion.rb
deleted file mode 100644
index 4daabb6baa8..00000000000
--- a/db/migrate/20190228192410_add_multi_line_attributes_to_suggestion.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddMultiLineAttributesToSuggestion < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :suggestions, :lines_above, :integer, default: 0, allow_null: false # rubocop:disable Migration/AddColumnWithDefault
- add_column_with_default :suggestions, :lines_below, :integer, default: 0, allow_null: false # rubocop:disable Migration/AddColumnWithDefault
- add_column_with_default :suggestions, :outdated, :boolean, default: false, allow_null: false # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_columns :suggestions, :outdated, :lines_above, :lines_below
- end
-end
diff --git a/db/migrate/20190301182457_add_external_hostname_to_ingress_and_knative.rb b/db/migrate/20190301182457_add_external_hostname_to_ingress_and_knative.rb
deleted file mode 100644
index 4cb6053fbe1..00000000000
--- a/db/migrate/20190301182457_add_external_hostname_to_ingress_and_knative.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-class AddExternalHostnameToIngressAndKnative < ActiveRecord::Migration[5.0]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :clusters_applications_ingress, :external_hostname, :string
- add_column :clusters_applications_knative, :external_hostname, :string
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190312071108_add_detected_repository_languages_to_projects.rb b/db/migrate/20190312071108_add_detected_repository_languages_to_projects.rb
deleted file mode 100644
index 82e7ec851c9..00000000000
--- a/db/migrate/20190312071108_add_detected_repository_languages_to_projects.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddDetectedRepositoryLanguagesToProjects < ActiveRecord::Migration[5.0]
- DOWNTIME = false
-
- def change
- add_column :projects, :detected_repository_languages, :boolean # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20190312113229_add_remove_at_to_pages_domains.rb b/db/migrate/20190312113229_add_remove_at_to_pages_domains.rb
deleted file mode 100644
index aa7d2841cd2..00000000000
--- a/db/migrate/20190312113229_add_remove_at_to_pages_domains.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class AddRemoveAtToPagesDomains < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- def change
- add_column :pages_domains, :remove_at, :datetime_with_timezone
- end
-end
diff --git a/db/migrate/20190312113634_add_remove_at_index_to_pages_domains.rb b/db/migrate/20190312113634_add_remove_at_index_to_pages_domains.rb
deleted file mode 100644
index b5ccebd9cfa..00000000000
--- a/db/migrate/20190312113634_add_remove_at_index_to_pages_domains.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddRemoveAtIndexToPagesDomains < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :pages_domains, :remove_at
- end
-
- def down
- remove_concurrent_index :pages_domains, :remove_at
- end
-end
diff --git a/db/migrate/20190315191339_create_merge_request_assignees_table.rb b/db/migrate/20190315191339_create_merge_request_assignees_table.rb
deleted file mode 100644
index 6fc4463f281..00000000000
--- a/db/migrate/20190315191339_create_merge_request_assignees_table.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class CreateMergeRequestAssigneesTable < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- INDEX_NAME = 'index_merge_request_assignees_on_merge_request_id_and_user_id'
-
- def up
- create_table :merge_request_assignees do |t|
- t.references :user, foreign_key: { on_delete: :cascade }, index: true, null: false
- t.references :merge_request, foreign_key: { on_delete: :cascade }, null: false
- end
-
- add_index :merge_request_assignees, [:merge_request_id, :user_id], unique: true, name: INDEX_NAME
- end
-
- def down
- drop_table :merge_request_assignees
- end
-end
diff --git a/db/migrate/20190320174702_add_lets_encrypt_notification_email_to_application_settings.rb b/db/migrate/20190320174702_add_lets_encrypt_notification_email_to_application_settings.rb
deleted file mode 100644
index e0ec10ca204..00000000000
--- a/db/migrate/20190320174702_add_lets_encrypt_notification_email_to_application_settings.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddLetsEncryptNotificationEmailToApplicationSettings < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :application_settings, :lets_encrypt_notification_email, :string
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190322164830_add_auto_ssl_enabled_to_pages_domain.rb b/db/migrate/20190322164830_add_auto_ssl_enabled_to_pages_domain.rb
deleted file mode 100644
index 41552b0e2e3..00000000000
--- a/db/migrate/20190322164830_add_auto_ssl_enabled_to_pages_domain.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddAutoSslEnabledToPagesDomain < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :pages_domains, :auto_ssl_enabled, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :pages_domains, :auto_ssl_enabled
- end
-end
diff --git a/db/migrate/20190325080727_truncate_user_fullname.rb b/db/migrate/20190325080727_truncate_user_fullname.rb
deleted file mode 100644
index 29255d173d8..00000000000
--- a/db/migrate/20190325080727_truncate_user_fullname.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-# rubocop:disable Migration/UpdateLargeTable
-class TruncateUserFullname < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- truncated_name = Arel.sql('SUBSTRING(name from 1 for 128)')
- where_clause = Arel.sql("LENGTH(name) > 128")
-
- update_column_in_batches(:users, :name, truncated_name) do |table, query|
- query.where(where_clause)
- end
- end
-
- def down
- # noop
- end
-end
diff --git a/db/migrate/20190325105715_add_fields_to_user_preferences.rb b/db/migrate/20190325105715_add_fields_to_user_preferences.rb
deleted file mode 100644
index 78ccbd65c84..00000000000
--- a/db/migrate/20190325105715_add_fields_to_user_preferences.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddFieldsToUserPreferences < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- def up
- add_column(:user_preferences, :timezone, :string) # rubocop:disable Migration/PreventStrings
- add_column(:user_preferences, :time_display_relative, :boolean)
- add_column(:user_preferences, :time_format_in_24h, :boolean)
- end
-
- def down
- remove_column(:user_preferences, :timezone)
- remove_column(:user_preferences, :time_display_relative)
- remove_column(:user_preferences, :time_format_in_24h)
- end
-end
diff --git a/db/migrate/20190325165127_add_managed_to_cluster.rb b/db/migrate/20190325165127_add_managed_to_cluster.rb
deleted file mode 100644
index 14ed4db143e..00000000000
--- a/db/migrate/20190325165127_add_managed_to_cluster.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddManagedToCluster < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- def up
- add_column_with_default(:clusters, :managed, :boolean, default: true) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:clusters, :managed)
- end
-end
diff --git a/db/migrate/20190326164045_import_common_metrics_knative.rb b/db/migrate/20190326164045_import_common_metrics_knative.rb
deleted file mode 100644
index 6b331755774..00000000000
--- a/db/migrate/20190326164045_import_common_metrics_knative.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class ImportCommonMetricsKnative < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- ::Gitlab::DatabaseImporters::CommonMetrics::Importer.new.execute
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20190327163904_add_notification_email_to_notification_settings.rb b/db/migrate/20190327163904_add_notification_email_to_notification_settings.rb
deleted file mode 100644
index d8a7e96f902..00000000000
--- a/db/migrate/20190327163904_add_notification_email_to_notification_settings.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddNotificationEmailToNotificationSettings < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :notification_settings, :notification_email, :string
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190329085614_add_lets_encrypt_terms_of_service_accepted_to_application_settings.rb b/db/migrate/20190329085614_add_lets_encrypt_terms_of_service_accepted_to_application_settings.rb
deleted file mode 100644
index 36641e24e45..00000000000
--- a/db/migrate/20190329085614_add_lets_encrypt_terms_of_service_accepted_to_application_settings.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddLetsEncryptTermsOfServiceAcceptedToApplicationSettings < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:application_settings, :lets_encrypt_terms_of_service_accepted, :boolean, default: false) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :application_settings, :lets_encrypt_terms_of_service_accepted
- end
-end
diff --git a/db/migrate/20190402150158_backport_enterprise_schema.rb b/db/migrate/20190402150158_backport_enterprise_schema.rb
deleted file mode 100644
index ba5f700a877..00000000000
--- a/db/migrate/20190402150158_backport_enterprise_schema.rb
+++ /dev/null
@@ -1,2195 +0,0 @@
-# frozen_string_literal: true
-
-# rubocop: disable Metrics/AbcSize
-# rubocop: disable Migration/Datetime
-# rubocop: disable Migration/PreventStrings
-# rubocop: disable Migration/AddLimitToTextColumns
-class BackportEnterpriseSchema < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- APPLICATION_SETTINGS_COLUMNS = [
- { type: :boolean, name: :elasticsearch_indexing, default: false, null: false },
- { type: :boolean, name: :elasticsearch_search, default: false, null: false },
- { type: :integer, name: :shared_runners_minutes, default: 0, null: false },
- { type: :bigint, name: :repository_size_limit, default: 0, null: true },
- { type: :string, name: :elasticsearch_url, default: "http://localhost:9200" },
- { type: :boolean, name: :elasticsearch_aws, default: false, null: false },
- { type: :string, name: :elasticsearch_aws_region, default: "us-east-1", null: true },
- { type: :string, name: :elasticsearch_aws_access_key, default: nil, null: true },
- { type: :string, name: :elasticsearch_aws_secret_access_key, default: nil, null: true },
- { type: :integer, name: :geo_status_timeout, default: 10, null: true },
- { type: :boolean, name: :elasticsearch_experimental_indexer, default: nil, null: true },
- { type: :boolean, name: :check_namespace_plan, default: false, null: false },
- { type: :integer, name: :mirror_max_delay, default: 300, null: false },
- { type: :integer, name: :mirror_max_capacity, default: 100, null: false },
- { type: :integer, name: :mirror_capacity_threshold, default: 50, null: false },
- { type: :boolean, name: :slack_app_enabled, default: false },
- { type: :string, name: :slack_app_id },
- { type: :string, name: :slack_app_secret },
- { type: :string, name: :slack_app_verification_token },
- { type: :boolean, name: :allow_group_owners_to_manage_ldap, default: true, null: false },
- { type: :integer, name: :default_project_creation, default: 2, null: false },
- { type: :string, name: :email_additional_text },
- { type: :integer, name: :file_template_project_id },
- { type: :boolean, name: :pseudonymizer_enabled, default: false, null: false },
- { type: :boolean, name: :snowplow_enabled, default: false, null: false },
- { type: :string, name: :snowplow_collector_uri },
- { type: :string, name: :snowplow_site_id },
- { type: :string, name: :snowplow_cookie_domain },
- { type: :integer, name: :custom_project_templates_group_id },
- { type: :boolean, name: :elasticsearch_limit_indexing, default: false, null: false },
- { type: :string, name: :geo_node_allowed_ips, default: '0.0.0.0/0, ::/0' }
- ].freeze
-
- NAMESPACE_COLUMNS = [
- { type: :integer, name: :custom_project_templates_group_id },
- { type: :integer, name: :file_template_project_id },
- { type: :string, name: :ldap_sync_error },
- { type: :datetime, name: :ldap_sync_last_successful_update_at },
- { type: :datetime, name: :ldap_sync_last_sync_at },
- { type: :datetime, name: :ldap_sync_last_update_at },
- { type: :integer, name: :plan_id },
- { type: :integer, name: :project_creation_level },
- { type: :bigint, name: :repository_size_limit },
- { type: :string, name: :saml_discovery_token },
- { type: :integer, name: :shared_runners_minutes_limit },
- { type: :datetime_with_timezone, name: :trial_ends_on },
- { type: :integer, name: :extra_shared_runners_minutes_limit }
- ].freeze
-
- PROJECT_MIRROR_DATA_COLUMNS = [
- { type: :datetime_with_timezone, name: :last_successful_update_at },
- { type: :datetime_with_timezone, name: :last_update_at },
- { type: :datetime, name: :last_update_scheduled_at },
- { type: :datetime, name: :last_update_started_at },
- { type: :datetime, name: :next_execution_timestamp }
- ].freeze
-
- PROJECTS_COLUMNS = [
- { type: :boolean, name: :disable_overriding_approvers_per_merge_request },
- { type: :string, name: :external_webhook_token },
- { type: :text, name: :issues_template },
- { type: :boolean, name: :merge_requests_author_approval },
- { type: :boolean, name: :merge_requests_disable_committers_approval },
- { type: :boolean, name: :merge_requests_require_code_owner_approval },
- { type: :text, name: :merge_requests_template },
- { type: :datetime, name: :mirror_last_successful_update_at },
- { type: :datetime, name: :mirror_last_update_at },
- { type: :boolean, name: :mirror_overwrites_diverged_branches },
- { type: :integer, name: :mirror_user_id },
- { type: :boolean, name: :only_mirror_protected_branches },
- { type: :boolean, name: :packages_enabled },
- { type: :boolean, name: :pull_mirror_available_overridden },
- { type: :bigint, name: :repository_size_limit },
- { type: :boolean, name: :require_password_to_approve }
- ].freeze
-
- USERS_COLUMNS = [
- { type: :datetime, name: :admin_email_unsubscribed_at },
- { type: :boolean, name: :email_opted_in },
- { type: :datetime, name: :email_opted_in_at },
- { type: :string, name: :email_opted_in_ip },
- { type: :integer, name: :email_opted_in_source_id },
- { type: :integer, name: :group_view },
- { type: :integer, name: :managing_group_id },
- { type: :text, name: :note },
- { type: :integer, name: :roadmap_layout, limit: 2 },
- { type: :boolean, name: :support_bot },
- { type: :integer, name: :bot_type, limit: 2 }
- ].freeze
-
- class ApplicationSetting < ActiveRecord::Base
- self.table_name = 'application_settings'
- end
-
- class ProtectedBranchMergeAccessLevels < ActiveRecord::Base
- self.table_name = 'protected_branch_merge_access_levels'
- end
-
- class ProtectedBranchPushAccessLevels < ActiveRecord::Base
- self.table_name = 'protected_branch_push_access_levels'
- end
-
- class Project < ActiveRecord::Base
- self.table_name = 'projects'
- end
-
- def up
- check_schema!
-
- create_missing_tables
-
- update_appearances
- update_application_settings
- update_boards_table
- update_clusters_applications_prometheus
- update_identities
- update_issues
- update_lists
- update_members
- update_merge_requests
- update_notes
- update_ci_builds
- update_environments
- update_namespaces
- update_notification_settings
- update_project_mirror_data
- update_project_statistics
- update_projects
- update_protected_branch_merge_access_levels
- update_protected_branch_push_access_levels
- update_resource_label_events
- update_user_preferences
- update_users
- update_web_hooks
- update_geo_nodes
-
- add_missing_foreign_keys
- end
-
- def down
- # This migration can not be reverted in a production environment, as doing
- # so would lead to data loss for existing EE installations.
- return if !Rails.env.test? && !Rails.env.development?
-
- remove_foreign_keys
- remove_tables
-
- revert_appearances
- revert_application_settings
- revert_boards_table
- revert_clusters_applications_prometheus
- revert_identities
- revert_issues
- revert_lists
- revert_members
- revert_merge_requests
- revert_notes
- revert_ci_builds
- revert_environments
- revert_namespaces
- revert_notification_settings
- revert_project_mirror_data
- revert_project_statistics
- revert_projects
- revert_protected_branch_merge_access_levels
- revert_protected_branch_push_access_levels
- revert_resource_label_events
- revert_user_preferences
- revert_users
- revert_web_hooks
- end
-
- def add_column_if_not_exists(table, name, *args)
- add_column(table, name, *args) unless column_exists?(table, name)
- end
-
- def remove_column_if_exists(table, column)
- remove_column(table, column) if column_exists?(table, column)
- end
-
- def drop_table_if_exists(table)
- # rubocop:disable Migration/DropTable
- drop_table(table) if table_exists?(table)
- # rubocop:enable Migration/DropTable
- end
-
- def add_column_with_default_if_not_exists(table, name, type, **args)
- unless column_exists?(table, name)
- add_column_with_default(table, name, type, **args) # rubocop:disable Migration/AddColumnWithDefault
- end
- end
-
- def add_missing_columns(table, columns)
- columns.each do |column|
- next if table.column_exists?(column[:name])
-
- # We can't use (public_)send here as this doesn't work with
- # `datetime_with_timezone` for some reason.
- table.column(
- column[:name],
- column[:type],
- default: column[:default],
- null: column.fetch(:null, true),
- limit: column[:limit]
- )
- end
- end
-
- def remove_columns(table, columns)
- columns.each do |column|
- remove_column_if_exists(table, column[:name])
- end
- end
-
- def create_table_if_not_exists(name, **args, &block)
- return if table_exists?(name)
-
- create_table(name, **args, &block)
- end
-
- def add_concurrent_foreign_key(source, target, column:, on_delete: nil, name: nil)
- # We don't want redundant VALIDATE CONSTRAINT statements to run for existing
- # foreign keys, as this can take a long time on large installations such as
- # GitLab.com.
- return if foreign_key_exists?(source, target, column: column)
-
- super
- end
-
- def update_appearances
- add_column_if_not_exists(:appearances, :updated_by, :integer)
- end
-
- def revert_appearances
- remove_column_if_exists(:namespaces, :updated_by)
- end
-
- def update_application_settings
- # In the CE schema this column allows NULL values even though there is a
- # default value. In EE this column is not allowed to be NULL. This means
- # that if we want to add a NOT NULL clause below, we must ensure no existing
- # data would violate this clause.
- ApplicationSetting
- .where(password_authentication_enabled_for_git: nil)
- .update_all(password_authentication_enabled_for_git: true)
-
- change_column_null(
- :application_settings,
- :password_authentication_enabled_for_git,
- false
- )
-
- # This table will only have a single row, and all operations here will be
- # very fast. As such we merge all of this into a single ALTER TABLE
- # statement.
- change_table(:application_settings) do |t|
- t.text(:help_text) unless t.column_exists?(:help_text)
-
- add_missing_columns(t, APPLICATION_SETTINGS_COLUMNS)
- end
-
- add_concurrent_index(
- :application_settings,
- :custom_project_templates_group_id
- )
-
- add_concurrent_index(
- :application_settings,
- :file_template_project_id
- )
- end
-
- def revert_application_settings
- change_column_null(
- :application_settings,
- :password_authentication_enabled_for_git,
- true
- )
-
- remove_concurrent_index(
- :application_settings,
- :custom_project_templates_group_id
- )
-
- remove_concurrent_index(
- :application_settings,
- :file_template_project_id
- )
-
- remove_columns(:application_settings, APPLICATION_SETTINGS_COLUMNS)
- end
-
- def update_boards_table
- add_column_if_not_exists(:boards, :milestone_id, :integer)
- add_column_if_not_exists(:boards, :weight, :integer)
-
- add_column_with_default_if_not_exists(
- :boards,
- :name,
- :string,
- default: 'Development'
- )
-
- add_concurrent_index(:boards, :milestone_id)
- end
-
- def revert_boards_table
- remove_concurrent_index(:boards, :milestone_id)
- remove_column_if_exists(:boards, :name)
- remove_column_if_exists(:boards, :weight)
- remove_column_if_exists(:boards, :milestone_id)
- end
-
- def update_clusters_applications_prometheus
- add_column_if_not_exists(
- :clusters_applications_prometheus,
- :encrypted_alert_manager_token,
- :string
- )
-
- add_column_if_not_exists(
- :clusters_applications_prometheus,
- :encrypted_alert_manager_token_iv,
- :string
- )
-
- add_column_if_not_exists(
- :clusters_applications_prometheus,
- :last_update_started_at,
- :datetime_with_timezone
- )
- end
-
- def revert_clusters_applications_prometheus
- remove_column_if_exists(
- :clusters_applications_prometheus,
- :encrypted_alert_manager_token
- )
-
- remove_column_if_exists(
- :clusters_applications_prometheus,
- :encrypted_alert_manager_token_iv
- )
-
- remove_column_if_exists(
- :clusters_applications_prometheus,
- :last_update_started_at
- )
- end
-
- def update_identities
- add_column_if_not_exists(:identities, :saml_provider_id, :integer)
- add_column_if_not_exists(:identities, :secondary_extern_uid, :string)
-
- add_concurrent_index(
- :identities,
- :saml_provider_id,
- where: 'saml_provider_id IS NOT NULL'
- )
- end
-
- def revert_identities
- remove_column_if_exists(:identities, :saml_provider_id)
- remove_column_if_exists(:identities, :secondary_extern_uid)
- end
-
- def update_issues
- add_column_if_not_exists(:issues, :service_desk_reply_to, :string)
- add_column_if_not_exists(:issues, :weight, :integer)
- end
-
- def revert_issues
- remove_column_if_exists(:issues, :service_desk_reply_to)
- remove_column_if_exists(:issues, :weight)
- end
-
- def update_lists
- add_column_if_not_exists(:lists, :milestone_id, :integer)
- add_column_if_not_exists(:lists, :user_id, :integer)
-
- add_concurrent_index(:lists, :milestone_id)
- add_concurrent_index(:lists, :user_id)
- end
-
- def revert_lists
- remove_column_if_exists(:lists, :milestone_id)
- remove_column_if_exists(:lists, :user_id)
- end
-
- def update_members
- add_column_with_default_if_not_exists(
- :members,
- :ldap,
- :boolean,
- default: false
- )
-
- add_column_with_default_if_not_exists(
- :members,
- :override,
- :boolean,
- default: false
- )
- end
-
- def revert_members
- remove_column_if_exists(:members, :ldap)
- remove_column_if_exists(:members, :override)
- end
-
- def update_merge_requests
- add_column_if_not_exists(:merge_requests, :approvals_before_merge, :integer)
- end
-
- def revert_merge_requests
- remove_column_if_exists(:merge_requests, :approvals_before_merge)
- end
-
- def update_notes
- add_column_if_not_exists(:notes, :review_id, :bigint)
- add_concurrent_index(:notes, :review_id)
- end
-
- def revert_notes
- remove_column_if_exists(:notes, :review_id)
- end
-
- def update_ci_builds
- add_concurrent_index(
- :ci_builds,
- [:name],
- name: 'index_ci_builds_on_name_for_security_products_values',
- where: "
- (
- (name)::text = ANY (
- ARRAY[
- ('container_scanning'::character varying)::text,
- ('dast'::character varying)::text,
- ('dependency_scanning'::character varying)::text,
- ('license_management'::character varying)::text,
- ('sast'::character varying)::text
- ]
- )
- )"
- )
- end
-
- def revert_ci_builds
- remove_concurrent_index_by_name(
- :ci_builds,
- 'index_ci_builds_on_name_for_security_products_values'
- )
- end
-
- def update_environments
- return if index_exists?(:environments, :name, name: 'index_environments_on_name_varchar_pattern_ops')
-
- execute('CREATE INDEX CONCURRENTLY index_environments_on_name_varchar_pattern_ops ON environments (name varchar_pattern_ops);')
- end
-
- def revert_environments
- remove_concurrent_index_by_name(
- :environments,
- 'index_environments_on_name_varchar_pattern_ops'
- )
- end
-
- def update_namespaces
- change_table(:namespaces) do |t|
- add_missing_columns(t, NAMESPACE_COLUMNS)
- end
-
- add_column_with_default_if_not_exists(
- :namespaces,
- :ldap_sync_status,
- :string,
- default: 'ready'
- )
-
- add_column_with_default_if_not_exists(
- :namespaces,
- :membership_lock,
- :boolean,
- default: false,
- allow_null: true
- )
-
- # When `add_concurrent_index` runs, it for some reason incorrectly
- # determines this index does not exist when it does. To work around this, we
- # check the existence by name ourselves.
- unless index_exists_by_name?(:namespaces, 'index_namespaces_on_custom_project_templates_group_id_and_type')
- add_concurrent_index(
- :namespaces,
- %i[custom_project_templates_group_id type],
- where: "(custom_project_templates_group_id IS NOT NULL)"
- )
- end
-
- add_concurrent_index(:namespaces, :file_template_project_id)
- add_concurrent_index(:namespaces, :ldap_sync_last_successful_update_at)
- add_concurrent_index(:namespaces, :ldap_sync_last_update_at)
- add_concurrent_index(:namespaces, :plan_id)
- add_concurrent_index(
- :namespaces,
- :trial_ends_on,
- where: "(trial_ends_on IS NOT NULL)"
- )
-
- unless index_exists_by_name?(:namespaces, 'index_namespaces_on_shared_and_extra_runners_minutes_limit')
- add_concurrent_index(
- :namespaces,
- %i[shared_runners_minutes_limit extra_shared_runners_minutes_limit],
- name: 'index_namespaces_on_shared_and_extra_runners_minutes_limit'
- )
- end
- end
-
- def revert_namespaces
- remove_columns(:namespaces, NAMESPACE_COLUMNS)
- remove_column_if_exists(:namespaces, :ldap_sync_status)
- remove_column_if_exists(:namespaces, :membership_lock)
-
- remove_concurrent_index_by_name(
- :namespaces,
- 'index_namespaces_on_shared_and_extra_runners_minutes_limit'
- )
- end
-
- def update_notification_settings
- add_column_if_not_exists(:notification_settings, :new_epic, :boolean)
- end
-
- def revert_notification_settings
- remove_column_if_exists(:notification_settings, :new_epic)
- end
-
- def update_project_mirror_data
- change_table(:project_mirror_data) do |t|
- add_missing_columns(t, PROJECT_MIRROR_DATA_COLUMNS)
- end
-
- add_column_with_default_if_not_exists(
- :project_mirror_data,
- :retry_count,
- :integer,
- default: 0
- )
-
- add_concurrent_index(:project_mirror_data, :last_successful_update_at)
-
- add_concurrent_index(
- :project_mirror_data,
- %i[next_execution_timestamp retry_count],
- name: 'index_mirror_data_on_next_execution_and_retry_count'
- )
- end
-
- def revert_project_mirror_data
- remove_columns(:project_mirror_data, PROJECT_MIRROR_DATA_COLUMNS)
-
- remove_concurrent_index_by_name(
- :project_mirror_data,
- 'index_mirror_data_on_next_execution_and_retry_count'
- )
-
- remove_column_if_exists(:project_statistics, :retry_count)
- end
-
- def update_project_statistics
- add_column_with_default_if_not_exists(
- :project_statistics,
- :shared_runners_seconds,
- :bigint,
- default: 0
- )
-
- add_column_if_not_exists(
- :project_statistics,
- :shared_runners_seconds_last_reset,
- :datetime
- )
- end
-
- def revert_project_statistics
- remove_column_if_exists(:project_statistics, :shared_runners_seconds)
-
- remove_column_if_exists(
- :project_statistics,
- :shared_runners_seconds_last_reset
- )
- end
-
- def update_projects
- change_table(:projects) do |t|
- add_missing_columns(t, PROJECTS_COLUMNS)
- end
-
- change_column_null(:projects, :merge_requests_rebase_enabled, true)
-
- add_column_with_default_if_not_exists(
- :projects,
- :mirror,
- :boolean,
- default: false
- )
-
- add_column_with_default_if_not_exists(
- :projects,
- :mirror_trigger_builds,
- :boolean,
- default: false
- )
-
- add_column_with_default_if_not_exists(
- :projects,
- :reset_approvals_on_push,
- :boolean,
- default: true,
- allow_null: true
- )
-
- add_column_with_default_if_not_exists(
- :projects,
- :service_desk_enabled,
- :boolean,
- default: true,
- allow_null: true
- )
-
- add_column_with_default_if_not_exists(
- :projects,
- :approvals_before_merge,
- :integer,
- default: 0
- )
-
- add_concurrent_index(
- :projects,
- %i[archived pending_delete merge_requests_require_code_owner_approval],
- name: 'projects_requiring_code_owner_approval',
- where: '((pending_delete = false) AND (archived = false) AND (merge_requests_require_code_owner_approval = true))'
- )
-
- add_concurrent_index(
- :projects,
- %i[id repository_storage last_repository_updated_at],
- name: 'idx_projects_on_repository_storage_last_repository_updated_at'
- )
-
- add_concurrent_index(
- :projects,
- :id,
- name: 'index_projects_on_mirror_and_mirror_trigger_builds_both_true',
- where: '((mirror IS TRUE) AND (mirror_trigger_builds IS TRUE))'
- )
-
- add_concurrent_index(:projects, :mirror_last_successful_update_at)
- end
-
- def revert_projects
- remove_columns(:projects, PROJECTS_COLUMNS)
-
- Project
- .where(merge_requests_rebase_enabled: nil)
- .update_all(merge_requests_rebase_enabled: false)
-
- change_column_null(:projects, :merge_requests_rebase_enabled, false)
-
- remove_column_if_exists(:projects, :mirror)
- remove_column_if_exists(:projects, :mirror_trigger_builds)
- remove_column_if_exists(:projects, :reset_approvals_on_push)
- remove_column_if_exists(:projects, :service_desk_enabled)
- remove_column_if_exists(:projects, :approvals_before_merge)
-
- remove_concurrent_index_by_name(
- :projects,
- 'projects_requiring_code_owner_approval'
- )
-
- remove_concurrent_index_by_name(
- :projects,
- 'idx_projects_on_repository_storage_last_repository_updated_at'
- )
-
- remove_concurrent_index_by_name(
- :projects,
- 'index_projects_on_mirror_and_mirror_trigger_builds_both_true'
- )
- end
-
- def update_protected_branch_merge_access_levels
- change_column_null(:protected_branch_merge_access_levels, :access_level, true)
-
- add_column_if_not_exists(
- :protected_branch_merge_access_levels,
- :group_id,
- :integer
- )
-
- add_column_if_not_exists(
- :protected_branch_merge_access_levels,
- :user_id,
- :integer
- )
-
- add_concurrent_index(:protected_branch_merge_access_levels, :group_id)
- add_concurrent_index(:protected_branch_merge_access_levels, :user_id)
- end
-
- def revert_protected_branch_merge_access_levels
- ProtectedBranchMergeAccessLevels
- .where(access_level: nil)
- .update_all(access_level: false)
-
- change_column_null(
- :protected_branch_merge_access_levels,
- :access_level,
- false
- )
-
- remove_column_if_exists(:protected_branch_merge_access_levels, :group_id)
- remove_column_if_exists(:protected_branch_merge_access_levels, :user_id)
- end
-
- def update_protected_branch_push_access_levels
- change_column_null(
- :protected_branch_push_access_levels,
- :access_level,
- true
- )
-
- add_column_if_not_exists(
- :protected_branch_push_access_levels,
- :group_id,
- :integer
- )
-
- add_column_if_not_exists(
- :protected_branch_push_access_levels,
- :user_id,
- :integer
- )
-
- add_concurrent_index(:protected_branch_push_access_levels, :group_id)
- add_concurrent_index(:protected_branch_push_access_levels, :user_id)
- end
-
- def revert_protected_branch_push_access_levels
- ProtectedBranchPushAccessLevels
- .where(access_level: nil)
- .update_all(access_level: false)
-
- change_column_null(
- :protected_branch_push_access_levels,
- :access_level,
- false
- )
-
- remove_column_if_exists(:protected_branch_push_access_levels, :group_id)
- remove_column_if_exists(:protected_branch_push_access_levels, :user_id)
- end
-
- def update_resource_label_events
- add_column_if_not_exists(:resource_label_events, :epic_id, :integer)
- add_concurrent_index(:resource_label_events, :epic_id)
- end
-
- def revert_resource_label_events
- remove_column_if_exists(:resource_label_events, :epic_id)
- end
-
- def update_user_preferences
- add_column_with_default_if_not_exists(
- :user_preferences,
- :epic_notes_filter,
- :integer,
- default: 0,
- limit: 2
- )
-
- add_column_if_not_exists(:user_preferences, :epics_sort, :string)
- add_column_if_not_exists(:user_preferences, :roadmap_epics_state, :integer)
- add_column_if_not_exists(:user_preferences, :roadmaps_sort, :string)
- end
-
- def revert_user_preferences
- remove_column_if_exists(:user_preferences, :epic_notes_filter)
- remove_column_if_exists(:user_preferences, :epics_sort)
- remove_column_if_exists(:user_preferences, :roadmap_epics_state)
- remove_column_if_exists(:user_preferences, :roadmaps_sort)
- end
-
- def update_users
- add_column_with_default_if_not_exists(
- :users,
- :auditor,
- :boolean,
- default: false
- )
-
- change_table(:users) do |t|
- add_missing_columns(t, USERS_COLUMNS)
- end
-
- add_concurrent_index(:users, :group_view)
- add_concurrent_index(:users, :managing_group_id)
- add_concurrent_index(:users, :support_bot)
- add_concurrent_index(:users, :bot_type)
-
- add_concurrent_index(
- :users,
- :state,
- name: 'index_users_on_state_and_internal_attrs',
- where: '((ghost <> true) AND (support_bot <> true))'
- )
-
- internal_index = 'index_users_on_state_and_internal'
-
- remove_concurrent_index(:users, :state, name: internal_index)
-
- add_concurrent_index(
- :users,
- :state,
- name: internal_index,
- where: '((ghost <> true) AND (bot_type IS NULL))'
- )
- end
-
- def revert_users
- remove_column_if_exists(:users, :auditor)
- remove_columns(:users, USERS_COLUMNS)
-
- remove_concurrent_index_by_name(
- :users,
- 'index_users_on_state_and_internal_attrs'
- )
-
- internal_index = 'index_users_on_state_and_internal'
-
- remove_concurrent_index(:users, :state, name: internal_index)
- add_concurrent_index(:users, :state, name: internal_index)
- end
-
- def update_web_hooks
- add_column_if_not_exists(:web_hooks, :group_id, :integer)
- end
-
- def revert_web_hooks
- remove_column_if_exists(:web_hooks, :group_id)
- end
-
- def update_geo_nodes
- add_column_if_not_exists(:geo_nodes, :internal_url, :string)
- end
-
- def revert_geo_nodes
- remove_column_if_exists(:geo_nodes, :internal_url)
- end
-
- # Some users may have upgraded to EE at some point but downgraded to
- # CE v11.11.3. As a result, their EE tables may not be in the right
- # state. Here we check for these such cases and attempt to guide the
- # user into recovering from this state by upgrading to v11.11.3 EE
- # before installing v12.0.0 CE.
- def check_schema!
- # The following cases will fail later when this migration attempts
- # to add a foreign key for non-existent columns.
- columns_to_check = [
- [:epics, :parent_id], # Added in GitLab 11.7
- [:geo_event_log, :cache_invalidation_event_id], # Added in GitLab 11.4
- [:vulnerability_feedback, :merge_request_id] # Added in GitLab 11.9
- ].freeze
-
- columns_to_check.each do |table, column|
- check_ee_columns!(table, column)
- end
- end
-
- def check_ee_columns!(table, column)
- return unless table_exists?(table)
- return if column_exists?(table, column)
-
- raise_ee_migration_error!(table, column)
- end
-
- def raise_ee_migration_error!(table, column)
- message = "Your database is missing the '#{column}' column from the '#{table}' table that is present for GitLab EE."
-
- message +=
- if ::Gitlab.ee?
- "\nUpgrade your GitLab instance to 11.11.3 EE first!"
- else
- <<~MSG
-
- Even though it looks like you're running a CE installation, it appears
- you may have installed GitLab EE at some point. To migrate to GitLab 12.0:
-
- 1. Install GitLab 11.11.3 EE
- 2. Install GitLab 12.0.x CE
- MSG
- end
-
- raise StandardError, message
- end
-
- def create_missing_tables
- create_table_if_not_exists "approval_merge_request_rule_sources", id: :bigserial do |t|
- t.bigint "approval_merge_request_rule_id", null: false
- t.bigint "approval_project_rule_id", null: false
- t.index %w[approval_merge_request_rule_id], name: "index_approval_merge_request_rule_sources_1", unique: true, using: :btree
- t.index %w[approval_project_rule_id], name: "index_approval_merge_request_rule_sources_2", using: :btree
- end
-
- create_table_if_not_exists "approval_merge_request_rules", id: :bigserial do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "merge_request_id", null: false
- t.integer "approvals_required", limit: 2, default: 0, null: false
- t.boolean "code_owner", default: false, null: false
- t.string "name", null: false
- t.index %w[merge_request_id code_owner name], name: "approval_rule_name_index_for_code_owners", unique: true, where: "(code_owner = true)", using: :btree
- t.index %w[merge_request_id code_owner], name: "index_approval_merge_request_rules_1", using: :btree
- end
-
- create_table_if_not_exists "approval_merge_request_rules_approved_approvers", id: :bigserial do |t|
- t.bigint "approval_merge_request_rule_id", null: false
- t.integer "user_id", null: false
- t.index %w[approval_merge_request_rule_id user_id], name: "index_approval_merge_request_rules_approved_approvers_1", unique: true, using: :btree
- t.index %w[user_id], name: "index_approval_merge_request_rules_approved_approvers_2", using: :btree
- end
-
- create_table_if_not_exists "approval_merge_request_rules_groups", id: :bigserial do |t|
- t.bigint "approval_merge_request_rule_id", null: false
- t.integer "group_id", null: false
- t.index %w[approval_merge_request_rule_id group_id], name: "index_approval_merge_request_rules_groups_1", unique: true, using: :btree
- t.index %w[group_id], name: "index_approval_merge_request_rules_groups_2", using: :btree
- end
-
- create_table_if_not_exists "approval_merge_request_rules_users", id: :bigserial do |t|
- t.bigint "approval_merge_request_rule_id", null: false
- t.integer "user_id", null: false
- t.index %w[approval_merge_request_rule_id user_id], name: "index_approval_merge_request_rules_users_1", unique: true, using: :btree
- t.index %w[user_id], name: "index_approval_merge_request_rules_users_2", using: :btree
- end
-
- create_table_if_not_exists "approval_project_rules", id: :bigserial do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "project_id", null: false
- t.integer "approvals_required", limit: 2, default: 0, null: false
- t.string "name", null: false
- t.index %w[project_id], name: "index_approval_project_rules_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "approval_project_rules_groups", id: :bigserial do |t|
- t.bigint "approval_project_rule_id", null: false
- t.integer "group_id", null: false
- t.index %w[approval_project_rule_id group_id], name: "index_approval_project_rules_groups_1", unique: true, using: :btree
- t.index %w[group_id], name: "index_approval_project_rules_groups_2", using: :btree
- end
-
- create_table_if_not_exists "approval_project_rules_users", id: :bigserial do |t|
- t.bigint "approval_project_rule_id", null: false
- t.integer "user_id", null: false
- t.index %w[approval_project_rule_id user_id], name: "index_approval_project_rules_users_1", unique: true, using: :btree
- t.index %w[user_id], name: "index_approval_project_rules_users_2", using: :btree
- end
-
- create_table_if_not_exists "approvals" do |t|
- t.integer "merge_request_id", null: false
- t.integer "user_id", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index %w[merge_request_id], name: "index_approvals_on_merge_request_id", using: :btree
- end
-
- create_table_if_not_exists "approver_groups" do |t|
- t.integer "target_id", null: false
- t.string "target_type", null: false
- t.integer "group_id", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index %w[group_id], name: "index_approver_groups_on_group_id", using: :btree
- t.index %w[target_id target_type], name: "index_approver_groups_on_target_id_and_target_type", using: :btree
- end
-
- create_table_if_not_exists "approvers" do |t|
- t.integer "target_id", null: false
- t.string "target_type"
- t.integer "user_id", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index %w[target_id target_type], name: "index_approvers_on_target_id_and_target_type", using: :btree
- t.index %w[user_id], name: "index_approvers_on_user_id", using: :btree
- end
-
- create_table_if_not_exists "board_assignees" do |t|
- t.integer "board_id", null: false
- t.integer "assignee_id", null: false
- t.index %w[assignee_id], name: "index_board_assignees_on_assignee_id", using: :btree
- t.index %w[board_id assignee_id], name: "index_board_assignees_on_board_id_and_assignee_id", unique: true, using: :btree
- end
-
- create_table_if_not_exists "board_labels" do |t|
- t.integer "board_id", null: false
- t.integer "label_id", null: false
- t.index %w[board_id label_id], name: "index_board_labels_on_board_id_and_label_id", unique: true, using: :btree
- t.index %w[label_id], name: "index_board_labels_on_label_id", using: :btree
- end
-
- create_table_if_not_exists "ci_sources_pipelines" do |t|
- t.integer "project_id"
- t.integer "pipeline_id"
- t.integer "source_project_id"
- t.integer "source_job_id"
- t.integer "source_pipeline_id"
- t.index ["pipeline_id"], name: "index_ci_sources_pipelines_on_pipeline_id", using: :btree
- t.index ["project_id"], name: "index_ci_sources_pipelines_on_project_id", using: :btree
- t.index ["source_job_id"], name: "index_ci_sources_pipelines_on_source_job_id", using: :btree
- t.index ["source_pipeline_id"], name: "index_ci_sources_pipelines_on_source_pipeline_id", using: :btree
- t.index ["source_project_id"], name: "index_ci_sources_pipelines_on_source_project_id", using: :btree
- end
-
- create_table_if_not_exists "design_management_designs", id: :bigserial, force: :cascade do |t|
- t.integer "project_id", null: false
- t.integer "issue_id", null: false
- t.string "filename", null: false
- t.index %w[issue_id filename], name: "index_design_management_designs_on_issue_id_and_filename", unique: true, using: :btree
- t.index ["project_id"], name: "index_design_management_designs_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "design_management_designs_versions", id: false, force: :cascade do |t|
- t.bigint "design_id", null: false
- t.bigint "version_id", null: false
- t.index %w[design_id version_id], name: "design_management_designs_versions_uniqueness", unique: true, using: :btree
- t.index ["design_id"], name: "index_design_management_designs_versions_on_design_id", using: :btree
- t.index ["version_id"], name: "index_design_management_designs_versions_on_version_id", using: :btree
- end
-
- create_table_if_not_exists "design_management_versions", id: :bigserial, force: :cascade do |t|
- t.binary "sha", null: false
- t.index ["sha"], name: "index_design_management_versions_on_sha", unique: true, using: :btree
- end
-
- create_table_if_not_exists "draft_notes", id: :bigserial do |t|
- t.integer "merge_request_id", null: false
- t.integer "author_id", null: false
- t.boolean "resolve_discussion", default: false, null: false
- t.string "discussion_id"
- t.text "note", null: false
- t.text "position"
- t.text "original_position"
- t.text "change_position"
- t.index ["author_id"], name: "index_draft_notes_on_author_id", using: :btree
- t.index ["discussion_id"], name: "index_draft_notes_on_discussion_id", using: :btree
- t.index ["merge_request_id"], name: "index_draft_notes_on_merge_request_id", using: :btree
- end
-
- create_table_if_not_exists "elasticsearch_indexed_namespaces", id: false do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "namespace_id"
- t.index ["namespace_id"], name: "index_elasticsearch_indexed_namespaces_on_namespace_id", unique: true, using: :btree
- end
-
- create_table_if_not_exists "elasticsearch_indexed_projects", id: false do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "project_id"
- t.index ["project_id"], name: "index_elasticsearch_indexed_projects_on_project_id", unique: true, using: :btree
- end
-
- create_table_if_not_exists "epic_issues" do |t|
- t.integer "epic_id", null: false
- t.integer "issue_id", null: false
- t.integer "relative_position", default: 1073741823, null: false
- t.index ["epic_id"], name: "index_epic_issues_on_epic_id", using: :btree
- t.index ["issue_id"], name: "index_epic_issues_on_issue_id", unique: true, using: :btree
- end
-
- create_table_if_not_exists "epic_metrics" do |t|
- t.integer "epic_id", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["epic_id"], name: "index_epic_metrics", using: :btree
- end
-
- create_table_if_not_exists "epics" do |t|
- t.integer "milestone_id"
- t.integer "group_id", null: false
- t.integer "author_id", null: false
- t.integer "assignee_id"
- t.integer "iid", null: false
- t.integer "cached_markdown_version"
- t.integer "updated_by_id"
- t.integer "last_edited_by_id"
- t.integer "lock_version"
- t.date "start_date"
- t.date "end_date"
- t.datetime "last_edited_at"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.string "title", null: false
- t.string "title_html", null: false
- t.text "description"
- t.text "description_html"
- t.integer "start_date_sourcing_milestone_id"
- t.integer "due_date_sourcing_milestone_id"
- t.date "start_date_fixed"
- t.date "due_date_fixed"
- t.boolean "start_date_is_fixed"
- t.boolean "due_date_is_fixed"
- t.integer "state", limit: 2, default: 1, null: false
- t.integer "closed_by_id"
- t.datetime "closed_at"
- t.integer "parent_id"
- t.integer "relative_position"
- t.index ["assignee_id"], name: "index_epics_on_assignee_id", using: :btree
- t.index ["author_id"], name: "index_epics_on_author_id", using: :btree
- t.index ["closed_by_id"], name: "index_epics_on_closed_by_id", using: :btree
- t.index ["end_date"], name: "index_epics_on_end_date", using: :btree
- t.index ["group_id"], name: "index_epics_on_group_id", using: :btree
- t.index ["iid"], name: "index_epics_on_iid", using: :btree
- t.index ["milestone_id"], name: "index_milestone", using: :btree
- t.index ["parent_id"], name: "index_epics_on_parent_id", using: :btree
- t.index ["start_date"], name: "index_epics_on_start_date", using: :btree
- end
-
- create_table_if_not_exists "geo_cache_invalidation_events", id: :bigserial do |t|
- t.string "key", null: false
- end
-
- create_table_if_not_exists "geo_event_log", id: :bigserial do |t|
- t.datetime "created_at", null: false
- t.bigint "repository_updated_event_id"
- t.bigint "repository_deleted_event_id"
- t.bigint "repository_renamed_event_id"
- t.bigint "repositories_changed_event_id"
- t.bigint "repository_created_event_id"
- t.bigint "hashed_storage_migrated_event_id"
- t.bigint "lfs_object_deleted_event_id"
- t.bigint "hashed_storage_attachments_event_id"
- t.bigint "upload_deleted_event_id"
- t.bigint "job_artifact_deleted_event_id"
- t.bigint "reset_checksum_event_id"
- t.bigint "cache_invalidation_event_id"
- t.index ["cache_invalidation_event_id"], name: "index_geo_event_log_on_cache_invalidation_event_id", where: "(cache_invalidation_event_id IS NOT NULL)", using: :btree
- t.index ["hashed_storage_attachments_event_id"], name: "index_geo_event_log_on_hashed_storage_attachments_event_id", where: "(hashed_storage_attachments_event_id IS NOT NULL)", using: :btree
- t.index ["hashed_storage_migrated_event_id"], name: "index_geo_event_log_on_hashed_storage_migrated_event_id", where: "(hashed_storage_migrated_event_id IS NOT NULL)", using: :btree
- t.index ["job_artifact_deleted_event_id"], name: "index_geo_event_log_on_job_artifact_deleted_event_id", where: "(job_artifact_deleted_event_id IS NOT NULL)", using: :btree
- t.index ["lfs_object_deleted_event_id"], name: "index_geo_event_log_on_lfs_object_deleted_event_id", where: "(lfs_object_deleted_event_id IS NOT NULL)", using: :btree
- t.index ["repositories_changed_event_id"], name: "index_geo_event_log_on_repositories_changed_event_id", where: "(repositories_changed_event_id IS NOT NULL)", using: :btree
- t.index ["repository_created_event_id"], name: "index_geo_event_log_on_repository_created_event_id", where: "(repository_created_event_id IS NOT NULL)", using: :btree
- t.index ["repository_deleted_event_id"], name: "index_geo_event_log_on_repository_deleted_event_id", where: "(repository_deleted_event_id IS NOT NULL)", using: :btree
- t.index ["repository_renamed_event_id"], name: "index_geo_event_log_on_repository_renamed_event_id", where: "(repository_renamed_event_id IS NOT NULL)", using: :btree
- t.index ["repository_updated_event_id"], name: "index_geo_event_log_on_repository_updated_event_id", where: "(repository_updated_event_id IS NOT NULL)", using: :btree
- t.index ["reset_checksum_event_id"], name: "index_geo_event_log_on_reset_checksum_event_id", where: "(reset_checksum_event_id IS NOT NULL)", using: :btree
- t.index ["upload_deleted_event_id"], name: "index_geo_event_log_on_upload_deleted_event_id", where: "(upload_deleted_event_id IS NOT NULL)", using: :btree
- end
-
- create_table_if_not_exists "geo_hashed_storage_attachments_events", id: :bigserial do |t|
- t.integer "project_id", null: false
- t.text "old_attachments_path", null: false
- t.text "new_attachments_path", null: false
- t.index ["project_id"], name: "index_geo_hashed_storage_attachments_events_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "geo_hashed_storage_migrated_events", id: :bigserial do |t|
- t.integer "project_id", null: false
- t.text "repository_storage_name", null: false
- t.text "old_disk_path", null: false
- t.text "new_disk_path", null: false
- t.text "old_wiki_disk_path", null: false
- t.text "new_wiki_disk_path", null: false
- t.integer "old_storage_version", limit: 2
- t.integer "new_storage_version", limit: 2, null: false
- t.index ["project_id"], name: "index_geo_hashed_storage_migrated_events_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "geo_job_artifact_deleted_events", id: :bigserial do |t|
- t.integer "job_artifact_id", null: false
- t.string "file_path", null: false
- t.index ["job_artifact_id"], name: "index_geo_job_artifact_deleted_events_on_job_artifact_id", using: :btree
- end
-
- create_table_if_not_exists "geo_lfs_object_deleted_events", id: :bigserial do |t|
- t.integer "lfs_object_id", null: false
- t.string "oid", null: false
- t.string "file_path", null: false
- t.index ["lfs_object_id"], name: "index_geo_lfs_object_deleted_events_on_lfs_object_id", using: :btree
- end
-
- create_table_if_not_exists "geo_node_namespace_links" do |t|
- t.integer "geo_node_id", null: false
- t.integer "namespace_id", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index %w[geo_node_id namespace_id], name: "index_geo_node_namespace_links_on_geo_node_id_and_namespace_id", unique: true, using: :btree
- t.index ["geo_node_id"], name: "index_geo_node_namespace_links_on_geo_node_id", using: :btree
- t.index ["namespace_id"], name: "index_geo_node_namespace_links_on_namespace_id", using: :btree
- end
-
- create_table_if_not_exists "geo_node_statuses" do |t|
- t.integer "geo_node_id", null: false
- t.integer "db_replication_lag_seconds"
- t.integer "repositories_synced_count"
- t.integer "repositories_failed_count"
- t.integer "lfs_objects_count"
- t.integer "lfs_objects_synced_count"
- t.integer "lfs_objects_failed_count"
- t.integer "attachments_count"
- t.integer "attachments_synced_count"
- t.integer "attachments_failed_count"
- t.integer "last_event_id"
- t.datetime "last_event_date"
- t.integer "cursor_last_event_id"
- t.datetime "cursor_last_event_date"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.datetime "last_successful_status_check_at"
- t.string "status_message"
- t.integer "replication_slots_count"
- t.integer "replication_slots_used_count"
- t.bigint "replication_slots_max_retained_wal_bytes"
- t.integer "wikis_synced_count"
- t.integer "wikis_failed_count"
- t.integer "job_artifacts_count"
- t.integer "job_artifacts_synced_count"
- t.integer "job_artifacts_failed_count"
- t.string "version"
- t.string "revision"
- t.integer "repositories_verified_count"
- t.integer "repositories_verification_failed_count"
- t.integer "wikis_verified_count"
- t.integer "wikis_verification_failed_count"
- t.integer "lfs_objects_synced_missing_on_primary_count"
- t.integer "job_artifacts_synced_missing_on_primary_count"
- t.integer "attachments_synced_missing_on_primary_count"
- t.integer "repositories_checksummed_count"
- t.integer "repositories_checksum_failed_count"
- t.integer "repositories_checksum_mismatch_count"
- t.integer "wikis_checksummed_count"
- t.integer "wikis_checksum_failed_count"
- t.integer "wikis_checksum_mismatch_count"
- t.binary "storage_configuration_digest"
- t.integer "repositories_retrying_verification_count"
- t.integer "wikis_retrying_verification_count"
- t.integer "projects_count"
- t.index ["geo_node_id"], name: "index_geo_node_statuses_on_geo_node_id", unique: true, using: :btree
- end
-
- create_table_if_not_exists "geo_nodes" do |t|
- t.boolean "primary"
- t.integer "oauth_application_id"
- t.boolean "enabled", default: true, null: false
- t.string "access_key"
- t.string "encrypted_secret_access_key"
- t.string "encrypted_secret_access_key_iv"
- t.string "clone_url_prefix"
- t.integer "files_max_capacity", default: 10, null: false
- t.integer "repos_max_capacity", default: 25, null: false
- t.string "url", null: false
- t.string "selective_sync_type"
- t.text "selective_sync_shards"
- t.integer "verification_max_capacity", default: 100, null: false
- t.integer "minimum_reverification_interval", default: 7, null: false
- t.string "alternate_url"
- t.index ["access_key"], name: "index_geo_nodes_on_access_key", using: :btree
- t.index ["primary"], name: "index_geo_nodes_on_primary", using: :btree
- t.index ["url"], name: "index_geo_nodes_on_url", unique: true, using: :btree
- end
-
- create_table_if_not_exists "geo_repositories_changed_events", id: :bigserial do |t|
- t.integer "geo_node_id", null: false
- t.index ["geo_node_id"], name: "index_geo_repositories_changed_events_on_geo_node_id", using: :btree
- end
-
- create_table_if_not_exists "geo_repository_created_events", id: :bigserial do |t|
- t.integer "project_id", null: false
- t.text "repository_storage_name", null: false
- t.text "repo_path", null: false
- t.text "wiki_path"
- t.text "project_name", null: false
- t.index ["project_id"], name: "index_geo_repository_created_events_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "geo_repository_deleted_events", id: :bigserial do |t|
- t.integer "project_id", null: false
- t.text "repository_storage_name", null: false
- t.text "deleted_path", null: false
- t.text "deleted_wiki_path"
- t.text "deleted_project_name", null: false
- t.index ["project_id"], name: "index_geo_repository_deleted_events_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "geo_repository_renamed_events", id: :bigserial do |t|
- t.integer "project_id", null: false
- t.text "repository_storage_name", null: false
- t.text "old_path_with_namespace", null: false
- t.text "new_path_with_namespace", null: false
- t.text "old_wiki_path_with_namespace", null: false
- t.text "new_wiki_path_with_namespace", null: false
- t.text "old_path", null: false
- t.text "new_path", null: false
- t.index ["project_id"], name: "index_geo_repository_renamed_events_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "geo_repository_updated_events", id: :bigserial do |t|
- t.integer "branches_affected", null: false
- t.integer "tags_affected", null: false
- t.integer "project_id", null: false
- t.integer "source", limit: 2, null: false
- t.boolean "new_branch", default: false, null: false
- t.boolean "remove_branch", default: false, null: false
- t.text "ref"
- t.index ["project_id"], name: "index_geo_repository_updated_events_on_project_id", using: :btree
- t.index ["source"], name: "index_geo_repository_updated_events_on_source", using: :btree
- end
-
- create_table_if_not_exists "geo_reset_checksum_events", id: :bigserial do |t|
- t.integer "project_id", null: false
- t.index ["project_id"], name: "index_geo_reset_checksum_events_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "geo_upload_deleted_events", id: :bigserial do |t|
- t.integer "upload_id", null: false
- t.string "file_path", null: false
- t.integer "model_id", null: false
- t.string "model_type", null: false
- t.string "uploader", null: false
- t.index ["upload_id"], name: "index_geo_upload_deleted_events_on_upload_id", using: :btree
- end
-
- create_table_if_not_exists "gitlab_subscriptions", id: :bigserial do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.date "start_date"
- t.date "end_date"
- t.date "trial_ends_on"
- t.integer "namespace_id"
- t.integer "hosted_plan_id"
- t.integer "max_seats_used", default: 0
- t.integer "seats", default: 0
- t.boolean "trial", default: false
- t.index ["hosted_plan_id"], name: "index_gitlab_subscriptions_on_hosted_plan_id", using: :btree
- t.index ["namespace_id"], name: "index_gitlab_subscriptions_on_namespace_id", unique: true, using: :btree
- end
-
- create_table_if_not_exists "historical_data" do |t|
- t.date "date", null: false
- t.integer "active_user_count"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table_if_not_exists "index_statuses" do |t|
- t.integer "project_id", null: false
- t.datetime "indexed_at"
- t.text "note"
- t.string "last_commit"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["project_id"], name: "index_index_statuses_on_project_id", unique: true, using: :btree
- end
-
- create_table_if_not_exists "insights" do |t|
- t.integer "namespace_id", null: false
- t.integer "project_id", null: false
- t.index ["namespace_id"], name: "index_insights_on_namespace_id", using: :btree
- t.index ["project_id"], name: "index_insights_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "issue_links" do |t|
- t.integer "source_id", null: false
- t.integer "target_id", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.index %w[source_id target_id], name: "index_issue_links_on_source_id_and_target_id", unique: true, using: :btree
- t.index ["source_id"], name: "index_issue_links_on_source_id", using: :btree
- t.index ["target_id"], name: "index_issue_links_on_target_id", using: :btree
- end
-
- create_table_if_not_exists "jira_connect_installations", id: :bigserial do |t|
- t.string "client_key"
- t.string "encrypted_shared_secret"
- t.string "encrypted_shared_secret_iv"
- t.string "base_url"
- t.index ["client_key"], name: "index_jira_connect_installations_on_client_key", unique: true, using: :btree
- end
-
- create_table_if_not_exists "jira_connect_subscriptions", id: :bigserial do |t|
- t.datetime_with_timezone "created_at", null: false
- t.bigint "jira_connect_installation_id", null: false
- t.integer "namespace_id", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.index %w[jira_connect_installation_id namespace_id], name: "idx_jira_connect_subscriptions_on_installation_id_namespace_id", unique: true, using: :btree
- t.index ["jira_connect_installation_id"], name: "idx_jira_connect_subscriptions_on_installation_id", using: :btree
- t.index ["namespace_id"], name: "index_jira_connect_subscriptions_on_namespace_id", using: :btree
- end
-
- create_table_if_not_exists "ldap_group_links" do |t|
- t.string "cn"
- t.integer "group_access", null: false
- t.integer "group_id", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "provider"
- t.string "filter"
- end
-
- create_table_if_not_exists "licenses" do |t|
- t.text "data", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table_if_not_exists "namespace_statistics" do |t|
- t.integer "namespace_id", null: false
- t.integer "shared_runners_seconds", default: 0, null: false
- t.datetime "shared_runners_seconds_last_reset"
- t.index ["namespace_id"], name: "index_namespace_statistics_on_namespace_id", unique: true, using: :btree
- end
-
- create_table_if_not_exists "operations_feature_flag_scopes", id: :bigserial do |t|
- t.bigint "feature_flag_id", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.boolean "active", null: false
- t.string "environment_scope", default: "*", null: false
- t.index %w[feature_flag_id environment_scope], name: "index_feature_flag_scopes_on_flag_id_and_environment_scope", unique: true, using: :btree
- end
-
- create_table_if_not_exists "operations_feature_flags", id: :bigserial do |t|
- t.integer "project_id", null: false
- t.boolean "active", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.string "name", null: false
- t.text "description"
- t.index %w[project_id name], name: "index_operations_feature_flags_on_project_id_and_name", unique: true, using: :btree
- end
-
- create_table_if_not_exists "operations_feature_flags_clients", id: :bigserial do |t|
- t.integer "project_id", null: false
- t.string "token", null: false
- t.index %w[project_id token], name: "index_operations_feature_flags_clients_on_project_id_and_token", unique: true, using: :btree
- end
-
- create_table_if_not_exists "packages_maven_metadata", id: :bigserial do |t|
- t.bigint "package_id", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.string "app_group", null: false
- t.string "app_name", null: false
- t.string "app_version"
- t.string "path", limit: 512, null: false
- t.index %w[package_id path], name: "index_packages_maven_metadata_on_package_id_and_path", using: :btree
- end
-
- create_table_if_not_exists "packages_package_files", id: :bigserial do |t|
- t.bigint "package_id", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.bigint "size"
- t.integer "file_type"
- t.integer "file_store"
- t.binary "file_md5"
- t.binary "file_sha1"
- t.string "file_name", null: false
- t.text "file", null: false
- t.index %w[package_id file_name], name: "index_packages_package_files_on_package_id_and_file_name", using: :btree
- end
-
- create_table_if_not_exists "packages_packages", id: :bigserial do |t|
- t.integer "project_id", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.string "name", null: false
- t.string "version"
- t.integer "package_type", limit: 2, null: false
- t.index ["project_id"], name: "index_packages_packages_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "path_locks" do |t|
- t.string "path", null: false
- t.integer "project_id"
- t.integer "user_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["path"], name: "index_path_locks_on_path", using: :btree
- t.index ["project_id"], name: "index_path_locks_on_project_id", using: :btree
- t.index ["user_id"], name: "index_path_locks_on_user_id", using: :btree
- end
-
- create_table_if_not_exists "plans" do |t|
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.string "name"
- t.string "title"
- t.integer "active_pipelines_limit"
- t.integer "pipeline_size_limit"
- t.index ["name"], name: "index_plans_on_name", using: :btree
- end
-
- create_table_if_not_exists "project_alerting_settings", primary_key: "project_id", id: :integer do |t|
- t.string "encrypted_token", null: false
- t.string "encrypted_token_iv", null: false
- end
-
- create_table_if_not_exists "project_feature_usages", primary_key: "project_id", id: :integer do |t|
- t.datetime "jira_dvcs_cloud_last_sync_at"
- t.datetime "jira_dvcs_server_last_sync_at"
- t.index %w[jira_dvcs_cloud_last_sync_at project_id], name: "idx_proj_feat_usg_on_jira_dvcs_cloud_last_sync_at_and_proj_id", where: "(jira_dvcs_cloud_last_sync_at IS NOT NULL)", using: :btree
- t.index %w[jira_dvcs_server_last_sync_at project_id], name: "idx_proj_feat_usg_on_jira_dvcs_server_last_sync_at_and_proj_id", where: "(jira_dvcs_server_last_sync_at IS NOT NULL)", using: :btree
- t.index ["project_id"], name: "index_project_feature_usages_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "project_incident_management_settings", primary_key: "project_id", id: :integer do |t|
- t.boolean "create_issue", default: false, null: false
- t.boolean "send_email", default: true, null: false
- t.text "issue_template_key"
- end
-
- create_table_if_not_exists "project_repository_states" do |t|
- t.integer "project_id", null: false
- t.binary "repository_verification_checksum"
- t.binary "wiki_verification_checksum"
- t.string "last_repository_verification_failure"
- t.string "last_wiki_verification_failure"
- t.datetime_with_timezone "repository_retry_at"
- t.datetime_with_timezone "wiki_retry_at"
- t.integer "repository_retry_count"
- t.integer "wiki_retry_count"
- t.datetime_with_timezone "last_repository_verification_ran_at"
- t.datetime_with_timezone "last_wiki_verification_ran_at"
- t.index ["last_repository_verification_failure"], name: "idx_repository_states_on_repository_failure_partial", where: "(last_repository_verification_failure IS NOT NULL)", using: :btree
- t.index ["last_wiki_verification_failure"], name: "idx_repository_states_on_wiki_failure_partial", where: "(last_wiki_verification_failure IS NOT NULL)", using: :btree
- t.index %w[project_id last_repository_verification_ran_at], name: "idx_repository_states_on_last_repository_verification_ran_at", where: "((repository_verification_checksum IS NOT NULL) AND (last_repository_verification_failure IS NULL))", using: :btree
- t.index %w[project_id last_wiki_verification_ran_at], name: "idx_repository_states_on_last_wiki_verification_ran_at", where: "((wiki_verification_checksum IS NOT NULL) AND (last_wiki_verification_failure IS NULL))", using: :btree
- t.index ["project_id"], name: "idx_repository_states_outdated_checksums", where: "(((repository_verification_checksum IS NULL) AND (last_repository_verification_failure IS NULL)) OR ((wiki_verification_checksum IS NULL) AND (last_wiki_verification_failure IS NULL)))", using: :btree
- t.index ["project_id"], name: "index_project_repository_states_on_project_id", unique: true, using: :btree
- end
-
- create_table_if_not_exists "project_tracing_settings", id: :bigserial do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "project_id", null: false
- t.string "external_url", null: false
- t.index ["project_id"], name: "index_project_tracing_settings_on_project_id", unique: true, using: :btree
- end
-
- create_table_if_not_exists "prometheus_alert_events", id: :bigserial do |t|
- t.integer "project_id", null: false
- t.integer "prometheus_alert_id", null: false
- t.datetime_with_timezone "started_at", null: false
- t.datetime_with_timezone "ended_at"
- t.integer "status", limit: 2
- t.string "payload_key"
- t.index %w[project_id status], name: "index_prometheus_alert_events_on_project_id_and_status", using: :btree
- t.index %w[prometheus_alert_id payload_key], name: "index_prometheus_alert_event_scoped_payload_key", unique: true, using: :btree
- end
-
- create_table_if_not_exists "prometheus_alerts" do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.float "threshold", null: false
- t.integer "operator", null: false
- t.integer "environment_id", null: false
- t.integer "project_id", null: false
- t.integer "prometheus_metric_id", null: false
- t.index ["environment_id"], name: "index_prometheus_alerts_on_environment_id", using: :btree
- t.index %w[project_id prometheus_metric_id environment_id], name: "index_prometheus_alerts_metric_environment", unique: true, using: :btree
- t.index ["prometheus_metric_id"], name: "index_prometheus_alerts_on_prometheus_metric_id", using: :btree
- end
-
- create_table_if_not_exists "protected_branch_unprotect_access_levels" do |t|
- t.integer "protected_branch_id", null: false
- t.integer "access_level", default: 40
- t.integer "user_id"
- t.integer "group_id"
- t.index ["group_id"], name: "index_protected_branch_unprotect_access_levels_on_group_id", using: :btree
- t.index ["protected_branch_id"], name: "index_protected_branch_unprotect_access", using: :btree
- t.index ["user_id"], name: "index_protected_branch_unprotect_access_levels_on_user_id", using: :btree
- end
-
- create_table_if_not_exists "protected_environment_deploy_access_levels" do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "access_level", default: 40
- t.integer "protected_environment_id", null: false
- t.integer "user_id"
- t.integer "group_id"
- t.index ["group_id"], name: "index_protected_environment_deploy_access_levels_on_group_id", using: :btree
- t.index ["protected_environment_id"], name: "index_protected_environment_deploy_access", using: :btree
- t.index ["user_id"], name: "index_protected_environment_deploy_access_levels_on_user_id", using: :btree
- end
-
- create_table_if_not_exists "protected_environments" do |t|
- t.integer "project_id", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.string "name", null: false
- t.index %w[project_id name], name: "index_protected_environments_on_project_id_and_name", unique: true, using: :btree
- t.index ["project_id"], name: "index_protected_environments_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "push_rules" do |t|
- t.string "force_push_regex"
- t.string "delete_branch_regex"
- t.string "commit_message_regex"
- t.boolean "deny_delete_tag"
- t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "author_email_regex"
- t.boolean "member_check", default: false, null: false
- t.string "file_name_regex"
- t.boolean "is_sample", default: false
- t.integer "max_file_size", default: 0, null: false
- t.boolean "prevent_secrets", default: false, null: false
- t.string "branch_name_regex"
- t.boolean "reject_unsigned_commits"
- t.boolean "commit_committer_check"
- t.boolean "regexp_uses_re2", default: true
- t.string "commit_message_negative_regex"
- t.index ["is_sample"], name: "index_push_rules_on_is_sample", where: "is_sample", using: :btree
- t.index ["project_id"], name: "index_push_rules_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "reviews", id: :bigserial do |t|
- t.integer "author_id"
- t.integer "merge_request_id", null: false
- t.integer "project_id", null: false
- t.datetime_with_timezone "created_at", null: false
- t.index ["author_id"], name: "index_reviews_on_author_id", using: :btree
- t.index ["merge_request_id"], name: "index_reviews_on_merge_request_id", using: :btree
- t.index ["project_id"], name: "index_reviews_on_project_id", using: :btree
- end
-
- create_table_if_not_exists "saml_providers" do |t|
- t.integer "group_id", null: false
- t.boolean "enabled", null: false
- t.string "certificate_fingerprint", null: false
- t.string "sso_url", null: false
- t.boolean "enforced_sso", default: false, null: false
- t.boolean "enforced_group_managed_accounts", default: false, null: false
- t.index ["group_id"], name: "index_saml_providers_on_group_id", using: :btree
- end
-
- create_table_if_not_exists "scim_oauth_access_tokens" do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "group_id", null: false
- t.string "token_encrypted", null: false
- t.index %w[group_id token_encrypted], name: "index_scim_oauth_access_tokens_on_group_id_and_token_encrypted", unique: true, using: :btree
- end
-
- create_table_if_not_exists "slack_integrations" do |t|
- t.integer "service_id", null: false
- t.string "team_id", null: false
- t.string "team_name", null: false
- t.string "alias", null: false
- t.string "user_id", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["service_id"], name: "index_slack_integrations_on_service_id", using: :btree
- t.index %w[team_id alias], name: "index_slack_integrations_on_team_id_and_alias", unique: true, using: :btree
- end
-
- create_table_if_not_exists "smartcard_identities", id: :bigserial do |t|
- t.integer "user_id", null: false
- t.string "subject", null: false
- t.string "issuer", null: false
- t.index %w[subject issuer], name: "index_smartcard_identities_on_subject_and_issuer", unique: true, using: :btree
- t.index ["user_id"], name: "index_smartcard_identities_on_user_id", using: :btree
- end
-
- create_table_if_not_exists "software_license_policies" do |t|
- t.integer "project_id", null: false
- t.integer "software_license_id", null: false
- t.integer "approval_status", default: 0, null: false
- t.index %w[project_id software_license_id], name: "index_software_license_policies_unique_per_project", unique: true, using: :btree
- t.index ["software_license_id"], name: "index_software_license_policies_on_software_license_id", using: :btree
- end
-
- create_table_if_not_exists "software_licenses" do |t|
- t.string "name", null: false
- t.index ["name"], name: "index_software_licenses_on_name", using: :btree
- end
-
- create_table_if_not_exists "users_ops_dashboard_projects", id: :bigserial do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "user_id", null: false
- t.integer "project_id", null: false
- t.index ["project_id"], name: "index_users_ops_dashboard_projects_on_project_id", using: :btree
- t.index %w[user_id project_id], name: "index_users_ops_dashboard_projects_on_user_id_and_project_id", unique: true, using: :btree
- end
-
- create_table_if_not_exists "vulnerability_feedback" do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "feedback_type", limit: 2, null: false
- t.integer "category", limit: 2, null: false
- t.integer "project_id", null: false
- t.integer "author_id", null: false
- t.integer "pipeline_id"
- t.integer "issue_id"
- t.string "project_fingerprint", limit: 40, null: false
- t.integer "merge_request_id"
- t.index ["author_id"], name: "index_vulnerability_feedback_on_author_id", using: :btree
- t.index ["issue_id"], name: "index_vulnerability_feedback_on_issue_id", using: :btree
- t.index ["merge_request_id"], name: "index_vulnerability_feedback_on_merge_request_id", using: :btree
- t.index ["pipeline_id"], name: "index_vulnerability_feedback_on_pipeline_id", using: :btree
- t.index %w[project_id category feedback_type project_fingerprint], name: "vulnerability_feedback_unique_idx", unique: true, using: :btree
- end
-
- create_table_if_not_exists "vulnerability_identifiers", id: :bigserial do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "project_id", null: false
- t.binary "fingerprint", null: false
- t.string "external_type", null: false
- t.string "external_id", null: false
- t.string "name", null: false
- t.text "url"
- t.index %w[project_id fingerprint], name: "index_vulnerability_identifiers_on_project_id_and_fingerprint", unique: true, using: :btree
- end
-
- create_table_if_not_exists "vulnerability_occurrence_identifiers", id: :bigserial do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.bigint "occurrence_id", null: false
- t.bigint "identifier_id", null: false
- t.index ["identifier_id"], name: "index_vulnerability_occurrence_identifiers_on_identifier_id", using: :btree
- t.index %w[occurrence_id identifier_id], name: "index_vulnerability_occurrence_identifiers_on_unique_keys", unique: true, using: :btree
- end
-
- create_table_if_not_exists "vulnerability_occurrence_pipelines", id: :bigserial do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.bigint "occurrence_id", null: false
- t.integer "pipeline_id", null: false
- t.index %w[occurrence_id pipeline_id], name: "vulnerability_occurrence_pipelines_on_unique_keys", unique: true, using: :btree
- t.index ["pipeline_id"], name: "index_vulnerability_occurrence_pipelines_on_pipeline_id", using: :btree
- end
-
- create_table_if_not_exists "vulnerability_occurrences", id: :bigserial do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "severity", limit: 2, null: false
- t.integer "confidence", limit: 2, null: false
- t.integer "report_type", limit: 2, null: false
- t.integer "project_id", null: false
- t.bigint "scanner_id", null: false
- t.bigint "primary_identifier_id", null: false
- t.binary "project_fingerprint", null: false
- t.binary "location_fingerprint", null: false
- t.string "uuid", limit: 36, null: false
- t.string "name", null: false
- t.string "metadata_version", null: false
- t.text "raw_metadata", null: false
- t.index ["primary_identifier_id"], name: "index_vulnerability_occurrences_on_primary_identifier_id", using: :btree
- t.index %w[project_id primary_identifier_id location_fingerprint scanner_id], name: "index_vulnerability_occurrences_on_unique_keys", unique: true, using: :btree
- t.index ["scanner_id"], name: "index_vulnerability_occurrences_on_scanner_id", using: :btree
- t.index ["uuid"], name: "index_vulnerability_occurrences_on_uuid", unique: true, using: :btree
- end
-
- create_table_if_not_exists "vulnerability_scanners", id: :bigserial do |t|
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.integer "project_id", null: false
- t.string "external_id", null: false
- t.string "name", null: false
- t.index %w[project_id external_id], name: "index_vulnerability_scanners_on_project_id_and_external_id", unique: true, using: :btree
- end
-
- create_table_if_not_exists "dependency_proxy_blobs", id: :serial do |t|
- t.datetime_with_timezone "created_at", null: false
- t.text "file", null: false
- t.string "file_name", null: false
- t.integer "file_store"
- t.integer "group_id", null: false
- t.bigint "size"
- t.datetime_with_timezone "updated_at", null: false
- t.index %w[group_id file_name], name: "index_dependency_proxy_blobs_on_group_id_and_file_name", using: :btree
- end
-
- create_table_if_not_exists "dependency_proxy_group_settings", id: :serial do |t|
- t.datetime_with_timezone "created_at", null: false
- t.boolean "enabled", default: false, null: false
- t.integer "group_id", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.index ["group_id"], name: "index_dependency_proxy_group_settings_on_group_id", using: :btree
- end
- end
-
- def remove_tables
- drop_table_if_exists "approval_merge_request_rule_sources"
- drop_table_if_exists "approval_merge_request_rules"
- drop_table_if_exists "approval_merge_request_rules_approved_approvers"
- drop_table_if_exists "approval_merge_request_rules_groups"
- drop_table_if_exists "approval_merge_request_rules_users"
- drop_table_if_exists "approval_project_rules"
- drop_table_if_exists "approval_project_rules_groups"
- drop_table_if_exists "approval_project_rules_users"
- drop_table_if_exists "approvals"
- drop_table_if_exists "approver_groups"
- drop_table_if_exists "approvers"
- drop_table_if_exists "board_assignees"
- drop_table_if_exists "board_labels"
- drop_table_if_exists "ci_sources_pipelines"
- drop_table_if_exists "design_management_designs_versions"
- drop_table_if_exists "design_management_versions"
- drop_table_if_exists "design_management_designs"
- drop_table_if_exists "draft_notes"
- drop_table_if_exists "elasticsearch_indexed_namespaces"
- drop_table_if_exists "elasticsearch_indexed_projects"
- drop_table_if_exists "epic_issues"
- drop_table_if_exists "epic_metrics"
- drop_table_if_exists "epics"
- drop_table_if_exists "geo_cache_invalidation_events"
- drop_table_if_exists "geo_event_log"
- drop_table_if_exists "geo_hashed_storage_attachments_events"
- drop_table_if_exists "geo_hashed_storage_migrated_events"
- drop_table_if_exists "geo_job_artifact_deleted_events"
- drop_table_if_exists "geo_lfs_object_deleted_events"
- drop_table_if_exists "geo_node_namespace_links"
- drop_table_if_exists "geo_node_statuses"
- drop_table_if_exists "geo_nodes"
- drop_table_if_exists "geo_repositories_changed_events"
- drop_table_if_exists "geo_repository_created_events"
- drop_table_if_exists "geo_repository_deleted_events"
- drop_table_if_exists "geo_repository_renamed_events"
- drop_table_if_exists "geo_repository_updated_events"
- drop_table_if_exists "geo_reset_checksum_events"
- drop_table_if_exists "geo_upload_deleted_events"
- drop_table_if_exists "gitlab_subscriptions"
- drop_table_if_exists "historical_data"
- drop_table_if_exists "index_statuses"
- drop_table_if_exists "insights"
- drop_table_if_exists "issue_links"
- drop_table_if_exists "jira_connect_subscriptions"
- drop_table_if_exists "jira_connect_installations"
- drop_table_if_exists "ldap_group_links"
- drop_table_if_exists "licenses"
- drop_table_if_exists "namespace_statistics"
- drop_table_if_exists "operations_feature_flag_scopes"
- drop_table_if_exists "operations_feature_flags"
- drop_table_if_exists "operations_feature_flags_clients"
- drop_table_if_exists "packages_maven_metadata"
- drop_table_if_exists "packages_package_files"
- drop_table_if_exists "packages_packages"
- drop_table_if_exists "path_locks"
- drop_table_if_exists "plans"
- drop_table_if_exists "project_alerting_settings"
- drop_table_if_exists "project_feature_usages"
- drop_table_if_exists "project_incident_management_settings"
- drop_table_if_exists "project_repository_states"
- drop_table_if_exists "project_tracing_settings"
- drop_table_if_exists "prometheus_alert_events"
- drop_table_if_exists "prometheus_alerts"
- drop_table_if_exists "protected_branch_unprotect_access_levels"
- drop_table_if_exists "protected_environment_deploy_access_levels"
- drop_table_if_exists "protected_environments"
- drop_table_if_exists "push_rules"
- drop_table_if_exists "reviews"
- drop_table_if_exists "saml_providers"
- drop_table_if_exists "scim_oauth_access_tokens"
- drop_table_if_exists "slack_integrations"
- drop_table_if_exists "smartcard_identities"
- drop_table_if_exists "software_license_policies"
- drop_table_if_exists "software_licenses"
- drop_table_if_exists "users_ops_dashboard_projects"
- drop_table_if_exists "vulnerability_feedback"
- drop_table_if_exists "vulnerability_identifiers"
- drop_table_if_exists "vulnerability_occurrence_identifiers"
- drop_table_if_exists "vulnerability_occurrence_pipelines"
- drop_table_if_exists "vulnerability_occurrences"
- drop_table_if_exists "vulnerability_scanners"
- drop_table_if_exists "dependency_proxy_blobs"
- drop_table_if_exists "dependency_proxy_group_settings"
- end
-
- def add_missing_foreign_keys
- add_concurrent_foreign_key("application_settings", "namespaces", column: "custom_project_templates_group_id", name: "fk_rails_b53e481273", on_delete: :nullify)
- add_concurrent_foreign_key("application_settings", "projects", column: "file_template_project_id", name: "fk_ec757bd087", on_delete: :nullify)
- add_concurrent_foreign_key("approval_merge_request_rule_sources", "approval_merge_request_rules", column: "approval_merge_request_rule_id", name: "fk_rails_e605a04f76", on_delete: :cascade)
- add_concurrent_foreign_key("approval_merge_request_rule_sources", "approval_project_rules", column: "approval_project_rule_id", name: "fk_rails_64e8ed3c7e", on_delete: :cascade)
- add_concurrent_foreign_key("approval_merge_request_rules", "merge_requests", column: "merge_request_id", name: "fk_rails_004ce82224", on_delete: :cascade)
- add_concurrent_foreign_key("approval_merge_request_rules_approved_approvers", "approval_merge_request_rules", column: "approval_merge_request_rule_id", name: "fk_rails_6577725edb", on_delete: :cascade)
- add_concurrent_foreign_key("approval_merge_request_rules_approved_approvers", "users", column: "user_id", name: "fk_rails_8dc94cff4d", on_delete: :cascade)
- add_concurrent_foreign_key("approval_merge_request_rules_groups", "approval_merge_request_rules", column: "approval_merge_request_rule_id", name: "fk_rails_5b2ecf6139", on_delete: :cascade)
- add_concurrent_foreign_key("approval_merge_request_rules_groups", "namespaces", column: "group_id", name: "fk_rails_2020a7124a", on_delete: :cascade)
- add_concurrent_foreign_key("approval_merge_request_rules_users", "approval_merge_request_rules", column: "approval_merge_request_rule_id", name: "fk_rails_80e6801803", on_delete: :cascade)
- add_concurrent_foreign_key("approval_merge_request_rules_users", "users", column: "user_id", name: "fk_rails_bc8972fa55", on_delete: :cascade)
- add_concurrent_foreign_key("approval_project_rules", "projects", column: "project_id", name: "fk_rails_5fb4dd100b", on_delete: :cascade)
- add_concurrent_foreign_key("approval_project_rules_groups", "approval_project_rules", column: "approval_project_rule_id", name: "fk_rails_9071e863d1", on_delete: :cascade)
- add_concurrent_foreign_key("approval_project_rules_groups", "namespaces", column: "group_id", name: "fk_rails_396841e79e", on_delete: :cascade)
- add_concurrent_foreign_key("approval_project_rules_users", "approval_project_rules", column: "approval_project_rule_id", name: "fk_rails_b9e9394efb", on_delete: :cascade)
- add_concurrent_foreign_key("approval_project_rules_users", "users", column: "user_id", name: "fk_rails_f365da8250", on_delete: :cascade)
- add_concurrent_foreign_key("approvals", "merge_requests", column: "merge_request_id", name: "fk_310d714958", on_delete: :cascade)
- add_concurrent_foreign_key("approver_groups", "namespaces", column: "group_id", name: "fk_rails_1cdcbd7723", on_delete: :cascade)
- add_concurrent_foreign_key("board_assignees", "boards", column: "board_id", name: "fk_rails_3f6f926bd5", on_delete: :cascade)
- add_concurrent_foreign_key("board_assignees", "users", column: "assignee_id", name: "fk_rails_1c0ff59e82", on_delete: :cascade)
- add_concurrent_foreign_key("board_labels", "boards", column: "board_id", name: "fk_rails_9374a16edd", on_delete: :cascade)
- add_concurrent_foreign_key("board_labels", "labels", column: "label_id", name: "fk_rails_362b0600a3", on_delete: :cascade)
- add_concurrent_foreign_key("ci_sources_pipelines", "ci_builds", column: "source_job_id", name: "fk_be5624bf37", on_delete: :cascade)
- add_concurrent_foreign_key("ci_sources_pipelines", "ci_pipelines", column: "pipeline_id", name: "fk_e1bad85861", on_delete: :cascade)
- add_concurrent_foreign_key("ci_sources_pipelines", "ci_pipelines", column: "source_pipeline_id", name: "fk_d4e29af7d7", on_delete: :cascade)
- add_concurrent_foreign_key("ci_sources_pipelines", "projects", column: "source_project_id", name: "fk_acd9737679", on_delete: :cascade)
- add_concurrent_foreign_key("ci_sources_pipelines", "projects", column: "project_id", name: "fk_1e53c97c0a", on_delete: :cascade)
- add_concurrent_foreign_key("design_management_designs", "issues", column: "issue_id", name: "fk_rails_bfe283ec3c", on_delete: :cascade)
- add_concurrent_foreign_key("design_management_designs", "projects", column: "project_id", name: "fk_rails_4bb1073360", on_delete: :cascade)
- add_concurrent_foreign_key("design_management_designs_versions", "design_management_designs", column: "design_id", on_delete: :cascade)
- add_concurrent_foreign_key("design_management_designs_versions", "design_management_versions", column: "version_id", on_delete: :cascade)
- add_concurrent_foreign_key("draft_notes", "merge_requests", column: "merge_request_id", name: "fk_rails_e753681674", on_delete: :cascade)
- add_concurrent_foreign_key("draft_notes", "users", column: "author_id", name: "fk_rails_2a8dac9901", on_delete: :cascade)
- add_concurrent_foreign_key("elasticsearch_indexed_namespaces", "namespaces", column: "namespace_id", name: "fk_rails_bdcf044f37", on_delete: :cascade)
- add_concurrent_foreign_key("elasticsearch_indexed_projects", "projects", column: "project_id", name: "fk_rails_bd13bbdc3d", on_delete: :cascade)
- add_concurrent_foreign_key("epic_issues", "epics", column: "epic_id", name: "fk_rails_5d942936b4", on_delete: :cascade)
- add_concurrent_foreign_key("epic_issues", "issues", column: "issue_id", name: "fk_rails_4209981af6", on_delete: :cascade)
- add_concurrent_foreign_key("epic_metrics", "epics", column: "epic_id", name: "fk_rails_d071904753", on_delete: :cascade)
- add_concurrent_foreign_key("epics", "epics", column: "parent_id", name: "fk_25b99c1be3", on_delete: :cascade)
- add_concurrent_foreign_key("epics", "milestones", column: "milestone_id", name: "fk_rails_1bf671ebb7", on_delete: :nullify)
- add_concurrent_foreign_key("epics", "namespaces", column: "group_id", name: "fk_f081aa4489", on_delete: :cascade)
- add_concurrent_foreign_key("epics", "users", column: "assignee_id", name: "fk_dccd3f98fc", on_delete: :nullify)
- add_concurrent_foreign_key("epics", "users", column: "author_id", name: "fk_3654b61b03", on_delete: :cascade)
- add_concurrent_foreign_key("epics", "users", column: "closed_by_id", name: "fk_aa5798e761", on_delete: :nullify)
- add_concurrent_foreign_key("geo_event_log", "geo_cache_invalidation_events", column: "cache_invalidation_event_id", name: "fk_42c3b54bed", on_delete: :cascade)
- add_concurrent_foreign_key("geo_event_log", "geo_hashed_storage_migrated_events", column: "hashed_storage_migrated_event_id", name: "fk_27548c6db3", on_delete: :cascade)
- add_concurrent_foreign_key("geo_event_log", "geo_job_artifact_deleted_events", column: "job_artifact_deleted_event_id", name: "fk_176d3fbb5d", on_delete: :cascade)
- add_concurrent_foreign_key("geo_event_log", "geo_lfs_object_deleted_events", column: "lfs_object_deleted_event_id", name: "fk_d5af95fcd9", on_delete: :cascade)
- add_concurrent_foreign_key("geo_event_log", "geo_repositories_changed_events", column: "repositories_changed_event_id", name: "fk_4a99ebfd60", on_delete: :cascade)
- add_concurrent_foreign_key("geo_event_log", "geo_repository_created_events", column: "repository_created_event_id", name: "fk_9b9afb1916", on_delete: :cascade)
- add_concurrent_foreign_key("geo_event_log", "geo_repository_deleted_events", column: "repository_deleted_event_id", name: "fk_c4b1c1f66e", on_delete: :cascade)
- add_concurrent_foreign_key("geo_event_log", "geo_repository_renamed_events", column: "repository_renamed_event_id", name: "fk_86c84214ec", on_delete: :cascade)
- add_concurrent_foreign_key("geo_event_log", "geo_repository_updated_events", column: "repository_updated_event_id", name: "fk_78a6492f68", on_delete: :cascade)
- add_concurrent_foreign_key("geo_event_log", "geo_reset_checksum_events", column: "reset_checksum_event_id", name: "fk_cff7185ad2", on_delete: :cascade)
- add_concurrent_foreign_key("geo_event_log", "geo_upload_deleted_events", column: "upload_deleted_event_id", name: "fk_c1f241c70d", on_delete: :cascade)
- add_concurrent_foreign_key("geo_hashed_storage_attachments_events", "projects", column: "project_id", name: "fk_rails_d496b088e9", on_delete: :cascade)
- add_concurrent_foreign_key("geo_hashed_storage_migrated_events", "projects", column: "project_id", name: "fk_rails_687ed7d7c5", on_delete: :cascade)
- add_concurrent_foreign_key("geo_node_namespace_links", "geo_nodes", column: "geo_node_id", name: "fk_rails_546bf08d3e", on_delete: :cascade)
- add_concurrent_foreign_key("geo_node_namespace_links", "namespaces", column: "namespace_id", name: "fk_rails_41ff5fb854", on_delete: :cascade)
- add_concurrent_foreign_key("geo_node_statuses", "geo_nodes", column: "geo_node_id", name: "fk_rails_0ecc699c2a", on_delete: :cascade)
- add_concurrent_foreign_key("geo_repositories_changed_events", "geo_nodes", column: "geo_node_id", name: "fk_rails_75ec0fefcc", on_delete: :cascade)
- add_concurrent_foreign_key("geo_repository_created_events", "projects", column: "project_id", name: "fk_rails_1f49e46a61", on_delete: :cascade)
- add_concurrent_foreign_key("geo_repository_renamed_events", "projects", column: "project_id", name: "fk_rails_4e6524febb", on_delete: :cascade)
- add_concurrent_foreign_key("geo_repository_updated_events", "projects", column: "project_id", name: "fk_rails_2b70854c08", on_delete: :cascade)
- add_concurrent_foreign_key("geo_reset_checksum_events", "projects", column: "project_id", name: "fk_rails_910a06f12b", on_delete: :cascade)
- add_concurrent_foreign_key("gitlab_subscriptions", "namespaces", column: "namespace_id", name: "fk_e2595d00a1", on_delete: :cascade)
- add_concurrent_foreign_key("gitlab_subscriptions", "plans", column: "hosted_plan_id", name: "fk_bd0c4019c3", on_delete: :cascade)
- add_concurrent_foreign_key("identities", "saml_providers", column: "saml_provider_id", name: "fk_aade90f0fc", on_delete: :cascade)
- add_concurrent_foreign_key("index_statuses", "projects", column: "project_id", name: "fk_74b2492545", on_delete: :cascade)
- add_concurrent_foreign_key("insights", "namespaces", column: "namespace_id", name: "fk_rails_5c4391f60a", on_delete: nil)
- add_concurrent_foreign_key("insights", "projects", column: "project_id", name: "fk_rails_f36fda3932", on_delete: nil)
- add_concurrent_foreign_key("issue_links", "issues", column: "source_id", name: "fk_c900194ff2", on_delete: :cascade)
- add_concurrent_foreign_key("issue_links", "issues", column: "target_id", name: "fk_e71bb44f1f", on_delete: :cascade)
- add_concurrent_foreign_key("lists", "milestones", column: "milestone_id", name: "fk_rails_baed5f39b7", on_delete: :cascade)
- add_concurrent_foreign_key("lists", "users", column: "user_id", name: "fk_d6cf4279f7", on_delete: :cascade)
- add_concurrent_foreign_key("namespace_statistics", "namespaces", column: "namespace_id", name: "fk_rails_0062050394", on_delete: :cascade)
- add_concurrent_foreign_key("namespaces", "namespaces", column: "custom_project_templates_group_id", name: "fk_e7a0b20a6b", on_delete: :nullify)
- add_concurrent_foreign_key("namespaces", "plans", column: "plan_id", name: "fk_fdd12e5b80", on_delete: :nullify)
- add_concurrent_foreign_key("namespaces", "projects", column: "file_template_project_id", name: "fk_319256d87a", on_delete: :nullify)
- add_concurrent_foreign_key("notes", "reviews", column: "review_id", name: "fk_2e82291620", on_delete: :nullify)
- add_concurrent_foreign_key("operations_feature_flag_scopes", "operations_feature_flags", column: "feature_flag_id", name: "fk_rails_a50a04d0a4", on_delete: :cascade)
- add_concurrent_foreign_key("operations_feature_flags", "projects", column: "project_id", name: "fk_rails_648e241be7", on_delete: :cascade)
- add_concurrent_foreign_key("operations_feature_flags_clients", "projects", column: "project_id", name: "fk_rails_6650ed902c", on_delete: :cascade)
- add_concurrent_foreign_key("packages_maven_metadata", "packages_packages", column: "package_id", name: "fk_be88aed360", on_delete: :cascade)
- add_concurrent_foreign_key("packages_package_files", "packages_packages", column: "package_id", name: "fk_86f0f182f8", on_delete: :cascade)
- add_concurrent_foreign_key("packages_packages", "projects", column: "project_id", name: "fk_rails_e1ac527425", on_delete: :cascade)
- add_concurrent_foreign_key("path_locks", "projects", column: "project_id", name: "fk_5265c98f24", on_delete: :cascade)
- add_concurrent_foreign_key("path_locks", "users", column: "user_id", name: "fk_rails_762cdcf942", on_delete: nil)
- add_concurrent_foreign_key("project_alerting_settings", "projects", column: "project_id", name: "fk_rails_27a84b407d", on_delete: :cascade)
- add_concurrent_foreign_key("project_feature_usages", "projects", column: "project_id", name: "fk_rails_c22a50024b", on_delete: :cascade)
- add_concurrent_foreign_key("project_incident_management_settings", "projects", column: "project_id", name: "fk_rails_9c2ea1b7dd", on_delete: :cascade)
- add_concurrent_foreign_key("project_repository_states", "projects", column: "project_id", name: "fk_rails_0f2298ca8a", on_delete: :cascade)
- add_concurrent_foreign_key("project_tracing_settings", "projects", column: "project_id", name: "fk_rails_fe56f57fc6", on_delete: :cascade)
- add_concurrent_foreign_key("prometheus_alert_events", "projects", column: "project_id", name: "fk_rails_4675865839", on_delete: :cascade)
- add_concurrent_foreign_key("prometheus_alert_events", "prometheus_alerts", column: "prometheus_alert_id", name: "fk_rails_106f901176", on_delete: :cascade)
- add_concurrent_foreign_key("prometheus_alerts", "environments", column: "environment_id", name: "fk_rails_6d9b283465", on_delete: :cascade)
- add_concurrent_foreign_key("prometheus_alerts", "projects", column: "project_id", name: "fk_rails_f0e8db86aa", on_delete: :cascade)
- add_concurrent_foreign_key("prometheus_alerts", "prometheus_metrics", column: "prometheus_metric_id", name: "fk_rails_e6351447ec", on_delete: :cascade)
- add_concurrent_foreign_key("protected_branch_merge_access_levels", "namespaces", column: "group_id", name: "fk_98f3d044fe", on_delete: :cascade)
- add_concurrent_foreign_key("protected_branch_merge_access_levels", "users", column: "user_id", name: "fk_rails_5ffb4f3590", on_delete: nil)
- add_concurrent_foreign_key("protected_branch_push_access_levels", "namespaces", column: "group_id", name: "fk_7111b68cdb", on_delete: :cascade)
- add_concurrent_foreign_key("protected_branch_push_access_levels", "users", column: "user_id", name: "fk_rails_8dcb712d65", on_delete: nil)
- add_concurrent_foreign_key("protected_branch_unprotect_access_levels", "namespaces", column: "group_id", name: "fk_rails_5be1abfc25", on_delete: :cascade)
- add_concurrent_foreign_key("protected_branch_unprotect_access_levels", "protected_branches", column: "protected_branch_id", name: "fk_rails_e9eb8dc025", on_delete: :cascade)
- add_concurrent_foreign_key("protected_branch_unprotect_access_levels", "users", column: "user_id", name: "fk_rails_2d2aba21ef", on_delete: :cascade)
- add_concurrent_foreign_key("protected_environment_deploy_access_levels", "namespaces", column: "group_id", name: "fk_rails_45cc02a931", on_delete: :cascade)
- add_concurrent_foreign_key("protected_environment_deploy_access_levels", "protected_environments", column: "protected_environment_id", name: "fk_rails_898a13b650", on_delete: :cascade)
- add_concurrent_foreign_key("protected_environment_deploy_access_levels", "users", column: "user_id", name: "fk_rails_5b9f6970fe", on_delete: :cascade)
- add_concurrent_foreign_key("protected_environments", "projects", column: "project_id", name: "fk_rails_a354313d11", on_delete: :cascade)
- add_concurrent_foreign_key("push_rules", "projects", column: "project_id", name: "fk_83b29894de", on_delete: :cascade)
- add_concurrent_foreign_key("resource_label_events", "epics", column: "epic_id", name: "fk_rails_75efb0a653", on_delete: :cascade)
- add_concurrent_foreign_key("reviews", "merge_requests", column: "merge_request_id", name: "fk_rails_5ca11d8c31", on_delete: :cascade)
- add_concurrent_foreign_key("reviews", "projects", column: "project_id", name: "fk_rails_64798be025", on_delete: :cascade)
- add_concurrent_foreign_key("reviews", "users", column: "author_id", name: "fk_rails_29e6f859c4", on_delete: :nullify)
- add_concurrent_foreign_key("saml_providers", "namespaces", column: "group_id", name: "fk_rails_306d459be7", on_delete: :cascade)
- add_concurrent_foreign_key("scim_oauth_access_tokens", "namespaces", column: "group_id", name: "fk_rails_c84404fb6c", on_delete: :cascade)
- add_concurrent_foreign_key("slack_integrations", "services", column: "service_id", name: "fk_rails_73db19721a", on_delete: :cascade)
- add_concurrent_foreign_key("smartcard_identities", "users", column: "user_id", name: "fk_rails_4689f889a9", on_delete: :cascade)
- add_concurrent_foreign_key("software_license_policies", "projects", column: "project_id", name: "fk_rails_87b2247ce5", on_delete: :cascade)
- add_concurrent_foreign_key("software_license_policies", "software_licenses", column: "software_license_id", name: "fk_rails_7a7a2a92de", on_delete: :cascade)
- add_concurrent_foreign_key("users", "namespaces", column: "managing_group_id", name: "fk_a4b8fefe3e", on_delete: :nullify)
- add_concurrent_foreign_key("users_ops_dashboard_projects", "projects", column: "project_id", name: "fk_rails_9b4ebf005b", on_delete: :cascade)
- add_concurrent_foreign_key("users_ops_dashboard_projects", "users", column: "user_id", name: "fk_rails_220a0562db", on_delete: :cascade)
- add_concurrent_foreign_key("vulnerability_feedback", "ci_pipelines", column: "pipeline_id", name: "fk_rails_20976e6fd9", on_delete: :nullify)
- add_concurrent_foreign_key("vulnerability_feedback", "issues", column: "issue_id", name: "fk_rails_8c77e5891a", on_delete: :nullify)
- add_concurrent_foreign_key("vulnerability_feedback", "merge_requests", column: "merge_request_id", name: "fk_563ff1912e", on_delete: :nullify)
- add_concurrent_foreign_key("vulnerability_feedback", "projects", column: "project_id", name: "fk_rails_debd54e456", on_delete: :cascade)
- add_concurrent_foreign_key("vulnerability_feedback", "users", column: "author_id", name: "fk_rails_472f69b043", on_delete: :cascade)
- add_concurrent_foreign_key("vulnerability_identifiers", "projects", column: "project_id", name: "fk_rails_a67a16c885", on_delete: :cascade)
- add_concurrent_foreign_key("vulnerability_occurrence_identifiers", "vulnerability_identifiers", column: "identifier_id", name: "fk_rails_be2e49e1d0", on_delete: :cascade)
- add_concurrent_foreign_key("vulnerability_occurrence_identifiers", "vulnerability_occurrences", column: "occurrence_id", name: "fk_rails_e4ef6d027c", on_delete: :cascade)
- add_concurrent_foreign_key("vulnerability_occurrence_pipelines", "ci_pipelines", column: "pipeline_id", name: "fk_rails_6421e35d7d", on_delete: :cascade)
- add_concurrent_foreign_key("vulnerability_occurrence_pipelines", "vulnerability_occurrences", column: "occurrence_id", name: "fk_rails_dc3ae04693", on_delete: :cascade)
- add_concurrent_foreign_key("vulnerability_occurrences", "projects", column: "project_id", name: "fk_rails_90fed4faba", on_delete: :cascade)
- add_concurrent_foreign_key("vulnerability_occurrences", "vulnerability_identifiers", column: "primary_identifier_id", name: "fk_rails_c8661a61eb", on_delete: :cascade)
- add_concurrent_foreign_key("vulnerability_occurrences", "vulnerability_scanners", column: "scanner_id", name: "fk_rails_bf5b788ca7", on_delete: :cascade)
- add_concurrent_foreign_key("vulnerability_scanners", "projects", column: "project_id", name: "fk_rails_5c9d42a221", on_delete: :cascade)
- add_concurrent_foreign_key("dependency_proxy_blobs", "namespaces", column: "group_id", on_delete: :cascade)
- add_concurrent_foreign_key("dependency_proxy_group_settings", "namespaces", column: "group_id", on_delete: :cascade)
- add_concurrent_foreign_key("jira_connect_subscriptions", "jira_connect_installations", column: "jira_connect_installation_id", on_delete: :cascade)
- add_concurrent_foreign_key("jira_connect_subscriptions", "namespaces", column: "namespace_id", on_delete: :cascade)
-
- remove_foreign_key_without_error("protected_tag_create_access_levels", column: :group_id)
- add_concurrent_foreign_key("protected_tag_create_access_levels", "namespaces", column: :group_id, name: "fk_b4eb82fe3c", on_delete: :cascade)
- end
-
- def remove_foreign_keys
- remove_foreign_key_without_error("application_settings", column: "custom_project_templates_group_id")
- remove_foreign_key_without_error("application_settings", column: "file_template_project_id")
- remove_foreign_key_without_error("approval_merge_request_rule_sources", column: "approval_merge_request_rule_id")
- remove_foreign_key_without_error("approval_merge_request_rule_sources", column: "approval_project_rule_id")
- remove_foreign_key_without_error("approval_merge_request_rules", column: "merge_request_id")
- remove_foreign_key_without_error("approval_merge_request_rules_approved_approvers", column: "approval_merge_request_rule_id")
- remove_foreign_key_without_error("approval_merge_request_rules_approved_approvers", column: "user_id")
- remove_foreign_key_without_error("approval_merge_request_rules_groups", column: "approval_merge_request_rule_id")
- remove_foreign_key_without_error("approval_merge_request_rules_groups", column: "group_id")
- remove_foreign_key_without_error("approval_merge_request_rules_users", column: "approval_merge_request_rule_id")
- remove_foreign_key_without_error("approval_merge_request_rules_users", column: "user_id")
- remove_foreign_key_without_error("approval_project_rules", column: "project_id")
- remove_foreign_key_without_error("approval_project_rules_groups", column: "approval_project_rule_id")
- remove_foreign_key_without_error("approval_project_rules_groups", column: "group_id")
- remove_foreign_key_without_error("approval_project_rules_users", column: "approval_project_rule_id")
- remove_foreign_key_without_error("approval_project_rules_users", column: "user_id")
- remove_foreign_key_without_error("approvals", column: "merge_request_id")
- remove_foreign_key_without_error("approver_groups", column: "group_id")
- remove_foreign_key_without_error("board_assignees", column: "board_id")
- remove_foreign_key_without_error("board_assignees", column: "assignee_id")
- remove_foreign_key_without_error("board_labels", column: "board_id")
- remove_foreign_key_without_error("board_labels", column: "label_id")
- remove_foreign_key_without_error("ci_sources_pipelines", column: "source_job_id")
- remove_foreign_key_without_error("ci_sources_pipelines", column: "pipeline_id")
- remove_foreign_key_without_error("ci_sources_pipelines", column: "source_pipeline_id")
- remove_foreign_key_without_error("ci_sources_pipelines", column: "source_project_id")
- remove_foreign_key_without_error("ci_sources_pipelines", column: "project_id")
- remove_foreign_key_without_error("design_management_designs", column: "issue_id")
- remove_foreign_key_without_error("design_management_designs", column: "project_id")
- remove_foreign_key_without_error("design_management_versions", column: "design_management_design_id")
- remove_foreign_key_without_error("draft_notes", column: "merge_request_id")
- remove_foreign_key_without_error("draft_notes", column: "author_id")
- remove_foreign_key_without_error("elasticsearch_indexed_namespaces", column: "namespace_id")
- remove_foreign_key_without_error("elasticsearch_indexed_projects", column: "project_id")
- remove_foreign_key_without_error("epic_issues", column: "epic_id")
- remove_foreign_key_without_error("epic_issues", column: "issue_id")
- remove_foreign_key_without_error("epic_metrics", column: "epic_id")
- remove_foreign_key_without_error("epics", column: "parent_id")
- remove_foreign_key_without_error("epics", column: "milestone_id")
- remove_foreign_key_without_error("epics", column: "group_id")
- remove_foreign_key_without_error("epics", column: "assignee_id")
- remove_foreign_key_without_error("epics", column: "author_id")
- remove_foreign_key_without_error("epics", column: "closed_by_id")
- remove_foreign_key_without_error("geo_event_log", column: "cache_invalidation_event_id")
- remove_foreign_key_without_error("geo_event_log", column: "hashed_storage_migrated_event_id")
- remove_foreign_key_without_error("geo_event_log", column: "job_artifact_deleted_event_id")
- remove_foreign_key_without_error("geo_event_log", column: "lfs_object_deleted_event_id")
- remove_foreign_key_without_error("geo_event_log", column: "repositories_changed_event_id")
- remove_foreign_key_without_error("geo_event_log", column: "repository_created_event_id")
- remove_foreign_key_without_error("geo_event_log", column: "repository_deleted_event_id")
- remove_foreign_key_without_error("geo_event_log", column: "repository_renamed_event_id")
- remove_foreign_key_without_error("geo_event_log", column: "repository_updated_event_id")
- remove_foreign_key_without_error("geo_event_log", column: "reset_checksum_event_id")
- remove_foreign_key_without_error("geo_event_log", column: "upload_deleted_event_id")
- remove_foreign_key_without_error("geo_hashed_storage_attachments_events", column: "project_id")
- remove_foreign_key_without_error("geo_hashed_storage_migrated_events", column: "project_id")
- remove_foreign_key_without_error("geo_node_namespace_links", column: "geo_node_id")
- remove_foreign_key_without_error("geo_node_namespace_links", column: "namespace_id")
- remove_foreign_key_without_error("geo_node_statuses", column: "geo_node_id")
- remove_foreign_key_without_error("geo_repositories_changed_events", column: "geo_node_id")
- remove_foreign_key_without_error("geo_repository_created_events", column: "project_id")
- remove_foreign_key_without_error("geo_repository_renamed_events", column: "project_id")
- remove_foreign_key_without_error("geo_repository_updated_events", column: "project_id")
- remove_foreign_key_without_error("geo_reset_checksum_events", column: "project_id")
- remove_foreign_key_without_error("gitlab_subscriptions", column: "namespace_id")
- remove_foreign_key_without_error("gitlab_subscriptions", column: "hosted_plan_id")
- remove_foreign_key_without_error("identities", column: "saml_provider_id")
- remove_foreign_key_without_error("index_statuses", column: "project_id")
- remove_foreign_key_without_error("insights", column: "namespace_id", on_delete: nil)
- remove_foreign_key_without_error("insights", column: "project_id", on_delete: nil)
- remove_foreign_key_without_error("issue_links", column: "source_id")
- remove_foreign_key_without_error("issue_links", column: "target_id")
- remove_foreign_key_without_error("lists", column: "milestone_id")
- remove_foreign_key_without_error("lists", column: "user_id")
- remove_foreign_key_without_error("namespace_statistics", column: "namespace_id")
- remove_foreign_key_without_error("namespaces", column: "custom_project_templates_group_id")
- remove_foreign_key_without_error("namespaces", column: "plan_id")
- remove_foreign_key_without_error("namespaces", column: "file_template_project_id")
- remove_foreign_key_without_error("notes", column: "review_id")
- remove_foreign_key_without_error("operations_feature_flag_scopes", column: "feature_flag_id")
- remove_foreign_key_without_error("operations_feature_flags", column: "project_id")
- remove_foreign_key_without_error("operations_feature_flags_clients", column: "project_id")
- remove_foreign_key_without_error("packages_maven_metadata", column: "package_id")
- remove_foreign_key_without_error("packages_package_files", column: "package_id")
- remove_foreign_key_without_error("packages_packages", column: "project_id")
- remove_foreign_key_without_error("path_locks", column: "project_id")
- remove_foreign_key_without_error("path_locks", column: "user_id", on_delete: nil)
- remove_foreign_key_without_error("project_alerting_settings", column: "project_id")
- remove_foreign_key_without_error("project_feature_usages", column: "project_id")
- remove_foreign_key_without_error("project_incident_management_settings", column: "project_id")
- remove_foreign_key_without_error("project_repository_states", column: "project_id")
- remove_foreign_key_without_error("project_tracing_settings", column: "project_id")
- remove_foreign_key_without_error("prometheus_alert_events", column: "project_id")
- remove_foreign_key_without_error("prometheus_alert_events", column: "prometheus_alert_id")
- remove_foreign_key_without_error("prometheus_alerts", column: "environment_id")
- remove_foreign_key_without_error("prometheus_alerts", column: "project_id")
- remove_foreign_key_without_error("prometheus_alerts", column: "prometheus_metric_id")
- remove_foreign_key_without_error("protected_branch_merge_access_levels", column: "group_id")
- remove_foreign_key_without_error("protected_branch_merge_access_levels", column: "user_id", on_delete: nil)
- remove_foreign_key_without_error("protected_branch_push_access_levels", column: "group_id")
- remove_foreign_key_without_error("protected_branch_push_access_levels", column: "user_id", on_delete: nil)
- remove_foreign_key_without_error("protected_branch_unprotect_access_levels", column: "group_id")
- remove_foreign_key_without_error("protected_branch_unprotect_access_levels", column: "protected_branch_id")
- remove_foreign_key_without_error("protected_branch_unprotect_access_levels", column: "user_id")
- remove_foreign_key_without_error("protected_environment_deploy_access_levels", column: "group_id")
- remove_foreign_key_without_error("protected_environment_deploy_access_levels", column: "protected_environment_id")
- remove_foreign_key_without_error("protected_environment_deploy_access_levels", column: "user_id")
- remove_foreign_key_without_error("protected_environments", column: "project_id")
- remove_foreign_key_without_error("push_rules", column: "project_id")
- remove_foreign_key_without_error("resource_label_events", column: "epic_id")
- remove_foreign_key_without_error("reviews", column: "merge_request_id")
- remove_foreign_key_without_error("reviews", column: "project_id")
- remove_foreign_key_without_error("reviews", column: "author_id")
- remove_foreign_key_without_error("saml_providers", column: "group_id")
- remove_foreign_key_without_error("scim_oauth_access_tokens", column: "group_id")
- remove_foreign_key_without_error("slack_integrations", column: "service_id")
- remove_foreign_key_without_error("smartcard_identities", column: "user_id")
- remove_foreign_key_without_error("software_license_policies", column: "project_id")
- remove_foreign_key_without_error("software_license_policies", column: "software_license_id")
- remove_foreign_key_without_error("users", column: "managing_group_id")
- remove_foreign_key_without_error("users_ops_dashboard_projects", column: "project_id")
- remove_foreign_key_without_error("users_ops_dashboard_projects", column: "user_id")
- remove_foreign_key_without_error("vulnerability_feedback", column: "pipeline_id")
- remove_foreign_key_without_error("vulnerability_feedback", column: "issue_id")
- remove_foreign_key_without_error("vulnerability_feedback", column: "merge_request_id")
- remove_foreign_key_without_error("vulnerability_feedback", column: "project_id")
- remove_foreign_key_without_error("vulnerability_feedback", column: "author_id")
- remove_foreign_key_without_error("vulnerability_identifiers", column: "project_id")
- remove_foreign_key_without_error("vulnerability_occurrence_identifiers", column: "identifier_id")
- remove_foreign_key_without_error("vulnerability_occurrence_identifiers", column: "occurrence_id")
- remove_foreign_key_without_error("vulnerability_occurrence_pipelines", column: "pipeline_id")
- remove_foreign_key_without_error("vulnerability_occurrence_pipelines", column: "occurrence_id")
- remove_foreign_key_without_error("vulnerability_occurrences", column: "project_id")
- remove_foreign_key_without_error("vulnerability_occurrences", column: "primary_identifier_id")
- remove_foreign_key_without_error("vulnerability_occurrences", column: "scanner_id")
- remove_foreign_key_without_error("vulnerability_scanners", column: "project_id")
- remove_foreign_key_without_error("dependency_proxy_blobs", column: "group_id")
- remove_foreign_key_without_error("dependency_proxy_group_settings", column: "group_id")
- remove_foreign_key_without_error("jira_connect_subscriptions", "jira_connect_installations", column: "jira_connect_installation_id")
- remove_foreign_key_without_error("jira_connect_subscriptions", "namespaces", column: "namespace_id")
-
- remove_foreign_key_without_error("protected_tag_create_access_levels", column: :group_id)
- add_concurrent_foreign_key("protected_tag_create_access_levels", "namespaces", column: :group_id, on_delete: nil)
- end
-end
-# rubocop: enable Metrics/AbcSize
-# rubocop: enable Migration/Datetime
-# rubocop: enable Migration/PreventStrings
-# rubocop: enable Migration/AddLimitToTextColumns
diff --git a/db/migrate/20190403161806_update_designs_index.rb b/db/migrate/20190403161806_update_designs_index.rb
deleted file mode 100644
index 78517e372d5..00000000000
--- a/db/migrate/20190403161806_update_designs_index.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class UpdateDesignsIndex < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index :design_management_designs, :issue_id, unique: true
- end
-
- def down
- add_concurrent_index :design_management_designs, :issue_id, unique: true
- end
-end
diff --git a/db/migrate/20190408163745_prometheus_knative05_fix.rb b/db/migrate/20190408163745_prometheus_knative05_fix.rb
deleted file mode 100644
index 3d0aa782669..00000000000
--- a/db/migrate/20190408163745_prometheus_knative05_fix.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class PrometheusKnative05Fix < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- ::Gitlab::DatabaseImporters::CommonMetrics::Importer.new.execute
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20190409224933_add_name_to_geo_nodes.rb b/db/migrate/20190409224933_add_name_to_geo_nodes.rb
deleted file mode 100644
index ac3eda701d1..00000000000
--- a/db/migrate/20190409224933_add_name_to_geo_nodes.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddNameToGeoNodes < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def up
- add_column :geo_nodes, :name, :string # rubocop:disable Migration/PreventStrings
-
- # url is also unique, and its type and size is identical to the name column,
- # so this is safe.
- execute "UPDATE geo_nodes SET name = url;"
-
- # url is also `null: false`, so this is safe.
- change_column :geo_nodes, :name, :string, null: false
- end
-
- def down
- remove_column :geo_nodes, :name
- end
-end
diff --git a/db/migrate/20190410173409_add_name_index_to_geo_nodes.rb b/db/migrate/20190410173409_add_name_index_to_geo_nodes.rb
deleted file mode 100644
index efbdaf1d025..00000000000
--- a/db/migrate/20190410173409_add_name_index_to_geo_nodes.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddNameIndexToGeoNodes < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :geo_nodes, :name, unique: true
- end
-
- def down
- remove_concurrent_index :geo_nodes, :name
- end
-end
diff --git a/db/migrate/20190412155659_add_merge_request_blocks.rb b/db/migrate/20190412155659_add_merge_request_blocks.rb
deleted file mode 100644
index 9e7f370d1cf..00000000000
--- a/db/migrate/20190412155659_add_merge_request_blocks.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class AddMergeRequestBlocks < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :merge_request_blocks, id: :bigserial do |t|
- t.references :blocking_merge_request,
- index: false, null: false,
- foreign_key: { to_table: :merge_requests, on_delete: :cascade }
-
- t.references :blocked_merge_request,
- index: true, null: false,
- foreign_key: { to_table: :merge_requests, on_delete: :cascade }
-
- t.index [:blocking_merge_request_id, :blocked_merge_request_id],
- unique: true,
- name: 'index_mr_blocks_on_blocking_and_blocked_mr_ids'
-
- t.timestamps_with_timezone
- end
- end
-end
diff --git a/db/migrate/20190412183653_remove_url_index_from_geo_nodes.rb b/db/migrate/20190412183653_remove_url_index_from_geo_nodes.rb
deleted file mode 100644
index 86a46260553..00000000000
--- a/db/migrate/20190412183653_remove_url_index_from_geo_nodes.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class RemoveUrlIndexFromGeoNodes < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index :geo_nodes, :url
- end
-
- def down
- add_concurrent_index :geo_nodes, :url, unique: true
- end
-end
diff --git a/db/migrate/20190414185432_add_comment_to_vulnerability_feedback.rb b/db/migrate/20190414185432_add_comment_to_vulnerability_feedback.rb
deleted file mode 100644
index f2047e21d1e..00000000000
--- a/db/migrate/20190414185432_add_comment_to_vulnerability_feedback.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddCommentToVulnerabilityFeedback < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def up
- add_column :vulnerability_feedback, :comment_author_id, :integer
- add_column :vulnerability_feedback, :comment, :text # rubocop:disable Migration/AddLimitToTextColumns
- add_column :vulnerability_feedback, :comment_timestamp, :datetime_with_timezone
- end
-
- def down
- remove_column :vulnerability_feedback, :comment_author_id
- remove_column :vulnerability_feedback, :comment
- remove_column :vulnerability_feedback, :comment_timestamp
- end
-end
diff --git a/db/migrate/20190415030217_add_variable_type_to_ci_variables.rb b/db/migrate/20190415030217_add_variable_type_to_ci_variables.rb
deleted file mode 100644
index ed7af455e12..00000000000
--- a/db/migrate/20190415030217_add_variable_type_to_ci_variables.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddVariableTypeToCiVariables < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
- disable_ddl_transaction!
-
- DOWNTIME = false
- ENV_VAR_VARIABLE_TYPE = 1
-
- def up
- add_column_with_default(:ci_variables, :variable_type, :smallint, default: ENV_VAR_VARIABLE_TYPE) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:ci_variables, :variable_type)
- end
-end
diff --git a/db/migrate/20190415095825_add_packages_size_to_project_statistics.rb b/db/migrate/20190415095825_add_packages_size_to_project_statistics.rb
deleted file mode 100644
index 99625981563..00000000000
--- a/db/migrate/20190415095825_add_packages_size_to_project_statistics.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddPackagesSizeToProjectStatistics < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :project_statistics, :packages_size, :bigint
- end
-end
diff --git a/db/migrate/20190415172035_update_insights_foreign_keys.rb b/db/migrate/20190415172035_update_insights_foreign_keys.rb
deleted file mode 100644
index 5d3aa4c05e9..00000000000
--- a/db/migrate/20190415172035_update_insights_foreign_keys.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-# rubocop: disable Migration/AddConcurrentForeignKey
-
-class UpdateInsightsForeignKeys < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- remove_foreign_key_if_exists(:insights, column: :project_id)
- add_foreign_key(:insights, :projects, column: :project_id, on_delete: :cascade)
-
- remove_foreign_key_if_exists(:insights, column: :namespace_id)
- add_foreign_key(:insights, :namespaces, column: :namespace_id, on_delete: :cascade)
- end
-
- def down
- remove_foreign_key_if_exists(:insights, column: :namespace_id)
- add_foreign_key(:insights, :namespaces, column: :namespace_id)
-
- remove_foreign_key_if_exists(:insights, column: :project_id)
- add_foreign_key(:insights, :projects, column: :project_id)
- end
-end
diff --git a/db/migrate/20190416185130_add_merge_train_enabled_to_ci_cd_settings.rb b/db/migrate/20190416185130_add_merge_train_enabled_to_ci_cd_settings.rb
deleted file mode 100644
index 2488cff38af..00000000000
--- a/db/migrate/20190416185130_add_merge_train_enabled_to_ci_cd_settings.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddMergeTrainEnabledToCiCdSettings < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- # rubocop:disable Migration/AddColumnWithDefault
- # rubocop:disable Migration/UpdateLargeTable
- def up
- add_column_with_default :project_ci_cd_settings, :merge_trains_enabled, :boolean, default: false, allow_null: false
- end
- # rubocop:enable Migration/AddColumnWithDefault
- # rubocop:enable Migration/UpdateLargeTable
-
- def down
- remove_column :project_ci_cd_settings, :merge_trains_enabled
- end
-end
diff --git a/db/migrate/20190416213556_add_variable_type_to_ci_group_variables.rb b/db/migrate/20190416213556_add_variable_type_to_ci_group_variables.rb
deleted file mode 100644
index 4d329cea1b5..00000000000
--- a/db/migrate/20190416213556_add_variable_type_to_ci_group_variables.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddVariableTypeToCiGroupVariables < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
- disable_ddl_transaction!
-
- DOWNTIME = false
- ENV_VAR_VARIABLE_TYPE = 1
-
- def up
- add_column_with_default(:ci_group_variables, :variable_type, :smallint, default: ENV_VAR_VARIABLE_TYPE) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:ci_group_variables, :variable_type)
- end
-end
diff --git a/db/migrate/20190416213615_add_variable_type_to_ci_pipeline_variables.rb b/db/migrate/20190416213615_add_variable_type_to_ci_pipeline_variables.rb
deleted file mode 100644
index 1a4439da5bf..00000000000
--- a/db/migrate/20190416213615_add_variable_type_to_ci_pipeline_variables.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddVariableTypeToCiPipelineVariables < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
- disable_ddl_transaction!
-
- DOWNTIME = false
- ENV_VAR_VARIABLE_TYPE = 1
-
- # rubocop:disable Migration/AddColumnWithDefault
- # rubocop:disable Migration/UpdateLargeTable
- def up
- add_column_with_default(:ci_pipeline_variables, :variable_type, :smallint, default: ENV_VAR_VARIABLE_TYPE)
- end
- # rubocop:enable Migration/AddColumnWithDefault
- # rubocop:enable Migration/UpdateLargeTable
-
- def down
- remove_column(:ci_pipeline_variables, :variable_type)
- end
-end
diff --git a/db/migrate/20190416213631_add_variable_type_to_ci_pipeline_schedule_variables.rb b/db/migrate/20190416213631_add_variable_type_to_ci_pipeline_schedule_variables.rb
deleted file mode 100644
index b7d80cb2d0d..00000000000
--- a/db/migrate/20190416213631_add_variable_type_to_ci_pipeline_schedule_variables.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddVariableTypeToCiPipelineScheduleVariables < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
- disable_ddl_transaction!
-
- DOWNTIME = false
- ENV_VAR_VARIABLE_TYPE = 1
-
- def up
- add_column_with_default(:ci_pipeline_schedule_variables, :variable_type, :smallint, default: ENV_VAR_VARIABLE_TYPE) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:ci_pipeline_schedule_variables, :variable_type)
- end
-end
diff --git a/db/migrate/20190418132750_add_foreign_key_from_vulnerability_feedback_to_users.rb b/db/migrate/20190418132750_add_foreign_key_from_vulnerability_feedback_to_users.rb
deleted file mode 100644
index 0bd9012aee8..00000000000
--- a/db/migrate/20190418132750_add_foreign_key_from_vulnerability_feedback_to_users.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddForeignKeyFromVulnerabilityFeedbackToUsers < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :vulnerability_feedback, :users, column: :comment_author_id, on_delete: :nullify
- add_concurrent_index :vulnerability_feedback, :comment_author_id
- end
-
- def down
- remove_foreign_key :vulnerability_feedback, column: :comment_author_id
- remove_concurrent_index :vulnerability_feedback, :comment_author_id
- end
-end
diff --git a/db/migrate/20190418182545_create_merge_request_trains_table.rb b/db/migrate/20190418182545_create_merge_request_trains_table.rb
deleted file mode 100644
index ac927c9c6b9..00000000000
--- a/db/migrate/20190418182545_create_merge_request_trains_table.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class CreateMergeRequestTrainsTable < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :merge_trains, id: :bigserial do |t|
- t.references :merge_request, foreign_key: { on_delete: :cascade }, type: :integer, index: false, null: false
- t.references :user, foreign_key: { on_delete: :cascade }, type: :integer, null: false
- t.references :pipeline, foreign_key: { to_table: :ci_pipelines, on_delete: :nullify }, type: :integer
- t.timestamps_with_timezone null: false
-
- t.index [:merge_request_id], unique: true
- end
- end
-end
diff --git a/db/migrate/20190419121952_add_bridged_pipeline_id_to_bridges.rb b/db/migrate/20190419121952_add_bridged_pipeline_id_to_bridges.rb
deleted file mode 100644
index efb59403df3..00000000000
--- a/db/migrate/20190419121952_add_bridged_pipeline_id_to_bridges.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddBridgedPipelineIdToBridges < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def change
- add_column :ci_builds, :upstream_pipeline_id, :integer # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20190419123057_add_bridged_pipeline_id_foreign_key.rb b/db/migrate/20190419123057_add_bridged_pipeline_id_foreign_key.rb
deleted file mode 100644
index c31ec7bc107..00000000000
--- a/db/migrate/20190419123057_add_bridged_pipeline_id_foreign_key.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddBridgedPipelineIdForeignKey < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_builds, :upstream_pipeline_id, where: 'upstream_pipeline_id IS NOT NULL'
- add_concurrent_foreign_key :ci_builds, :ci_pipelines, column: :upstream_pipeline_id
- end
-
- def down
- remove_foreign_key :ci_builds, column: :upstream_pipeline_id
- remove_concurrent_index :ci_builds, :upstream_pipeline_id
- end
-end
diff --git a/db/migrate/20190422082247_create_project_metrics_settings.rb b/db/migrate/20190422082247_create_project_metrics_settings.rb
deleted file mode 100644
index 177c4820a0c..00000000000
--- a/db/migrate/20190422082247_create_project_metrics_settings.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class CreateProjectMetricsSettings < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :project_metrics_settings, id: :int, primary_key: :project_id, default: nil do |t|
- t.string :external_dashboard_url, null: false # rubocop:disable Migration/PreventStrings
- t.foreign_key :projects, column: :project_id, on_delete: :cascade
- end
- end
-end
diff --git a/db/migrate/20190423124640_add_index_to_projects_mirror_user_id.rb b/db/migrate/20190423124640_add_index_to_projects_mirror_user_id.rb
deleted file mode 100644
index b008d8ce0cc..00000000000
--- a/db/migrate/20190423124640_add_index_to_projects_mirror_user_id.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToProjectsMirrorUserId < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :projects, :mirror_user_id
- end
-
- def down
- remove_concurrent_index :projects, :mirror_user_id
- end
-end
diff --git a/db/migrate/20190426180107_add_deployment_events_to_services.rb b/db/migrate/20190426180107_add_deployment_events_to_services.rb
deleted file mode 100644
index 61339ea7506..00000000000
--- a/db/migrate/20190426180107_add_deployment_events_to_services.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddDeploymentEventsToServices < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- # rubocop:disable Migration/AddColumnWithDefault
- # rubocop:disable Migration/UpdateLargeTable
- def up
- add_column_with_default(:services, :deployment_events, :boolean, default: false, allow_null: false)
- end
- # rubocop:enable Migration/AddColumnWithDefault
- # rubocop:enable Migration/UpdateLargeTable
-
- def down
- remove_column(:services, :deployment_events)
- end
-end
diff --git a/db/migrate/20190429082448_create_pages_domain_acme_orders.rb b/db/migrate/20190429082448_create_pages_domain_acme_orders.rb
deleted file mode 100644
index 75636031193..00000000000
--- a/db/migrate/20190429082448_create_pages_domain_acme_orders.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreatePagesDomainAcmeOrders < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- create_table :pages_domain_acme_orders do |t|
- t.references :pages_domain, null: false, index: true, foreign_key: { on_delete: :cascade }, type: :integer
-
- t.datetime_with_timezone :expires_at, null: false
- t.timestamps_with_timezone null: false
-
- t.string :url, null: false
-
- t.string :challenge_token, null: false, index: true
- t.text :challenge_file_content, null: false
-
- t.text :encrypted_private_key, null: false
- t.text :encrypted_private_key_iv, null: false
- end
- end
- # rubocop:enable Migration/AddLimitToTextColumns
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190430131225_create_issue_tracker_data.rb b/db/migrate/20190430131225_create_issue_tracker_data.rb
deleted file mode 100644
index 2ec9802dbcd..00000000000
--- a/db/migrate/20190430131225_create_issue_tracker_data.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreateIssueTrackerData < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :issue_tracker_data do |t|
- t.references :service, foreign_key: { on_delete: :cascade }, type: :integer, index: true, null: false
- t.timestamps_with_timezone
- t.string :encrypted_project_url
- t.string :encrypted_project_url_iv
- t.string :encrypted_issues_url
- t.string :encrypted_issues_url_iv
- t.string :encrypted_new_issue_url
- t.string :encrypted_new_issue_url_iv
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190430142025_create_jira_tracker_data.rb b/db/migrate/20190430142025_create_jira_tracker_data.rb
deleted file mode 100644
index 2144c60a267..00000000000
--- a/db/migrate/20190430142025_create_jira_tracker_data.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreateJiraTrackerData < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :jira_tracker_data do |t|
- t.references :service, foreign_key: { on_delete: :cascade }, type: :integer, index: true, null: false
- t.timestamps_with_timezone
- t.string :encrypted_url
- t.string :encrypted_url_iv
- t.string :encrypted_api_url
- t.string :encrypted_api_url_iv
- t.string :encrypted_username
- t.string :encrypted_username_iv
- t.string :encrypted_password
- t.string :encrypted_password_iv
- t.string :jira_issue_transition_id
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190506135337_add_temporary_indexes_to_state_id.rb b/db/migrate/20190506135337_add_temporary_indexes_to_state_id.rb
deleted file mode 100644
index 8e9838e1afb..00000000000
--- a/db/migrate/20190506135337_add_temporary_indexes_to_state_id.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# frozen_string_literal: true
-
-# This migration adds temporary indexes to state_id column of issues
-# and merge_requests tables. It will be used only to peform the scheduling
-# for populating state_id in a post migrate and will be removed after it.
-# Check: ScheduleSyncIssuablesStateIdWhereNil.
-
-class AddTemporaryIndexesToStateId < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- %w(issues merge_requests).each do |table|
- add_concurrent_index(
- table,
- 'id',
- name: index_name_for(table),
- where: "state_id IS NULL"
- )
- end
- end
-
- def down
- remove_concurrent_index_by_name(:issues, index_name_for("issues"))
- remove_concurrent_index_by_name(:merge_requests, index_name_for("merge_requests"))
- end
-
- def index_name_for(table)
- "idx_on_#{table}_where_state_id_is_null"
- end
-end
diff --git a/db/migrate/20190513174947_enable_create_incident_issues_by_default.rb b/db/migrate/20190513174947_enable_create_incident_issues_by_default.rb
deleted file mode 100644
index ecd466627fe..00000000000
--- a/db/migrate/20190513174947_enable_create_incident_issues_by_default.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class EnableCreateIncidentIssuesByDefault < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- change_default_for :create_issue, from: false, to: true
- change_default_for :send_email, from: true, to: false
- end
-
- private
-
- def change_default_for(column, from:, to:)
- change_column_default :project_incident_management_settings,
- column, from: from, to: to
- end
-end
diff --git a/db/migrate/20190514105711_create_ip_restriction.rb b/db/migrate/20190514105711_create_ip_restriction.rb
deleted file mode 100644
index 51e711ca32b..00000000000
--- a/db/migrate/20190514105711_create_ip_restriction.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class CreateIpRestriction < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :ip_restrictions do |t|
- t.references :group, references: :namespace,
- column: :group_id,
- type: :integer,
- null: false,
- index: true
- t.string :range, null: false # rubocop:disable Migration/PreventStrings
- end
-
- add_foreign_key(:ip_restrictions, :namespaces, column: :group_id, on_delete: :cascade) # rubocop: disable Migration/AddConcurrentForeignKey
- end
-end
diff --git a/db/migrate/20190515125613_add_application_settings_elasticsearch_shards.rb b/db/migrate/20190515125613_add_application_settings_elasticsearch_shards.rb
deleted file mode 100644
index 9cebc0f8db4..00000000000
--- a/db/migrate/20190515125613_add_application_settings_elasticsearch_shards.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class AddApplicationSettingsElasticsearchShards < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def change
- add_column :application_settings, :elasticsearch_shards, :integer, null: false, default: 5
- add_column :application_settings, :elasticsearch_replicas, :integer, null: false, default: 1
- end
-end
diff --git a/db/migrate/20190516011213_add_build_queued_at_index.rb b/db/migrate/20190516011213_add_build_queued_at_index.rb
deleted file mode 100644
index 77ffa7cd4e9..00000000000
--- a/db/migrate/20190516011213_add_build_queued_at_index.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-# This migration make queued_at field indexed to speed up builds filtering by job_age
-
-class AddBuildQueuedAtIndex < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_builds, :queued_at
- end
-
- def down
- remove_concurrent_index :ci_builds, :queued_at
- end
-end
diff --git a/db/migrate/20190516151857_add_lets_encrypt_private_key_to_application_settings.rb b/db/migrate/20190516151857_add_lets_encrypt_private_key_to_application_settings.rb
deleted file mode 100644
index a2692ad32e9..00000000000
--- a/db/migrate/20190516151857_add_lets_encrypt_private_key_to_application_settings.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddLetsEncryptPrivateKeyToApplicationSettings < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- add_column :application_settings, :encrypted_lets_encrypt_private_key, :text
- add_column :application_settings, :encrypted_lets_encrypt_private_key_iv, :text
- end
- # rubocop:enable Migration/AddLimitToTextColumns
-end
diff --git a/db/migrate/20190516155724_change_packages_size_defaults_in_project_statistics.rb b/db/migrate/20190516155724_change_packages_size_defaults_in_project_statistics.rb
deleted file mode 100644
index eba154df496..00000000000
--- a/db/migrate/20190516155724_change_packages_size_defaults_in_project_statistics.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class ChangePackagesSizeDefaultsInProjectStatistics < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- change_column_default :project_statistics, :packages_size, 0
-
- update_column_in_batches(:project_statistics, :packages_size, 0) do |table, query|
- query.where(table[:packages_size].eq(nil))
- end
-
- change_column_null :project_statistics, :packages_size, false
- end
-
- def down
- change_column_null :project_statistics, :packages_size, true
- change_column_default :project_statistics, :packages_size, nil
- end
-end
diff --git a/db/migrate/20190520200123_add_rule_type_to_approval_merge_request_approval_rules.rb b/db/migrate/20190520200123_add_rule_type_to_approval_merge_request_approval_rules.rb
deleted file mode 100644
index 7bdb48f3eec..00000000000
--- a/db/migrate/20190520200123_add_rule_type_to_approval_merge_request_approval_rules.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddRuleTypeToApprovalMergeRequestApprovalRules < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:approval_merge_request_rules, :rule_type, :integer, limit: 2, default: 1) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:approval_merge_request_rules, :rule_type)
- end
-end
diff --git a/db/migrate/20190521174505_add_report_type_to_approval_merge_request_rules.rb b/db/migrate/20190521174505_add_report_type_to_approval_merge_request_rules.rb
deleted file mode 100644
index eafffd4f5a3..00000000000
--- a/db/migrate/20190521174505_add_report_type_to_approval_merge_request_rules.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddReportTypeToApprovalMergeRequestRules < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- change_table :approval_merge_request_rules do |t|
- t.integer :report_type, limit: 2
- end
- end
-end
diff --git a/db/migrate/20190523112344_limit_milestone_date_years_to_4_digits.rb b/db/migrate/20190523112344_limit_milestone_date_years_to_4_digits.rb
deleted file mode 100644
index 86fe09d7573..00000000000
--- a/db/migrate/20190523112344_limit_milestone_date_years_to_4_digits.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class LimitMilestoneDateYearsTo4Digits < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # When a migration requires downtime you **must** uncomment the following
- # constant and define a short and easy to understand explanation as to why the
- # migration requires downtime.
- # DOWNTIME_REASON = ''
-
- # When using the methods "add_concurrent_index", "remove_concurrent_index" or
- # "add_column_with_default" you must disable the use of transactions
- # as these methods can not run in an existing transaction.
- # When using "add_concurrent_index" or "remove_concurrent_index" methods make sure
- # that either of them is the _only_ method called in the migration,
- # any other changes should go in a separate migration.
- # This ensures that upon failure _only_ the index creation or removing fails
- # and can be retried or reverted easily.
- #
- # To disable transactions uncomment the following line and remove these
- # comments:
- # disable_ddl_transaction!
-
- def change
- Milestone.where("start_date > '9999-12-31'").update_all(
- "start_date = '9999-12-31'"
- )
- Milestone.where("due_date > '9999-12-31'").update_all(
- "due_date = '9999-12-31'"
- )
- end
-end
diff --git a/db/migrate/20190524062810_generate_lets_encrypt_private_key.rb b/db/migrate/20190524062810_generate_lets_encrypt_private_key.rb
deleted file mode 100644
index ae93a76575a..00000000000
--- a/db/migrate/20190524062810_generate_lets_encrypt_private_key.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class GenerateLetsEncryptPrivateKey < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # we now generate this key on the fly, but since this migration was merged to master, we don't remove it
- def up
- end
-
- def down
- end
-end
diff --git a/db/migrate/20190524071727_add_ssl_valid_period_to_pages_domain.rb b/db/migrate/20190524071727_add_ssl_valid_period_to_pages_domain.rb
deleted file mode 100644
index 18544dcb6d3..00000000000
--- a/db/migrate/20190524071727_add_ssl_valid_period_to_pages_domain.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddSslValidPeriodToPagesDomain < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def change
- add_column :pages_domains, :certificate_valid_not_before, :datetime_with_timezone
- add_column :pages_domains, :certificate_valid_not_after, :datetime_with_timezone
- end
-end
diff --git a/db/migrate/20190527011309_add_required_template_name_to_application_settings.rb b/db/migrate/20190527011309_add_required_template_name_to_application_settings.rb
deleted file mode 100644
index 9e0f5c5b1e7..00000000000
--- a/db/migrate/20190527011309_add_required_template_name_to_application_settings.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddRequiredTemplateNameToApplicationSettings < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :application_settings, :required_instance_ci_template, :string, null: true
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190527194830_add_wiki_size_to_statistics.rb b/db/migrate/20190527194830_add_wiki_size_to_statistics.rb
deleted file mode 100644
index d4f16cdec18..00000000000
--- a/db/migrate/20190527194830_add_wiki_size_to_statistics.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddWikiSizeToStatistics < ActiveRecord::Migration[5.0]
- DOWNTIME = false
-
- def change
- add_column :project_statistics, :wiki_size, :bigint
- end
-end
diff --git a/db/migrate/20190528173628_add_index_for_code_owner_rule_type_on_approval_merge_request_rules.rb b/db/migrate/20190528173628_add_index_for_code_owner_rule_type_on_approval_merge_request_rules.rb
deleted file mode 100644
index 96d878a98f2..00000000000
--- a/db/migrate/20190528173628_add_index_for_code_owner_rule_type_on_approval_merge_request_rules.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddIndexForCodeOwnerRuleTypeOnApprovalMergeRequestRules < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- INDEX_CODE_OWNERS_RULES_UNIQUENESS_NAME = 'index_approval_rule_name_for_code_owners_rule_type'
- INDEX_CODE_OWNERS_RULES_QUERY_NAME = 'index_approval_rules_code_owners_rule_type'
-
- class ApprovalMergeRequestRule < ActiveRecord::Base
- include EachBatch
-
- enum rule_types: {
- regular: 1,
- code_owner: 2
- }
- end
-
- def up
- # Ensure only 1 code_owner rule per merge_request
- add_concurrent_index(
- :approval_merge_request_rules,
- [:merge_request_id, :rule_type, :name],
- unique: true,
- where: "rule_type = #{ApprovalMergeRequestRule.rule_types[:code_owner]}",
- name: INDEX_CODE_OWNERS_RULES_UNIQUENESS_NAME
- )
-
- # Support lookups for all code_owner rules per merge_request
- add_concurrent_index(
- :approval_merge_request_rules,
- [:merge_request_id, :rule_type],
- where: "rule_type = #{ApprovalMergeRequestRule.rule_types[:code_owner]}",
- name: INDEX_CODE_OWNERS_RULES_QUERY_NAME
- )
- end
-
- def down
- remove_concurrent_index_by_name(
- :approval_merge_request_rules,
- INDEX_CODE_OWNERS_RULES_UNIQUENESS_NAME
- )
-
- remove_concurrent_index_by_name(
- :approval_merge_request_rules,
- INDEX_CODE_OWNERS_RULES_QUERY_NAME
- )
- end
-end
diff --git a/db/migrate/20190529142545_add_dns_rebinding_protection_enabled_to_application_settings.rb b/db/migrate/20190529142545_add_dns_rebinding_protection_enabled_to_application_settings.rb
deleted file mode 100644
index b50845c85b3..00000000000
--- a/db/migrate/20190529142545_add_dns_rebinding_protection_enabled_to_application_settings.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddDnsRebindingProtectionEnabledToApplicationSettings < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:application_settings, :dns_rebinding_protection_enabled, # rubocop:disable Migration/AddColumnWithDefault
- :boolean,
- default: true,
- allow_null: false)
- end
-
- def down
- remove_column(:application_settings, :dns_rebinding_protection_enabled)
- end
-end
diff --git a/db/migrate/20190530042141_add_default_git_depth_to_ci_cd_settings.rb b/db/migrate/20190530042141_add_default_git_depth_to_ci_cd_settings.rb
deleted file mode 100644
index 8abea05def4..00000000000
--- a/db/migrate/20190530042141_add_default_git_depth_to_ci_cd_settings.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddDefaultGitDepthToCiCdSettings < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :project_ci_cd_settings, :default_git_depth, :integer
- end
-end
diff --git a/db/migrate/20190530154715_add_index_to_merge_requests_state_and_merge_status.rb b/db/migrate/20190530154715_add_index_to_merge_requests_state_and_merge_status.rb
deleted file mode 100644
index e669f81ca35..00000000000
--- a/db/migrate/20190530154715_add_index_to_merge_requests_state_and_merge_status.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddIndexToMergeRequestsStateAndMergeStatus < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :merge_requests, [:state, :merge_status],
- where: "state = 'opened' AND merge_status = 'can_be_merged'"
- end
-
- def down
- remove_concurrent_index :merge_requests, [:state, :merge_status]
- end
-end
diff --git a/db/migrate/20190531153110_create_namespace_root_storage_statistics.rb b/db/migrate/20190531153110_create_namespace_root_storage_statistics.rb
deleted file mode 100644
index 702560d05cc..00000000000
--- a/db/migrate/20190531153110_create_namespace_root_storage_statistics.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class CreateNamespaceRootStorageStatistics < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def change
- create_table :namespace_root_storage_statistics, id: false, primary_key: :namespace_id do |t|
- t.integer :namespace_id, null: false, primary_key: true
- t.datetime_with_timezone :updated_at, null: false
-
- t.bigint :repository_size, null: false, default: 0
- t.bigint :lfs_objects_size, null: false, default: 0
- t.bigint :wiki_size, null: false, default: 0
- t.bigint :build_artifacts_size, null: false, default: 0
- t.bigint :storage_size, null: false, default: 0
- t.bigint :packages_size, null: false, default: 0
-
- t.index :namespace_id, unique: true
- t.foreign_key :namespaces, column: :namespace_id, on_delete: :cascade
- end
- end
-end
diff --git a/db/migrate/20190602014139_add_repository_type_to_lfs_objects_project.rb b/db/migrate/20190602014139_add_repository_type_to_lfs_objects_project.rb
deleted file mode 100644
index 6ff64ba12a9..00000000000
--- a/db/migrate/20190602014139_add_repository_type_to_lfs_objects_project.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddRepositoryTypeToLfsObjectsProject < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :lfs_objects_projects, :repository_type, :integer, limit: 2, null: true
- end
-end
diff --git a/db/migrate/20190603124955_add_index_to_count_pending_mirror_updates.rb b/db/migrate/20190603124955_add_index_to_count_pending_mirror_updates.rb
deleted file mode 100644
index 6aa94f7b20b..00000000000
--- a/db/migrate/20190603124955_add_index_to_count_pending_mirror_updates.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToCountPendingMirrorUpdates < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :project_mirror_data, [:last_update_at, :retry_count]
- end
-
- def down
- remove_concurrent_index :project_mirror_data, [:last_update_at, :retry_count]
- end
-end
diff --git a/db/migrate/20190604091310_add_ldap_membership_lock.rb b/db/migrate/20190604091310_add_ldap_membership_lock.rb
deleted file mode 100644
index d2e99f33b87..00000000000
--- a/db/migrate/20190604091310_add_ldap_membership_lock.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddLdapMembershipLock < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:application_settings, :lock_memberships_to_ldap, :boolean, default: false) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:application_settings, :lock_memberships_to_ldap)
- end
-end
diff --git a/db/migrate/20190604184643_fix_pool_repository_source_project_id.rb b/db/migrate/20190604184643_fix_pool_repository_source_project_id.rb
deleted file mode 100644
index 30244760e6b..00000000000
--- a/db/migrate/20190604184643_fix_pool_repository_source_project_id.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class FixPoolRepositorySourceProjectId < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def up
- execute "UPDATE pool_repositories SET source_project_id = (SELECT MIN(id) FROM projects WHERE pool_repository_id = pool_repositories.id) WHERE pool_repositories.source_project_id IS NULL"
- end
-
- def down
- # nothing to do her
- end
-end
diff --git a/db/migrate/20190605104727_add_default_project_deletion_protection_to_application_settings.rb b/db/migrate/20190605104727_add_default_project_deletion_protection_to_application_settings.rb
deleted file mode 100644
index e660c918fa4..00000000000
--- a/db/migrate/20190605104727_add_default_project_deletion_protection_to_application_settings.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddDefaultProjectDeletionProtectionToApplicationSettings < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- # rubocop:disable Migration/AddColumnWithDefault
- add_column_with_default :application_settings, :default_project_deletion_protection, :boolean, default: false, allow_null: false
- # rubocop:enable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :application_settings, :default_project_deletion_protection
- end
-end
diff --git a/db/migrate/20190605184422_create_namespace_aggregation_schedules.rb b/db/migrate/20190605184422_create_namespace_aggregation_schedules.rb
deleted file mode 100644
index 5e8cb616cc1..00000000000
--- a/db/migrate/20190605184422_create_namespace_aggregation_schedules.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class CreateNamespaceAggregationSchedules < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def change
- create_table :namespace_aggregation_schedules, id: false, primary_key: :namespace_id do |t|
- t.integer :namespace_id, null: false, primary_key: true
-
- t.index :namespace_id, unique: true
- t.foreign_key :namespaces, column: :namespace_id, on_delete: :cascade
- end
- end
-end
diff --git a/db/migrate/20190606014128_add_last_ci_minutes_notification_at_to_namespaces.rb b/db/migrate/20190606014128_add_last_ci_minutes_notification_at_to_namespaces.rb
deleted file mode 100644
index 53b2e9f01fe..00000000000
--- a/db/migrate/20190606014128_add_last_ci_minutes_notification_at_to_namespaces.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddLastCiMinutesNotificationAtToNamespaces < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def change
- add_column :namespaces, :last_ci_minutes_notification_at, :datetime_with_timezone # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20190606034427_add_lfs_object_id_index_to_lfs_objects_projects.rb b/db/migrate/20190606034427_add_lfs_object_id_index_to_lfs_objects_projects.rb
deleted file mode 100644
index fc09fcfae0f..00000000000
--- a/db/migrate/20190606034427_add_lfs_object_id_index_to_lfs_objects_projects.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddLfsObjectIdIndexToLfsObjectsProjects < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :lfs_objects_projects, :lfs_object_id
- end
-
- def down
- remove_concurrent_index :lfs_objects_projects, :lfs_object_id
- end
-end
diff --git a/db/migrate/20190606054649_change_operations_feature_flags_clients_token_not_null.rb b/db/migrate/20190606054649_change_operations_feature_flags_clients_token_not_null.rb
deleted file mode 100644
index c9dbb48f5bd..00000000000
--- a/db/migrate/20190606054649_change_operations_feature_flags_clients_token_not_null.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeOperationsFeatureFlagsClientsTokenNotNull < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- change_column_null :operations_feature_flags_clients, :token, true
- end
-end
diff --git a/db/migrate/20190606054742_add_token_encrypted_to_operations_feature_flags_clients.rb b/db/migrate/20190606054742_add_token_encrypted_to_operations_feature_flags_clients.rb
deleted file mode 100644
index 01cd49ac219..00000000000
--- a/db/migrate/20190606054742_add_token_encrypted_to_operations_feature_flags_clients.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddTokenEncryptedToOperationsFeatureFlagsClients < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :operations_feature_flags_clients, :token_encrypted, :string
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190606054832_add_index_to_operations_feature_flags_clients_token_encrypted.rb b/db/migrate/20190606054832_add_index_to_operations_feature_flags_clients_token_encrypted.rb
deleted file mode 100644
index 5627457af5c..00000000000
--- a/db/migrate/20190606054832_add_index_to_operations_feature_flags_clients_token_encrypted.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToOperationsFeatureFlagsClientsTokenEncrypted < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :operations_feature_flags_clients, [:project_id, :token_encrypted],
- unique: true, name: "index_feature_flags_clients_on_project_id_and_token_encrypted"
- end
-
- def down
- remove_concurrent_index_by_name :operations_feature_flags_clients, "index_feature_flags_clients_on_project_id_and_token_encrypted"
- end
-end
diff --git a/db/migrate/20190606202100_add_name_to_badges.rb b/db/migrate/20190606202100_add_name_to_badges.rb
deleted file mode 100644
index 7b386a6e690..00000000000
--- a/db/migrate/20190606202100_add_name_to_badges.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddNameToBadges < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :badges, :name, :string, null: true, limit: 255 # rubocop:disable Migration/PreventStrings
- end
-end
diff --git a/db/migrate/20190607085356_add_source_to_pages_domains.rb b/db/migrate/20190607085356_add_source_to_pages_domains.rb
deleted file mode 100644
index d681ab67431..00000000000
--- a/db/migrate/20190607085356_add_source_to_pages_domains.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddSourceToPagesDomains < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:pages_domains, :certificate_source, :smallint, default: 0) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:pages_domains, :certificate_source)
- end
-end
diff --git a/db/migrate/20190607145325_add_pages_domains_ssl_renew_index.rb b/db/migrate/20190607145325_add_pages_domains_ssl_renew_index.rb
deleted file mode 100644
index 7167accbf1e..00000000000
--- a/db/migrate/20190607145325_add_pages_domains_ssl_renew_index.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddPagesDomainsSslRenewIndex < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- INDEX_NAME = 'index_pages_domains_need_auto_ssl_renewal'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:pages_domains, [:certificate_source, :certificate_valid_not_after],
- where: "auto_ssl_enabled = #{::Gitlab::Database.true_value}", name: INDEX_NAME)
- end
-
- def down
- remove_concurrent_index(:pages_domains, [:certificate_source, :certificate_valid_not_after],
- where: "auto_ssl_enabled = #{::Gitlab::Database.true_value}", name: INDEX_NAME)
- end
-end
diff --git a/db/migrate/20190607190856_add_index_to_users_public_emails.rb b/db/migrate/20190607190856_add_index_to_users_public_emails.rb
deleted file mode 100644
index 81ec38b8b32..00000000000
--- a/db/migrate/20190607190856_add_index_to_users_public_emails.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddIndexToUsersPublicEmails < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :users, [:public_email],
- where: "public_email != ''"
- end
-
- def down
- remove_concurrent_index :users, [:public_email],
- where: "public_email != ''"
- end
-end
diff --git a/db/migrate/20190607205656_add_wiki_columns_to_index_status.rb b/db/migrate/20190607205656_add_wiki_columns_to_index_status.rb
deleted file mode 100644
index 0910d425212..00000000000
--- a/db/migrate/20190607205656_add_wiki_columns_to_index_status.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-class AddWikiColumnsToIndexStatus < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :index_statuses, :last_wiki_commit, :binary
- add_column :index_statuses, :wiki_indexed_at, :datetime_with_timezone
- end
-end
diff --git a/db/migrate/20190610142825_add_index_to_members_invite_email.rb b/db/migrate/20190610142825_add_index_to_members_invite_email.rb
deleted file mode 100644
index 58157cc5313..00000000000
--- a/db/migrate/20190610142825_add_index_to_members_invite_email.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddIndexToMembersInviteEmail < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :members, [:invite_email]
- end
-
- def down
- remove_concurrent_index :members, [:invite_email]
- end
-end
diff --git a/db/migrate/20190611090827_add_time_tracking_limit_to_hours_to_application_settings.rb b/db/migrate/20190611090827_add_time_tracking_limit_to_hours_to_application_settings.rb
deleted file mode 100644
index f0a3ec1d3bc..00000000000
--- a/db/migrate/20190611090827_add_time_tracking_limit_to_hours_to_application_settings.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddTimeTrackingLimitToHoursToApplicationSettings < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- # rubocop:disable Migration/AddColumnWithDefault
- add_column_with_default :application_settings, :time_tracking_limit_to_hours, :boolean, default: false, allow_null: false
- # rubocop:enable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :application_settings, :time_tracking_limit_to_hours
- end
-end
diff --git a/db/migrate/20190611100201_add_geo_container_repository_updated_events_table.rb b/db/migrate/20190611100201_add_geo_container_repository_updated_events_table.rb
deleted file mode 100644
index 8963e837e08..00000000000
--- a/db/migrate/20190611100201_add_geo_container_repository_updated_events_table.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddGeoContainerRepositoryUpdatedEventsTable < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :geo_container_repository_updated_events, force: :cascade do |t|
- t.integer :container_repository_id, null: false
-
- t.index :container_repository_id, name: :idx_geo_con_rep_updated_events_on_container_repository_id, using: :btree
- end
-
- add_column :geo_event_log, :container_repository_updated_event_id, :bigint
- end
-end
diff --git a/db/migrate/20190611100202_add_index_to_geo_event_log.rb b/db/migrate/20190611100202_add_index_to_geo_event_log.rb
deleted file mode 100644
index c5c855fed61..00000000000
--- a/db/migrate/20190611100202_add_index_to_geo_event_log.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToGeoEventLog < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :geo_event_log, :container_repository_updated_event_id
- end
-
- def down
- remove_concurrent_index(:geo_event_log, :container_repository_updated_event_id)
- end
-end
diff --git a/db/migrate/20190611161641_add_target_project_id_to_merge_trains.rb b/db/migrate/20190611161641_add_target_project_id_to_merge_trains.rb
deleted file mode 100644
index 7b73202ab8d..00000000000
--- a/db/migrate/20190611161641_add_target_project_id_to_merge_trains.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddTargetProjectIdToMergeTrains < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Rails/NotNullColumn
- # rubocop:disable Migration/AddReference
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- add_reference :merge_trains, :target_project, null: false, index: true, foreign_key: { on_delete: :cascade, to_table: :projects }, type: :integer
- add_column :merge_trains, :target_branch, :text, null: false
- end
- # rubocop:enable Migration/AddLimitToTextColumns
- # rubocop:enable Migration/AddReference
- # rubocop:enable Rails/NotNullColumn
-end
diff --git a/db/migrate/20190612111201_add_geo_container_repository_counters.rb b/db/migrate/20190612111201_add_geo_container_repository_counters.rb
deleted file mode 100644
index b73bb885ab7..00000000000
--- a/db/migrate/20190612111201_add_geo_container_repository_counters.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddGeoContainerRepositoryCounters < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- change_table :geo_node_statuses do |t|
- t.column :container_repositories_count, :integer
- t.column :container_repositories_synced_count, :integer
- t.column :container_repositories_failed_count, :integer
- t.column :container_repositories_registry_count, :integer
- end
- end
-end
diff --git a/db/migrate/20190612111404_add_geo_container_sync_capacity.rb b/db/migrate/20190612111404_add_geo_container_sync_capacity.rb
deleted file mode 100644
index d4cd569f460..00000000000
--- a/db/migrate/20190612111404_add_geo_container_sync_capacity.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddGeoContainerSyncCapacity < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- change_table :geo_nodes do |t|
- t.column :container_repositories_max_capacity, :integer, default: 10, null: false
- end
- end
-end
diff --git a/db/migrate/20190613030606_enable_hashed_storage_by_default.rb b/db/migrate/20190613030606_enable_hashed_storage_by_default.rb
deleted file mode 100644
index 8edefd1273e..00000000000
--- a/db/migrate/20190613030606_enable_hashed_storage_by_default.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class EnableHashedStorageByDefault < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- change_column_default :application_settings, :hashed_storage_enabled, true
- end
-
- def down
- change_column_default :application_settings, :hashed_storage_enabled, false
- end
-end
diff --git a/db/migrate/20190613044655_add_username_to_deploy_tokens.rb b/db/migrate/20190613044655_add_username_to_deploy_tokens.rb
deleted file mode 100644
index ac5a6589f07..00000000000
--- a/db/migrate/20190613044655_add_username_to_deploy_tokens.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddUsernameToDeployTokens < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def change
- add_column :deploy_tokens, :username, :string # rubocop:disable Migration/PreventStrings
- end
-end
diff --git a/db/migrate/20190613073003_create_project_aliases.rb b/db/migrate/20190613073003_create_project_aliases.rb
deleted file mode 100644
index ee111d437e9..00000000000
--- a/db/migrate/20190613073003_create_project_aliases.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class CreateProjectAliases < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :project_aliases do |t|
- t.references :project, null: false, index: true, foreign_key: { on_delete: :cascade }, type: :integer
- t.string :name, null: false, index: { unique: true } # rubocop:disable Migration/PreventStrings
-
- t.timestamps_with_timezone null: false
- end
- end
-end
diff --git a/db/migrate/20190617123615_add_grafana_to_settings.rb b/db/migrate/20190617123615_add_grafana_to_settings.rb
deleted file mode 100644
index 2d2250cef27..00000000000
--- a/db/migrate/20190617123615_add_grafana_to_settings.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddGrafanaToSettings < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- def up
- add_column_with_default(:application_settings, :grafana_enabled, :boolean, # rubocop:disable Migration/AddColumnWithDefault
- default: false, allow_null: false)
- end
-
- def down
- remove_column(:application_settings, :grafana_enabled)
- end
-end
diff --git a/db/migrate/20190620105427_change_null_private_profile_to_false.rb b/db/migrate/20190620105427_change_null_private_profile_to_false.rb
deleted file mode 100644
index d820dbbe9d3..00000000000
--- a/db/migrate/20190620105427_change_null_private_profile_to_false.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeNullPrivateProfileToFalse < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- DELAY = 30.seconds.to_i
- BATCH_SIZE = 1_000
-
- disable_ddl_transaction!
-
- class User < ActiveRecord::Base
- self.table_name = 'users'
-
- include ::EachBatch
- end
-
- def up
- change_column_default :users, :private_profile, false
-
- # Migration will take about 120 hours
- User.where(private_profile: nil).each_batch(of: BATCH_SIZE) do |batch, index|
- range = batch.pluck('MIN(id)', 'MAX(id)').first
- delay = index * DELAY
-
- BackgroundMigrationWorker.perform_in(delay.seconds, 'MigrateNullPrivateProfileToFalse', [*range])
- end
- end
-
- def down
- change_column_default :users, :private_profile, nil
- end
-end
diff --git a/db/migrate/20190621022810_add_last_ci_minutes_usage_notification_level_to_namespaces.rb b/db/migrate/20190621022810_add_last_ci_minutes_usage_notification_level_to_namespaces.rb
deleted file mode 100644
index 02e06703acc..00000000000
--- a/db/migrate/20190621022810_add_last_ci_minutes_usage_notification_level_to_namespaces.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddLastCiMinutesUsageNotificationLevelToNamespaces < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def change
- add_column :namespaces, :last_ci_minutes_usage_notification_level, :integer # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20190621151636_add_merge_request_rebase_jid.rb b/db/migrate/20190621151636_add_merge_request_rebase_jid.rb
deleted file mode 100644
index df1b1c79375..00000000000
--- a/db/migrate/20190621151636_add_merge_request_rebase_jid.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddMergeRequestRebaseJid < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def change
- add_column :merge_requests, :rebase_jid, :string # rubocop:disable Migration/PreventStrings
- end
-end
diff --git a/db/migrate/20190623212503_add_cluster_id_to_deployments.rb b/db/migrate/20190623212503_add_cluster_id_to_deployments.rb
deleted file mode 100644
index cd0c4191568..00000000000
--- a/db/migrate/20190623212503_add_cluster_id_to_deployments.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddClusterIdToDeployments < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def change
- add_column :deployments, :cluster_id, :integer
- end
-end
diff --git a/db/migrate/20190624123615_add_grafana_url_to_settings.rb b/db/migrate/20190624123615_add_grafana_url_to_settings.rb
deleted file mode 100644
index f10014872e9..00000000000
--- a/db/migrate/20190624123615_add_grafana_url_to_settings.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class AddGrafanaUrlToSettings < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def up
- add_column_with_default(:application_settings, :grafana_url, :string, # rubocop:disable Migration/AddColumnWithDefault
- default: '/-/grafana', allow_null: false)
- end
- # rubocop:enable Migration/PreventStrings
-
- def down
- remove_column(:application_settings, :grafana_url)
- end
-end
diff --git a/db/migrate/20190625115224_add_description_to_services.rb b/db/migrate/20190625115224_add_description_to_services.rb
deleted file mode 100644
index bdd6d70cb0f..00000000000
--- a/db/migrate/20190625115224_add_description_to_services.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddDescriptionToServices < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :services, :description, :string, limit: 500 # rubocop:disable Migration/PreventStrings
- end
-end
diff --git a/db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb b/db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb
deleted file mode 100644
index 6fcadc0c82c..00000000000
--- a/db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddGroupCreationLevelToNamespaces < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- add_column(:namespaces, :subgroup_creation_level, :integer) # rubocop:disable Migration/AddColumnsToWideTables
- change_column_default(:namespaces,
- :subgroup_creation_level,
- ::Gitlab::Access::MAINTAINER_SUBGROUP_ACCESS)
- end
-
- def down
- remove_column(:namespaces, :subgroup_creation_level)
- end
-end
diff --git a/db/migrate/20190627051902_add_cluster_id_index_fk_to_deployments.rb b/db/migrate/20190627051902_add_cluster_id_index_fk_to_deployments.rb
deleted file mode 100644
index f41e5c80269..00000000000
--- a/db/migrate/20190627051902_add_cluster_id_index_fk_to_deployments.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddClusterIdIndexFkToDeployments < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :deployments, :cluster_id
-
- add_concurrent_foreign_key :deployments, :clusters, column: :cluster_id, on_delete: :nullify
- end
-
- def down
- remove_foreign_key :deployments, :clusters
-
- remove_concurrent_index :deployments, :cluster_id
- end
-end
diff --git a/db/migrate/20190627100221_add_mr_productivity_metrics.rb b/db/migrate/20190627100221_add_mr_productivity_metrics.rb
deleted file mode 100644
index b6f1520cb2d..00000000000
--- a/db/migrate/20190627100221_add_mr_productivity_metrics.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class AddMrProductivityMetrics < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def change
- add_column :merge_request_metrics, :first_comment_at, :datetime_with_timezone
- add_column :merge_request_metrics, :first_commit_at, :datetime_with_timezone
- add_column :merge_request_metrics, :last_commit_at, :datetime_with_timezone
- add_column :merge_request_metrics, :diff_size, :integer
- add_column :merge_request_metrics, :modified_paths_size, :integer
- add_column :merge_request_metrics, :commits_count, :integer
- end
-end
diff --git a/db/migrate/20190627122264_add_foreign_keys_for_container_repository.rb b/db/migrate/20190627122264_add_foreign_keys_for_container_repository.rb
deleted file mode 100644
index cf7fd03e9af..00000000000
--- a/db/migrate/20190627122264_add_foreign_keys_for_container_repository.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class AddForeignKeysForContainerRepository < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key(:geo_container_repository_updated_events, :container_repositories, column: :container_repository_id, on_delete: :cascade)
-
- add_concurrent_foreign_key(:geo_event_log, :geo_container_repository_updated_events, column: :container_repository_updated_event_id, on_delete: :cascade)
- end
-
- def down
- if foreign_key_exists?(:geo_container_repository_updated_events, :container_repositories)
- remove_foreign_key(:geo_container_repository_updated_events, :container_repositories)
- end
-
- if foreign_key_exists?(:geo_event_log, :geo_container_repository_updated_events)
- remove_foreign_key(:geo_event_log, :geo_container_repository_updated_events)
- end
- end
-end
diff --git a/db/migrate/20190628145246_add_strategies_to_operations_feature_flag_scopes.rb b/db/migrate/20190628145246_add_strategies_to_operations_feature_flag_scopes.rb
deleted file mode 100644
index 185a2b04531..00000000000
--- a/db/migrate/20190628145246_add_strategies_to_operations_feature_flag_scopes.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddStrategiesToOperationsFeatureFlagScopes < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- # rubocop:disable Migration/AddColumnWithDefault
- add_column_with_default :operations_feature_flag_scopes, :strategies, :jsonb, default: [{ name: "default", parameters: {} }]
- # rubocop:enable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:operations_feature_flag_scopes, :strategies)
- end
-end
diff --git a/db/migrate/20190628185000_add_released_at_to_releases_table.rb b/db/migrate/20190628185000_add_released_at_to_releases_table.rb
deleted file mode 100644
index ae55aa434d9..00000000000
--- a/db/migrate/20190628185000_add_released_at_to_releases_table.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddReleasedAtToReleasesTable < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column(:releases, :released_at, :datetime_with_timezone)
- end
-end
diff --git a/db/migrate/20190628185004_backfill_and_add_not_null_constraint_to_released_at_column_on_releases_table.rb b/db/migrate/20190628185004_backfill_and_add_not_null_constraint_to_released_at_column_on_releases_table.rb
deleted file mode 100644
index 1e5d3e8f235..00000000000
--- a/db/migrate/20190628185004_backfill_and_add_not_null_constraint_to_released_at_column_on_releases_table.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class BackfillAndAddNotNullConstraintToReleasedAtColumnOnReleasesTable < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- update_column_in_batches(:releases, :released_at, Arel.sql('created_at'))
- change_column_null(:releases, :released_at, false)
- end
-
- def down
- change_column_null(:releases, :released_at, true)
- end
-end
diff --git a/db/migrate/20190703043358_add_commit_id_to_draft_notes.rb b/db/migrate/20190703043358_add_commit_id_to_draft_notes.rb
deleted file mode 100644
index 022400ce585..00000000000
--- a/db/migrate/20190703043358_add_commit_id_to_draft_notes.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddCommitIdToDraftNotes < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :draft_notes, :commit_id, :binary
- end
-end
diff --git a/db/migrate/20190703130053_remove_gitaly_feature_flags.rb b/db/migrate/20190703130053_remove_gitaly_feature_flags.rb
deleted file mode 100644
index 13ac10a5e21..00000000000
--- a/db/migrate/20190703130053_remove_gitaly_feature_flags.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveGitalyFeatureFlags < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- FEATURES = %w[
- gitaly_batch_lfs_pointers gitaly_blame gitaly_blob_get_all_lfs_pointers gitaly_blob_get_new_lfs_pointers
- gitaly_branch_names gitaly_branch_names_contains_sha gitaly_branches gitaly_bundle_to_disk
- gitaly_calculate_checksum gitaly_can_be_merged gitaly_cherry_pick gitaly_commit_count
- gitaly_commit_deltas gitaly_commit_languages gitaly_commit_messages gitaly_commit_patch
- gitaly_commit_raw_diffs gitaly_commit_stats gitaly_commit_tree_entry gitaly_commits_between
- gitaly_commits_by_message gitaly_conflicts_list_conflict_files gitaly_conflicts_resolve_conflicts gitaly_count_commits
- gitaly_count_diverging_commits_no_max gitaly_create_branch gitaly_create_repo_from_bundle gitaly_create_repository
- gitaly_delete_branch gitaly_delete_refs gitaly_delta_islands gitaly_deny_disk_acces
- gitaly_diff_between gitaly_extract_commit_signature gitaly_fetch_ref gitaly_fetch_remote
- gitaly_fetch_source_branch gitaly_filter_shas_with_signature gitaly_filter_shas_with_signatures gitaly_find_all_commits
- gitaly_find_branch gitaly_find_commit gitaly_find_commits gitaly_find_ref_name
- gitaly_force_push gitaly_fork_repository gitaly_garbage_collect gitaly_get_info_attributes
- gitaly_git_blob_load_all_data gitaly_git_blob_raw gitaly_git_fsck gitaly_go-find-all-tags
- gitaly_has_local_branches gitaly_import_repository gitaly_is_ancestor gitaly_last_commit_for_path
- gitaly_license_short_name gitaly_list_blobs_by_sha_path gitaly_list_commits_by_oid gitaly_local_branches
- gitaly_ls_files gitaly_merge_base gitaly_merged_branch_names gitaly_new_commits
- gitaly_operation_user_add_tag gitaly_operation_user_commit_file gitaly_operation_user_commit_files gitaly_operation_user_create_branch
- gitaly_operation_user_delete_branch gitaly_operation_user_delete_tag gitaly_operation_user_ff_branch gitaly_operation_user_merge_branch
- gitaly_post_receive_pack gitaly_post_upload_pack gitaly_project_raw_show gitaly_raw_changes_between
- gitaly_rebase gitaly_rebase_in_progress gitaly_ref_delete_refs gitaly_ref_exists
- gitaly_ref_exists_branch gitaly_ref_exists_branches gitaly_ref_find_all_remote_branches gitaly_remote_add_remote
- gitaly_remote_fetch_internal_remote gitaly_remote_remove_remote gitaly_remote_update_remote_mirror gitaly_remove_namespace
- gitaly_repack_full gitaly_repack_incremental gitaly_repository_cleanup gitaly_repository_exists
- gitaly_repository_size gitaly_root_ref gitaly_search_files_by_content gitaly_search_files_by_name
- gitaly_squash gitaly_squash_in_progress gitaly_ssh_receive_pack gitaly_ssh_upload_pack
- gitaly_submodule_url_for gitaly_tag_messages gitaly_tag_names gitaly_tag_names_contains_sha
- gitaly_tags gitaly_tree_entries gitaly_wiki_delete_page gitaly_wiki_find_file
- gitaly_wiki_find_page gitaly_wiki_get_all_pages gitaly_wiki_page_formatted_data gitaly_wiki_page_versions
- gitaly_wiki_update_page gitaly_wiki_write_page gitaly_workhorse_archive gitaly_workhorse_raw_show
- gitaly_workhorse_send_git_diff gitaly_workhorse_send_git_patch gitaly_write_config gitaly_write_ref
- ]
-
- class Feature < ActiveRecord::Base
- self.table_name = 'features'
- end
-
- def up
- Feature.where(key: FEATURES).delete_all
- end
-end
diff --git a/db/migrate/20190703171157_add_sourcing_epic_dates.rb b/db/migrate/20190703171157_add_sourcing_epic_dates.rb
deleted file mode 100644
index 202e2098d5b..00000000000
--- a/db/migrate/20190703171157_add_sourcing_epic_dates.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class AddSourcingEpicDates < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def change
- add_column :epics, :start_date_sourcing_epic_id, :integer
- add_column :epics, :due_date_sourcing_epic_id, :integer
- end
-end
diff --git a/db/migrate/20190703171555_add_sourcing_epic_dates_fks.rb b/db/migrate/20190703171555_add_sourcing_epic_dates_fks.rb
deleted file mode 100644
index 4995a3cd03f..00000000000
--- a/db/migrate/20190703171555_add_sourcing_epic_dates_fks.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class AddSourcingEpicDatesFks < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :epics, :start_date_sourcing_epic_id, where: 'start_date_sourcing_epic_id is not null'
- add_concurrent_index :epics, :due_date_sourcing_epic_id, where: 'due_date_sourcing_epic_id is not null'
-
- add_concurrent_foreign_key :epics, :epics, column: :start_date_sourcing_epic_id, on_delete: :nullify
- add_concurrent_foreign_key :epics, :epics, column: :due_date_sourcing_epic_id, on_delete: :nullify
- end
-
- def down
- remove_foreign_key_if_exists :epics, column: :start_date_sourcing_epic_id
- remove_foreign_key_if_exists :epics, column: :due_date_sourcing_epic_id
-
- remove_concurrent_index :epics, :start_date_sourcing_epic_id
- remove_concurrent_index :epics, :due_date_sourcing_epic_id
- end
-end
diff --git a/db/migrate/20190709204413_add_rule_type_to_approval_project_rules.rb b/db/migrate/20190709204413_add_rule_type_to_approval_project_rules.rb
deleted file mode 100644
index b11154d0f26..00000000000
--- a/db/migrate/20190709204413_add_rule_type_to_approval_project_rules.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddRuleTypeToApprovalProjectRules < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :approval_project_rules, :rule_type, :integer, limit: 2, default: 0, allow_null: false # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :approval_project_rules, :rule_type
- end
-end
diff --git a/db/migrate/20190709220014_import_common_metrics_y_axis.rb b/db/migrate/20190709220014_import_common_metrics_y_axis.rb
deleted file mode 100644
index 89ecf32ecc1..00000000000
--- a/db/migrate/20190709220014_import_common_metrics_y_axis.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class ImportCommonMetricsYAxis < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def up
- ::Gitlab::DatabaseImporters::CommonMetrics::Importer.new.execute
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20190709220143_add_index_to_issues_relative_position.rb b/db/migrate/20190709220143_add_index_to_issues_relative_position.rb
deleted file mode 100644
index ec11c6d768f..00000000000
--- a/db/migrate/20190709220143_add_index_to_issues_relative_position.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToIssuesRelativePosition < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_issues_on_project_id_and_state_and_rel_position_and_id'
-
- def up
- add_concurrent_index :issues, [:project_id, :state, :relative_position, :id], order: { id: :desc }, name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index_by_name :issues, INDEX_NAME
- end
-end
diff --git a/db/migrate/20190710151229_add_index_to_approval_project_rules_rule_type.rb b/db/migrate/20190710151229_add_index_to_approval_project_rules_rule_type.rb
deleted file mode 100644
index 64123c53c4a..00000000000
--- a/db/migrate/20190710151229_add_index_to_approval_project_rules_rule_type.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToApprovalProjectRulesRuleType < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :approval_project_rules, :rule_type
- end
-
- def down
- remove_concurrent_index :approval_project_rules, :rule_type
- end
-end
diff --git a/db/migrate/20190711124721_create_job_variables.rb b/db/migrate/20190711124721_create_job_variables.rb
deleted file mode 100644
index 6174afc236c..00000000000
--- a/db/migrate/20190711124721_create_job_variables.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreateJobVariables < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- create_table :ci_job_variables do |t|
- t.string :key, null: false
- t.text :encrypted_value
- t.string :encrypted_value_iv
- t.references :job, null: false, index: true, foreign_key: { to_table: :ci_builds, on_delete: :cascade }
- t.integer :variable_type, null: false, limit: 2, default: 1
- end
-
- add_index :ci_job_variables, [:key, :job_id], unique: true
- end
- # rubocop:enable Migration/AddLimitToTextColumns
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190711200053_change_deploy_tokens_token_not_null.rb b/db/migrate/20190711200053_change_deploy_tokens_token_not_null.rb
deleted file mode 100644
index 14ccf544d0b..00000000000
--- a/db/migrate/20190711200053_change_deploy_tokens_token_not_null.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeDeployTokensTokenNotNull < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- change_column_null :deploy_tokens, :token, true
- end
-end
diff --git a/db/migrate/20190711200508_add_token_encrypted_to_deploy_tokens.rb b/db/migrate/20190711200508_add_token_encrypted_to_deploy_tokens.rb
deleted file mode 100644
index dff682e8ce7..00000000000
--- a/db/migrate/20190711200508_add_token_encrypted_to_deploy_tokens.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddTokenEncryptedToDeployTokens < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :deploy_tokens, :token_encrypted, :string, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190712040400_add_environment_id_to_clusters_kubernetes_namespaces.rb b/db/migrate/20190712040400_add_environment_id_to_clusters_kubernetes_namespaces.rb
deleted file mode 100644
index 7f465c0a962..00000000000
--- a/db/migrate/20190712040400_add_environment_id_to_clusters_kubernetes_namespaces.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-class AddEnvironmentIdToClustersKubernetesNamespaces < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def change
- # rubocop:disable Migration/AddReference
- add_reference :clusters_kubernetes_namespaces, :environment,
- index: true, type: :bigint, foreign_key: { on_delete: :nullify }
- # rubocop:enable Migration/AddReference
- end
-end
diff --git a/db/migrate/20190712040412_index_clusters_kubernetes_namespaces_on_environment_id.rb b/db/migrate/20190712040412_index_clusters_kubernetes_namespaces_on_environment_id.rb
deleted file mode 100644
index 23082492091..00000000000
--- a/db/migrate/20190712040412_index_clusters_kubernetes_namespaces_on_environment_id.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class IndexClustersKubernetesNamespacesOnEnvironmentId < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_kubernetes_namespaces_on_cluster_project_environment_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :clusters_kubernetes_namespaces, [:cluster_id, :project_id, :environment_id], unique: true, name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index :clusters_kubernetes_namespaces, name: INDEX_NAME
- end
-end
diff --git a/db/migrate/20190712064021_add_namespace_per_environment_flag_to_clusters.rb b/db/migrate/20190712064021_add_namespace_per_environment_flag_to_clusters.rb
deleted file mode 100644
index 771eb21c4b6..00000000000
--- a/db/migrate/20190712064021_add_namespace_per_environment_flag_to_clusters.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddNamespacePerEnvironmentFlagToClusters < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :clusters, :namespace_per_environment, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :clusters, :namespace_per_environment
- end
-end
diff --git a/db/migrate/20190715042813_add_issue_id_to_versions.rb b/db/migrate/20190715042813_add_issue_id_to_versions.rb
deleted file mode 100644
index 623e72c1096..00000000000
--- a/db/migrate/20190715042813_add_issue_id_to_versions.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddIssueIdToVersions < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def up
- # rubocop:disable Migration/AddReference
- add_reference :design_management_versions, :issue, index: true, foreign_key: { on_delete: :cascade }
- # rubocop:enable Migration/AddReference
- end
-
- def down
- remove_reference :design_management_versions, :issue
- end
-end
diff --git a/db/migrate/20190715043954_set_issue_id_for_all_versions.rb b/db/migrate/20190715043954_set_issue_id_for_all_versions.rb
deleted file mode 100644
index 345b749f1a4..00000000000
--- a/db/migrate/20190715043954_set_issue_id_for_all_versions.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class SetIssueIdForAllVersions < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def up
- execute('UPDATE design_management_versions as versions SET issue_id = (
- SELECT design_management_designs.issue_id
- FROM design_management_designs
- INNER JOIN design_management_designs_versions ON design_management_designs.id = design_management_designs_versions.design_id
- WHERE design_management_designs_versions.version_id = versions.id
- LIMIT 1
- )')
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20190715140740_add_event_type_to_design_management_designs_versions.rb b/db/migrate/20190715140740_add_event_type_to_design_management_designs_versions.rb
deleted file mode 100644
index 136a9d27e25..00000000000
--- a/db/migrate/20190715140740_add_event_type_to_design_management_designs_versions.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-# This migration sets up a event enum on the DesignsVersions join table
-class AddEventTypeToDesignManagementDesignsVersions < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # We disable these cops here because adding this column is safe. The table does not
- # have any data in it.
- # rubocop: disable Migration/AddIndex
- def up
- add_column(:design_management_designs_versions, :event, :integer,
- limit: 2,
- null: false,
- default: 0)
- add_index(:design_management_designs_versions, :event)
- end
-
- # rubocop: disable Migration/RemoveIndex
- def down
- remove_index(:design_management_designs_versions, :event)
- remove_column(:design_management_designs_versions, :event)
- end
-end
diff --git a/db/migrate/20190715142138_add_raw_blob_request_limit_to_application_settings.rb b/db/migrate/20190715142138_add_raw_blob_request_limit_to_application_settings.rb
deleted file mode 100644
index e8198e11ea7..00000000000
--- a/db/migrate/20190715142138_add_raw_blob_request_limit_to_application_settings.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddRawBlobRequestLimitToApplicationSettings < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :application_settings, :raw_blob_request_limit, :integer, default: 300, null: false
- end
-end
diff --git a/db/migrate/20190715173819_add_object_storage_flag_to_geo_node.rb b/db/migrate/20190715173819_add_object_storage_flag_to_geo_node.rb
deleted file mode 100644
index cbc353b6282..00000000000
--- a/db/migrate/20190715173819_add_object_storage_flag_to_geo_node.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddObjectStorageFlagToGeoNode < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :geo_nodes, :sync_object_storage, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :geo_nodes, :sync_object_storage
- end
-end
diff --git a/db/migrate/20190715215532_add_project_emails_disabled.rb b/db/migrate/20190715215532_add_project_emails_disabled.rb
deleted file mode 100644
index 72dba82ef1c..00000000000
--- a/db/migrate/20190715215532_add_project_emails_disabled.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectEmailsDisabled < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :projects, :emails_disabled, :boolean # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20190715215549_add_group_emails_disabled.rb b/db/migrate/20190715215549_add_group_emails_disabled.rb
deleted file mode 100644
index 63a815cb880..00000000000
--- a/db/migrate/20190715215549_add_group_emails_disabled.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddGroupEmailsDisabled < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :namespaces, :emails_disabled, :boolean # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20190716144222_create_analytics_cycle_analytics_project_stages.rb b/db/migrate/20190716144222_create_analytics_cycle_analytics_project_stages.rb
deleted file mode 100644
index 5723f6db0a3..00000000000
--- a/db/migrate/20190716144222_create_analytics_cycle_analytics_project_stages.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# frozen_string_literal: true
-
-class CreateAnalyticsCycleAnalyticsProjectStages < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- INDEX_PREFIX = 'index_analytics_ca_project_stages_'
-
- def change
- create_table :analytics_cycle_analytics_project_stages do |t|
- t.timestamps_with_timezone
- t.integer :relative_position
- t.integer :start_event_identifier, null: false
- t.integer :end_event_identifier, null: false
-
- t.references(:project,
- null: false,
- foreign_key: { to_table: :projects, on_delete: :cascade },
- index: { name: INDEX_PREFIX + 'on_project_id' }
- )
- t.references(:start_event_label,
- foreign_key: { to_table: :labels, on_delete: :cascade },
- index: { name: INDEX_PREFIX + 'on_start_event_label_id' }
- )
- t.references(:end_event_label,
- foreign_key: { to_table: :labels, on_delete: :cascade },
- index: { name: INDEX_PREFIX + 'on_end_event_label_id' }
- )
- t.boolean :hidden, default: false, null: false
- t.boolean :custom, default: true, null: false
- t.string :name, null: false, limit: 255 # rubocop:disable Migration/PreventStrings
- end
-
- add_index :analytics_cycle_analytics_project_stages, [:project_id, :name], unique: true, name: INDEX_PREFIX + 'on_project_id_and_name'
- add_index :analytics_cycle_analytics_project_stages, [:relative_position], name: INDEX_PREFIX + 'on_relative_position'
- end
-end
diff --git a/db/migrate/20190719122333_add_login_recaptcha_protection_enabled_to_application_settings.rb b/db/migrate/20190719122333_add_login_recaptcha_protection_enabled_to_application_settings.rb
deleted file mode 100644
index 4561e1e8aa9..00000000000
--- a/db/migrate/20190719122333_add_login_recaptcha_protection_enabled_to_application_settings.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddLoginRecaptchaProtectionEnabledToApplicationSettings < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- def change
- add_column :application_settings, :login_recaptcha_protection_enabled, :boolean, default: false, null: false
- end
-end
diff --git a/db/migrate/20190719174505_add_index_to_deploy_tokens_token_encrypted.rb b/db/migrate/20190719174505_add_index_to_deploy_tokens_token_encrypted.rb
deleted file mode 100644
index d58d1d8348c..00000000000
--- a/db/migrate/20190719174505_add_index_to_deploy_tokens_token_encrypted.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToDeployTokensTokenEncrypted < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :deploy_tokens, :token_encrypted, unique: true, name: "index_deploy_tokens_on_token_encrypted"
- end
-
- def down
- remove_concurrent_index_by_name :deploy_tokens, "index_deploy_tokens_on_token_encrypted"
- end
-end
diff --git a/db/migrate/20190722104947_add_static_object_token_to_users.rb b/db/migrate/20190722104947_add_static_object_token_to_users.rb
deleted file mode 100644
index 3983f076b3f..00000000000
--- a/db/migrate/20190722104947_add_static_object_token_to_users.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddStaticObjectTokenToUsers < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- # rubocop:disable Migration/AddColumnsToWideTables
- # rubocop:disable Migration/PreventStrings
- def up
- add_column :users, :static_object_token, :string, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
- # rubocop:enable Migration/AddColumnsToWideTables
-
- def down
- remove_column :users, :static_object_token
- end
-end
diff --git a/db/migrate/20190722132830_add_static_objects_external_storage_columns_to_application_settings.rb b/db/migrate/20190722132830_add_static_objects_external_storage_columns_to_application_settings.rb
deleted file mode 100644
index f493eae26a8..00000000000
--- a/db/migrate/20190722132830_add_static_objects_external_storage_columns_to_application_settings.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddStaticObjectsExternalStorageColumnsToApplicationSettings < ActiveRecord::Migration[5.2]
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :application_settings, :static_objects_external_storage_url, :string, limit: 255
- add_column :application_settings, :static_objects_external_storage_auth_token, :string, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190722144316_create_milestone_releases_table.rb b/db/migrate/20190722144316_create_milestone_releases_table.rb
deleted file mode 100644
index 55878bcec41..00000000000
--- a/db/migrate/20190722144316_create_milestone_releases_table.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class CreateMilestoneReleasesTable < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- create_table :milestone_releases do |t|
- t.references :milestone, foreign_key: { on_delete: :cascade }, null: false, index: false
- t.references :release, foreign_key: { on_delete: :cascade }, null: false
- end
-
- add_index :milestone_releases, [:milestone_id, :release_id], unique: true, name: 'index_miletone_releases_on_milestone_and_release'
- end
-
- def down
- drop_table :milestone_releases
- end
-end
diff --git a/db/migrate/20190723153247_create_allowed_email_domains_for_groups.rb b/db/migrate/20190723153247_create_allowed_email_domains_for_groups.rb
deleted file mode 100644
index 71af7434f9d..00000000000
--- a/db/migrate/20190723153247_create_allowed_email_domains_for_groups.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreateAllowedEmailDomainsForGroups < ActiveRecord::Migration[5.2]
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def change
- create_table :allowed_email_domains do |t|
- t.timestamps_with_timezone null: false
- t.references :group, references: :namespace,
- column: :group_id,
- type: :integer,
- null: false,
- index: true
- t.foreign_key :namespaces, column: :group_id, on_delete: :cascade
- t.string :domain, null: false, limit: 255 # rubocop:disable Migration/PreventStrings
- end
- end
-end
diff --git a/db/migrate/20190724112147_add_column_for_self_monitoring_project_id.rb b/db/migrate/20190724112147_add_column_for_self_monitoring_project_id.rb
deleted file mode 100644
index cf44804cdb4..00000000000
--- a/db/migrate/20190724112147_add_column_for_self_monitoring_project_id.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddColumnForSelfMonitoringProjectId < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- # rubocop:disable Migration/AddReference
- add_reference(
- :application_settings,
- :instance_administration_project,
- index: { name: 'index_applicationsettings_on_instance_administration_project_id' },
- foreign_key: { to_table: :projects, on_delete: :nullify }
- )
- # rubocop:enable Migration/AddReference
- end
-end
diff --git a/db/migrate/20190725012225_change_outbound_local_requests_whitelist_default.rb b/db/migrate/20190725012225_change_outbound_local_requests_whitelist_default.rb
deleted file mode 100644
index 21b00e0b7d9..00000000000
--- a/db/migrate/20190725012225_change_outbound_local_requests_whitelist_default.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeOutboundLocalRequestsWhitelistDefault < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- class ApplicationSetting < ActiveRecord::Base
- self.table_name = 'application_settings'
- end
-
- def up
- default_value = []
-
- change_column_default(:application_settings, :outbound_local_requests_whitelist, default_value)
-
- ApplicationSetting
- .where(outbound_local_requests_whitelist: nil)
- .update(outbound_local_requests_whitelist: default_value)
-
- change_column_null(:application_settings, :outbound_local_requests_whitelist, false)
- end
-
- def down
- change_column_null(:application_settings, :outbound_local_requests_whitelist, true)
-
- change_column_default(:application_settings, :outbound_local_requests_whitelist, nil)
- end
-end
diff --git a/db/migrate/20190725183432_add_index_to_index_on_static_object_token.rb b/db/migrate/20190725183432_add_index_to_index_on_static_object_token.rb
deleted file mode 100644
index 423c45b9543..00000000000
--- a/db/migrate/20190725183432_add_index_to_index_on_static_object_token.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddIndexToIndexOnStaticObjectToken < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :users, :static_object_token, unique: true
- end
-
- def down
- remove_concurrent_index :users, :static_object_token
- end
-end
diff --git a/db/migrate/20190726101050_rename_allow_local_requests_from_hooks_and_services_application_setting.rb b/db/migrate/20190726101050_rename_allow_local_requests_from_hooks_and_services_application_setting.rb
deleted file mode 100644
index cce8942128c..00000000000
--- a/db/migrate/20190726101050_rename_allow_local_requests_from_hooks_and_services_application_setting.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class RenameAllowLocalRequestsFromHooksAndServicesApplicationSetting < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- rename_column_concurrently :application_settings, :allow_local_requests_from_hooks_and_services, :allow_local_requests_from_web_hooks_and_services
- end
-
- def down
- undo_rename_column_concurrently :application_settings, :allow_local_requests_from_hooks_and_services, :allow_local_requests_from_web_hooks_and_services
- end
-end
diff --git a/db/migrate/20190726101133_add_allow_local_requests_from_system_hooks_to_application_settings.rb b/db/migrate/20190726101133_add_allow_local_requests_from_system_hooks_to_application_settings.rb
deleted file mode 100644
index 95d4f956f93..00000000000
--- a/db/migrate/20190726101133_add_allow_local_requests_from_system_hooks_to_application_settings.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddAllowLocalRequestsFromSystemHooksToApplicationSettings < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- add_column(:application_settings, :allow_local_requests_from_system_hooks,
- :boolean,
- default: true,
- null: false)
- end
-
- def down
- remove_column(:application_settings, :allow_local_requests_from_system_hooks)
- end
-end
diff --git a/db/migrate/20190729062536_create_analytics_cycle_analytics_group_stages.rb b/db/migrate/20190729062536_create_analytics_cycle_analytics_group_stages.rb
deleted file mode 100644
index d438ece9951..00000000000
--- a/db/migrate/20190729062536_create_analytics_cycle_analytics_group_stages.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# frozen_string_literal: true
-
-class CreateAnalyticsCycleAnalyticsGroupStages < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- INDEX_PREFIX = 'index_analytics_ca_group_stages_'
-
- def change
- create_table :analytics_cycle_analytics_group_stages do |t|
- t.timestamps_with_timezone
- t.integer :relative_position
- t.integer :start_event_identifier, null: false
- t.integer :end_event_identifier, null: false
-
- t.references(:group,
- null: false,
- foreign_key: { to_table: :namespaces, on_delete: :cascade },
- index: { name: INDEX_PREFIX + 'on_group_id' }
- )
- t.references(:start_event_label,
- foreign_key: { to_table: :labels, on_delete: :cascade },
- index: { name: INDEX_PREFIX + 'on_start_event_label_id' }
- )
- t.references(:end_event_label,
- foreign_key: { to_table: :labels, on_delete: :cascade },
- index: { name: INDEX_PREFIX + 'on_end_event_label_id' }
- )
- t.boolean :hidden, default: false, null: false
- t.boolean :custom, default: true, null: false
- t.string :name, null: false, limit: 255 # rubocop:disable Migration/PreventStrings
- end
-
- add_index :analytics_cycle_analytics_group_stages, [:group_id, :name], unique: true, name: INDEX_PREFIX + 'on_group_id_and_name'
- add_index :analytics_cycle_analytics_group_stages, [:relative_position], name: INDEX_PREFIX + 'on_relative_position'
- end
-end
diff --git a/db/migrate/20190729090456_add_index_on_environments_with_state.rb b/db/migrate/20190729090456_add_index_on_environments_with_state.rb
deleted file mode 100644
index 9a8d8391415..00000000000
--- a/db/migrate/20190729090456_add_index_on_environments_with_state.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnEnvironmentsWithState < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :environments, [:project_id, :state]
- end
-
- def down
- remove_concurrent_index :environments, [:project_id, :state]
- end
-end
diff --git a/db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb b/db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb
deleted file mode 100644
index bfac67606d6..00000000000
--- a/db/migrate/20190729180447_add_merge_requests_require_code_owner_approval_to_protected_branches.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-class AddMergeRequestsRequireCodeOwnerApprovalToProtectedBranches < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault
- :protected_branches,
- :code_owner_approval_required,
- :boolean,
- default: false
- )
-
- add_concurrent_index(
- :protected_branches,
- [:project_id, :code_owner_approval_required],
- name: "code_owner_approval_required",
- where: "code_owner_approval_required = #{Gitlab::Database.true_value}")
- end
-
- def down
- remove_concurrent_index(:protected_branches, name: "code_owner_approval_required")
-
- remove_column(:protected_branches, :code_owner_approval_required)
- end
-end
diff --git a/db/migrate/20190731084415_add_build_need.rb b/db/migrate/20190731084415_add_build_need.rb
deleted file mode 100644
index ba044260db2..00000000000
--- a/db/migrate/20190731084415_add_build_need.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddBuildNeed < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :ci_build_needs, id: :serial do |t|
- t.integer :build_id, null: false
- t.text :name, null: false # rubocop:disable Migration/AddLimitToTextColumns
-
- t.index [:build_id, :name], unique: true
- t.foreign_key :ci_builds, column: :build_id, on_delete: :cascade
- end
- end
-end
diff --git a/db/migrate/20190801060809_delete_kubernetes_services.rb b/db/migrate/20190801060809_delete_kubernetes_services.rb
deleted file mode 100644
index 88717293817..00000000000
--- a/db/migrate/20190801060809_delete_kubernetes_services.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class DeleteKubernetesServices < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- class Service < ActiveRecord::Base
- self.table_name = 'services'
- self.inheritance_column = :_type_disabled
- end
-
- def up
- Service.where(type: "KubernetesService").delete_all
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20190801142441_add_throttle_protected_path_columns.rb b/db/migrate/20190801142441_add_throttle_protected_path_columns.rb
deleted file mode 100644
index f9e0922ad66..00000000000
--- a/db/migrate/20190801142441_add_throttle_protected_path_columns.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class AddThrottleProtectedPathColumns < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- DEFAULT_PROTECTED_PATHS = [
- '/users/password',
- '/users/sign_in',
- '/api/v3/session.json',
- '/api/v3/session',
- '/api/v4/session.json',
- '/api/v4/session',
- '/users',
- '/users/confirmation',
- '/unsubscribes/',
- '/import/github/personal_access_token'
- ]
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :application_settings, :throttle_protected_paths_enabled, :boolean, default: true, null: false
- add_column :application_settings, :throttle_protected_paths_requests_per_period, :integer, default: 10, null: false
- add_column :application_settings, :throttle_protected_paths_period_in_seconds, :integer, default: 60, null: false
- add_column :application_settings, :protected_paths, :string, array: true, limit: 255, default: DEFAULT_PROTECTED_PATHS
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190801193427_rename_application_settings_snowplow_collector_uri_column.rb b/db/migrate/20190801193427_rename_application_settings_snowplow_collector_uri_column.rb
deleted file mode 100644
index fba9849d3eb..00000000000
--- a/db/migrate/20190801193427_rename_application_settings_snowplow_collector_uri_column.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class RenameApplicationSettingsSnowplowCollectorUriColumn < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- rename_column_concurrently :application_settings, :snowplow_collector_uri, :snowplow_collector_hostname
- end
-
- def down
- undo_rename_column_concurrently :application_settings, :snowplow_collector_uri, :snowplow_collector_hostname
- end
-end
diff --git a/db/migrate/20190802012622_reorder_issues_project_id_relative_position_index.rb b/db/migrate/20190802012622_reorder_issues_project_id_relative_position_index.rb
deleted file mode 100644
index 12088dd763f..00000000000
--- a/db/migrate/20190802012622_reorder_issues_project_id_relative_position_index.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class ReorderIssuesProjectIdRelativePositionIndex < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- OLD_INDEX_NAME = 'index_issues_on_project_id_and_state_and_rel_position_and_id'
- NEW_INDEX_NAME = 'index_issues_on_project_id_and_rel_position_and_state_and_id'
-
- def up
- add_concurrent_index :issues, [:project_id, :relative_position, :state, :id], order: { id: :desc }, name: NEW_INDEX_NAME
-
- remove_concurrent_index_by_name :issues, OLD_INDEX_NAME
- end
-
- def down
- add_concurrent_index :issues, [:project_id, :state, :relative_position, :id], order: { id: :desc }, name: OLD_INDEX_NAME
-
- remove_concurrent_index_by_name :issues, NEW_INDEX_NAME
- end
-end
diff --git a/db/migrate/20190802195602_add_timestamps_columns_to_geo_nodes.rb b/db/migrate/20190802195602_add_timestamps_columns_to_geo_nodes.rb
deleted file mode 100644
index b95d9037afe..00000000000
--- a/db/migrate/20190802195602_add_timestamps_columns_to_geo_nodes.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class AddTimestampsColumnsToGeoNodes < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column(:geo_nodes, :created_at, :datetime_with_timezone, null: true)
- add_column(:geo_nodes, :updated_at, :datetime_with_timezone, null: true)
- end
-end
diff --git a/db/migrate/20190805140353_remove_rendundant_index_from_releases.rb b/db/migrate/20190805140353_remove_rendundant_index_from_releases.rb
deleted file mode 100644
index 477f8a850f8..00000000000
--- a/db/migrate/20190805140353_remove_rendundant_index_from_releases.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class RemoveRendundantIndexFromReleases < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :releases, 'index_releases_on_project_id'
-
- # This is an extra index that is not present in db/schema.rb but known to exist on some installs
- remove_concurrent_index_by_name :releases, 'releases_project_id_idx' if index_exists_by_name?(:releases, 'releases_project_id_idx')
- end
-
- def down
- add_concurrent_index :releases, :project_id, name: 'index_releases_on_project_id'
- end
-end
diff --git a/db/migrate/20190806071559_remove_epic_issues_default_relative_position.rb b/db/migrate/20190806071559_remove_epic_issues_default_relative_position.rb
deleted file mode 100644
index 0994bbbfd17..00000000000
--- a/db/migrate/20190806071559_remove_epic_issues_default_relative_position.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveEpicIssuesDefaultRelativePosition < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- # The column won't exist if someone installed EE, downgraded to CE
- # before it was added in EE, then tries to upgrade CE.
- if column_exists?(:epic_issues, :relative_position)
- change_column_null :epic_issues, :relative_position, true
- change_column_default :epic_issues, :relative_position, from: 1073741823, to: nil
- else
- add_column_with_default(:epic_issues, :relative_position, :integer, default: nil, allow_null: true) # rubocop:disable Migration/AddColumnWithDefault
- end
- end
-
- def down
- change_column_default :epic_issues, :relative_position, from: nil, to: 1073741823
- change_column_null :epic_issues, :relative_position, false
- end
-end
diff --git a/db/migrate/20190807023052_design_issue_id_nullable.rb b/db/migrate/20190807023052_design_issue_id_nullable.rb
deleted file mode 100644
index 4429e23d520..00000000000
--- a/db/migrate/20190807023052_design_issue_id_nullable.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class DesignIssueIdNullable < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- change_column_null :design_management_designs, :issue_id, true
- end
-end
diff --git a/db/migrate/20190808152507_add_projects_sorting_field_to_user_preferences.rb b/db/migrate/20190808152507_add_projects_sorting_field_to_user_preferences.rb
deleted file mode 100644
index 5022ae843e7..00000000000
--- a/db/migrate/20190808152507_add_projects_sorting_field_to_user_preferences.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectsSortingFieldToUserPreferences < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def up
- add_column :user_preferences, :projects_sort, :string, limit: 64
- end
- # rubocop:enable Migration/PreventStrings
-
- def down
- remove_column :user_preferences, :projects_sort
- end
-end
diff --git a/db/migrate/20190814205640_import_common_metrics_line_charts.rb b/db/migrate/20190814205640_import_common_metrics_line_charts.rb
deleted file mode 100644
index 1c28d686a42..00000000000
--- a/db/migrate/20190814205640_import_common_metrics_line_charts.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class ImportCommonMetricsLineCharts < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def up
- ::Gitlab::DatabaseImporters::CommonMetrics::Importer.new.execute
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20190815093936_add_index_notes_on_project_id_and_id_and_system_false.rb b/db/migrate/20190815093936_add_index_notes_on_project_id_and_id_and_system_false.rb
deleted file mode 100644
index cbbece35901..00000000000
--- a/db/migrate/20190815093936_add_index_notes_on_project_id_and_id_and_system_false.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexNotesOnProjectIdAndIdAndSystemFalse < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(*index_arguments)
- end
-
- def down
- remove_concurrent_index(*index_arguments)
- end
-
- private
-
- def index_arguments
- [
- :notes,
- [:project_id, :id],
- {
- name: 'index_notes_on_project_id_and_id_and_system_false',
- where: 'NOT system'
- }
- ]
- end
-end
diff --git a/db/migrate/20190815093949_remove_index_notes_on_noteable_type.rb b/db/migrate/20190815093949_remove_index_notes_on_noteable_type.rb
deleted file mode 100644
index 158c88e6258..00000000000
--- a/db/migrate/20190815093949_remove_index_notes_on_noteable_type.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveIndexNotesOnNoteableType < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index(*index_arguments)
- end
-
- def down
- add_concurrent_index(*index_arguments)
- end
-
- private
-
- def index_arguments
- [
- :notes,
- [:noteable_type],
- {
- name: 'index_notes_on_noteable_type'
- }
- ]
- end
-end
diff --git a/db/migrate/20190816151221_add_active_jobs_limit_to_plans.rb b/db/migrate/20190816151221_add_active_jobs_limit_to_plans.rb
deleted file mode 100644
index 193e6cb188e..00000000000
--- a/db/migrate/20190816151221_add_active_jobs_limit_to_plans.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddActiveJobsLimitToPlans < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :plans, :active_jobs_limit, :integer, default: 0 # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :plans, :active_jobs_limit
- end
-end
diff --git a/db/migrate/20190819131155_add_cluster_status_index_to_deployments.rb b/db/migrate/20190819131155_add_cluster_status_index_to_deployments.rb
deleted file mode 100644
index bfa91e33558..00000000000
--- a/db/migrate/20190819131155_add_cluster_status_index_to_deployments.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddClusterStatusIndexToDeployments < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :deployments, [:cluster_id, :status]
- end
-
- def down
- remove_concurrent_index :deployments, [:cluster_id, :status]
- end
-end
diff --git a/db/migrate/20190820163320_add_first_last_name_to_user.rb b/db/migrate/20190820163320_add_first_last_name_to_user.rb
deleted file mode 100644
index 908f55fa821..00000000000
--- a/db/migrate/20190820163320_add_first_last_name_to_user.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddFirstLastNameToUser < ActiveRecord::Migration[5.2]
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/AddColumnsToWideTables
- # rubocop:disable Migration/PreventStrings
- def change
- add_column(:users, :first_name, :string, null: true, limit: 255)
- add_column(:users, :last_name, :string, null: true, limit: 255)
- end
- # rubocop:enable Migration/PreventStrings
- # rubocop:enable Migration/AddColumnsToWideTables
-end
diff --git a/db/migrate/20190821040941_create_cluster_providers_aws.rb b/db/migrate/20190821040941_create_cluster_providers_aws.rb
deleted file mode 100644
index 666c33759a2..00000000000
--- a/db/migrate/20190821040941_create_cluster_providers_aws.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# frozen_string_literal: true
-
-class CreateClusterProvidersAws < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- create_table :cluster_providers_aws do |t|
- t.references :cluster, null: false, type: :bigint, index: { unique: true }, foreign_key: { on_delete: :cascade }
- t.references :created_by_user, type: :integer, foreign_key: { on_delete: :nullify, to_table: :users }
-
- t.integer :num_nodes, null: false
- t.integer :status, null: false
-
- t.timestamps_with_timezone null: false
-
- t.string :key_name, null: false, limit: 255
- t.string :role_arn, null: false, limit: 2048
- t.string :region, null: false, limit: 255
- t.string :vpc_id, null: false, limit: 255
- t.string :subnet_ids, null: false, array: true, default: [], limit: 255
- t.string :security_group_id, null: false, limit: 255
- t.string :instance_type, null: false, limit: 255
-
- t.string :access_key_id, limit: 255
- t.string :encrypted_secret_access_key_iv, limit: 255
- t.text :encrypted_secret_access_key
- t.text :session_token
- t.text :status_reason
-
- t.index [:cluster_id, :status]
- end
- end
- # rubocop:enable Migration/AddLimitToTextColumns
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190822175441_rename_epics_state_to_state_id.rb b/db/migrate/20190822175441_rename_epics_state_to_state_id.rb
deleted file mode 100644
index 7f40d164a8e..00000000000
--- a/db/migrate/20190822175441_rename_epics_state_to_state_id.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class RenameEpicsStateToStateId < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- rename_column_concurrently :epics, :state, :state_id
- end
-
- def down
- cleanup_concurrent_column_rename :epics, :state_id, :state
- end
-end
diff --git a/db/migrate/20190822181528_create_list_user_preferences.rb b/db/migrate/20190822181528_create_list_user_preferences.rb
deleted file mode 100644
index a7993818b50..00000000000
--- a/db/migrate/20190822181528_create_list_user_preferences.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class CreateListUserPreferences < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :list_user_preferences do |t|
- t.references :user, index: true, null: false, foreign_key: { on_delete: :cascade }
- t.references :list, index: true, null: false, foreign_key: { on_delete: :cascade }
- t.timestamps_with_timezone null: false
- t.boolean :collapsed
- end
-
- add_index :list_user_preferences, [:user_id, :list_id], unique: true
- end
-end
diff --git a/db/migrate/20190823055948_change_clusters_namespace_per_environment_default.rb b/db/migrate/20190823055948_change_clusters_namespace_per_environment_default.rb
deleted file mode 100644
index 919ce807869..00000000000
--- a/db/migrate/20190823055948_change_clusters_namespace_per_environment_default.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class ChangeClustersNamespacePerEnvironmentDefault < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- change_column_default :clusters, :namespace_per_environment, from: false, to: true
- end
-end
diff --git a/db/migrate/20190826090628_remove_redundant_deployments_index.rb b/db/migrate/20190826090628_remove_redundant_deployments_index.rb
deleted file mode 100644
index 6b009c17d64..00000000000
--- a/db/migrate/20190826090628_remove_redundant_deployments_index.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveRedundantDeploymentsIndex < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index :deployments, :cluster_id
- end
-
- def down
- add_concurrent_index :deployments, :cluster_id
- end
-end
diff --git a/db/migrate/20190826100605_add_group_column_to_events.rb b/db/migrate/20190826100605_add_group_column_to_events.rb
deleted file mode 100644
index dfc9d8cbdf1..00000000000
--- a/db/migrate/20190826100605_add_group_column_to_events.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddGroupColumnToEvents < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column(:events, :group_id, :bigint) unless column_exists?(:events, :group_id)
- add_concurrent_index(:events, :group_id)
- add_concurrent_foreign_key(:events, :namespaces, column: :group_id, on_delete: :cascade)
- end
-
- def down
- remove_column(:events, :group_id) if column_exists?(:events, :group_id)
- end
-end
diff --git a/db/migrate/20190827222124_add_sourcegraph_configuration_to_application_settings.rb b/db/migrate/20190827222124_add_sourcegraph_configuration_to_application_settings.rb
deleted file mode 100644
index 1059f73db8a..00000000000
--- a/db/migrate/20190827222124_add_sourcegraph_configuration_to_application_settings.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddSourcegraphConfigurationToApplicationSettings < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def up
- add_column(:application_settings, :sourcegraph_enabled, :boolean, default: false, null: false)
- add_column(:application_settings, :sourcegraph_url, :string, null: true, limit: 255)
- end
- # rubocop:enable Migration/PreventStrings
-
- def down
- remove_column(:application_settings, :sourcegraph_enabled)
- remove_column(:application_settings, :sourcegraph_url)
- end
-end
diff --git a/db/migrate/20190828083843_add_index_to_ci_job_artifacts_on_project_id_for_security_reports.rb b/db/migrate/20190828083843_add_index_to_ci_job_artifacts_on_project_id_for_security_reports.rb
deleted file mode 100644
index 5253f25aab4..00000000000
--- a/db/migrate/20190828083843_add_index_to_ci_job_artifacts_on_project_id_for_security_reports.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToCiJobArtifactsOnProjectIdForSecurityReports < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_job_artifacts,
- :project_id,
- name: "index_ci_job_artifacts_on_project_id_for_security_reports",
- where: "file_type IN (5, 6, 7, 8)"
- end
-
- def down
- remove_concurrent_index :ci_job_artifacts,
- :project_id,
- name: "index_ci_job_artifacts_on_project_id_for_security_reports"
- end
-end
diff --git a/db/migrate/20190828110802_add_not_null_constraints_to_prometheus_metrics_y_label_and_unit.rb b/db/migrate/20190828110802_add_not_null_constraints_to_prometheus_metrics_y_label_and_unit.rb
deleted file mode 100644
index 1b238907af6..00000000000
--- a/db/migrate/20190828110802_add_not_null_constraints_to_prometheus_metrics_y_label_and_unit.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class AddNotNullConstraintsToPrometheusMetricsYLabelAndUnit < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- change_column_null(:prometheus_metrics, :y_label, false)
- change_column_null(:prometheus_metrics, :unit, false)
- end
-end
diff --git a/db/migrate/20190828170945_create_package_metadatum.rb b/db/migrate/20190828170945_create_package_metadatum.rb
deleted file mode 100644
index 3047b812e0e..00000000000
--- a/db/migrate/20190828170945_create_package_metadatum.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class CreatePackageMetadatum < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :packages_package_metadata do |t|
- t.references :package, index: { unique: true }, null: false, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :integer
- t.binary :metadata, null: false
- end
- end
-end
diff --git a/db/migrate/20190828172831_create_package_tag.rb b/db/migrate/20190828172831_create_package_tag.rb
deleted file mode 100644
index a70b71db51d..00000000000
--- a/db/migrate/20190828172831_create_package_tag.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-# frozen_string_literal: true .
-
-class CreatePackageTag < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :packages_package_tags do |t|
- t.references :package, index: true, null: false, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :integer
- t.string :name, limit: 255, null: false # rubocop:disable Migration/PreventStrings
- end
- end
-end
diff --git a/db/migrate/20190829131130_create_external_pull_requests.rb b/db/migrate/20190829131130_create_external_pull_requests.rb
deleted file mode 100644
index 817f84017e2..00000000000
--- a/db/migrate/20190829131130_create_external_pull_requests.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class CreateExternalPullRequests < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX = 'index_external_pull_requests_on_project_and_branches'
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :external_pull_requests do |t|
- t.timestamps_with_timezone null: false
- t.references :project, null: false, foreign_key: { on_delete: :cascade }, index: false
- t.integer :pull_request_iid, null: false
- t.integer :status, null: false, limit: 2
- t.string :source_branch, null: false, limit: 255
- t.string :target_branch, null: false, limit: 255
- t.string :source_repository, null: false, limit: 255
- t.string :target_repository, null: false, limit: 255
- t.binary :source_sha, null: false
- t.binary :target_sha, null: false
-
- t.index [:project_id, :source_branch, :target_branch], unique: true, name: INDEX
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190830075508_add_external_pull_request_id_to_ci_pipelines.rb b/db/migrate/20190830075508_add_external_pull_request_id_to_ci_pipelines.rb
deleted file mode 100644
index 5abf56742b1..00000000000
--- a/db/migrate/20190830075508_add_external_pull_request_id_to_ci_pipelines.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddExternalPullRequestIdToCiPipelines < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- add_column :ci_pipelines, :external_pull_request_id, :bigint
- end
-
- def down
- remove_column :ci_pipelines, :external_pull_request_id
- end
-end
diff --git a/db/migrate/20190830080123_add_index_to_ci_pipelines_external_pull_request.rb b/db/migrate/20190830080123_add_index_to_ci_pipelines_external_pull_request.rb
deleted file mode 100644
index d2f5ad7a420..00000000000
--- a/db/migrate/20190830080123_add_index_to_ci_pipelines_external_pull_request.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToCiPipelinesExternalPullRequest < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_pipelines, :external_pull_request_id, where: 'external_pull_request_id IS NOT NULL'
- end
-
- def down
- remove_concurrent_index :ci_pipelines, :external_pull_request_id
- end
-end
diff --git a/db/migrate/20190830080626_add_foreign_key_to_ci_pipelines_external_pull_request.rb b/db/migrate/20190830080626_add_foreign_key_to_ci_pipelines_external_pull_request.rb
deleted file mode 100644
index b38fda83047..00000000000
--- a/db/migrate/20190830080626_add_foreign_key_to_ci_pipelines_external_pull_request.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddForeignKeyToCiPipelinesExternalPullRequest < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :ci_pipelines, :external_pull_requests, column: :external_pull_request_id, on_delete: :nullify
- end
-
- def down
- remove_foreign_key :ci_pipelines, :external_pull_requests
- end
-end
diff --git a/db/migrate/20190830140240_add_duplicated_to_to_issue.rb b/db/migrate/20190830140240_add_duplicated_to_to_issue.rb
deleted file mode 100644
index b38e4302a0b..00000000000
--- a/db/migrate/20190830140240_add_duplicated_to_to_issue.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class AddDuplicatedToToIssue < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column :issues, :duplicated_to_id, :integer unless duplicated_to_id_exists?
- add_concurrent_foreign_key :issues, :issues, column: :duplicated_to_id, on_delete: :nullify
- add_concurrent_index :issues, :duplicated_to_id, where: 'duplicated_to_id IS NOT NULL'
- end
-
- def down
- remove_foreign_key_without_error(:issues, column: :duplicated_to_id)
- remove_concurrent_index(:issues, :duplicated_to_id)
- remove_column(:issues, :duplicated_to_id) if duplicated_to_id_exists?
- end
-
- private
-
- def duplicated_to_id_exists?
- column_exists?(:issues, :duplicated_to_id)
- end
-end
diff --git a/db/migrate/20190901174200_add_max_issue_count_to_list.rb b/db/migrate/20190901174200_add_max_issue_count_to_list.rb
deleted file mode 100644
index 7408d2f1c93..00000000000
--- a/db/migrate/20190901174200_add_max_issue_count_to_list.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddMaxIssueCountToList < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- def up
- add_column_with_default :lists, :max_issue_count, :integer, default: 0 # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :lists, :max_issue_count
- end
-end
diff --git a/db/migrate/20190902131045_replace_indexes_for_counting_active_users.rb b/db/migrate/20190902131045_replace_indexes_for_counting_active_users.rb
deleted file mode 100644
index 2c7c47bee96..00000000000
--- a/db/migrate/20190902131045_replace_indexes_for_counting_active_users.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class ReplaceIndexesForCountingActiveUsers < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name(:users, 'index_users_on_state_and_internal')
-
- add_concurrent_index(:users, :state, where: 'ghost IS NOT TRUE', name: 'index_users_on_state_and_internal')
- add_concurrent_index(:users, :state, where: 'ghost IS NOT TRUE AND bot_type IS NULL', name: 'index_users_on_state_and_internal_ee')
- end
-
- def down
- remove_concurrent_index_by_name(:users, 'index_users_on_state_and_internal_ee')
- remove_concurrent_index_by_name(:users, 'index_users_on_state_and_internal')
-
- add_concurrent_index(:users, :state, where: 'ghost <> true AND bot_type IS NULL', name: 'index_users_on_state_and_internal')
- end
-end
diff --git a/db/migrate/20190902152329_add_index_for_ci_builds_metrics.rb b/db/migrate/20190902152329_add_index_for_ci_builds_metrics.rb
deleted file mode 100644
index b755d60e311..00000000000
--- a/db/migrate/20190902152329_add_index_for_ci_builds_metrics.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexForCiBuildsMetrics < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- INDEX_NAME = 'ci_builds_gitlab_monitor_metrics'
-
- def up
- add_concurrent_index(:ci_builds, [:status, :created_at, :project_id], where: "type = 'Ci::Build'", name: INDEX_NAME)
- end
-
- def down
- remove_concurrent_index_by_name(:ci_builds, INDEX_NAME)
- end
-end
diff --git a/db/migrate/20190903150358_create_analytics_repository_files_table.rb b/db/migrate/20190903150358_create_analytics_repository_files_table.rb
deleted file mode 100644
index 69c9cd504f4..00000000000
--- a/db/migrate/20190903150358_create_analytics_repository_files_table.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class CreateAnalyticsRepositoryFilesTable < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :analytics_repository_files do |t|
- t.references :project,
- index: false,
- foreign_key: { on_delete: :cascade },
- null: false
- t.string :file_path,
- limit: 4096,
- null: false
- end
-
- add_index :analytics_repository_files, [:project_id, :file_path], unique: true
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190903150435_create_analytics_repository_file_edits_table.rb b/db/migrate/20190903150435_create_analytics_repository_file_edits_table.rb
deleted file mode 100644
index dca3fa1b37d..00000000000
--- a/db/migrate/20190903150435_create_analytics_repository_file_edits_table.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class CreateAnalyticsRepositoryFileEditsTable < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :analytics_repository_file_edits do |t|
- t.references :project,
- index: true,
- foreign_key: { on_delete: :cascade }, null: false
- t.references :analytics_repository_file,
- index: false,
- foreign_key: { on_delete: :cascade },
- null: false
- t.date :committed_date,
- null: false
- t.integer :num_edits,
- null: false,
- default: 0
- end
-
- add_index :analytics_repository_file_edits,
- [:analytics_repository_file_id, :committed_date, :project_id],
- name: 'index_file_edits_on_committed_date_file_id_and_project_id',
- unique: true
- end
-end
diff --git a/db/migrate/20190904173203_add_index_on_users_unconfirmed_email.rb b/db/migrate/20190904173203_add_index_on_users_unconfirmed_email.rb
deleted file mode 100644
index e78d47f023f..00000000000
--- a/db/migrate/20190904173203_add_index_on_users_unconfirmed_email.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnUsersUnconfirmedEmail < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :users, :unconfirmed_email, where: 'unconfirmed_email IS NOT NULL'
- end
-
- def down
- remove_concurrent_index :users, :unconfirmed_email, where: 'unconfirmed_email IS NOT NULL'
- end
-end
diff --git a/db/migrate/20190905022045_add_issues_prometheus_alert_event_join_table.rb b/db/migrate/20190905022045_add_issues_prometheus_alert_event_join_table.rb
deleted file mode 100644
index 861b97f0a09..00000000000
--- a/db/migrate/20190905022045_add_issues_prometheus_alert_event_join_table.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class AddIssuesPrometheusAlertEventJoinTable < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :issues_prometheus_alert_events, id: false do |t|
- t.references :issue, null: false,
- index: false, # Uses the index below
- foreign_key: { on_delete: :cascade }
- t.references :prometheus_alert_event, null: false,
- index: { name: 'issue_id_issues_prometheus_alert_events_index' },
- foreign_key: { on_delete: :cascade }
-
- t.timestamps_with_timezone
- t.index [:issue_id, :prometheus_alert_event_id],
- unique: true, name: 'issue_id_prometheus_alert_event_id_index'
- end
- end
-end
diff --git a/db/migrate/20190905074652_index_timestamp_columns_for_issue_metrics.rb b/db/migrate/20190905074652_index_timestamp_columns_for_issue_metrics.rb
deleted file mode 100644
index e468b2decd9..00000000000
--- a/db/migrate/20190905074652_index_timestamp_columns_for_issue_metrics.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class IndexTimestampColumnsForIssueMetrics < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(*index_arguments)
- end
-
- def down
- remove_concurrent_index(*index_arguments)
- end
-
- private
-
- def index_arguments
- [
- :issue_metrics,
- [:issue_id, :first_mentioned_in_commit_at, :first_associated_with_milestone_at, :first_added_to_board_at],
- {
- name: 'index_issue_metrics_on_issue_id_and_timestamps'
- }
- ]
- end
-end
diff --git a/db/migrate/20190905140605_add_cloud_run_to_clusters_providers_gcp.rb b/db/migrate/20190905140605_add_cloud_run_to_clusters_providers_gcp.rb
deleted file mode 100644
index cd6b2fb7d4f..00000000000
--- a/db/migrate/20190905140605_add_cloud_run_to_clusters_providers_gcp.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddCloudRunToClustersProvidersGcp < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:cluster_providers_gcp, :cloud_run, :boolean, default: false) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:cluster_providers_gcp, :cloud_run)
- end
-end
diff --git a/db/migrate/20190905223800_add_interruptible_to_builds_metadata.rb b/db/migrate/20190905223800_add_interruptible_to_builds_metadata.rb
deleted file mode 100644
index a666b11013b..00000000000
--- a/db/migrate/20190905223800_add_interruptible_to_builds_metadata.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddInterruptibleToBuildsMetadata < ActiveRecord::Migration[5.0]
- DOWNTIME = false
-
- def change
- add_column :ci_builds_metadata, :interruptible, :boolean
- end
-end
diff --git a/db/migrate/20190905223900_add_concurrent_index_to_builds_metadata.rb b/db/migrate/20190905223900_add_concurrent_index_to_builds_metadata.rb
deleted file mode 100644
index d394f995673..00000000000
--- a/db/migrate/20190905223900_add_concurrent_index_to_builds_metadata.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddConcurrentIndexToBuildsMetadata < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_builds_metadata, [:build_id],
- where: "interruptible = false",
- name: "index_ci_builds_metadata_on_build_id_and_interruptible_false"
- end
-
- def down
- remove_concurrent_index_by_name(:ci_builds_metadata, 'index_ci_builds_metadata_on_build_id_and_interruptible_false')
- end
-end
diff --git a/db/migrate/20190906104555_create_alerts_service_data.rb b/db/migrate/20190906104555_create_alerts_service_data.rb
deleted file mode 100644
index 9388a205978..00000000000
--- a/db/migrate/20190906104555_create_alerts_service_data.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class CreateAlertsServiceData < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :alerts_service_data do |t|
- t.references :service, type: :integer, index: true, null: false,
- foreign_key: { on_delete: :cascade }
- t.timestamps_with_timezone
- t.string :encrypted_token, limit: 255
- t.string :encrypted_token_iv, limit: 255
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190907184714_add_show_whitespace_in_diffs_to_user_preferences.rb b/db/migrate/20190907184714_add_show_whitespace_in_diffs_to_user_preferences.rb
deleted file mode 100644
index 41f9b36278a..00000000000
--- a/db/migrate/20190907184714_add_show_whitespace_in_diffs_to_user_preferences.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddShowWhitespaceInDiffsToUserPreferences < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :user_preferences, :show_whitespace_in_diffs, :boolean, default: true, allow_null: false # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :user_preferences, :show_whitespace_in_diffs
- end
-end
diff --git a/db/migrate/20190909045845_create_project_pages_metadata.rb b/db/migrate/20190909045845_create_project_pages_metadata.rb
deleted file mode 100644
index 5fc8fc6e6c1..00000000000
--- a/db/migrate/20190909045845_create_project_pages_metadata.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class CreateProjectPagesMetadata < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :project_pages_metadata, id: false do |t|
- t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade }
- t.boolean :deployed, null: false, default: false
-
- t.index :project_id, name: 'index_project_pages_metadata_on_project_id_and_deployed_is_true', where: "deployed = TRUE"
- end
- end
-end
diff --git a/db/migrate/20190910103144_replace_events_index_on_group_id_with_partial_index.rb b/db/migrate/20190910103144_replace_events_index_on_group_id_with_partial_index.rb
deleted file mode 100644
index 40a7454fd20..00000000000
--- a/db/migrate/20190910103144_replace_events_index_on_group_id_with_partial_index.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class ReplaceEventsIndexOnGroupIdWithPartialIndex < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:events, :group_id, where: 'group_id IS NOT NULL', name: 'index_events_on_group_id_partial')
- remove_concurrent_index_by_name(:events, 'index_events_on_group_id')
- end
-
- def down
- add_concurrent_index(:events, :group_id, name: 'index_events_on_group_id')
- remove_concurrent_index_by_name(:events, 'index_events_on_group_id_partial')
- end
-end
diff --git a/db/migrate/20190910114843_exclude_nulls_from_index_on_namespaces_type.rb b/db/migrate/20190910114843_exclude_nulls_from_index_on_namespaces_type.rb
deleted file mode 100644
index 8237c48b16d..00000000000
--- a/db/migrate/20190910114843_exclude_nulls_from_index_on_namespaces_type.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class ExcludeNullsFromIndexOnNamespacesType < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:namespaces, :type, where: 'type is not null', name: 'index_namespaces_on_type_partial')
- remove_concurrent_index_by_name(:namespaces, 'index_namespaces_on_type')
- end
-
- def down
- add_concurrent_index(:namespaces, :type, name: 'index_namespaces_on_type')
- remove_concurrent_index_by_name(:namespaces, 'index_namespaces_on_type_partial')
- end
-end
diff --git a/db/migrate/20190910125852_create_analytics_language_trend_repository_languages.rb b/db/migrate/20190910125852_create_analytics_language_trend_repository_languages.rb
deleted file mode 100644
index 1fc9034655c..00000000000
--- a/db/migrate/20190910125852_create_analytics_language_trend_repository_languages.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# frozen_string_literal: true
-
-class CreateAnalyticsLanguageTrendRepositoryLanguages < ActiveRecord::Migration[5.2]
- DOWNTIME = false
- INDEX_PREFIX = 'analytics_repository_languages_'
-
- def change
- create_table :analytics_language_trend_repository_languages, id: false do |t|
- t.integer :file_count, null: false, default: 0
-
- t.references :programming_language,
- null: false,
- foreign_key: { on_delete: :cascade },
- index: false
- t.references :project,
- null: false,
- foreign_key: { on_delete: :cascade },
- index: { name: INDEX_PREFIX + 'on_project_id' }
- t.integer :loc, null: false, default: 0
- t.integer :bytes, null: false, default: 0
- # Storing percentage (with 2 decimal places), on 2 bytes.
- # 50.25% => 5025
- # Max: 100.00% => 10000 (fits smallint: 32767)
- t.integer :percentage, limit: 2, null: false, default: 0
- t.date :snapshot_date, null: false
- end
-
- add_index :analytics_language_trend_repository_languages, %I[
- programming_language_id
- project_id
- snapshot_date
- ], name: INDEX_PREFIX + 'unique_index', unique: true
- end
-end
diff --git a/db/migrate/20190910211526_create_packages_conan_file_metadata.rb b/db/migrate/20190910211526_create_packages_conan_file_metadata.rb
deleted file mode 100644
index a6830a93cbc..00000000000
--- a/db/migrate/20190910211526_create_packages_conan_file_metadata.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class CreatePackagesConanFileMetadata < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :packages_conan_file_metadata do |t|
- t.references :package_file, index: { unique: true }, null: false, foreign_key: { to_table: :packages_package_files, on_delete: :cascade }, type: :bigint
- t.timestamps_with_timezone
- t.string "recipe_revision", null: false, default: "0", limit: 255
- t.string "package_revision", limit: 255
- t.string "conan_package_reference", limit: 255
- t.integer "conan_file_type", limit: 2, null: false
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190910212256_add_any_approver_rule_unique_indexes.rb b/db/migrate/20190910212256_add_any_approver_rule_unique_indexes.rb
deleted file mode 100644
index e8f5b853d1d..00000000000
--- a/db/migrate/20190910212256_add_any_approver_rule_unique_indexes.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddAnyApproverRuleUniqueIndexes < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- PROJECT_RULE_UNIQUE_INDEX = 'any_approver_project_rule_type_unique_index'
- MERGE_REQUEST_RULE_UNIQUE_INDEX = 'any_approver_merge_request_rule_type_unique_index'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:approval_project_rules, [:project_id],
- where: "rule_type = 3",
- name: PROJECT_RULE_UNIQUE_INDEX, unique: true)
-
- add_concurrent_index(:approval_merge_request_rules, [:merge_request_id, :rule_type],
- where: "rule_type = 4",
- name: MERGE_REQUEST_RULE_UNIQUE_INDEX, unique: true)
- end
-
- def down
- remove_concurrent_index_by_name(:approval_project_rules, PROJECT_RULE_UNIQUE_INDEX)
- remove_concurrent_index_by_name(:approval_merge_request_rules, MERGE_REQUEST_RULE_UNIQUE_INDEX)
- end
-end
diff --git a/db/migrate/20190911115056_add_projects_max_pages_size.rb b/db/migrate/20190911115056_add_projects_max_pages_size.rb
deleted file mode 100644
index 70812e31ab8..00000000000
--- a/db/migrate/20190911115056_add_projects_max_pages_size.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectsMaxPagesSize < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :projects, :max_pages_size, :integer # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20190911115109_add_namespaces_max_pages_size.rb b/db/migrate/20190911115109_add_namespaces_max_pages_size.rb
deleted file mode 100644
index d3054714188..00000000000
--- a/db/migrate/20190911115109_add_namespaces_max_pages_size.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddNamespacesMaxPagesSize < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :namespaces, :max_pages_size, :integer # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20190911115207_add_projects_max_artifacts_size.rb b/db/migrate/20190911115207_add_projects_max_artifacts_size.rb
deleted file mode 100644
index cd4574ad9c8..00000000000
--- a/db/migrate/20190911115207_add_projects_max_artifacts_size.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectsMaxArtifactsSize < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :projects, :max_artifacts_size, :integer # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20190911115222_add_namespaces_max_artifacts_size.rb b/db/migrate/20190911115222_add_namespaces_max_artifacts_size.rb
deleted file mode 100644
index bec81d6c7e1..00000000000
--- a/db/migrate/20190911115222_add_namespaces_max_artifacts_size.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddNamespacesMaxArtifactsSize < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :namespaces, :max_artifacts_size, :integer # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20190912061145_add_index_to_members_on_expires_at.rb b/db/migrate/20190912061145_add_index_to_members_on_expires_at.rb
deleted file mode 100644
index e961977747b..00000000000
--- a/db/migrate/20190912061145_add_index_to_members_on_expires_at.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToMembersOnExpiresAt < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :members, :expires_at
- end
-
- def down
- remove_concurrent_index :members, :expires_at
- end
-end
diff --git a/db/migrate/20190912223232_add_role_to_users.rb b/db/migrate/20190912223232_add_role_to_users.rb
deleted file mode 100644
index a6405ab896d..00000000000
--- a/db/migrate/20190912223232_add_role_to_users.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddRoleToUsers < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :users, :role, :smallint # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20190913174707_add_spdx_id_to_software_licenses.rb b/db/migrate/20190913174707_add_spdx_id_to_software_licenses.rb
deleted file mode 100644
index 46e1400c394..00000000000
--- a/db/migrate/20190913174707_add_spdx_id_to_software_licenses.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddSpdxIdToSoftwareLicenses < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def up
- add_column :software_licenses, :spdx_identifier, :string, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
-
- def down
- remove_column :software_licenses, :spdx_identifier
- end
-end
diff --git a/db/migrate/20190913175827_add_index_to_software_licenses_on_spdx_id.rb b/db/migrate/20190913175827_add_index_to_software_licenses_on_spdx_id.rb
deleted file mode 100644
index 94f8738b0cc..00000000000
--- a/db/migrate/20190913175827_add_index_to_software_licenses_on_spdx_id.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToSoftwareLicensesOnSpdxId < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :software_licenses, :spdx_identifier
- end
-
- def down
- remove_concurrent_index :software_licenses, :spdx_identifier
- end
-end
diff --git a/db/migrate/20190914223900_modify_concurrent_index_to_builds_metadata.rb b/db/migrate/20190914223900_modify_concurrent_index_to_builds_metadata.rb
deleted file mode 100644
index ad8979045e5..00000000000
--- a/db/migrate/20190914223900_modify_concurrent_index_to_builds_metadata.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class ModifyConcurrentIndexToBuildsMetadata < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_builds_metadata, [:build_id],
- where: "interruptible = true",
- name: "index_ci_builds_metadata_on_build_id_and_interruptible"
- remove_concurrent_index_by_name(:ci_builds_metadata, 'index_ci_builds_metadata_on_build_id_and_interruptible_false')
- end
-
- def down
- remove_concurrent_index_by_name(:ci_builds_metadata, 'index_ci_builds_metadata_on_build_id_and_interruptible')
- add_concurrent_index :ci_builds_metadata, [:build_id],
- where: "interruptible = false",
- name: "index_ci_builds_metadata_on_build_id_and_interruptible_false"
- end
-end
diff --git a/db/migrate/20190918025618_add_user_and_timestamps_to_design_management_versions.rb b/db/migrate/20190918025618_add_user_and_timestamps_to_design_management_versions.rb
deleted file mode 100644
index 3daca8a8e97..00000000000
--- a/db/migrate/20190918025618_add_user_and_timestamps_to_design_management_versions.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddUserAndTimestampsToDesignManagementVersions < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- add_column :design_management_versions, :user_id, :integer
- add_column :design_management_versions, :created_at, :datetime_with_timezone
- end
-
- def down
- remove_columns :design_management_versions, :user_id, :created_at
- end
-end
diff --git a/db/migrate/20190918102042_create_grafana_integrations.rb b/db/migrate/20190918102042_create_grafana_integrations.rb
deleted file mode 100644
index d48aaaf45bc..00000000000
--- a/db/migrate/20190918102042_create_grafana_integrations.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class CreateGrafanaIntegrations < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :grafana_integrations do |t|
- t.references :project, index: true, foreign_key: { on_delete: :cascade }, unique: true, null: false
- t.timestamps_with_timezone null: false
- t.string :encrypted_token, limit: 255, null: false
- t.string :encrypted_token_iv, limit: 255, null: false
- t.string :grafana_url, null: false, limit: 1024
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190918104212_add_merge_request_metrics_merged_at_index.rb b/db/migrate/20190918104212_add_merge_request_metrics_merged_at_index.rb
deleted file mode 100644
index 9db4e42f3ee..00000000000
--- a/db/migrate/20190918104212_add_merge_request_metrics_merged_at_index.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddMergeRequestMetricsMergedAtIndex < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :merge_request_metrics, [:merged_at, :id]
- end
-
- def down
- remove_concurrent_index :merge_request_metrics, [:merged_at, :id]
- end
-end
diff --git a/db/migrate/20190918104731_add_cleanup_status_to_cluster.rb b/db/migrate/20190918104731_add_cleanup_status_to_cluster.rb
deleted file mode 100644
index 62290fb0fa6..00000000000
--- a/db/migrate/20190918104731_add_cleanup_status_to_cluster.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddCleanupStatusToCluster < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:clusters, :cleanup_status, # rubocop:disable Migration/AddColumnWithDefault
- :smallint,
- default: 1,
- allow_null: false)
- end
-
- def down
- remove_column(:clusters, :cleanup_status)
- end
-end
diff --git a/db/migrate/20190918121135_add_cleanup_status_reason_to_cluster.rb b/db/migrate/20190918121135_add_cleanup_status_reason_to_cluster.rb
deleted file mode 100644
index 85293ebbe86..00000000000
--- a/db/migrate/20190918121135_add_cleanup_status_reason_to_cluster.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-class AddCleanupStatusReasonToCluster < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def change
- add_column :clusters, :cleanup_status_reason, :text # rubocop:disable Migration/AddLimitToTextColumns
- end
-end
diff --git a/db/migrate/20190919040324_add_successfull_pages_deploy_partial_index_on_ci_builds.rb b/db/migrate/20190919040324_add_successfull_pages_deploy_partial_index_on_ci_builds.rb
deleted file mode 100644
index d736b21dddf..00000000000
--- a/db/migrate/20190919040324_add_successfull_pages_deploy_partial_index_on_ci_builds.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class AddSuccessfullPagesDeployPartialIndexOnCiBuilds < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_ci_builds_on_project_id_for_successfull_pages_deploy'
-
- def up
- add_concurrent_index(
- :ci_builds, :project_id,
- name: INDEX_NAME,
- where: "type='GenericCommitStatus' AND stage='deploy' AND name='pages:deploy' AND status = 'success'"
- )
- end
-
- def down
- remove_concurrent_index_by_name :ci_builds, INDEX_NAME
- end
-end
diff --git a/db/migrate/20190919091300_create_evidences.rb b/db/migrate/20190919091300_create_evidences.rb
deleted file mode 100644
index 3f861ed26bd..00000000000
--- a/db/migrate/20190919091300_create_evidences.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class CreateEvidences < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :evidences do |t|
- t.references :release, foreign_key: { on_delete: :cascade }, null: false
- t.timestamps_with_timezone
- t.binary :summary_sha
- t.jsonb :summary, null: false, default: {}
- end
- end
-end
diff --git a/db/migrate/20190919104119_index_timestamp_columns_for_merge_requests_creation_date.rb b/db/migrate/20190919104119_index_timestamp_columns_for_merge_requests_creation_date.rb
deleted file mode 100644
index 5e0d80630cd..00000000000
--- a/db/migrate/20190919104119_index_timestamp_columns_for_merge_requests_creation_date.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class IndexTimestampColumnsForMergeRequestsCreationDate < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(*index_arguments)
- end
-
- def down
- remove_concurrent_index(*index_arguments)
- end
-
- private
-
- def index_arguments
- [
- :merge_requests,
- [:target_project_id, :created_at],
- {
- name: 'index_merge_requests_target_project_id_created_at'
- }
- ]
- end
-end
diff --git a/db/migrate/20190919162036_add_index_to_clusters_providers_gcp_on_cloud_run.rb b/db/migrate/20190919162036_add_index_to_clusters_providers_gcp_on_cloud_run.rb
deleted file mode 100644
index 8e0bde97cc1..00000000000
--- a/db/migrate/20190919162036_add_index_to_clusters_providers_gcp_on_cloud_run.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToClustersProvidersGcpOnCloudRun < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:cluster_providers_gcp, :cloud_run)
- end
-
- def down
- remove_concurrent_index(:cluster_providers_gcp, :cloud_run)
- end
-end
diff --git a/db/migrate/20190919183411_add_index_packages_on_name_trigram_to_packages_packages.rb b/db/migrate/20190919183411_add_index_packages_on_name_trigram_to_packages_packages.rb
deleted file mode 100644
index d359350a891..00000000000
--- a/db/migrate/20190919183411_add_index_packages_on_name_trigram_to_packages_packages.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexPackagesOnNameTrigramToPackagesPackages < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_packages_packages_on_name_trigram'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :packages_packages, :name, name: INDEX_NAME, using: :gin, opclass: { name: :gin_trgm_ops }
- end
-
- def down
- remove_concurrent_index_by_name(:packages_packages, INDEX_NAME)
- end
-end
diff --git a/db/migrate/20190920122420_add_max_personal_access_token_lifetime_to_application_settings.rb b/db/migrate/20190920122420_add_max_personal_access_token_lifetime_to_application_settings.rb
deleted file mode 100644
index 5a6e810dede..00000000000
--- a/db/migrate/20190920122420_add_max_personal_access_token_lifetime_to_application_settings.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddMaxPersonalAccessTokenLifetimeToApplicationSettings < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :application_settings, :max_personal_access_token_lifetime, :integer
- end
-end
diff --git a/db/migrate/20190920194925_backfill_releases_table_updated_at_and_add_not_null_constraints_to_timestamps.rb b/db/migrate/20190920194925_backfill_releases_table_updated_at_and_add_not_null_constraints_to_timestamps.rb
deleted file mode 100644
index f8f1c6c231b..00000000000
--- a/db/migrate/20190920194925_backfill_releases_table_updated_at_and_add_not_null_constraints_to_timestamps.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class BackfillReleasesTableUpdatedAtAndAddNotNullConstraintsToTimestamps < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- change_column_null(:releases, :created_at, false, Time.zone.now)
-
- update_column_in_batches(:releases, :updated_at, Arel.sql('created_at')) do |table, query|
- query.where(table[:updated_at].eq(nil))
- end
-
- change_column_null(:releases, :updated_at, false, Time.zone.now)
- end
-
- def down
- change_column_null(:releases, :updated_at, true)
- change_column_null(:releases, :created_at, true)
- end
-end
diff --git a/db/migrate/20190920224341_create_merge_request_context_commits_and_diffs.rb b/db/migrate/20190920224341_create_merge_request_context_commits_and_diffs.rb
deleted file mode 100644
index bd97d3d3183..00000000000
--- a/db/migrate/20190920224341_create_merge_request_context_commits_and_diffs.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreateMergeRequestContextCommitsAndDiffs < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- create_table :merge_request_context_commits do |t|
- t.references :merge_request, foreign_key: { on_delete: :cascade }
- t.datetime_with_timezone :authored_date
- t.datetime_with_timezone :committed_date
- t.binary :sha, null: false
- t.integer :relative_order, null: false
- t.text :author_name
- t.text :author_email
- t.text :committer_name
- t.text :committer_email
- t.text :message
- t.index [:merge_request_id, :sha], unique: true, name: 'index_mr_context_commits_on_merge_request_id_and_sha'
- end
-
- create_table :merge_request_context_commit_diff_files, id: false do |t|
- t.references :merge_request_context_commit, foreign_key: { on_delete: :cascade }, index: { name: "idx_mr_cc_diff_files_on_mr_cc_id" }
- t.binary :sha, null: false
- t.integer :relative_order, null: false
- t.string :a_mode, null: false, limit: 255
- t.string :b_mode, null: false, limit: 255
- t.boolean :new_file, null: false
- t.boolean :renamed_file, null: false
- t.boolean :deleted_file, null: false
- t.boolean :too_large, null: false
- t.boolean :binary
- t.text :new_path, null: false
- t.text :old_path, null: false
- t.text :diff
- t.index [:merge_request_context_commit_id, :sha], name: 'idx_mr_cc_diff_files_on_mr_cc_id_and_sha'
- end
- end
- # rubocop:enable Migration/AddLimitToTextColumns
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190924124627_add_pull_mirror_branch_prefix_to_projects.rb b/db/migrate/20190924124627_add_pull_mirror_branch_prefix_to_projects.rb
deleted file mode 100644
index 2750468834f..00000000000
--- a/db/migrate/20190924124627_add_pull_mirror_branch_prefix_to_projects.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddPullMirrorBranchPrefixToProjects < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/AddColumnsToWideTables
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :projects, :pull_mirror_branch_prefix, :string, limit: 50
- end
- # rubocop:enable Migration/PreventStrings
- # rubocop:enable Migration/AddColumnsToWideTables
-end
diff --git a/db/migrate/20190925055714_default_request_access_groups.rb b/db/migrate/20190925055714_default_request_access_groups.rb
deleted file mode 100644
index ba3efbe56f4..00000000000
--- a/db/migrate/20190925055714_default_request_access_groups.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class DefaultRequestAccessGroups < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- change_column_default :namespaces, :request_access_enabled, true
- end
-
- def down
- change_column_default :namespaces, :request_access_enabled, false
- end
-end
diff --git a/db/migrate/20190925055902_default_request_access_projects.rb b/db/migrate/20190925055902_default_request_access_projects.rb
deleted file mode 100644
index 3ad88d0963d..00000000000
--- a/db/migrate/20190925055902_default_request_access_projects.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class DefaultRequestAccessProjects < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- change_column_default :projects, :request_access_enabled, true
- end
-
- def down
- change_column_default :projects, :request_access_enabled, false
- end
-end
diff --git a/db/migrate/20190926041216_add_user_indexes_to_design_management_versions.rb b/db/migrate/20190926041216_add_user_indexes_to_design_management_versions.rb
deleted file mode 100644
index 6eb9fdbbcaa..00000000000
--- a/db/migrate/20190926041216_add_user_indexes_to_design_management_versions.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddUserIndexesToDesignManagementVersions < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :design_management_versions, :users, column: :user_id, on_delete: :nullify
- add_concurrent_index :design_management_versions, :user_id, where: 'user_id IS NOT NULL'
- end
-
- def down
- remove_concurrent_index :design_management_versions, :user_id
- remove_foreign_key :design_management_versions, column: :user_id
- end
-end
diff --git a/db/migrate/20190926225633_create_x509_signatures.rb b/db/migrate/20190926225633_create_x509_signatures.rb
deleted file mode 100644
index 40d2c351524..00000000000
--- a/db/migrate/20190926225633_create_x509_signatures.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreateX509Signatures < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :x509_issuers do |t|
- t.timestamps_with_timezone null: false
-
- t.string :subject_key_identifier, index: true, null: false, unique: true, limit: 255
- t.string :subject, null: false, limit: 255
- t.string :crl_url, null: false, limit: 255
- end
-
- create_table :x509_certificates do |t|
- t.timestamps_with_timezone null: false
-
- t.string :subject_key_identifier, index: true, null: false, unique: true, limit: 255
- t.string :subject, null: false, limit: 255
- t.string :email, null: false, limit: 255
- t.binary :serial_number, null: false
-
- t.integer :certificate_status, limit: 2, default: 0, null: false
-
- t.references :x509_issuer, index: true, null: false, foreign_key: { on_delete: :cascade }
- end
-
- create_table :x509_commit_signatures do |t|
- t.timestamps_with_timezone null: false
-
- t.references :project, index: true, null: false, foreign_key: { on_delete: :cascade }
- t.references :x509_certificate, index: true, null: false, foreign_key: { on_delete: :cascade }
-
- t.binary :commit_sha, index: true, null: false
- t.integer :verification_status, limit: 2, default: 0, null: false
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20190927055500_create_description_versions.rb b/db/migrate/20190927055500_create_description_versions.rb
deleted file mode 100644
index b3082533a6f..00000000000
--- a/db/migrate/20190927055500_create_description_versions.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class CreateDescriptionVersions < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- create_table :description_versions do |t|
- t.timestamps_with_timezone
- t.references :issue, index: false, foreign_key: { on_delete: :cascade }, type: :integer
- t.references :merge_request, index: false, foreign_key: { on_delete: :cascade }, type: :integer
- t.references :epic, index: false, foreign_key: { on_delete: :cascade }, type: :integer
- t.text :description # rubocop:disable Migration/AddLimitToTextColumns
- end
-
- add_index :description_versions, :issue_id, where: 'issue_id IS NOT NULL'
- add_index :description_versions, :merge_request_id, where: 'merge_request_id IS NOT NULL'
- add_index :description_versions, :epic_id, where: 'epic_id IS NOT NULL'
-
- add_column :system_note_metadata, :description_version_id, :bigint
- end
-
- def down
- remove_column :system_note_metadata, :description_version_id
-
- drop_table :description_versions
- end
-end
diff --git a/db/migrate/20190927055540_add_index_to_sytem_note_metadata_description_version_id.rb b/db/migrate/20190927055540_add_index_to_sytem_note_metadata_description_version_id.rb
deleted file mode 100644
index 695ba955043..00000000000
--- a/db/migrate/20190927055540_add_index_to_sytem_note_metadata_description_version_id.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToSytemNoteMetadataDescriptionVersionId < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :system_note_metadata, :description_version_id, unique: true, where: 'description_version_id IS NOT NULL'
- add_concurrent_foreign_key :system_note_metadata, :description_versions, column: :description_version_id, on_delete: :nullify
- end
-
- def down
- remove_foreign_key :system_note_metadata, column: :description_version_id
- remove_concurrent_index :system_note_metadata, :description_version_id
- end
-end
diff --git a/db/migrate/20190927074328_add_index_on_snippet_content.rb b/db/migrate/20190927074328_add_index_on_snippet_content.rb
deleted file mode 100644
index ef7583508f2..00000000000
--- a/db/migrate/20190927074328_add_index_on_snippet_content.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnSnippetContent < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_snippets_on_content_trigram'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :snippets, :content, name: INDEX_NAME, using: :gin, opclass: { content: :gin_trgm_ops }
- end
-
- def down
- remove_concurrent_index_by_name(:snippets, INDEX_NAME)
- end
-end
diff --git a/db/migrate/20190929180751_create_vulnerabilities.rb b/db/migrate/20190929180751_create_vulnerabilities.rb
deleted file mode 100644
index e4c53b1063a..00000000000
--- a/db/migrate/20190929180751_create_vulnerabilities.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreateVulnerabilities < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- create_table :vulnerabilities do |t|
- t.bigint "milestone_id"
- t.bigint "epic_id"
- t.bigint "project_id", null: false
- t.bigint "author_id", null: false
- t.bigint "updated_by_id"
- t.bigint "last_edited_by_id"
- t.bigint "start_date_sourcing_milestone_id"
- t.bigint "due_date_sourcing_milestone_id"
- t.bigint "closed_by_id"
- t.datetime_with_timezone "last_edited_at"
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.datetime_with_timezone "closed_at"
- t.date "start_date"
- t.date "due_date"
- t.integer "state", limit: 2, default: 1, null: false # initially: open, closed
- t.integer "severity", limit: 2, null: false # auto-calculated as highest-severity finding, but overrideable
- t.integer "confidence", limit: 2, null: false # auto-calculated as lowest-confidence finding, but overrideable
- t.boolean "severity_overridden", default: false
- t.boolean "confidence_overridden", default: false
- t.string "title", limit: 255, null: false # rubocop:disable Migration/PreventStrings
- t.text "title_html", null: false
- t.text "description"
- t.text "description_html"
- end
- end
- # rubocop:enable Migration/AddLimitToTextColumns
-end
diff --git a/db/migrate/20190929180813_add_reference_from_vulnerability_occurrences_to_occurrences.rb b/db/migrate/20190929180813_add_reference_from_vulnerability_occurrences_to_occurrences.rb
deleted file mode 100644
index eb8e8fb73d1..00000000000
--- a/db/migrate/20190929180813_add_reference_from_vulnerability_occurrences_to_occurrences.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddReferenceFromVulnerabilityOccurrencesToOccurrences < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :vulnerability_occurrences, :vulnerability_id, :bigint
- end
-end
diff --git a/db/migrate/20190929180827_add_foreign_keys_and_indexes_to_vulnerabilities.rb b/db/migrate/20190929180827_add_foreign_keys_and_indexes_to_vulnerabilities.rb
deleted file mode 100644
index 4d7c2363083..00000000000
--- a/db/migrate/20190929180827_add_foreign_keys_and_indexes_to_vulnerabilities.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddForeignKeysAndIndexesToVulnerabilities < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :vulnerabilities, :milestone_id
- add_concurrent_foreign_key :vulnerabilities, :milestones, column: :milestone_id, on_delete: :nullify
-
- add_concurrent_index :vulnerabilities, :epic_id
- add_concurrent_foreign_key :vulnerabilities, :epics, column: :epic_id, on_delete: :nullify
-
- add_concurrent_index :vulnerabilities, :project_id
- add_concurrent_foreign_key :vulnerabilities, :projects, column: :project_id
-
- add_concurrent_index :vulnerabilities, :author_id
- add_concurrent_foreign_key :vulnerabilities, :users, column: :author_id, on_delete: :nullify
-
- add_concurrent_index :vulnerabilities, :updated_by_id
- add_concurrent_foreign_key :vulnerabilities, :users, column: :updated_by_id, on_delete: :nullify
-
- add_concurrent_index :vulnerabilities, :last_edited_by_id
- add_concurrent_foreign_key :vulnerabilities, :users, column: :last_edited_by_id, on_delete: :nullify
-
- add_concurrent_index :vulnerabilities, :closed_by_id
- add_concurrent_foreign_key :vulnerabilities, :users, column: :closed_by_id, on_delete: :nullify
-
- add_concurrent_index :vulnerabilities, :start_date_sourcing_milestone_id
- add_concurrent_foreign_key :vulnerabilities, :milestones, column: :start_date_sourcing_milestone_id, on_delete: :nullify
-
- add_concurrent_index :vulnerabilities, :due_date_sourcing_milestone_id
- add_concurrent_foreign_key :vulnerabilities, :milestones, column: :due_date_sourcing_milestone_id, on_delete: :nullify
-
- add_concurrent_index :vulnerability_occurrences, :vulnerability_id
- add_concurrent_foreign_key :vulnerability_occurrences, :vulnerabilities, column: :vulnerability_id, on_delete: :nullify
- end
-
- def down
- remove_foreign_key :vulnerability_occurrences, :vulnerabilities
- remove_concurrent_index :vulnerability_occurrences, :vulnerability_id
-
- remove_foreign_key :vulnerabilities, column: :due_date_sourcing_milestone_id
- remove_concurrent_index :vulnerabilities, :due_date_sourcing_milestone_id
-
- remove_foreign_key :vulnerabilities, column: :start_date_sourcing_milestone_id
- remove_concurrent_index :vulnerabilities, :start_date_sourcing_milestone_id
-
- remove_foreign_key :vulnerabilities, column: :closed_by_id
- remove_concurrent_index :vulnerabilities, :closed_by_id
-
- remove_foreign_key :vulnerabilities, column: :last_edited_by_id
- remove_concurrent_index :vulnerabilities, :last_edited_by_id
-
- remove_foreign_key :vulnerabilities, column: :updated_by_id
- remove_concurrent_index :vulnerabilities, :updated_by_id
-
- remove_foreign_key :vulnerabilities, column: :author_id
- remove_concurrent_index :vulnerabilities, :author_id
-
- remove_foreign_key :vulnerabilities, :projects
- remove_concurrent_index :vulnerabilities, :project_id
-
- remove_foreign_key :vulnerabilities, :epics
- remove_concurrent_index :vulnerabilities, :epic_id
-
- remove_foreign_key :vulnerabilities, :milestones
- remove_concurrent_index :vulnerabilities, :milestone_id
- end
-end
diff --git a/db/migrate/20190930025655_add_incident_management_throttle_columns_to_application_setting.rb b/db/migrate/20190930025655_add_incident_management_throttle_columns_to_application_setting.rb
deleted file mode 100644
index 577c705fbef..00000000000
--- a/db/migrate/20190930025655_add_incident_management_throttle_columns_to_application_setting.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-class AddIncidentManagementThrottleColumnsToApplicationSetting < ActiveRecord::Migration[5.2]
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def up
- add_column(:application_settings,
- :throttle_incident_management_notification_enabled,
- :boolean,
- null: false,
- default: false)
-
- add_column(:application_settings,
- :throttle_incident_management_notification_period_in_seconds,
- :integer,
- default: 3_600)
-
- add_column(:application_settings,
- :throttle_incident_management_notification_per_period,
- :integer,
- default: 3_600)
- end
-
- def down
- remove_column :application_settings, :throttle_incident_management_notification_enabled
- remove_column :application_settings, :throttle_incident_management_notification_period_in_seconds
- remove_column :application_settings, :throttle_incident_management_notification_per_period
- end
-end
diff --git a/db/migrate/20190930063627_add_management_project_id_to_clusters.rb b/db/migrate/20190930063627_add_management_project_id_to_clusters.rb
deleted file mode 100644
index 46c3fef8e76..00000000000
--- a/db/migrate/20190930063627_add_management_project_id_to_clusters.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddManagementProjectIdToClusters < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :clusters, :management_project_id, :integer
- end
-end
diff --git a/db/migrate/20190930082942_add_new_release_to_notification_settings.rb b/db/migrate/20190930082942_add_new_release_to_notification_settings.rb
deleted file mode 100644
index 2ec5815f542..00000000000
--- a/db/migrate/20190930082942_add_new_release_to_notification_settings.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddNewReleaseToNotificationSettings < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :notification_settings, :new_release, :boolean
- end
-end
diff --git a/db/migrate/20190930153535_create_zoom_meetings.rb b/db/migrate/20190930153535_create_zoom_meetings.rb
deleted file mode 100644
index 8bc9f0e89de..00000000000
--- a/db/migrate/20190930153535_create_zoom_meetings.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class CreateZoomMeetings < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- ZOOM_MEETING_STATUS_ADDED = 1
-
- def change
- create_table :zoom_meetings do |t|
- t.references :project, foreign_key: { on_delete: :cascade },
- null: false
- t.references :issue, foreign_key: { on_delete: :cascade },
- null: false
- t.timestamps_with_timezone null: false
- t.integer :issue_status, limit: 2, default: 1, null: false
- t.string :url, limit: 255 # rubocop:disable Migration/PreventStrings
-
- t.index [:issue_id, :issue_status], unique: true,
- where: "issue_status = #{ZOOM_MEETING_STATUS_ADDED}"
- end
- end
-end
diff --git a/db/migrate/20191001040549_add_management_project_id_index_fk_to_clusters.rb b/db/migrate/20191001040549_add_management_project_id_index_fk_to_clusters.rb
deleted file mode 100644
index 97253dd1f2d..00000000000
--- a/db/migrate/20191001040549_add_management_project_id_index_fk_to_clusters.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddManagementProjectIdIndexFkToClusters < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :clusters, :projects, column: :management_project_id, on_delete: :nullify
- add_concurrent_index :clusters, :management_project_id, where: 'management_project_id IS NOT NULL'
- end
-
- def down
- remove_concurrent_index :clusters, :management_project_id
- remove_foreign_key_if_exists :clusters, column: :management_project_id
- end
-end
diff --git a/db/migrate/20191001170300_create_ci_ref.rb b/db/migrate/20191001170300_create_ci_ref.rb
deleted file mode 100644
index feeb8517e6e..00000000000
--- a/db/migrate/20191001170300_create_ci_ref.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class CreateCiRef < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :ci_refs do |t|
- t.references :project, null: false, index: false, foreign_key: { on_delete: :cascade }, type: :integer
- t.integer :lock_version, default: 0
- t.integer :last_updated_by_pipeline_id
- t.boolean :tag, default: false, null: false
- t.string :ref, null: false, limit: 255
- t.string :status, null: false, limit: 255
- t.foreign_key :ci_pipelines, column: :last_updated_by_pipeline_id, on_delete: :nullify
- t.index [:project_id, :ref, :tag], unique: true
- t.index [:last_updated_by_pipeline_id]
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191002123516_create_clusters_applications_elastic_stack.rb b/db/migrate/20191002123516_create_clusters_applications_elastic_stack.rb
deleted file mode 100644
index e1236423672..00000000000
--- a/db/migrate/20191002123516_create_clusters_applications_elastic_stack.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreateClustersApplicationsElasticStack < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :clusters_applications_elastic_stacks do |t|
- t.timestamps_with_timezone null: false
- t.references :cluster, null: false, index: false, foreign_key: { on_delete: :cascade }
- t.integer :status, null: false
- t.string :version, null: false, limit: 255
- t.string :kibana_hostname, limit: 255
- t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns
- t.index :cluster_id, unique: true
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191003015155_add_self_managed_prometheus_alerts.rb b/db/migrate/20191003015155_add_self_managed_prometheus_alerts.rb
deleted file mode 100644
index eec6f518257..00000000000
--- a/db/migrate/20191003015155_add_self_managed_prometheus_alerts.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class AddSelfManagedPrometheusAlerts < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :self_managed_prometheus_alert_events do |t|
- t.references :project, index: false, foreign_key: { on_delete: :cascade }, null: false
- t.references :environment, index: true, foreign_key: { on_delete: :cascade }
- t.datetime_with_timezone :started_at, null: false
- t.datetime_with_timezone :ended_at
-
- t.integer :status, null: false, limit: 2
- t.string :title, null: false, limit: 255
- t.string :query_expression, limit: 255
- t.string :payload_key, null: false, limit: 255
- t.index [:project_id, :payload_key], unique: true, name: 'idx_project_id_payload_key_self_managed_prometheus_alert_events'
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191003060227_add_push_event_hooks_limit_to_application_settings.rb b/db/migrate/20191003060227_add_push_event_hooks_limit_to_application_settings.rb
deleted file mode 100644
index 4b381dca81b..00000000000
--- a/db/migrate/20191003060227_add_push_event_hooks_limit_to_application_settings.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddPushEventHooksLimitToApplicationSettings < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:application_settings, :push_event_hooks_limit, :integer, default: 3) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:application_settings, :push_event_hooks_limit)
- end
-end
diff --git a/db/migrate/20191003064615_create_aws_roles.rb b/db/migrate/20191003064615_create_aws_roles.rb
deleted file mode 100644
index 960e9b28053..00000000000
--- a/db/migrate/20191003064615_create_aws_roles.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreateAwsRoles < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :aws_roles, id: false do |t|
- t.references :user, primary_key: true, default: nil, type: :integer, index: { unique: true }, foreign_key: { on_delete: :cascade }
-
- t.timestamps_with_timezone null: false
-
- t.string :role_arn, null: false, limit: 2048
- t.string :role_external_id, null: false, limit: 64
-
- t.index :role_external_id, unique: true
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191003130045_create_issue_user_mentions.rb b/db/migrate/20191003130045_create_issue_user_mentions.rb
deleted file mode 100644
index e465a307f44..00000000000
--- a/db/migrate/20191003130045_create_issue_user_mentions.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class CreateIssueUserMentions < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :issue_user_mentions do |t|
- t.references :issue, type: :integer, index: false, null: false, foreign_key: { on_delete: :cascade }
- t.references :note, type: :integer,
- index: { where: 'note_id IS NOT NULL', unique: true }, null: true, foreign_key: { on_delete: :cascade }
- t.integer :mentioned_users_ids, array: true
- t.integer :mentioned_projects_ids, array: true
- t.integer :mentioned_groups_ids, array: true
- end
-
- add_index :issue_user_mentions, [:issue_id], where: 'note_id is null', unique: true, name: 'issue_user_mentions_on_issue_id_index'
- add_index :issue_user_mentions, [:issue_id, :note_id], unique: true, name: 'issue_user_mentions_on_issue_id_and_note_id_index'
- end
-end
diff --git a/db/migrate/20191003150045_create_merge_request_user_mentions.rb b/db/migrate/20191003150045_create_merge_request_user_mentions.rb
deleted file mode 100644
index 0ec45020127..00000000000
--- a/db/migrate/20191003150045_create_merge_request_user_mentions.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class CreateMergeRequestUserMentions < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :merge_request_user_mentions do |t|
- t.references :merge_request, type: :integer, index: false, null: false, foreign_key: { on_delete: :cascade }
- t.references :note, type: :integer,
- index: { where: 'note_id IS NOT NULL', unique: true }, null: true, foreign_key: { on_delete: :cascade }
- t.integer :mentioned_users_ids, array: true
- t.integer :mentioned_projects_ids, array: true
- t.integer :mentioned_groups_ids, array: true
- end
-
- add_index :merge_request_user_mentions, [:merge_request_id], where: 'note_id is null', unique: true, name: 'merge_request_user_mentions_on_mr_id_index'
- add_index :merge_request_user_mentions, [:merge_request_id, :note_id], unique: true, name: 'merge_request_user_mentions_on_mr_id_and_note_id_index'
- end
-end
diff --git a/db/migrate/20191003161031_add_mark_for_deletion_to_projects.rb b/db/migrate/20191003161031_add_mark_for_deletion_to_projects.rb
deleted file mode 100644
index 12f17c849aa..00000000000
--- a/db/migrate/20191003161031_add_mark_for_deletion_to_projects.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddMarkForDeletionToProjects < ActiveRecord::Migration[5.2]
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/AddColumnsToWideTables
- def change
- add_column :projects, :marked_for_deletion_at, :date
- add_column :projects, :marked_for_deletion_by_user_id, :integer
- end
- # rubocop:enable Migration/AddColumnsToWideTables
-end
diff --git a/db/migrate/20191003161032_add_mark_for_deletion_indexes_to_projects.rb b/db/migrate/20191003161032_add_mark_for_deletion_indexes_to_projects.rb
deleted file mode 100644
index d6ef6509fff..00000000000
--- a/db/migrate/20191003161032_add_mark_for_deletion_indexes_to_projects.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddMarkForDeletionIndexesToProjects < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :projects, :users, column: :marked_for_deletion_by_user_id, on_delete: :nullify
- add_concurrent_index :projects, :marked_for_deletion_by_user_id, where: 'marked_for_deletion_by_user_id IS NOT NULL'
- end
-
- def down
- remove_foreign_key_if_exists :projects, column: :marked_for_deletion_by_user_id
- remove_concurrent_index :projects, :marked_for_deletion_by_user_id
- end
-end
diff --git a/db/migrate/20191003195218_add_pendo_enabled_to_application_settings.rb b/db/migrate/20191003195218_add_pendo_enabled_to_application_settings.rb
deleted file mode 100644
index 2d937327ca1..00000000000
--- a/db/migrate/20191003195218_add_pendo_enabled_to_application_settings.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddPendoEnabledToApplicationSettings < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :application_settings, :pendo_enabled, :boolean, default: false, allow_null: false # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :application_settings, :pendo_enabled
- end
-end
diff --git a/db/migrate/20191003195620_add_pendo_url_to_application_settings.rb b/db/migrate/20191003195620_add_pendo_url_to_application_settings.rb
deleted file mode 100644
index cbeb1ef5186..00000000000
--- a/db/migrate/20191003195620_add_pendo_url_to_application_settings.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddPendoUrlToApplicationSettings < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :application_settings, :pendo_url, :string, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191003200045_create_epic_user_mentions.rb b/db/migrate/20191003200045_create_epic_user_mentions.rb
deleted file mode 100644
index 25f9b24f9cc..00000000000
--- a/db/migrate/20191003200045_create_epic_user_mentions.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class CreateEpicUserMentions < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :epic_user_mentions do |t|
- t.references :epic, type: :integer, index: false, null: false, foreign_key: { on_delete: :cascade }
- t.references :note, type: :integer,
- index: { where: 'note_id IS NOT NULL', unique: true }, null: true, foreign_key: { on_delete: :cascade }
- t.integer :mentioned_users_ids, array: true
- t.integer :mentioned_projects_ids, array: true
- t.integer :mentioned_groups_ids, array: true
- end
-
- add_index :epic_user_mentions, [:epic_id], where: 'note_id is null', unique: true, name: 'epic_user_mentions_on_epic_id_index'
- add_index :epic_user_mentions, [:epic_id, :note_id], unique: true, name: 'epic_user_mentions_on_epic_id_and_note_id_index'
- end
-end
diff --git a/db/migrate/20191003250045_create_commit_user_mentions.rb b/db/migrate/20191003250045_create_commit_user_mentions.rb
deleted file mode 100644
index 135c115c725..00000000000
--- a/db/migrate/20191003250045_create_commit_user_mentions.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class CreateCommitUserMentions < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :commit_user_mentions do |t|
- t.references :note, type: :integer,
- index: { unique: true }, null: false, foreign_key: { on_delete: :cascade }
- t.binary :commit_id, null: false
- t.integer :mentioned_users_ids, array: true
- t.integer :mentioned_projects_ids, array: true
- t.integer :mentioned_groups_ids, array: true
- end
-
- add_index :commit_user_mentions, [:commit_id, :note_id], name: 'commit_user_mentions_on_commit_id_and_note_id_index'
- end
-end
diff --git a/db/migrate/20191003300045_create_snippet_user_mentions.rb b/db/migrate/20191003300045_create_snippet_user_mentions.rb
deleted file mode 100644
index fb7681d6e33..00000000000
--- a/db/migrate/20191003300045_create_snippet_user_mentions.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class CreateSnippetUserMentions < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :snippet_user_mentions do |t|
- t.references :snippet, type: :integer, index: false, null: false, foreign_key: { on_delete: :cascade }
- t.references :note, type: :integer,
- index: { where: 'note_id IS NOT NULL', unique: true }, null: true, foreign_key: { on_delete: :cascade }
- t.integer :mentioned_users_ids, array: true
- t.integer :mentioned_projects_ids, array: true
- t.integer :mentioned_groups_ids, array: true
- end
-
- add_index :snippet_user_mentions, [:snippet_id], where: 'note_id is null', unique: true, name: 'snippet_user_mentions_on_snippet_id_index'
- add_index :snippet_user_mentions, [:snippet_id, :note_id], unique: true, name: 'snippet_user_mentions_on_snippet_id_and_note_id_index'
- end
-end
diff --git a/db/migrate/20191003350045_create_design_user_mentions.rb b/db/migrate/20191003350045_create_design_user_mentions.rb
deleted file mode 100644
index 149ee5bd124..00000000000
--- a/db/migrate/20191003350045_create_design_user_mentions.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class CreateDesignUserMentions < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :design_user_mentions do |t|
- t.references :design, type: :integer, index: false, null: false,
- foreign_key: { to_table: :design_management_designs, column: :design_id, on_delete: :cascade }
- t.references :note, type: :integer,
- index: { unique: true }, null: false, foreign_key: { on_delete: :cascade }
- t.integer :mentioned_users_ids, array: true
- t.integer :mentioned_projects_ids, array: true
- t.integer :mentioned_groups_ids, array: true
- end
-
- add_index :design_user_mentions, [:design_id, :note_id], name: 'design_user_mentions_on_design_id_and_note_id_index'
- end
-end
diff --git a/db/migrate/20191004080818_add_productivity_analytics_start_date.rb b/db/migrate/20191004080818_add_productivity_analytics_start_date.rb
deleted file mode 100644
index 287b0755bc1..00000000000
--- a/db/migrate/20191004080818_add_productivity_analytics_start_date.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddProductivityAnalyticsStartDate < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :application_settings, :productivity_analytics_start_date, :datetime_with_timezone
- end
-end
diff --git a/db/migrate/20191004081520_fill_productivity_analytics_start_date.rb b/db/migrate/20191004081520_fill_productivity_analytics_start_date.rb
deleted file mode 100644
index 9432cd68708..00000000000
--- a/db/migrate/20191004081520_fill_productivity_analytics_start_date.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-# Expected migration duration: 1 minute
-class FillProductivityAnalyticsStartDate < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :merge_request_metrics, :merged_at,
- where: "merged_at > '2019-09-01' AND commits_count IS NOT NULL",
- name: 'fill_productivity_analytics_start_date_tmp_index'
-
- execute(
- <<SQL
- UPDATE application_settings
- SET productivity_analytics_start_date = COALESCE((SELECT MIN(merged_at) FROM merge_request_metrics
- WHERE merged_at > '2019-09-01' AND commits_count IS NOT NULL), NOW())
-SQL
- )
-
- remove_concurrent_index :merge_request_metrics, :merged_at,
- name: 'fill_productivity_analytics_start_date_tmp_index'
- end
-
- def down
- execute('UPDATE application_settings SET productivity_analytics_start_date = NULL')
- end
-end
diff --git a/db/migrate/20191004133612_create_analytics_repository_file_commits.rb b/db/migrate/20191004133612_create_analytics_repository_file_commits.rb
deleted file mode 100644
index f2064b2b301..00000000000
--- a/db/migrate/20191004133612_create_analytics_repository_file_commits.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class CreateAnalyticsRepositoryFileCommits < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :analytics_repository_file_commits do |t|
- t.references :analytics_repository_file, index: { name: 'index_analytics_repository_file_commits_file_id' }, foreign_key: { on_delete: :cascade }, null: false
- t.references :project, index: false, foreign_key: { on_delete: :cascade }, null: false
- t.date :committed_date, null: false
- t.integer :commit_count, limit: 2, null: false
- end
-
- add_index :analytics_repository_file_commits,
- [:project_id, :committed_date, :analytics_repository_file_id],
- name: 'index_file_commits_on_committed_date_file_id_and_project_id',
- unique: true
- end
-end
diff --git a/db/migrate/20191004151428_add_auto_stop_in_to_environments.rb b/db/migrate/20191004151428_add_auto_stop_in_to_environments.rb
deleted file mode 100644
index 860e52d420c..00000000000
--- a/db/migrate/20191004151428_add_auto_stop_in_to_environments.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddAutoStopInToEnvironments < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :environments, :auto_stop_at, :datetime_with_timezone
- end
-end
diff --git a/db/migrate/20191008013056_add_push_event_activities_limit_to_application_settings.rb b/db/migrate/20191008013056_add_push_event_activities_limit_to_application_settings.rb
deleted file mode 100644
index af206bcb8d0..00000000000
--- a/db/migrate/20191008013056_add_push_event_activities_limit_to_application_settings.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddPushEventActivitiesLimitToApplicationSettings < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:application_settings, :push_event_activities_limit, :integer, default: 3) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:application_settings, :push_event_activities_limit)
- end
-end
diff --git a/db/migrate/20191008142331_add_ref_count_to_push_event_payloads.rb b/db/migrate/20191008142331_add_ref_count_to_push_event_payloads.rb
deleted file mode 100644
index 72621971dbb..00000000000
--- a/db/migrate/20191008142331_add_ref_count_to_push_event_payloads.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddRefCountToPushEventPayloads < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :push_event_payloads, :ref_count, :integer
- end
-end
diff --git a/db/migrate/20191008180203_add_issuable_state_id_indexes.rb b/db/migrate/20191008180203_add_issuable_state_id_indexes.rb
deleted file mode 100644
index a9a8b8b6359..00000000000
--- a/db/migrate/20191008180203_add_issuable_state_id_indexes.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-# frozen_string_literal: true
-
-class AddIssuableStateIdIndexes < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- # Creates the same indexes that are currently using state:string column
- # for issues and merge_requests tables
- create_indexes_for_issues
- create_indexes_for_merge_requests
- end
-
- def down
- # Removes indexes for issues
- remove_concurrent_index_by_name :issues, 'idx_issues_on_state_id'
- remove_concurrent_index_by_name :issues, 'idx_issues_on_project_id_and_created_at_and_id_and_state_id'
- remove_concurrent_index_by_name :issues, 'idx_issues_on_project_id_and_due_date_and_id_and_state_id'
- remove_concurrent_index_by_name :issues, 'idx_issues_on_project_id_and_rel_position_and_state_id_and_id'
- remove_concurrent_index_by_name :issues, 'idx_issues_on_project_id_and_updated_at_and_id_and_state_id'
-
- # Removes indexes from merge_requests
- remove_concurrent_index_by_name :merge_requests, 'idx_merge_requests_on_id_and_merge_jid'
- remove_concurrent_index_by_name :merge_requests, 'idx_merge_requests_on_source_project_and_branch_state_opened'
- remove_concurrent_index_by_name :merge_requests, 'idx_merge_requests_on_state_id_and_merge_status'
- remove_concurrent_index_by_name :merge_requests, 'idx_merge_requests_on_target_project_id_and_iid_opened'
- end
-
- def create_indexes_for_issues
- add_concurrent_index :issues, :state_id, name: 'idx_issues_on_state_id'
-
- add_concurrent_index :issues,
- [:project_id, :created_at, :id, :state_id],
- name: 'idx_issues_on_project_id_and_created_at_and_id_and_state_id'
-
- add_concurrent_index :issues,
- [:project_id, :due_date, :id, :state_id],
- where: 'due_date IS NOT NULL',
- name: 'idx_issues_on_project_id_and_due_date_and_id_and_state_id'
-
- add_concurrent_index :issues,
- [:project_id, :relative_position, :state_id, :id],
- order: { id: :desc },
- name: 'idx_issues_on_project_id_and_rel_position_and_state_id_and_id'
-
- add_concurrent_index :issues,
- [:project_id, :updated_at, :id, :state_id],
- name: 'idx_issues_on_project_id_and_updated_at_and_id_and_state_id'
- end
-
- def create_indexes_for_merge_requests
- add_concurrent_index :merge_requests,
- [:id, :merge_jid],
- where: 'merge_jid IS NOT NULL and state_id = 4',
- name: 'idx_merge_requests_on_id_and_merge_jid'
-
- add_concurrent_index :merge_requests,
- [:source_project_id, :source_branch],
- where: 'state_id = 1',
- name: 'idx_merge_requests_on_source_project_and_branch_state_opened'
-
- add_concurrent_index :merge_requests,
- [:state_id, :merge_status],
- where: "state_id = 1 AND merge_status = 'can_be_merged'",
- name: 'idx_merge_requests_on_state_id_and_merge_status'
-
- add_concurrent_index :merge_requests,
- [:target_project_id, :iid],
- where: 'state_id = 1',
- name: 'idx_merge_requests_on_target_project_id_and_iid_opened'
- end
-end
diff --git a/db/migrate/20191008200204_add_state_id_default_value.rb b/db/migrate/20191008200204_add_state_id_default_value.rb
deleted file mode 100644
index 15a80163ca8..00000000000
--- a/db/migrate/20191008200204_add_state_id_default_value.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddStateIdDefaultValue < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- change_column_default :issues, :state_id, 1
- change_column_null :issues, :state_id, false
- change_column_default :merge_requests, :state_id, 1
- change_column_null :merge_requests, :state_id, false
- end
-
- def down
- change_column_default :issues, :state_id, nil
- change_column_null :issues, :state_id, true
- change_column_default :merge_requests, :state_id, nil
- change_column_null :merge_requests, :state_id, true
- end
-end
diff --git a/db/migrate/20191009100244_add_geo_design_repository_counters.rb b/db/migrate/20191009100244_add_geo_design_repository_counters.rb
deleted file mode 100644
index 26387453f88..00000000000
--- a/db/migrate/20191009100244_add_geo_design_repository_counters.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddGeoDesignRepositoryCounters < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- change_table :geo_node_statuses do |t|
- t.column :design_repositories_count, :integer
- t.column :design_repositories_synced_count, :integer
- t.column :design_repositories_failed_count, :integer
- t.column :design_repositories_registry_count, :integer
- end
- end
-end
diff --git a/db/migrate/20191009110124_add_has_exposed_artifacts_to_ci_builds_metadata.rb b/db/migrate/20191009110124_add_has_exposed_artifacts_to_ci_builds_metadata.rb
deleted file mode 100644
index 86c3c540e5e..00000000000
--- a/db/migrate/20191009110124_add_has_exposed_artifacts_to_ci_builds_metadata.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddHasExposedArtifactsToCiBuildsMetadata < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def up
- add_column :ci_builds_metadata, :has_exposed_artifacts, :boolean
- end
-
- def down
- remove_column :ci_builds_metadata, :has_exposed_artifacts
- end
-end
diff --git a/db/migrate/20191009110757_add_index_to_ci_builds_metadata_has_exposed_artifacts.rb b/db/migrate/20191009110757_add_index_to_ci_builds_metadata_has_exposed_artifacts.rb
deleted file mode 100644
index 6b8c452a62a..00000000000
--- a/db/migrate/20191009110757_add_index_to_ci_builds_metadata_has_exposed_artifacts.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToCiBuildsMetadataHasExposedArtifacts < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_builds_metadata, [:build_id], where: "has_exposed_artifacts IS TRUE", name: 'index_ci_builds_metadata_on_build_id_and_has_exposed_artifacts'
- end
-
- def down
- remove_concurrent_index_by_name :ci_builds_metadata, 'index_ci_builds_metadata_on_build_id_and_has_exposed_artifacts'
- end
-end
diff --git a/db/migrate/20191009222222_add_custom_http_clone_url_root_to_application_settings.rb b/db/migrate/20191009222222_add_custom_http_clone_url_root_to_application_settings.rb
deleted file mode 100644
index 41876ee2cdf..00000000000
--- a/db/migrate/20191009222222_add_custom_http_clone_url_root_to_application_settings.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddCustomHttpCloneUrlRootToApplicationSettings < ActiveRecord::Migration[5.2]
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :application_settings, :custom_http_clone_url_root, :string, limit: 511
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191010174846_add_snowplow_iglu_registry_url_to_application_settings.rb b/db/migrate/20191010174846_add_snowplow_iglu_registry_url_to_application_settings.rb
deleted file mode 100644
index 8f882bcaa50..00000000000
--- a/db/migrate/20191010174846_add_snowplow_iglu_registry_url_to_application_settings.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddSnowplowIgluRegistryUrlToApplicationSettings < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :application_settings, :snowplow_iglu_registry_url, :string, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191011084019_add_project_deletion_adjourned_period_to_application_settings.rb b/db/migrate/20191011084019_add_project_deletion_adjourned_period_to_application_settings.rb
deleted file mode 100644
index 79546e33253..00000000000
--- a/db/migrate/20191011084019_add_project_deletion_adjourned_period_to_application_settings.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectDeletionAdjournedPeriodToApplicationSettings < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- DEFAULT_NUMBER_OF_DAYS_BEFORE_REMOVAL = 7
-
- def change
- add_column :application_settings, :deletion_adjourned_period, :integer, default: DEFAULT_NUMBER_OF_DAYS_BEFORE_REMOVAL, null: false
- end
-end
diff --git a/db/migrate/20191013100213_add_squash_commit_sha_to_merge_requests.rb b/db/migrate/20191013100213_add_squash_commit_sha_to_merge_requests.rb
deleted file mode 100644
index 0a58f0a89aa..00000000000
--- a/db/migrate/20191013100213_add_squash_commit_sha_to_merge_requests.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddSquashCommitShaToMergeRequests < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :merge_requests, :squash_commit_sha, :binary
- end
-end
diff --git a/db/migrate/20191014025629_rename_design_management_version_user_to_author.rb b/db/migrate/20191014025629_rename_design_management_version_user_to_author.rb
deleted file mode 100644
index 2359cc2e826..00000000000
--- a/db/migrate/20191014025629_rename_design_management_version_user_to_author.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class RenameDesignManagementVersionUserToAuthor < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- rename_column_concurrently :design_management_versions, :user_id, :author_id
- end
-
- def down
- undo_rename_column_concurrently :design_management_versions, :user_id, :author_id
- end
-end
diff --git a/db/migrate/20191014030730_add_author_index_to_design_management_versions.rb b/db/migrate/20191014030730_add_author_index_to_design_management_versions.rb
deleted file mode 100644
index 30e076f1fe6..00000000000
--- a/db/migrate/20191014030730_add_author_index_to_design_management_versions.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddAuthorIndexToDesignManagementVersions < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :design_management_versions, :author_id, where: 'author_id IS NOT NULL'
- end
-
- def down
- remove_concurrent_index :design_management_versions, :author_id
- end
-end
diff --git a/db/migrate/20191014084150_add_index_on_snippets_project_id_and_visibility_level.rb b/db/migrate/20191014084150_add_index_on_snippets_project_id_and_visibility_level.rb
deleted file mode 100644
index a8f40953e5d..00000000000
--- a/db/migrate/20191014084150_add_index_on_snippets_project_id_and_visibility_level.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnSnippetsProjectIdAndVisibilityLevel < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :snippets, [:project_id, :visibility_level]
- end
-
- def down
- remove_concurrent_index :snippets, [:project_id, :visibility_level]
- end
-end
diff --git a/db/migrate/20191014123159_add_expire_notification_delivered_to_personal_access_tokens.rb b/db/migrate/20191014123159_add_expire_notification_delivered_to_personal_access_tokens.rb
deleted file mode 100644
index 41a81e3ac87..00000000000
--- a/db/migrate/20191014123159_add_expire_notification_delivered_to_personal_access_tokens.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddExpireNotificationDeliveredToPersonalAccessTokens < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :personal_access_tokens, :expire_notification_delivered, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :personal_access_tokens, :expire_notification_delivered
- end
-end
diff --git a/db/migrate/20191014132931_remove_index_on_snippets_project_id.rb b/db/migrate/20191014132931_remove_index_on_snippets_project_id.rb
deleted file mode 100644
index 850112b4f0b..00000000000
--- a/db/migrate/20191014132931_remove_index_on_snippets_project_id.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveIndexOnSnippetsProjectId < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :snippets, 'index_snippets_on_project_id'
-
- # This is an extra index that is not present in db/schema.rb but known to exist on some installs
- remove_concurrent_index_by_name :snippets, :snippets_project_id_idx if index_exists_by_name? :snippets, :snippets_project_id_idx
- end
-
- def down
- add_concurrent_index :snippets, [:project_id], name: 'index_snippets_on_project_id'
- end
-end
diff --git a/db/migrate/20191016072826_replace_ci_trigger_requests_index.rb b/db/migrate/20191016072826_replace_ci_trigger_requests_index.rb
deleted file mode 100644
index 8faa6c3847f..00000000000
--- a/db/migrate/20191016072826_replace_ci_trigger_requests_index.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# frozen_string_literal: true
-
-class ReplaceCiTriggerRequestsIndex < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_trigger_requests, [:trigger_id, :id], order: { id: :desc }
-
- # Some installations have legacy, duplicate indexes on
- # ci_trigger_requests.trigger_id. Rails won't drop them without an
- # explicit name: https://gitlab.com/gitlab-org/gitlab/issues/34818
- old_index_names.each do |name|
- remove_concurrent_index :ci_trigger_requests, [:trigger_id], name: name
- end
- end
-
- def down
- add_concurrent_index :ci_trigger_requests, [:trigger_id]
-
- remove_concurrent_index :ci_trigger_requests, [:trigger_id, :id], order: { id: :desc }
- end
-
- private
-
- def old_index_names
- indexes(:ci_trigger_requests).select { |i| i.columns == ['trigger_id'] }.map(&:name)
- end
-end
diff --git a/db/migrate/20191016133352_create_ci_subscriptions_projects.rb b/db/migrate/20191016133352_create_ci_subscriptions_projects.rb
deleted file mode 100644
index 00ab2c19193..00000000000
--- a/db/migrate/20191016133352_create_ci_subscriptions_projects.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreateCiSubscriptionsProjects < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def change
- create_table :ci_subscriptions_projects do |t|
- t.references :downstream_project, null: false, index: false, foreign_key: { to_table: :projects, on_delete: :cascade }
- t.references :upstream_project, null: false, foreign_key: { to_table: :projects, on_delete: :cascade }
- end
-
- add_index :ci_subscriptions_projects, [:downstream_project_id, :upstream_project_id],
- unique: true, name: 'index_ci_subscriptions_projects_unique_subscription'
- end
-end
diff --git a/db/migrate/20191016220135_add_join_table_for_self_managed_prometheus_alert_issues.rb b/db/migrate/20191016220135_add_join_table_for_self_managed_prometheus_alert_issues.rb
deleted file mode 100644
index 68b448f8836..00000000000
--- a/db/migrate/20191016220135_add_join_table_for_self_managed_prometheus_alert_issues.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class AddJoinTableForSelfManagedPrometheusAlertIssues < ActiveRecord::Migration[5.2]
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def change
- # Join table to Issues
- create_table :issues_self_managed_prometheus_alert_events, id: false do |t|
- t.references :issue, null: false,
- index: false, # Uses the index below
- foreign_key: { on_delete: :cascade }
- t.references :self_managed_prometheus_alert_event, null: false,
- index: { name: 'issue_id_issues_self_managed_rometheus_alert_events_index' },
- foreign_key: { on_delete: :cascade }
-
- t.timestamps_with_timezone
- t.index [:issue_id, :self_managed_prometheus_alert_event_id],
- unique: true, name: 'issue_id_self_managed_prometheus_alert_event_id_index'
- end
- end
-end
diff --git a/db/migrate/20191017001326_create_users_security_dashboard_projects.rb b/db/migrate/20191017001326_create_users_security_dashboard_projects.rb
deleted file mode 100644
index 398401dbee6..00000000000
--- a/db/migrate/20191017001326_create_users_security_dashboard_projects.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class CreateUsersSecurityDashboardProjects < ActiveRecord::Migration[5.2]
- DOWNTIME = false
- INDEX_NAME = 'users_security_dashboard_projects_unique_index'
-
- def change
- create_table :users_security_dashboard_projects, id: false do |t|
- t.references :user, null: false, foreign_key: { on_delete: :cascade }
- t.references :project, null: false, index: false, foreign_key: { on_delete: :cascade }
- end
-
- add_index :users_security_dashboard_projects, [:project_id, :user_id], name: INDEX_NAME, unique: true
- end
-end
diff --git a/db/migrate/20191017094449_add_remove_source_branch_after_merge_to_projects.rb b/db/migrate/20191017094449_add_remove_source_branch_after_merge_to_projects.rb
deleted file mode 100644
index d4f84b066a3..00000000000
--- a/db/migrate/20191017094449_add_remove_source_branch_after_merge_to_projects.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddRemoveSourceBranchAfterMergeToProjects < ActiveRecord::Migration[5.1]
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def up
- add_column :projects, :remove_source_branch_after_merge, :boolean # rubocop:disable Migration/AddColumnsToWideTables
- end
-
- def down
- remove_column :projects, :remove_source_branch_after_merge
- end
-end
diff --git a/db/migrate/20191017134513_add_deployment_merge_requests.rb b/db/migrate/20191017134513_add_deployment_merge_requests.rb
deleted file mode 100644
index dbe09463d22..00000000000
--- a/db/migrate/20191017134513_add_deployment_merge_requests.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-class AddDeploymentMergeRequests < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :deployment_merge_requests, id: false do |t|
- t.references(
- :deployment,
- foreign_key: { on_delete: :cascade },
- type: :integer,
- index: false,
- null: false
- )
-
- t.references(
- :merge_request,
- foreign_key: { on_delete: :cascade },
- type: :integer,
- index: true,
- null: false
- )
-
- t.index(
- [:deployment_id, :merge_request_id],
- unique: true,
- name: 'idx_deployment_merge_requests_unique_index'
- )
- end
- end
-end
diff --git a/db/migrate/20191017191341_create_clusters_applications_crossplane.rb b/db/migrate/20191017191341_create_clusters_applications_crossplane.rb
deleted file mode 100644
index 42f980ed99d..00000000000
--- a/db/migrate/20191017191341_create_clusters_applications_crossplane.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class CreateClustersApplicationsCrossplane < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :clusters_applications_crossplane do |t|
- t.timestamps_with_timezone null: false
- t.references :cluster, null: false, index: false, foreign_key: { on_delete: :cascade }
- t.integer :status, null: false
- t.string :version, null: false, limit: 255
- t.string :stack, null: false, limit: 255
- t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns
- t.index :cluster_id, unique: true
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191023093207_add_comment_actions_to_services.rb b/db/migrate/20191023093207_add_comment_actions_to_services.rb
deleted file mode 100644
index 46d4bdf9500..00000000000
--- a/db/migrate/20191023093207_add_comment_actions_to_services.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddCommentActionsToServices < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- # rubocop:disable Migration/AddColumnWithDefault
- # rubocop:disable Migration/UpdateLargeTable
- def up
- add_column_with_default(:services, :comment_on_event_enabled, :boolean, default: true)
- end
- # rubocop:enable Migration/AddColumnWithDefault
- # rubocop:enable Migration/UpdateLargeTable
-
- def down
- remove_column(:services, :comment_on_event_enabled)
- end
-end
diff --git a/db/migrate/20191023132005_add_merge_requests_index_on_target_project_and_branch.rb b/db/migrate/20191023132005_add_merge_requests_index_on_target_project_and_branch.rb
deleted file mode 100644
index a3de3f34c44..00000000000
--- a/db/migrate/20191023132005_add_merge_requests_index_on_target_project_and_branch.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddMergeRequestsIndexOnTargetProjectAndBranch < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :merge_requests, [:target_project_id, :target_branch],
- where: "state_id = 1 AND merge_when_pipeline_succeeds = true"
- end
-
- def down
- remove_concurrent_index :merge_requests, [:target_project_id, :target_branch]
- end
-end
diff --git a/db/migrate/20191023152913_add_default_and_free_plans.rb b/db/migrate/20191023152913_add_default_and_free_plans.rb
deleted file mode 100644
index 4f5f8000386..00000000000
--- a/db/migrate/20191023152913_add_default_and_free_plans.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class AddDefaultAndFreePlans < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- class Plan < ApplicationRecord
- end
-
- def up
- plan_names.each do |plan_name|
- Plan.create_with(title: plan_name.titleize).find_or_create_by(name: plan_name)
- end
- end
-
- def down
- Plan.where(name: plan_names).delete_all
- end
-
- private
-
- def plan_names
- [
- ('free' if Gitlab.com?),
- 'default'
- ].compact
- end
-end
diff --git a/db/migrate/20191024134020_add_index_to_zoom_meetings.rb b/db/migrate/20191024134020_add_index_to_zoom_meetings.rb
deleted file mode 100644
index ef3657b6a5e..00000000000
--- a/db/migrate/20191024134020_add_index_to_zoom_meetings.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToZoomMeetings < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :zoom_meetings, :issue_status
- end
-
- def down
- remove_concurrent_index :zoom_meetings, :issue_status if index_exists?(:zoom_meetings, :issue_status)
- end
-end
diff --git a/db/migrate/20191025092748_add_secret_token_to_snippet.rb b/db/migrate/20191025092748_add_secret_token_to_snippet.rb
deleted file mode 100644
index c43c1fbe2b7..00000000000
--- a/db/migrate/20191025092748_add_secret_token_to_snippet.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-class AddSecretTokenToSnippet < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :snippets, :encrypted_secret_token, :string, limit: 255
- add_column :snippets, :encrypted_secret_token_iv, :string, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191026041447_change_default_value_of_throttle_protected_paths.rb b/db/migrate/20191026041447_change_default_value_of_throttle_protected_paths.rb
deleted file mode 100644
index dd79fb217ef..00000000000
--- a/db/migrate/20191026041447_change_default_value_of_throttle_protected_paths.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeDefaultValueOfThrottleProtectedPaths < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- change_column_default :application_settings, :throttle_protected_paths_enabled, false
-
- # Because we already set the value to true in the previous
- # migration, this feature was switched on inadvertently in GitLab
- # 12.4. This migration toggles it back off to ensure we don't
- # inadvertently block legitimate users. The admin will have to
- # re-enable it in the application settings.
- unless omnibus_protected_paths_present?
- execute "UPDATE application_settings SET throttle_protected_paths_enabled = #{false_value}"
- end
- end
-
- def down
- change_column_default :application_settings, :throttle_protected_paths_enabled, true
-
- execute "UPDATE application_settings SET throttle_protected_paths_enabled = #{true_value}"
- end
-
- private
-
- def omnibus_protected_paths_present?
- Rack::Attack.throttles.key?('protected paths')
- rescue e
- say "Error while checking if Omnibus protected paths were already enabled: #{e.message}"
- say 'Continuing. Protected paths will remain enabled.'
-
- # Return true so we don't take a risk
- true
- end
-end
diff --git a/db/migrate/20191026120008_add_promoted_to_epic_to_issues.rb b/db/migrate/20191026120008_add_promoted_to_epic_to_issues.rb
deleted file mode 100644
index 158dbf69bcc..00000000000
--- a/db/migrate/20191026120008_add_promoted_to_epic_to_issues.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddPromotedToEpicToIssues < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def up
- add_column :issues, :promoted_to_epic_id, :integer
- end
-
- def down
- remove_column :issues, :promoted_to_epic_id
- end
-end
diff --git a/db/migrate/20191026120112_add_promoted_to_epic_to_issues_index.rb b/db/migrate/20191026120112_add_promoted_to_epic_to_issues_index.rb
deleted file mode 100644
index 649c2f7abe5..00000000000
--- a/db/migrate/20191026120112_add_promoted_to_epic_to_issues_index.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddPromotedToEpicToIssuesIndex < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :issues, :epics, column: :promoted_to_epic_id, on_delete: :nullify
- add_concurrent_index :issues, :promoted_to_epic_id, where: 'promoted_to_epic_id IS NOT NULL'
- end
-
- def down
- remove_concurrent_index(:issues, :promoted_to_epic_id)
- remove_foreign_key :issues, column: :promoted_to_epic_id
- end
-end
diff --git a/db/migrate/20191026124116_set_application_settings_default_project_and_snippet_visibility.rb b/db/migrate/20191026124116_set_application_settings_default_project_and_snippet_visibility.rb
deleted file mode 100644
index 9d19279510a..00000000000
--- a/db/migrate/20191026124116_set_application_settings_default_project_and_snippet_visibility.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class SetApplicationSettingsDefaultProjectAndSnippetVisibility < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- change_column_null :application_settings, :default_project_visibility, false, 0
- change_column_default :application_settings, :default_project_visibility, from: nil, to: 0
-
- change_column_null :application_settings, :default_snippet_visibility, false, 0
- change_column_default :application_settings, :default_snippet_visibility, from: nil, to: 0
- end
-end
diff --git a/db/migrate/20191028130054_add_max_issue_weight_to_list.rb b/db/migrate/20191028130054_add_max_issue_weight_to_list.rb
deleted file mode 100644
index f15b65067f6..00000000000
--- a/db/migrate/20191028130054_add_max_issue_weight_to_list.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddMaxIssueWeightToList < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- def up
- add_column_with_default :lists, :max_issue_weight, :integer, default: 0 # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :lists, :max_issue_weight
- end
-end
diff --git a/db/migrate/20191028162543_add_setup_for_company_to_user_preferences.rb b/db/migrate/20191028162543_add_setup_for_company_to_user_preferences.rb
deleted file mode 100644
index 18a8a2306e2..00000000000
--- a/db/migrate/20191028162543_add_setup_for_company_to_user_preferences.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddSetupForCompanyToUserPreferences < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :user_preferences, :setup_for_company, :boolean
- end
-end
diff --git a/db/migrate/20191028184740_rename_snowplow_site_id_to_snowplow_app_id.rb b/db/migrate/20191028184740_rename_snowplow_site_id_to_snowplow_app_id.rb
deleted file mode 100644
index 4e3b2da670e..00000000000
--- a/db/migrate/20191028184740_rename_snowplow_site_id_to_snowplow_app_id.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class RenameSnowplowSiteIdToSnowplowAppId < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- rename_column_concurrently :application_settings, :snowplow_site_id, :snowplow_app_id
- end
-
- def down
- undo_rename_column_concurrently :application_settings, :snowplow_site_id, :snowplow_app_id
- end
-end
diff --git a/db/migrate/20191029125305_create_packages_conan_metadata.rb b/db/migrate/20191029125305_create_packages_conan_metadata.rb
deleted file mode 100644
index fa14b73e19b..00000000000
--- a/db/migrate/20191029125305_create_packages_conan_metadata.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class CreatePackagesConanMetadata < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :packages_conan_metadata do |t|
- t.references :package, index: { unique: true }, null: false, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :bigint
- t.timestamps_with_timezone
- t.string "package_username", null: false, limit: 255
- t.string "package_channel", null: false, limit: 255
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191029191901_add_enabled_to_grafana_integrations.rb b/db/migrate/20191029191901_add_enabled_to_grafana_integrations.rb
deleted file mode 100644
index 40e361e2150..00000000000
--- a/db/migrate/20191029191901_add_enabled_to_grafana_integrations.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class AddEnabledToGrafanaIntegrations < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault
- :grafana_integrations,
- :enabled,
- :boolean,
- allow_null: false,
- default: false
- )
- end
-
- def down
- remove_column(:grafana_integrations, :enabled)
- end
-end
diff --git a/db/migrate/20191030135044_create_plan_limits.rb b/db/migrate/20191030135044_create_plan_limits.rb
deleted file mode 100644
index 291d9824f6d..00000000000
--- a/db/migrate/20191030135044_create_plan_limits.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class CreatePlanLimits < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :plan_limits, id: false do |t|
- t.references :plan, foreign_key: { on_delete: :cascade }, null: false, index: { unique: true }
- t.integer :ci_active_pipelines, null: false, default: 0
- t.integer :ci_pipeline_size, null: false, default: 0
- t.integer :ci_active_jobs, null: false, default: 0
- end
- end
-end
diff --git a/db/migrate/20191030152934_move_limits_from_plans.rb b/db/migrate/20191030152934_move_limits_from_plans.rb
deleted file mode 100644
index 020a028f648..00000000000
--- a/db/migrate/20191030152934_move_limits_from_plans.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class MoveLimitsFromPlans < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def up
- execute <<~SQL
- INSERT INTO plan_limits (plan_id, ci_active_pipelines, ci_pipeline_size, ci_active_jobs)
- SELECT id, COALESCE(active_pipelines_limit, 0), COALESCE(pipeline_size_limit, 0), COALESCE(active_jobs_limit, 0)
- FROM plans
- SQL
- end
-
- def down
- execute 'DELETE FROM plan_limits'
- end
-end
diff --git a/db/migrate/20191031095636_create_project_settings.rb b/db/migrate/20191031095636_create_project_settings.rb
deleted file mode 100644
index 0263eceb3c1..00000000000
--- a/db/migrate/20191031095636_create_project_settings.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-class CreateProjectSettings < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :project_settings, id: false do |t|
- t.timestamps_with_timezone null: false
- t.references :project, primary_key: true, default: nil, type: :integer, index: false, foreign_key: { on_delete: :cascade }
- end
- end
-end
diff --git a/db/migrate/20191101092917_replace_index_on_metrics_merged_at.rb b/db/migrate/20191101092917_replace_index_on_metrics_merged_at.rb
deleted file mode 100644
index b2baaee2b76..00000000000
--- a/db/migrate/20191101092917_replace_index_on_metrics_merged_at.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class ReplaceIndexOnMetricsMergedAt < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :merge_request_metrics, :merged_at
- remove_concurrent_index :merge_request_metrics, [:merged_at, :id]
- end
-
- def down
- add_concurrent_index :merge_request_metrics, [:merged_at, :id]
- remove_concurrent_index :merge_request_metrics, :merged_at
- end
-end
diff --git a/db/migrate/20191103202505_add_eks_credentials_to_application_settings.rb b/db/migrate/20191103202505_add_eks_credentials_to_application_settings.rb
deleted file mode 100644
index 5ed3e7edb3c..00000000000
--- a/db/migrate/20191103202505_add_eks_credentials_to_application_settings.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddEksCredentialsToApplicationSettings < ActiveRecord::Migration[5.2]
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- add_column :application_settings, :eks_integration_enabled, :boolean, null: false, default: false
- add_column :application_settings, :eks_account_id, :string, limit: 128
- add_column :application_settings, :eks_access_key_id, :string, limit: 128
- add_column :application_settings, :encrypted_eks_secret_access_key_iv, :string, limit: 255
- add_column :application_settings, :encrypted_eks_secret_access_key, :text
- end
- # rubocop:enable Migration/AddLimitToTextColumns
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191104205020_add_license_details_to_application_settings.rb b/db/migrate/20191104205020_add_license_details_to_application_settings.rb
deleted file mode 100644
index f951ae6492d..00000000000
--- a/db/migrate/20191104205020_add_license_details_to_application_settings.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddLicenseDetailsToApplicationSettings < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :application_settings, :license_trial_ends_on, :date, null: true
- end
-end
diff --git a/db/migrate/20191105094558_add_report_type_to_vulnerabilities.rb b/db/migrate/20191105094558_add_report_type_to_vulnerabilities.rb
deleted file mode 100644
index 8fb657bf9e7..00000000000
--- a/db/migrate/20191105094558_add_report_type_to_vulnerabilities.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddReportTypeToVulnerabilities < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :vulnerabilities, :report_type, :integer, limit: 2
- end
-end
diff --git a/db/migrate/20191105134413_create_service_desk_settings.rb b/db/migrate/20191105134413_create_service_desk_settings.rb
deleted file mode 100644
index dc8268f1c90..00000000000
--- a/db/migrate/20191105134413_create_service_desk_settings.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class CreateServiceDeskSettings < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :service_desk_settings, id: false do |t|
- t.references :project,
- primary_key: true,
- default: nil,
- null: false,
- index: false,
- foreign_key: { on_delete: :cascade }
-
- t.string :issue_template_key, limit: 255
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191105155113_add_secret_to_snippet.rb b/db/migrate/20191105155113_add_secret_to_snippet.rb
deleted file mode 100644
index 8f0a330238b..00000000000
--- a/db/migrate/20191105155113_add_secret_to_snippet.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class AddSecretToSnippet < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- unless column_exists?(:snippets, :secret)
- add_column_with_default :snippets, :secret, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault
- end
-
- add_concurrent_index :snippets, [:visibility_level, :secret]
- remove_concurrent_index :snippets, :visibility_level
- end
-
- def down
- add_concurrent_index :snippets, :visibility_level
- remove_concurrent_index :snippets, [:visibility_level, :secret]
-
- if column_exists?(:snippets, :secret)
- remove_column :snippets, :secret
- end
- end
-end
diff --git a/db/migrate/20191105193652_add_index_on_deployments_updated_at.rb b/db/migrate/20191105193652_add_index_on_deployments_updated_at.rb
deleted file mode 100644
index 10371c26dcc..00000000000
--- a/db/migrate/20191105193652_add_index_on_deployments_updated_at.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnDeploymentsUpdatedAt < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_COLUMNS = [:project_id, :updated_at]
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:deployments, INDEX_COLUMNS)
- end
-
- def down
- remove_concurrent_index(:deployments, INDEX_COLUMNS)
- end
-end
diff --git a/db/migrate/20191106144901_add_state_to_merge_trains.rb b/db/migrate/20191106144901_add_state_to_merge_trains.rb
deleted file mode 100644
index 64a70575c91..00000000000
--- a/db/migrate/20191106144901_add_state_to_merge_trains.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddStateToMergeTrains < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- MERGE_TRAIN_STATUS_CREATED = 0 # Equivalent to MergeTrain.statuses[:created]
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :merge_trains, :status, :integer, limit: 2, default: MERGE_TRAIN_STATUS_CREATED # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :merge_trains, :status
- end
-end
diff --git a/db/migrate/20191106150931_add_timelog_spent_at_index.rb b/db/migrate/20191106150931_add_timelog_spent_at_index.rb
deleted file mode 100644
index 2412b77d0bf..00000000000
--- a/db/migrate/20191106150931_add_timelog_spent_at_index.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddTimelogSpentAtIndex < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :timelogs, :spent_at, where: 'spent_at IS NOT NULL'
- end
-
- def down
- remove_concurrent_index :timelogs, :spent_at, where: 'spent_at IS NOT NULL'
- end
-end
diff --git a/db/migrate/20191107064946_update_oauth_open_id_requests_foreign_keys.rb b/db/migrate/20191107064946_update_oauth_open_id_requests_foreign_keys.rb
deleted file mode 100644
index 439610758a6..00000000000
--- a/db/migrate/20191107064946_update_oauth_open_id_requests_foreign_keys.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class UpdateOauthOpenIdRequestsForeignKeys < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key(:oauth_openid_requests, :oauth_access_grants, column: :access_grant_id, on_delete: :cascade, name: new_foreign_key_name)
- remove_foreign_key_if_exists(:oauth_openid_requests, name: existing_foreign_key_name)
- end
-
- def down
- add_concurrent_foreign_key(:oauth_openid_requests, :oauth_access_grants, column: :access_grant_id, on_delete: false, name: existing_foreign_key_name)
- remove_foreign_key_if_exists(:oauth_openid_requests, name: new_foreign_key_name)
- end
-
- private
-
- def new_foreign_key_name
- concurrent_foreign_key_name(:oauth_openid_requests, :access_grant_id)
- end
-
- def existing_foreign_key_name
- 'fk_oauth_openid_requests_oauth_access_grants_access_grant_id'
- end
-end
diff --git a/db/migrate/20191107173446_add_sourcegraph_admin_and_user_preferences.rb b/db/migrate/20191107173446_add_sourcegraph_admin_and_user_preferences.rb
deleted file mode 100644
index 731ed82c999..00000000000
--- a/db/migrate/20191107173446_add_sourcegraph_admin_and_user_preferences.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddSourcegraphAdminAndUserPreferences < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- add_column(:application_settings, :sourcegraph_public_only, :boolean, default: true, null: false)
- add_column(:user_preferences, :sourcegraph_enabled, :boolean)
- end
-
- def down
- remove_column(:application_settings, :sourcegraph_public_only)
- remove_column(:user_preferences, :sourcegraph_enabled)
- end
-end
diff --git a/db/migrate/20191107220314_add_index_to_projects_on_marked_for_deletion.rb b/db/migrate/20191107220314_add_index_to_projects_on_marked_for_deletion.rb
deleted file mode 100644
index 06849cf9bfd..00000000000
--- a/db/migrate/20191107220314_add_index_to_projects_on_marked_for_deletion.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToProjectsOnMarkedForDeletion < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :projects, :marked_for_deletion_at, where: 'marked_for_deletion_at IS NOT NULL'
- end
-
- def down
- remove_concurrent_index :projects, :marked_for_deletion_at
- end
-end
diff --git a/db/migrate/20191108031900_create_package_build_info.rb b/db/migrate/20191108031900_create_package_build_info.rb
deleted file mode 100644
index d0c85e2fb3f..00000000000
--- a/db/migrate/20191108031900_create_package_build_info.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-class CreatePackageBuildInfo < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :packages_build_infos do |t|
- t.references :package, null: false, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :integer, index: { unique: true }
- t.references :pipeline, index: true, null: true, foreign_key: { to_table: :ci_pipelines, on_delete: :nullify }, type: :integer
- end
- end
-end
diff --git a/db/migrate/20191111115229_add_group_id_to_import_export_uploads.rb b/db/migrate/20191111115229_add_group_id_to_import_export_uploads.rb
deleted file mode 100644
index 74ef0f27b3e..00000000000
--- a/db/migrate/20191111115229_add_group_id_to_import_export_uploads.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddGroupIdToImportExportUploads < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :import_export_uploads, :group_id, :bigint
- end
-end
diff --git a/db/migrate/20191111115431_add_group_fk_to_import_export_uploads.rb b/db/migrate/20191111115431_add_group_fk_to_import_export_uploads.rb
deleted file mode 100644
index 403de3f33ed..00000000000
--- a/db/migrate/20191111115431_add_group_fk_to_import_export_uploads.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddGroupFkToImportExportUploads < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :import_export_uploads, :namespaces, column: :group_id, on_delete: :cascade
- add_concurrent_index :import_export_uploads, :group_id, unique: true, where: 'group_id IS NOT NULL'
- end
-
- def down
- remove_foreign_key_without_error(:import_export_uploads, column: :group_id)
- remove_concurrent_index(:import_export_uploads, :group_id)
- end
-end
diff --git a/db/migrate/20191111121500_default_ci_config_path.rb b/db/migrate/20191111121500_default_ci_config_path.rb
deleted file mode 100644
index 3914058d35b..00000000000
--- a/db/migrate/20191111121500_default_ci_config_path.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class DefaultCiConfigPath < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def up
- add_column :application_settings, :default_ci_config_path, :string, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
-
- def down
- remove_column :application_settings, :default_ci_config_path
- end
-end
diff --git a/db/migrate/20191111165017_add_fixed_pipeline_to_notification_settings.rb b/db/migrate/20191111165017_add_fixed_pipeline_to_notification_settings.rb
deleted file mode 100644
index 7a857807468..00000000000
--- a/db/migrate/20191111165017_add_fixed_pipeline_to_notification_settings.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddFixedPipelineToNotificationSettings < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :notification_settings, :fixed_pipeline, :boolean
- end
-end
diff --git a/db/migrate/20191111175230_add_index_on_ci_pipelines_updated_at.rb b/db/migrate/20191111175230_add_index_on_ci_pipelines_updated_at.rb
deleted file mode 100644
index 566bb16ac65..00000000000
--- a/db/migrate/20191111175230_add_index_on_ci_pipelines_updated_at.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnCiPipelinesUpdatedAt < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_COLUMNS = [:project_id, :status, :updated_at]
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:ci_pipelines, INDEX_COLUMNS)
- end
-
- def down
- remove_concurrent_index(:ci_pipelines, INDEX_COLUMNS)
- end
-end
diff --git a/db/migrate/20191112090226_add_artifacts_to_ci_build_need.rb b/db/migrate/20191112090226_add_artifacts_to_ci_build_need.rb
deleted file mode 100644
index b868e0b44a8..00000000000
--- a/db/migrate/20191112090226_add_artifacts_to_ci_build_need.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class AddArtifactsToCiBuildNeed < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:ci_build_needs, :artifacts, # rubocop:disable Migration/AddColumnWithDefault
- :boolean,
- default: true,
- allow_null: false)
- end
-
- def down
- remove_column(:ci_build_needs, :artifacts)
- end
-end
diff --git a/db/migrate/20191112105448_add_index_on_personal_access_tokens_user_id_and_expires_at.rb b/db/migrate/20191112105448_add_index_on_personal_access_tokens_user_id_and_expires_at.rb
deleted file mode 100644
index 1c1dc31ff23..00000000000
--- a/db/migrate/20191112105448_add_index_on_personal_access_tokens_user_id_and_expires_at.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnPersonalAccessTokensUserIdAndExpiresAt < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_pat_on_user_id_and_expires_at'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :personal_access_tokens, [:user_id, :expires_at], name: INDEX_NAME, using: :btree
- end
-
- def down
- remove_concurrent_index_by_name :personal_access_tokens, INDEX_NAME
- end
-end
diff --git a/db/migrate/20191112115247_add_cached_markdown_version_to_vulnerabilities.rb b/db/migrate/20191112115247_add_cached_markdown_version_to_vulnerabilities.rb
deleted file mode 100644
index b0c513737e8..00000000000
--- a/db/migrate/20191112115247_add_cached_markdown_version_to_vulnerabilities.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddCachedMarkdownVersionToVulnerabilities < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :vulnerabilities, :cached_markdown_version, :integer
- end
-end
diff --git a/db/migrate/20191112212815_create_web_authn_table.rb b/db/migrate/20191112212815_create_web_authn_table.rb
deleted file mode 100644
index 72895f955df..00000000000
--- a/db/migrate/20191112212815_create_web_authn_table.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class CreateWebAuthnTable < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # disable_ddl_transaction!
-
- # rubocop:disable Migration/AddLimitToTextColumns
- # limits are added in subsequent migration
- def change
- create_table :webauthn_registrations do |t|
- t.bigint :user_id, null: false, index: true
-
- t.bigint :counter, default: 0, null: false
- t.timestamps_with_timezone
- t.text :credential_xid, null: false, index: { unique: true }
- t.text :name, null: false
- # The length of the public key is determined by the device
- # and not specified. Thus we can't set a limit
- t.text :public_key, null: false # rubocop:disable Migration/AddLimitToTextColumns
- end
- end
- # rubocop:enable Migration/AddLimitToTextColumns
-end
diff --git a/db/migrate/20191112214305_add_indexes_for_projects_api_default_params.rb b/db/migrate/20191112214305_add_indexes_for_projects_api_default_params.rb
deleted file mode 100644
index 3893c0422c7..00000000000
--- a/db/migrate/20191112214305_add_indexes_for_projects_api_default_params.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexesForProjectsApiDefaultParams < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :projects, %i(visibility_level created_at id)
- remove_concurrent_index_by_name :projects, 'index_projects_on_visibility_level'
- end
-
- def down
- add_concurrent_index :projects, :visibility_level
- remove_concurrent_index :projects, %i(visibility_level created_at id)
- end
-end
diff --git a/db/migrate/20191112221821_add_indexes_for_projects_api_default_params_authenticated.rb b/db/migrate/20191112221821_add_indexes_for_projects_api_default_params_authenticated.rb
deleted file mode 100644
index 6ebc6a72854..00000000000
--- a/db/migrate/20191112221821_add_indexes_for_projects_api_default_params_authenticated.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexesForProjectsApiDefaultParamsAuthenticated < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :projects, %i(created_at id)
- remove_concurrent_index_by_name :projects, 'index_projects_on_created_at'
- end
-
- def down
- add_concurrent_index :projects, :created_at
- remove_concurrent_index_by_name :projects, 'index_projects_on_created_at_and_id'
- end
-end
diff --git a/db/migrate/20191112232338_ensure_no_empty_milestone_titles.rb b/db/migrate/20191112232338_ensure_no_empty_milestone_titles.rb
deleted file mode 100644
index 76cb511424e..00000000000
--- a/db/migrate/20191112232338_ensure_no_empty_milestone_titles.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class EnsureNoEmptyMilestoneTitles < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- loop do
- rows_updated = exec_update <<~SQL
- UPDATE milestones SET title = '%BLANK' WHERE id IN (SELECT id FROM milestones WHERE title = '' LIMIT 500)
- SQL
- break if rows_updated < 500
- end
- end
-
- def down; end
-end
diff --git a/db/migrate/20191114132259_add_mentions_disabled_to_namespaces.rb b/db/migrate/20191114132259_add_mentions_disabled_to_namespaces.rb
deleted file mode 100644
index a67d032795d..00000000000
--- a/db/migrate/20191114132259_add_mentions_disabled_to_namespaces.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddMentionsDisabledToNamespaces < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :namespaces, :mentions_disabled, :boolean # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20191114173508_add_resolved_attributes_to_vulnerabilities.rb b/db/migrate/20191114173508_add_resolved_attributes_to_vulnerabilities.rb
deleted file mode 100644
index ec45a729ebb..00000000000
--- a/db/migrate/20191114173508_add_resolved_attributes_to_vulnerabilities.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddResolvedAttributesToVulnerabilities < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def up
- add_column :vulnerabilities, :resolved_by_id, :bigint
- add_column :vulnerabilities, :resolved_at, :datetime_with_timezone
- end
-
- def down
- remove_column :vulnerabilities, :resolved_at
- remove_column :vulnerabilities, :resolved_by_id
- end
-end
diff --git a/db/migrate/20191114173602_add_foreign_key_on_resolved_by_id_to_vulnerabilities.rb b/db/migrate/20191114173602_add_foreign_key_on_resolved_by_id_to_vulnerabilities.rb
deleted file mode 100644
index e0a125ca756..00000000000
--- a/db/migrate/20191114173602_add_foreign_key_on_resolved_by_id_to_vulnerabilities.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddForeignKeyOnResolvedByIdToVulnerabilities < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :vulnerabilities, :resolved_by_id
- add_concurrent_foreign_key :vulnerabilities, :users, column: :resolved_by_id, on_delete: :nullify
- end
-
- def down
- remove_foreign_key :vulnerabilities, column: :resolved_by_id
- remove_concurrent_index :vulnerabilities, :resolved_by_id
- end
-end
diff --git a/db/migrate/20191114201118_make_created_at_not_null_in_design_management_versions.rb b/db/migrate/20191114201118_make_created_at_not_null_in_design_management_versions.rb
deleted file mode 100644
index 7b9d70c1a50..00000000000
--- a/db/migrate/20191114201118_make_created_at_not_null_in_design_management_versions.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class MakeCreatedAtNotNullInDesignManagementVersions < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- change_column_null :design_management_versions, :created_at, false, Time.now.to_s(:db)
- end
-
- def down
- change_column_null :design_management_versions, :created_at, true
- end
-end
diff --git a/db/migrate/20191115001123_add_index_to_mod_sec_ci_variables.rb b/db/migrate/20191115001123_add_index_to_mod_sec_ci_variables.rb
deleted file mode 100644
index 169ecf5ea41..00000000000
--- a/db/migrate/20191115001123_add_index_to_mod_sec_ci_variables.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToModSecCiVariables < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_variables, :project_id, where: "key = 'AUTO_DEVOPS_MODSECURITY_SEC_RULE_ENGINE'"
- end
-
- def down
- remove_concurrent_index :ci_variables, :project_id
- end
-end
diff --git a/db/migrate/20191115001843_add_index_to_mod_sec_ci_pipeline_variables.rb b/db/migrate/20191115001843_add_index_to_mod_sec_ci_pipeline_variables.rb
deleted file mode 100644
index 6b13f565a11..00000000000
--- a/db/migrate/20191115001843_add_index_to_mod_sec_ci_pipeline_variables.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToModSecCiPipelineVariables < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_pipeline_variables, :pipeline_id, where: "key = 'AUTO_DEVOPS_MODSECURITY_SEC_RULE_ENGINE'"
- end
-
- def down
- remove_concurrent_index :ci_pipeline_variables, :pipeline_id
- end
-end
diff --git a/db/migrate/20191115091425_create_vulnerability_issue_links.rb b/db/migrate/20191115091425_create_vulnerability_issue_links.rb
deleted file mode 100644
index 8398b6357c4..00000000000
--- a/db/migrate/20191115091425_create_vulnerability_issue_links.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class CreateVulnerabilityIssueLinks < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :vulnerability_issue_links do |t|
- # index: false because idx_vulnerability_issue_links_on_vulnerability_id_and_issue_id refers the same column
- t.references :vulnerability, null: false, index: false, foreign_key: { on_delete: :cascade }
- # index: true is implied
- t.references :issue, null: false, foreign_key: { on_delete: :cascade }
- t.integer 'link_type', limit: 2, null: false, default: 1 # 'related'
- t.index %i[vulnerability_id issue_id],
- name: 'idx_vulnerability_issue_links_on_vulnerability_id_and_issue_id',
- unique: true # only one link (and of only one type) is allowed
- t.index %i[vulnerability_id link_type],
- name: 'idx_vulnerability_issue_links_on_vulnerability_id_and_link_type',
- where: 'link_type = 2',
- unique: true # only one 'created' link per vulnerability is allowed
- t.timestamps_with_timezone
- end
- end
-end
diff --git a/db/migrate/20191115114032_add_processed_to_ci_builds.rb b/db/migrate/20191115114032_add_processed_to_ci_builds.rb
deleted file mode 100644
index 6fece99cb02..00000000000
--- a/db/migrate/20191115114032_add_processed_to_ci_builds.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddProcessedToCiBuilds < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :ci_builds, :processed, :boolean # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20191118053631_add_group_deletion_schedules.rb b/db/migrate/20191118053631_add_group_deletion_schedules.rb
deleted file mode 100644
index 6f3ed27e156..00000000000
--- a/db/migrate/20191118053631_add_group_deletion_schedules.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-class AddGroupDeletionSchedules < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def up
- create_table :group_deletion_schedules, id: false do |t|
- t.references :group,
- foreign_key: { on_delete: :cascade, to_table: :namespaces },
- default: nil,
- index: false,
- primary_key: true
-
- t.references :user,
- index: true,
- foreign_key: { on_delete: :nullify },
- null: false
-
- t.date :marked_for_deletion_on,
- index: true,
- null: false
- end
- end
-
- def down
- drop_table :group_deletion_schedules
- end
-end
diff --git a/db/migrate/20191118155702_add_index_on_status_to_merge_trains.rb b/db/migrate/20191118155702_add_index_on_status_to_merge_trains.rb
deleted file mode 100644
index 9b5238045f8..00000000000
--- a/db/migrate/20191118155702_add_index_on_status_to_merge_trains.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnStatusToMergeTrains < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_for_status_per_branch_per_project'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :merge_trains, [:target_project_id, :target_branch, :status], name: INDEX_NAME
- remove_concurrent_index :merge_trains, :target_project_id
- end
-
- def down
- add_concurrent_index :merge_trains, :target_project_id
- remove_concurrent_index :merge_trains, [:target_project_id, :target_branch, :status], name: INDEX_NAME
- end
-end
diff --git a/db/migrate/20191118173522_add_snippet_size_limit_to_application_settings.rb b/db/migrate/20191118173522_add_snippet_size_limit_to_application_settings.rb
deleted file mode 100644
index b6b30febbd6..00000000000
--- a/db/migrate/20191118173522_add_snippet_size_limit_to_application_settings.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddSnippetSizeLimitToApplicationSettings < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def up
- add_column :application_settings, :snippet_size_limit, :bigint, default: 50.megabytes, null: false
- end
-
- def down
- remove_column :application_settings, :snippet_size_limit
- end
-end
diff --git a/db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb b/db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb
deleted file mode 100644
index 01272dfad44..00000000000
--- a/db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToEnvironmentsOnProjectIdStateEnvironmentType < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- OLD_INDEX_NAME = 'index_environments_on_project_id_and_state'
- NEW_INDEX_NAME = 'index_environments_on_project_id_state_environment_type'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:environments, [:project_id, :state, :environment_type], name: NEW_INDEX_NAME)
- remove_concurrent_index_by_name(:environments, OLD_INDEX_NAME)
- end
-
- def down
- add_concurrent_index(:environments, [:project_id, :state], name: OLD_INDEX_NAME)
- remove_concurrent_index_by_name(:environments, NEW_INDEX_NAME)
- end
-end
diff --git a/db/migrate/20191119023952_add_created_at_index_to_snippets.rb b/db/migrate/20191119023952_add_created_at_index_to_snippets.rb
deleted file mode 100644
index 226af5f9e6d..00000000000
--- a/db/migrate/20191119023952_add_created_at_index_to_snippets.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddCreatedAtIndexToSnippets < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :snippets, :created_at
- end
-
- def down
- remove_concurrent_index :snippets, :created_at
- end
-end
diff --git a/db/migrate/20191119220425_rename_software_license_policies_approval_status_to_classification.rb b/db/migrate/20191119220425_rename_software_license_policies_approval_status_to_classification.rb
deleted file mode 100644
index 98c14f42558..00000000000
--- a/db/migrate/20191119220425_rename_software_license_policies_approval_status_to_classification.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class RenameSoftwareLicensePoliciesApprovalStatusToClassification < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- rename_column_concurrently :software_license_policies, :approval_status, :classification
- end
-
- def down
- undo_rename_column_concurrently :software_license_policies, :approval_status, :classification
- end
-end
diff --git a/db/migrate/20191119231621_create_container_expiration_policies.rb b/db/migrate/20191119231621_create_container_expiration_policies.rb
deleted file mode 100644
index d06ae659f41..00000000000
--- a/db/migrate/20191119231621_create_container_expiration_policies.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class CreateContainerExpirationPolicies < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :container_expiration_policies, id: false, primary_key: :project_id do |t|
- t.timestamps_with_timezone null: false
- t.datetime_with_timezone :next_run_at
- t.references :project, primary_key: true, default: nil, index: false, foreign_key: { on_delete: :cascade }
- t.string :name_regex, limit: 255
- t.string :cadence, null: false, limit: 12, default: '7d'
- t.string :older_than, limit: 12
- t.integer :keep_n
- t.boolean :enabled, null: false, default: false
- end
-
- add_index :container_expiration_policies, [:next_run_at, :enabled],
- name: 'index_container_expiration_policies_on_next_run_at_and_enabled'
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191120084627_add_encrypted_fields_to_application_settings.rb b/db/migrate/20191120084627_add_encrypted_fields_to_application_settings.rb
deleted file mode 100644
index 7bb2d9c6301..00000000000
--- a/db/migrate/20191120084627_add_encrypted_fields_to_application_settings.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-# frozen_string_literal: true
-
-class AddEncryptedFieldsToApplicationSettings < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- PLAINTEXT_ATTRIBUTES = %w[
- akismet_api_key
- elasticsearch_aws_secret_access_key
- recaptcha_private_key
- recaptcha_site_key
- slack_app_secret
- slack_app_verification_token
- ].freeze
-
- # rubocop:disable Migration/PreventStrings
- # rubocop:disable Migration/AddLimitToTextColumns
- def up
- PLAINTEXT_ATTRIBUTES.each do |plaintext_attribute|
- add_column :application_settings, "encrypted_#{plaintext_attribute}", :text
- add_column :application_settings, "encrypted_#{plaintext_attribute}_iv", :string, limit: 255
- end
- end
- # rubocop:enable Migration/AddLimitToTextColumns
- # rubocop:enable Migration/PreventStrings
-
- def down
- PLAINTEXT_ATTRIBUTES.each do |plaintext_attribute|
- remove_column :application_settings, "encrypted_#{plaintext_attribute}"
- remove_column :application_settings, "encrypted_#{plaintext_attribute}_iv"
- end
- end
-end
diff --git a/db/migrate/20191120115530_encrypt_plaintext_attributes_on_application_settings.rb b/db/migrate/20191120115530_encrypt_plaintext_attributes_on_application_settings.rb
deleted file mode 100644
index 3ae5e3265e8..00000000000
--- a/db/migrate/20191120115530_encrypt_plaintext_attributes_on_application_settings.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-# frozen_string_literal: true
-
-class EncryptPlaintextAttributesOnApplicationSettings < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- PLAINTEXT_ATTRIBUTES = %w[
- akismet_api_key
- elasticsearch_aws_secret_access_key
- recaptcha_private_key
- recaptcha_site_key
- slack_app_secret
- slack_app_verification_token
- ].freeze
-
- class ApplicationSetting < ActiveRecord::Base
- self.table_name = 'application_settings'
-
- def self.encryption_options_base_32_aes_256_gcm
- {
- mode: :per_attribute_iv,
- key: Gitlab::Utils.ensure_utf8_size(Rails.application.secrets.db_key_base, bytes: 32.bytes),
- algorithm: 'aes-256-gcm',
- encode: true
- }
- end
-
- attr_encrypted :akismet_api_key, encryption_options_base_32_aes_256_gcm
- attr_encrypted :elasticsearch_aws_secret_access_key, encryption_options_base_32_aes_256_gcm
- attr_encrypted :recaptcha_private_key, encryption_options_base_32_aes_256_gcm
- attr_encrypted :recaptcha_site_key, encryption_options_base_32_aes_256_gcm
- attr_encrypted :slack_app_secret, encryption_options_base_32_aes_256_gcm
- attr_encrypted :slack_app_verification_token, encryption_options_base_32_aes_256_gcm
-
- def akismet_api_key
- decrypt(:akismet_api_key, self[:encrypted_akismet_api_key]) || self[:akismet_api_key]
- end
-
- def elasticsearch_aws_secret_access_key
- decrypt(:elasticsearch_aws_secret_access_key, self[:encrypted_elasticsearch_aws_secret_access_key]) || self[:elasticsearch_aws_secret_access_key]
- end
-
- def recaptcha_private_key
- decrypt(:recaptcha_private_key, self[:encrypted_recaptcha_private_key]) || self[:recaptcha_private_key]
- end
-
- def recaptcha_site_key
- decrypt(:recaptcha_site_key, self[:encrypted_recaptcha_site_key]) || self[:recaptcha_site_key]
- end
-
- def slack_app_secret
- decrypt(:slack_app_secret, self[:encrypted_slack_app_secret]) || self[:slack_app_secret]
- end
-
- def slack_app_verification_token
- decrypt(:slack_app_verification_token, self[:encrypted_slack_app_verification_token]) || self[:slack_app_verification_token]
- end
- end
-
- def up
- ApplicationSetting.find_each do |application_setting|
- # We are using the setter from attr_encrypted gem to encrypt the data.
- # The gem updates the two columns needed to decrypt the value:
- # - "encrypted_#{plaintext_attribute}"
- # - "encrypted_#{plaintext_attribute}_iv"
- application_setting.assign_attributes(
- PLAINTEXT_ATTRIBUTES.each_with_object({}) do |plaintext_attribute, attributes|
- attributes[plaintext_attribute] = application_setting.send(plaintext_attribute)
- end
- )
- application_setting.save(validate: false)
- end
- end
-
- def down
- ApplicationSetting.find_each do |application_setting|
- application_setting.update_columns(
- PLAINTEXT_ATTRIBUTES.each_with_object({}) do |plaintext_attribute, attributes|
- attributes[plaintext_attribute] = application_setting.send(plaintext_attribute)
- attributes["encrypted_#{plaintext_attribute}"] = nil
- attributes["encrypted_#{plaintext_attribute}_iv"] = nil
- end
- )
- end
- end
-end
diff --git a/db/migrate/20191120200015_add_index_to_grafana_integrations.rb b/db/migrate/20191120200015_add_index_to_grafana_integrations.rb
deleted file mode 100644
index c67f6850baf..00000000000
--- a/db/migrate/20191120200015_add_index_to_grafana_integrations.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToGrafanaIntegrations < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :grafana_integrations, :enabled, where: 'enabled IS TRUE'
- end
-
- def down
- remove_concurrent_index :grafana_integrations, :enabled
- end
-end
diff --git a/db/migrate/20191121111621_create_packages_dependencies.rb b/db/migrate/20191121111621_create_packages_dependencies.rb
deleted file mode 100644
index 29a8434514e..00000000000
--- a/db/migrate/20191121111621_create_packages_dependencies.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class CreatePackagesDependencies < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :packages_dependencies do |t|
- t.string :name, null: false, limit: 255
- t.string :version_pattern, null: false, limit: 255
- end
-
- add_index :packages_dependencies, [:name, :version_pattern], unique: true
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191121121947_create_packages_dependency_links.rb b/db/migrate/20191121121947_create_packages_dependency_links.rb
deleted file mode 100644
index 0907ed8f16c..00000000000
--- a/db/migrate/20191121121947_create_packages_dependency_links.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class CreatePackagesDependencyLinks < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :packages_dependency_links do |t|
- t.references :package, index: false, null: false, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :bigint
- t.references :dependency, null: false, foreign_key: { to_table: :packages_dependencies, on_delete: :cascade }, type: :bigint
- t.integer :dependency_type, limit: 2, null: false
- end
-
- add_index :packages_dependency_links, [:package_id, :dependency_id, :dependency_type], unique: true, name: 'idx_pkgs_dep_links_on_pkg_id_dependency_id_dependency_type'
- end
-end
diff --git a/db/migrate/20191121161018_add_project_id_name_version_package_type_index_to_packages_packages.rb b/db/migrate/20191121161018_add_project_id_name_version_package_type_index_to_packages_packages.rb
deleted file mode 100644
index 4a34b9e791e..00000000000
--- a/db/migrate/20191121161018_add_project_id_name_version_package_type_index_to_packages_packages.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectIdNameVersionPackageTypeIndexToPackagesPackages < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'idx_packages_packages_on_project_id_name_version_package_type'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :packages_packages,
- [:project_id, :name, :version, :package_type],
- name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index :packages_packages,
- [:project_id, :name, :version, :package_type],
- name: INDEX_NAME
- end
-end
diff --git a/db/migrate/20191121193110_add_issue_links_type.rb b/db/migrate/20191121193110_add_issue_links_type.rb
deleted file mode 100644
index 86bfd41b916..00000000000
--- a/db/migrate/20191121193110_add_issue_links_type.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIssueLinksType < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :issue_links, :link_type, :integer, default: 0, limit: 2 # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :issue_links, :link_type
- end
-end
diff --git a/db/migrate/20191122161519_create_sentry_issues_table.rb b/db/migrate/20191122161519_create_sentry_issues_table.rb
deleted file mode 100644
index 753286b6025..00000000000
--- a/db/migrate/20191122161519_create_sentry_issues_table.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class CreateSentryIssuesTable < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :sentry_issues do |t|
- t.references :issue,
- foreign_key: { on_delete: :cascade },
- index: { unique: true },
- null: false
- t.bigint :sentry_issue_identifier, null: false
- end
- end
-end
diff --git a/db/migrate/20191123062354_add_minimum_password_length_to_application_settings.rb b/db/migrate/20191123062354_add_minimum_password_length_to_application_settings.rb
deleted file mode 100644
index 0a7ad9d81a9..00000000000
--- a/db/migrate/20191123062354_add_minimum_password_length_to_application_settings.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddMinimumPasswordLengthToApplicationSettings < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- DEFAULT_MINIMUM_PASSWORD_LENGTH = 8
-
- def change
- add_column(:application_settings, :minimum_password_length, :integer, default: DEFAULT_MINIMUM_PASSWORD_LENGTH, null: false)
- end
-end
diff --git a/db/migrate/20191123081456_add_dismissable_to_broadcast_messages.rb b/db/migrate/20191123081456_add_dismissable_to_broadcast_messages.rb
deleted file mode 100644
index 40235771d80..00000000000
--- a/db/migrate/20191123081456_add_dismissable_to_broadcast_messages.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddDismissableToBroadcastMessages < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :broadcast_messages, :dismissable, :boolean
- end
-end
diff --git a/db/migrate/20191124150431_change_label_id_index_to_include_action_on_label_events.rb b/db/migrate/20191124150431_change_label_id_index_to_include_action_on_label_events.rb
deleted file mode 100644
index bd138adc5fa..00000000000
--- a/db/migrate/20191124150431_change_label_id_index_to_include_action_on_label_events.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeLabelIdIndexToIncludeActionOnLabelEvents < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:resource_label_events, %I[label_id action])
-
- remove_concurrent_index(:resource_label_events, :label_id)
- end
-
- def down
- add_concurrent_index(:resource_label_events, :label_id)
-
- remove_concurrent_index(:resource_label_events, %I[label_id action])
- end
-end
diff --git a/db/migrate/20191125114345_add_admin_mode_protected_path.rb b/db/migrate/20191125114345_add_admin_mode_protected_path.rb
deleted file mode 100644
index 7e9b0d5a285..00000000000
--- a/db/migrate/20191125114345_add_admin_mode_protected_path.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-# frozen_string_literal: true
-
-class AddAdminModeProtectedPath < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- ADMIN_MODE_ENDPOINT = '/admin/session'
-
- OLD_DEFAULT_PROTECTED_PATHS = [
- '/users/password',
- '/users/sign_in',
- '/api/v3/session.json',
- '/api/v3/session',
- '/api/v4/session.json',
- '/api/v4/session',
- '/users',
- '/users/confirmation',
- '/unsubscribes/',
- '/import/github/personal_access_token'
- ]
-
- NEW_DEFAULT_PROTECTED_PATHS = OLD_DEFAULT_PROTECTED_PATHS.dup << ADMIN_MODE_ENDPOINT
-
- class ApplicationSetting < ActiveRecord::Base
- self.table_name = 'application_settings'
- end
-
- def up
- change_column_default :application_settings, :protected_paths, NEW_DEFAULT_PROTECTED_PATHS
-
- # schema allows nulls for protected_paths
- ApplicationSetting.where.not(protected_paths: nil).each do |application_setting|
- unless application_setting.protected_paths.include?(ADMIN_MODE_ENDPOINT)
- updated_protected_paths = application_setting.protected_paths << ADMIN_MODE_ENDPOINT
-
- application_setting.update(protected_paths: updated_protected_paths)
- end
- end
- end
-
- def down
- change_column_default :application_settings, :protected_paths, OLD_DEFAULT_PROTECTED_PATHS
-
- # schema allows nulls for protected_paths
- ApplicationSetting.where.not(protected_paths: nil).each do |application_setting|
- if application_setting.protected_paths.include?(ADMIN_MODE_ENDPOINT)
- updated_protected_paths = application_setting.protected_paths - [ADMIN_MODE_ENDPOINT]
-
- application_setting.update(protected_paths: updated_protected_paths)
- end
- end
- end
-end
diff --git a/db/migrate/20191125133353_add_target_path_to_broadcast_message.rb b/db/migrate/20191125133353_add_target_path_to_broadcast_message.rb
deleted file mode 100644
index 8597cce5b19..00000000000
--- a/db/migrate/20191125133353_add_target_path_to_broadcast_message.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddTargetPathToBroadcastMessage < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :broadcast_messages, :target_path, :string, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191125140458_create_import_failures.rb b/db/migrate/20191125140458_create_import_failures.rb
deleted file mode 100644
index e5dbcf5d41d..00000000000
--- a/db/migrate/20191125140458_create_import_failures.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class CreateImportFailures < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :import_failures do |t|
- t.integer :relation_index
- t.references :project, null: false, index: true
- t.datetime_with_timezone :created_at, null: false
- t.string :relation_key, limit: 64
- t.string :exception_class, limit: 128
- t.string :correlation_id_value, limit: 128, index: true
- t.string :exception_message, limit: 255
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191126134210_rename_packages_package_tags.rb b/db/migrate/20191126134210_rename_packages_package_tags.rb
deleted file mode 100644
index 75cb53802ab..00000000000
--- a/db/migrate/20191126134210_rename_packages_package_tags.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class RenamePackagesPackageTags < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- rename_table(:packages_package_tags, :packages_tags)
- end
-end
diff --git a/db/migrate/20191127030005_create_serverless_domain_cluster.rb b/db/migrate/20191127030005_create_serverless_domain_cluster.rb
deleted file mode 100644
index c65301bf133..00000000000
--- a/db/migrate/20191127030005_create_serverless_domain_cluster.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class CreateServerlessDomainCluster < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :serverless_domain_cluster, id: false, primary_key: :uuid do |t|
- t.references :pages_domain, null: false, foreign_key: { on_delete: :cascade }
- t.references :clusters_applications_knative, null: false,
- foreign_key: { to_table: :clusters_applications_knative, on_delete: :cascade },
- index: { name: :idx_serverless_domain_cluster_on_clusters_applications_knative, unique: true }
- t.references :creator, name: :created_by, foreign_key: { to_table: :users, on_delete: :nullify }
- t.timestamps_with_timezone null: false
- t.string :uuid, null: false, limit: 14, primary_key: true
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191127151619_create_gitlab_subscription_histories.rb b/db/migrate/20191127151619_create_gitlab_subscription_histories.rb
deleted file mode 100644
index 718f2c1b313..00000000000
--- a/db/migrate/20191127151619_create_gitlab_subscription_histories.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# frozen_string_literal: true
-
-class CreateGitlabSubscriptionHistories < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def up
- create_table :gitlab_subscription_histories do |t|
- t.datetime_with_timezone :gitlab_subscription_created_at
- t.datetime_with_timezone :gitlab_subscription_updated_at
- t.date :start_date
- t.date :end_date
- t.date :trial_ends_on
- t.integer :namespace_id, null: true
- t.integer :hosted_plan_id, null: true
- t.integer :max_seats_used
- t.integer :seats
- t.boolean :trial
- t.integer :change_type, limit: 2
- t.bigint :gitlab_subscription_id, null: false
- t.datetime_with_timezone :created_at
- end
- add_index :gitlab_subscription_histories, :gitlab_subscription_id
- end
-
- def down
- drop_table :gitlab_subscription_histories
- end
-end
diff --git a/db/migrate/20191127151629_add_trial_starts_on_to_gitlab_subscriptions.rb b/db/migrate/20191127151629_add_trial_starts_on_to_gitlab_subscriptions.rb
deleted file mode 100644
index 2528aa9c2c8..00000000000
--- a/db/migrate/20191127151629_add_trial_starts_on_to_gitlab_subscriptions.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-class AddTrialStartsOnToGitlabSubscriptions < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :gitlab_subscriptions, :trial_starts_on, :date, null: true
- add_column :gitlab_subscription_histories, :trial_starts_on, :date, null: true
- end
-end
diff --git a/db/migrate/20191127163053_add_confidential_to_doorkeeper_application.rb b/db/migrate/20191127163053_add_confidential_to_doorkeeper_application.rb
deleted file mode 100644
index 12e22b4744c..00000000000
--- a/db/migrate/20191127163053_add_confidential_to_doorkeeper_application.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class AddConfidentialToDoorkeeperApplication < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault
- :oauth_applications,
- :confidential,
- :boolean,
- default: false, # assume all existing applications are non-confidential
- allow_null: false
- )
-
- # set the default to true so that all future applications are confidential by default
- change_column_default(:oauth_applications, :confidential, true)
- end
-
- def down
- remove_column :oauth_applications, :confidential
- end
-end
diff --git a/db/migrate/20191127221608_add_wildcard_and_domain_type_to_pages_domains.rb b/db/migrate/20191127221608_add_wildcard_and_domain_type_to_pages_domains.rb
deleted file mode 100644
index 96a2e8275c6..00000000000
--- a/db/migrate/20191127221608_add_wildcard_and_domain_type_to_pages_domains.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class AddWildcardAndDomainTypeToPagesDomains < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- PROJECT_TYPE = 2
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :pages_domains, :wildcard, :boolean, default: false # rubocop:disable Migration/AddColumnWithDefault
- add_column_with_default :pages_domains, :domain_type, :integer, limit: 2, default: PROJECT_TYPE # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :pages_domains, :wildcard
- remove_column :pages_domains, :domain_type
- end
-end
diff --git a/db/migrate/20191128145231_add_ci_resource_groups.rb b/db/migrate/20191128145231_add_ci_resource_groups.rb
deleted file mode 100644
index 77975120f72..00000000000
--- a/db/migrate/20191128145231_add_ci_resource_groups.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class AddCiResourceGroups < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :ci_resource_groups do |t|
- t.timestamps_with_timezone
- t.bigint :project_id, null: false
- t.string :key, null: false, limit: 255 # rubocop:disable Migration/PreventStrings
- t.index %i[project_id key], unique: true
- end
-
- create_table :ci_resources do |t|
- t.timestamps_with_timezone
- t.references :resource_group, null: false, index: false, foreign_key: { to_table: :ci_resource_groups, on_delete: :cascade }
- t.bigint :build_id, null: true
- t.index %i[build_id]
- t.index %i[resource_group_id build_id], unique: true
- end
- end
-end
diff --git a/db/migrate/20191128145232_add_fk_to_ci_resources_build_id.rb b/db/migrate/20191128145232_add_fk_to_ci_resources_build_id.rb
deleted file mode 100644
index a13513de3b2..00000000000
--- a/db/migrate/20191128145232_add_fk_to_ci_resources_build_id.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddFkToCiResourcesBuildId < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :ci_resources, :ci_builds, column: :build_id, on_delete: :nullify
- end
-
- def down
- remove_foreign_key_if_exists :ci_resources, column: :build_id
- end
-end
diff --git a/db/migrate/20191128145233_add_fk_to_ci_resource_groups_project_id.rb b/db/migrate/20191128145233_add_fk_to_ci_resource_groups_project_id.rb
deleted file mode 100644
index bb23012ea9b..00000000000
--- a/db/migrate/20191128145233_add_fk_to_ci_resource_groups_project_id.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddFkToCiResourceGroupsProjectId < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :ci_resource_groups, :projects, column: :project_id, on_delete: :cascade
- end
-
- def down
- remove_foreign_key_if_exists :ci_resource_groups, column: :project_id
- end
-end
diff --git a/db/migrate/20191129134844_add_broadcast_type_to_broadcast_message.rb b/db/migrate/20191129134844_add_broadcast_type_to_broadcast_message.rb
deleted file mode 100644
index 884d9ac6d7f..00000000000
--- a/db/migrate/20191129134844_add_broadcast_type_to_broadcast_message.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddBroadcastTypeToBroadcastMessage < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
- BROADCAST_MESSAGE_BANNER_TYPE = 1
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:broadcast_messages, :broadcast_type, :smallint, default: BROADCAST_MESSAGE_BANNER_TYPE) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:broadcast_messages, :broadcast_type)
- end
-end
diff --git a/db/migrate/20191129144630_add_resource_group_id_to_ci_builds.rb b/db/migrate/20191129144630_add_resource_group_id_to_ci_builds.rb
deleted file mode 100644
index 245df7fdcf3..00000000000
--- a/db/migrate/20191129144630_add_resource_group_id_to_ci_builds.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class AddResourceGroupIdToCiBuilds < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/AddColumnsToWideTables
- def up
- unless column_exists?(:ci_builds, :resource_group_id)
- add_column :ci_builds, :resource_group_id, :bigint
- end
-
- unless column_exists?(:ci_builds, :waiting_for_resource_at)
- add_column :ci_builds, :waiting_for_resource_at, :datetime_with_timezone
- end
- end
- # rubocop:enable Migration/AddColumnsToWideTables
-
- def down
- if column_exists?(:ci_builds, :resource_group_id)
- remove_column :ci_builds, :resource_group_id, :bigint
- end
-
- if column_exists?(:ci_builds, :waiting_for_resource_at)
- remove_column :ci_builds, :waiting_for_resource_at, :datetime_with_timezone
- end
- end
-end
diff --git a/db/migrate/20191129144631_add_index_to_resource_group_id.rb b/db/migrate/20191129144631_add_index_to_resource_group_id.rb
deleted file mode 100644
index 01d56f417b5..00000000000
--- a/db/migrate/20191129144631_add_index_to_resource_group_id.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToResourceGroupId < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_for_resource_group'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_builds, %i[resource_group_id id], where: 'resource_group_id IS NOT NULL', name: INDEX_NAME
- add_concurrent_foreign_key :ci_builds, :ci_resource_groups, column: :resource_group_id, on_delete: :nullify
- end
-
- def down
- remove_foreign_key_if_exists :ci_builds, column: :resource_group_id
- remove_concurrent_index_by_name :ci_builds, INDEX_NAME
- end
-end
diff --git a/db/migrate/20191202181924_add_environment_auto_stop_in_to_ci_builds_metadata.rb b/db/migrate/20191202181924_add_environment_auto_stop_in_to_ci_builds_metadata.rb
deleted file mode 100644
index c09196da91b..00000000000
--- a/db/migrate/20191202181924_add_environment_auto_stop_in_to_ci_builds_metadata.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddEnvironmentAutoStopInToCiBuildsMetadata < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def up
- add_column :ci_builds_metadata, :environment_auto_stop_in, :string, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
-
- def down
- remove_column :ci_builds_metadata, :environment_auto_stop_in
- end
-end
diff --git a/db/migrate/20191203121729_update_group_deletion_schedules_foreign_keys.rb b/db/migrate/20191203121729_update_group_deletion_schedules_foreign_keys.rb
deleted file mode 100644
index 99531a1e93e..00000000000
--- a/db/migrate/20191203121729_update_group_deletion_schedules_foreign_keys.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class UpdateGroupDeletionSchedulesForeignKeys < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key(:group_deletion_schedules, :users, column: :user_id, on_delete: :cascade, name: new_foreign_key_name)
- remove_foreign_key_if_exists(:group_deletion_schedules, column: :user_id, on_delete: :nullify)
- end
-
- def down
- add_concurrent_foreign_key(:group_deletion_schedules, :users, column: :user_id, on_delete: :nullify, name: existing_foreign_key_name)
- remove_foreign_key_if_exists(:group_deletion_schedules, column: :user_id, on_delete: :cascade)
- end
-
- private
-
- def new_foreign_key_name
- concurrent_foreign_key_name(:group_deletion_schedules, :user_id)
- end
-
- def existing_foreign_key_name
- 'fk_group_deletion_schedules_users_user_id'
- end
-end
diff --git a/db/migrate/20191204070713_change_updated_at_index_and_add_index_to_id_on_deployments.rb b/db/migrate/20191204070713_change_updated_at_index_and_add_index_to_id_on_deployments.rb
deleted file mode 100644
index 450b276e689..00000000000
--- a/db/migrate/20191204070713_change_updated_at_index_and_add_index_to_id_on_deployments.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeUpdatedAtIndexAndAddIndexToIdOnDeployments < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- PROJECT_ID_INDEX_PARAMS = [[:project_id, :id], order: { id: :desc }]
- OLD_UPDATED_AT_INDEX_PARAMS = [[:project_id, :updated_at]]
- NEW_UPDATED_AT_INDEX_PARAMS = [[:project_id, :updated_at, :id], order: { updated_at: :desc, id: :desc }]
-
- def up
- add_concurrent_index :deployments, *NEW_UPDATED_AT_INDEX_PARAMS
-
- remove_concurrent_index :deployments, *OLD_UPDATED_AT_INDEX_PARAMS
-
- add_concurrent_index :deployments, *PROJECT_ID_INDEX_PARAMS
- end
-
- def down
- add_concurrent_index :deployments, *OLD_UPDATED_AT_INDEX_PARAMS
-
- remove_concurrent_index :deployments, *NEW_UPDATED_AT_INDEX_PARAMS
-
- remove_concurrent_index :deployments, *PROJECT_ID_INDEX_PARAMS
- end
-end
diff --git a/db/migrate/20191204093410_add_label_project_group_partial_indexes.rb b/db/migrate/20191204093410_add_label_project_group_partial_indexes.rb
deleted file mode 100644
index 85666144856..00000000000
--- a/db/migrate/20191204093410_add_label_project_group_partial_indexes.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddLabelProjectGroupPartialIndexes < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- PROJECT_AND_TITLE = [:project_id, :title]
- GROUP_AND_TITLE = [:group_id, :title]
-
- def up
- add_concurrent_index :labels, PROJECT_AND_TITLE, unique: false, where: "labels.group_id = null"
- add_concurrent_index :labels, GROUP_AND_TITLE, unique: false, where: "labels.project_id = null"
- end
-
- def down
- remove_concurrent_index :labels, PROJECT_AND_TITLE
- remove_concurrent_index :labels, GROUP_AND_TITLE
- end
-end
diff --git a/db/migrate/20191204192726_add_design_disk_path_to_geo_hashed_storage_migrated_events.rb b/db/migrate/20191204192726_add_design_disk_path_to_geo_hashed_storage_migrated_events.rb
deleted file mode 100644
index 8631502ded8..00000000000
--- a/db/migrate/20191204192726_add_design_disk_path_to_geo_hashed_storage_migrated_events.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class AddDesignDiskPathToGeoHashedStorageMigratedEvents < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- add_column :geo_hashed_storage_migrated_events, :old_design_disk_path, :text
- add_column :geo_hashed_storage_migrated_events, :new_design_disk_path, :text
- end
- # rubocop:enable Migration/AddLimitToTextColumns
-end
diff --git a/db/migrate/20191205060723_add_index_to_keys.rb b/db/migrate/20191205060723_add_index_to_keys.rb
deleted file mode 100644
index 8e8c725f62e..00000000000
--- a/db/migrate/20191205060723_add_index_to_keys.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToKeys < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :keys, :last_used_at, order: { last_used_at: 'DESC NULLS LAST' }
- end
-
- def down
- remove_concurrent_index :keys, :last_used_at
- end
-end
diff --git a/db/migrate/20191205094702_add_index_for_cross_projects_dependencies_to_ci_builds.rb b/db/migrate/20191205094702_add_index_for_cross_projects_dependencies_to_ci_builds.rb
deleted file mode 100644
index 023414fb4bb..00000000000
--- a/db/migrate/20191205094702_add_index_for_cross_projects_dependencies_to_ci_builds.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexForCrossProjectsDependenciesToCiBuilds < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_builds, [:project_id, :name, :ref],
- where: "type = 'Ci::Build' AND status = 'success' AND (retried = FALSE OR retried IS NULL)"
- end
-
- def down
- remove_concurrent_index :ci_builds, [:project_id, :name, :ref],
- where: "type = 'Ci::Build' AND status = 'success' AND (retried = FALSE OR retried IS NULL)"
- end
-end
diff --git a/db/migrate/20191205145647_add_index_to_projects_deploy_keys_deploy_key.rb b/db/migrate/20191205145647_add_index_to_projects_deploy_keys_deploy_key.rb
deleted file mode 100644
index f9cdc226e4d..00000000000
--- a/db/migrate/20191205145647_add_index_to_projects_deploy_keys_deploy_key.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToProjectsDeployKeysDeployKey < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- def up
- add_concurrent_index :deploy_keys_projects, :deploy_key_id
- end
-
- def down
- remove_concurrent_index :deploy_keys_projects, :deploy_key_id
- end
-end
diff --git a/db/migrate/20191205212923_support_multiple_milestones_for_issues.rb b/db/migrate/20191205212923_support_multiple_milestones_for_issues.rb
deleted file mode 100644
index e0edd76c4b9..00000000000
--- a/db/migrate/20191205212923_support_multiple_milestones_for_issues.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class SupportMultipleMilestonesForIssues < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :issue_milestones, id: false do |t|
- t.references :issue, foreign_key: { on_delete: :cascade }, index: { unique: true }, null: false
- t.references :milestone, foreign_key: { on_delete: :cascade }, index: true, null: false
- end
-
- add_index :issue_milestones, [:issue_id, :milestone_id], unique: true
- end
-end
diff --git a/db/migrate/20191205212924_support_multiple_milestones_for_merge_requests.rb b/db/migrate/20191205212924_support_multiple_milestones_for_merge_requests.rb
deleted file mode 100644
index 85ad1a748e9..00000000000
--- a/db/migrate/20191205212924_support_multiple_milestones_for_merge_requests.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class SupportMultipleMilestonesForMergeRequests < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :merge_request_milestones, id: false do |t|
- t.references :merge_request, foreign_key: { on_delete: :cascade }, index: { unique: true }, null: false
- t.references :milestone, foreign_key: { on_delete: :cascade }, index: true, null: false
- end
-
- add_index :merge_request_milestones, [:merge_request_id, :milestone_id], name: 'index_mrs_milestones_on_mr_id_and_milestone_id', unique: true
- end
-end
diff --git a/db/migrate/20191206014412_add_image_to_design_management_designs_versions.rb b/db/migrate/20191206014412_add_image_to_design_management_designs_versions.rb
deleted file mode 100644
index 54ef9b74f29..00000000000
--- a/db/migrate/20191206014412_add_image_to_design_management_designs_versions.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddImageToDesignManagementDesignsVersions < ActiveRecord::Migration[6.0]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :design_management_designs_versions, :image_v432x230, :string, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191206022133_add_indexes_to_pages_domains_on_wildcard_and_domain_type.rb b/db/migrate/20191206022133_add_indexes_to_pages_domains_on_wildcard_and_domain_type.rb
deleted file mode 100644
index 3c1704a3377..00000000000
--- a/db/migrate/20191206022133_add_indexes_to_pages_domains_on_wildcard_and_domain_type.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexesToPagesDomainsOnWildcardAndDomainType < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :pages_domains, :wildcard
- add_concurrent_index :pages_domains, :domain_type
- end
-
- def down
- remove_concurrent_index :pages_domains, :wildcard
- remove_concurrent_index :pages_domains, :domain_type
- end
-end
diff --git a/db/migrate/20191206122926_update_index_for_pool_repositories.rb b/db/migrate/20191206122926_update_index_for_pool_repositories.rb
deleted file mode 100644
index f88e8e94ee1..00000000000
--- a/db/migrate/20191206122926_update_index_for_pool_repositories.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class UpdateIndexForPoolRepositories < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- # This index is less restrictive then the one we already have, no need to
- # update data.
- add_concurrent_index :pool_repositories, [:source_project_id, :shard_id], unique: true
- remove_concurrent_index :pool_repositories, :source_project_id
- end
-
- def down
- # Not adding this index as a unique one, since while the new index existed
- # we could have created multiple pool repositories for a project. In that
- # case this rollback would fail.
- add_concurrent_index :pool_repositories, :source_project_id
- remove_concurrent_index :pool_repositories, [:source_project_id, :shard_id], unique: true
- end
-end
diff --git a/db/migrate/20191207104000_add_render_whitespace_in_code_to_user_preference.rb b/db/migrate/20191207104000_add_render_whitespace_in_code_to_user_preference.rb
deleted file mode 100644
index 83b44b98c67..00000000000
--- a/db/migrate/20191207104000_add_render_whitespace_in_code_to_user_preference.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddRenderWhitespaceInCodeToUserPreference < ActiveRecord::Migration[5.1]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column(:user_preferences, :render_whitespace_in_code, :boolean)
- end
-
- def down
- remove_column(:user_preferences, :render_whitespace_in_code)
- end
-end
diff --git a/db/migrate/20191208071111_add_fingerprint_sha256_to_key.rb b/db/migrate/20191208071111_add_fingerprint_sha256_to_key.rb
deleted file mode 100644
index 1bc87357f7d..00000000000
--- a/db/migrate/20191208071111_add_fingerprint_sha256_to_key.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddFingerprintSha256ToKey < ActiveRecord::Migration[5.0]
- DOWNTIME = false
-
- def up
- add_column(:keys, :fingerprint_sha256, :binary)
- end
-
- def down
- remove_column(:keys, :fingerprint_sha256) if column_exists?(:keys, :fingerprint_sha256)
- end
-end
diff --git a/db/migrate/20191208071112_add_fingerprint_sha256_index_to_key.rb b/db/migrate/20191208071112_add_fingerprint_sha256_index_to_key.rb
deleted file mode 100644
index 6f0c4bcd321..00000000000
--- a/db/migrate/20191208071112_add_fingerprint_sha256_index_to_key.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddFingerprintSha256IndexToKey < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:keys, "fingerprint_sha256")
- end
-
- def down
- remove_concurrent_index(:keys, "fingerprint_sha256")
- end
-end
diff --git a/db/migrate/20191208110214_add_suggestion_commit_message_to_projects.rb b/db/migrate/20191208110214_add_suggestion_commit_message_to_projects.rb
deleted file mode 100644
index 3c96a1737c2..00000000000
--- a/db/migrate/20191208110214_add_suggestion_commit_message_to_projects.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddSuggestionCommitMessageToProjects < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/AddColumnsToWideTables
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :projects, :suggestion_commit_message, :string, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
- # rubocop:enable Migration/AddColumnsToWideTables
-end
diff --git a/db/migrate/20191209143606_add_deleted_at_to_description_versions.rb b/db/migrate/20191209143606_add_deleted_at_to_description_versions.rb
deleted file mode 100644
index 02a3d1271c2..00000000000
--- a/db/migrate/20191209143606_add_deleted_at_to_description_versions.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddDeletedAtToDescriptionVersions < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :description_versions, :deleted_at, :datetime_with_timezone
- end
-end
diff --git a/db/migrate/20191210211253_create_resource_weight_event.rb b/db/migrate/20191210211253_create_resource_weight_event.rb
deleted file mode 100644
index b458c5f169f..00000000000
--- a/db/migrate/20191210211253_create_resource_weight_event.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class CreateResourceWeightEvent < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :resource_weight_events do |t|
- t.references :user, null: false, foreign_key: { on_delete: :nullify },
- index: { name: 'index_resource_weight_events_on_user_id' }
- t.references :issue, null: false, foreign_key: { on_delete: :cascade },
- index: false
- t.integer :weight
- t.datetime_with_timezone :created_at, null: false
-
- t.index [:issue_id, :weight], name: 'index_resource_weight_events_on_issue_id_and_weight'
- end
- end
-end
diff --git a/db/migrate/20191212140117_change_commit_user_mentions_commit_id_column_type.rb b/db/migrate/20191212140117_change_commit_user_mentions_commit_id_column_type.rb
deleted file mode 100644
index f205de3587e..00000000000
--- a/db/migrate/20191212140117_change_commit_user_mentions_commit_id_column_type.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeCommitUserMentionsCommitIdColumnType < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- OLD_INDEX = 'commit_user_mentions_on_commit_id_and_note_id_index'
- OLD_TMP_INDEX = 'temp_commit_id_and_note_id_index'
- NEW_TMP_INDEX = 'temp_commit_id_for_type_change_and_note_id_index'
- NEW_INDEX = 'commit_id_and_note_id_index'
-
- # rubocop:disable Migration/PreventStrings
- def up
- # the initial index name is too long and fails during migration. Renaming the index first.
- add_concurrent_index :commit_user_mentions, [:commit_id, :note_id], name: OLD_TMP_INDEX
- remove_concurrent_index_by_name :commit_user_mentions, OLD_INDEX
-
- change_column_type_concurrently :commit_user_mentions, :commit_id, :string
-
- # change_column_type_concurrently creates a new index for new column `commit_id_for_type` based on existing
- # `temp_commit_id_and_note_id_index` naming it `temp_commit_id_for_type_change_and_note_id_index`, yet keeping
- # `temp_commit_id_and_note_id_index` for `commit_id`, that will be cleaned
- # by `cleanup_concurrent_column_type_change :commit_user_mentions, :commit_id` in a later migration.
- #
- # So we'll rename `temp_commit_id_for_type_change_and_note_id_index` to initialy intended name: `commit_id_and_note_id_index`.
-
- add_concurrent_index :commit_user_mentions, [:commit_id_for_type_change, :note_id], name: NEW_INDEX
- remove_concurrent_index_by_name :commit_user_mentions, NEW_TMP_INDEX
- end
- # rubocop:enable Migration/PreventStrings
-
- def down
- cleanup_concurrent_column_type_change :commit_user_mentions, :commit_id
- end
-end
diff --git a/db/migrate/20191213104838_add_service_desk_username.rb b/db/migrate/20191213104838_add_service_desk_username.rb
deleted file mode 100644
index d50de4c362c..00000000000
--- a/db/migrate/20191213104838_add_service_desk_username.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddServiceDeskUsername < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :service_desk_settings, :outgoing_name, :string, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20191213120427_fix_max_pages_size.rb b/db/migrate/20191213120427_fix_max_pages_size.rb
deleted file mode 100644
index 498ea91b773..00000000000
--- a/db/migrate/20191213120427_fix_max_pages_size.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class FixMaxPagesSize < ActiveRecord::Migration[5.2]
- DOWNTIME = false
- MAX_SIZE = 1.terabyte / 1.megabyte
-
- class ApplicationSetting < ActiveRecord::Base
- self.table_name = 'application_settings'
- self.inheritance_column = :_type_disabled
- end
-
- def up
- table = ApplicationSetting.arel_table
- ApplicationSetting.where(table[:max_pages_size].gt(MAX_SIZE)).update_all(max_pages_size: MAX_SIZE)
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20191213143656_create_ci_pipelines_config.rb b/db/migrate/20191213143656_create_ci_pipelines_config.rb
deleted file mode 100644
index a1821ee9f66..00000000000
--- a/db/migrate/20191213143656_create_ci_pipelines_config.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class CreateCiPipelinesConfig < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- create_table :ci_pipelines_config, id: false do |t|
- t.references :pipeline,
- primary_key: true,
- foreign_key: { to_table: :ci_pipelines, on_delete: :cascade }
- t.text :content, null: false # rubocop:disable Migration/AddLimitToTextColumns
- end
- end
-end
diff --git a/db/migrate/20191213184609_backfill_operations_feature_flags_active.rb b/db/migrate/20191213184609_backfill_operations_feature_flags_active.rb
deleted file mode 100644
index cc61b30acae..00000000000
--- a/db/migrate/20191213184609_backfill_operations_feature_flags_active.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class BackfillOperationsFeatureFlagsActive < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- class OperationsFeatureFlag < ActiveRecord::Base
- self.table_name = 'operations_feature_flags'
- self.inheritance_column = :_type_disabled
- end
-
- def up
- OperationsFeatureFlag.where(active: false).update_all(active: true)
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb b/db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb
deleted file mode 100644
index ea92f9cfd32..00000000000
--- a/db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexesToDeploymentsOnProjectIdAndRef < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'partial_index_deployments_for_project_id_and_tag'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :deployments, [:project_id, :ref]
- add_concurrent_index :deployments, [:project_id], where: 'tag IS TRUE', name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index :deployments, [:project_id, :ref]
- remove_concurrent_index :deployments, [:project_id], where: 'tag IS TRUE', name: INDEX_NAME
- end
-end
diff --git a/db/migrate/20191216074800_add_epic_date_sourcing_milestone_indexes.rb b/db/migrate/20191216074800_add_epic_date_sourcing_milestone_indexes.rb
deleted file mode 100644
index 72fd5937331..00000000000
--- a/db/migrate/20191216074800_add_epic_date_sourcing_milestone_indexes.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-class AddEpicDateSourcingMilestoneIndexes < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :epics, due_date_column
- add_concurrent_index :epics, start_date_column
- end
-
- def down
- remove_concurrent_index :epics, start_date_column
- remove_concurrent_index :epics, due_date_column
- end
-
- private
-
- def due_date_column
- :due_date_sourcing_milestone_id
- end
-
- def start_date_column
- :start_date_sourcing_milestone_id
- end
-end
diff --git a/db/migrate/20191216074802_add_epic_start_date_sourcing_milestone_id_foreign_key.rb b/db/migrate/20191216074802_add_epic_start_date_sourcing_milestone_id_foreign_key.rb
deleted file mode 100644
index 1c0713ec586..00000000000
--- a/db/migrate/20191216074802_add_epic_start_date_sourcing_milestone_id_foreign_key.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class AddEpicStartDateSourcingMilestoneIdForeignKey < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :epics, :milestones, column: start_date_column, on_delete: :nullify, validate: false
- end
-
- def down
- remove_foreign_key_if_exists :epics, column: start_date_column
- end
-
- private
-
- def start_date_column
- :start_date_sourcing_milestone_id
- end
-end
diff --git a/db/migrate/20191216074803_add_epic_due_date_sourcing_milestone_id_foreign_key.rb b/db/migrate/20191216074803_add_epic_due_date_sourcing_milestone_id_foreign_key.rb
deleted file mode 100644
index 51202e358cc..00000000000
--- a/db/migrate/20191216074803_add_epic_due_date_sourcing_milestone_id_foreign_key.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class AddEpicDueDateSourcingMilestoneIdForeignKey < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key :epics, :milestones, column: due_date_column, on_delete: :nullify, validate: false
- end
-
- def down
- remove_foreign_key_if_exists :epics, column: due_date_column
- end
-
- private
-
- def due_date_column
- :due_date_sourcing_milestone_id
- end
-end
diff --git a/db/migrate/20191216094119_add_id_to_plan_limits.rb b/db/migrate/20191216094119_add_id_to_plan_limits.rb
deleted file mode 100644
index 05ebd900df3..00000000000
--- a/db/migrate/20191216094119_add_id_to_plan_limits.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddIdToPlanLimits < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def up
- add_column(:plan_limits, :id, :primary_key) unless column_exists?(:plan_limits, :id)
- end
-
- def down
- remove_column(:plan_limits, :id)
- end
-end
diff --git a/db/migrate/20191216183531_add_project_hooks_to_plan_limits.rb b/db/migrate/20191216183531_add_project_hooks_to_plan_limits.rb
deleted file mode 100644
index c56b6edf029..00000000000
--- a/db/migrate/20191216183531_add_project_hooks_to_plan_limits.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectHooksToPlanLimits < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column(:plan_limits, :project_hooks, :integer, default: 0, null: false)
- end
-end
diff --git a/db/migrate/20191216183532_insert_project_hooks_plan_limits.rb b/db/migrate/20191216183532_insert_project_hooks_plan_limits.rb
deleted file mode 100644
index b2c0121dd24..00000000000
--- a/db/migrate/20191216183532_insert_project_hooks_plan_limits.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# frozen_string_literal: true
-
-class InsertProjectHooksPlanLimits < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- return unless Gitlab.com?
-
- create_or_update_plan_limit('project_hooks', 'free', 10)
- create_or_update_plan_limit('project_hooks', 'bronze', 20)
- create_or_update_plan_limit('project_hooks', 'silver', 30)
- create_or_update_plan_limit('project_hooks', 'gold', 100)
- end
-
- def down
- return unless Gitlab.com?
-
- create_or_update_plan_limit('project_hooks', 'free', 0)
- create_or_update_plan_limit('project_hooks', 'bronze', 0)
- create_or_update_plan_limit('project_hooks', 'silver', 0)
- create_or_update_plan_limit('project_hooks', 'gold', 0)
- end
-end
diff --git a/db/migrate/20191217165641_add_saml_provider_prohibited_outer_forks.rb b/db/migrate/20191217165641_add_saml_provider_prohibited_outer_forks.rb
deleted file mode 100644
index 4b528578848..00000000000
--- a/db/migrate/20191217165641_add_saml_provider_prohibited_outer_forks.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddSamlProviderProhibitedOuterForks < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :saml_providers, :prohibited_outer_forks, :boolean, default: false, allow_null: true # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :saml_providers, :prohibited_outer_forks
- end
-end
diff --git a/db/migrate/20191217212348_add_modsecurity_enabled_to_ingress_application.rb b/db/migrate/20191217212348_add_modsecurity_enabled_to_ingress_application.rb
deleted file mode 100644
index 2690a5762dd..00000000000
--- a/db/migrate/20191217212348_add_modsecurity_enabled_to_ingress_application.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddModsecurityEnabledToIngressApplication < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def up
- add_column :clusters_applications_ingress, :modsecurity_enabled, :boolean
- end
-
- def down
- remove_column :clusters_applications_ingress, :modsecurity_enabled
- end
-end
diff --git a/db/migrate/20191218084115_add_updating_name_disabled_for_users_to_application_settings.rb b/db/migrate/20191218084115_add_updating_name_disabled_for_users_to_application_settings.rb
deleted file mode 100644
index d0b2e53650b..00000000000
--- a/db/migrate/20191218084115_add_updating_name_disabled_for_users_to_application_settings.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class AddUpdatingNameDisabledForUsersToApplicationSettings < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:application_settings, :updating_name_disabled_for_users, # rubocop:disable Migration/AddColumnWithDefault
- :boolean,
- default: false,
- allow_null: false)
- end
-
- def down
- remove_column(:application_settings, :updating_name_disabled_for_users)
- end
-end
diff --git a/db/migrate/20191218122457_add_force_pages_access_control_to_application_settings.rb b/db/migrate/20191218122457_add_force_pages_access_control_to_application_settings.rb
deleted file mode 100644
index 97352fc98ff..00000000000
--- a/db/migrate/20191218122457_add_force_pages_access_control_to_application_settings.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddForcePagesAccessControlToApplicationSettings < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column :application_settings, :force_pages_access_control, :boolean, null: false, default: false
- end
-end
diff --git a/db/migrate/20191218124915_add_repository_storage_to_snippets.rb b/db/migrate/20191218124915_add_repository_storage_to_snippets.rb
deleted file mode 100644
index e2ba11aef20..00000000000
--- a/db/migrate/20191218124915_add_repository_storage_to_snippets.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class AddRepositoryStorageToSnippets < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- # rubocop:disable Migration/PreventStrings
- def up
- add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault
- :snippets,
- :repository_storage,
- :string,
- default: 'default',
- limit: 255,
- allow_null: false
- )
- end
- # rubocop:enable Migration/PreventStrings
-
- def down
- remove_column(:snippets, :repository_storage)
- end
-end
diff --git a/db/migrate/20191218125015_add_storage_version_to_snippets.rb b/db/migrate/20191218125015_add_storage_version_to_snippets.rb
deleted file mode 100644
index b1bd3589692..00000000000
--- a/db/migrate/20191218125015_add_storage_version_to_snippets.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class AddStorageVersionToSnippets < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
- disable_ddl_transaction!
-
- def up
- add_column_with_default( # rubocop:disable Migration/AddColumnWithDefault
- :snippets,
- :storage_version,
- :integer,
- default: 2,
- allow_null: false
- )
- end
-
- def down
- remove_column(:snippets, :storage_version)
- end
-end
diff --git a/db/migrate/20191218190253_add_tab_width_to_user_preferences.rb b/db/migrate/20191218190253_add_tab_width_to_user_preferences.rb
deleted file mode 100644
index b03dd8f76b9..00000000000
--- a/db/migrate/20191218190253_add_tab_width_to_user_preferences.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddTabWidthToUserPreferences < ActiveRecord::Migration[5.2]
- DOWNTIME = false
-
- def change
- add_column(:user_preferences, :tab_width, :integer, limit: 2)
- end
-end
diff --git a/db/migrate/20191223124940_add_scheduling_type_to_ci_builds.rb b/db/migrate/20191223124940_add_scheduling_type_to_ci_builds.rb
deleted file mode 100644
index bb849aa8a95..00000000000
--- a/db/migrate/20191223124940_add_scheduling_type_to_ci_builds.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddSchedulingTypeToCiBuilds < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :ci_builds, :scheduling_type, :integer, limit: 2 # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20191225071320_add_index_to_elasticsearch_indexed_namespaces.rb b/db/migrate/20191225071320_add_index_to_elasticsearch_indexed_namespaces.rb
deleted file mode 100644
index 758838cb775..00000000000
--- a/db/migrate/20191225071320_add_index_to_elasticsearch_indexed_namespaces.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToElasticsearchIndexedNamespaces < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:elasticsearch_indexed_namespaces, :created_at)
- end
-
- def down
- remove_concurrent_index(:elasticsearch_indexed_namespaces, :created_at)
- end
-end
diff --git a/db/migrate/20191227140254_update_personal_access_tokens_user_id_foreign_key.rb b/db/migrate/20191227140254_update_personal_access_tokens_user_id_foreign_key.rb
deleted file mode 100644
index fbf17b28274..00000000000
--- a/db/migrate/20191227140254_update_personal_access_tokens_user_id_foreign_key.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class UpdatePersonalAccessTokensUserIdForeignKey < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- CONSTRAINT_NAME = 'fk_personal_access_tokens_user_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key(:personal_access_tokens, :users, column: :user_id, on_delete: :cascade, name: CONSTRAINT_NAME)
- remove_foreign_key_if_exists(:personal_access_tokens, column: :user_id, on_delete: nil)
- end
-
- def down
- add_concurrent_foreign_key(:personal_access_tokens, :users, column: :user_id, on_delete: nil)
- remove_foreign_key_if_exists(:personal_access_tokens, column: :user_id, on_delete: :cascade, name: CONSTRAINT_NAME)
- end
-end
diff --git a/db/migrate/20191229140154_drop_index_ci_pipelines_on_project_id.rb b/db/migrate/20191229140154_drop_index_ci_pipelines_on_project_id.rb
deleted file mode 100644
index 9e78457b007..00000000000
--- a/db/migrate/20191229140154_drop_index_ci_pipelines_on_project_id.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class DropIndexCiPipelinesOnProjectId < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name :ci_pipelines, 'index_ci_pipelines_on_project_id'
-
- # extra (duplicate) index that already existed on some installs
- remove_concurrent_index_by_name :ci_pipelines, 'ci_pipelines_project_id_idx'
- end
-
- def down
- add_concurrent_index :ci_pipelines, :project_id, name: 'index_ci_pipelines_on_project_id'
- end
-end
diff --git a/db/migrate/20210629031900_associate_existing_dast_builds_with_variables.rb b/db/migrate/20210629031900_associate_existing_dast_builds_with_variables.rb
index 5db39334550..3d81db87143 100644
--- a/db/migrate/20210629031900_associate_existing_dast_builds_with_variables.rb
+++ b/db/migrate/20210629031900_associate_existing_dast_builds_with_variables.rb
@@ -20,6 +20,7 @@ class AssociateExistingDastBuildsWithVariables < ActiveRecord::Migration[6.1]
class Build < ApplicationRecord
self.table_name = 'ci_builds'
self.inheritance_column = :_type_disabled
+ self.gitlab_schema = :gitlab_ci
default_scope { where(name: :dast, stage: :dast) } # rubocop:disable Cop/DefaultScope
end
diff --git a/db/migrate/20210819185500_create_external_audit_event_destinations_table.rb b/db/migrate/20210819185500_create_external_audit_event_destinations_table.rb
new file mode 100644
index 00000000000..bf0725a77a0
--- /dev/null
+++ b/db/migrate/20210819185500_create_external_audit_event_destinations_table.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class CreateExternalAuditEventDestinationsTable < Gitlab::Database::Migration[1.0]
+ enable_lock_retries!
+
+ def change
+ create_table :audit_events_external_audit_event_destinations do |t|
+ t.references :namespace, index: false, null: false, foreign_key: { on_delete: :cascade }
+ t.text :destination_url, null: false, limit: 255 # rubocop:disable Migration/AddLimitToTextColumns
+ t.timestamps_with_timezone null: false
+
+ t.index [:namespace_id, :destination_url], unique: true, name: 'index_external_audit_event_destinations_on_namespace_id'
+ end
+ end
+end
diff --git a/db/migrate/20210908195506_add_data_to_vulnerability_finding_evidence.rb b/db/migrate/20210908195506_add_data_to_vulnerability_finding_evidence.rb
new file mode 100644
index 00000000000..447508d3d5b
--- /dev/null
+++ b/db/migrate/20210908195506_add_data_to_vulnerability_finding_evidence.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddDataToVulnerabilityFindingEvidence < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :vulnerability_finding_evidences, :data, :jsonb, default: {}, null: false
+ end
+end
diff --git a/db/migrate/20210910014741_add_dependency_proxy_ttl_group_policy_worker_capacity_to_application_settings.rb b/db/migrate/20210910014741_add_dependency_proxy_ttl_group_policy_worker_capacity_to_application_settings.rb
new file mode 100644
index 00000000000..52fab5a63ee
--- /dev/null
+++ b/db/migrate/20210910014741_add_dependency_proxy_ttl_group_policy_worker_capacity_to_application_settings.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddDependencyProxyTtlGroupPolicyWorkerCapacityToApplicationSettings < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :application_settings,
+ :dependency_proxy_ttl_group_policy_worker_capacity,
+ :smallint,
+ default: 2,
+ null: false
+ end
+end
diff --git a/db/migrate/20210910015047_add_app_settings_dep_proxy_ttl_worker_capacity_check_constraint.rb b/db/migrate/20210910015047_add_app_settings_dep_proxy_ttl_worker_capacity_check_constraint.rb
new file mode 100644
index 00000000000..9b522f2874f
--- /dev/null
+++ b/db/migrate/20210910015047_add_app_settings_dep_proxy_ttl_worker_capacity_check_constraint.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddAppSettingsDepProxyTtlWorkerCapacityCheckConstraint < Gitlab::Database::Migration[1.0]
+ CONSTRAINT_NAME = 'app_settings_dep_proxy_ttl_policies_worker_capacity_positive'
+
+ disable_ddl_transaction!
+
+ def up
+ add_check_constraint :application_settings, 'dependency_proxy_ttl_group_policy_worker_capacity >= 0', CONSTRAINT_NAME
+ end
+
+ def down
+ remove_check_constraint :application_settings, CONSTRAINT_NAME
+ end
+end
diff --git a/db/migrate/20210910192921_add_report_type_into_approval_project_rules.rb b/db/migrate/20210910192921_add_report_type_into_approval_project_rules.rb
new file mode 100644
index 00000000000..4b147034657
--- /dev/null
+++ b/db/migrate/20210910192921_add_report_type_into_approval_project_rules.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddReportTypeIntoApprovalProjectRules < Gitlab::Database::Migration[1.0]
+ def up
+ add_column :approval_project_rules, :report_type, :integer, limit: 2
+ end
+
+ def down
+ remove_column :approval_project_rules, :report_type
+ end
+end
diff --git a/db/migrate/20210912034903_add_runner_features_to_ci_builds_metadata.rb b/db/migrate/20210912034903_add_runner_features_to_ci_builds_metadata.rb
new file mode 100644
index 00000000000..83eddf2fb0d
--- /dev/null
+++ b/db/migrate/20210912034903_add_runner_features_to_ci_builds_metadata.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddRunnerFeaturesToCiBuildsMetadata < Gitlab::Database::Migration[1.0]
+ enable_lock_retries!
+
+ def change
+ add_column :ci_builds_metadata, :runner_features, :jsonb, default: {}, null: false
+ end
+end
diff --git a/db/migrate/20210913224558_update_dependency_proxy_manifests_uniqueness_constraint.rb b/db/migrate/20210913224558_update_dependency_proxy_manifests_uniqueness_constraint.rb
new file mode 100644
index 00000000000..845697c28b5
--- /dev/null
+++ b/db/migrate/20210913224558_update_dependency_proxy_manifests_uniqueness_constraint.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class UpdateDependencyProxyManifestsUniquenessConstraint < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ NEW_INDEX_NAME = 'index_dep_prox_manifests_on_group_id_file_name_and_status'
+ OLD_INDEX_NAME = 'index_dependency_proxy_manifests_on_group_id_and_file_name'
+
+ def up
+ add_concurrent_index :dependency_proxy_manifests, [:group_id, :file_name, :status], unique: true, name: NEW_INDEX_NAME
+ remove_concurrent_index_by_name :dependency_proxy_manifests, OLD_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :dependency_proxy_manifests, [:group_id, :file_name], unique: true, name: OLD_INDEX_NAME
+ remove_concurrent_index_by_name :dependency_proxy_manifests, NEW_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210914145810_add_throttle_deprecated_api_columns.rb b/db/migrate/20210914145810_add_throttle_deprecated_api_columns.rb
new file mode 100644
index 00000000000..6e57429bca8
--- /dev/null
+++ b/db/migrate/20210914145810_add_throttle_deprecated_api_columns.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddThrottleDeprecatedApiColumns < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :application_settings, :throttle_unauthenticated_deprecated_api_requests_per_period, :integer, default: 3600, null: false
+ add_column :application_settings, :throttle_unauthenticated_deprecated_api_period_in_seconds, :integer, default: 3600, null: false
+ add_column :application_settings, :throttle_unauthenticated_deprecated_api_enabled, :boolean, default: false, null: false
+
+ add_column :application_settings, :throttle_authenticated_deprecated_api_requests_per_period, :integer, default: 3600, null: false
+ add_column :application_settings, :throttle_authenticated_deprecated_api_period_in_seconds, :integer, default: 1800, null: false
+ add_column :application_settings, :throttle_authenticated_deprecated_api_enabled, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20210914172202_add_status_index_to_dependency_proxy_tables.rb b/db/migrate/20210914172202_add_status_index_to_dependency_proxy_tables.rb
new file mode 100644
index 00000000000..9b593fbe540
--- /dev/null
+++ b/db/migrate/20210914172202_add_status_index_to_dependency_proxy_tables.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddStatusIndexToDependencyProxyTables < Gitlab::Database::Migration[1.0]
+ MANIFEST_INDEX_NAME = 'index_dependency_proxy_manifests_on_status'
+ BLOB_INDEX_NAME = 'index_dependency_proxy_blobs_on_status'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :dependency_proxy_manifests, :status, name: MANIFEST_INDEX_NAME
+ add_concurrent_index :dependency_proxy_blobs, :status, name: BLOB_INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :dependency_proxy_manifests, MANIFEST_INDEX_NAME
+ remove_concurrent_index_by_name :dependency_proxy_blobs, BLOB_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210915000453_add_index_on_clusters_integration_prometheus_enabled.rb b/db/migrate/20210915000453_add_index_on_clusters_integration_prometheus_enabled.rb
new file mode 100644
index 00000000000..35cd18c1da9
--- /dev/null
+++ b/db/migrate/20210915000453_add_index_on_clusters_integration_prometheus_enabled.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddIndexOnClustersIntegrationPrometheusEnabled < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_clusters_integration_prometheus_enabled'
+
+ def up
+ add_concurrent_index(:clusters_integration_prometheus, [:enabled, :created_at, :cluster_id], name: INDEX_NAME)
+ end
+
+ def down
+ remove_concurrent_index_by_name(:clusters_integration_prometheus, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210915001242_add_index_on_clusters_integration_elastic_stack_enabled.rb b/db/migrate/20210915001242_add_index_on_clusters_integration_elastic_stack_enabled.rb
new file mode 100644
index 00000000000..bdaa84f27fe
--- /dev/null
+++ b/db/migrate/20210915001242_add_index_on_clusters_integration_elastic_stack_enabled.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddIndexOnClustersIntegrationElasticStackEnabled < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_clusters_integration_elasticstack_enabled'
+
+ def up
+ add_concurrent_index(:clusters_integration_elasticstack, [:enabled, :created_at, :cluster_id], name: INDEX_NAME)
+ end
+
+ def down
+ remove_concurrent_index_by_name(:clusters_integration_elasticstack, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210915070423_add_avatar_and_description_to_topic.rb b/db/migrate/20210915070423_add_avatar_and_description_to_topic.rb
new file mode 100644
index 00000000000..2ceeb53cd1e
--- /dev/null
+++ b/db/migrate/20210915070423_add_avatar_and_description_to_topic.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddAvatarAndDescriptionToTopic < Gitlab::Database::Migration[1.0]
+ # rubocop:disable Migration/AddLimitToTextColumns
+ def up
+ add_column :topics, :avatar, :text
+ add_column :topics, :description, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+
+ def down
+ remove_column :topics, :avatar
+ remove_column :topics, :description
+ end
+end
diff --git a/db/migrate/20210916132547_add_process_mode_to_resource_groups.rb b/db/migrate/20210916132547_add_process_mode_to_resource_groups.rb
new file mode 100644
index 00000000000..6bac264fcf4
--- /dev/null
+++ b/db/migrate/20210916132547_add_process_mode_to_resource_groups.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddProcessModeToResourceGroups < Gitlab::Database::Migration[1.0]
+ enable_lock_retries!
+
+ PROCESS_MODE_UNORDERED = 0
+
+ def up
+ add_column :ci_resource_groups, :process_mode, :integer, default: PROCESS_MODE_UNORDERED, null: false, limit: 2
+ end
+
+ def down
+ remove_column :ci_resource_groups, :process_mode
+ end
+end
diff --git a/db/migrate/20210917134321_remove_temporary_index_for_project_topics_on_taggings.rb b/db/migrate/20210917134321_remove_temporary_index_for_project_topics_on_taggings.rb
new file mode 100644
index 00000000000..ac4821b8007
--- /dev/null
+++ b/db/migrate/20210917134321_remove_temporary_index_for_project_topics_on_taggings.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class RemoveTemporaryIndexForProjectTopicsOnTaggings < Gitlab::Database::Migration[1.0]
+ MIGRATION = 'ExtractProjectTopicsIntoSeparateTable'
+ INDEX_NAME = 'tmp_index_taggings_on_id_where_taggable_type_project'
+ INDEX_CONDITION = "taggable_type = 'Project'"
+
+ disable_ddl_transaction!
+
+ def up
+ # Ensure that no background jobs of 20210730104800_schedule_extract_project_topics_into_separate_table remain
+ finalize_background_migration MIGRATION
+ # this index was used in 20210730104800_schedule_extract_project_topics_into_separate_table
+ remove_concurrent_index_by_name :taggings, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :taggings, :id, where: INDEX_CONDITION, name: INDEX_NAME # rubocop:disable Migration/PreventIndexCreation
+ end
+end
diff --git a/db/migrate/20210917153645_remove_pipeline_fk_from_packages_build_infos.rb b/db/migrate/20210917153645_remove_pipeline_fk_from_packages_build_infos.rb
new file mode 100644
index 00000000000..456788de521
--- /dev/null
+++ b/db/migrate/20210917153645_remove_pipeline_fk_from_packages_build_infos.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class RemovePipelineFkFromPackagesBuildInfos < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(:packages_build_infos, :ci_pipelines)
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(:packages_build_infos, :ci_pipelines, column: :pipeline_id, on_delete: :nullify)
+ end
+end
diff --git a/db/migrate/20210917153905_remove_pipeline_fk_from_packages_package_file_build_infos.rb b/db/migrate/20210917153905_remove_pipeline_fk_from_packages_package_file_build_infos.rb
new file mode 100644
index 00000000000..187ddc8a088
--- /dev/null
+++ b/db/migrate/20210917153905_remove_pipeline_fk_from_packages_package_file_build_infos.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class RemovePipelineFkFromPackagesPackageFileBuildInfos < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(:packages_package_file_build_infos, :ci_pipelines)
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(:packages_package_file_build_infos, :ci_pipelines, column: :pipeline_id, on_delete: :nullify)
+ end
+end
diff --git a/db/migrate/20210917224419_add_registration_objective_to_user_detail.rb b/db/migrate/20210917224419_add_registration_objective_to_user_detail.rb
new file mode 100644
index 00000000000..ee7a474928e
--- /dev/null
+++ b/db/migrate/20210917224419_add_registration_objective_to_user_detail.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddRegistrationObjectiveToUserDetail < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :user_details, :registration_objective, :smallint
+ end
+end
diff --git a/db/migrate/20210920104446_add_text_limit_to_topics_description_and_avatar.rb b/db/migrate/20210920104446_add_text_limit_to_topics_description_and_avatar.rb
new file mode 100644
index 00000000000..83ceaa58ff4
--- /dev/null
+++ b/db/migrate/20210920104446_add_text_limit_to_topics_description_and_avatar.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddTextLimitToTopicsDescriptionAndAvatar < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :topics, :description, 1024
+ add_text_limit :topics, :avatar, 255
+ end
+
+ def down
+ remove_text_limit :topics, :avatar
+ remove_text_limit :topics, :description
+ end
+end
diff --git a/db/migrate/20210921032008_add_suggest_pipeline_enabled_to_application_settings.rb b/db/migrate/20210921032008_add_suggest_pipeline_enabled_to_application_settings.rb
new file mode 100644
index 00000000000..5ac12eccc7d
--- /dev/null
+++ b/db/migrate/20210921032008_add_suggest_pipeline_enabled_to_application_settings.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddSuggestPipelineEnabledToApplicationSettings < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :application_settings, :suggest_pipeline_enabled, :boolean, default: true, null: false
+ end
+end
diff --git a/db/migrate/20210921063924_index_labels_using_varchar_pattern_ops.rb b/db/migrate/20210921063924_index_labels_using_varchar_pattern_ops.rb
new file mode 100644
index 00000000000..67975636488
--- /dev/null
+++ b/db/migrate/20210921063924_index_labels_using_varchar_pattern_ops.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+class IndexLabelsUsingVarcharPatternOps < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ NEW_TITLE_INDEX_NAME = 'index_labels_on_title_varchar'
+ NEW_PROJECT_ID_TITLE_INDEX_NAME = 'index_labels_on_project_id_and_title_varchar_unique'
+ NEW_GROUP_ID_TITLE_INDEX_NAME = 'index_labels_on_group_id_and_title_varchar_unique'
+ NEW_GROUP_ID_INDEX_NAME = 'index_labels_on_group_id'
+
+ OLD_TITLE_INDEX_NAME = 'index_labels_on_title'
+ OLD_PROJECT_ID_TITLE_INDEX_NAME = 'index_labels_on_project_id_and_title_unique'
+ OLD_GROUP_ID_TITLE_INDEX_NAME = 'index_labels_on_group_id_and_title_unique'
+ OLD_GROUP_ID_PROJECT_ID_TITLE_INDEX_NAME = 'index_labels_on_group_id_and_project_id_and_title'
+
+ def up
+ add_concurrent_index :labels, :title, order: { title: :varchar_pattern_ops }, name: NEW_TITLE_INDEX_NAME
+ add_concurrent_index :labels, [:project_id, :title], where: "labels.group_id IS NULL", unique: true, order: { title: :varchar_pattern_ops }, name: NEW_PROJECT_ID_TITLE_INDEX_NAME
+ add_concurrent_index :labels, [:group_id, :title], where: "labels.project_id IS NULL", unique: true, order: { title: :varchar_pattern_ops }, name: NEW_GROUP_ID_TITLE_INDEX_NAME
+ add_concurrent_index :labels, :group_id, name: NEW_GROUP_ID_INDEX_NAME
+
+ remove_concurrent_index_by_name :labels, OLD_TITLE_INDEX_NAME
+ remove_concurrent_index_by_name :labels, OLD_PROJECT_ID_TITLE_INDEX_NAME
+ remove_concurrent_index_by_name :labels, OLD_GROUP_ID_TITLE_INDEX_NAME
+ remove_concurrent_index_by_name :labels, OLD_GROUP_ID_PROJECT_ID_TITLE_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :labels, :title, name: OLD_TITLE_INDEX_NAME
+ add_concurrent_index :labels, [:project_id, :title], where: "labels.group_id IS NULL", unique: true, name: OLD_PROJECT_ID_TITLE_INDEX_NAME
+ add_concurrent_index :labels, [:group_id, :title], where: "labels.project_id IS NULL", unique: true, name: OLD_GROUP_ID_TITLE_INDEX_NAME
+ add_concurrent_index :labels, [:group_id, :project_id, :title], unique: true, name: OLD_GROUP_ID_PROJECT_ID_TITLE_INDEX_NAME
+
+ remove_concurrent_index_by_name :labels, NEW_TITLE_INDEX_NAME
+ remove_concurrent_index_by_name :labels, NEW_PROJECT_ID_TITLE_INDEX_NAME
+ remove_concurrent_index_by_name :labels, NEW_GROUP_ID_TITLE_INDEX_NAME
+ remove_concurrent_index_by_name :labels, NEW_GROUP_ID_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210921191010_add_report_type_index_into_approval_project_rules.rb b/db/migrate/20210921191010_add_report_type_index_into_approval_project_rules.rb
new file mode 100644
index 00000000000..c03c463b9bb
--- /dev/null
+++ b/db/migrate/20210921191010_add_report_type_index_into_approval_project_rules.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddReportTypeIndexIntoApprovalProjectRules < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_approval_project_rules_report_type'
+
+ def up
+ add_concurrent_index :approval_project_rules, :report_type, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :approval_project_rules, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210922172056_add_unique_namespaces_index_on_name_parent_id_and_type.rb b/db/migrate/20210922172056_add_unique_namespaces_index_on_name_parent_id_and_type.rb
new file mode 100644
index 00000000000..6cbbe582ff6
--- /dev/null
+++ b/db/migrate/20210922172056_add_unique_namespaces_index_on_name_parent_id_and_type.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddUniqueNamespacesIndexOnNameParentIdAndType < Gitlab::Database::Migration[1.0]
+ INDEX_NAME = 'index_namespaces_name_parent_id_type'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :namespaces, [:name, :parent_id, :type], unique: true, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :namespaces, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210922172156_drop_unique_namespaces_index_on_name_and_parent_id.rb b/db/migrate/20210922172156_drop_unique_namespaces_index_on_name_and_parent_id.rb
new file mode 100644
index 00000000000..001f3a6964b
--- /dev/null
+++ b/db/migrate/20210922172156_drop_unique_namespaces_index_on_name_and_parent_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class DropUniqueNamespacesIndexOnNameAndParentId < Gitlab::Database::Migration[1.0]
+ INDEX_NAME = 'index_namespaces_on_name_and_parent_id'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :namespaces, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :namespaces, [:name, :parent_id], unique: true, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210922215740_create_issue_customer_relations_contacts.rb b/db/migrate/20210922215740_create_issue_customer_relations_contacts.rb
new file mode 100644
index 00000000000..2d89d295608
--- /dev/null
+++ b/db/migrate/20210922215740_create_issue_customer_relations_contacts.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class CreateIssueCustomerRelationsContacts < Gitlab::Database::Migration[1.0]
+ def change
+ create_table :issue_customer_relations_contacts do |t|
+ t.bigint :issue_id, null: false
+ t.bigint :contact_id, null: false
+ t.timestamps_with_timezone null: false
+
+ t.index :contact_id
+ t.index [:issue_id, :contact_id], unique: true, name: :index_issue_crm_contacts_on_issue_id_and_contact_id
+ end
+ end
+end
diff --git a/db/migrate/20210922220104_add_issue_customer_relations_contacts_foreign_keys.rb b/db/migrate/20210922220104_add_issue_customer_relations_contacts_foreign_keys.rb
new file mode 100644
index 00000000000..7be465ca31a
--- /dev/null
+++ b/db/migrate/20210922220104_add_issue_customer_relations_contacts_foreign_keys.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddIssueCustomerRelationsContactsForeignKeys < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :issue_customer_relations_contacts, :issues, column: :issue_id
+ add_concurrent_foreign_key :issue_customer_relations_contacts, :customer_relations_contacts, column: :contact_id
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :issue_customer_relations_contacts, column: :issue_id
+ end
+
+ with_lock_retries do
+ remove_foreign_key_if_exists :issue_customer_relations_contacts, column: :contact_id
+ end
+ end
+end
diff --git a/db/migrate/20210923042323_add_meta_data_to_user_credit_card_validations.rb b/db/migrate/20210923042323_add_meta_data_to_user_credit_card_validations.rb
new file mode 100644
index 00000000000..2958285e7a5
--- /dev/null
+++ b/db/migrate/20210923042323_add_meta_data_to_user_credit_card_validations.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddMetaDataToUserCreditCardValidations < Gitlab::Database::Migration[1.0]
+ # rubocop:disable Migration/AddLimitToTextColumns
+ def change
+ change_table :user_credit_card_validations do |t|
+ t.date :expiration_date
+ t.integer :last_digits, limit: 2 # last 4 digits
+ t.text :holder_name
+ end
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20210923042324_limit_holder_name_on_user_credit_card_validations.rb b/db/migrate/20210923042324_limit_holder_name_on_user_credit_card_validations.rb
new file mode 100644
index 00000000000..11d436093b7
--- /dev/null
+++ b/db/migrate/20210923042324_limit_holder_name_on_user_credit_card_validations.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class LimitHolderNameOnUserCreditCardValidations < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :user_credit_card_validations, :holder_name, 26 # ISO IEC 7813
+
+ add_check_constraint(:user_credit_card_validations, 'last_digits BETWEEN 0 AND 9999', constraint_name)
+ end
+
+ def down
+ remove_text_limit :user_credit_card_validations, :holder_name
+
+ remove_check_constraint(:user_credit_card_validations, constraint_name)
+ end
+
+ private
+
+ def constraint_name
+ check_constraint_name(:user_credit_card_validations, :last_digits, 'range')
+ end
+end
diff --git a/db/migrate/20210923042325_index_meta_data_on_user_credit_card_validations.rb b/db/migrate/20210923042325_index_meta_data_on_user_credit_card_validations.rb
new file mode 100644
index 00000000000..cc4f4d35f09
--- /dev/null
+++ b/db/migrate/20210923042325_index_meta_data_on_user_credit_card_validations.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class IndexMetaDataOnUserCreditCardValidations < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_user_credit_card_validations_meta_data_full_match'
+
+ def up
+ add_concurrent_index :user_credit_card_validations,
+ [:holder_name, :expiration_date, :last_digits, :credit_card_validated_at],
+ name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :user_credit_card_validations,
+ [:holder_name, :expiration_date, :last_digits, :credit_card_validated_at],
+ name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210923151641_change_default_for_integrated_error_tracking.rb b/db/migrate/20210923151641_change_default_for_integrated_error_tracking.rb
new file mode 100644
index 00000000000..fc4cc1945f3
--- /dev/null
+++ b/db/migrate/20210923151641_change_default_for_integrated_error_tracking.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class ChangeDefaultForIntegratedErrorTracking < Gitlab::Database::Migration[1.0]
+ def up
+ change_column_default :project_error_tracking_settings, :integrated, from: false, to: true
+ end
+
+ def down
+ change_column_default :project_error_tracking_settings, :integrated, from: true, to: false
+ end
+end
diff --git a/db/migrate/20210928155022_improve_index_for_error_tracking.rb b/db/migrate/20210928155022_improve_index_for_error_tracking.rb
new file mode 100644
index 00000000000..ec8427670d7
--- /dev/null
+++ b/db/migrate/20210928155022_improve_index_for_error_tracking.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class ImproveIndexForErrorTracking < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :error_tracking_errors, %i(project_id status last_seen_at id),
+ order: { last_seen_at: :desc, id: :desc },
+ name: 'index_et_errors_on_project_id_and_status_last_seen_at_id_desc'
+
+ add_concurrent_index :error_tracking_errors, %i(project_id status first_seen_at id),
+ order: { first_seen_at: :desc, id: :desc },
+ name: 'index_et_errors_on_project_id_and_status_first_seen_at_id_desc'
+
+ add_concurrent_index :error_tracking_errors, %i(project_id status events_count id),
+ order: { events_count: :desc, id: :desc },
+ name: 'index_et_errors_on_project_id_and_status_events_count_id_desc'
+
+ remove_concurrent_index :error_tracking_errors, [:project_id, :status, :last_seen_at], name: 'index_et_errors_on_project_id_and_status_and_last_seen_at'
+ remove_concurrent_index :error_tracking_errors, [:project_id, :status, :first_seen_at], name: 'index_et_errors_on_project_id_and_status_and_first_seen_at'
+ remove_concurrent_index :error_tracking_errors, [:project_id, :status, :events_count], name: 'index_et_errors_on_project_id_and_status_and_events_count'
+ end
+
+ def down
+ add_concurrent_index :error_tracking_errors, [:project_id, :status, :last_seen_at], name: 'index_et_errors_on_project_id_and_status_and_last_seen_at'
+ add_concurrent_index :error_tracking_errors, [:project_id, :status, :first_seen_at], name: 'index_et_errors_on_project_id_and_status_and_first_seen_at'
+ add_concurrent_index :error_tracking_errors, [:project_id, :status, :events_count], name: 'index_et_errors_on_project_id_and_status_and_events_count'
+
+ remove_concurrent_index :error_tracking_errors, [:project_id, :status, :last_seen_at, :id], name: 'index_et_errors_on_project_id_and_status_last_seen_at_id_desc'
+ remove_concurrent_index :error_tracking_errors, [:project_id, :status, :first_seen_at, :id], name: 'index_et_errors_on_project_id_and_status_first_seen_at_id_desc'
+ remove_concurrent_index :error_tracking_errors, [:project_id, :status, :events_count, :id], name: 'index_et_errors_on_project_id_and_status_events_count_id_desc'
+ end
+end
diff --git a/db/migrate/20210928171122_add_group_id_status_id_index_to_dependency_proxy_tables.rb b/db/migrate/20210928171122_add_group_id_status_id_index_to_dependency_proxy_tables.rb
new file mode 100644
index 00000000000..ef437641f2c
--- /dev/null
+++ b/db/migrate/20210928171122_add_group_id_status_id_index_to_dependency_proxy_tables.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddGroupIdStatusIdIndexToDependencyProxyTables < Gitlab::Database::Migration[1.0]
+ MANIFEST_INDEX_NAME = 'index_dependency_proxy_manifests_on_group_id_status_and_id'
+ BLOB_INDEX_NAME = 'index_dependency_proxy_blobs_on_group_id_status_and_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :dependency_proxy_manifests, [:group_id, :status, :id], name: MANIFEST_INDEX_NAME
+ add_concurrent_index :dependency_proxy_blobs, [:group_id, :status, :id], name: BLOB_INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :dependency_proxy_manifests, MANIFEST_INDEX_NAME
+ remove_concurrent_index_by_name :dependency_proxy_blobs, BLOB_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210929025600_add_phone_to_user_details.rb b/db/migrate/20210929025600_add_phone_to_user_details.rb
new file mode 100644
index 00000000000..9bcfd4ab7e3
--- /dev/null
+++ b/db/migrate/20210929025600_add_phone_to_user_details.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddPhoneToUserDetails < Gitlab::Database::Migration[1.0]
+ enable_lock_retries!
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ def up
+ add_column :user_details, :phone, :text, comment: 'JiHu-specific column'
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+
+ def down
+ remove_column :user_details, :phone
+ end
+end
diff --git a/db/migrate/20210929030834_add_text_limit_to_user_details_phone.rb b/db/migrate/20210929030834_add_text_limit_to_user_details_phone.rb
new file mode 100644
index 00000000000..f250aad3253
--- /dev/null
+++ b/db/migrate/20210929030834_add_text_limit_to_user_details_phone.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddTextLimitToUserDetailsPhone < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :user_details, :phone, 32
+ end
+
+ def down
+ remove_text_limit :user_details, :phone
+ end
+end
diff --git a/db/migrate/20210929031049_add_unique_index_phone_on_user_details.rb b/db/migrate/20210929031049_add_unique_index_phone_on_user_details.rb
new file mode 100644
index 00000000000..e0cf7aa8a44
--- /dev/null
+++ b/db/migrate/20210929031049_add_unique_index_phone_on_user_details.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddUniqueIndexPhoneOnUserDetails < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_user_details_on_phone'
+
+ def up
+ add_concurrent_index :user_details, :phone, unique: true, where: 'phone IS NOT NULL', name: INDEX_NAME, comment: 'JiHu-specific index'
+ end
+
+ def down
+ remove_concurrent_index_by_name :user_details, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210929032555_create_verification_codes.rb b/db/migrate/20210929032555_create_verification_codes.rb
new file mode 100644
index 00000000000..ad743641b9c
--- /dev/null
+++ b/db/migrate/20210929032555_create_verification_codes.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+class CreateVerificationCodes < Gitlab::Database::Migration[1.0]
+ include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers
+
+ def up
+ constraint_visitor_id_code = check_constraint_name('verification_codes', 'visitor_id_code', 'max_length')
+ constraint_code = check_constraint_name('verification_codes', 'code', 'max_length')
+ constraint_phone = check_constraint_name('verification_codes', 'phone', 'max_length')
+
+ execute(<<~SQL)
+ CREATE TABLE verification_codes (
+ created_at timestamp with time zone NOT NULL DEFAULT NOW(),
+ visitor_id_code text,
+ code text,
+ phone text,
+ PRIMARY KEY (created_at, visitor_id_code, code, phone),
+ CONSTRAINT #{constraint_visitor_id_code} CHECK ((char_length(visitor_id_code) <= 64)),
+ CONSTRAINT #{constraint_code} CHECK ((char_length(code) <= 8)),
+ CONSTRAINT #{constraint_phone} CHECK ((char_length(phone) <= 32))
+ ) PARTITION BY RANGE (created_at);
+ COMMENT ON TABLE verification_codes IS 'JiHu-specific table';
+
+ CREATE UNIQUE INDEX index_verification_codes_on_phone_and_visitor_id_code ON verification_codes (visitor_id_code, phone, created_at);
+ COMMENT ON INDEX index_verification_codes_on_phone_and_visitor_id_code IS 'JiHu-specific index';
+ SQL
+
+ min_date = Date.today - 1.month
+ max_date = Date.today + 1.month
+ create_daterange_partitions('verification_codes', 'created_at', min_date, max_date)
+ end
+
+ def down
+ drop_table :verification_codes
+ end
+end
diff --git a/db/migrate/20210929115340_add_security_policy_configurations_management_project_id_foreign_key.rb b/db/migrate/20210929115340_add_security_policy_configurations_management_project_id_foreign_key.rb
new file mode 100644
index 00000000000..1335c06cf1f
--- /dev/null
+++ b/db/migrate/20210929115340_add_security_policy_configurations_management_project_id_foreign_key.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddSecurityPolicyConfigurationsManagementProjectIdForeignKey < Gitlab::Database::Migration[1.0]
+ CONSTRAINT_NAME = 'fk_security_policy_configurations_management_project_id'
+ OLD_CONSTRAINT_NAME = 'fk_rails_42ed6c25ec'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key(:security_orchestration_policy_configurations, :projects, column: :security_policy_management_project_id, on_delete: :cascade, name: CONSTRAINT_NAME)
+ remove_foreign_key_if_exists(:security_orchestration_policy_configurations, column: :security_policy_management_project_id, on_delete: :restrict, name: OLD_CONSTRAINT_NAME)
+ end
+
+ def down
+ add_concurrent_foreign_key(:security_orchestration_policy_configurations, :projects, column: :security_policy_management_project_id, on_delete: :restrict, name: OLD_CONSTRAINT_NAME)
+ remove_foreign_key_if_exists(:security_orchestration_policy_configurations, column: :security_policy_management_project_id, on_delete: :cascade, name: CONSTRAINT_NAME)
+ end
+end
diff --git a/db/migrate/20210929121516_add_releases_author_id_id_created_at_index.rb b/db/migrate/20210929121516_add_releases_author_id_id_created_at_index.rb
new file mode 100644
index 00000000000..60ca3040d70
--- /dev/null
+++ b/db/migrate/20210929121516_add_releases_author_id_id_created_at_index.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+class AddReleasesAuthorIdIdCreatedAtIndex < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_releases_on_author_id_id_created_at'
+
+ def up
+ add_concurrent_index :releases, [:author_id, :id, :created_at], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :releases, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210930081208_fix_deprecated_api_throttle_defaults.rb b/db/migrate/20210930081208_fix_deprecated_api_throttle_defaults.rb
new file mode 100644
index 00000000000..be82b16ee8c
--- /dev/null
+++ b/db/migrate/20210930081208_fix_deprecated_api_throttle_defaults.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+class FixDeprecatedApiThrottleDefaults < Gitlab::Database::Migration[1.0]
+ def change
+ change_column_default :application_settings, :throttle_unauthenticated_deprecated_api_requests_per_period, from: 3600, to: 1800
+ change_column_default :application_settings, :throttle_authenticated_deprecated_api_period_in_seconds, from: 1800, to: 3600
+ end
+end
diff --git a/db/migrate/20211001001222_add_source_version_to_bulk_imports.rb b/db/migrate/20211001001222_add_source_version_to_bulk_imports.rb
new file mode 100644
index 00000000000..d0eb4a32cac
--- /dev/null
+++ b/db/migrate/20211001001222_add_source_version_to_bulk_imports.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddSourceVersionToBulkImports < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :bulk_imports, :source_version, :text # rubocop:disable Migration/AddLimitToTextColumns
+ end
+end
diff --git a/db/migrate/20211004062942_create_coverage_fuzzing_corpuses.rb b/db/migrate/20211004062942_create_coverage_fuzzing_corpuses.rb
new file mode 100644
index 00000000000..c24883b626d
--- /dev/null
+++ b/db/migrate/20211004062942_create_coverage_fuzzing_corpuses.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateCoverageFuzzingCorpuses < Gitlab::Database::Migration[1.0]
+ def change
+ create_table :coverage_fuzzing_corpuses do |t|
+ t.bigint :project_id, null: false
+ t.bigint :user_id
+ t.bigint :package_id, null: false
+
+ t.datetime_with_timezone :file_updated_at, null: false, default: -> { 'NOW()' }
+ t.timestamps_with_timezone null: false
+
+ t.index :project_id
+ t.index :user_id
+ t.index :package_id
+ end
+ end
+end
diff --git a/db/migrate/20211004075629_add_topics_name_gin_index.rb b/db/migrate/20211004075629_add_topics_name_gin_index.rb
new file mode 100644
index 00000000000..94634a4cb2f
--- /dev/null
+++ b/db/migrate/20211004075629_add_topics_name_gin_index.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddTopicsNameGinIndex < Gitlab::Database::Migration[1.0]
+ INDEX_NAME = 'index_topics_on_name_trigram'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :topics, :name, name: INDEX_NAME, using: :gin, opclass: { name: :gin_trgm_ops }
+ end
+
+ def down
+ remove_concurrent_index_by_name :topics, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20211004081911_add_external_event_destination_limit_to_plan_limits.rb b/db/migrate/20211004081911_add_external_event_destination_limit_to_plan_limits.rb
new file mode 100644
index 00000000000..3e44c388617
--- /dev/null
+++ b/db/migrate/20211004081911_add_external_event_destination_limit_to_plan_limits.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddExternalEventDestinationLimitToPlanLimits < Gitlab::Database::Migration[1.0]
+ def change
+ add_column(:plan_limits, :external_audit_event_destinations, :integer, default: 5, null: false)
+ end
+end
diff --git a/db/migrate/20211005063519_add_foreign_key_to_corpuses_on_project.rb b/db/migrate/20211005063519_add_foreign_key_to_corpuses_on_project.rb
new file mode 100644
index 00000000000..ba1fb443343
--- /dev/null
+++ b/db/migrate/20211005063519_add_foreign_key_to_corpuses_on_project.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToCorpusesOnProject < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :coverage_fuzzing_corpuses, :projects, column: :project_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :coverage_fuzzing_corpuses, column: :project_id
+ end
+ end
+end
diff --git a/db/migrate/20211005063616_add_foreign_key_to_corpuses_on_user.rb b/db/migrate/20211005063616_add_foreign_key_to_corpuses_on_user.rb
new file mode 100644
index 00000000000..da08ab97acf
--- /dev/null
+++ b/db/migrate/20211005063616_add_foreign_key_to_corpuses_on_user.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToCorpusesOnUser < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :coverage_fuzzing_corpuses, :users, column: :user_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :coverage_fuzzing_corpuses, column: :user_id
+ end
+ end
+end
diff --git a/db/migrate/20211005063723_add_foreign_key_to_corpuses_on_package.rb b/db/migrate/20211005063723_add_foreign_key_to_corpuses_on_package.rb
new file mode 100644
index 00000000000..74ba7b070d0
--- /dev/null
+++ b/db/migrate/20211005063723_add_foreign_key_to_corpuses_on_package.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToCorpusesOnPackage < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :coverage_fuzzing_corpuses, :packages_packages, column: :package_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :coverage_fuzzing_corpuses, column: :package_id
+ end
+ end
+end
diff --git a/db/migrate/20211005092428_drop_time_range_partitioned_loose_fk.rb b/db/migrate/20211005092428_drop_time_range_partitioned_loose_fk.rb
new file mode 100644
index 00000000000..2aaf5e4cf87
--- /dev/null
+++ b/db/migrate/20211005092428_drop_time_range_partitioned_loose_fk.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class DropTimeRangePartitionedLooseFk < Gitlab::Database::Migration[1.0]
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ def up
+ # the table is not in use
+ drop_table :loose_foreign_keys_deleted_records # rubocop: disable Migration/DropTable
+ end
+
+ def down
+ constraint_name = check_constraint_name('loose_foreign_keys_deleted_records', 'deleted_table_name', 'max_length')
+ execute(<<~SQL)
+ CREATE TABLE loose_foreign_keys_deleted_records (
+ created_at timestamp with time zone NOT NULL DEFAULT NOW(),
+ deleted_table_name text NOT NULL,
+ deleted_table_primary_key_value bigint NOT NULL,
+ PRIMARY KEY (created_at, deleted_table_name, deleted_table_primary_key_value),
+ CONSTRAINT #{constraint_name} CHECK ((char_length(deleted_table_name) <= 63))
+ ) PARTITION BY RANGE (created_at);
+ SQL
+
+ min_date = Date.today - 1.month
+ max_date = Date.today + 3.months
+ create_daterange_partitions('loose_foreign_keys_deleted_records', 'created_at', min_date, max_date)
+ end
+end
diff --git a/db/migrate/20211005093558_add_range_partitioned_loose_fk_table.rb b/db/migrate/20211005093558_add_range_partitioned_loose_fk_table.rb
new file mode 100644
index 00000000000..6f52b6ec63b
--- /dev/null
+++ b/db/migrate/20211005093558_add_range_partitioned_loose_fk_table.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class AddRangePartitionedLooseFkTable < Gitlab::Database::Migration[1.0]
+ include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers
+
+ def up
+ constraint_name = check_constraint_name('loose_foreign_keys_deleted_records', 'fully_qualified_table_name', 'max_length')
+ execute(<<~SQL)
+ CREATE TABLE loose_foreign_keys_deleted_records (
+ id BIGSERIAL NOT NULL,
+ partition bigint NOT NULL,
+ primary_key_value bigint NOT NULL,
+ status smallint NOT NULL DEFAULT 1,
+ created_at timestamp with time zone NOT NULL DEFAULT NOW(),
+ fully_qualified_table_name text NOT NULL,
+ PRIMARY KEY (partition, id),
+ CONSTRAINT #{constraint_name} CHECK ((char_length(fully_qualified_table_name) <= 150))
+ ) PARTITION BY LIST (partition);
+
+ CREATE TABLE gitlab_partitions_static.loose_foreign_keys_deleted_records_1
+ PARTITION OF loose_foreign_keys_deleted_records
+ FOR VALUES IN (1);
+ SQL
+ end
+
+ def down
+ drop_table :loose_foreign_keys_deleted_records
+ end
+end
diff --git a/db/migrate/20211005100112_recreate_loose_fk_insert_function.rb b/db/migrate/20211005100112_recreate_loose_fk_insert_function.rb
new file mode 100644
index 00000000000..b03ad069eba
--- /dev/null
+++ b/db/migrate/20211005100112_recreate_loose_fk_insert_function.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+class RecreateLooseFkInsertFunction < Gitlab::Database::Migration[1.0]
+ include Gitlab::Database::MigrationHelpers::LooseForeignKeyHelpers
+
+ def up
+ execute(<<~SQL)
+ CREATE OR REPLACE FUNCTION #{DELETED_RECORDS_INSERT_FUNCTION_NAME}()
+ RETURNS TRIGGER AS
+ $$
+ BEGIN
+ INSERT INTO loose_foreign_keys_deleted_records
+ (partition, fully_qualified_table_name, primary_key_value)
+ SELECT 1, TG_TABLE_SCHEMA || '.' || TG_TABLE_NAME, old_table.id FROM old_table
+ ON CONFLICT DO NOTHING;
+
+ RETURN NULL;
+ END
+ $$ LANGUAGE PLPGSQL
+ SQL
+ end
+
+ def down
+ # old function
+ execute(<<~SQL)
+ CREATE OR REPLACE FUNCTION #{DELETED_RECORDS_INSERT_FUNCTION_NAME}()
+ RETURNS TRIGGER AS
+ $$
+ BEGIN
+ INSERT INTO loose_foreign_keys_deleted_records
+ (deleted_table_name, deleted_table_primary_key_value)
+ SELECT TG_TABLE_NAME, old_table.id FROM old_table
+ ON CONFLICT DO NOTHING;
+
+ RETURN NULL;
+ END
+ $$ LANGUAGE PLPGSQL
+ SQL
+ end
+end
diff --git a/db/migrate/20211006060254_add_topics_total_projects_count_cache.rb b/db/migrate/20211006060254_add_topics_total_projects_count_cache.rb
new file mode 100644
index 00000000000..ebca4c70879
--- /dev/null
+++ b/db/migrate/20211006060254_add_topics_total_projects_count_cache.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddTopicsTotalProjectsCountCache < Gitlab::Database::Migration[1.0]
+ def up
+ add_column :topics, :total_projects_count, :bigint, null: false, default: 0
+ end
+
+ def down
+ remove_column :topics, :total_projects_count
+ end
+end
diff --git a/db/migrate/20211006103122_change_helm_channel_length.rb b/db/migrate/20211006103122_change_helm_channel_length.rb
new file mode 100644
index 00000000000..6579ca4053b
--- /dev/null
+++ b/db/migrate/20211006103122_change_helm_channel_length.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class ChangeHelmChannelLength < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :packages_helm_file_metadata, :channel, 255, constraint_name: check_constraint_name(:packages_helm_file_metadata, :channel, 'max_length_v2')
+ remove_text_limit :packages_helm_file_metadata, :channel, constraint_name: check_constraint_name(:packages_helm_file_metadata, :channel, 'max_length')
+ end
+
+ def down
+ # no-op: Danger of failing if there are records with length(channel) > 63
+ end
+end
diff --git a/db/migrate/20211006122010_add_topics_total_projects_count_index.rb b/db/migrate/20211006122010_add_topics_total_projects_count_index.rb
new file mode 100644
index 00000000000..bd969a9ff0a
--- /dev/null
+++ b/db/migrate/20211006122010_add_topics_total_projects_count_index.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddTopicsTotalProjectsCountIndex < Gitlab::Database::Migration[1.0]
+ INDEX_NAME = 'index_topics_total_projects_count'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :topics, [:total_projects_count, :id], order: { total_projects_count: :desc }, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :topics, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20211007113136_add_status_column_to_security_scans_table.rb b/db/migrate/20211007113136_add_status_column_to_security_scans_table.rb
new file mode 100644
index 00000000000..d60171dead7
--- /dev/null
+++ b/db/migrate/20211007113136_add_status_column_to_security_scans_table.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddStatusColumnToSecurityScansTable < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :security_scans, :status, :integer, limit: 1, default: 0, null: false
+ end
+end
diff --git a/db/migrate/20211008181451_add_shared_runners_duration_to_ci_namespace_monthly_usages.rb b/db/migrate/20211008181451_add_shared_runners_duration_to_ci_namespace_monthly_usages.rb
new file mode 100644
index 00000000000..862d1a26867
--- /dev/null
+++ b/db/migrate/20211008181451_add_shared_runners_duration_to_ci_namespace_monthly_usages.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddSharedRunnersDurationToCiNamespaceMonthlyUsages < Gitlab::Database::Migration[1.0]
+ enable_lock_retries!
+
+ def change
+ add_column :ci_namespace_monthly_usages, :shared_runners_duration, :integer, default: 0, null: false
+ end
+end
diff --git a/db/migrate/20211008182954_add_shared_runners_duration_to_ci_project_monthly_usages.rb b/db/migrate/20211008182954_add_shared_runners_duration_to_ci_project_monthly_usages.rb
new file mode 100644
index 00000000000..76bb7356f0f
--- /dev/null
+++ b/db/migrate/20211008182954_add_shared_runners_duration_to_ci_project_monthly_usages.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddSharedRunnersDurationToCiProjectMonthlyUsages < Gitlab::Database::Migration[1.0]
+ enable_lock_retries!
+
+ def change
+ add_column :ci_project_monthly_usages, :shared_runners_duration, :integer, default: 0, null: false
+ end
+end
diff --git a/db/migrate/20211012091822_add_text_limit_to_bulk_imports_source_version.rb b/db/migrate/20211012091822_add_text_limit_to_bulk_imports_source_version.rb
new file mode 100644
index 00000000000..9b4fca9a98c
--- /dev/null
+++ b/db/migrate/20211012091822_add_text_limit_to_bulk_imports_source_version.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddTextLimitToBulkImportsSourceVersion < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :bulk_imports, :source_version, 63
+ end
+
+ def down
+ remove_text_limit :bulk_imports, :source_version
+ end
+end