summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /db
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/10_merge_requests.rb2
-rw-r--r--db/fixtures/development/17_cycle_analytics.rb4
-rw-r--r--db/gitlab_structure.sql4
-rw-r--r--db/migrate/20180101160629_create_prometheus_metrics.rb20
-rw-r--r--db/migrate/20180101160630_change_project_id_for_prometheus_metrics.rb11
-rw-r--r--db/migrate/20180102220145_add_pages_https_only_to_projects.rb9
-rw-r--r--db/migrate/20180103123548_add_confidential_note_events_to_services.rb16
-rw-r--r--db/migrate/20180105212544_add_commits_count_to_merge_request_diff.rb29
-rw-r--r--db/migrate/20180109183319_change_default_value_for_pages_https_only.rb13
-rw-r--r--db/migrate/20180113220114_rework_redirect_routes_indexes.rb60
-rw-r--r--db/migrate/20180115094742_add_default_project_creation_setting.rb19
-rw-r--r--db/migrate/20180115113902_add_project_creation_level_to_groups.rb17
-rw-r--r--db/migrate/20180115201419_add_index_updated_at_to_issues.rb15
-rw-r--r--db/migrate/20180116193854_create_lfs_file_locks.rb30
-rw-r--r--db/migrate/20180119135717_add_uploader_index_to_uploads.rb20
-rw-r--r--db/migrate/20180119160751_optimize_ci_job_artifacts.rb23
-rw-r--r--db/migrate/20180122162010_add_auto_devops_domain_to_application_settings.rb15
-rw-r--r--db/migrate/20180125214301_create_user_callouts.rb16
-rw-r--r--db/migrate/20180129193323_add_uploads_builder_context.rb16
-rw-r--r--db/migrate/20180201102129_add_unique_constraint_to_trending_projects_project_id.rb19
-rw-r--r--db/migrate/20180201110056_add_foreign_keys_to_todos.rb38
-rw-r--r--db/migrate/20180201145907_migrate_remaining_issues_closed_at.rb56
-rw-r--r--db/migrate/20180206200543_reset_events_primary_key_sequence.rb21
-rw-r--r--db/migrate/20180208183958_schedule_populate_untracked_uploads_if_needed.rb47
-rw-r--r--db/migrate/20180209115333_create_chatops_tables.rb26
-rw-r--r--db/migrate/20180209165249_add_closed_by_to_issues.rb20
-rw-r--r--db/migrate/20180212030105_add_external_ip_to_clusters_applications_ingress.rb11
-rw-r--r--db/migrate/20180213131630_add_partial_index_to_projects_for_index_only_scans.rb21
-rw-r--r--db/migrate/20180214093516_create_badges.rb21
-rw-r--r--db/migrate/20180214155405_create_clusters_applications_runners.rb32
-rw-r--r--db/migrate/20180215181245_users_name_lower_index.rb21
-rw-r--r--db/migrate/20180216120000_add_pages_domain_verification.rb8
-rw-r--r--db/migrate/20180216120010_add_pages_domain_verified_at_index.rb15
-rw-r--r--db/migrate/20180216120020_allow_domain_verification_to_be_disabled.rb7
-rw-r--r--db/migrate/20180216120030_add_pages_domain_enabled_until.rb7
-rw-r--r--db/migrate/20180216120040_add_pages_domain_enabled_until_index.rb17
-rw-r--r--db/migrate/20180216120050_pages_domains_verification_grace_period.rb26
-rw-r--r--db/migrate/20180219153455_add_maximum_timeout_to_ci_runners.rb9
-rw-r--r--db/migrate/20180221151752_add_allow_maintainer_to_push_to_merge_requests.rb18
-rw-r--r--db/migrate/20180222043024_add_ip_address_to_runner.rb9
-rw-r--r--db/migrate/20180223120443_create_user_interacted_projects_table.rb20
-rw-r--r--db/migrate/20180223144945_add_allow_local_requests_from_hooks_and_services_to_application_settings.rb18
-rw-r--r--db/migrate/20180226050030_add_checksum_to_ci_job_artifacts.rb7
-rw-r--r--db/migrate/20180227182112_add_group_id_to_boards_ce.rb36
-rw-r--r--db/migrate/20180228172924_add_include_private_contributions_to_users.rb7
-rw-r--r--db/migrate/20180301010859_create_ci_builds_metadata_table.rb20
-rw-r--r--db/migrate/20180302152117_ensure_foreign_keys_on_clusters_applications.rb51
-rw-r--r--db/migrate/20180305095250_create_internal_ids_table.rb15
-rw-r--r--db/migrate/20180305144721_add_privileged_to_runner.rb18
-rw-r--r--db/migrate/20180306134842_add_missing_indexes_acts_as_taggable_on_engine.rb21
-rw-r--r--db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb17
-rw-r--r--db/migrate/20180308125206_add_user_internal_regex_to_application_setting.rb15
-rw-r--r--db/migrate/20180309121820_reschedule_commits_count_for_merge_request_diff.rb30
-rw-r--r--db/migrate/20180309160427_add_partial_indexes_on_todos.rb29
-rw-r--r--db/migrate/20180314100728_add_external_authorization_service_timeout_to_application_settings.rb18
-rw-r--r--db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb20
-rw-r--r--db/migrate/20180315160435_add_external_auth_mutual_tls_fields_to_project_settings.rb20
-rw-r--r--db/migrate/20180319190020_create_deploy_tokens.rb21
-rw-r--r--db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb18
-rw-r--r--db/migrate/20180323150945_add_push_to_merge_request_to_notification_settings.rb9
-rw-r--r--db/migrate/20180326202229_create_ci_build_trace_chunks.rb17
-rw-r--r--db/migrate/20180327101207_remove_index_from_events_table.rb18
-rw-r--r--db/migrate/20180330121048_add_issue_due_to_notification_settings.rb9
-rw-r--r--db/migrate/20180403035759_create_project_ci_cd_settings.rb62
-rw-r--r--db/migrate/20180405142733_create_project_deploy_tokens.rb16
-rw-r--r--db/migrate/20180408143354_rename_users_rss_token_to_feed_token.rb16
-rw-r--r--db/migrate/20180413022611_create_missing_namespace_for_internal_users.rb66
-rw-r--r--db/migrate/20180416155103_add_further_scope_columns_to_internal_id_table.rb15
-rw-r--r--db/migrate/20180417090132_add_index_constraints_to_internal_id_table.rb41
-rw-r--r--db/migrate/20180417101040_add_tmp_stage_priority_index_to_ci_builds.rb16
-rw-r--r--db/migrate/20180417101940_add_index_to_ci_stage.rb9
-rw-r--r--db/migrate/20180418053107_add_index_to_ci_job_artifacts_file_store.rb16
-rw-r--r--db/migrate/20180420010016_add_pipeline_build_foreign_key.rb27
-rw-r--r--db/migrate/20180420010616_cleanup_build_stage_migration.rb63
-rw-r--r--db/migrate/20180423204600_add_pages_access_level_to_project_feature.rb20
-rw-r--r--db/migrate/20180424090541_add_enforce_terms_to_application_settings.rb10
-rw-r--r--db/migrate/20180424134533_create_application_setting_terms.rb15
-rw-r--r--db/migrate/20180424160449_add_pipeline_iid_to_ci_pipelines.rb13
-rw-r--r--db/migrate/20180425075446_create_term_agreements.rb29
-rw-r--r--db/migrate/20180425131009_assure_commits_count_for_merge_request_diff.rb27
-rw-r--r--db/migrate/20180425205249_add_index_constraints_to_pipeline_iid.rb15
-rw-r--r--db/migrate/20180426102016_add_accepted_term_to_users.rb23
-rw-r--r--db/migrate/20180430101916_add_runner_type_to_ci_runners.rb9
-rw-r--r--db/migrate/20180502122856_create_project_mirror_data.rb32
-rw-r--r--db/migrate/20180503131624_create_remote_mirrors.rb36
-rw-r--r--db/migrate/20180503141722_add_remote_mirror_available_overridden_to_projects.rb15
-rw-r--r--db/migrate/20180503150427_add_index_to_namespaces_runners_token.rb21
-rw-r--r--db/migrate/20180503175053_ensure_missing_columns_to_project_mirror_data.rb19
-rw-r--r--db/migrate/20180503175054_add_indexes_to_project_mirror_data.rb18
-rw-r--r--db/migrate/20180503193542_add_indexes_to_remote_mirror.rb17
-rw-r--r--db/migrate/20180503193953_add_mirror_available_to_application_settings.rb17
-rw-r--r--db/migrate/20180503200320_enable_prometheus_metrics_by_default.rb11
-rw-r--r--db/migrate/20180504195842_project_name_lower_index.rb24
-rw-r--r--db/migrate/20180508055821_make_remote_mirrors_disabled_by_default.rb11
-rw-r--r--db/migrate/20180508100222_add_not_null_constraint_to_project_mirror_data_foreign_key.rb21
-rw-r--r--db/migrate/20180508102840_add_unique_constraint_to_project_mirror_data_project_id_index.rb31
-rw-r--r--db/migrate/20180508135515_set_runner_type_not_null.rb9
-rw-r--r--db/migrate/20180511090724_add_index_on_ci_runners_runner_type.rb16
-rw-r--r--db/migrate/20180511131058_create_clusters_applications_jupyter.rb25
-rw-r--r--db/migrate/20180515005612_add_squash_to_merge_requests.rb20
-rw-r--r--db/migrate/20180515121227_create_notes_diff_files.rb27
-rw-r--r--db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb24
-rw-r--r--db/migrate/20180523042841_rename_merge_requests_allow_maintainer_to_push.rb17
-rw-r--r--db/migrate/20180524132016_merge_requests_target_id_iid_state_partial_index.rb27
-rw-r--r--db/migrate/20180529093006_ensure_remote_mirror_columns.rb28
-rw-r--r--db/migrate/20180530135500_add_index_to_stages_position.rb15
-rw-r--r--db/migrate/20180531185349_add_repository_languages.rb30
-rw-r--r--db/migrate/20180531220618_change_default_value_for_dsa_key_restriction.rb16
-rw-r--r--db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb19
-rw-r--r--db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb12
-rw-r--r--db/migrate/20180608091413_add_group_to_todos.rb36
-rw-r--r--db/migrate/20180608110058_rename_merge_requests_allow_collaboration.rb22
-rw-r--r--db/migrate/20180612103626_add_columns_for_helm_tiller_certificates.rb14
-rw-r--r--db/migrate/20180613081317_create_ci_builds_runner_session.rb23
-rw-r--r--db/migrate/20180625113853_create_import_export_uploads.rb18
-rw-r--r--db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb18
-rw-r--r--db/migrate/20180628124813_alter_web_hook_logs_indexes.rb28
-rw-r--r--db/migrate/20180629153018_create_site_statistics.rb18
-rw-r--r--db/migrate/20180702124358_remove_orphaned_routes.rb49
-rw-r--r--db/migrate/20180702134423_generate_missing_routes.rb144
-rw-r--r--db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb18
-rw-r--r--db/migrate/20180705160945_add_file_format_to_ci_job_artifacts.rb7
-rw-r--r--db/migrate/20180710162338_add_foreign_key_from_notification_settings_to_users.rb30
-rw-r--r--db/migrate/20180711103851_drop_duplicate_protected_tags.rb38
-rw-r--r--db/migrate/20180711103922_add_protected_tags_index.rb18
-rw-r--r--db/migrate/20180713092803_create_user_statuses.rb22
-rw-r--r--db/migrate/20180717125853_remove_restricted_todos.rb31
-rw-r--r--db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb20
-rw-r--r--db/migrate/20180720023512_add_receive_max_input_size_to_application_settings.rb11
-rw-r--r--db/migrate/20180722103201_add_private_profile_to_users.rb10
-rw-r--r--db/migrate/20180723135214_add_web_ide_client_side_preview_enabled_to_application_settings.rb20
-rw-r--r--db/migrate/20180726172057_create_resource_label_events.rb18
-rw-r--r--db/migrate/20180807153545_remove_redundant_status_index_on_ci_builds.rb17
-rw-r--r--db/migrate/20180808162000_add_user_show_add_ssh_key_message_to_application_settings.rb21
-rw-r--r--db/migrate/20180813101999_change_default_of_auto_devops_instance_wide.rb15
-rw-r--r--db/migrate/20180813102000_enable_auto_devops_instance_wide_for_everyone.rb15
-rw-r--r--db/migrate/20180814153625_add_commit_email_to_users.rb37
-rw-r--r--db/migrate/20180815040323_add_authorization_type_to_cluster_platforms_kubernetes.rb11
-rw-r--r--db/migrate/20180815160409_add_file_location_to_ci_job_artifacts.rb9
-rw-r--r--db/migrate/20180815170510_add_partial_index_to_ci_builds_artifacts_file.rb16
-rw-r--r--db/migrate/20180815175440_add_index_on_list_type.rb16
-rw-r--r--db/migrate/20180824202952_add_outbound_requests_whitelist_to_application_settings.rb11
-rw-r--r--db/migrate/20180831164905_add_common_to_prometheus_metrics.rb17
-rw-r--r--db/migrate/20180831164907_add_index_on_common_for_prometheus_metrics.rb17
-rw-r--r--db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb11
-rw-r--r--db/migrate/20180831164909_add_index_for_identifier_to_prometheus_metric.rb17
-rw-r--r--db/migrate/20180831164910_import_common_metrics.rb15
-rw-r--r--db/migrate/20180901171833_add_project_config_source_status_index_to_pipeline.rb17
-rw-r--r--db/migrate/20180901200537_add_resource_label_event_reference_fields.rb13
-rw-r--r--db/migrate/20180902070406_create_group_group_links.rb32
-rw-r--r--db/migrate/20180906101639_add_user_ping_consent_to_application_settings.rb19
-rw-r--r--db/migrate/20180907015926_add_legacy_abac_to_cluster_providers_gcp.rb17
-rw-r--r--db/migrate/20180910115836_add_attr_encrypted_columns_to_web_hook.rb17
-rw-r--r--db/migrate/20180910153412_add_token_digest_to_personal_access_tokens.rb19
-rw-r--r--db/migrate/20180910153413_add_index_to_token_digest_on_personal_access_tokens.rb17
-rw-r--r--db/migrate/20180912111628_add_knative_application.rb22
-rw-r--r--db/migrate/20180916011959_add_index_pipelines_project_id_source.rb20
-rw-r--r--db/migrate/20180924141949_add_diff_max_patch_bytes_to_application_settings.rb25
-rw-r--r--db/migrate/20180924190739_add_scheduled_at_to_ci_builds.rb9
-rw-r--r--db/migrate/20180924201039_add_partial_index_to_scheduled_at.rb18
-rw-r--r--db/migrate/20180925200829_create_user_preferences.rb31
-rw-r--r--db/migrate/20180927073410_add_index_to_project_deploy_tokens_deploy_token_id.rb17
-rw-r--r--db/migrate/20181002172433_remove_restricted_todos_with_cte.rb32
-rw-r--r--db/migrate/20181005110927_add_index_to_lfs_objects_file_store.rb17
-rw-r--r--db/migrate/20181006004100_import_common_metrics_nginx_vts.rb13
-rw-r--r--db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb26
-rw-r--r--db/migrate/20181010235606_create_board_project_recent_visits.rb19
-rw-r--r--db/migrate/20181014203236_create_cluster_groups.rb17
-rw-r--r--db/migrate/20181015155839_add_finished_at_to_deployments.rb15
-rw-r--r--db/migrate/20181016141739_add_status_to_deployments.rb33
-rw-r--r--db/migrate/20181016152238_create_board_group_recent_visits.rb20
-rw-r--r--db/migrate/20181017001059_add_cluster_type_to_clusters.rb18
-rw-r--r--db/migrate/20181019032400_add_shards_table.rb11
-rw-r--r--db/migrate/20181019032408_add_repositories_table.rb15
-rw-r--r--db/migrate/20181019105553_add_projects_pool_repository_id_foreign_key.rb22
-rw-r--r--db/migrate/20181022135539_add_index_on_status_to_deployments.rb19
-rw-r--r--db/migrate/20181023104858_add_archive_builds_duration_to_application_settings.rb11
-rw-r--r--db/migrate/20181023144439_add_partial_index_for_legacy_successful_deployments.rb18
-rw-r--r--db/migrate/20181025115728_add_private_commit_email_hostname_to_application_settings.rb13
-rw-r--r--db/migrate/20181026143227_migrate_snippets_access_level_default_value.rb42
-rw-r--r--db/migrate/20181027114222_add_first_day_of_week_to_user_preferences.rb9
-rw-r--r--db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb16
-rw-r--r--db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb61
-rw-r--r--db/migrate/20181031145139_add_protected_ci_variables_to_application_settings.rb17
-rw-r--r--db/migrate/20181031190558_drop_fk_gcp_clusters_table.rb37
-rw-r--r--db/migrate/20181031190559_drop_gcp_clusters_table.rb53
-rw-r--r--db/migrate/20181101144347_add_index_for_stuck_mr_query.rb16
-rw-r--r--db/migrate/20181101191341_create_clusters_applications_cert_manager.rb21
-rw-r--r--db/migrate/20181106135939_add_index_to_deployments.rb17
-rw-r--r--db/migrate/20181108091549_cleanup_environments_external_url.rb18
-rw-r--r--db/migrate/20181112103239_drop_default_value_on_status_deployments.rb14
-rw-r--r--db/migrate/20181115140140_add_encrypted_runners_token_to_settings.rb13
-rw-r--r--db/migrate/20181116050532_knative_external_ip.rb16
-rw-r--r--db/migrate/20181116141415_add_encrypted_runners_token_to_namespaces.rb13
-rw-r--r--db/migrate/20181116141504_add_encrypted_runners_token_to_projects.rb15
-rw-r--r--db/migrate/20181119081539_add_merge_request_id_to_ci_pipelines.rb13
-rw-r--r--db/migrate/20181119132520_add_indexes_to_ci_builds_and_pipelines.rb44
-rw-r--r--db/migrate/20181120082911_rename_repositories_pool_repositories.rb11
-rw-r--r--db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb22
-rw-r--r--db/migrate/20181120151656_add_token_encrypted_to_ci_runners.rb11
-rw-r--r--db/migrate/20181121101842_add_ci_builds_partial_index_on_project_id_and_status.rb33
-rw-r--r--db/migrate/20181121101843_remove_redundant_ci_builds_partial_index.rb33
-rw-r--r--db/migrate/20181122160027_create_project_repositories.rb18
-rw-r--r--db/migrate/20181123135036_drop_not_null_constraint_pool_repository_disk_path.rb9
-rw-r--r--db/migrate/20181123144235_create_suggestions.rb24
-rw-r--r--db/migrate/20181126150622_add_events_index_on_project_id_and_created_at.rb32
-rw-r--r--db/migrate/20181126153547_remove_notes_index_on_updated_at.rb32
-rw-r--r--db/migrate/20181128123704_add_state_to_pool_repository.rb23
-rw-r--r--db/migrate/20181129104854_add_token_encrypted_to_ci_builds.rb15
-rw-r--r--db/migrate/20181129104944_add_index_to_ci_builds_token_encrypted.rb17
-rw-r--r--db/migrate/20181203002526_add_project_bfg_object_map_column.rb13
-rw-r--r--db/migrate/20181205171941_create_project_daily_statistics.rb18
-rw-r--r--db/migrate/20181211092510_add_name_author_id_and_sha_to_releases.rb15
-rw-r--r--db/migrate/20181211092514_add_author_id_index_and_fk_to_releases.rb21
-rw-r--r--db/migrate/20181212104941_backfill_releases_name_with_tag_name.rb17
-rw-r--r--db/migrate/20181212171634_create_error_tracking_settings.rb19
-rw-r--r--db/migrate/20181219145521_add_options_to_build_metadata.rb15
-rw-r--r--db/migrate/20181228175414_create_releases_link_table.rb21
-rw-r--r--db/migrate/20181228175414_init_schema.rb (renamed from db/migrate/20171230123729_init_schema.rb)1655
-rw-r--r--db/migrate/20190315191339_create_merge_request_assignees_table.rb2
-rw-r--r--db/migrate/20190402150158_backport_enterprise_schema.rb2
-rw-r--r--db/migrate/20190722144316_create_milestone_releases_table.rb2
-rw-r--r--db/migrate/20190927055500_create_description_versions.rb2
-rw-r--r--db/migrate/20191118053631_add_group_deletion_schedules.rb2
-rw-r--r--db/migrate/20191127151619_create_gitlab_subscription_histories.rb2
-rw-r--r--db/migrate/20200123091622_drop_analytics_repository_files_table.rb2
-rw-r--r--db/migrate/20200123091734_drop_analytics_repository_file_commits_table.rb2
-rw-r--r--db/migrate/20200123091854_drop_analytics_repository_file_edits_table.rb2
-rw-r--r--db/migrate/20200214025454_add_canonical_emails.rb2
-rw-r--r--db/migrate/20200215225103_drop_forked_project_links_table.rb2
-rw-r--r--db/migrate/20200227165129_create_user_details.rb2
-rw-r--r--db/migrate/20200306160521_add_index_on_author_id_and_created_at_to_events.rb5
-rw-r--r--db/migrate/20200311093210_create_user_highest_roles.rb2
-rw-r--r--db/migrate/20200325094612_add_allow_merge_on_skipped_pipeline_to_project_settings.rb9
-rw-r--r--db/migrate/20200326122700_create_diff_note_positions.rb2
-rw-r--r--db/migrate/20200330203826_drop_fk_in_ci_ref.rb32
-rw-r--r--db/migrate/20200330203837_recreate_ci_ref.rb45
-rw-r--r--db/migrate/20200331103637_add_ci_ref_id_to_ci_pipelines.rb19
-rw-r--r--db/migrate/20200331113728_add_index_to_ci_ref_id.rb16
-rw-r--r--db/migrate/20200331113738_add_fk_to_ci_ref_id.rb18
-rw-r--r--db/migrate/20200331132103_add_project_compliance_framework_settings_table.rb2
-rw-r--r--db/migrate/20200407182205_create_partitioned_foreign_keys.rb2
-rw-r--r--db/migrate/20200407222647_create_project_repository_storage_moves.rb2
-rw-r--r--db/migrate/20200408125046_create_ci_freeze_periods.rb2
-rw-r--r--db/migrate/20200416005331_create_status_page_published_incidents.rb2
-rw-r--r--db/migrate/20200417044453_create_alert_management_alerts.rb2
-rw-r--r--db/migrate/20200420104303_add_group_import_states_table.rb2
-rw-r--r--db/migrate/20200420115948_create_metrics_users_starred_dashboard.rb2
-rw-r--r--db/migrate/20200421054930_remove_index_on_pipeline_id_from_ci_pipeline_variables.rb18
-rw-r--r--db/migrate/20200421054948_remove_index_on_pipeline_id_from_ci_variables.rb18
-rw-r--r--db/migrate/20200422091541_create_ci_instance_variables.rb2
-rw-r--r--db/migrate/20200424135319_create_nuget_dependency_link_metadata.rb4
-rw-r--r--db/migrate/20200429023324_add_composer_metadata.rb12
-rw-r--r--db/migrate/20200430123614_create_project_access_tokens.rb14
-rw-r--r--db/migrate/20200430130048_create_packages_nuget_metadata.rb2
-rw-r--r--db/migrate/20200430174637_create_group_deploy_keys.rb38
-rw-r--r--db/migrate/20200507221434_add_container_registry_features_to_application_settings.rb2
-rw-r--r--db/migrate/20200508021128_remove_ultraauth_provider_from_identities.rb18
-rw-r--r--db/migrate/20200508050301_add_spam_check_endpoint_to_application_settings.rb34
-rw-r--r--db/migrate/20200508140959_add_elasticsearch_pause_indexing_to_application_settings.rb19
-rw-r--r--db/migrate/20200508203901_add_repository_storages_weighted_to_application_settings.rb13
-rw-r--r--db/migrate/20200511181027_create_test_reports.rb18
-rw-r--r--db/migrate/20200511191027_add_author_foreign_key_to_test_reports.rb19
-rw-r--r--db/migrate/20200511208012_add_pipeline_foreign_key_to_test_reports.rb19
-rw-r--r--db/migrate/20200512160004_add_index_to_ci_job_artifacts_for_terraform_reports.rb18
-rw-r--r--db/migrate/20200512195442_update_index_on_name_type_eq_ci_build_to_ci_builds.rb36
-rw-r--r--db/migrate/20200518091745_add_index_to_personal_access_token_impersonation.rb26
-rw-r--r--db/migrate/20200519074709_update_resource_state_events_constraint_to_support_epic_id.rb24
-rw-r--r--db/migrate/20200519101002_add_error_message_column_to_jira_imports.rb22
-rw-r--r--db/migrate/20200519115908_add_epics_confidential_index.rb (renamed from db/migrate/20181005125926_add_index_to_uploads_store.rb)6
-rw-r--r--db/migrate/20200519141534_add_instance_level_variables_column_to_plan_limits.rb9
-rw-r--r--db/migrate/20200519194042_update_container_expiration_policies_defaults.rb23
-rw-r--r--db/migrate/20200520103514_add_todo_resolved_by_action.rb19
-rw-r--r--db/migrate/20200521022725_add_experience_level_to_user_preferences.rb9
-rw-r--r--db/migrate/20200521225327_create_alert_management_alert_assignees.rb24
-rw-r--r--db/migrate/20200521225337_add_foreign_key_to_user_id_on_alert_management_alert_assignees.rb19
-rw-r--r--db/migrate/20200521225346_add_foreign_key_to_alert_id_on_alert_mangagement_alert_assignees.rb19
-rw-r--r--db/migrate/20200522235146_add_index_on_snippet_type_and_id.rb17
-rw-r--r--db/migrate/20200525114553_rename_user_type_index.rb19
-rw-r--r--db/migrate/20200526013844_add_alert_events_to_services.rb19
-rw-r--r--db/migrate/20200526120714_change_partial_indexes_on_services.rb26
-rw-r--r--db/migrate/20200526142550_drop_null_constraint_on_group_import_state_jid.rb13
-rw-r--r--db/migrate/20200526153844_add_issues_last_edited_by_id_index.rb19
-rw-r--r--db/migrate/20200526164946_create_operations_feature_flags_issues.rb15
-rw-r--r--db/migrate/20200526164947_add_foreign_key_to_ops_feature_flags_issues.rb19
-rw-r--r--db/migrate/20200527092027_add_link_type_to_release_links.rb19
-rw-r--r--db/migrate/20200527135313_add_requirements_build_reference.rb23
-rw-r--r--db/migrate/20200527151413_create_ci_build_report_results_table.rb13
-rw-r--r--db/migrate/20200527152116_add_foreign_key_to_build_id_on_build_report_results.rb19
-rw-r--r--db/migrate/20200527152657_add_foreign_key_to_project_id_on_build_report_results.rb19
-rw-r--r--db/migrate/20200527170649_create_alert_management_alert_user_mentions.rb20
-rw-r--r--db/migrate/20200527211000_add_max_import_size.rb15
-rw-r--r--db/migrate/20200528054112_add_index_to_package_name.rb19
-rw-r--r--db/migrate/20200528125905_add_project_id_user_id_status_ref_index_to_ci_pipelines.rb27
-rw-r--r--db/migrate/20200528171933_remove_not_null_from_external_dashboard_url.rb12
-rw-r--r--db/migrate/20200601210148_add_dashboard_timezone_to_project_metrics_setting.rb12
-rw-r--r--db/migrate/20200603073101_change_constraint_name_on_resource_state_events.rb16
-rw-r--r--db/migrate/20200603180338_add_enforce_pat_expiration_to_application_settings.rb9
-rw-r--r--db/migrate/20200604143628_create_project_security_settings.rb29
-rw-r--r--db/migrate/20200604145731_create_board_user_preferences.rb22
-rw-r--r--db/migrate/20200604174544_add_users_foreign_key_to_board_user_preferences.rb19
-rw-r--r--db/migrate/20200604174558_add_boards_foreign_key_to_board_user_preferences.rb19
-rw-r--r--db/migrate/20200605003204_add_foreign_key_to_alert_management_alert_user_mentions.rb19
-rw-r--r--db/migrate/20200605093113_add_ip_address_to_audit_events.rb9
-rw-r--r--db/migrate/20200608214008_change_column_default_project_incident_management_settings.rb13
-rw-r--r--db/migrate/20200609142506_remove_not_null_constraint_from_weight_events_table.rb9
-rw-r--r--db/migrate/20200609142507_remove_not_null_constraint_from_milestone_events_table.rb9
-rw-r--r--db/migrate/20200609142508_remove_not_null_constraint_from_state_events_table.rb9
-rw-r--r--db/migrate/20200609212701_add_incident_settings_to_all_existing_projects.rb40
-rw-r--r--db/migrate/20200615083635_add_composer_json_to_metadata.rb9
-rw-r--r--db/migrate/20200615121217_add_projects_foreign_key_to_project_access_tokens.rb17
-rw-r--r--db/migrate/20200615123055_add_personal_access_token_foreign_key_to_project_access_tokens.rb17
-rw-r--r--db/migrate/20200615232735_add_index_to_composer_metadata.rb17
-rw-r--r--db/post_migrate/20180104131052_schedule_set_confidential_note_events_on_webhooks.rb23
-rw-r--r--db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb58
-rw-r--r--db/post_migrate/20180122154930_schedule_set_confidential_note_events_on_services.rb23
-rw-r--r--db/post_migrate/20180204200836_change_author_id_to_not_null_in_todos.rb26
-rw-r--r--db/post_migrate/20180212101828_add_tmp_partial_null_index_to_builds.rb14
-rw-r--r--db/post_migrate/20180212101928_schedule_build_stage_migration.rb14
-rw-r--r--db/post_migrate/20180212102028_remove_tmp_partial_null_index_from_builds.rb14
-rw-r--r--db/post_migrate/20180216121020_fill_pages_domain_verification_code.rb41
-rw-r--r--db/post_migrate/20180216121030_enqueue_verify_pages_domain_workers.rb16
-rw-r--r--db/post_migrate/20180220150310_remove_empty_extern_uid_auth0_identities.rb25
-rw-r--r--db/post_migrate/20180223124427_build_user_interacted_projects_table.rb139
-rw-r--r--db/post_migrate/20180301084653_change_project_namespace_id_not_null.rb29
-rw-r--r--db/post_migrate/20180305100050_remove_permanent_from_redirect_routes.rb33
-rw-r--r--db/post_migrate/20180306074045_migrate_create_trace_artifact_sidekiq_queue.rb13
-rw-r--r--db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb31
-rw-r--r--db/post_migrate/20180307012445_migrate_update_head_pipeline_for_merge_request_sidekiq_queue.rb15
-rw-r--r--db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb33
-rw-r--r--db/post_migrate/20180408143355_cleanup_users_rss_token_rename.rb14
-rw-r--r--db/post_migrate/20180409170809_populate_missing_project_ci_cd_settings.rb30
-rw-r--r--db/post_migrate/20180420080616_schedule_stages_index_migration.rb29
-rw-r--r--db/post_migrate/20180424151928_fill_file_store.rb72
-rw-r--r--db/post_migrate/20180430143705_backfill_runner_type_for_ci_runners_post_migrate.rb24
-rw-r--r--db/post_migrate/20180507083701_set_minimal_project_build_timeout.rb21
-rw-r--r--db/post_migrate/20180511174224_add_unique_constraint_to_project_features_project_id.rb43
-rw-r--r--db/post_migrate/20180512061621_add_not_null_constraint_to_project_features_project_id.rb21
-rw-r--r--db/post_migrate/20180514161336_remove_gemnasium_service.rb15
-rw-r--r--db/post_migrate/20180523125103_cleanup_merge_requests_allow_maintainer_to_push_rename.rb18
-rw-r--r--db/post_migrate/20180529152628_schedule_to_archive_legacy_traces.rb35
-rw-r--r--db/post_migrate/20180603190921_migrate_object_storage_upload_sidekiq_queue.rb16
-rw-r--r--db/post_migrate/20180604123514_cleanup_stages_position_migration.rb45
-rw-r--r--db/post_migrate/20180608201435_cleanup_merge_requests_allow_collaboration_rename.rb20
-rw-r--r--db/post_migrate/20180629191052_add_partial_index_to_projects_for_last_repository_check_at.rb18
-rw-r--r--db/post_migrate/20180702120647_enqueue_fix_cross_project_label_links.rb30
-rw-r--r--db/post_migrate/20180704145007_update_project_indexes.rb23
-rw-r--r--db/post_migrate/20180706223200_populate_site_statistics.rb25
-rw-r--r--db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb32
-rw-r--r--db/post_migrate/20180816161409_migrate_legacy_artifacts_to_job_artifacts.rb32
-rw-r--r--db/post_migrate/20180816193530_rename_login_root_namespaces.rb22
-rw-r--r--db/post_migrate/20180826111825_recalculate_site_statistics.rb27
-rw-r--r--db/post_migrate/20180913142237_schedule_digest_personal_access_tokens.rb28
-rw-r--r--db/post_migrate/20180914162043_encrypt_web_hooks_columns.rb33
-rw-r--r--db/post_migrate/20180914201132_remove_sidekiq_throttling_from_application_settings.rb17
-rw-r--r--db/post_migrate/20180917172041_remove_wikis_count_from_site_statistics.rb6
-rw-r--r--db/post_migrate/20181008145341_steal_encrypt_columns.rb15
-rw-r--r--db/post_migrate/20181008145359_remove_web_hooks_token_and_url.rb10
-rw-r--r--db/post_migrate/20181008200441_remove_circuit_breaker.rb32
-rw-r--r--db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb27
-rw-r--r--db/post_migrate/20181013005024_remove_koding_from_application_settings.rb17
-rw-r--r--db/post_migrate/20181022173835_enqueue_populate_cluster_kubernetes_namespace.rb18
-rw-r--r--db/post_migrate/20181026091631_migrate_forbidden_redirect_uris.rb32
-rw-r--r--db/post_migrate/20181030135124_fill_empty_finished_at_in_deployments.rb27
-rw-r--r--db/post_migrate/20181101091005_steal_digest_column.rb17
-rw-r--r--db/post_migrate/20181101091124_remove_token_from_personal_access_tokens.rb11
-rw-r--r--db/post_migrate/20181105201455_steal_fill_store_upload.rb31
-rw-r--r--db/post_migrate/20181107054254_remove_restricted_todos_again.rb32
-rw-r--r--db/post_migrate/20181121111200_schedule_runners_token_encryption.rb38
-rw-r--r--db/post_migrate/20181123042307_drop_site_statistics.rb22
-rw-r--r--db/post_migrate/20181130102132_backfill_hashed_project_repositories.rb26
-rw-r--r--db/post_migrate/20181219130552_update_project_import_visibility_level.rb60
-rw-r--r--db/post_migrate/20181219145520_migrate_cluster_configure_worker_sidekiq_queue.rb15
-rw-r--r--db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb2
-rw-r--r--db/post_migrate/20200406102120_backfill_deployment_clusters_from_deployments.rb2
-rw-r--r--db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb27
-rw-r--r--db/post_migrate/20200421195234_backfill_status_page_published_incidents.rb48
-rw-r--r--db/post_migrate/20200518114540_schedule_fix_ruby_object_in_audit_events.rb41
-rw-r--r--db/post_migrate/20200518133123_add_index_on_starting_ending_at_to_metrics_dashboard_annotations.rb18
-rw-r--r--db/post_migrate/20200519171058_update_index_ci_builds_on_commit_id_and_artifacts_expireatandidpartial.rb35
-rw-r--r--db/post_migrate/20200525121014_drop_users_ghost_column.rb29
-rw-r--r--db/post_migrate/20200525144525_migrate_stuck_import_jobs_queue_to_stuck_project_import_jobs.rb15
-rw-r--r--db/post_migrate/20200526000407_seed_repository_storages_weighted.rb23
-rw-r--r--db/post_migrate/20200527094322_drop_vulnerability_confidence_index.rb20
-rw-r--r--db/post_migrate/20200527095401_drop_vulnerability_occurrence_confidence_index.rb20
-rw-r--r--db/post_migrate/20200528123703_add_merge_request_partial_index_to_events.rb24
-rw-r--r--db/post_migrate/20200602013900_add_limit_to_designs_filename.rb17
-rw-r--r--db/post_migrate/20200602013901_cap_designs_filename_length_to_new_limit.rb40
-rw-r--r--db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb178
-rw-r--r--db/post_migrate/20200608072931_backfill_imported_snippet_repositories.rb47
-rw-r--r--db/post_migrate/20200608075553_add_index_on_user_id_and_created_at_and_source_to_ci_pipelines.rb19
-rw-r--r--db/post_migrate/20200609002841_add_partial_index_on_locked_state_id_to_merge_requests.rb19
-rw-r--r--db/structure.sql793
393 files changed, 3584 insertions, 7112 deletions
diff --git a/db/fixtures/development/10_merge_requests.rb b/db/fixtures/development/10_merge_requests.rb
index 9157045a7fd..8cda3eb51be 100644
--- a/db/fixtures/development/10_merge_requests.rb
+++ b/db/fixtures/development/10_merge_requests.rb
@@ -19,7 +19,7 @@ Gitlab::Seeder.quiet do
target_branch = branches.pop
label_ids = project.labels.pluck(:id).sample(3)
- label_ids += project.group.labels.sample(3) if project.group
+ label_ids += project.group.labels.sample(3).pluck(:id) if project.group
params = {
source_branch: source_branch,
diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb
index f5dc2b558d4..57993061c58 100644
--- a/db/fixtures/development/17_cycle_analytics.rb
+++ b/db/fixtures/development/17_cycle_analytics.rb
@@ -107,6 +107,10 @@ class Gitlab::Seeder::CycleAnalytics
pipeline = FactoryBot.create(:ci_pipeline, :success, project: project)
build = FactoryBot.create(:ci_build, pipeline: pipeline, project: project, user: developers.sample)
+ # Required because seeds run in a transaction and these are now
+ # created in an `after_commit` hook.
+ merge_request.ensure_metrics
+
merge_request.metrics.update!(
latest_build_started_at: merge_request.created_at,
latest_build_finished_at: within_end_time(merge_request.created_at + TEST_STAGE_MAX_DURATION_IN_HOURS.hours),
diff --git a/db/gitlab_structure.sql b/db/gitlab_structure.sql
new file mode 100644
index 00000000000..35c7a2eb14e
--- /dev/null
+++ b/db/gitlab_structure.sql
@@ -0,0 +1,4 @@
+-- this file tracks custom GitLab data, such as foreign keys referencing partitioned tables
+-- more details can be found in the issue: https://gitlab.com/gitlab-org/gitlab/-/issues/201872
+SET search_path=public;
+
diff --git a/db/migrate/20180101160629_create_prometheus_metrics.rb b/db/migrate/20180101160629_create_prometheus_metrics.rb
deleted file mode 100644
index f94abd0e76e..00000000000
--- a/db/migrate/20180101160629_create_prometheus_metrics.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class CreatePrometheusMetrics < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :prometheus_metrics do |t|
- t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: false
- 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, index: true
- t.timestamps_with_timezone null: false
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180101160630_change_project_id_for_prometheus_metrics.rb b/db/migrate/20180101160630_change_project_id_for_prometheus_metrics.rb
deleted file mode 100644
index d225899af18..00000000000
--- a/db/migrate/20180101160630_change_project_id_for_prometheus_metrics.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeProjectIdForPrometheusMetrics < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- change_column_null :prometheus_metrics, :project_id, true
- end
-end
diff --git a/db/migrate/20180102220145_add_pages_https_only_to_projects.rb b/db/migrate/20180102220145_add_pages_https_only_to_projects.rb
deleted file mode 100644
index 7bd646cd5fd..00000000000
--- a/db/migrate/20180102220145_add_pages_https_only_to_projects.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddPagesHttpsOnlyToProjects < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :projects, :pages_https_only, :boolean # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20180103123548_add_confidential_note_events_to_services.rb b/db/migrate/20180103123548_add_confidential_note_events_to_services.rb
deleted file mode 100644
index 02724575e6c..00000000000
--- a/db/migrate/20180103123548_add_confidential_note_events_to_services.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class AddConfidentialNoteEventsToServices < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column :services, :confidential_note_events, :boolean
- change_column_default :services, :confidential_note_events, true
- end
-
- def down
- remove_column :services, :confidential_note_events
- end
-end
diff --git a/db/migrate/20180105212544_add_commits_count_to_merge_request_diff.rb b/db/migrate/20180105212544_add_commits_count_to_merge_request_diff.rb
deleted file mode 100644
index e27eecde906..00000000000
--- a/db/migrate/20180105212544_add_commits_count_to_merge_request_diff.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-class AddCommitsCountToMergeRequestDiff < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- MIGRATION = 'AddMergeRequestDiffCommitsCount'.freeze
- BATCH_SIZE = 5000
- DELAY_INTERVAL = 5.minutes.to_i
-
- class MergeRequestDiff < ActiveRecord::Base
- self.table_name = 'merge_request_diffs'
-
- include ::EachBatch
- end
-
- disable_ddl_transaction!
-
- def up
- add_column :merge_request_diffs, :commits_count, :integer
-
- say 'Populating the MergeRequestDiff `commits_count`'
-
- queue_background_migration_jobs_by_range_at_intervals(MergeRequestDiff, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE)
- end
-
- def down
- remove_column :merge_request_diffs, :commits_count
- end
-end
diff --git a/db/migrate/20180109183319_change_default_value_for_pages_https_only.rb b/db/migrate/20180109183319_change_default_value_for_pages_https_only.rb
deleted file mode 100644
index 558eb60ac3f..00000000000
--- a/db/migrate/20180109183319_change_default_value_for_pages_https_only.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class ChangeDefaultValueForPagesHttpsOnly < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- change_column_default :projects, :pages_https_only, true
- end
-
- def down
- change_column_default :projects, :pages_https_only, nil
- end
-end
diff --git a/db/migrate/20180113220114_rework_redirect_routes_indexes.rb b/db/migrate/20180113220114_rework_redirect_routes_indexes.rb
deleted file mode 100644
index ca7ce6286dc..00000000000
--- a/db/migrate/20180113220114_rework_redirect_routes_indexes.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class ReworkRedirectRoutesIndexes < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- INDEX_NAME_UNIQUE = "index_redirect_routes_on_path_unique_text_pattern_ops"
-
- INDEX_NAME_PERM = "index_redirect_routes_on_path_text_pattern_ops_where_permanent"
- INDEX_NAME_TEMP = "index_redirect_routes_on_path_text_pattern_ops_where_temporary"
-
- OLD_INDEX_NAME_PATH_TPOPS = "index_redirect_routes_on_path_text_pattern_ops"
- OLD_INDEX_NAME_PATH_LOWER = "index_on_redirect_routes_lower_path"
-
- def up
- disable_statement_timeout do
- # this is a plain btree on a single boolean column. It'll never be
- # selective enough to be valuable.
- if index_exists?(:redirect_routes, :permanent)
- remove_concurrent_index(:redirect_routes, :permanent)
- end
-
- if_not_exists = Gitlab::Database.version.to_f >= 9.5 ? "IF NOT EXISTS" : ""
-
- # Unique index on lower(path) across both types of redirect_routes:
- execute("CREATE UNIQUE INDEX CONCURRENTLY #{if_not_exists} #{INDEX_NAME_UNIQUE} ON redirect_routes (lower(path) varchar_pattern_ops);")
-
- # Make two indexes on path -- one for permanent and one for temporary routes:
- execute("CREATE INDEX CONCURRENTLY #{if_not_exists} #{INDEX_NAME_PERM} ON redirect_routes (lower(path) varchar_pattern_ops) where (permanent);")
- execute("CREATE INDEX CONCURRENTLY #{if_not_exists} #{INDEX_NAME_TEMP} ON redirect_routes (lower(path) varchar_pattern_ops) where (not permanent or permanent is null) ;")
-
- # Remove the old indexes:
-
- # This one needed to be on lower(path) but wasn't so it's replaced with the two above
- execute "DROP INDEX CONCURRENTLY IF EXISTS #{OLD_INDEX_NAME_PATH_TPOPS};"
-
- # This one isn't needed because we only ever do = and LIKE on this
- # column so the varchar_pattern_ops index is sufficient
- execute "DROP INDEX CONCURRENTLY IF EXISTS #{OLD_INDEX_NAME_PATH_LOWER};"
- end
- end
-
- def down
- disable_statement_timeout do
- add_concurrent_index(:redirect_routes, :permanent)
-
- execute("CREATE INDEX CONCURRENTLY #{OLD_INDEX_NAME_PATH_TPOPS} ON redirect_routes (path varchar_pattern_ops);")
- execute("CREATE INDEX CONCURRENTLY #{OLD_INDEX_NAME_PATH_LOWER} ON redirect_routes (LOWER(path));")
-
- execute("DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME_UNIQUE};")
- execute("DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME_PERM};")
- execute("DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME_TEMP};")
- end
- end
-end
diff --git a/db/migrate/20180115094742_add_default_project_creation_setting.rb b/db/migrate/20180115094742_add_default_project_creation_setting.rb
deleted file mode 100644
index b19e588ece3..00000000000
--- a/db/migrate/20180115094742_add_default_project_creation_setting.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-class AddDefaultProjectCreationSetting < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- unless column_exists?(:application_settings, :default_project_creation)
- add_column_with_default(:application_settings, :default_project_creation, :integer, default: 2) # rubocop:disable Migration/AddColumnWithDefault
- end
- end
-
- def down
- if column_exists?(:application_settings, :default_project_creation)
- remove_column(:application_settings, :default_project_creation)
- end
- end
-end
diff --git a/db/migrate/20180115113902_add_project_creation_level_to_groups.rb b/db/migrate/20180115113902_add_project_creation_level_to_groups.rb
deleted file mode 100644
index a10ce54087c..00000000000
--- a/db/migrate/20180115113902_add_project_creation_level_to_groups.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class AddProjectCreationLevelToGroups < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- unless column_exists?(:namespaces, :project_creation_level)
- add_column(:namespaces, :project_creation_level, :integer)
- end
- end
-
- def down
- if column_exists?(:namespaces, :project_creation_level)
- remove_column(:namespaces, :project_creation_level, :integer)
- end
- end
-end
diff --git a/db/migrate/20180115201419_add_index_updated_at_to_issues.rb b/db/migrate/20180115201419_add_index_updated_at_to_issues.rb
deleted file mode 100644
index 8707307eed0..00000000000
--- a/db/migrate/20180115201419_add_index_updated_at_to_issues.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class AddIndexUpdatedAtToIssues < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :issues, :updated_at
- end
-
- def down
- remove_concurrent_index :issues, :updated_at
- end
-end
diff --git a/db/migrate/20180116193854_create_lfs_file_locks.rb b/db/migrate/20180116193854_create_lfs_file_locks.rb
deleted file mode 100644
index 6d49281dca2..00000000000
--- a/db/migrate/20180116193854_create_lfs_file_locks.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-class CreateLfsFileLocks < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- create_table :lfs_file_locks do |t|
- t.references :project, null: false, foreign_key: { on_delete: :cascade }
- t.references :user, null: false, index: true, foreign_key: { on_delete: :cascade }
- t.datetime :created_at, null: false # rubocop:disable Migration/Datetime
- t.string :path, limit: 511 # rubocop:disable Migration/PreventStrings
- end
-
- add_index :lfs_file_locks, [:project_id, :path], unique: true
- end
-
- def down
- if foreign_keys_for(:lfs_file_locks, :project_id).any?
- remove_foreign_key :lfs_file_locks, column: :project_id
- end
-
- if index_exists?(:lfs_file_locks, [:project_id, :path])
- remove_concurrent_index :lfs_file_locks, [:project_id, :path]
- end
-
- drop_table :lfs_file_locks
- end
-end
diff --git a/db/migrate/20180119135717_add_uploader_index_to_uploads.rb b/db/migrate/20180119135717_add_uploader_index_to_uploads.rb
deleted file mode 100644
index 7dd0a06e3bf..00000000000
--- a/db/migrate/20180119135717_add_uploader_index_to_uploads.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddUploaderIndexToUploads < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index :uploads, :path
- add_concurrent_index :uploads, [:uploader, :path], using: :btree
- end
-
- def down
- remove_concurrent_index :uploads, [:uploader, :path]
- add_concurrent_index :uploads, :path, using: :btree
- end
-end
diff --git a/db/migrate/20180119160751_optimize_ci_job_artifacts.rb b/db/migrate/20180119160751_optimize_ci_job_artifacts.rb
deleted file mode 100644
index 3598689d78c..00000000000
--- a/db/migrate/20180119160751_optimize_ci_job_artifacts.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class OptimizeCiJobArtifacts < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- # job_id is just here to be a covering index for index only scans
- # since we'll almost always be joining against ci_builds on job_id
- add_concurrent_index(:ci_job_artifacts, [:expire_at, :job_id])
- add_concurrent_index(:ci_builds, [:artifacts_expire_at], where: "artifacts_file <> ''")
- end
-
- def down
- remove_concurrent_index(:ci_job_artifacts, [:expire_at, :job_id])
- remove_concurrent_index(:ci_builds, [:artifacts_expire_at], where: "artifacts_file <> ''")
- end
-end
diff --git a/db/migrate/20180122162010_add_auto_devops_domain_to_application_settings.rb b/db/migrate/20180122162010_add_auto_devops_domain_to_application_settings.rb
deleted file mode 100644
index 603f4eb13db..00000000000
--- a/db/migrate/20180122162010_add_auto_devops_domain_to_application_settings.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddAutoDevopsDomainToApplicationSettings < ActiveRecord::Migration[4.2]
- 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, :auto_devops_domain, :string
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180125214301_create_user_callouts.rb b/db/migrate/20180125214301_create_user_callouts.rb
deleted file mode 100644
index 6eb2f932ccc..00000000000
--- a/db/migrate/20180125214301_create_user_callouts.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreateUserCallouts < ActiveRecord::Migration[4.2]
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def change
- create_table :user_callouts do |t|
- t.integer :feature_name, null: false
- t.references :user, index: true, foreign_key: { on_delete: :cascade }, null: false
- end
-
- add_index :user_callouts, [:user_id, :feature_name], unique: true
- end
-end
diff --git a/db/migrate/20180129193323_add_uploads_builder_context.rb b/db/migrate/20180129193323_add_uploads_builder_context.rb
deleted file mode 100644
index 308b732dca4..00000000000
--- a/db/migrate/20180129193323_add_uploads_builder_context.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddUploadsBuilderContext < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :uploads, :mount_point, :string
- add_column :uploads, :secret, :string
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180201102129_add_unique_constraint_to_trending_projects_project_id.rb b/db/migrate/20180201102129_add_unique_constraint_to_trending_projects_project_id.rb
deleted file mode 100644
index 1f2a79d36a5..00000000000
--- a/db/migrate/20180201102129_add_unique_constraint_to_trending_projects_project_id.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-class AddUniqueConstraintToTrendingProjectsProjectId < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :trending_projects, :project_id, unique: true, name: 'index_trending_projects_on_project_id_unique'
- remove_concurrent_index_by_name :trending_projects, 'index_trending_projects_on_project_id'
- rename_index :trending_projects, 'index_trending_projects_on_project_id_unique', 'index_trending_projects_on_project_id'
- end
-
- def down
- rename_index :trending_projects, 'index_trending_projects_on_project_id', 'index_trending_projects_on_project_id_old'
- add_concurrent_index :trending_projects, :project_id
- remove_concurrent_index_by_name :trending_projects, 'index_trending_projects_on_project_id_old'
- end
-end
diff --git a/db/migrate/20180201110056_add_foreign_keys_to_todos.rb b/db/migrate/20180201110056_add_foreign_keys_to_todos.rb
deleted file mode 100644
index 6b217632a52..00000000000
--- a/db/migrate/20180201110056_add_foreign_keys_to_todos.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-class AddForeignKeysToTodos < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- class Todo < ActiveRecord::Base
- self.table_name = 'todos'
- include EachBatch
- end
-
- BATCH_SIZE = 1000
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- Todo.where('NOT EXISTS ( SELECT true FROM users WHERE id=todos.user_id )').each_batch(of: BATCH_SIZE) do |batch|
- batch.delete_all
- end
-
- Todo.where('NOT EXISTS ( SELECT true FROM users WHERE id=todos.author_id )').each_batch(of: BATCH_SIZE) do |batch|
- batch.delete_all
- end
-
- Todo.where('note_id IS NOT NULL AND NOT EXISTS ( SELECT true FROM notes WHERE id=todos.note_id )').each_batch(of: BATCH_SIZE) do |batch|
- batch.delete_all
- end
-
- add_concurrent_foreign_key :todos, :users, column: :user_id, on_delete: :cascade
- add_concurrent_foreign_key :todos, :users, column: :author_id, on_delete: :cascade
- add_concurrent_foreign_key :todos, :notes, column: :note_id, on_delete: :cascade
- end
-
- def down
- remove_foreign_key :todos, column: :user_id
- remove_foreign_key :todos, column: :author_id
- remove_foreign_key :todos, :notes
- end
-end
diff --git a/db/migrate/20180201145907_migrate_remaining_issues_closed_at.rb b/db/migrate/20180201145907_migrate_remaining_issues_closed_at.rb
deleted file mode 100644
index d398909f25b..00000000000
--- a/db/migrate/20180201145907_migrate_remaining_issues_closed_at.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class MigrateRemainingIssuesClosedAt < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- class Issue < ActiveRecord::Base
- self.table_name = 'issues'
- include EachBatch
- end
-
- def up
- Gitlab::BackgroundMigration.steal('CopyColumn')
- Gitlab::BackgroundMigration.steal('CleanupConcurrentTypeChange')
-
- if migrate_column_type?
- if closed_at_for_type_change_exists?
- migrate_remaining_rows
- else
- # Due to some EE merge problems some environments may not have the
- # "closed_at_for_type_change" column. If this is the case we have no
- # other option than to migrate the data _right now_.
- # rubocop:disable Migration/UpdateLargeTable
- change_column_type_concurrently(:issues, :closed_at, :datetime_with_timezone)
- cleanup_concurrent_column_type_change(:issues, :closed_at)
- end
- end
- end
-
- def down
- # Previous migrations already revert the changes made here.
- end
-
- def migrate_remaining_rows
- Issue.where('closed_at_for_type_change IS NULL AND closed_at IS NOT NULL').each_batch do |batch|
- batch.update_all('closed_at_for_type_change = closed_at')
- end
-
- cleanup_concurrent_column_type_change(:issues, :closed_at)
- end
-
- def migrate_column_type?
- # Some environments may have already executed the previous version of this
- # migration, thus we don't need to migrate those environments again.
- column_for('issues', 'closed_at').type == :datetime # rubocop:disable Migration/Datetime
- end
-
- def closed_at_for_type_change_exists?
- columns('issues').any? { |col| col.name == 'closed_at_for_type_change' }
- end
-end
diff --git a/db/migrate/20180206200543_reset_events_primary_key_sequence.rb b/db/migrate/20180206200543_reset_events_primary_key_sequence.rb
deleted file mode 100644
index e7a18e68395..00000000000
--- a/db/migrate/20180206200543_reset_events_primary_key_sequence.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class ResetEventsPrimaryKeySequence < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- class Event < ActiveRecord::Base
- self.table_name = 'events'
- end
-
- def up
- reset_pk_sequence!(Event.table_name)
- end
-
- def down
- # No-op
- end
-end
diff --git a/db/migrate/20180208183958_schedule_populate_untracked_uploads_if_needed.rb b/db/migrate/20180208183958_schedule_populate_untracked_uploads_if_needed.rb
deleted file mode 100644
index b69ac8f94c1..00000000000
--- a/db/migrate/20180208183958_schedule_populate_untracked_uploads_if_needed.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class SchedulePopulateUntrackedUploadsIfNeeded < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- FOLLOW_UP_MIGRATION = 'PopulateUntrackedUploads'.freeze
-
- class UntrackedFile < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'untracked_files_for_uploads'
- end
-
- def up
- if table_exists?(:untracked_files_for_uploads)
- process_or_remove_table
- end
- end
-
- def down
- # nothing
- end
-
- private
-
- def process_or_remove_table
- if UntrackedFile.all.empty?
- drop_temp_table
- else
- schedule_populate_untracked_uploads_jobs
- end
- end
-
- def drop_temp_table
- drop_table(:untracked_files_for_uploads, if_exists: true)
- end
-
- def schedule_populate_untracked_uploads_jobs
- say "Scheduling #{FOLLOW_UP_MIGRATION} background migration jobs since there are rows in untracked_files_for_uploads."
-
- bulk_queue_background_migration_jobs_by_range(
- UntrackedFile, FOLLOW_UP_MIGRATION)
- end
-end
diff --git a/db/migrate/20180209115333_create_chatops_tables.rb b/db/migrate/20180209115333_create_chatops_tables.rb
deleted file mode 100644
index 9e11dfde7a3..00000000000
--- a/db/migrate/20180209115333_create_chatops_tables.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class CreateChatopsTables < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :ci_pipeline_chat_data, id: :bigserial do |t|
- t.integer :pipeline_id, null: false
- t.references :chat_name, foreign_key: { on_delete: :cascade }, null: false
- t.text :response_url, null: false # rubocop:disable Migration/AddLimitToTextColumns
-
- # A pipeline can only contain one row in this table, hence this index is
- # unique.
- t.index :pipeline_id, unique: true
-
- t.index :chat_name_id
- end
-
- # rubocop:disable Migration/AddConcurrentForeignKey
- add_foreign_key :ci_pipeline_chat_data, :ci_pipelines,
- column: :pipeline_id,
- on_delete: :cascade
- end
-end
diff --git a/db/migrate/20180209165249_add_closed_by_to_issues.rb b/db/migrate/20180209165249_add_closed_by_to_issues.rb
deleted file mode 100644
index 91a1e021ab9..00000000000
--- a/db/migrate/20180209165249_add_closed_by_to_issues.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddClosedByToIssues < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def up
- add_column :issues, :closed_by_id, :integer
- add_concurrent_foreign_key :issues, :users, column: :closed_by_id, on_delete: :nullify
- end
-
- def down
- remove_foreign_key :issues, column: :closed_by_id
- remove_column :issues, :closed_by_id
- end
-end
diff --git a/db/migrate/20180212030105_add_external_ip_to_clusters_applications_ingress.rb b/db/migrate/20180212030105_add_external_ip_to_clusters_applications_ingress.rb
deleted file mode 100644
index 78bb49b8b84..00000000000
--- a/db/migrate/20180212030105_add_external_ip_to_clusters_applications_ingress.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class AddExternalIpToClustersApplicationsIngress < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :clusters_applications_ingress, :external_ip, :string
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180213131630_add_partial_index_to_projects_for_index_only_scans.rb b/db/migrate/20180213131630_add_partial_index_to_projects_for_index_only_scans.rb
deleted file mode 100644
index 905915d9239..00000000000
--- a/db/migrate/20180213131630_add_partial_index_to_projects_for_index_only_scans.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class AddPartialIndexToProjectsForIndexOnlyScans < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'index_projects_on_id_partial_for_visibility'
-
- disable_ddl_transaction!
-
- # Adds a partial index to leverage index-only scans when looking up project ids
- def up
- unless index_exists?(:projects, :id, name: INDEX_NAME)
- add_concurrent_index :projects, :id, name: INDEX_NAME, unique: true, where: 'visibility_level IN (10,20)'
- end
- end
-
- def down
- if index_exists?(:projects, :id, name: INDEX_NAME)
- remove_concurrent_index_by_name :projects, INDEX_NAME
- end
- end
-end
diff --git a/db/migrate/20180214093516_create_badges.rb b/db/migrate/20180214093516_create_badges.rb
deleted file mode 100644
index 7a0d82d2d81..00000000000
--- a/db/migrate/20180214093516_create_badges.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class CreateBadges < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :badges do |t|
- t.string :link_url, null: false
- t.string :image_url, null: false
- t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: true
- t.integer :group_id, index: true, null: true
- t.string :type, null: false
-
- t.timestamps_with_timezone null: false
- end
-
- # rubocop:disable Migration/AddConcurrentForeignKey
- add_foreign_key :badges, :namespaces, column: :group_id, on_delete: :cascade
- # rubocop:enable Migration/AddConcurrentForeignKey
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180214155405_create_clusters_applications_runners.rb b/db/migrate/20180214155405_create_clusters_applications_runners.rb
deleted file mode 100644
index e6025007507..00000000000
--- a/db/migrate/20180214155405_create_clusters_applications_runners.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-class CreateClustersApplicationsRunners < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- create_table :clusters_applications_runners do |t|
- t.references :cluster, null: false, foreign_key: { on_delete: :cascade }
- t.references :runner, references: :ci_runners
- t.index :runner_id
- t.index :cluster_id, unique: true
- t.integer :status, null: false
- t.timestamps_with_timezone null: false
- t.string :version, null: false # rubocop:disable Migration/PreventStrings
- t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns
- end
-
- add_concurrent_foreign_key :clusters_applications_runners, :ci_runners,
- column: :runner_id,
- on_delete: :nullify
- end
-
- def down
- if foreign_keys_for(:clusters_applications_runners, :runner_id).any?
- remove_foreign_key :clusters_applications_runners, column: :runner_id
- end
-
- drop_table :clusters_applications_runners
- end
-end
diff --git a/db/migrate/20180215181245_users_name_lower_index.rb b/db/migrate/20180215181245_users_name_lower_index.rb
deleted file mode 100644
index 46f02885c3f..00000000000
--- a/db/migrate/20180215181245_users_name_lower_index.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class UsersNameLowerIndex < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
- INDEX_NAME = 'index_on_users_name_lower'
-
- disable_ddl_transaction!
-
- def up
- # On GitLab.com this produces an index with a size of roughly 60 MB.
- execute "CREATE INDEX CONCURRENTLY #{INDEX_NAME} ON users (LOWER(name))"
- end
-
- def down
- execute "DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME}"
- end
-end
diff --git a/db/migrate/20180216120000_add_pages_domain_verification.rb b/db/migrate/20180216120000_add_pages_domain_verification.rb
deleted file mode 100644
index 0600fe633a7..00000000000
--- a/db/migrate/20180216120000_add_pages_domain_verification.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class AddPagesDomainVerification < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def change
- add_column :pages_domains, :verified_at, :datetime_with_timezone
- add_column :pages_domains, :verification_code, :string # rubocop:disable Migration/PreventStrings
- end
-end
diff --git a/db/migrate/20180216120010_add_pages_domain_verified_at_index.rb b/db/migrate/20180216120010_add_pages_domain_verified_at_index.rb
deleted file mode 100644
index 6e7cb89c765..00000000000
--- a/db/migrate/20180216120010_add_pages_domain_verified_at_index.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class AddPagesDomainVerifiedAtIndex < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :pages_domains, :verified_at
- end
-
- def down
- remove_concurrent_index :pages_domains, :verified_at
- end
-end
diff --git a/db/migrate/20180216120020_allow_domain_verification_to_be_disabled.rb b/db/migrate/20180216120020_allow_domain_verification_to_be_disabled.rb
deleted file mode 100644
index 18e4f534105..00000000000
--- a/db/migrate/20180216120020_allow_domain_verification_to_be_disabled.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class AllowDomainVerificationToBeDisabled < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def change
- add_column :application_settings, :pages_domain_verification_enabled, :boolean, default: true, null: false
- end
-end
diff --git a/db/migrate/20180216120030_add_pages_domain_enabled_until.rb b/db/migrate/20180216120030_add_pages_domain_enabled_until.rb
deleted file mode 100644
index 3347bb6deaa..00000000000
--- a/db/migrate/20180216120030_add_pages_domain_enabled_until.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class AddPagesDomainEnabledUntil < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def change
- add_column :pages_domains, :enabled_until, :datetime_with_timezone
- end
-end
diff --git a/db/migrate/20180216120040_add_pages_domain_enabled_until_index.rb b/db/migrate/20180216120040_add_pages_domain_enabled_until_index.rb
deleted file mode 100644
index 3880a8ea139..00000000000
--- a/db/migrate/20180216120040_add_pages_domain_enabled_until_index.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class AddPagesDomainEnabledUntilIndex < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :pages_domains, [:project_id, :enabled_until]
- add_concurrent_index :pages_domains, [:verified_at, :enabled_until]
- end
-
- def down
- remove_concurrent_index :pages_domains, [:verified_at, :enabled_until]
- remove_concurrent_index :pages_domains, [:project_id, :enabled_until]
- end
-end
diff --git a/db/migrate/20180216120050_pages_domains_verification_grace_period.rb b/db/migrate/20180216120050_pages_domains_verification_grace_period.rb
deleted file mode 100644
index e51cff68b50..00000000000
--- a/db/migrate/20180216120050_pages_domains_verification_grace_period.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-class PagesDomainsVerificationGracePeriod < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- class PagesDomain < ActiveRecord::Base
- include EachBatch
- end
-
- # Allow this migration to resume if it fails partway through
- disable_ddl_transaction!
-
- def up
- now = Time.now
- grace = now + 30.days
-
- PagesDomain.each_batch do |relation|
- relation.update_all(verified_at: now, enabled_until: grace)
-
- # Sleep 2 minutes between batches to not overload the DB with dead tuples
- sleep(2.minutes) unless relation.reorder(:id).last == PagesDomain.reorder(:id).last
- end
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20180219153455_add_maximum_timeout_to_ci_runners.rb b/db/migrate/20180219153455_add_maximum_timeout_to_ci_runners.rb
deleted file mode 100644
index 68578c23207..00000000000
--- a/db/migrate/20180219153455_add_maximum_timeout_to_ci_runners.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddMaximumTimeoutToCiRunners < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :ci_runners, :maximum_timeout, :integer
- end
-end
diff --git a/db/migrate/20180221151752_add_allow_maintainer_to_push_to_merge_requests.rb b/db/migrate/20180221151752_add_allow_maintainer_to_push_to_merge_requests.rb
deleted file mode 100644
index 71f6bc46a88..00000000000
--- a/db/migrate/20180221151752_add_allow_maintainer_to_push_to_merge_requests.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddAllowMaintainerToPushToMergeRequests < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column :merge_requests, :allow_maintainer_to_push, :boolean
- end
-
- def down
- remove_column :merge_requests, :allow_maintainer_to_push
- end
-end
diff --git a/db/migrate/20180222043024_add_ip_address_to_runner.rb b/db/migrate/20180222043024_add_ip_address_to_runner.rb
deleted file mode 100644
index cc183112f6f..00000000000
--- a/db/migrate/20180222043024_add_ip_address_to_runner.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddIpAddressToRunner < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :ci_runners, :ip_address, :string # rubocop:disable Migration/PreventStrings
- end
-end
diff --git a/db/migrate/20180223120443_create_user_interacted_projects_table.rb b/db/migrate/20180223120443_create_user_interacted_projects_table.rb
deleted file mode 100644
index 185a690ad3d..00000000000
--- a/db/migrate/20180223120443_create_user_interacted_projects_table.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-class CreateUserInteractedProjectsTable < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- INDEX_NAME = 'user_interacted_projects_non_unique_index'
-
- def up
- create_table :user_interacted_projects, id: false do |t|
- t.references :user, null: false
- t.references :project, null: false
- end
-
- add_index :user_interacted_projects, [:project_id, :user_id], name: INDEX_NAME
- end
-
- def down
- drop_table :user_interacted_projects
- end
-end
diff --git a/db/migrate/20180223144945_add_allow_local_requests_from_hooks_and_services_to_application_settings.rb b/db/migrate/20180223144945_add_allow_local_requests_from_hooks_and_services_to_application_settings.rb
deleted file mode 100644
index 3171ff56299..00000000000
--- a/db/migrate/20180223144945_add_allow_local_requests_from_hooks_and_services_to_application_settings.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class AddAllowLocalRequestsFromHooksAndServicesToApplicationSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:application_settings, :allow_local_requests_from_hooks_and_services, # rubocop:disable Migration/AddColumnWithDefault
- :boolean,
- default: false,
- allow_null: false)
- end
-
- def down
- remove_column(:application_settings, :allow_local_requests_from_hooks_and_services)
- end
-end
diff --git a/db/migrate/20180226050030_add_checksum_to_ci_job_artifacts.rb b/db/migrate/20180226050030_add_checksum_to_ci_job_artifacts.rb
deleted file mode 100644
index bccb7ac26ec..00000000000
--- a/db/migrate/20180226050030_add_checksum_to_ci_job_artifacts.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class AddChecksumToCiJobArtifacts < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def change
- add_column :ci_job_artifacts, :file_sha256, :binary
- end
-end
diff --git a/db/migrate/20180227182112_add_group_id_to_boards_ce.rb b/db/migrate/20180227182112_add_group_id_to_boards_ce.rb
deleted file mode 100644
index b887be0cc55..00000000000
--- a/db/migrate/20180227182112_add_group_id_to_boards_ce.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-class AddGroupIdToBoardsCe < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- def up
- return if group_id_exists?
-
- # rubocop:disable Migration/AddConcurrentForeignKey
- add_column :boards, :group_id, :integer
- add_foreign_key :boards, :namespaces, column: :group_id, on_delete: :cascade
- add_concurrent_index :boards, :group_id
-
- change_column_null :boards, :project_id, true
- end
-
- def down
- return unless group_id_exists?
-
- # rubocop:disable Migration/RemoveIndex
- remove_foreign_key :boards, column: :group_id
- remove_index :boards, :group_id if index_exists? :boards, :group_id
- remove_column :boards, :group_id
-
- execute "DELETE from boards WHERE project_id IS NULL"
- change_column_null :boards, :project_id, false
- end
-
- private
-
- def group_id_exists?
- column_exists?(:boards, :group_id)
- end
-end
diff --git a/db/migrate/20180228172924_add_include_private_contributions_to_users.rb b/db/migrate/20180228172924_add_include_private_contributions_to_users.rb
deleted file mode 100644
index 58e50b2ee74..00000000000
--- a/db/migrate/20180228172924_add_include_private_contributions_to_users.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class AddIncludePrivateContributionsToUsers < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def change
- add_column :users, :include_private_contributions, :boolean # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20180301010859_create_ci_builds_metadata_table.rb b/db/migrate/20180301010859_create_ci_builds_metadata_table.rb
deleted file mode 100644
index 29652c675e1..00000000000
--- a/db/migrate/20180301010859_create_ci_builds_metadata_table.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-class CreateCiBuildsMetadataTable < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :ci_builds_metadata do |t|
- t.integer :build_id, null: false
- t.integer :project_id, null: false
- t.integer :timeout
- t.integer :timeout_source, null: false, default: 1
-
- t.foreign_key :ci_builds, column: :build_id, on_delete: :cascade
- t.foreign_key :projects, column: :project_id, on_delete: :cascade
-
- t.index :build_id, unique: true
- t.index :project_id
- end
- end
-end
diff --git a/db/migrate/20180302152117_ensure_foreign_keys_on_clusters_applications.rb b/db/migrate/20180302152117_ensure_foreign_keys_on_clusters_applications.rb
deleted file mode 100644
index d660c7cfd2d..00000000000
--- a/db/migrate/20180302152117_ensure_foreign_keys_on_clusters_applications.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class EnsureForeignKeysOnClustersApplications < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- # rubocop:disable Cop/InBatches
- def up
- existing = Clusters::Cluster
- .joins(:application_ingress)
- .where('clusters.id = clusters_applications_ingress.cluster_id')
-
- Clusters::Applications::Ingress.where('NOT EXISTS (?)', existing).in_batches do |batch|
- batch.delete_all
- end
-
- unless foreign_keys_for(:clusters_applications_ingress, :cluster_id).any?
- add_concurrent_foreign_key :clusters_applications_ingress, :clusters,
- column: :cluster_id,
- on_delete: :cascade
- end
-
- existing = Clusters::Cluster
- .joins(:application_prometheus)
- .where('clusters.id = clusters_applications_prometheus.cluster_id')
-
- Clusters::Applications::Ingress.where('NOT EXISTS (?)', existing).in_batches do |batch|
- batch.delete_all
- end
-
- unless foreign_keys_for(:clusters_applications_prometheus, :cluster_id).any?
- add_concurrent_foreign_key :clusters_applications_prometheus, :clusters,
- column: :cluster_id,
- on_delete: :cascade
- end
- end
-
- def down
- if foreign_keys_for(:clusters_applications_ingress, :cluster_id).any?
- remove_foreign_key :clusters_applications_ingress, column: :cluster_id
- end
-
- if foreign_keys_for(:clusters_applications_prometheus, :cluster_id).any?
- remove_foreign_key :clusters_applications_prometheus, column: :cluster_id
- end
- end
-end
diff --git a/db/migrate/20180305095250_create_internal_ids_table.rb b/db/migrate/20180305095250_create_internal_ids_table.rb
deleted file mode 100644
index 8565f5d848b..00000000000
--- a/db/migrate/20180305095250_create_internal_ids_table.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class CreateInternalIdsTable < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :internal_ids, id: :bigserial do |t|
- t.references :project, null: false, foreign_key: { on_delete: :cascade }
- t.integer :usage, null: false
- t.integer :last_value, null: false
-
- t.index [:usage, :project_id], unique: true
- end
- end
-end
diff --git a/db/migrate/20180305144721_add_privileged_to_runner.rb b/db/migrate/20180305144721_add_privileged_to_runner.rb
deleted file mode 100644
index 1ad3c045d60..00000000000
--- a/db/migrate/20180305144721_add_privileged_to_runner.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddPrivilegedToRunner < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default :clusters_applications_runners, :privileged, :boolean, default: true, allow_null: false # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :clusters_applications_runners, :privileged
- end
-end
diff --git a/db/migrate/20180306134842_add_missing_indexes_acts_as_taggable_on_engine.rb b/db/migrate/20180306134842_add_missing_indexes_acts_as_taggable_on_engine.rb
deleted file mode 100644
index b400ff94dbe..00000000000
--- a/db/migrate/20180306134842_add_missing_indexes_acts_as_taggable_on_engine.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# This migration comes from acts_as_taggable_on_engine (originally 6)
-#
-# It has been modified to handle no-downtime GitLab migrations. Several
-# indexes have been removed since they are not needed for GitLab.
-class AddMissingIndexesActsAsTaggableOnEngine < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :taggings, :tag_id unless index_exists? :taggings, :tag_id
- add_concurrent_index :taggings, [:taggable_id, :taggable_type] unless index_exists? :taggings, [:taggable_id, :taggable_type]
- end
-
- def down
- remove_concurrent_index :taggings, :tag_id
- remove_concurrent_index :taggings, [:taggable_id, :taggable_type]
- end
-end
diff --git a/db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb b/db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb
deleted file mode 100644
index 58a1d2b12d5..00000000000
--- a/db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class AddSectionNameIdIndexOnCiBuildTraceSections < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
- INDEX_NAME = 'index_ci_build_trace_sections_on_section_name_id'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_build_trace_sections, :section_name_id, name: INDEX_NAME
- end
-
- def down
- remove_concurrent_index :ci_build_trace_sections, :section_name_id, name: INDEX_NAME
- end
-end
diff --git a/db/migrate/20180308125206_add_user_internal_regex_to_application_setting.rb b/db/migrate/20180308125206_add_user_internal_regex_to_application_setting.rb
deleted file mode 100644
index d97d2953677..00000000000
--- a/db/migrate/20180308125206_add_user_internal_regex_to_application_setting.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class AddUserInternalRegexToApplicationSetting < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def up
- add_column :application_settings, :user_default_internal_regex, :string, null: true
- end
- # rubocop:enable Migration/PreventStrings
-
- def down
- remove_column :application_settings, :user_default_internal_regex
- end
-end
diff --git a/db/migrate/20180309121820_reschedule_commits_count_for_merge_request_diff.rb b/db/migrate/20180309121820_reschedule_commits_count_for_merge_request_diff.rb
deleted file mode 100644
index 3d85a19b82f..00000000000
--- a/db/migrate/20180309121820_reschedule_commits_count_for_merge_request_diff.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-class RescheduleCommitsCountForMergeRequestDiff < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- MIGRATION = 'AddMergeRequestDiffCommitsCount'.freeze
- BATCH_SIZE = 5000
- DELAY_INTERVAL = 5.minutes.to_i
-
- class MergeRequestDiff < ActiveRecord::Base
- self.table_name = 'merge_request_diffs'
-
- include ::EachBatch
- end
-
- disable_ddl_transaction!
-
- def up
- say 'Populating the MergeRequestDiff `commits_count` (reschedule)'
-
- execute("SET statement_timeout TO '60s'")
-
- MergeRequestDiff.where(commits_count: nil).each_batch(of: BATCH_SIZE) do |relation, index|
- start_id, end_id = relation.pluck('MIN(id), MAX(id)').first
- delay = index * DELAY_INTERVAL
-
- BackgroundMigrationWorker.perform_in(delay, MIGRATION, [start_id, end_id])
- end
- end
-end
diff --git a/db/migrate/20180309160427_add_partial_indexes_on_todos.rb b/db/migrate/20180309160427_add_partial_indexes_on_todos.rb
deleted file mode 100644
index c22ed0a5177..00000000000
--- a/db/migrate/20180309160427_add_partial_indexes_on_todos.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddPartialIndexesOnTodos < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- INDEX_NAME_PENDING = "index_todos_on_user_id_and_id_pending"
- INDEX_NAME_DONE = "index_todos_on_user_id_and_id_done"
-
- def up
- unless index_exists?(:todos, [:user_id, :id], name: INDEX_NAME_PENDING)
- add_concurrent_index(:todos, [:user_id, :id], where: "state='pending'", name: INDEX_NAME_PENDING)
- end
-
- unless index_exists?(:todos, [:user_id, :id], name: INDEX_NAME_DONE)
- add_concurrent_index(:todos, [:user_id, :id], where: "state='done'", name: INDEX_NAME_DONE)
- end
- end
-
- def down
- remove_concurrent_index(:todos, [:user_id, :id], where: "state='pending'", name: INDEX_NAME_PENDING)
- remove_concurrent_index(:todos, [:user_id, :id], where: "state='done'", name: INDEX_NAME_DONE)
- end
-end
diff --git a/db/migrate/20180314100728_add_external_authorization_service_timeout_to_application_settings.rb b/db/migrate/20180314100728_add_external_authorization_service_timeout_to_application_settings.rb
deleted file mode 100644
index c3c6aa0ddf8..00000000000
--- a/db/migrate/20180314100728_add_external_authorization_service_timeout_to_application_settings.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class AddExternalAuthorizationServiceTimeoutToApplicationSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- # We can use the regular `add_column` with a default since `application_settings`
- # is a small table.
- add_column :application_settings,
- :external_authorization_service_timeout,
- :float,
- default: 0.5
- end
-
- def down
- remove_column :application_settings, :external_authorization_service_timeout
- end
-end
diff --git a/db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb b/db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb
deleted file mode 100644
index a6f2605c906..00000000000
--- a/db/migrate/20180314145917_add_header_and_footer_banners_to_appearances_table.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class AddHeaderAndFooterBannersToAppearancesTable < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- # rubocop:disable Migration/AddLimitToTextColumns
- add_column :appearances, :header_message, :text
- add_column :appearances, :header_message_html, :text
-
- add_column :appearances, :footer_message, :text
- add_column :appearances, :footer_message_html, :text
-
- add_column :appearances, :message_background_color, :text
- add_column :appearances, :message_font_color, :text
- # rubocop:enable Migration/AddLimitToTextColumns
- end
-end
diff --git a/db/migrate/20180315160435_add_external_auth_mutual_tls_fields_to_project_settings.rb b/db/migrate/20180315160435_add_external_auth_mutual_tls_fields_to_project_settings.rb
deleted file mode 100644
index dd40c5fdf4d..00000000000
--- a/db/migrate/20180315160435_add_external_auth_mutual_tls_fields_to_project_settings.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-class AddExternalAuthMutualTlsFieldsToProjectSettings < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- add_column :application_settings,
- :external_auth_client_cert, :text
- add_column :application_settings,
- :encrypted_external_auth_client_key, :text
- add_column :application_settings,
- :encrypted_external_auth_client_key_iv, :string
- add_column :application_settings,
- :encrypted_external_auth_client_key_pass, :string
- add_column :application_settings,
- :encrypted_external_auth_client_key_pass_iv, :string
- end
- # rubocop:enable Migration/AddLimitToTextColumns
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180319190020_create_deploy_tokens.rb b/db/migrate/20180319190020_create_deploy_tokens.rb
deleted file mode 100644
index 019543cb2f1..00000000000
--- a/db/migrate/20180319190020_create_deploy_tokens.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class CreateDeployTokens < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :deploy_tokens do |t|
- t.boolean :revoked, default: false
- t.boolean :read_repository, null: false, default: false
- t.boolean :read_registry, null: false, default: 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, index: { unique: true }, null: false
-
- t.index [:token, :expires_at, :id], where: "(revoked IS FALSE)"
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb b/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb
deleted file mode 100644
index ba8ad1b7495..00000000000
--- a/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class AddIndexesForUserActivityQueries < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :events, [:author_id, :project_id] unless index_exists?(:events, [:author_id, :project_id])
- add_concurrent_index :user_interacted_projects, :user_id unless index_exists?(:user_interacted_projects, :user_id)
- end
-
- def down
- remove_concurrent_index :events, [:author_id, :project_id] if index_exists?(:events, [:author_id, :project_id])
-
- remove_concurrent_index :user_interacted_projects, :user_id if index_exists?(:user_interacted_projects, :user_id)
- end
-end
diff --git a/db/migrate/20180323150945_add_push_to_merge_request_to_notification_settings.rb b/db/migrate/20180323150945_add_push_to_merge_request_to_notification_settings.rb
deleted file mode 100644
index 3b38d21a8aa..00000000000
--- a/db/migrate/20180323150945_add_push_to_merge_request_to_notification_settings.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddPushToMergeRequestToNotificationSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :notification_settings, :push_to_merge_request, :boolean
- end
-end
diff --git a/db/migrate/20180326202229_create_ci_build_trace_chunks.rb b/db/migrate/20180326202229_create_ci_build_trace_chunks.rb
deleted file mode 100644
index 45a64ec23d1..00000000000
--- a/db/migrate/20180326202229_create_ci_build_trace_chunks.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class CreateCiBuildTraceChunks < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :ci_build_trace_chunks, id: :bigserial 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.foreign_key :ci_builds, column: :build_id, on_delete: :cascade
- t.index [:build_id, :chunk_index], unique: true
- end
- end
-end
diff --git a/db/migrate/20180327101207_remove_index_from_events_table.rb b/db/migrate/20180327101207_remove_index_from_events_table.rb
deleted file mode 100644
index 0583a2641ec..00000000000
--- a/db/migrate/20180327101207_remove_index_from_events_table.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class RemoveIndexFromEventsTable < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index :events, :author_id
- end
-
- def down
- add_concurrent_index :events, :author_id
- end
-end
diff --git a/db/migrate/20180330121048_add_issue_due_to_notification_settings.rb b/db/migrate/20180330121048_add_issue_due_to_notification_settings.rb
deleted file mode 100644
index 2d9ca002872..00000000000
--- a/db/migrate/20180330121048_add_issue_due_to_notification_settings.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddIssueDueToNotificationSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :notification_settings, :issue_due, :boolean
- end
-end
diff --git a/db/migrate/20180403035759_create_project_ci_cd_settings.rb b/db/migrate/20180403035759_create_project_ci_cd_settings.rb
deleted file mode 100644
index c630dd3c942..00000000000
--- a/db/migrate/20180403035759_create_project_ci_cd_settings.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-class CreateProjectCiCdSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- unless table_exists?(:project_ci_cd_settings)
- create_table(:project_ci_cd_settings) do |t|
- t.integer(:project_id, null: false)
- t.boolean(:group_runners_enabled, default: true, null: false)
- end
- end
-
- disable_statement_timeout do
- # This particular INSERT will take between 10 and 20 seconds.
- execute 'INSERT INTO project_ci_cd_settings (project_id) SELECT id FROM projects'
-
- # We add the index and foreign key separately so the above INSERT statement
- # takes as little time as possible.
- add_concurrent_index(:project_ci_cd_settings, :project_id, unique: true)
-
- add_foreign_key_with_retry
- end
- end
-
- def down
- drop_table :project_ci_cd_settings
- end
-
- def add_foreign_key_with_retry
- # Between the initial INSERT and the addition of the foreign key some
- # projects may have been removed, leaving orphaned rows in our new settings
- # table.
- loop do
- remove_orphaned_settings
-
- begin
- add_project_id_foreign_key
- break
- rescue ActiveRecord::InvalidForeignKey
- say 'project_ci_cd_settings contains some orphaned rows, retrying...'
- end
- end
- end
-
- def add_project_id_foreign_key
- add_concurrent_foreign_key(:project_ci_cd_settings, :projects, column: :project_id)
- end
-
- def remove_orphaned_settings
- execute <<~SQL
- DELETE FROM project_ci_cd_settings
- WHERE NOT EXISTS (
- SELECT 1
- FROM projects
- WHERE projects.id = project_ci_cd_settings.project_id
- )
- SQL
- end
-end
diff --git a/db/migrate/20180405142733_create_project_deploy_tokens.rb b/db/migrate/20180405142733_create_project_deploy_tokens.rb
deleted file mode 100644
index ba000492247..00000000000
--- a/db/migrate/20180405142733_create_project_deploy_tokens.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class CreateProjectDeployTokens < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def change
- create_table :project_deploy_tokens do |t|
- t.integer :project_id, null: false
- t.integer :deploy_token_id, null: false
- t.datetime_with_timezone :created_at, null: false
-
- t.foreign_key :deploy_tokens, column: :deploy_token_id, on_delete: :cascade
- t.foreign_key :projects, column: :project_id, on_delete: :cascade
-
- t.index [:project_id, :deploy_token_id], unique: true
- end
- end
-end
diff --git a/db/migrate/20180408143354_rename_users_rss_token_to_feed_token.rb b/db/migrate/20180408143354_rename_users_rss_token_to_feed_token.rb
deleted file mode 100644
index 4b8844a134d..00000000000
--- a/db/migrate/20180408143354_rename_users_rss_token_to_feed_token.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class RenameUsersRssTokenToFeedToken < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- # rubocop:disable Migration/UpdateLargeTable
- rename_column_concurrently :users, :rss_token, :feed_token
- end
-
- def down
- cleanup_concurrent_column_rename :users, :feed_token, :rss_token
- end
-end
diff --git a/db/migrate/20180413022611_create_missing_namespace_for_internal_users.rb b/db/migrate/20180413022611_create_missing_namespace_for_internal_users.rb
deleted file mode 100644
index 21d7f50ee83..00000000000
--- a/db/migrate/20180413022611_create_missing_namespace_for_internal_users.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-class CreateMissingNamespaceForInternalUsers < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def up
- connection.exec_query(users_query.to_sql).rows.each do |id, username|
- create_namespace(id, username)
- # When testing locally I've noticed that these internal users are missing
- # the notification email, for more details visit the below link:
- # https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/18357#note_68327560
- set_notification_email(id)
- end
- end
-
- def down
- # no-op
- end
-
- private
-
- def users
- @users ||= Arel::Table.new(:users)
- end
-
- def namespaces
- @namespaces ||= Arel::Table.new(:namespaces)
- end
-
- def users_query
- condition = users[:ghost].eq(true)
-
- if column_exists?(:users, :support_bot)
- condition = condition.or(users[:support_bot].eq(true))
- end
-
- users.join(namespaces, Arel::Nodes::OuterJoin)
- .on(namespaces[:type].eq(nil).and(namespaces[:owner_id].eq(users[:id])))
- .where(namespaces[:owner_id].eq(nil))
- .where(condition)
- .project(users[:id], users[:username])
- end
-
- def create_namespace(user_id, username)
- path = Uniquify.new.string(username) do |str|
- query = "SELECT id FROM namespaces WHERE parent_id IS NULL AND path='#{str}' LIMIT 1"
- connection.exec_query(query).present?
- end
-
- insert_query = "INSERT INTO namespaces(owner_id, path, name, created_at, updated_at) VALUES(#{user_id}, '#{path}', '#{path}', NOW(), NOW())"
- namespace_id = connection.insert(insert_query)
-
- create_route(namespace_id)
- end
-
- def create_route(namespace_id)
- return unless namespace_id
-
- row = connection.exec_query("SELECT id, path FROM namespaces WHERE id=#{namespace_id}").first
- id, path = row.values_at('id', 'path')
-
- execute("INSERT INTO routes(source_id, source_type, path, name, created_at, updated_at) VALUES(#{id}, 'Namespace', '#{path}', '#{path}', NOW(), NOW())")
- end
-
- def set_notification_email(user_id)
- execute "UPDATE users SET notification_email = email WHERE notification_email IS NULL AND id = #{user_id}"
- end
-end
diff --git a/db/migrate/20180416155103_add_further_scope_columns_to_internal_id_table.rb b/db/migrate/20180416155103_add_further_scope_columns_to_internal_id_table.rb
deleted file mode 100644
index 7c28cbb6795..00000000000
--- a/db/migrate/20180416155103_add_further_scope_columns_to_internal_id_table.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class AddFurtherScopeColumnsToInternalIdTable < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- change_column_null :internal_ids, :project_id, true
- add_column :internal_ids, :namespace_id, :integer, null: true
- end
-
- def down
- change_column_null :internal_ids, :project_id, false
- remove_column :internal_ids, :namespace_id
- end
-end
diff --git a/db/migrate/20180417090132_add_index_constraints_to_internal_id_table.rb b/db/migrate/20180417090132_add_index_constraints_to_internal_id_table.rb
deleted file mode 100644
index ac6bb1a8cab..00000000000
--- a/db/migrate/20180417090132_add_index_constraints_to_internal_id_table.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-class AddIndexConstraintsToInternalIdTable < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :internal_ids, [:usage, :namespace_id], unique: true, where: 'namespace_id IS NOT NULL'
-
- replace_index(:internal_ids, [:usage, :project_id], name: 'index_internal_ids_on_usage_and_project_id') do
- add_concurrent_index :internal_ids, [:usage, :project_id], unique: true, where: 'project_id IS NOT NULL'
- end
-
- add_concurrent_foreign_key :internal_ids, :namespaces, column: :namespace_id, on_delete: :cascade
- end
-
- def down
- remove_concurrent_index :internal_ids, [:usage, :namespace_id]
-
- replace_index(:internal_ids, [:usage, :project_id], name: 'index_internal_ids_on_usage_and_project_id') do
- add_concurrent_index :internal_ids, [:usage, :project_id], unique: true
- end
-
- remove_foreign_key :internal_ids, column: :namespace_id
- end
-
- private
-
- def replace_index(table, columns, name:)
- temporary_name = "#{name}_old"
-
- if index_exists?(table, columns, name: name)
- rename_index table, name, temporary_name
- end
-
- yield
-
- remove_concurrent_index_by_name table, temporary_name
- end
-end
diff --git a/db/migrate/20180417101040_add_tmp_stage_priority_index_to_ci_builds.rb b/db/migrate/20180417101040_add_tmp_stage_priority_index_to_ci_builds.rb
deleted file mode 100644
index ce470884999..00000000000
--- a/db/migrate/20180417101040_add_tmp_stage_priority_index_to_ci_builds.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class AddTmpStagePriorityIndexToCiBuilds < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:ci_builds, [:stage_id, :stage_idx],
- where: 'stage_idx IS NOT NULL', name: 'tmp_build_stage_position_index')
- end
-
- def down
- remove_concurrent_index_by_name(:ci_builds, 'tmp_build_stage_position_index')
- end
-end
diff --git a/db/migrate/20180417101940_add_index_to_ci_stage.rb b/db/migrate/20180417101940_add_index_to_ci_stage.rb
deleted file mode 100644
index 97a8f5efce0..00000000000
--- a/db/migrate/20180417101940_add_index_to_ci_stage.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddIndexToCiStage < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :ci_stages, :position, :integer
- end
-end
diff --git a/db/migrate/20180418053107_add_index_to_ci_job_artifacts_file_store.rb b/db/migrate/20180418053107_add_index_to_ci_job_artifacts_file_store.rb
deleted file mode 100644
index 4b574923483..00000000000
--- a/db/migrate/20180418053107_add_index_to_ci_job_artifacts_file_store.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class AddIndexToCiJobArtifactsFileStore < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_job_artifacts, :file_store
- end
-
- def down
- # rubocop:disable Migration/RemoveIndex
- remove_index :ci_job_artifacts, :file_store if index_exists?(:ci_job_artifacts, :file_store)
- end
-end
diff --git a/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb b/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb
deleted file mode 100644
index 90a908feaee..00000000000
--- a/db/migrate/20180420010016_add_pipeline_build_foreign_key.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-class AddPipelineBuildForeignKey < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- execute <<~SQL
- DELETE FROM ci_builds WHERE project_id IS NULL OR commit_id IS NULL
- SQL
-
- execute <<~SQL
- DELETE FROM ci_builds WHERE NOT EXISTS
- (SELECT true FROM ci_pipelines WHERE ci_pipelines.id = ci_builds.commit_id)
- AND stage_id IS NULL
- SQL
-
- add_concurrent_foreign_key(:ci_builds, :ci_pipelines, column: :commit_id)
- end
-
- def down
- return unless foreign_key_exists?(:ci_builds, :ci_pipelines, column: :commit_id)
-
- remove_foreign_key(:ci_builds, column: :commit_id)
- end
-end
diff --git a/db/migrate/20180420010616_cleanup_build_stage_migration.rb b/db/migrate/20180420010616_cleanup_build_stage_migration.rb
deleted file mode 100644
index 30c0d97781d..00000000000
--- a/db/migrate/20180420010616_cleanup_build_stage_migration.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-class CleanupBuildStageMigration < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- TMP_INDEX = 'tmp_id_stage_partial_null_index'.freeze
-
- disable_ddl_transaction!
-
- class Build < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'ci_builds'
- self.inheritance_column = :_type_disabled
- end
-
- def up
- disable_statement_timeout do
- ##
- # We steal from the background migrations queue to catch up with the
- # scheduled migrations set.
- #
- Gitlab::BackgroundMigration.steal('MigrateBuildStage')
-
- ##
- # We add temporary index, to make iteration over batches more performant.
- # Conditional here is to avoid the need of doing that in a separate
- # migration file to make this operation idempotent.
- #
- unless index_exists_by_name?(:ci_builds, TMP_INDEX)
- add_concurrent_index(:ci_builds, :id, where: 'stage_id IS NULL', name: TMP_INDEX)
- end
-
- ##
- # We check if there are remaining rows that should be migrated (for example
- # if Sidekiq / Redis fails / is restarted, what could result in not all
- # background migrations being executed correctly.
- #
- # We migrate remaining rows synchronously in a blocking way, to make sure
- # that when this migration is done we are confident that all rows are
- # already migrated.
- #
- Build.where('stage_id IS NULL').each_batch(of: 50) do |batch|
- range = batch.pluck('MIN(id)', 'MAX(id)').first
-
- Gitlab::BackgroundMigration::MigrateBuildStage.new.perform(*range)
- end
-
- ##
- # We remove temporary index, because it is not required during standard
- # operations and runtime.
- #
- remove_concurrent_index_by_name(:ci_builds, TMP_INDEX)
- end
- end
-
- def down
- if index_exists_by_name?(:ci_builds, TMP_INDEX)
- disable_statement_timeout do
- remove_concurrent_index_by_name(:ci_builds, TMP_INDEX)
- end
- end
- end
-end
diff --git a/db/migrate/20180423204600_add_pages_access_level_to_project_feature.rb b/db/migrate/20180423204600_add_pages_access_level_to_project_feature.rb
deleted file mode 100644
index acb6d04126e..00000000000
--- a/db/migrate/20180423204600_add_pages_access_level_to_project_feature.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-class AddPagesAccessLevelToProjectFeature < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- # rubocop: disable Migration/UpdateLargeTable
- # rubocop: disable Migration/AddColumnWithDefault
- def up
- add_column_with_default(:project_features, :pages_access_level, :integer, default: ProjectFeature::PUBLIC, allow_null: false)
-
- change_column_default(:project_features, :pages_access_level, ProjectFeature::ENABLED)
- end
- # rubocop: enable Migration/UpdateLargeTable
- # rubocop: enable Migration/AddColumnWithDefault
-
- def down
- remove_column :project_features, :pages_access_level
- end
-end
diff --git a/db/migrate/20180424090541_add_enforce_terms_to_application_settings.rb b/db/migrate/20180424090541_add_enforce_terms_to_application_settings.rb
deleted file mode 100644
index b8fd71002a1..00000000000
--- a/db/migrate/20180424090541_add_enforce_terms_to_application_settings.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class AddEnforceTermsToApplicationSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- # rubocop:disable Migration/SaferBooleanColumn
- add_column :application_settings, :enforce_terms, :boolean, default: false
- end
-end
diff --git a/db/migrate/20180424134533_create_application_setting_terms.rb b/db/migrate/20180424134533_create_application_setting_terms.rb
deleted file mode 100644
index 41edb8a9559..00000000000
--- a/db/migrate/20180424134533_create_application_setting_terms.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class CreateApplicationSettingTerms < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- create_table :application_setting_terms do |t|
- t.integer :cached_markdown_version
- t.text :terms, null: false
- t.text :terms_html
- end
- end
- # rubocop:enable Migration/AddLimitToTextColumns
-end
diff --git a/db/migrate/20180424160449_add_pipeline_iid_to_ci_pipelines.rb b/db/migrate/20180424160449_add_pipeline_iid_to_ci_pipelines.rb
deleted file mode 100644
index 550b5a2c149..00000000000
--- a/db/migrate/20180424160449_add_pipeline_iid_to_ci_pipelines.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class AddPipelineIidToCiPipelines < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- add_column :ci_pipelines, :iid, :integer
- end
-
- def down
- remove_column :ci_pipelines, :iid, :integer
- end
-end
diff --git a/db/migrate/20180425075446_create_term_agreements.rb b/db/migrate/20180425075446_create_term_agreements.rb
deleted file mode 100644
index 25182215841..00000000000
--- a/db/migrate/20180425075446_create_term_agreements.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-class CreateTermAgreements < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- create_table :term_agreements do |t|
- t.references :term, index: true, null: false
- t.foreign_key :application_setting_terms, column: :term_id
- t.references :user, index: true, null: false, foreign_key: { on_delete: :cascade }
- t.boolean :accepted, default: false, null: false
-
- t.timestamps_with_timezone null: false
- end
-
- add_index :term_agreements, [:user_id, :term_id],
- unique: true,
- name: 'term_agreements_unique_index'
- end
-
- def down
- # rubocop:disable Migration/RemoveIndex
- remove_index :term_agreements, name: 'term_agreements_unique_index'
-
- drop_table :term_agreements
- end
-end
diff --git a/db/migrate/20180425131009_assure_commits_count_for_merge_request_diff.rb b/db/migrate/20180425131009_assure_commits_count_for_merge_request_diff.rb
deleted file mode 100644
index 7d38a15b850..00000000000
--- a/db/migrate/20180425131009_assure_commits_count_for_merge_request_diff.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-class AssureCommitsCountForMergeRequestDiff < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- class MergeRequestDiff < ActiveRecord::Base
- self.table_name = 'merge_request_diffs'
-
- include ::EachBatch
- end
-
- def up
- Gitlab::BackgroundMigration.steal('AddMergeRequestDiffCommitsCount')
-
- MergeRequestDiff.where(commits_count: nil).each_batch(of: 50) do |batch|
- range = batch.pluck('MIN(id)', 'MAX(id)').first
-
- Gitlab::BackgroundMigration::AddMergeRequestDiffCommitsCount.new.perform(*range)
- end
- end
-
- def down
- # noop
- end
-end
diff --git a/db/migrate/20180425205249_add_index_constraints_to_pipeline_iid.rb b/db/migrate/20180425205249_add_index_constraints_to_pipeline_iid.rb
deleted file mode 100644
index 8a0cb7ae4e4..00000000000
--- a/db/migrate/20180425205249_add_index_constraints_to_pipeline_iid.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class AddIndexConstraintsToPipelineIid < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_pipelines, [:project_id, :iid], unique: true, where: 'iid IS NOT NULL'
- end
-
- def down
- remove_concurrent_index :ci_pipelines, [:project_id, :iid]
- end
-end
diff --git a/db/migrate/20180426102016_add_accepted_term_to_users.rb b/db/migrate/20180426102016_add_accepted_term_to_users.rb
deleted file mode 100644
index 3c6665b4264..00000000000
--- a/db/migrate/20180426102016_add_accepted_term_to_users.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddAcceptedTermToUsers < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- change_table :users do |t|
- t.references :accepted_term,
- null: true
- end
- add_concurrent_foreign_key :users, :application_setting_terms, column: :accepted_term_id
- end
-
- def down
- remove_foreign_key :users, column: :accepted_term_id
- remove_column :users, :accepted_term_id
- end
-end
diff --git a/db/migrate/20180430101916_add_runner_type_to_ci_runners.rb b/db/migrate/20180430101916_add_runner_type_to_ci_runners.rb
deleted file mode 100644
index a74231e0f44..00000000000
--- a/db/migrate/20180430101916_add_runner_type_to_ci_runners.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddRunnerTypeToCiRunners < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :ci_runners, :runner_type, :smallint
- end
-end
diff --git a/db/migrate/20180502122856_create_project_mirror_data.rb b/db/migrate/20180502122856_create_project_mirror_data.rb
deleted file mode 100644
index 1ecfd8926fb..00000000000
--- a/db/migrate/20180502122856_create_project_mirror_data.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-class CreateProjectMirrorData < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- # rubocop:disable Migration/AddLimitToTextColumns
- def up
- if table_exists?(:project_mirror_data)
- add_column :project_mirror_data, :status, :string unless column_exists?(:project_mirror_data, :status)
- add_column :project_mirror_data, :jid, :string unless column_exists?(:project_mirror_data, :jid)
- add_column :project_mirror_data, :last_error, :text unless column_exists?(:project_mirror_data, :last_error)
- else
- create_table :project_mirror_data do |t|
- t.references :project, index: true, foreign_key: { on_delete: :cascade }
- t.string :status
- t.string :jid
- t.text :last_error
- end
- end
- end
- # rubocop:enable Migration/AddLimitToTextColumns
- # rubocop:enable Migration/PreventStrings
-
- def down
- remove_column :project_mirror_data, :status
- remove_column :project_mirror_data, :jid
- remove_column :project_mirror_data, :last_error
-
- # ee/db/migrate/20170509153720_create_project_mirror_data_ee.rb will remove the table.
- end
-end
diff --git a/db/migrate/20180503131624_create_remote_mirrors.rb b/db/migrate/20180503131624_create_remote_mirrors.rb
deleted file mode 100644
index 330a0d8f62d..00000000000
--- a/db/migrate/20180503131624_create_remote_mirrors.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-class CreateRemoteMirrors < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- # rubocop:disable Migration/PreventStrings
- def up
- return if table_exists?(:remote_mirrors)
-
- create_table :remote_mirrors do |t|
- t.references :project, index: true, foreign_key: { on_delete: :cascade }
- t.string :url
- t.boolean :enabled, default: true
- t.string :update_status
- t.datetime :last_update_at # rubocop:disable Migration/Datetime
- t.datetime :last_successful_update_at # rubocop:disable Migration/Datetime
- t.datetime :last_update_started_at # rubocop:disable Migration/Datetime
- t.string :last_error
- t.boolean :only_protected_branches, default: false, null: false
- t.string :remote_name
- t.text :encrypted_credentials # rubocop:disable Migration/AddLimitToTextColumns
- t.string :encrypted_credentials_iv
- t.string :encrypted_credentials_salt
-
- # rubocop:disable Migration/Timestamps
- t.timestamps null: false
- end
- end
- # rubocop:enable Migration/PreventStrings
-
- def down
- # ee/db/migrate/20160321161032_create_remote_mirrors_ee.rb will remove the table
- end
-end
diff --git a/db/migrate/20180503141722_add_remote_mirror_available_overridden_to_projects.rb b/db/migrate/20180503141722_add_remote_mirror_available_overridden_to_projects.rb
deleted file mode 100644
index aa3d9a804ab..00000000000
--- a/db/migrate/20180503141722_add_remote_mirror_available_overridden_to_projects.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class AddRemoteMirrorAvailableOverriddenToProjects < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column(:projects, :remote_mirror_available_overridden, :boolean) unless column_exists?(:projects, :remote_mirror_available_overridden) # rubocop:disable Migration/AddColumnsToWideTables
- end
-
- def down
- # ee/db/migrate/20171017130239_add_remote_mirror_available_overridden_to_projects_ee.rb will remove the column.
- end
-end
diff --git a/db/migrate/20180503150427_add_index_to_namespaces_runners_token.rb b/db/migrate/20180503150427_add_index_to_namespaces_runners_token.rb
deleted file mode 100644
index 899e4a05cbd..00000000000
--- a/db/migrate/20180503150427_add_index_to_namespaces_runners_token.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddIndexToNamespacesRunnersToken < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :namespaces, :runners_token, unique: true
- end
-
- def down
- if index_exists?(:namespaces, :runners_token, unique: true)
- # rubocop:disable Migration/RemoveIndex
- remove_index :namespaces, :runners_token
- end
- end
-end
diff --git a/db/migrate/20180503175053_ensure_missing_columns_to_project_mirror_data.rb b/db/migrate/20180503175053_ensure_missing_columns_to_project_mirror_data.rb
deleted file mode 100644
index 12ebac47850..00000000000
--- a/db/migrate/20180503175053_ensure_missing_columns_to_project_mirror_data.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-class EnsureMissingColumnsToProjectMirrorData < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/AddLimitToTextColumns
- # rubocop:disable Migration/PreventStrings
- def up
- add_column :project_mirror_data, :status, :string unless column_exists?(:project_mirror_data, :status)
- add_column :project_mirror_data, :jid, :string unless column_exists?(:project_mirror_data, :jid)
- add_column :project_mirror_data, :last_error, :text unless column_exists?(:project_mirror_data, :last_error)
- end
- # rubocop:enable Migration/PreventStrings
- # rubocop:enable Migration/AddLimitToTextColumns
-
- def down
- # db/migrate/20180502122856_create_project_mirror_data.rb will remove the table
- end
-end
diff --git a/db/migrate/20180503175054_add_indexes_to_project_mirror_data.rb b/db/migrate/20180503175054_add_indexes_to_project_mirror_data.rb
deleted file mode 100644
index 15a188594b0..00000000000
--- a/db/migrate/20180503175054_add_indexes_to_project_mirror_data.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class AddIndexesToProjectMirrorData < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :project_mirror_data, :jid
- add_concurrent_index :project_mirror_data, :status
- end
-
- def down
- # rubocop:disable Migration/RemoveIndex
- remove_index :project_mirror_data, :jid if index_exists? :project_mirror_data, :jid
- remove_index :project_mirror_data, :status if index_exists? :project_mirror_data, :status
- end
-end
diff --git a/db/migrate/20180503193542_add_indexes_to_remote_mirror.rb b/db/migrate/20180503193542_add_indexes_to_remote_mirror.rb
deleted file mode 100644
index 19bed8d0500..00000000000
--- a/db/migrate/20180503193542_add_indexes_to_remote_mirror.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class AddIndexesToRemoteMirror < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :remote_mirrors, :last_successful_update_at unless index_exists?(:remote_mirrors, :last_successful_update_at)
- end
-
- def down
- # ee/db/migrate/20170208144550_add_index_to_mirrors_last_update_at_fields.rb will remove the index.
- # rubocop:disable Migration/RemoveIndex
- remove_index :remote_mirrors, :last_successful_update_at if index_exists? :remote_mirrors, :last_successful_update_at
- end
-end
diff --git a/db/migrate/20180503193953_add_mirror_available_to_application_settings.rb b/db/migrate/20180503193953_add_mirror_available_to_application_settings.rb
deleted file mode 100644
index 117887a8bc2..00000000000
--- a/db/migrate/20180503193953_add_mirror_available_to_application_settings.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class AddMirrorAvailableToApplicationSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- # rubocop:disable Migration/AddColumnWithDefault
- add_column_with_default(:application_settings, :mirror_available, :boolean, default: true, allow_null: false) unless column_exists?(:application_settings, :mirror_available)
- # rubocop:enable Migration/AddColumnWithDefault
- end
-
- def down
- # ee/db/migrate/20171017125928_add_remote_mirror_available_to_application_settings.rb will remove the column.
- end
-end
diff --git a/db/migrate/20180503200320_enable_prometheus_metrics_by_default.rb b/db/migrate/20180503200320_enable_prometheus_metrics_by_default.rb
deleted file mode 100644
index bab3b178713..00000000000
--- a/db/migrate/20180503200320_enable_prometheus_metrics_by_default.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class EnablePrometheusMetricsByDefault < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def up
- change_column_default :application_settings, :prometheus_metrics_enabled, true
- end
-
- def down
- change_column_default :application_settings, :prometheus_metrics_enabled, false
- end
-end
diff --git a/db/migrate/20180504195842_project_name_lower_index.rb b/db/migrate/20180504195842_project_name_lower_index.rb
deleted file mode 100644
index e789837193f..00000000000
--- a/db/migrate/20180504195842_project_name_lower_index.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class ProjectNameLowerIndex < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
- INDEX_NAME = 'index_projects_on_lower_name'
-
- disable_ddl_transaction!
-
- def up
- disable_statement_timeout do
- execute "CREATE INDEX CONCURRENTLY #{INDEX_NAME} ON projects (LOWER(name))"
- end
- end
-
- def down
- disable_statement_timeout do
- execute "DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME}"
- end
- end
-end
diff --git a/db/migrate/20180508055821_make_remote_mirrors_disabled_by_default.rb b/db/migrate/20180508055821_make_remote_mirrors_disabled_by_default.rb
deleted file mode 100644
index 81aa18c8b86..00000000000
--- a/db/migrate/20180508055821_make_remote_mirrors_disabled_by_default.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class MakeRemoteMirrorsDisabledByDefault < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def up
- change_column_default :remote_mirrors, :enabled, false
- end
-
- def down
- change_column_default :remote_mirrors, :enabled, true
- end
-end
diff --git a/db/migrate/20180508100222_add_not_null_constraint_to_project_mirror_data_foreign_key.rb b/db/migrate/20180508100222_add_not_null_constraint_to_project_mirror_data_foreign_key.rb
deleted file mode 100644
index dba5d20f276..00000000000
--- a/db/migrate/20180508100222_add_not_null_constraint_to_project_mirror_data_foreign_key.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class AddNotNullConstraintToProjectMirrorDataForeignKey < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- class ProjectImportState < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'project_mirror_data'
- end
-
- def up
- ProjectImportState.where(project_id: nil).delete_all
-
- change_column_null :project_mirror_data, :project_id, false
- end
-
- def down
- change_column_null :project_mirror_data, :project_id, true
- end
-end
diff --git a/db/migrate/20180508102840_add_unique_constraint_to_project_mirror_data_project_id_index.rb b/db/migrate/20180508102840_add_unique_constraint_to_project_mirror_data_project_id_index.rb
deleted file mode 100644
index b225354ca43..00000000000
--- a/db/migrate/20180508102840_add_unique_constraint_to_project_mirror_data_project_id_index.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-class AddUniqueConstraintToProjectMirrorDataProjectIdIndex < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:project_mirror_data,
- :project_id,
- unique: true,
- name: 'index_project_mirror_data_on_project_id_unique')
-
- remove_concurrent_index_by_name(:project_mirror_data, 'index_project_mirror_data_on_project_id')
-
- rename_index(:project_mirror_data,
- 'index_project_mirror_data_on_project_id_unique',
- 'index_project_mirror_data_on_project_id')
- end
-
- def down
- rename_index(:project_mirror_data,
- 'index_project_mirror_data_on_project_id',
- 'index_project_mirror_data_on_project_id_old')
-
- add_concurrent_index(:project_mirror_data, :project_id)
-
- remove_concurrent_index_by_name(:project_mirror_data,
- 'index_project_mirror_data_on_project_id_old')
- end
-end
diff --git a/db/migrate/20180508135515_set_runner_type_not_null.rb b/db/migrate/20180508135515_set_runner_type_not_null.rb
deleted file mode 100644
index 00c546c8f47..00000000000
--- a/db/migrate/20180508135515_set_runner_type_not_null.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class SetRunnerTypeNotNull < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- change_column_null(:ci_runners, :runner_type, false)
- end
-end
diff --git a/db/migrate/20180511090724_add_index_on_ci_runners_runner_type.rb b/db/migrate/20180511090724_add_index_on_ci_runners_runner_type.rb
deleted file mode 100644
index 4913b8602c9..00000000000
--- a/db/migrate/20180511090724_add_index_on_ci_runners_runner_type.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class AddIndexOnCiRunnersRunnerType < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_runners, :runner_type
- end
-
- def down
- # rubocop:disable Migration/RemoveIndex
- remove_index :ci_runners, :runner_type
- end
-end
diff --git a/db/migrate/20180511131058_create_clusters_applications_jupyter.rb b/db/migrate/20180511131058_create_clusters_applications_jupyter.rb
deleted file mode 100644
index 908a6113f98..00000000000
--- a/db/migrate/20180511131058_create_clusters_applications_jupyter.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreateClustersApplicationsJupyter < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :clusters_applications_jupyter do |t|
- t.references :cluster, null: false, unique: true, foreign_key: { on_delete: :cascade }
- t.references :oauth_application, foreign_key: { on_delete: :nullify }
-
- t.integer :status, null: false
- t.string :version, null: false
- t.string :hostname
-
- t.timestamps_with_timezone null: false
-
- t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180515005612_add_squash_to_merge_requests.rb b/db/migrate/20180515005612_add_squash_to_merge_requests.rb
deleted file mode 100644
index dd301d22614..00000000000
--- a/db/migrate/20180515005612_add_squash_to_merge_requests.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddSquashToMergeRequests < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- def up
- unless column_exists?(:merge_requests, :squash)
- # rubocop:disable Migration/UpdateLargeTable
- add_column_with_default :merge_requests, :squash, :boolean, default: false, allow_null: false # rubocop:disable Migration/AddColumnWithDefault
- end
- end
-
- def down
- remove_column :merge_requests, :squash if column_exists?(:merge_requests, :squash)
- end
-end
diff --git a/db/migrate/20180515121227_create_notes_diff_files.rb b/db/migrate/20180515121227_create_notes_diff_files.rb
deleted file mode 100644
index 1797a86c679..00000000000
--- a/db/migrate/20180515121227_create_notes_diff_files.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-class CreateNotesDiffFiles < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- # rubocop:disable Migration/AddLimitToTextColumns
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :note_diff_files do |t|
- t.references :diff_note, references: :notes, null: false, index: { unique: true }
- 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
- end
-
- # rubocop:disable Migration/AddConcurrentForeignKey
- add_foreign_key :note_diff_files, :notes, column: :diff_note_id, on_delete: :cascade
- # rubocop:enable Migration/AddConcurrentForeignKey
- end
- # rubocop:enable Migration/PreventStrings
- # rubocop:enable Migration/AddLimitToTextColumns
-end
diff --git a/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb b/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb
deleted file mode 100644
index 859e341d04b..00000000000
--- a/db/migrate/20180517082340_add_not_null_constraints_to_project_authorizations.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-class AddNotNullConstraintsToProjectAuthorizations < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def up
- execute <<~SQL
- ALTER TABLE project_authorizations
- ALTER COLUMN user_id SET NOT NULL,
- ALTER COLUMN project_id SET NOT NULL,
- ALTER COLUMN access_level SET NOT NULL
- SQL
- end
-
- def down
- execute <<~SQL
- ALTER TABLE project_authorizations
- ALTER COLUMN user_id DROP NOT NULL,
- ALTER COLUMN project_id DROP NOT NULL,
- ALTER COLUMN access_level DROP NOT NULL
- SQL
- end
-end
diff --git a/db/migrate/20180523042841_rename_merge_requests_allow_maintainer_to_push.rb b/db/migrate/20180523042841_rename_merge_requests_allow_maintainer_to_push.rb
deleted file mode 100644
index 131dca1fbc2..00000000000
--- a/db/migrate/20180523042841_rename_merge_requests_allow_maintainer_to_push.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class RenameMergeRequestsAllowMaintainerToPush < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- # NOOP
- end
-
- def down
- if column_exists?(:merge_requests, :allow_collaboration)
- cleanup_concurrent_column_rename :merge_requests, :allow_collaboration, :allow_maintainer_to_push
- end
- end
-end
diff --git a/db/migrate/20180524132016_merge_requests_target_id_iid_state_partial_index.rb b/db/migrate/20180524132016_merge_requests_target_id_iid_state_partial_index.rb
deleted file mode 100644
index bff4690427e..00000000000
--- a/db/migrate/20180524132016_merge_requests_target_id_iid_state_partial_index.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class MergeRequestsTargetIdIidStatePartialIndex < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- INDEX_NAME = 'index_merge_requests_on_target_project_id_and_iid_opened'
-
- disable_ddl_transaction!
-
- def up
- # On GitLab.com this index will take up roughly 5 MB of space.
- add_concurrent_index(
- :merge_requests,
- [:target_project_id, :iid],
- where: "state = 'opened'",
- name: INDEX_NAME
- )
- end
-
- def down
- remove_concurrent_index_by_name(:merge_requests, INDEX_NAME)
- end
-end
diff --git a/db/migrate/20180529093006_ensure_remote_mirror_columns.rb b/db/migrate/20180529093006_ensure_remote_mirror_columns.rb
deleted file mode 100644
index 8cf636e1da6..00000000000
--- a/db/migrate/20180529093006_ensure_remote_mirror_columns.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-class EnsureRemoteMirrorColumns < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- # rubocop:disable Migration/Datetime
- # rubocop:disable Migration/PreventStrings
- def up
- add_column :remote_mirrors, :last_update_started_at, :datetime unless column_exists?(:remote_mirrors, :last_update_started_at)
- add_column :remote_mirrors, :remote_name, :string unless column_exists?(:remote_mirrors, :remote_name)
-
- unless column_exists?(:remote_mirrors, :only_protected_branches)
- add_column_with_default(:remote_mirrors, # rubocop:disable Migration/AddColumnWithDefault
- :only_protected_branches,
- :boolean,
- default: false,
- allow_null: false)
- end
- end
- # rubocop:enable Migration/PreventStrings
- # rubocop:enable Migration/Datetime
-
- def down
- # db/migrate/20180503131624_create_remote_mirrors.rb will remove the table
- end
-end
diff --git a/db/migrate/20180530135500_add_index_to_stages_position.rb b/db/migrate/20180530135500_add_index_to_stages_position.rb
deleted file mode 100644
index eabf94ab8ec..00000000000
--- a/db/migrate/20180530135500_add_index_to_stages_position.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class AddIndexToStagesPosition < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_stages, [:pipeline_id, :position]
- end
-
- def down
- remove_concurrent_index :ci_stages, [:pipeline_id, :position]
- end
-end
diff --git a/db/migrate/20180531185349_add_repository_languages.rb b/db/migrate/20180531185349_add_repository_languages.rb
deleted file mode 100644
index 08871e8b6f0..00000000000
--- a/db/migrate/20180531185349_add_repository_languages.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-class AddRepositoryLanguages < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def up
- create_table(:programming_languages) do |t|
- t.string :name, null: false
- t.string :color, null: false
- t.datetime_with_timezone :created_at, null: false
- end
-
- create_table(:repository_languages, id: false) do |t|
- t.references :project, null: false, foreign_key: { on_delete: :cascade }
- t.references :programming_language, null: false
- t.float :share, null: false
- end
-
- add_index :programming_languages, :name, unique: true
- add_index :repository_languages, [:project_id, :programming_language_id],
- unique: true, name: "index_repository_languages_on_project_and_languages_id"
- end
- # rubocop:enable Migration/PreventStrings
-
- def down
- drop_table :repository_languages
- drop_table :programming_languages
- end
-end
diff --git a/db/migrate/20180531220618_change_default_value_for_dsa_key_restriction.rb b/db/migrate/20180531220618_change_default_value_for_dsa_key_restriction.rb
deleted file mode 100644
index cf621c46f2b..00000000000
--- a/db/migrate/20180531220618_change_default_value_for_dsa_key_restriction.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class ChangeDefaultValueForDsaKeyRestriction < ActiveRecord::Migration[4.2]
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- def up
- change_column :application_settings, :dsa_key_restriction, :integer, null: false,
- default: -1
-
- execute("UPDATE application_settings SET dsa_key_restriction = -1")
- end
-
- def down
- change_column :application_settings, :dsa_key_restriction, :integer, null: false,
- default: 0
- end
-end
diff --git a/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb b/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb
deleted file mode 100644
index 67d20b949d9..00000000000
--- a/db/migrate/20180601213245_add_deploy_strategy_to_project_auto_devops.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddDeployStrategyToProjectAutoDevops < ActiveRecord::Migration[4.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 :project_auto_devops, :deploy_strategy, :integer, default: 0, allow_null: false # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :project_auto_devops, :deploy_strategy
- end
-end
diff --git a/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb b/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb
deleted file mode 100644
index 42bb0a784bb..00000000000
--- a/db/migrate/20180607071808_add_push_events_branch_filter_to_web_hooks.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddPushEventsBranchFilterToWebHooks < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :web_hooks, :push_events_branch_filter, :text # rubocop:disable Migration/AddLimitToTextColumns
- end
-end
diff --git a/db/migrate/20180608091413_add_group_to_todos.rb b/db/migrate/20180608091413_add_group_to_todos.rb
deleted file mode 100644
index 7f8efd78c59..00000000000
--- a/db/migrate/20180608091413_add_group_to_todos.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-class AddGroupToTodos < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- class Todo < ActiveRecord::Base
- self.table_name = 'todos'
-
- include ::EachBatch
- end
-
- def up
- add_column(:todos, :group_id, :integer) unless group_id_exists?
- add_concurrent_foreign_key :todos, :namespaces, column: :group_id, on_delete: :cascade
- add_concurrent_index :todos, :group_id
-
- change_column_null :todos, :project_id, true
- end
-
- def down
- remove_foreign_key_without_error(:todos, column: :group_id)
- remove_concurrent_index(:todos, :group_id)
- remove_column(:todos, :group_id) if group_id_exists?
-
- Todo.where(project_id: nil).each_batch { |batch| batch.delete_all }
- change_column_null :todos, :project_id, false
- end
-
- private
-
- def group_id_exists?
- column_exists?(:todos, :group_id)
- end
-end
diff --git a/db/migrate/20180608110058_rename_merge_requests_allow_collaboration.rb b/db/migrate/20180608110058_rename_merge_requests_allow_collaboration.rb
deleted file mode 100644
index 0f2d5ba3a5e..00000000000
--- a/db/migrate/20180608110058_rename_merge_requests_allow_collaboration.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class RenameMergeRequestsAllowCollaboration < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- if column_exists?(:merge_requests, :allow_collaboration)
- # rubocop:disable Migration/UpdateLargeTable
- rename_column_concurrently :merge_requests, :allow_collaboration, :allow_maintainer_to_push
- end
- end
-
- def down
- # NOOP
- end
-end
diff --git a/db/migrate/20180612103626_add_columns_for_helm_tiller_certificates.rb b/db/migrate/20180612103626_add_columns_for_helm_tiller_certificates.rb
deleted file mode 100644
index 515aab45145..00000000000
--- a/db/migrate/20180612103626_add_columns_for_helm_tiller_certificates.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-class AddColumnsForHelmTillerCertificates < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- add_column :clusters_applications_helm, :encrypted_ca_key, :text
- add_column :clusters_applications_helm, :encrypted_ca_key_iv, :text
- add_column :clusters_applications_helm, :ca_cert, :text
- end
- # rubocop:enable Migration/AddLimitToTextColumns
-end
diff --git a/db/migrate/20180613081317_create_ci_builds_runner_session.rb b/db/migrate/20180613081317_create_ci_builds_runner_session.rb
deleted file mode 100644
index 29e133de1b7..00000000000
--- a/db/migrate/20180613081317_create_ci_builds_runner_session.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CreateCiBuildsRunnerSession < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :ci_builds_runner_session, id: :bigserial do |t|
- t.integer :build_id, null: false
- t.string :url, null: false
- t.string :certificate
- t.string :authorization
-
- t.foreign_key :ci_builds, column: :build_id, on_delete: :cascade
- t.index :build_id, unique: true
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180625113853_create_import_export_uploads.rb b/db/migrate/20180625113853_create_import_export_uploads.rb
deleted file mode 100644
index 2fe5a1e7f6b..00000000000
--- a/db/migrate/20180625113853_create_import_export_uploads.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class CreateImportExportUploads < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- create_table :import_export_uploads do |t|
- t.datetime_with_timezone :updated_at, null: false
-
- t.references :project, index: true, foreign_key: { on_delete: :cascade }, unique: true
-
- t.text :import_file
- t.text :export_file
- end
-
- add_index :import_export_uploads, :updated_at
- end
- # rubocop:enable Migration/AddLimitToTextColumns
-end
diff --git a/db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb b/db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb
deleted file mode 100644
index 0fc14b43fae..00000000000
--- a/db/migrate/20180626125654_add_index_on_deployable_for_deployments.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddIndexOnDeployableForDeployments < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :deployments, [:deployable_type, :deployable_id]
- end
-
- def down
- remove_concurrent_index :deployments, [:deployable_type, :deployable_id]
- end
-end
diff --git a/db/migrate/20180628124813_alter_web_hook_logs_indexes.rb b/db/migrate/20180628124813_alter_web_hook_logs_indexes.rb
deleted file mode 100644
index 64ef165c5e6..00000000000
--- a/db/migrate/20180628124813_alter_web_hook_logs_indexes.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 AlterWebHookLogsIndexes < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- # "created_at" comes first so the Sidekiq worker pruning old webhook logs can
- # use a composite index.
- #
- # We leave the old standalone index on "web_hook_id" in place so future code
- # that doesn't care about "created_at" can still use that index.
- COLUMNS_TO_INDEX = %i[created_at web_hook_id]
-
- def up
- add_concurrent_index(:web_hook_logs, COLUMNS_TO_INDEX)
- end
-
- def down
- remove_concurrent_index(:web_hook_logs, COLUMNS_TO_INDEX)
- end
-end
diff --git a/db/migrate/20180629153018_create_site_statistics.rb b/db/migrate/20180629153018_create_site_statistics.rb
deleted file mode 100644
index 60a32b3b2a7..00000000000
--- a/db/migrate/20180629153018_create_site_statistics.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class CreateSiteStatistics < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- create_table :site_statistics do |t|
- t.integer :repositories_count, default: 0, null: false
- t.integer :wikis_count, default: 0, null: false
- end
-
- execute('INSERT INTO site_statistics (id) VALUES(1)')
- end
-
- def down
- drop_table :site_statistics
- end
-end
diff --git a/db/migrate/20180702124358_remove_orphaned_routes.rb b/db/migrate/20180702124358_remove_orphaned_routes.rb
deleted file mode 100644
index 62c15f9cd00..00000000000
--- a/db/migrate/20180702124358_remove_orphaned_routes.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class RemoveOrphanedRoutes < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- class Route < ActiveRecord::Base
- self.table_name = 'routes'
- include EachBatch
-
- def self.orphaned_namespace_routes
- where(source_type: 'Namespace')
- .where('NOT EXISTS ( SELECT 1 FROM namespaces WHERE namespaces.id = routes.source_id )')
- end
-
- def self.orphaned_project_routes
- where(source_type: 'Project')
- .where('NOT EXISTS ( SELECT 1 FROM projects WHERE projects.id = routes.source_id )')
- end
- end
-
- def up
- # Some of these queries can take up to 10 seconds to run on GitLab.com,
- # which is pretty close to our 15 second statement timeout. To ensure a
- # smooth deployment procedure we disable the statement timeouts for this
- # migration, just in case.
- disable_statement_timeout do
- # On GitLab.com there are around 4000 orphaned project routes, and around
- # 150 orphaned namespace routes.
- [
- Route.orphaned_project_routes,
- Route.orphaned_namespace_routes
- ].each do |relation|
- relation.each_batch(of: 1_000) do |batch|
- batch.delete_all
- end
- end
- end
- end
-
- def down
- # There is no way to restore orphaned routes, and this doesn't make any
- # sense anyway.
- end
-end
diff --git a/db/migrate/20180702134423_generate_missing_routes.rb b/db/migrate/20180702134423_generate_missing_routes.rb
deleted file mode 100644
index dd1106c9e6a..00000000000
--- a/db/migrate/20180702134423_generate_missing_routes.rb
+++ /dev/null
@@ -1,144 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-# This migration generates missing routes for any projects and namespaces that
-# don't already have a route.
-#
-# On GitLab.com this would insert 611 project routes, and 0 namespace routes.
-# The exact number could vary per instance, so we take care of both just in
-# case.
-class GenerateMissingRoutes < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- class User < ActiveRecord::Base
- self.table_name = 'users'
- end
-
- class Route < ActiveRecord::Base
- self.table_name = 'routes'
- end
-
- module Routable
- def build_full_path
- if parent && path
- parent.build_full_path + '/' + path
- else
- path
- end
- end
-
- def build_full_name
- if parent && name
- parent.human_name + ' / ' + name
- else
- name
- end
- end
-
- def human_name
- build_full_name
- end
-
- def attributes_for_insert
- time = Time.zone.now
-
- {
- # We can't use "self.class.name" here as that would include the
- # migration namespace.
- source_type: source_type_for_route,
- source_id: id,
- created_at: time,
- updated_at: time,
- name: build_full_name,
-
- # The route path might already be taken. Instead of trying to generate a
- # new unique name on every conflict, we just append the row ID to the
- # route path.
- path: "#{build_full_path}-#{id}"
- }
- end
- end
-
- class Project < ActiveRecord::Base
- self.table_name = 'projects'
-
- include EachBatch
- include GenerateMissingRoutes::Routable
-
- belongs_to :namespace, class_name: 'GenerateMissingRoutes::Namespace'
-
- has_one :route,
- as: :source,
- inverse_of: :source,
- class_name: 'GenerateMissingRoutes::Route'
-
- alias_method :parent, :namespace
- alias_attribute :parent_id, :namespace_id
-
- def self.without_routes
- where(
- 'NOT EXISTS (
- SELECT 1
- FROM routes
- WHERE source_type = ?
- AND source_id = projects.id
- )',
- 'Project'
- )
- end
-
- def source_type_for_route
- 'Project'
- end
- end
-
- class Namespace < ActiveRecord::Base
- self.table_name = 'namespaces'
- self.inheritance_column = :_type_disabled
-
- include EachBatch
- include GenerateMissingRoutes::Routable
-
- belongs_to :parent, class_name: 'GenerateMissingRoutes::Namespace'
- belongs_to :owner, class_name: 'GenerateMissingRoutes::User'
-
- has_one :route,
- as: :source,
- inverse_of: :source,
- class_name: 'GenerateMissingRoutes::Route'
-
- def self.without_routes
- where(
- 'NOT EXISTS (
- SELECT 1
- FROM routes
- WHERE source_type = ?
- AND source_id = namespaces.id
- )',
- 'Namespace'
- )
- end
-
- def source_type_for_route
- 'Namespace'
- end
- end
-
- def up
- [Namespace, Project].each do |model|
- model.without_routes.each_batch(of: 100) do |batch|
- rows = batch.map(&:attributes_for_insert)
-
- Gitlab::Database.bulk_insert(:routes, rows)
- end
- end
- end
-
- def down
- # Removing routes we previously generated makes no sense.
- end
-end
diff --git a/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb b/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb
deleted file mode 100644
index b037f72a964..00000000000
--- a/db/migrate/20180704204006_add_hide_third_party_offers_to_application_settings.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class AddHideThirdPartyOffersToApplicationSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:application_settings, :hide_third_party_offers, # rubocop:disable Migration/AddColumnWithDefault
- :boolean,
- default: false,
- allow_null: false)
- end
-
- def down
- remove_column(:application_settings, :hide_third_party_offers)
- end
-end
diff --git a/db/migrate/20180705160945_add_file_format_to_ci_job_artifacts.rb b/db/migrate/20180705160945_add_file_format_to_ci_job_artifacts.rb
deleted file mode 100644
index 938438841a5..00000000000
--- a/db/migrate/20180705160945_add_file_format_to_ci_job_artifacts.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class AddFileFormatToCiJobArtifacts < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def change
- add_column :ci_job_artifacts, :file_format, :integer, limit: 2
- end
-end
diff --git a/db/migrate/20180710162338_add_foreign_key_from_notification_settings_to_users.rb b/db/migrate/20180710162338_add_foreign_key_from_notification_settings_to_users.rb
deleted file mode 100644
index 79691f2b24c..00000000000
--- a/db/migrate/20180710162338_add_foreign_key_from_notification_settings_to_users.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-class AddForeignKeyFromNotificationSettingsToUsers < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- class NotificationSetting < ActiveRecord::Base
- self.table_name = 'notification_settings'
-
- include EachBatch
- end
-
- class User < ActiveRecord::Base
- self.table_name = 'users'
- end
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- NotificationSetting.each_batch(of: 1000) do |batch|
- batch.where('NOT EXISTS (?)', User.select(1).where('users.id = notification_settings.user_id'))
- .delete_all
- end
-
- add_concurrent_foreign_key(:notification_settings, :users, column: :user_id, on_delete: :cascade)
- end
-
- def down
- remove_foreign_key(:notification_settings, column: :user_id)
- end
-end
diff --git a/db/migrate/20180711103851_drop_duplicate_protected_tags.rb b/db/migrate/20180711103851_drop_duplicate_protected_tags.rb
deleted file mode 100644
index 94f72aa162d..00000000000
--- a/db/migrate/20180711103851_drop_duplicate_protected_tags.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class DropDuplicateProtectedTags < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- BATCH_SIZE = 1000
-
- class Project < ActiveRecord::Base
- self.table_name = 'projects'
-
- include ::EachBatch
- end
-
- class ProtectedTag < ActiveRecord::Base
- self.table_name = 'protected_tags'
- end
-
- def up
- Project.each_batch(of: BATCH_SIZE) do |projects|
- ids = ProtectedTag
- .where(project_id: projects)
- .group(:name, :project_id)
- .select('max(id)')
-
- tags = ProtectedTag
- .where(project_id: projects)
- .where.not(id: ids)
-
- tags.delete_all
- end
- end
-
- def down
- end
-end
diff --git a/db/migrate/20180711103922_add_protected_tags_index.rb b/db/migrate/20180711103922_add_protected_tags_index.rb
deleted file mode 100644
index ef81ca633c3..00000000000
--- a/db/migrate/20180711103922_add_protected_tags_index.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddProtectedTagsIndex < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :protected_tags, [:project_id, :name], unique: true
- end
-
- def down
- remove_concurrent_index :protected_tags, [:project_id, :name]
- end
-end
diff --git a/db/migrate/20180713092803_create_user_statuses.rb b/db/migrate/20180713092803_create_user_statuses.rb
deleted file mode 100644
index 79a12c9b8ee..00000000000
--- a/db/migrate/20180713092803_create_user_statuses.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class CreateUserStatuses < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :user_statuses, id: false, primary_key: :user_id do |t|
- t.references :user,
- foreign_key: { on_delete: :cascade },
- null: false,
- primary_key: true
- t.integer :cached_markdown_version, limit: 4
- t.string :emoji, null: false, default: 'speech_balloon'
- t.string :message, limit: 100
- t.string :message_html
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180717125853_remove_restricted_todos.rb b/db/migrate/20180717125853_remove_restricted_todos.rb
deleted file mode 100644
index 1d4bbf6571e..00000000000
--- a/db/migrate/20180717125853_remove_restricted_todos.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-# frozen_string_literal: true
-
-class RemoveRestrictedTodos < ActiveRecord::Migration[4.2]
- DOWNTIME = false
- disable_ddl_transaction!
-
- MIGRATION = 'RemoveRestrictedTodos'.freeze
- BATCH_SIZE = 1000
- DELAY_INTERVAL = 5.minutes.to_i
-
- class Project < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'projects'
- end
-
- def up
- Project.where('EXISTS (SELECT 1 FROM todos WHERE todos.project_id = projects.id)')
- .each_batch(of: BATCH_SIZE) do |batch, index|
- range = batch.pluck('MIN(id)', 'MAX(id)').first
-
- BackgroundMigrationWorker.perform_in(index * DELAY_INTERVAL, MIGRATION, range)
- end
- end
-
- def down
- # nothing to do
- end
-end
diff --git a/db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb b/db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb
deleted file mode 100644
index 9e453be8c57..00000000000
--- a/db/migrate/20180718005113_add_instance_statistics_visibility_to_application_setting.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class AddInstanceStatisticsVisibilityToApplicationSetting < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:application_settings, :instance_statistics_visibility_private, # rubocop:disable Migration/AddColumnWithDefault
- :boolean,
- default: false,
- allow_null: false)
- end
-
- def down
- remove_column(:application_settings, :instance_statistics_visibility_private)
- end
-end
diff --git a/db/migrate/20180720023512_add_receive_max_input_size_to_application_settings.rb b/db/migrate/20180720023512_add_receive_max_input_size_to_application_settings.rb
deleted file mode 100644
index 0cf3c78507e..00000000000
--- a/db/migrate/20180720023512_add_receive_max_input_size_to_application_settings.rb
+++ /dev/null
@@ -1,11 +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 AddReceiveMaxInputSizeToApplicationSettings < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def change
- add_column :application_settings, :receive_max_input_size, :integer
- end
-end
diff --git a/db/migrate/20180722103201_add_private_profile_to_users.rb b/db/migrate/20180722103201_add_private_profile_to_users.rb
deleted file mode 100644
index 63b7a631fc8..00000000000
--- a/db/migrate/20180722103201_add_private_profile_to_users.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddPrivateProfileToUsers < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def change
- add_column :users, :private_profile, :boolean # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20180723135214_add_web_ide_client_side_preview_enabled_to_application_settings.rb b/db/migrate/20180723135214_add_web_ide_client_side_preview_enabled_to_application_settings.rb
deleted file mode 100644
index 96b5c43d0a3..00000000000
--- a/db/migrate/20180723135214_add_web_ide_client_side_preview_enabled_to_application_settings.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class AddWebIdeClientSidePreviewEnabledToApplicationSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:application_settings, :web_ide_clientside_preview_enabled, # rubocop:disable Migration/AddColumnWithDefault
- :boolean,
- default: false,
- allow_null: false)
- end
-
- def down
- remove_column(:application_settings, :web_ide_clientside_preview_enabled)
- end
-end
diff --git a/db/migrate/20180726172057_create_resource_label_events.rb b/db/migrate/20180726172057_create_resource_label_events.rb
deleted file mode 100644
index 550e35d6f90..00000000000
--- a/db/migrate/20180726172057_create_resource_label_events.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class CreateResourceLabelEvents < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :resource_label_events, id: :bigserial do |t|
- t.integer :action, null: false
- t.references :issue, null: true, index: true, foreign_key: { on_delete: :cascade }
- t.references :merge_request, null: true, index: true, foreign_key: { on_delete: :cascade }
- t.references :label, index: true, foreign_key: { on_delete: :nullify }
- t.references :user, index: true, foreign_key: { on_delete: :nullify }
- t.datetime_with_timezone :created_at, null: false
- end
- end
-end
diff --git a/db/migrate/20180807153545_remove_redundant_status_index_on_ci_builds.rb b/db/migrate/20180807153545_remove_redundant_status_index_on_ci_builds.rb
deleted file mode 100644
index c957fc2f6fc..00000000000
--- a/db/migrate/20180807153545_remove_redundant_status_index_on_ci_builds.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveRedundantStatusIndexOnCiBuilds < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index :ci_builds, :status
- end
-
- def down
- add_concurrent_index :ci_builds, :status
- end
-end
diff --git a/db/migrate/20180808162000_add_user_show_add_ssh_key_message_to_application_settings.rb b/db/migrate/20180808162000_add_user_show_add_ssh_key_message_to_application_settings.rb
deleted file mode 100644
index 6bf54f79644..00000000000
--- a/db/migrate/20180808162000_add_user_show_add_ssh_key_message_to_application_settings.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddUserShowAddSshKeyMessageToApplicationSettings < ActiveRecord::Migration[4.2]
- 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, :user_show_add_ssh_key_message, :boolean, default: true, allow_null: false
- # rubocop:enable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column :application_settings, :user_show_add_ssh_key_message
- end
-end
diff --git a/db/migrate/20180813101999_change_default_of_auto_devops_instance_wide.rb b/db/migrate/20180813101999_change_default_of_auto_devops_instance_wide.rb
deleted file mode 100644
index da101bc76e3..00000000000
--- a/db/migrate/20180813101999_change_default_of_auto_devops_instance_wide.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class ChangeDefaultOfAutoDevopsInstanceWide < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- change_column_default :application_settings, :auto_devops_enabled, true
- end
-
- def down
- change_column_default :application_settings, :auto_devops_enabled, false
- end
-end
diff --git a/db/migrate/20180813102000_enable_auto_devops_instance_wide_for_everyone.rb b/db/migrate/20180813102000_enable_auto_devops_instance_wide_for_everyone.rb
deleted file mode 100644
index 1531fad2c6c..00000000000
--- a/db/migrate/20180813102000_enable_auto_devops_instance_wide_for_everyone.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class EnableAutoDevopsInstanceWideForEveryone < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- execute "UPDATE application_settings SET auto_devops_enabled = true"
- end
-
- def down
- # No way to know here what their previous setting was...
- end
-end
diff --git a/db/migrate/20180814153625_add_commit_email_to_users.rb b/db/migrate/20180814153625_add_commit_email_to_users.rb
deleted file mode 100644
index c94ee9512de..00000000000
--- a/db/migrate/20180814153625_add_commit_email_to_users.rb
+++ /dev/null
@@ -1,37 +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 AddCommitEmailToUsers < ActiveRecord::Migration[4.2]
- 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!
-
- # rubocop:disable Migration/PreventStrings
- # rubocop:disable Migration/AddColumnsToWideTables
- def change
- add_column :users, :commit_email, :string
- end
- # rubocop:enable Migration/AddColumnsToWideTables
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180815040323_add_authorization_type_to_cluster_platforms_kubernetes.rb b/db/migrate/20180815040323_add_authorization_type_to_cluster_platforms_kubernetes.rb
deleted file mode 100644
index 44125b4696a..00000000000
--- a/db/migrate/20180815040323_add_authorization_type_to_cluster_platforms_kubernetes.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddAuthorizationTypeToClusterPlatformsKubernetes < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :cluster_platforms_kubernetes, :authorization_type, :integer, limit: 2
- end
-end
diff --git a/db/migrate/20180815160409_add_file_location_to_ci_job_artifacts.rb b/db/migrate/20180815160409_add_file_location_to_ci_job_artifacts.rb
deleted file mode 100644
index 389101902d0..00000000000
--- a/db/migrate/20180815160409_add_file_location_to_ci_job_artifacts.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class AddFileLocationToCiJobArtifacts < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :ci_job_artifacts, :file_location, :integer, limit: 2
- end
-end
diff --git a/db/migrate/20180815170510_add_partial_index_to_ci_builds_artifacts_file.rb b/db/migrate/20180815170510_add_partial_index_to_ci_builds_artifacts_file.rb
deleted file mode 100644
index 237e6ba4559..00000000000
--- a/db/migrate/20180815170510_add_partial_index_to_ci_builds_artifacts_file.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class AddPartialIndexToCiBuildsArtifactsFile < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'partial_index_ci_builds_on_id_with_legacy_artifacts'.freeze
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:ci_builds, :id, where: "artifacts_file <> ''", name: INDEX_NAME)
- end
-
- def down
- remove_concurrent_index_by_name(:ci_builds, INDEX_NAME)
- end
-end
diff --git a/db/migrate/20180815175440_add_index_on_list_type.rb b/db/migrate/20180815175440_add_index_on_list_type.rb
deleted file mode 100644
index 3fe0f6b8de5..00000000000
--- a/db/migrate/20180815175440_add_index_on_list_type.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-class AddIndexOnListType < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :lists, :list_type
- end
-
- def down
- remove_concurrent_index :lists, :list_type
- end
-end
diff --git a/db/migrate/20180824202952_add_outbound_requests_whitelist_to_application_settings.rb b/db/migrate/20180824202952_add_outbound_requests_whitelist_to_application_settings.rb
deleted file mode 100644
index 7b87b04bc9d..00000000000
--- a/db/migrate/20180824202952_add_outbound_requests_whitelist_to_application_settings.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddOutboundRequestsWhitelistToApplicationSettings < ActiveRecord::Migration[5.1]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :application_settings, :outbound_local_requests_whitelist, :string, array: true, limit: 255
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180831164905_add_common_to_prometheus_metrics.rb b/db/migrate/20180831164905_add_common_to_prometheus_metrics.rb
deleted file mode 100644
index 6654e6d1957..00000000000
--- a/db/migrate/20180831164905_add_common_to_prometheus_metrics.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddCommonToPrometheusMetrics < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:prometheus_metrics, :common, :boolean, default: false) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:prometheus_metrics, :common)
- end
-end
diff --git a/db/migrate/20180831164907_add_index_on_common_for_prometheus_metrics.rb b/db/migrate/20180831164907_add_index_on_common_for_prometheus_metrics.rb
deleted file mode 100644
index 5758321891a..00000000000
--- a/db/migrate/20180831164907_add_index_on_common_for_prometheus_metrics.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnCommonForPrometheusMetrics < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :prometheus_metrics, :common
- end
-
- def down
- remove_concurrent_index :prometheus_metrics, :common
- end
-end
diff --git a/db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb b/db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb
deleted file mode 100644
index efdcab53920..00000000000
--- a/db/migrate/20180831164908_add_identifier_to_prometheus_metric.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddIdentifierToPrometheusMetric < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :prometheus_metrics, :identifier, :string # rubocop:disable Migration/PreventStrings
- end
-end
diff --git a/db/migrate/20180831164909_add_index_for_identifier_to_prometheus_metric.rb b/db/migrate/20180831164909_add_index_for_identifier_to_prometheus_metric.rb
deleted file mode 100644
index 1f6cfc181f4..00000000000
--- a/db/migrate/20180831164909_add_index_for_identifier_to_prometheus_metric.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexForIdentifierToPrometheusMetric < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :prometheus_metrics, :identifier, unique: true
- end
-
- def down
- remove_concurrent_index :prometheus_metrics, :identifier, unique: true
- end
-end
diff --git a/db/migrate/20180831164910_import_common_metrics.rb b/db/migrate/20180831164910_import_common_metrics.rb
deleted file mode 100644
index 4e61a25c1ad..00000000000
--- a/db/migrate/20180831164910_import_common_metrics.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class ImportCommonMetrics < ActiveRecord::Migration[4.2]
- 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/20180901171833_add_project_config_source_status_index_to_pipeline.rb b/db/migrate/20180901171833_add_project_config_source_status_index_to_pipeline.rb
deleted file mode 100644
index f2136657d95..00000000000
--- a/db/migrate/20180901171833_add_project_config_source_status_index_to_pipeline.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectConfigSourceStatusIndexToPipeline < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_pipelines, [:project_id, :status, :config_source]
- end
-
- def down
- remove_concurrent_index :ci_pipelines, [:project_id, :status, :config_source]
- end
-end
diff --git a/db/migrate/20180901200537_add_resource_label_event_reference_fields.rb b/db/migrate/20180901200537_add_resource_label_event_reference_fields.rb
deleted file mode 100644
index 2dc86e1ac9a..00000000000
--- a/db/migrate/20180901200537_add_resource_label_event_reference_fields.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddResourceLabelEventReferenceFields < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- add_column :resource_label_events, :cached_markdown_version, :integer
- add_column :resource_label_events, :reference, :text
- add_column :resource_label_events, :reference_html, :text
- end
- # rubocop:enable Migration/AddLimitToTextColumns
-end
diff --git a/db/migrate/20180902070406_create_group_group_links.rb b/db/migrate/20180902070406_create_group_group_links.rb
deleted file mode 100644
index 95fed0ebf96..00000000000
--- a/db/migrate/20180902070406_create_group_group_links.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# frozen_string_literal: true
-
-class CreateGroupGroupLinks < ActiveRecord::Migration[5.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- create_table :group_group_links do |t|
- t.timestamps_with_timezone null: false
-
- t.references :shared_group, null: false,
- index: false,
- foreign_key: { on_delete: :cascade,
- to_table: :namespaces }
- t.references :shared_with_group, null: false,
- foreign_key: { on_delete: :cascade,
- to_table: :namespaces }
- t.date :expires_at
- t.index [:shared_group_id, :shared_with_group_id],
- { unique: true,
- name: 'index_group_group_links_on_shared_group_and_shared_with_group' }
- t.integer :group_access, { limit: 2,
- default: 30, # Gitlab::Access::DEVELOPER
- null: false }
- end
- end
-
- def down
- drop_table :group_group_links
- end
-end
diff --git a/db/migrate/20180906101639_add_user_ping_consent_to_application_settings.rb b/db/migrate/20180906101639_add_user_ping_consent_to_application_settings.rb
deleted file mode 100644
index 334efa12e7b..00000000000
--- a/db/migrate/20180906101639_add_user_ping_consent_to_application_settings.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddUserPingConsentToApplicationSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column :application_settings, :usage_stats_set_by_user_id, :integer
- add_concurrent_foreign_key :application_settings, :users, column: :usage_stats_set_by_user_id, on_delete: :nullify
- end
-
- def down
- remove_foreign_key :application_settings, column: :usage_stats_set_by_user_id
- remove_column :application_settings, :usage_stats_set_by_user_id
- end
-end
diff --git a/db/migrate/20180907015926_add_legacy_abac_to_cluster_providers_gcp.rb b/db/migrate/20180907015926_add_legacy_abac_to_cluster_providers_gcp.rb
deleted file mode 100644
index 8bfb0c5612a..00000000000
--- a/db/migrate/20180907015926_add_legacy_abac_to_cluster_providers_gcp.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddLegacyAbacToClusterProvidersGcp < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:cluster_providers_gcp, :legacy_abac, :boolean, default: true) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:cluster_providers_gcp, :legacy_abac)
- end
-end
diff --git a/db/migrate/20180910115836_add_attr_encrypted_columns_to_web_hook.rb b/db/migrate/20180910115836_add_attr_encrypted_columns_to_web_hook.rb
deleted file mode 100644
index 3341fd5c593..00000000000
--- a/db/migrate/20180910115836_add_attr_encrypted_columns_to_web_hook.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddAttrEncryptedColumnsToWebHook < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :web_hooks, :encrypted_token, :string
- add_column :web_hooks, :encrypted_token_iv, :string
-
- add_column :web_hooks, :encrypted_url, :string
- add_column :web_hooks, :encrypted_url_iv, :string
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180910153412_add_token_digest_to_personal_access_tokens.rb b/db/migrate/20180910153412_add_token_digest_to_personal_access_tokens.rb
deleted file mode 100644
index 4ed31bf7f39..00000000000
--- a/db/migrate/20180910153412_add_token_digest_to_personal_access_tokens.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddTokenDigestToPersonalAccessTokens < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- change_column :personal_access_tokens, :token, :string, null: true
-
- add_column :personal_access_tokens, :token_digest, :string # rubocop:disable Migration/PreventStrings
- end
-
- def down
- remove_column :personal_access_tokens, :token_digest
-
- change_column :personal_access_tokens, :token, :string, null: false
- end
-end
diff --git a/db/migrate/20180910153413_add_index_to_token_digest_on_personal_access_tokens.rb b/db/migrate/20180910153413_add_index_to_token_digest_on_personal_access_tokens.rb
deleted file mode 100644
index d501b07614a..00000000000
--- a/db/migrate/20180910153413_add_index_to_token_digest_on_personal_access_tokens.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToTokenDigestOnPersonalAccessTokens < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :personal_access_tokens, :token_digest, unique: true
- end
-
- def down
- remove_concurrent_index :personal_access_tokens, :token_digest if index_exists?(:personal_access_tokens, :token_digest)
- end
-end
diff --git a/db/migrate/20180912111628_add_knative_application.rb b/db/migrate/20180912111628_add_knative_application.rb
deleted file mode 100644
index cd2512cc17a..00000000000
--- a/db/migrate/20180912111628_add_knative_application.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class AddKnativeApplication < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table "clusters_applications_knative" do |t|
- t.references :cluster, null: false, unique: true, foreign_key: { on_delete: :cascade }
-
- 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" # rubocop:disable Migration/AddLimitToTextColumns
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20180916011959_add_index_pipelines_project_id_source.rb b/db/migrate/20180916011959_add_index_pipelines_project_id_source.rb
deleted file mode 100644
index 5b71c79ac86..00000000000
--- a/db/migrate/20180916011959_add_index_pipelines_project_id_source.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 AddIndexPipelinesProjectIdSource < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_pipelines, [:project_id, :source]
- end
-
- def down
- remove_concurrent_index :ci_pipelines, [:project_id, :source]
- end
-end
diff --git a/db/migrate/20180924141949_add_diff_max_patch_bytes_to_application_settings.rb b/db/migrate/20180924141949_add_diff_max_patch_bytes_to_application_settings.rb
deleted file mode 100644
index 69166f8d1a4..00000000000
--- a/db/migrate/20180924141949_add_diff_max_patch_bytes_to_application_settings.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 AddDiffMaxPatchBytesToApplicationSettings < ActiveRecord::Migration[4.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(:application_settings, # rubocop:disable Migration/AddColumnWithDefault
- :diff_max_patch_bytes,
- :integer,
- default: 100.kilobytes,
- allow_null: false)
- end
-
- def down
- remove_column(:application_settings, :diff_max_patch_bytes)
- end
-end
diff --git a/db/migrate/20180924190739_add_scheduled_at_to_ci_builds.rb b/db/migrate/20180924190739_add_scheduled_at_to_ci_builds.rb
deleted file mode 100644
index 04a784a0c90..00000000000
--- a/db/migrate/20180924190739_add_scheduled_at_to_ci_builds.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddScheduledAtToCiBuilds < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def change
- add_column :ci_builds, :scheduled_at, :datetime_with_timezone # rubocop:disable Migration/AddColumnsToWideTables
- end
-end
diff --git a/db/migrate/20180924201039_add_partial_index_to_scheduled_at.rb b/db/migrate/20180924201039_add_partial_index_to_scheduled_at.rb
deleted file mode 100644
index 378fc4e5fea..00000000000
--- a/db/migrate/20180924201039_add_partial_index_to_scheduled_at.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddPartialIndexToScheduledAt < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'partial_index_ci_builds_on_scheduled_at_with_scheduled_jobs'.freeze
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:ci_builds, :scheduled_at, where: "scheduled_at IS NOT NULL AND type = 'Ci::Build' AND status = 'scheduled'", name: INDEX_NAME)
- end
-
- def down
- remove_concurrent_index_by_name(:ci_builds, INDEX_NAME)
- end
-end
diff --git a/db/migrate/20180925200829_create_user_preferences.rb b/db/migrate/20180925200829_create_user_preferences.rb
deleted file mode 100644
index b46df8157a6..00000000000
--- a/db/migrate/20180925200829_create_user_preferences.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-class CreateUserPreferences < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- class UserPreference < ActiveRecord::Base
- self.table_name = 'user_preferences'
-
- NOTES_FILTERS = { all_notes: 0, comments: 1 }.freeze
- end
-
- def change
- create_table :user_preferences do |t|
- t.references :user,
- null: false,
- index: { unique: true },
- foreign_key: { on_delete: :cascade }
-
- t.integer :issue_notes_filter,
- default: UserPreference::NOTES_FILTERS[:all_notes],
- null: false, limit: 2
-
- t.integer :merge_request_notes_filter,
- default: UserPreference::NOTES_FILTERS[:all_notes],
- null: false,
- limit: 2
-
- t.timestamps_with_timezone null: false
- end
- end
-end
diff --git a/db/migrate/20180927073410_add_index_to_project_deploy_tokens_deploy_token_id.rb b/db/migrate/20180927073410_add_index_to_project_deploy_tokens_deploy_token_id.rb
deleted file mode 100644
index edfcad81202..00000000000
--- a/db/migrate/20180927073410_add_index_to_project_deploy_tokens_deploy_token_id.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToProjectDeployTokensDeployTokenId < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :project_deploy_tokens, :deploy_token_id
- end
-
- def down
- remove_concurrent_index(:project_deploy_tokens, :deploy_token_id)
- end
-end
diff --git a/db/migrate/20181002172433_remove_restricted_todos_with_cte.rb b/db/migrate/20181002172433_remove_restricted_todos_with_cte.rb
deleted file mode 100644
index 7826c8d802e..00000000000
--- a/db/migrate/20181002172433_remove_restricted_todos_with_cte.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.
-
-# rescheduling of the revised RemoveRestrictedTodos background migration
-class RemoveRestrictedTodosWithCte < ActiveRecord::Migration[4.2]
- DOWNTIME = false
- disable_ddl_transaction!
-
- MIGRATION = 'RemoveRestrictedTodos'.freeze
- BATCH_SIZE = 1000
- DELAY_INTERVAL = 5.minutes.to_i
-
- class Project < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'projects'
- end
-
- def up
- Project.where('EXISTS (SELECT 1 FROM todos WHERE todos.project_id = projects.id)')
- .each_batch(of: BATCH_SIZE) do |batch, index|
- range = batch.pluck('MIN(id)', 'MAX(id)').first
-
- BackgroundMigrationWorker.perform_in(index * DELAY_INTERVAL, MIGRATION, range)
- end
- end
-
- def down
- # nothing to do
- end
-end
diff --git a/db/migrate/20181005110927_add_index_to_lfs_objects_file_store.rb b/db/migrate/20181005110927_add_index_to_lfs_objects_file_store.rb
deleted file mode 100644
index ff17a0a567d..00000000000
--- a/db/migrate/20181005110927_add_index_to_lfs_objects_file_store.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToLfsObjectsFileStore < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :lfs_objects, :file_store
- end
-
- def down
- remove_concurrent_index :lfs_objects, :file_store
- end
-end
diff --git a/db/migrate/20181006004100_import_common_metrics_nginx_vts.rb b/db/migrate/20181006004100_import_common_metrics_nginx_vts.rb
deleted file mode 100644
index 2b238774dca..00000000000
--- a/db/migrate/20181006004100_import_common_metrics_nginx_vts.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class ImportCommonMetricsNginxVts < 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/20181009190428_create_clusters_kubernetes_namespaces.rb b/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb
deleted file mode 100644
index 42d0899fe31..00000000000
--- a/db/migrate/20181009190428_create_clusters_kubernetes_namespaces.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class CreateClustersKubernetesNamespaces < ActiveRecord::Migration[4.2]
- DOWNTIME = false
- INDEX_NAME = 'kubernetes_namespaces_cluster_and_namespace'
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :clusters_kubernetes_namespaces, id: :bigserial do |t|
- t.references :cluster, null: false, index: true, foreign_key: { on_delete: :cascade }
- t.references :project, index: true, foreign_key: { on_delete: :nullify }
- t.references :cluster_project, index: true, foreign_key: { on_delete: :nullify }
-
- t.timestamps_with_timezone 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 # rubocop:disable Migration/AddLimitToTextColumns
-
- t.index [:cluster_id, :namespace], name: INDEX_NAME, unique: true
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20181010235606_create_board_project_recent_visits.rb b/db/migrate/20181010235606_create_board_project_recent_visits.rb
deleted file mode 100644
index 07bfbdda26b..00000000000
--- a/db/migrate/20181010235606_create_board_project_recent_visits.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class CreateBoardProjectRecentVisits < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :board_project_recent_visits, id: :bigserial do |t|
- t.timestamps_with_timezone null: false
-
- t.references :user, index: true, foreign_key: { on_delete: :cascade }
- t.references :project, index: true, foreign_key: { on_delete: :cascade }
- t.references :board, index: true, foreign_key: { on_delete: :cascade }
- end
-
- add_index :board_project_recent_visits, [:user_id, :project_id, :board_id], unique: true, name: 'index_board_project_recent_visits_on_user_project_and_board'
- end
-end
diff --git a/db/migrate/20181014203236_create_cluster_groups.rb b/db/migrate/20181014203236_create_cluster_groups.rb
deleted file mode 100644
index 33ae9a4a478..00000000000
--- a/db/migrate/20181014203236_create_cluster_groups.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class CreateClusterGroups < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :cluster_groups do |t|
- t.references :cluster, null: false, foreign_key: { on_delete: :cascade }
- t.references :group, null: false, index: true
-
- t.index [:cluster_id, :group_id], unique: true
- t.foreign_key :namespaces, column: :group_id, on_delete: :cascade
- end
- end
-end
diff --git a/db/migrate/20181015155839_add_finished_at_to_deployments.rb b/db/migrate/20181015155839_add_finished_at_to_deployments.rb
deleted file mode 100644
index bb8d6cdcf2c..00000000000
--- a/db/migrate/20181015155839_add_finished_at_to_deployments.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddFinishedAtToDeployments < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- add_column :deployments, :finished_at, :datetime_with_timezone
- end
-
- def down
- remove_column :deployments, :finished_at, :datetime_with_timezone
- end
-end
diff --git a/db/migrate/20181016141739_add_status_to_deployments.rb b/db/migrate/20181016141739_add_status_to_deployments.rb
deleted file mode 100644
index 103bd9cc56d..00000000000
--- a/db/migrate/20181016141739_add_status_to_deployments.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-class AddStatusToDeployments < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DEPLOYMENT_STATUS_SUCCESS = 2 # Equivalent to Deployment.state_machine.states['success'].value
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- ##
- # NOTE:
- # Ideally, `status` column should not have default value because it should be leveraged by state machine (i.e. application level).
- # However, we have to use the default value for avoiding `NOT NULL` violation during the transition period.
- # The default value should be removed in the future release.
- # rubocop:disable Migration/AddColumnWithDefault
- # rubocop:disable Migration/UpdateLargeTable
- def up
- add_column_with_default(:deployments,
- :status,
- :integer,
- limit: 2,
- default: DEPLOYMENT_STATUS_SUCCESS,
- allow_null: false)
- end
- # rubocop:enable Migration/AddColumnWithDefault
- # rubocop:enable Migration/UpdateLargeTable
-
- def down
- remove_column(:deployments, :status)
- end
-end
diff --git a/db/migrate/20181016152238_create_board_group_recent_visits.rb b/db/migrate/20181016152238_create_board_group_recent_visits.rb
deleted file mode 100644
index 9e240a5f97f..00000000000
--- a/db/migrate/20181016152238_create_board_group_recent_visits.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-class CreateBoardGroupRecentVisits < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :board_group_recent_visits, id: :bigserial do |t|
- t.timestamps_with_timezone null: false
-
- t.references :user, index: true, foreign_key: { on_delete: :cascade }
- t.references :board, index: true, foreign_key: { on_delete: :cascade }
- t.references :group, references: :namespace, column: :group_id, index: true
- t.foreign_key :namespaces, column: :group_id, on_delete: :cascade
- end
-
- add_index :board_group_recent_visits, [:user_id, :group_id, :board_id], unique: true, name: 'index_board_group_recent_visits_on_user_group_and_board'
- end
-end
diff --git a/db/migrate/20181017001059_add_cluster_type_to_clusters.rb b/db/migrate/20181017001059_add_cluster_type_to_clusters.rb
deleted file mode 100644
index 75abcfedfc9..00000000000
--- a/db/migrate/20181017001059_add_cluster_type_to_clusters.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddClusterTypeToClusters < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- PROJECT_CLUSTER_TYPE = 3
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:clusters, :cluster_type, :smallint, default: PROJECT_CLUSTER_TYPE) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:clusters, :cluster_type)
- end
-end
diff --git a/db/migrate/20181019032400_add_shards_table.rb b/db/migrate/20181019032400_add_shards_table.rb
deleted file mode 100644
index 713039c1a15..00000000000
--- a/db/migrate/20181019032400_add_shards_table.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddShardsTable < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def change
- create_table :shards do |t|
- t.string :name, null: false, index: { unique: true } # rubocop:disable Migration/PreventStrings
- end
- end
-end
diff --git a/db/migrate/20181019032408_add_repositories_table.rb b/db/migrate/20181019032408_add_repositories_table.rb
deleted file mode 100644
index d4d3acf7029..00000000000
--- a/db/migrate/20181019032408_add_repositories_table.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddRepositoriesTable < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def change
- create_table :repositories, id: :bigserial do |t|
- t.references :shard, null: false, index: true, foreign_key: { on_delete: :restrict }
- t.string :disk_path, null: false, index: { unique: true } # rubocop:disable Migration/PreventStrings
- end
-
- add_column :projects, :pool_repository_id, :bigint # rubocop:disable Migration/AddColumnsToWideTables
- add_index :projects, :pool_repository_id, where: 'pool_repository_id IS NOT NULL'
- end
-end
diff --git a/db/migrate/20181019105553_add_projects_pool_repository_id_foreign_key.rb b/db/migrate/20181019105553_add_projects_pool_repository_id_foreign_key.rb
deleted file mode 100644
index dddf44ce488..00000000000
--- a/db/migrate/20181019105553_add_projects_pool_repository_id_foreign_key.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectsPoolRepositoryIdForeignKey < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_foreign_key(
- :projects,
- :repositories,
- column: :pool_repository_id,
- on_delete: :nullify
- )
- end
-
- def down
- remove_foreign_key(:projects, column: :pool_repository_id)
- end
-end
diff --git a/db/migrate/20181022135539_add_index_on_status_to_deployments.rb b/db/migrate/20181022135539_add_index_on_status_to_deployments.rb
deleted file mode 100644
index 9c7a722c626..00000000000
--- a/db/migrate/20181022135539_add_index_on_status_to_deployments.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexOnStatusToDeployments < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :deployments, [:project_id, :status]
- add_concurrent_index :deployments, [:environment_id, :status]
- end
-
- def down
- remove_concurrent_index :deployments, [:project_id, :status]
- remove_concurrent_index :deployments, [:environment_id, :status]
- end
-end
diff --git a/db/migrate/20181023104858_add_archive_builds_duration_to_application_settings.rb b/db/migrate/20181023104858_add_archive_builds_duration_to_application_settings.rb
deleted file mode 100644
index 5d7a21fc5b5..00000000000
--- a/db/migrate/20181023104858_add_archive_builds_duration_to_application_settings.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddArchiveBuildsDurationToApplicationSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column(:application_settings, :archive_builds_in_seconds, :integer, allow_null: true)
- end
-end
diff --git a/db/migrate/20181023144439_add_partial_index_for_legacy_successful_deployments.rb b/db/migrate/20181023144439_add_partial_index_for_legacy_successful_deployments.rb
deleted file mode 100644
index e90e59b57a9..00000000000
--- a/db/migrate/20181023144439_add_partial_index_for_legacy_successful_deployments.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class AddPartialIndexForLegacySuccessfulDeployments < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- INDEX_NAME = 'partial_index_deployments_for_legacy_successful_deployments'.freeze
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:deployments, :id, where: "finished_at IS NULL AND status = 2", name: INDEX_NAME)
- end
-
- def down
- remove_concurrent_index_by_name(:deployments, INDEX_NAME)
- end
-end
diff --git a/db/migrate/20181025115728_add_private_commit_email_hostname_to_application_settings.rb b/db/migrate/20181025115728_add_private_commit_email_hostname_to_application_settings.rb
deleted file mode 100644
index 0923975f43a..00000000000
--- a/db/migrate/20181025115728_add_private_commit_email_hostname_to_application_settings.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddPrivateCommitEmailHostnameToApplicationSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column(:application_settings, :commit_email_hostname, :string, null: true)
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20181026143227_migrate_snippets_access_level_default_value.rb b/db/migrate/20181026143227_migrate_snippets_access_level_default_value.rb
deleted file mode 100644
index 2f4ef33b253..00000000000
--- a/db/migrate/20181026143227_migrate_snippets_access_level_default_value.rb
+++ /dev/null
@@ -1,42 +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 MigrateSnippetsAccessLevelDefaultValue < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- ENABLED = 20
-
- disable_ddl_transaction!
-
- class ProjectFeature < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'project_features'
- end
-
- def up
- change_column_default :project_features, :snippets_access_level, ENABLED
-
- # On GitLab.com this will update about 28 000 rows. Since our updates are
- # very small and this column is not indexed, these updates should be very
- # lightweight.
- ProjectFeature.where(snippets_access_level: nil).each_batch do |batch|
- batch.update_all(snippets_access_level: ENABLED)
- end
-
- # We do not need to perform this in a post-deployment migration as the
- # ProjectFeature model already enforces a default value for all new rows.
- change_column_null :project_features, :snippets_access_level, false
- end
-
- def down
- change_column_null :project_features, :snippets_access_level, true
- change_column_default :project_features, :snippets_access_level, nil
-
- # We can't migrate from 20 -> NULL, as some projects may have explicitly set
- # the access level to 20.
- end
-end
diff --git a/db/migrate/20181027114222_add_first_day_of_week_to_user_preferences.rb b/db/migrate/20181027114222_add_first_day_of_week_to_user_preferences.rb
deleted file mode 100644
index 96ba5fbd816..00000000000
--- a/db/migrate/20181027114222_add_first_day_of_week_to_user_preferences.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class AddFirstDayOfWeekToUserPreferences < ActiveRecord::Migration[5.0]
- DOWNTIME = false
-
- def change
- add_column :user_preferences, :first_day_of_week, :integer
- end
-end
diff --git a/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb b/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb
deleted file mode 100644
index c4c25d08754..00000000000
--- a/db/migrate/20181028120717_add_first_day_of_week_to_application_settings.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-
-class AddFirstDayOfWeekToApplicationSettings < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
- disable_ddl_transaction!
-
- DOWNTIME = false
-
- def up
- add_column_with_default(:application_settings, :first_day_of_week, :integer, default: 0) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:application_settings, :first_day_of_week)
- end
-end
diff --git a/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb b/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb
deleted file mode 100644
index e21eb291282..00000000000
--- a/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-# frozen_string_literal: true
-
-class AddMissingIndexesForForeignKeys < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:application_settings, :usage_stats_set_by_user_id)
- add_concurrent_index(:ci_pipeline_schedules, :owner_id)
- add_concurrent_index(:ci_trigger_requests, :trigger_id)
- add_concurrent_index(:ci_triggers, :owner_id)
- add_concurrent_index(:clusters_applications_helm, :cluster_id, unique: true)
- add_concurrent_index(:clusters_applications_ingress, :cluster_id, unique: true)
- add_concurrent_index(:clusters_applications_jupyter, :cluster_id, unique: true)
- add_concurrent_index(:clusters_applications_jupyter, :oauth_application_id)
- add_concurrent_index(:clusters_applications_knative, :cluster_id, unique: true)
- add_concurrent_index(:clusters_applications_prometheus, :cluster_id, unique: true)
- add_concurrent_index(:fork_network_members, :forked_from_project_id)
- add_concurrent_index(:internal_ids, :namespace_id)
- add_concurrent_index(:internal_ids, :project_id)
- add_concurrent_index(:issues, :closed_by_id)
- add_concurrent_index(:label_priorities, :label_id)
- add_concurrent_index(:merge_request_metrics, :merged_by_id)
- add_concurrent_index(:merge_request_metrics, :latest_closed_by_id)
- add_concurrent_index(:oauth_openid_requests, :access_grant_id)
- add_concurrent_index(:project_deploy_tokens, :deploy_token_id)
- add_concurrent_index(:protected_tag_create_access_levels, :group_id)
- add_concurrent_index(:subscriptions, :project_id)
- add_concurrent_index(:user_statuses, :user_id)
- add_concurrent_index(:users, :accepted_term_id)
- end
-
- def down
- remove_concurrent_index(:application_settings, :usage_stats_set_by_user_id)
- remove_concurrent_index(:ci_pipeline_schedules, :owner_id)
- remove_concurrent_index(:ci_trigger_requests, :trigger_id)
- remove_concurrent_index(:ci_triggers, :owner_id)
- remove_concurrent_index(:clusters_applications_helm, :cluster_id, unique: true)
- remove_concurrent_index(:clusters_applications_ingress, :cluster_id, unique: true)
- remove_concurrent_index(:clusters_applications_jupyter, :cluster_id, unique: true)
- remove_concurrent_index(:clusters_applications_jupyter, :oauth_application_id)
- remove_concurrent_index(:clusters_applications_knative, :cluster_id, unique: true)
- remove_concurrent_index(:clusters_applications_prometheus, :cluster_id, unique: true)
- remove_concurrent_index(:fork_network_members, :forked_from_project_id)
- remove_concurrent_index(:internal_ids, :namespace_id)
- remove_concurrent_index(:internal_ids, :project_id)
- remove_concurrent_index(:issues, :closed_by_id)
- remove_concurrent_index(:label_priorities, :label_id)
- remove_concurrent_index(:merge_request_metrics, :merged_by_id)
- remove_concurrent_index(:merge_request_metrics, :latest_closed_by_id)
- remove_concurrent_index(:oauth_openid_requests, :access_grant_id)
- remove_concurrent_index(:project_deploy_tokens, :deploy_token_id)
- remove_concurrent_index(:protected_tag_create_access_levels, :group_id)
- remove_concurrent_index(:subscriptions, :project_id)
- remove_concurrent_index(:user_statuses, :user_id)
- remove_concurrent_index(:users, :accepted_term_id)
- end
-end
diff --git a/db/migrate/20181031145139_add_protected_ci_variables_to_application_settings.rb b/db/migrate/20181031145139_add_protected_ci_variables_to_application_settings.rb
deleted file mode 100644
index 1817677c58d..00000000000
--- a/db/migrate/20181031145139_add_protected_ci_variables_to_application_settings.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddProtectedCiVariablesToApplicationSettings < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column_with_default(:application_settings, :protected_ci_variables, :boolean, default: false, allow_null: false) # rubocop:disable Migration/AddColumnWithDefault
- end
-
- def down
- remove_column(:application_settings, :protected_ci_variables)
- end
-end
diff --git a/db/migrate/20181031190558_drop_fk_gcp_clusters_table.rb b/db/migrate/20181031190558_drop_fk_gcp_clusters_table.rb
deleted file mode 100644
index 2c1dea05808..00000000000
--- a/db/migrate/20181031190558_drop_fk_gcp_clusters_table.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-# frozen_string_literal: true
-
-class DropFkGcpClustersTable < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- remove_foreign_key_if_exists :gcp_clusters, column: :project_id
- remove_foreign_key_if_exists :gcp_clusters, column: :user_id
- remove_foreign_key_if_exists :gcp_clusters, column: :service_id
- end
-
- def down
- add_foreign_key_if_not_exists :gcp_clusters, :projects, column: :project_id, on_delete: :cascade
- add_foreign_key_if_not_exists :gcp_clusters, :users, column: :user_id, on_delete: :nullify
- add_foreign_key_if_not_exists :gcp_clusters, :services, column: :service_id, on_delete: :nullify
- end
-
- private
-
- def add_foreign_key_if_not_exists(source, target, column:, on_delete:)
- return unless table_exists?(source)
- return if foreign_key_exists?(source, target, column: column)
-
- add_concurrent_foreign_key(source, target, column: column, on_delete: on_delete)
- end
-
- def remove_foreign_key_if_exists(table, column:)
- return unless table_exists?(table)
- return unless foreign_key_exists?(table, column: column)
-
- remove_foreign_key(table, column: column)
- end
-end
diff --git a/db/migrate/20181031190559_drop_gcp_clusters_table.rb b/db/migrate/20181031190559_drop_gcp_clusters_table.rb
deleted file mode 100644
index 597fe49f4c8..00000000000
--- a/db/migrate/20181031190559_drop_gcp_clusters_table.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-# frozen_string_literal: true
-
-class DropGcpClustersTable < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- drop_table :gcp_clusters
- end
-
- def down
- create_table :gcp_clusters do |t|
- # Order columns by best align scheme
- t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade }
- t.references :user, foreign_key: { on_delete: :nullify }
- t.references :service, foreign_key: { on_delete: :nullify }
- t.integer :status
- t.integer :gcp_cluster_size, null: false
-
- # Timestamps
- t.datetime_with_timezone :created_at, null: false
- t.datetime_with_timezone :updated_at, null: false
-
- # Enable/disable
- t.boolean :enabled, default: true
-
- # General
- t.text :status_reason
-
- # k8s integration specific
- t.string :project_namespace
-
- # Cluster details
- t.string :endpoint
- t.text :ca_cert
- t.text :encrypted_kubernetes_token
- t.string :encrypted_kubernetes_token_iv
- t.string :username
- t.text :encrypted_password
- t.string :encrypted_password_iv
-
- # GKE
- t.string :gcp_project_id, null: false
- t.string :gcp_cluster_zone, null: false
- t.string :gcp_cluster_name, null: false
- t.string :gcp_machine_type
- t.string :gcp_operation_id
- t.text :encrypted_gcp_token
- t.string :encrypted_gcp_token_iv
- end
- end
-end
diff --git a/db/migrate/20181101144347_add_index_for_stuck_mr_query.rb b/db/migrate/20181101144347_add_index_for_stuck_mr_query.rb
deleted file mode 100644
index 569eaa8b22c..00000000000
--- a/db/migrate/20181101144347_add_index_for_stuck_mr_query.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# frozen_string_literal: true
-class AddIndexForStuckMrQuery < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :merge_requests, [:id, :merge_jid], where: "merge_jid IS NOT NULL and state = 'locked'"
- end
-
- def down
- remove_concurrent_index :merge_requests, [:id, :merge_jid], where: "merge_jid IS NOT NULL and state = 'locked'"
- end
-end
diff --git a/db/migrate/20181101191341_create_clusters_applications_cert_manager.rb b/db/migrate/20181101191341_create_clusters_applications_cert_manager.rb
deleted file mode 100644
index 95996531669..00000000000
--- a/db/migrate/20181101191341_create_clusters_applications_cert_manager.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class CreateClustersApplicationsCertManager < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :clusters_applications_cert_managers do |t|
- t.references :cluster, null: false, index: false, foreign_key: { on_delete: :cascade }
- t.integer :status, null: false
- t.string :version, null: false
- t.string :email, null: false
- t.timestamps_with_timezone null: false
- 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/20181106135939_add_index_to_deployments.rb b/db/migrate/20181106135939_add_index_to_deployments.rb
deleted file mode 100644
index e8181e61d22..00000000000
--- a/db/migrate/20181106135939_add_index_to_deployments.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToDeployments < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :deployments, [:project_id, :status, :created_at]
- end
-
- def down
- remove_concurrent_index :deployments, [:project_id, :status, :created_at]
- end
-end
diff --git a/db/migrate/20181108091549_cleanup_environments_external_url.rb b/db/migrate/20181108091549_cleanup_environments_external_url.rb
deleted file mode 100644
index 8439f6e55e6..00000000000
--- a/db/migrate/20181108091549_cleanup_environments_external_url.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class CleanupEnvironmentsExternalUrl < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- update_column_in_batches(:environments, :external_url, nil) do |table, query|
- query.where(table[:external_url].matches('javascript://%'))
- end
- end
-
- def down
- end
-end
diff --git a/db/migrate/20181112103239_drop_default_value_on_status_deployments.rb b/db/migrate/20181112103239_drop_default_value_on_status_deployments.rb
deleted file mode 100644
index 59d6d2f29ff..00000000000
--- a/db/migrate/20181112103239_drop_default_value_on_status_deployments.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# frozen_string_literal: true
-
-class DropDefaultValueOnStatusDeployments < ActiveRecord::Migration[4.2]
- DOWNTIME = false
- DEPLOYMENT_STATUS_SUCCESS = 2 # Equivalent to Deployment.state_machine.states['success'].value
-
- def up
- change_column_default :deployments, :status, nil
- end
-
- def down
- change_column_default :deployments, :status, DEPLOYMENT_STATUS_SUCCESS
- end
-end
diff --git a/db/migrate/20181115140140_add_encrypted_runners_token_to_settings.rb b/db/migrate/20181115140140_add_encrypted_runners_token_to_settings.rb
deleted file mode 100644
index abb720dafb2..00000000000
--- a/db/migrate/20181115140140_add_encrypted_runners_token_to_settings.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddEncryptedRunnersTokenToSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :application_settings, :runners_registration_token_encrypted, :string
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20181116050532_knative_external_ip.rb b/db/migrate/20181116050532_knative_external_ip.rb
deleted file mode 100644
index 4179e13c1b8..00000000000
--- a/db/migrate/20181116050532_knative_external_ip.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 KnativeExternalIp < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :clusters_applications_knative, :external_ip, :string
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20181116141415_add_encrypted_runners_token_to_namespaces.rb b/db/migrate/20181116141415_add_encrypted_runners_token_to_namespaces.rb
deleted file mode 100644
index 00c88140b52..00000000000
--- a/db/migrate/20181116141415_add_encrypted_runners_token_to_namespaces.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddEncryptedRunnersTokenToNamespaces < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :namespaces, :runners_token_encrypted, :string
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20181116141504_add_encrypted_runners_token_to_projects.rb b/db/migrate/20181116141504_add_encrypted_runners_token_to_projects.rb
deleted file mode 100644
index f42239475f7..00000000000
--- a/db/migrate/20181116141504_add_encrypted_runners_token_to_projects.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddEncryptedRunnersTokenToProjects < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/AddColumnsToWideTables
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :projects, :runners_token_encrypted, :string
- end
- # rubocop:enable Migration/PreventStrings
- # rubocop:enable Migration/AddColumnsToWideTables
-end
diff --git a/db/migrate/20181119081539_add_merge_request_id_to_ci_pipelines.rb b/db/migrate/20181119081539_add_merge_request_id_to_ci_pipelines.rb
deleted file mode 100644
index f96d80787f9..00000000000
--- a/db/migrate/20181119081539_add_merge_request_id_to_ci_pipelines.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddMergeRequestIdToCiPipelines < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- def up
- add_column :ci_pipelines, :merge_request_id, :integer
- end
-
- def down
- remove_column :ci_pipelines, :merge_request_id, :integer
- end
-end
diff --git a/db/migrate/20181119132520_add_indexes_to_ci_builds_and_pipelines.rb b/db/migrate/20181119132520_add_indexes_to_ci_builds_and_pipelines.rb
deleted file mode 100644
index cb01fa113eb..00000000000
--- a/db/migrate/20181119132520_add_indexes_to_ci_builds_and_pipelines.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexesToCiBuildsAndPipelines < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- indexes.each do |index|
- add_concurrent_index(*index)
- end
- end
-
- def down
- indexes.each do |index|
- remove_concurrent_index(*index)
- end
- end
-
- private
-
- def indexes
- [
- [
- :ci_pipelines,
- [:project_id, :ref, :id],
- {
- order: { id: :desc },
- name: 'index_ci_pipelines_on_project_idandrefandiddesc'
- }
- ],
- [
- :ci_builds,
- [:commit_id, :artifacts_expire_at, :id],
- {
- where: "type::text = 'Ci::Build'::text AND (retried = false OR retried IS NULL) AND (name::text = ANY (ARRAY['sast'::character varying, 'dependency_scanning'::character varying, 'sast:container'::character varying, 'container_scanning'::character varying, 'dast'::character varying]::text[]))",
- name: 'index_ci_builds_on_commit_id_and_artifacts_expireatandidpartial'
- }
- ]
- ]
- end
-end
diff --git a/db/migrate/20181120082911_rename_repositories_pool_repositories.rb b/db/migrate/20181120082911_rename_repositories_pool_repositories.rb
deleted file mode 100644
index 165771c4775..00000000000
--- a/db/migrate/20181120082911_rename_repositories_pool_repositories.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class RenameRepositoriesPoolRepositories < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- # This change doesn't require downtime as the table is not in use, so we're
- # free to change an empty table
- DOWNTIME = false
-
- def change
- rename_table :repositories, :pool_repositories
- end
-end
diff --git a/db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb b/db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb
deleted file mode 100644
index f8b46395941..00000000000
--- a/db/migrate/20181120091639_add_foreign_key_to_ci_pipelines_merge_requests.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-class AddForeignKeyToCiPipelinesMergeRequests < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_pipelines, :merge_request_id, where: 'merge_request_id IS NOT NULL'
- add_concurrent_foreign_key :ci_pipelines, :merge_requests, column: :merge_request_id, on_delete: :cascade
- end
-
- def down
- if foreign_key_exists?(:ci_pipelines, :merge_requests, column: :merge_request_id)
- remove_foreign_key :ci_pipelines, :merge_requests
- end
-
- remove_concurrent_index :ci_pipelines, :merge_request_id, where: 'merge_request_id IS NOT NULL'
- end
-end
diff --git a/db/migrate/20181120151656_add_token_encrypted_to_ci_runners.rb b/db/migrate/20181120151656_add_token_encrypted_to_ci_runners.rb
deleted file mode 100644
index 2b78d390907..00000000000
--- a/db/migrate/20181120151656_add_token_encrypted_to_ci_runners.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class AddTokenEncryptedToCiRunners < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :ci_runners, :token_encrypted, :string # rubocop:disable Migration/PreventStrings
- end
-end
diff --git a/db/migrate/20181121101842_add_ci_builds_partial_index_on_project_id_and_status.rb b/db/migrate/20181121101842_add_ci_builds_partial_index_on_project_id_and_status.rb
deleted file mode 100644
index a524709faf8..00000000000
--- a/db/migrate/20181121101842_add_ci_builds_partial_index_on_project_id_and_status.rb
+++ /dev/null
@@ -1,33 +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 AddCiBuildsPartialIndexOnProjectIdAndStatus < ActiveRecord::Migration[4.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
- [
- :ci_builds,
- [: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])))"
- }
- ]
- end
-end
diff --git a/db/migrate/20181121101843_remove_redundant_ci_builds_partial_index.rb b/db/migrate/20181121101843_remove_redundant_ci_builds_partial_index.rb
deleted file mode 100644
index e4fb703e887..00000000000
--- a/db/migrate/20181121101843_remove_redundant_ci_builds_partial_index.rb
+++ /dev/null
@@ -1,33 +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 RemoveRedundantCiBuildsPartialIndex < ActiveRecord::Migration[4.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
- [
- :ci_builds,
- [:project_id, :status],
- {
- name: 'index_ci_builds_project_id_and_status_for_live_jobs_partial',
- where: "((status)::text = ANY (ARRAY[('running'::character varying)::text, ('pending'::character varying)::text, ('created'::character varying)::text]))"
- }
- ]
- end
-end
diff --git a/db/migrate/20181122160027_create_project_repositories.rb b/db/migrate/20181122160027_create_project_repositories.rb
deleted file mode 100644
index 9148cde2fb4..00000000000
--- a/db/migrate/20181122160027_create_project_repositories.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 CreateProjectRepositories < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :project_repositories, id: :bigserial do |t|
- t.references :shard, null: false, index: true, foreign_key: { on_delete: :restrict }
- t.string :disk_path, null: false, index: { unique: true } # rubocop:disable Migration/PreventStrings
- t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade }
- end
- end
-end
diff --git a/db/migrate/20181123135036_drop_not_null_constraint_pool_repository_disk_path.rb b/db/migrate/20181123135036_drop_not_null_constraint_pool_repository_disk_path.rb
deleted file mode 100644
index bcd969e91c5..00000000000
--- a/db/migrate/20181123135036_drop_not_null_constraint_pool_repository_disk_path.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-class DropNotNullConstraintPoolRepositoryDiskPath < ActiveRecord::Migration[5.0]
- DOWNTIME = false
-
- def change
- change_column_null :pool_repositories, :disk_path, true
- end
-end
diff --git a/db/migrate/20181123144235_create_suggestions.rb b/db/migrate/20181123144235_create_suggestions.rb
deleted file mode 100644
index b92e8ac8027..00000000000
--- a/db/migrate/20181123144235_create_suggestions.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-class CreateSuggestions < ActiveRecord::Migration[5.0]
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- # rubocop:disable Migration/AddLimitToTextColumns
- def change
- create_table :suggestions, id: :bigserial do |t|
- t.references :note, foreign_key: { on_delete: :cascade }, null: false
- t.integer :relative_order, null: false, limit: 2
- t.boolean :applied, null: false, default: 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
- end
- end
- # rubocop:enable Migration/AddLimitToTextColumns
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20181126150622_add_events_index_on_project_id_and_created_at.rb b/db/migrate/20181126150622_add_events_index_on_project_id_and_created_at.rb
deleted file mode 100644
index 7e9c56957d5..00000000000
--- a/db/migrate/20181126150622_add_events_index_on_project_id_and_created_at.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 AddEventsIndexOnProjectIdAndCreatedAt < ActiveRecord::Migration[5.0]
- 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
- [
- :events,
- [:project_id, :created_at],
- {
- name: 'index_events_on_project_id_and_created_at'
- }
- ]
- end
-end
diff --git a/db/migrate/20181126153547_remove_notes_index_on_updated_at.rb b/db/migrate/20181126153547_remove_notes_index_on_updated_at.rb
deleted file mode 100644
index d7ca46b50e4..00000000000
--- a/db/migrate/20181126153547_remove_notes_index_on_updated_at.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 RemoveNotesIndexOnUpdatedAt < ActiveRecord::Migration[5.0]
- 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,
- [:updated_at],
- {
- name: 'index_notes_on_updated_at'
- }
- ]
- end
-end
diff --git a/db/migrate/20181128123704_add_state_to_pool_repository.rb b/db/migrate/20181128123704_add_state_to_pool_repository.rb
deleted file mode 100644
index 4d4e56390df..00000000000
--- a/db/migrate/20181128123704_add_state_to_pool_repository.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class AddStateToPoolRepository < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # Given the table is empty, and the non concurrent methods are chosen so
- # the transactions don't have to be disabled
- # rubocop:disable Migration/AddConcurrentForeignKey
- # rubocop:disable Migration/AddIndex
- # rubocop:disable Migration/PreventStrings
- def change
- add_column(:pool_repositories, :state, :string, null: true)
-
- add_column :pool_repositories, :source_project_id, :integer
- add_index :pool_repositories, :source_project_id, unique: true
- add_foreign_key :pool_repositories, :projects, column: :source_project_id, on_delete: :nullify
- end
- # rubocop:enable Migration/PreventStrings
- # rubocop:enable Migration/AddIndex
- # rubocop:enable Migration/AddConcurrentForeignKey
-end
diff --git a/db/migrate/20181129104854_add_token_encrypted_to_ci_builds.rb b/db/migrate/20181129104854_add_token_encrypted_to_ci_builds.rb
deleted file mode 100644
index b83cabd6b75..00000000000
--- a/db/migrate/20181129104854_add_token_encrypted_to_ci_builds.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddTokenEncryptedToCiBuilds < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/AddColumnsToWideTables
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :ci_builds, :token_encrypted, :string
- end
- # rubocop:enable Migration/PreventStrings
- # rubocop:enable Migration/AddColumnsToWideTables
-end
diff --git a/db/migrate/20181129104944_add_index_to_ci_builds_token_encrypted.rb b/db/migrate/20181129104944_add_index_to_ci_builds_token_encrypted.rb
deleted file mode 100644
index f90aca008e5..00000000000
--- a/db/migrate/20181129104944_add_index_to_ci_builds_token_encrypted.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class AddIndexToCiBuildsTokenEncrypted < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :ci_builds, :token_encrypted, unique: true, where: 'token_encrypted IS NOT NULL'
- end
-
- def down
- remove_concurrent_index :ci_builds, :token_encrypted
- end
-end
diff --git a/db/migrate/20181203002526_add_project_bfg_object_map_column.rb b/db/migrate/20181203002526_add_project_bfg_object_map_column.rb
deleted file mode 100644
index 7850f314ca8..00000000000
--- a/db/migrate/20181203002526_add_project_bfg_object_map_column.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-class AddProjectBfgObjectMapColumn < ActiveRecord::Migration[5.0]
- DOWNTIME = false
-
- # rubocop:disable Migration/AddColumnsToWideTables
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :projects, :bfg_object_map, :string
- end
- # rubocop:enable Migration/PreventStrings
- # rubocop:enable Migration/AddColumnsToWideTables
-end
diff --git a/db/migrate/20181205171941_create_project_daily_statistics.rb b/db/migrate/20181205171941_create_project_daily_statistics.rb
deleted file mode 100644
index c9e2a1e1aa7..00000000000
--- a/db/migrate/20181205171941_create_project_daily_statistics.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class CreateProjectDailyStatistics < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- create_table :project_daily_statistics, id: :bigserial do |t|
- t.integer :project_id, null: false
- t.integer :fetch_count, null: false
- t.date :date
-
- t.index [:project_id, :date], unique: true, order: { date: :desc }
- t.foreign_key :projects, on_delete: :cascade
- end
- end
-end
diff --git a/db/migrate/20181211092510_add_name_author_id_and_sha_to_releases.rb b/db/migrate/20181211092510_add_name_author_id_and_sha_to_releases.rb
deleted file mode 100644
index 79711d13cfe..00000000000
--- a/db/migrate/20181211092510_add_name_author_id_and_sha_to_releases.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class AddNameAuthorIdAndShaToReleases < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- add_column :releases, :author_id, :integer
- add_column :releases, :name, :string
- add_column :releases, :sha, :string
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20181211092514_add_author_id_index_and_fk_to_releases.rb b/db/migrate/20181211092514_add_author_id_index_and_fk_to_releases.rb
deleted file mode 100644
index f6350a49944..00000000000
--- a/db/migrate/20181211092514_add_author_id_index_and_fk_to_releases.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class AddAuthorIdIndexAndFkToReleases < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index :releases, :author_id
-
- add_concurrent_foreign_key :releases, :users, column: :author_id, on_delete: :nullify
- end
-
- def down
- remove_foreign_key :releases, column: :author_id
-
- remove_concurrent_index :releases, column: :author_id
- end
-end
diff --git a/db/migrate/20181212104941_backfill_releases_name_with_tag_name.rb b/db/migrate/20181212104941_backfill_releases_name_with_tag_name.rb
deleted file mode 100644
index e152dc87bc1..00000000000
--- a/db/migrate/20181212104941_backfill_releases_name_with_tag_name.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class BackfillReleasesNameWithTagName < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- update_column_in_batches(:releases, :name, Release.arel_table[:tag])
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/migrate/20181212171634_create_error_tracking_settings.rb b/db/migrate/20181212171634_create_error_tracking_settings.rb
deleted file mode 100644
index 567abe6f45f..00000000000
--- a/db/migrate/20181212171634_create_error_tracking_settings.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-class CreateErrorTrackingSettings < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :project_error_tracking_settings, id: :int, primary_key: :project_id, default: nil do |t|
- t.boolean :enabled, null: false, default: true
- t.string :api_url, null: false
- t.string :encrypted_token
- t.string :encrypted_token_iv
- t.foreign_key :projects, column: :project_id, on_delete: :cascade
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20181219145521_add_options_to_build_metadata.rb b/db/migrate/20181219145521_add_options_to_build_metadata.rb
deleted file mode 100644
index dc9569babc2..00000000000
--- a/db/migrate/20181219145521_add_options_to_build_metadata.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 AddOptionsToBuildMetadata < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- add_column :ci_builds_metadata, :config_options, :jsonb
- add_column :ci_builds_metadata, :config_variables, :jsonb
- end
-end
diff --git a/db/migrate/20181228175414_create_releases_link_table.rb b/db/migrate/20181228175414_create_releases_link_table.rb
deleted file mode 100644
index 9d770d0dc2f..00000000000
--- a/db/migrate/20181228175414_create_releases_link_table.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class CreateReleasesLinkTable < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- # rubocop:disable Migration/PreventStrings
- def change
- create_table :release_links, id: :bigserial do |t|
- t.references :release, null: false, index: false, foreign_key: { on_delete: :cascade }
- t.string :url, null: false
- t.string :name, null: false
- t.timestamps_with_timezone null: false
-
- t.index [:release_id, :url], unique: true
- t.index [:release_id, :name], unique: true
- end
- end
- # rubocop:enable Migration/PreventStrings
-end
diff --git a/db/migrate/20171230123729_init_schema.rb b/db/migrate/20181228175414_init_schema.rb
index 99ff85ff01f..d4212f405d9 100644
--- a/db/migrate/20171230123729_init_schema.rb
+++ b/db/migrate/20181228175414_init_schema.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-# rubocop:disable Layout/SpaceInsideHashLiteralBraces
-# rubocop:disable Layout/SpaceAroundOperators
# rubocop:disable Metrics/AbcSize
# rubocop:disable Migration/AddConcurrentForeignKey
# rubocop:disable Style/WordArray
@@ -9,14 +7,15 @@
# rubocop:disable Migration/AddLimitToTextColumns
# rubocop:disable Migration/Datetime
-class InitSchema < ActiveRecord::Migration[4.2]
+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 "plpgsql"
enable_extension "pg_trgm"
- create_table "abuse_reports", id: :serial do |t|
+ enable_extension "plpgsql"
+
+ create_table "abuse_reports", id: :serial, force: :cascade do |t|
t.integer "reporter_id"
t.integer "user_id"
t.text "message"
@@ -25,7 +24,8 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.text "message_html"
t.integer "cached_markdown_version"
end
- create_table "appearances", id: :serial do |t|
+
+ create_table "appearances", id: :serial, force: :cascade do |t|
t.string "title", null: false
t.text "description", null: false
t.string "header_logo"
@@ -37,8 +37,21 @@ class InitSchema < ActiveRecord::Migration[4.2]
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 do |t|
+
+ create_table "application_settings", id: :serial, force: :cascade do |t|
t.integer "default_projects_limit"
t.boolean "signup_enabled"
t.boolean "gravatar_enabled"
@@ -95,14 +108,12 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.boolean "domain_blacklist_enabled", default: false
t.text "domain_blacklist"
t.boolean "usage_ping_enabled", default: true, null: false
- t.boolean "koding_enabled"
- t.string "koding_url"
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: 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
@@ -110,9 +121,6 @@ class InitSchema < ActiveRecord::Migration[4.2]
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 "sidekiq_throttling_enabled", default: false
- t.string "sidekiq_throttling_queues"
- t.decimal "sidekiq_throttling_factor"
t.boolean "html_emails_enabled", default: true
t.string "plantuml_url"
t.boolean "plantuml_enabled"
@@ -126,14 +134,14 @@ class InitSchema < ActiveRecord::Migration[4.2]
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: false, null: false
+ 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: false, 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
@@ -143,21 +151,44 @@ class InitSchema < ActiveRecord::Migration[4.2]
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 "circuitbreaker_failure_count_threshold", default: 3
- t.integer "circuitbreaker_failure_reset_time", default: 1800
- t.integer "circuitbreaker_storage_timeout", default: 15
- t.integer "circuitbreaker_access_retries", default: 3
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.integer "circuitbreaker_check_interval", default: 1, 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 do |t|
+
+ 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
@@ -165,25 +196,66 @@ class InitSchema < ActiveRecord::Migration[4.2]
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", using: :btree
+ t.index ["entity_id", "entity_type"], name: "index_audit_events_on_entity_id_and_entity_type"
end
- create_table "award_emoji", id: :serial do |t|
+
+ 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", using: :btree
- t.index ["user_id", "name"], name: "index_award_emoji_on_user_id_and_name", using: :btree
+ 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 "boards", id: :serial do |t|
- t.integer "project_id", null: false
+
+ 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.index ["project_id"], name: "index_boards_on_project_id", using: :btree
+ 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 do |t|
+
+ 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
@@ -193,9 +265,10 @@ class InitSchema < ActiveRecord::Migration[4.2]
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", using: :btree
+ 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 do |t|
+
+ 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
@@ -205,23 +278,34 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
- t.index ["user_id", "service_id"], name: "index_chat_names_on_user_id_and_service_id", unique: true, using: :btree
+ 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 do |t|
+
+ 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, using: :btree
+ t.index ["namespace_id"], name: "index_chat_teams_on_namespace_id", unique: true
end
- create_table "ci_build_trace_section_names", id: :serial do |t|
+
+ 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, using: :btree
+ 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 do |t|
+
+ 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
@@ -229,10 +313,12 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
- t.index ["project_id"], name: "index_ci_build_trace_sections_on_project_id", using: :btree
+ 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 do |t|
+
+ create_table "ci_builds", id: :serial, force: :cascade do |t|
t.string "status"
t.datetime "finished_at"
t.text "trace"
@@ -276,22 +362,50 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.integer "artifacts_metadata_store"
t.boolean "protected"
t.integer "failure_reason"
- t.index ["auto_canceled_by_id"], name: "index_ci_builds_on_auto_canceled_by_id", using: :btree
- t.index ["commit_id", "stage_idx", "created_at"], name: "index_ci_builds_on_commit_id_and_stage_idx_and_created_at", using: :btree
- t.index ["commit_id", "status", "type"], name: "index_ci_builds_on_commit_id_and_status_and_type", using: :btree
- t.index ["commit_id", "type", "name", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_name_and_ref", using: :btree
- t.index ["commit_id", "type", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_ref", using: :btree
- t.index ["project_id", "id"], name: "index_ci_builds_on_project_id_and_id", using: :btree
- t.index ["protected"], name: "index_ci_builds_on_protected", using: :btree
- t.index ["runner_id"], name: "index_ci_builds_on_runner_id", using: :btree
- t.index ["stage_id"], name: "index_ci_builds_on_stage_id", using: :btree
- t.index ["status", "type", "runner_id"], name: "index_ci_builds_on_status_and_type_and_runner_id", using: :btree
- t.index ["status"], name: "index_ci_builds_on_status", using: :btree
- t.index ["token"], name: "index_ci_builds_on_token", unique: true, using: :btree
- t.index ["updated_at"], name: "index_ci_builds_on_updated_at", using: :btree
- t.index ["user_id"], name: "index_ci_builds_on_user_id", using: :btree
- end
- create_table "ci_group_variables", id: :serial do |t|
+ 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"
@@ -301,9 +415,10 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
+ 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 do |t|
+
+ 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
@@ -313,10 +428,24 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.datetime_with_timezone "expire_at"
t.string "file"
t.integer "file_store"
- t.index ["job_id", "file_type"], name: "index_ci_job_artifacts_on_job_id_and_file_type", unique: true, using: :btree
- t.index ["project_id"], name: "index_ci_job_artifacts_on_project_id", using: :btree
+ 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 do |t|
+
+ create_table "ci_pipeline_schedule_variables", id: :serial, force: :cascade do |t|
t.string "key", null: false
t.text "value"
t.text "encrypted_value"
@@ -325,9 +454,10 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
+ 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 do |t|
+
+ create_table "ci_pipeline_schedules", id: :serial, force: :cascade do |t|
t.string "description"
t.string "ref"
t.string "cron"
@@ -338,19 +468,22 @@ class InitSchema < ActiveRecord::Migration[4.2]
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", using: :btree
- t.index ["project_id"], name: "index_ci_pipeline_schedules_on_project_id", using: :btree
+ 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 do |t|
+
+ 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, using: :btree
+ t.index ["pipeline_id", "key"], name: "index_ci_pipeline_variables_on_pipeline_id_and_key", unique: true
end
- create_table "ci_pipelines", id: :serial do |t|
+
+ create_table "ci_pipelines", id: :serial, force: :cascade do |t|
t.string "ref"
t.string "sha"
t.string "before_sha"
@@ -372,29 +505,39 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.boolean "protected"
t.integer "config_source"
t.integer "failure_reason"
- t.index ["auto_canceled_by_id"], name: "index_ci_pipelines_on_auto_canceled_by_id", using: :btree
- t.index ["pipeline_schedule_id"], name: "index_ci_pipelines_on_pipeline_schedule_id", using: :btree
- t.index ["project_id", "ref", "status", "id"], name: "index_ci_pipelines_on_project_id_and_ref_and_status_and_id", using: :btree
- t.index ["project_id", "sha"], name: "index_ci_pipelines_on_project_id_and_sha", using: :btree
- t.index ["project_id"], name: "index_ci_pipelines_on_project_id", using: :btree
- t.index ["status"], name: "index_ci_pipelines_on_status", using: :btree
- t.index ["user_id"], name: "index_ci_pipelines_on_user_id", using: :btree
- end
- create_table "ci_runner_namespaces", id: :serial do |t|
+ 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", using: :btree
- t.index ["runner_id", "namespace_id"], name: "index_ci_runner_namespaces_on_runner_id_and_namespace_id", unique: true, using: :btree
+ 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 do |t|
+
+ 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", using: :btree
- t.index ["runner_id"], name: "index_ci_runner_projects_on_runner_id", using: :btree
+ 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 do |t|
+
+ create_table "ci_runners", id: :serial, force: :cascade do |t|
t.string "token"
t.datetime "created_at"
t.datetime "updated_at"
@@ -410,12 +553,18 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.boolean "run_untagged", default: true, null: false
t.boolean "locked", default: false, null: false
t.integer "access_level", default: 0, null: false
- t.index ["contacted_at"], name: "index_ci_runners_on_contacted_at", using: :btree
- t.index ["is_shared"], name: "index_ci_runners_on_is_shared", using: :btree
- t.index ["locked"], name: "index_ci_runners_on_locked", using: :btree
- t.index ["token"], name: "index_ci_runners_on_token", using: :btree
+ 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 do |t|
+
+ create_table "ci_stages", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.integer "pipeline_id"
t.datetime "created_at"
@@ -423,19 +572,24 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.string "name"
t.integer "status"
t.integer "lock_version"
- t.index ["pipeline_id", "name"], name: "index_ci_stages_on_pipeline_id_and_name", using: :btree
- t.index ["pipeline_id"], name: "index_ci_stages_on_pipeline_id", using: :btree
- t.index ["project_id"], name: "index_ci_stages_on_project_id", using: :btree
+ 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 do |t|
+
+ 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", using: :btree
+ 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 do |t|
+
+ create_table "ci_triggers", id: :serial, force: :cascade do |t|
t.string "token"
t.datetime "created_at"
t.datetime "updated_at"
@@ -443,9 +597,11 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.integer "owner_id"
t.string "description"
t.string "ref"
- t.index ["project_id"], name: "index_ci_triggers_on_project_id", using: :btree
+ 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 do |t|
+
+ create_table "ci_variables", id: :serial, force: :cascade do |t|
t.string "key", null: false
t.text "value"
t.text "encrypted_value"
@@ -454,9 +610,17 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
+ 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_platforms_kubernetes", id: :serial do |t|
+
+ 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
@@ -468,17 +632,20 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.string "encrypted_password_iv"
t.text "encrypted_token"
t.string "encrypted_token_iv"
- t.index ["cluster_id"], name: "index_cluster_platforms_kubernetes_on_cluster_id", unique: true, using: :btree
+ 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 do |t|
+
+ 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", using: :btree
- t.index ["project_id"], name: "index_cluster_projects_on_project_id", using: :btree
+ 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 do |t|
+
+ 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
@@ -492,9 +659,11 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.string "endpoint"
t.text "encrypted_access_token"
t.string "encrypted_access_token_iv"
- t.index ["cluster_id"], name: "index_cluster_providers_gcp_on_cluster_id", unique: true, using: :btree
+ 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 do |t|
+
+ create_table "clusters", id: :serial, force: :cascade do |t|
t.integer "user_id"
t.integer "provider_type"
t.integer "platform_type"
@@ -503,18 +672,36 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.boolean "enabled", default: true
t.string "name", null: false
t.string "environment_scope", default: "*", null: false
- t.index ["enabled"], name: "index_clusters_on_enabled", using: :btree
- t.index ["user_id"], name: "index_clusters_on_user_id", using: :btree
+ 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_helm", id: :serial do |t|
+
+ 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 do |t|
+
+ 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
@@ -523,24 +710,84 @@ class InitSchema < ActiveRecord::Migration[4.2]
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 do |t|
+
+ 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 "container_repositories", id: :serial do |t|
+
+ 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, using: :btree
- t.index ["project_id"], name: "index_container_repositories_on_project_id", using: :btree
+ 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 do |t|
+
+ 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
@@ -574,15 +821,29 @@ class InitSchema < ActiveRecord::Migration[4.2]
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 do |t|
+
+ 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", using: :btree
+ t.index ["project_id"], name: "index_deploy_keys_projects_on_project_id"
end
- create_table "deployments", id: :serial do |t|
+
+ 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
@@ -595,12 +856,20 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.datetime "created_at"
t.datetime "updated_at"
t.string "on_stop"
- t.index ["created_at"], name: "index_deployments_on_created_at", using: :btree
- t.index ["environment_id", "id"], name: "index_deployments_on_environment_id_and_id", using: :btree
- t.index ["environment_id", "iid", "project_id"], name: "index_deployments_on_environment_id_and_iid_and_project_id", using: :btree
- t.index ["project_id", "iid"], name: "index_deployments_on_project_id_and_iid", unique: true, using: :btree
+ 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 do |t|
+
+ create_table "emails", id: :serial, force: :cascade do |t|
t.integer "user_id", null: false
t.string "email", null: false
t.datetime "created_at"
@@ -608,11 +877,12 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
- t.index ["email"], name: "index_emails_on_email", unique: true, using: :btree
- t.index ["user_id"], name: "index_emails_on_user_id", using: :btree
+ 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 do |t|
+
+ create_table "environments", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.string "name", null: false
t.datetime "created_at"
@@ -621,10 +891,11 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
- t.index ["project_id", "slug"], name: "index_environments_on_project_id_and_slug", unique: true, using: :btree
+ 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 do |t|
+
+ create_table "events", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.integer "author_id", null: false
t.integer "target_id"
@@ -632,91 +903,74 @@ class InitSchema < ActiveRecord::Migration[4.2]
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", using: :btree
- t.index ["author_id"], name: "index_events_on_author_id", using: :btree
- t.index ["project_id", "id"], name: "index_events_on_project_id_and_id", using: :btree
- t.index ["target_type", "target_id"], name: "index_events_on_target_type_and_target_id", using: :btree
+ 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 do |t|
+
+ 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, using: :btree
+ 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 do |t|
+
+ 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, using: :btree
+ t.index ["key"], name: "index_features_on_key", unique: true
end
- create_table "fork_network_members", id: :serial do |t|
+
+ 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", using: :btree
- t.index ["project_id"], name: "index_fork_network_members_on_project_id", unique: true, using: :btree
+ 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 do |t|
+
+ 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, using: :btree
+ t.index ["root_project_id"], name: "index_fork_networks_on_root_project_id", unique: true
end
- create_table "forked_project_links", id: :serial do |t|
+
+ 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, using: :btree
+ t.index ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true
end
- create_table "gcp_clusters", id: :serial do |t|
- t.integer "project_id", null: false
- t.integer "user_id"
- t.integer "service_id"
- t.integer "status"
- t.integer "gcp_cluster_size", null: false
- t.datetime_with_timezone "created_at", null: false
- t.datetime_with_timezone "updated_at", null: false
- t.boolean "enabled", default: true
- t.text "status_reason"
- t.string "project_namespace"
- t.string "endpoint"
- t.text "ca_cert"
- t.text "encrypted_kubernetes_token"
- t.string "encrypted_kubernetes_token_iv"
- t.string "username"
- t.text "encrypted_password"
- t.string "encrypted_password_iv"
- t.string "gcp_project_id", null: false
- t.string "gcp_cluster_zone", null: false
- t.string "gcp_cluster_name", null: false
- t.string "gcp_machine_type"
- t.string "gcp_operation_id"
- t.text "encrypted_gcp_token"
- t.string "encrypted_gcp_token_iv"
- t.index ["project_id"], name: "index_gcp_clusters_on_project_id", unique: true, using: :btree
- end
- create_table "gpg_key_subkeys", id: :serial do |t|
+
+ 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, using: :btree
- t.index ["gpg_key_id"], name: "index_gpg_key_subkeys_on_gpg_key_id", using: :btree
- t.index ["keyid"], name: "index_gpg_key_subkeys_on_keyid", unique: true, using: :btree
+ 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 do |t|
+
+ 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, using: :btree
- t.index ["primary_keyid"], name: "index_gpg_keys_on_primary_keyid", unique: true, using: :btree
- t.index ["user_id"], name: "index_gpg_keys_on_user_id", using: :btree
+ 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 do |t|
+
+ 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"
@@ -727,45 +981,81 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
- t.index ["gpg_key_id"], name: "index_gpg_signatures_on_gpg_key_id", using: :btree
- t.index ["gpg_key_primary_keyid"], name: "index_gpg_signatures_on_gpg_key_primary_keyid", using: :btree
- t.index ["gpg_key_subkey_id"], name: "index_gpg_signatures_on_gpg_key_subkey_id", using: :btree
- t.index ["project_id"], name: "index_gpg_signatures_on_project_id", using: :btree
+ 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 do |t|
+
+ 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, using: :btree
- t.index ["key", "value"], name: "index_group_custom_attributes_on_key_and_value", using: :btree
+ 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 do |t|
+
+ 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", using: :btree
+ 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 do |t|
+
+ 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, using: :btree
- t.index ["user_id"], name: "index_issue_assignees_on_user_id", using: :btree
+ 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 do |t|
+
+ 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", using: :btree
+ t.index ["issue_id"], name: "index_issue_metrics"
end
- create_table "issues", id: :serial do |t|
+
+ create_table "issues", id: :serial, force: :cascade do |t|
t.string "title"
t.integer "author_id"
t.integer "project_id"
@@ -789,21 +1079,25 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.integer "last_edited_by_id"
t.boolean "discussion_locked"
t.datetime_with_timezone "closed_at"
- t.index ["author_id"], name: "index_issues_on_author_id", using: :btree
- t.index ["confidential"], name: "index_issues_on_confidential", using: :btree
- t.index ["description"], name: "index_issues_on_description_trigram", using: :gin, opclass: {"description"=>"gin_trgm_ops"}
- t.index ["milestone_id"], name: "index_issues_on_milestone_id", using: :btree
- t.index ["moved_to_id"], name: "index_issues_on_moved_to_id", where: "(moved_to_id IS NOT NULL)", using: :btree
- t.index ["project_id", "created_at", "id", "state"], name: "index_issues_on_project_id_and_created_at_and_id_and_state", using: :btree
- 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)", using: :btree
- t.index ["project_id", "iid"], name: "index_issues_on_project_id_and_iid", unique: true, using: :btree
- t.index ["project_id", "updated_at", "id", "state"], name: "index_issues_on_project_id_and_updated_at_and_id_and_state", using: :btree
- t.index ["relative_position"], name: "index_issues_on_relative_position", using: :btree
- t.index ["state"], name: "index_issues_on_state", using: :btree
- t.index ["title"], name: "index_issues_on_title_trigram", using: :gin, opclass: {"title"=>"gin_trgm_ops"}
- t.index ["updated_by_id"], name: "index_issues_on_updated_by_id", where: "(updated_by_id IS NOT NULL)", using: :btree
- end
- create_table "keys", id: :serial do |t|
+ 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"
@@ -813,28 +1107,32 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
- t.index ["user_id"], name: "index_keys_on_user_id", using: :btree
+ 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 do |t|
+
+ 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", using: :btree
- t.index ["target_id", "target_type"], name: "index_label_links_on_target_id_and_target_type", using: :btree
+ 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 do |t|
+
+ 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 ["priority"], name: "index_label_priorities_on_priority", using: :btree
- t.index ["project_id", "label_id"], name: "index_label_priorities_on_project_id_and_label_id", unique: true, using: :btree
+ 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 do |t|
+
+ create_table "labels", id: :serial, force: :cascade do |t|
t.string "title"
t.string "color"
t.integer "project_id"
@@ -846,39 +1144,54 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
- t.index ["project_id"], name: "index_labels_on_project_id", using: :btree
- t.index ["template"], name: "index_labels_on_template", where: "template", using: :btree
- t.index ["title"], name: "index_labels_on_title", using: :btree
- t.index ["type", "project_id"], name: "index_labels_on_type_and_project_id", using: :btree
+ 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_objects", id: :serial do |t|
+
+ 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 ["oid"], name: "index_lfs_objects_on_oid", unique: true, using: :btree
+ 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 do |t|
+
+ 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", using: :btree
+ t.index ["project_id"], name: "index_lfs_objects_projects_on_project_id"
end
- create_table "lists", id: :serial do |t|
+
+ 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, using: :btree
- t.index ["label_id"], name: "index_lists_on_label_id", using: :btree
+ 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 do |t|
+
+ 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
@@ -893,13 +1206,14 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.datetime "invite_accepted_at"
t.datetime "requested_at"
t.date "expires_at"
- t.index ["access_level"], name: "index_members_on_access_level", using: :btree
- t.index ["invite_token"], name: "index_members_on_invite_token", unique: true, using: :btree
- t.index ["requested_at"], name: "index_members_on_requested_at", using: :btree
- t.index ["source_id", "source_type"], name: "index_members_on_source_id_and_source_type", using: :btree
- t.index ["user_id"], name: "index_members_on_user_id", using: :btree
+ 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 do |t|
+
+ 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
@@ -910,10 +1224,11 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
- t.index ["sha"], name: "index_merge_request_diff_commits_on_sha", using: :btree
+ 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 do |t|
+
+ 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
@@ -926,9 +1241,10 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
+ 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 do |t|
+
+ 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"
@@ -937,9 +1253,11 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.string "real_size"
t.string "head_commit_sha"
t.string "start_commit_sha"
- t.index ["merge_request_id", "id"], name: "index_merge_request_diffs_on_merge_request_id_and_id", using: :btree
+ 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 do |t|
+
+ 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"
@@ -951,11 +1269,14 @@ class InitSchema < ActiveRecord::Migration[4.2]
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", using: :btree
- t.index ["merge_request_id"], name: "index_merge_request_metrics", using: :btree
- t.index ["pipeline_id"], name: "index_merge_request_metrics_on_pipeline_id", using: :btree
+ 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 do |t|
+
+ 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"
@@ -989,33 +1310,39 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.string "merge_jid"
t.boolean "discussion_locked"
t.integer "latest_merge_request_diff_id"
- t.index ["assignee_id"], name: "index_merge_requests_on_assignee_id", using: :btree
- t.index ["author_id"], name: "index_merge_requests_on_author_id", using: :btree
- t.index ["created_at"], name: "index_merge_requests_on_created_at", using: :btree
- t.index ["description"], name: "index_merge_requests_on_description_trigram", using: :gin, opclass: {"description"=>"gin_trgm_ops"}
- t.index ["head_pipeline_id"], name: "index_merge_requests_on_head_pipeline_id", using: :btree
- t.index ["latest_merge_request_diff_id"], name: "index_merge_requests_on_latest_merge_request_diff_id", using: :btree
- t.index ["merge_user_id"], name: "index_merge_requests_on_merge_user_id", where: "(merge_user_id IS NOT NULL)", using: :btree
- t.index ["milestone_id"], name: "index_merge_requests_on_milestone_id", using: :btree
- t.index ["source_branch"], name: "index_merge_requests_on_source_branch", using: :btree
- t.index ["source_project_id", "source_branch"], name: "index_merge_requests_on_source_project_and_branch_state_opened", where: "((state)::text = 'opened'::text)", using: :btree
- t.index ["source_project_id", "source_branch"], name: "index_merge_requests_on_source_project_id_and_source_branch", using: :btree
- t.index ["target_branch"], name: "index_merge_requests_on_target_branch", using: :btree
- t.index ["target_project_id", "iid"], name: "index_merge_requests_on_target_project_id_and_iid", unique: true, using: :btree
- t.index ["target_project_id", "merge_commit_sha", "id"], name: "index_merge_requests_on_tp_id_and_merge_commit_sha_and_id", using: :btree
- t.index ["title"], name: "index_merge_requests_on_title", using: :btree
- t.index ["title"], name: "index_merge_requests_on_title_trigram", using: :gin, opclass: {"title"=>"gin_trgm_ops"}
- t.index ["updated_by_id"], name: "index_merge_requests_on_updated_by_id", where: "(updated_by_id IS NOT NULL)", using: :btree
- end
- create_table "merge_requests_closing_issues", id: :serial do |t|
+ 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", using: :btree
- t.index ["merge_request_id"], name: "index_merge_requests_closing_issues_on_merge_request_id", using: :btree
+ 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 do |t|
+
+ create_table "milestones", id: :serial, force: :cascade do |t|
t.string "title", null: false
t.integer "project_id"
t.text "description"
@@ -1029,14 +1356,15 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.date "start_date"
t.integer "cached_markdown_version"
t.integer "group_id"
- t.index ["description"], name: "index_milestones_on_description_trigram", using: :gin, opclass: {"description"=>"gin_trgm_ops"}
- t.index ["due_date"], name: "index_milestones_on_due_date", using: :btree
- t.index ["group_id"], name: "index_milestones_on_group_id", using: :btree
- t.index ["project_id", "iid"], name: "index_milestones_on_project_id_and_iid", unique: true, using: :btree
- t.index ["title"], name: "index_milestones_on_title", using: :btree
- t.index ["title"], name: "index_milestones_on_title_trigram", using: :gin, opclass: {"title"=>"gin_trgm_ops"}
- end
- create_table "namespaces", id: :serial do |t|
+ 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"
@@ -1055,17 +1383,34 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.integer "two_factor_grace_period", default: 48, null: false
t.integer "cached_markdown_version"
t.string "runners_token"
- t.index ["created_at"], name: "index_namespaces_on_created_at", using: :btree
- t.index ["name", "parent_id"], name: "index_namespaces_on_name_and_parent_id", unique: true, using: :btree
- t.index ["name"], name: "index_namespaces_on_name_trigram", using: :gin, opclass: {"name"=>"gin_trgm_ops"}
- t.index ["owner_id"], name: "index_namespaces_on_owner_id", using: :btree
- t.index ["parent_id", "id"], name: "index_namespaces_on_parent_id_and_id", unique: true, using: :btree
- t.index ["path"], name: "index_namespaces_on_path", using: :btree
- t.index ["path"], name: "index_namespaces_on_path_trigram", using: :gin, opclass: {"path"=>"gin_trgm_ops"}
- t.index ["require_two_factor_authentication"], name: "index_namespaces_on_require_two_factor_authentication", using: :btree
- t.index ["type"], name: "index_namespaces_on_type", using: :btree
- end
- create_table "notes", id: :serial do |t|
+ 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"
@@ -1089,18 +1434,18 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.integer "cached_markdown_version"
t.text "change_position"
t.boolean "resolved_by_push"
- t.index ["author_id"], name: "index_notes_on_author_id", using: :btree
- t.index ["commit_id"], name: "index_notes_on_commit_id", using: :btree
- t.index ["created_at"], name: "index_notes_on_created_at", using: :btree
- t.index ["discussion_id"], name: "index_notes_on_discussion_id", using: :btree
- t.index ["line_code"], name: "index_notes_on_line_code", using: :btree
- t.index ["note"], name: "index_notes_on_note_trigram", using: :gin, opclass: {"note"=>"gin_trgm_ops"}
- t.index ["noteable_id", "noteable_type"], name: "index_notes_on_noteable_id_and_noteable_type", using: :btree
- t.index ["noteable_type"], name: "index_notes_on_noteable_type", using: :btree
- t.index ["project_id", "noteable_type"], name: "index_notes_on_project_id_and_noteable_type", using: :btree
- t.index ["updated_at"], name: "index_notes_on_updated_at", using: :btree
- end
- create_table "notification_settings", id: :serial do |t|
+ 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"
@@ -1119,11 +1464,14 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.boolean "merge_merge_request"
t.boolean "failed_pipeline"
t.boolean "success_pipeline"
- t.index ["source_id", "source_type"], name: "index_notification_settings_on_source_id_and_source_type", using: :btree
- t.index ["user_id", "source_id", "source_type"], name: "index_notifications_on_user_id_and_source_id_and_source_type", unique: true, using: :btree
- t.index ["user_id"], name: "index_notification_settings_on_user_id", using: :btree
+ 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 do |t|
+
+ 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
@@ -1132,9 +1480,10 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
+ t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true
end
- create_table "oauth_access_tokens", id: :serial do |t|
+
+ 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
@@ -1143,11 +1492,12 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
- t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree
- t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree
+ 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 do |t|
+
+ 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
@@ -1158,26 +1508,35 @@ class InitSchema < ActiveRecord::Migration[4.2]
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", using: :btree
- t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
+ 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 do |t|
+
+ 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 do |t|
+
+ 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.index ["domain"], name: "index_pages_domains_on_domain", unique: true, using: :btree
- t.index ["project_id"], name: "index_pages_domains_on_project_id", using: :btree
+ 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 do |t|
+
+ create_table "personal_access_tokens", id: :serial, force: :cascade do |t|
t.integer "user_id", null: false
- t.string "token", null: false
t.string "name", null: false
t.boolean "revoked", default: false
t.date "expires_at"
@@ -1185,64 +1544,138 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.datetime "updated_at", null: false
t.string "scopes", default: "--- []\n", null: false
t.boolean "impersonation", default: false, null: false
- t.index ["token"], name: "index_personal_access_tokens_on_token", unique: true, using: :btree
- t.index ["user_id"], name: "index_personal_access_tokens_on_user_id", using: :btree
+ 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 "project_authorizations", id: false do |t|
- t.integer "user_id"
- t.integer "project_id"
- t.integer "access_level"
- t.index ["project_id"], name: "index_project_authorizations_on_project_id", using: :btree
- t.index ["user_id", "project_id", "access_level"], name: "index_project_authorizations_on_user_id_project_id_access_level", unique: true, using: :btree
+
+ 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 "project_auto_devops", id: :serial do |t|
+
+ 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.index ["project_id"], name: "index_project_auto_devops_on_project_id", unique: true, using: :btree
+ 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 do |t|
+
+ 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", using: :btree
- t.index ["project_id", "key"], name: "index_project_custom_attributes_on_project_id_and_key", unique: true, using: :btree
+ 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_features", id: :serial do |t|
- t.integer "project_id"
+
+ 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"
+ 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.index ["project_id"], name: "index_project_features_on_project_id", using: :btree
+ 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 do |t|
+
+ 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", using: :btree
- t.index ["project_id"], name: "index_project_group_links_on_project_id", using: :btree
+ 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 do |t|
+
+ 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", using: :btree
+ 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 do |t|
+
+ 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
@@ -1250,17 +1683,18 @@ class InitSchema < ActiveRecord::Migration[4.2]
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", using: :btree
- t.index ["project_id"], name: "index_project_statistics_on_project_id", unique: true, using: :btree
+ 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 do |t|
+
+ 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"
+ t.integer "namespace_id", null: false
t.datetime "last_activity_at"
t.string "import_url"
t.integer "visibility_level", default: 0, null: false
@@ -1304,62 +1738,98 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.boolean "resolve_outdated_diff_discussions"
t.string "external_authorization_classification_label"
t.integer "jobs_cache_index"
- t.index ["ci_id"], name: "index_projects_on_ci_id", using: :btree
- t.index ["created_at"], name: "index_projects_on_created_at", using: :btree
- t.index ["creator_id"], name: "index_projects_on_creator_id", using: :btree
- t.index ["description"], name: "index_projects_on_description_trigram", using: :gin, opclass: {"description"=>"gin_trgm_ops"}
- t.index ["last_activity_at"], name: "index_projects_on_last_activity_at", using: :btree
- t.index ["last_repository_check_failed"], name: "index_projects_on_last_repository_check_failed", using: :btree
- t.index ["last_repository_updated_at"], name: "index_projects_on_last_repository_updated_at", using: :btree
- t.index ["name"], name: "index_projects_on_name_trigram", using: :gin, opclass: {"name"=>"gin_trgm_ops"}
- t.index ["namespace_id"], name: "index_projects_on_namespace_id", using: :btree
- t.index ["path"], name: "index_projects_on_path", using: :btree
- t.index ["path"], name: "index_projects_on_path_trigram", using: :gin, opclass: {"path"=>"gin_trgm_ops"}
- t.index ["pending_delete"], name: "index_projects_on_pending_delete", using: :btree
- t.index ["repository_storage"], name: "index_projects_on_repository_storage", using: :btree
- t.index ["runners_token"], name: "index_projects_on_runners_token", using: :btree
- t.index ["star_count"], name: "index_projects_on_star_count", using: :btree
- t.index ["visibility_level"], name: "index_projects_on_visibility_level", using: :btree
- end
- create_table "protected_branch_merge_access_levels", id: :serial do |t|
+ 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", using: :btree
+ t.index ["protected_branch_id"], name: "index_protected_branch_merge_access"
end
- create_table "protected_branch_push_access_levels", id: :serial do |t|
+
+ 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", using: :btree
+ t.index ["protected_branch_id"], name: "index_protected_branch_push_access"
end
- create_table "protected_branches", id: :serial do |t|
+
+ 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", using: :btree
+ t.index ["project_id"], name: "index_protected_branches_on_project_id"
end
- create_table "protected_tag_create_access_levels", id: :serial do |t|
+
+ 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 ["protected_tag_id"], name: "index_protected_tag_create_access", using: :btree
- t.index ["user_id"], name: "index_protected_tag_create_access_levels_on_user_id", using: :btree
+ 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 do |t|
+
+ 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: "index_protected_tags_on_project_id", using: :btree
+ 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 do |t|
+
+ 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
@@ -1368,21 +1838,31 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
+ t.index ["event_id"], name: "index_push_event_payloads_on_event_id", unique: true
end
- create_table "redirect_routes", id: :serial do |t|
+
+ 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.boolean "permanent"
- t.index ["path"], name: "index_redirect_routes_on_path", unique: true, using: :btree
- t.index ["path"], name: "index_redirect_routes_on_path_text_pattern_ops", using: :btree, opclass: {"path"=>"varchar_pattern_ops"}
- t.index ["permanent"], name: "index_redirect_routes_on_permanent", using: :btree
- t.index ["source_type", "source_id"], name: "index_redirect_routes_on_source_type_and_source_id", using: :btree
+ 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 "releases", id: :serial do |t|
+
+ 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"
@@ -1390,21 +1870,70 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.datetime "updated_at"
t.text "description_html"
t.integer "cached_markdown_version"
- t.index ["project_id", "tag"], name: "index_releases_on_project_id_and_tag", using: :btree
- t.index ["project_id"], name: "index_releases_on_project_id", using: :btree
+ 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 do |t|
+
+ 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, using: :btree
- t.index ["path"], name: "index_routes_on_path_text_pattern_ops", using: :btree, opclass: {"path"=>"varchar_pattern_ops"}
- t.index ["source_type", "source_id"], name: "index_routes_on_source_type_and_source_id", unique: true, using: :btree
+ 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 do |t|
+
+ create_table "sent_notifications", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.string "noteable_type"
t.integer "noteable_id"
@@ -1415,9 +1944,10 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
+ t.index ["reply_key"], name: "index_sent_notifications_on_reply_key", unique: true
end
- create_table "services", id: :serial do |t|
+
+ create_table "services", id: :serial, force: :cascade do |t|
t.string "type"
t.string "title"
t.integer "project_id"
@@ -1438,10 +1968,17 @@ class InitSchema < ActiveRecord::Migration[4.2]
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.index ["project_id"], name: "index_services_on_project_id", using: :btree
- t.index ["template"], name: "index_services_on_template", using: :btree
+ 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 "snippets", id: :serial do |t|
+
+ 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
@@ -1456,14 +1993,15 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.integer "cached_markdown_version"
t.text "description"
t.text "description_html"
- t.index ["author_id"], name: "index_snippets_on_author_id", using: :btree
- t.index ["file_name"], name: "index_snippets_on_file_name_trigram", using: :gin, opclass: {"file_name"=>"gin_trgm_ops"}
- t.index ["project_id"], name: "index_snippets_on_project_id", using: :btree
- t.index ["title"], name: "index_snippets_on_title_trigram", using: :gin, opclass: {"title"=>"gin_trgm_ops"}
- t.index ["updated_at"], name: "index_snippets_on_updated_at", using: :btree
- t.index ["visibility_level"], name: "index_snippets_on_visibility_level", using: :btree
- end
- create_table "spam_logs", id: :serial do |t|
+ 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"
@@ -1476,7 +2014,8 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.boolean "submitted_as_ham", default: false, null: false
t.boolean "recaptcha_verified", default: false, null: false
end
- create_table "subscriptions", id: :serial do |t|
+
+ create_table "subscriptions", id: :serial, force: :cascade do |t|
t.integer "user_id"
t.string "subscribable_type"
t.integer "subscribable_id"
@@ -1484,17 +2023,31 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.datetime "created_at"
t.datetime "updated_at"
t.integer "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, using: :btree
+ 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 "system_note_metadata", id: :serial do |t|
+
+ 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, using: :btree
+ t.index ["note_id"], name: "index_system_note_metadata_on_note_id", unique: true
end
- create_table "taggings", id: :serial do |t|
+
+ create_table "taggings", id: :serial, force: :cascade do |t|
t.integer "tag_id"
t.integer "taggable_id"
t.string "taggable_type"
@@ -1502,15 +2055,30 @@ class InitSchema < ActiveRecord::Migration[4.2]
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, using: :btree
- t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree
+ 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 do |t|
+
+ 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, using: :btree
+ 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 do |t|
+
+ 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
@@ -1518,34 +2086,41 @@ class InitSchema < ActiveRecord::Migration[4.2]
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", using: :btree
- t.index ["merge_request_id"], name: "index_timelogs_on_merge_request_id", using: :btree
- t.index ["user_id"], name: "index_timelogs_on_user_id", using: :btree
+ 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 do |t|
+
+ create_table "todos", id: :serial, force: :cascade do |t|
t.integer "user_id", null: false
- t.integer "project_id", null: false
+ t.integer "project_id"
t.string "target_type", null: false
t.integer "target_id"
- t.integer "author_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.index ["author_id"], name: "index_todos_on_author_id", using: :btree
- t.index ["commit_id"], name: "index_todos_on_commit_id", using: :btree
- t.index ["note_id"], name: "index_todos_on_note_id", using: :btree
- t.index ["project_id"], name: "index_todos_on_project_id", using: :btree
- t.index ["target_type", "target_id"], name: "index_todos_on_target_type_and_target_id", using: :btree
- t.index ["user_id"], name: "index_todos_on_user_id", using: :btree
- end
- create_table "trending_projects", id: :serial do |t|
+ 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", using: :btree
+ t.index ["project_id"], name: "index_trending_projects_on_project_id", unique: true
end
- create_table "u2f_registrations", id: :serial do |t|
+
+ create_table "u2f_registrations", id: :serial, force: :cascade do |t|
t.text "certificate"
t.string "key_handle"
t.string "public_key"
@@ -1554,10 +2129,11 @@ class InitSchema < ActiveRecord::Migration[4.2]
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", using: :btree
- t.index ["user_id"], name: "index_u2f_registrations_on_user_id", using: :btree
+ 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 do |t|
+
+ 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
@@ -1566,11 +2142,15 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.string "uploader", null: false
t.datetime "created_at", null: false
t.integer "store"
- t.index ["checksum"], name: "index_uploads_on_checksum", using: :btree
- t.index ["model_id", "model_type"], name: "index_uploads_on_model_id_and_model_type", using: :btree
- t.index ["path"], name: "index_uploads_on_path", using: :btree
+ 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 do |t|
+
+ 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
@@ -1578,26 +2158,61 @@ class InitSchema < ActiveRecord::Migration[4.2]
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", using: :btree
+ t.index ["subject_id", "subject_type"], name: "index_user_agent_details_on_subject_id_and_subject_type"
end
- create_table "user_custom_attributes", id: :serial do |t|
+
+ 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", using: :btree
- t.index ["user_id", "key"], name: "index_user_custom_attributes_on_user_id_and_key", unique: true, using: :btree
+ 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 do |t|
+
+ 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, using: :btree
+ t.index ["user_id"], name: "index_user_synced_attributes_metadata_on_user_id", unique: true
end
- create_table "users", id: :serial do |t|
+
+ 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"
@@ -1660,32 +2275,40 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.date "last_activity_on"
t.boolean "notified_of_own_activity"
t.string "preferred_language"
- t.string "rss_token"
t.integer "theme_id", limit: 2
- t.index ["admin"], name: "index_users_on_admin", using: :btree
- t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
- t.index ["created_at"], name: "index_users_on_created_at", using: :btree
- t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
- t.index ["email"], name: "index_users_on_email_trigram", using: :gin, opclass: {"email"=>"gin_trgm_ops"}
- t.index ["ghost"], name: "index_users_on_ghost", using: :btree
- t.index ["incoming_email_token"], name: "index_users_on_incoming_email_token", using: :btree
- t.index ["name"], name: "index_users_on_name", using: :btree
- t.index ["name"], name: "index_users_on_name_trigram", using: :gin, opclass: {"name"=>"gin_trgm_ops"}
- t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
- t.index ["rss_token"], name: "index_users_on_rss_token", using: :btree
- t.index ["state"], name: "index_users_on_state", using: :btree
- t.index ["username"], name: "index_users_on_username", using: :btree
- t.index ["username"], name: "index_users_on_username_trigram", using: :gin, opclass: {"username"=>"gin_trgm_ops"}
- end
- create_table "users_star_projects", id: :serial do |t|
+ 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", using: :btree
- t.index ["user_id", "project_id"], name: "index_users_star_projects_on_user_id_and_project_id", unique: true, using: :btree
+ 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 do |t|
+
+ create_table "web_hook_logs", id: :serial, force: :cascade do |t|
t.integer "web_hook_id", null: false
t.string "trigger"
t.string "url"
@@ -1698,10 +2321,11 @@ class InitSchema < ActiveRecord::Migration[4.2]
t.string "internal_error_message"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
- t.index ["web_hook_id"], name: "index_web_hook_logs_on_web_hook_id", using: :btree
+ 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 do |t|
- t.string "url", limit: 2000
+
+ create_table "web_hooks", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
@@ -1714,33 +2338,56 @@ class InitSchema < ActiveRecord::Migration[4.2]
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.string "token"
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.index ["project_id"], name: "index_web_hooks_on_project_id", using: :btree
- t.index ["type"], name: "index_web_hooks_on_type", using: :btree
+ 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
@@ -1751,14 +2398,25 @@ class InitSchema < ActiveRecord::Migration[4.2]
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
@@ -1770,15 +2428,17 @@ class InitSchema < ActiveRecord::Migration[4.2]
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 "gcp_clusters", "projects", on_delete: :cascade
- add_foreign_key "gcp_clusters", "services", on_delete: :nullify
- add_foreign_key "gcp_clusters", "users", on_delete: :nullify
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
@@ -1786,11 +2446,14 @@ class InitSchema < ActiveRecord::Migration[4.2]
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
@@ -1814,18 +2477,32 @@ class InitSchema < ActiveRecord::Migration[4.2]
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
@@ -1834,18 +2511,39 @@ class InitSchema < ActiveRecord::Migration[4.2]
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
@@ -1855,5 +2553,10 @@ class InitSchema < ActiveRecord::Migration[4.2]
raise ActiveRecord::IrreversibleMigration, "The initial migration is not revertable"
end
end
-# rubocop:enable Migration/AddLimitToTextColumns
+
+# 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/20190315191339_create_merge_request_assignees_table.rb b/db/migrate/20190315191339_create_merge_request_assignees_table.rb
index 6fc4463f281..dbd9ea3e35b 100644
--- a/db/migrate/20190315191339_create_merge_request_assignees_table.rb
+++ b/db/migrate/20190315191339_create_merge_request_assignees_table.rb
@@ -17,6 +17,8 @@ class CreateMergeRequestAssigneesTable < ActiveRecord::Migration[5.0]
end
def down
+ # rubocop:disable Migration/DropTable
drop_table :merge_request_assignees
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20190402150158_backport_enterprise_schema.rb b/db/migrate/20190402150158_backport_enterprise_schema.rb
index 694c0feba0a..912da09af9d 100644
--- a/db/migrate/20190402150158_backport_enterprise_schema.rb
+++ b/db/migrate/20190402150158_backport_enterprise_schema.rb
@@ -193,7 +193,9 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0]
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, *args)
diff --git a/db/migrate/20190722144316_create_milestone_releases_table.rb b/db/migrate/20190722144316_create_milestone_releases_table.rb
index 55878bcec41..911ca941a56 100644
--- a/db/migrate/20190722144316_create_milestone_releases_table.rb
+++ b/db/migrate/20190722144316_create_milestone_releases_table.rb
@@ -15,6 +15,8 @@ class CreateMilestoneReleasesTable < ActiveRecord::Migration[5.2]
end
def down
+ # rubocop:disable Migration/DropTable
drop_table :milestone_releases
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20190927055500_create_description_versions.rb b/db/migrate/20190927055500_create_description_versions.rb
index b3082533a6f..9046ebbc499 100644
--- a/db/migrate/20190927055500_create_description_versions.rb
+++ b/db/migrate/20190927055500_create_description_versions.rb
@@ -24,6 +24,8 @@ class CreateDescriptionVersions < ActiveRecord::Migration[5.2]
def down
remove_column :system_note_metadata, :description_version_id
+ # rubocop:disable Migration/DropTable
drop_table :description_versions
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20191118053631_add_group_deletion_schedules.rb b/db/migrate/20191118053631_add_group_deletion_schedules.rb
index 6f3ed27e156..bc18480e5b9 100644
--- a/db/migrate/20191118053631_add_group_deletion_schedules.rb
+++ b/db/migrate/20191118053631_add_group_deletion_schedules.rb
@@ -23,6 +23,8 @@ class AddGroupDeletionSchedules < ActiveRecord::Migration[5.2]
end
def down
+ # rubocop:disable Migration/DropTable
drop_table :group_deletion_schedules
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20191127151619_create_gitlab_subscription_histories.rb b/db/migrate/20191127151619_create_gitlab_subscription_histories.rb
index 718f2c1b313..db2617112a3 100644
--- a/db/migrate/20191127151619_create_gitlab_subscription_histories.rb
+++ b/db/migrate/20191127151619_create_gitlab_subscription_histories.rb
@@ -23,6 +23,8 @@ class CreateGitlabSubscriptionHistories < ActiveRecord::Migration[5.2]
end
def down
+ # rubocop:disable Migration/DropTable
drop_table :gitlab_subscription_histories
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20200123091622_drop_analytics_repository_files_table.rb b/db/migrate/20200123091622_drop_analytics_repository_files_table.rb
index aa31d23920a..ed6746165a8 100644
--- a/db/migrate/20200123091622_drop_analytics_repository_files_table.rb
+++ b/db/migrate/20200123091622_drop_analytics_repository_files_table.rb
@@ -7,7 +7,9 @@ class DropAnalyticsRepositoryFilesTable < ActiveRecord::Migration[5.2]
def up
# Requires ExclusiveLock on the table. Not in use, no records, no FKs.
+ # rubocop:disable Migration/DropTable
drop_table :analytics_repository_files
+ # rubocop:enable Migration/DropTable
end
def down
diff --git a/db/migrate/20200123091734_drop_analytics_repository_file_commits_table.rb b/db/migrate/20200123091734_drop_analytics_repository_file_commits_table.rb
index 2d3c1c9a817..2eb10a9056d 100644
--- a/db/migrate/20200123091734_drop_analytics_repository_file_commits_table.rb
+++ b/db/migrate/20200123091734_drop_analytics_repository_file_commits_table.rb
@@ -7,7 +7,9 @@ class DropAnalyticsRepositoryFileCommitsTable < ActiveRecord::Migration[5.2]
def up
# Requires ExclusiveLock on the table. Not in use, no records, no FKs.
+ # rubocop:disable Migration/DropTable
drop_table :analytics_repository_file_commits
+ # rubocop:enable Migration/DropTable
end
def down
diff --git a/db/migrate/20200123091854_drop_analytics_repository_file_edits_table.rb b/db/migrate/20200123091854_drop_analytics_repository_file_edits_table.rb
index 59bf2dbdca3..e4bdb6f6ec2 100644
--- a/db/migrate/20200123091854_drop_analytics_repository_file_edits_table.rb
+++ b/db/migrate/20200123091854_drop_analytics_repository_file_edits_table.rb
@@ -7,7 +7,9 @@ class DropAnalyticsRepositoryFileEditsTable < ActiveRecord::Migration[5.2]
def up
# Requires ExclusiveLock on the table. Not in use, no records, no FKs.
+ # rubocop:disable Migration/DropTable
drop_table :analytics_repository_file_edits if table_exists?(:analytics_repository_file_edits) # this table might be already dropped on development environment
+ # rubocop:enable Migration/DropTable
end
def down
diff --git a/db/migrate/20200214025454_add_canonical_emails.rb b/db/migrate/20200214025454_add_canonical_emails.rb
index 0732d39169d..70ab7208ade 100644
--- a/db/migrate/20200214025454_add_canonical_emails.rb
+++ b/db/migrate/20200214025454_add_canonical_emails.rb
@@ -20,7 +20,9 @@ class AddCanonicalEmails < ActiveRecord::Migration[6.0]
def down
with_lock_retries do
+ # rubocop:disable Migration/DropTable
drop_table(:user_canonical_emails)
+ # rubocop:enable Migration/DropTable
end
end
end
diff --git a/db/migrate/20200215225103_drop_forked_project_links_table.rb b/db/migrate/20200215225103_drop_forked_project_links_table.rb
index 9c028d23dbc..6acced2c734 100644
--- a/db/migrate/20200215225103_drop_forked_project_links_table.rb
+++ b/db/migrate/20200215225103_drop_forked_project_links_table.rb
@@ -8,6 +8,7 @@ class DropForkedProjectLinksTable < ActiveRecord::Migration[6.0]
DOWNTIME = false
def change
+ # rubocop:disable Migration/DropTable
drop_table "forked_project_links", id: :serial do |t|
t.integer "forked_to_project_id", null: false
t.integer "forked_from_project_id", null: false
@@ -15,5 +16,6 @@ class DropForkedProjectLinksTable < ActiveRecord::Migration[6.0]
t.datetime "updated_at"
t.index ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true
end
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20200227165129_create_user_details.rb b/db/migrate/20200227165129_create_user_details.rb
index 89258eadb9f..474dc357266 100644
--- a/db/migrate/20200227165129_create_user_details.rb
+++ b/db/migrate/20200227165129_create_user_details.rb
@@ -20,7 +20,9 @@ class CreateUserDetails < ActiveRecord::Migration[6.0]
def down
with_lock_retries do
+ # rubocop:disable Migration/DropTable
drop_table :user_details
+ # rubocop:enable Migration/DropTable
end
end
end
diff --git a/db/migrate/20200306160521_add_index_on_author_id_and_created_at_to_events.rb b/db/migrate/20200306160521_add_index_on_author_id_and_created_at_to_events.rb
index 3328a14bb65..2f7c16b3f20 100644
--- a/db/migrate/20200306160521_add_index_on_author_id_and_created_at_to_events.rb
+++ b/db/migrate/20200306160521_add_index_on_author_id_and_created_at_to_events.rb
@@ -4,14 +4,15 @@ class AddIndexOnAuthorIdAndCreatedAtToEvents < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
+ INDEX_NAME = 'index_events_on_author_id_and_created_at'
disable_ddl_transaction!
def up
- add_concurrent_index :events, [:author_id, :created_at]
+ add_concurrent_index :events, [:author_id, :created_at], name: INDEX_NAME
end
def down
- remove_concurrent_index :events, [:author_id, :created_at]
+ remove_concurrent_index :events, INDEX_NAME
end
end
diff --git a/db/migrate/20200311093210_create_user_highest_roles.rb b/db/migrate/20200311093210_create_user_highest_roles.rb
index 36007f196d1..df2b02b7d91 100644
--- a/db/migrate/20200311093210_create_user_highest_roles.rb
+++ b/db/migrate/20200311093210_create_user_highest_roles.rb
@@ -19,7 +19,9 @@ class CreateUserHighestRoles < ActiveRecord::Migration[6.0]
def down
with_lock_retries do
+ # rubocop:disable Migration/DropTable
drop_table :user_highest_roles
+ # rubocop:enable Migration/DropTable
end
end
end
diff --git a/db/migrate/20200325094612_add_allow_merge_on_skipped_pipeline_to_project_settings.rb b/db/migrate/20200325094612_add_allow_merge_on_skipped_pipeline_to_project_settings.rb
new file mode 100644
index 00000000000..8575dd2f080
--- /dev/null
+++ b/db/migrate/20200325094612_add_allow_merge_on_skipped_pipeline_to_project_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddAllowMergeOnSkippedPipelineToProjectSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :project_settings, :allow_merge_on_skipped_pipeline, :boolean
+ end
+end
diff --git a/db/migrate/20200326122700_create_diff_note_positions.rb b/db/migrate/20200326122700_create_diff_note_positions.rb
index d37f7fef078..6c558516471 100644
--- a/db/migrate/20200326122700_create_diff_note_positions.rb
+++ b/db/migrate/20200326122700_create_diff_note_positions.rb
@@ -30,6 +30,8 @@ class CreateDiffNotePositions < ActiveRecord::Migration[6.0]
# rubocop:enable Migration/AddLimitToTextColumns
def down
+ # rubocop:disable Migration/DropTable
drop_table :diff_note_positions
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20200330203826_drop_fk_in_ci_ref.rb b/db/migrate/20200330203826_drop_fk_in_ci_ref.rb
new file mode 100644
index 00000000000..08cb4aaddab
--- /dev/null
+++ b/db/migrate/20200330203826_drop_fk_in_ci_ref.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class DropFkInCiRef < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists :ci_refs, column: :project_id
+ end
+ with_lock_retries do
+ remove_foreign_key_if_exists :ci_refs, column: :last_updated_by_pipeline_id
+ end
+ end
+
+ def down
+ add_foreign_key_if_not_exists :ci_refs, :projects, column: :project_id, on_delete: :cascade
+ add_foreign_key_if_not_exists :ci_refs, :ci_pipelines, column: :last_updated_by_pipeline_id, on_delete: :nullify
+ end
+
+ private
+
+ def add_foreign_key_if_not_exists(source, target, column:, on_delete:)
+ return unless table_exists?(source)
+ return if foreign_key_exists?(source, target, column: column)
+
+ add_concurrent_foreign_key(source, target, column: column, on_delete: on_delete)
+ end
+end
diff --git a/db/migrate/20200330203837_recreate_ci_ref.rb b/db/migrate/20200330203837_recreate_ci_ref.rb
new file mode 100644
index 00000000000..5a7bede4dc8
--- /dev/null
+++ b/db/migrate/20200330203837_recreate_ci_ref.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+
+class RecreateCiRef < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ UNKNOWN_STATUS = 0
+
+ def up
+ with_lock_retries do
+ # rubocop:disable Migration/DropTable
+ drop_table :ci_refs
+ # rubocop:enable Migration/DropTable
+
+ create_table :ci_refs do |t|
+ t.references :project, null: false, index: false, foreign_key: { on_delete: :cascade }, type: :bigint
+ t.integer :lock_version, null: false, default: 0
+ t.integer :status, null: false, limit: 2, default: UNKNOWN_STATUS
+ t.text :ref_path, null: false # rubocop: disable Migration/AddLimitToTextColumns
+ t.index [:project_id, :ref_path], unique: true
+ end
+ end
+ end
+
+ def down
+ with_lock_retries do
+ # rubocop:disable Migration/DropTable
+ drop_table :ci_refs
+ # rubocop:enable Migration/DropTable
+
+ 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
+ end
+end
diff --git a/db/migrate/20200331103637_add_ci_ref_id_to_ci_pipelines.rb b/db/migrate/20200331103637_add_ci_ref_id_to_ci_pipelines.rb
new file mode 100644
index 00000000000..9f2780670dc
--- /dev/null
+++ b/db/migrate/20200331103637_add_ci_ref_id_to_ci_pipelines.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddCiRefIdToCiPipelines < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :ci_pipelines, :ci_ref_id, :bigint
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :ci_pipelines, :ci_ref_id, :bigint
+ end
+ end
+end
diff --git a/db/migrate/20200331113728_add_index_to_ci_ref_id.rb b/db/migrate/20200331113728_add_index_to_ci_ref_id.rb
new file mode 100644
index 00000000000..d3495fd4fa1
--- /dev/null
+++ b/db/migrate/20200331113728_add_index_to_ci_ref_id.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class AddIndexToCiRefId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_pipelines, [:ci_ref_id], where: 'ci_ref_id IS NOT NULL'
+ end
+
+ def down
+ remove_concurrent_index :ci_pipelines, [:ci_ref_id], where: 'ci_ref_id IS NOT NULL'
+ end
+end
diff --git a/db/migrate/20200331113738_add_fk_to_ci_ref_id.rb b/db/migrate/20200331113738_add_fk_to_ci_ref_id.rb
new file mode 100644
index 00000000000..1a7a76904b1
--- /dev/null
+++ b/db/migrate/20200331113738_add_fk_to_ci_ref_id.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddFkToCiRefId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :ci_pipelines, :ci_refs, column: :ci_ref_id, on_delete: :nullify
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :ci_pipelines, column: :ci_ref_id
+ end
+ end
+end
diff --git a/db/migrate/20200331132103_add_project_compliance_framework_settings_table.rb b/db/migrate/20200331132103_add_project_compliance_framework_settings_table.rb
index 6af8c6db939..169c8602cab 100644
--- a/db/migrate/20200331132103_add_project_compliance_framework_settings_table.rb
+++ b/db/migrate/20200331132103_add_project_compliance_framework_settings_table.rb
@@ -16,7 +16,9 @@ class AddProjectComplianceFrameworkSettingsTable < ActiveRecord::Migration[6.0]
def down
with_lock_retries do
+ # rubocop:disable Migration/DropTable
drop_table :project_compliance_framework_settings
+ # rubocop:enable Migration/DropTable
end
end
end
diff --git a/db/migrate/20200407182205_create_partitioned_foreign_keys.rb b/db/migrate/20200407182205_create_partitioned_foreign_keys.rb
index aca8116d2dd..59e7d88b238 100644
--- a/db/migrate/20200407182205_create_partitioned_foreign_keys.rb
+++ b/db/migrate/20200407182205_create_partitioned_foreign_keys.rb
@@ -26,6 +26,8 @@ class CreatePartitionedForeignKeys < ActiveRecord::Migration[6.0]
end
def down
+ # rubocop:disable Migration/DropTable
drop_table :partitioned_foreign_keys
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20200407222647_create_project_repository_storage_moves.rb b/db/migrate/20200407222647_create_project_repository_storage_moves.rb
index 402a1cdd4a6..98e44aa2fc6 100644
--- a/db/migrate/20200407222647_create_project_repository_storage_moves.rb
+++ b/db/migrate/20200407222647_create_project_repository_storage_moves.rb
@@ -26,6 +26,8 @@ class CreateProjectRepositoryStorageMoves < ActiveRecord::Migration[6.0]
remove_check_constraint(:project_repository_storage_moves, 'project_repository_storage_moves_source_storage_name')
remove_check_constraint(:project_repository_storage_moves, 'project_repository_storage_moves_destination_storage_name')
+ # rubocop:disable Migration/DropTable
drop_table :project_repository_storage_moves
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20200408125046_create_ci_freeze_periods.rb b/db/migrate/20200408125046_create_ci_freeze_periods.rb
index 42a385150b8..98f0e20b11b 100644
--- a/db/migrate/20200408125046_create_ci_freeze_periods.rb
+++ b/db/migrate/20200408125046_create_ci_freeze_periods.rb
@@ -25,6 +25,8 @@ class CreateCiFreezePeriods < ActiveRecord::Migration[6.0]
end
def down
+ # rubocop:disable Migration/DropTable
drop_table :ci_freeze_periods
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20200416005331_create_status_page_published_incidents.rb b/db/migrate/20200416005331_create_status_page_published_incidents.rb
index 75889cd5bb6..ea2ddcde925 100644
--- a/db/migrate/20200416005331_create_status_page_published_incidents.rb
+++ b/db/migrate/20200416005331_create_status_page_published_incidents.rb
@@ -15,6 +15,8 @@ class CreateStatusPagePublishedIncidents < ActiveRecord::Migration[6.0]
end
def down
+ # rubocop:disable Migration/DropTable
drop_table :status_page_published_incidents
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20200417044453_create_alert_management_alerts.rb b/db/migrate/20200417044453_create_alert_management_alerts.rb
index 6221eeeb24b..3509f4946a7 100644
--- a/db/migrate/20200417044453_create_alert_management_alerts.rb
+++ b/db/migrate/20200417044453_create_alert_management_alerts.rb
@@ -39,6 +39,8 @@ class CreateAlertManagementAlerts < ActiveRecord::Migration[6.0]
end
def down
+ # rubocop:disable Migration/DropTable
drop_table :alert_management_alerts
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20200420104303_add_group_import_states_table.rb b/db/migrate/20200420104303_add_group_import_states_table.rb
index a44a2ea75f3..10b8cd4aa49 100644
--- a/db/migrate/20200420104303_add_group_import_states_table.rb
+++ b/db/migrate/20200420104303_add_group_import_states_table.rb
@@ -20,6 +20,8 @@ class AddGroupImportStatesTable < ActiveRecord::Migration[6.0]
# rubocop:enable Migration/AddLimitToTextColumns
def down
+ # rubocop:disable Migration/DropTable
drop_table :group_import_states
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20200420115948_create_metrics_users_starred_dashboard.rb b/db/migrate/20200420115948_create_metrics_users_starred_dashboard.rb
index 27130136e9d..8e9495f3a83 100644
--- a/db/migrate/20200420115948_create_metrics_users_starred_dashboard.rb
+++ b/db/migrate/20200420115948_create_metrics_users_starred_dashboard.rb
@@ -20,6 +20,8 @@ class CreateMetricsUsersStarredDashboard < ActiveRecord::Migration[6.0]
# rubocop: enable Migration/AddLimitToTextColumns
def down
+ # rubocop:disable Migration/DropTable
drop_table :metrics_users_starred_dashboards
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20200421054930_remove_index_on_pipeline_id_from_ci_pipeline_variables.rb b/db/migrate/20200421054930_remove_index_on_pipeline_id_from_ci_pipeline_variables.rb
new file mode 100644
index 00000000000..1a904188fc6
--- /dev/null
+++ b/db/migrate/20200421054930_remove_index_on_pipeline_id_from_ci_pipeline_variables.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveIndexOnPipelineIdFromCiPipelineVariables < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_ci_pipeline_variables_on_pipeline_id'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :ci_pipeline_variables, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :ci_pipeline_variables, :pipeline_id, name: INDEX_NAME, where: "key = 'AUTO_DEVOPS_MODSECURITY_SEC_RULE_ENGINE'"
+ end
+end
diff --git a/db/migrate/20200421054948_remove_index_on_pipeline_id_from_ci_variables.rb b/db/migrate/20200421054948_remove_index_on_pipeline_id_from_ci_variables.rb
new file mode 100644
index 00000000000..f7e6d10e8a3
--- /dev/null
+++ b/db/migrate/20200421054948_remove_index_on_pipeline_id_from_ci_variables.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveIndexOnPipelineIdFromCiVariables < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_ci_variables_on_project_id'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :ci_variables, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :ci_variables, :project_id, name: INDEX_NAME, where: "key = 'AUTO_DEVOPS_MODSECURITY_SEC_RULE_ENGINE'"
+ end
+end
diff --git a/db/migrate/20200422091541_create_ci_instance_variables.rb b/db/migrate/20200422091541_create_ci_instance_variables.rb
index ab2a4722f89..d1c954b4020 100644
--- a/db/migrate/20200422091541_create_ci_instance_variables.rb
+++ b/db/migrate/20200422091541_create_ci_instance_variables.rb
@@ -26,6 +26,8 @@ class CreateCiInstanceVariables < ActiveRecord::Migration[6.0]
end
def down
+ # rubocop:disable Migration/DropTable
drop_table :ci_instance_variables
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20200424135319_create_nuget_dependency_link_metadata.rb b/db/migrate/20200424135319_create_nuget_dependency_link_metadata.rb
index 8aa3d98aa80..79adf41f973 100644
--- a/db/migrate/20200424135319_create_nuget_dependency_link_metadata.rb
+++ b/db/migrate/20200424135319_create_nuget_dependency_link_metadata.rb
@@ -7,7 +7,7 @@ class CreateNugetDependencyLinkMetadata < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
- CONSTRAINT_NAME = 'packages_nuget_dependency_link_metadata_target_framework_constraint'
+ CONSTRAINT_NAME = 'packages_nuget_dependency_link_metadata_target_framework_constr'
def up
unless table_exists?(:packages_nuget_dependency_link_metadata)
@@ -21,6 +21,8 @@ class CreateNugetDependencyLinkMetadata < ActiveRecord::Migration[6.0]
end
def down
+ # rubocop:disable Migration/DropTable
drop_table :packages_nuget_dependency_link_metadata
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20200429023324_add_composer_metadata.rb b/db/migrate/20200429023324_add_composer_metadata.rb
new file mode 100644
index 00000000000..738b630bec1
--- /dev/null
+++ b/db/migrate/20200429023324_add_composer_metadata.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class AddComposerMetadata < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ create_table :packages_composer_metadata, id: false do |t|
+ t.references :package, primary_key: true, index: false, default: nil, foreign_key: { to_table: :packages_packages, on_delete: :cascade }, type: :bigint
+ t.binary :target_sha, null: false
+ end
+ end
+end
diff --git a/db/migrate/20200430123614_create_project_access_tokens.rb b/db/migrate/20200430123614_create_project_access_tokens.rb
new file mode 100644
index 00000000000..f07b1875ce0
--- /dev/null
+++ b/db/migrate/20200430123614_create_project_access_tokens.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class CreateProjectAccessTokens < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ create_table :project_access_tokens, primary_key: [:personal_access_token_id, :project_id] do |t|
+ t.column :personal_access_token_id, :bigint, null: false
+ t.column :project_id, :bigint, null: false
+ end
+
+ add_index :project_access_tokens, :project_id
+ end
+end
diff --git a/db/migrate/20200430130048_create_packages_nuget_metadata.rb b/db/migrate/20200430130048_create_packages_nuget_metadata.rb
index 0f0d490c93d..3c89a143932 100644
--- a/db/migrate/20200430130048_create_packages_nuget_metadata.rb
+++ b/db/migrate/20200430130048_create_packages_nuget_metadata.rb
@@ -29,6 +29,8 @@ class CreatePackagesNugetMetadata < ActiveRecord::Migration[6.0]
end
def down
+ # rubocop:disable Migration/DropTable
drop_table :packages_nuget_metadata
+ # rubocop:enable Migration/DropTable
end
end
diff --git a/db/migrate/20200430174637_create_group_deploy_keys.rb b/db/migrate/20200430174637_create_group_deploy_keys.rb
new file mode 100644
index 00000000000..283c8769a80
--- /dev/null
+++ b/db/migrate/20200430174637_create_group_deploy_keys.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+class CreateGroupDeployKeys < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:group_deploy_keys)
+ with_lock_retries do
+ create_table :group_deploy_keys do |t|
+ t.references :user, foreign_key: { on_delete: :restrict }, index: true
+ t.timestamps_with_timezone
+ t.datetime_with_timezone :last_used_at
+ t.datetime_with_timezone :expires_at
+ t.text :key, null: false, unique: true
+ t.text :title
+ t.text :fingerprint, null: false, unique: true
+ t.binary :fingerprint_sha256
+
+ t.index :fingerprint, unique: true
+ t.index :fingerprint_sha256
+ end
+ end
+ end
+
+ add_text_limit(:group_deploy_keys, :key, 4096)
+ add_text_limit(:group_deploy_keys, :title, 255)
+ add_text_limit(:group_deploy_keys, :fingerprint, 255)
+ end
+
+ def down
+ # rubocop:disable Migration/DropTable
+ drop_table :group_deploy_keys
+ # rubocop:enable Migration/DropTable
+ end
+end
diff --git a/db/migrate/20200507221434_add_container_registry_features_to_application_settings.rb b/db/migrate/20200507221434_add_container_registry_features_to_application_settings.rb
index b333db56eee..fbbf2306f81 100644
--- a/db/migrate/20200507221434_add_container_registry_features_to_application_settings.rb
+++ b/db/migrate/20200507221434_add_container_registry_features_to_application_settings.rb
@@ -4,7 +4,7 @@ class AddContainerRegistryFeaturesToApplicationSettings < ActiveRecord::Migratio
DOWNTIME = false
def up
- add_column :application_settings, :container_registry_features, :text, array: true, default: [], null: false # rubocop:disable Migration/AddLimitToTextColumns
+ add_column :application_settings, :container_registry_features, :text, array: true, default: [], null: false
end
def down
diff --git a/db/migrate/20200508021128_remove_ultraauth_provider_from_identities.rb b/db/migrate/20200508021128_remove_ultraauth_provider_from_identities.rb
new file mode 100644
index 00000000000..dd3f1dbcc0e
--- /dev/null
+++ b/db/migrate/20200508021128_remove_ultraauth_provider_from_identities.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveUltraauthProviderFromIdentities < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :identities, :provider
+ execute "DELETE FROM identities WHERE provider = 'ultraauth'"
+ remove_concurrent_index :identities, :provider
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20200508050301_add_spam_check_endpoint_to_application_settings.rb b/db/migrate/20200508050301_add_spam_check_endpoint_to_application_settings.rb
new file mode 100644
index 00000000000..d30b8abbbc3
--- /dev/null
+++ b/db/migrate/20200508050301_add_spam_check_endpoint_to_application_settings.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+class AddSpamCheckEndpointToApplicationSettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless column_exists?(:application_settings, :spam_check_endpoint_url)
+ add_column :application_settings, :spam_check_endpoint_url, :text
+ end
+
+ add_text_limit :application_settings, :spam_check_endpoint_url, 255
+
+ unless column_exists?(:application_settings, :spam_check_endpoint_enabled)
+ add_column :application_settings, :spam_check_endpoint_enabled, :boolean, null: false, default: false
+ end
+ end
+
+ def down
+ remove_column_if_exists :spam_check_endpoint_url
+ remove_column_if_exists :spam_check_endpoint_enabled
+ end
+
+ private
+
+ def remove_column_if_exists(column)
+ return unless column_exists?(:application_settings, column)
+
+ remove_column :application_settings, column
+ end
+end
diff --git a/db/migrate/20200508140959_add_elasticsearch_pause_indexing_to_application_settings.rb b/db/migrate/20200508140959_add_elasticsearch_pause_indexing_to_application_settings.rb
new file mode 100644
index 00000000000..5828db973ed
--- /dev/null
+++ b/db/migrate/20200508140959_add_elasticsearch_pause_indexing_to_application_settings.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddElasticsearchPauseIndexingToApplicationSettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ add_column :application_settings, :elasticsearch_pause_indexing, :boolean, default: false, null: false
+ end
+ end
+
+ def down
+ remove_column :application_settings, :elasticsearch_pause_indexing
+ end
+end
diff --git a/db/migrate/20200508203901_add_repository_storages_weighted_to_application_settings.rb b/db/migrate/20200508203901_add_repository_storages_weighted_to_application_settings.rb
new file mode 100644
index 00000000000..b9d4f65989a
--- /dev/null
+++ b/db/migrate/20200508203901_add_repository_storages_weighted_to_application_settings.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddRepositoryStoragesWeightedToApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ add_column :application_settings, :repository_storages_weighted, :jsonb, default: {}, null: false
+ end
+
+ def down
+ remove_column :application_settings, :repository_storages_weighted
+ end
+end
diff --git a/db/migrate/20200511181027_create_test_reports.rb b/db/migrate/20200511181027_create_test_reports.rb
new file mode 100644
index 00000000000..a08e208441d
--- /dev/null
+++ b/db/migrate/20200511181027_create_test_reports.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateTestReports < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ create_table :requirements_management_test_reports do |t|
+ t.datetime_with_timezone :created_at, null: false
+ t.references :requirement, null: false, foreign_key: { on_delete: :cascade }
+ t.bigint :pipeline_id
+ t.bigint :author_id
+ t.integer :state, null: false, limit: 2
+
+ t.index :pipeline_id
+ t.index :author_id
+ end
+ end
+end
diff --git a/db/migrate/20200511191027_add_author_foreign_key_to_test_reports.rb b/db/migrate/20200511191027_add_author_foreign_key_to_test_reports.rb
new file mode 100644
index 00000000000..a9fbee388c5
--- /dev/null
+++ b/db/migrate/20200511191027_add_author_foreign_key_to_test_reports.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddAuthorForeignKeyToTestReports < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :requirements_management_test_reports, :users, column: :author_id, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :requirements_management_test_reports, column: :author_id
+ end
+ end
+end
diff --git a/db/migrate/20200511208012_add_pipeline_foreign_key_to_test_reports.rb b/db/migrate/20200511208012_add_pipeline_foreign_key_to_test_reports.rb
new file mode 100644
index 00000000000..2b9b3464580
--- /dev/null
+++ b/db/migrate/20200511208012_add_pipeline_foreign_key_to_test_reports.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddPipelineForeignKeyToTestReports < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :requirements_management_test_reports, :ci_pipelines, column: :pipeline_id, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :requirements_management_test_reports, column: :pipeline_id
+ end
+ end
+end
diff --git a/db/migrate/20200512160004_add_index_to_ci_job_artifacts_for_terraform_reports.rb b/db/migrate/20200512160004_add_index_to_ci_job_artifacts_for_terraform_reports.rb
new file mode 100644
index 00000000000..20eaa549ee5
--- /dev/null
+++ b/db/migrate/20200512160004_add_index_to_ci_job_artifacts_for_terraform_reports.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexToCiJobArtifactsForTerraformReports < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_ci_job_artifacts_for_terraform_reports'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_job_artifacts, [:project_id, :id], where: 'file_type = 18', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20200512195442_update_index_on_name_type_eq_ci_build_to_ci_builds.rb b/db/migrate/20200512195442_update_index_on_name_type_eq_ci_build_to_ci_builds.rb
new file mode 100644
index 00000000000..f1334afb89d
--- /dev/null
+++ b/db/migrate/20200512195442_update_index_on_name_type_eq_ci_build_to_ci_builds.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+class UpdateIndexOnNameTypeEqCiBuildToCiBuilds < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ disable_ddl_transaction!
+
+ OLD_INDEX_NAME = 'index_ci_builds_on_name_and_security_type_eq_ci_build'
+ NEW_INDEX_NAME = 'index_security_ci_builds_on_name_and_id'
+
+ OLD_CLAUSE = "((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,
+ ('license_scanning'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text)"
+
+ NEW_CLAUSE = "((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,
+ ('secret_detection'::character varying)::text,
+ ('license_scanning'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text)"
+
+ def up
+ add_concurrent_index :ci_builds, [:name, :id], name: NEW_INDEX_NAME, where: NEW_CLAUSE
+ remove_concurrent_index_by_name :ci_builds, OLD_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :ci_builds, [:name, :id], name: OLD_INDEX_NAME, where: OLD_CLAUSE
+ remove_concurrent_index_by_name :ci_builds, NEW_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20200518091745_add_index_to_personal_access_token_impersonation.rb b/db/migrate/20200518091745_add_index_to_personal_access_token_impersonation.rb
new file mode 100644
index 00000000000..f9681f1a976
--- /dev/null
+++ b/db/migrate/20200518091745_add_index_to_personal_access_token_impersonation.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class AddIndexToPersonalAccessTokenImpersonation < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_expired_and_not_notified_personal_access_tokens'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(
+ :personal_access_tokens,
+ [:id, :expires_at],
+ where: "impersonation = FALSE AND revoked = FALSE AND expire_notification_delivered = FALSE",
+ name: INDEX_NAME
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name(
+ :personal_access_tokens,
+ name: INDEX_NAME
+ )
+ end
+end
diff --git a/db/migrate/20200519074709_update_resource_state_events_constraint_to_support_epic_id.rb b/db/migrate/20200519074709_update_resource_state_events_constraint_to_support_epic_id.rb
new file mode 100644
index 00000000000..ff60e3bdac1
--- /dev/null
+++ b/db/migrate/20200519074709_update_resource_state_events_constraint_to_support_epic_id.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class UpdateResourceStateEventsConstraintToSupportEpicId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ OLD_CONSTRAINT = 'resource_state_events_must_belong_to_issue_or_merge_request'
+ CONSTRAINT_NAME = 'resource_state_events_must_belong_to_issue_or_merge_request_or_'
+
+ def up
+ remove_check_constraint :resource_state_events, OLD_CONSTRAINT
+ add_check_constraint :resource_state_events, "(issue_id != NULL AND merge_request_id IS NULL AND epic_id IS NULL) OR " \
+ "(issue_id IS NULL AND merge_request_id != NULL AND epic_id IS NULL) OR" \
+ "(issue_id IS NULL AND merge_request_id IS NULL AND epic_id != NULL)", CONSTRAINT_NAME
+ end
+
+ def down
+ remove_check_constraint :resource_state_events, CONSTRAINT_NAME
+ add_check_constraint :resource_state_events, '(issue_id != NULL AND merge_request_id IS NULL) OR (merge_request_id != NULL AND issue_id IS NULL)', OLD_CONSTRAINT
+ end
+end
diff --git a/db/migrate/20200519101002_add_error_message_column_to_jira_imports.rb b/db/migrate/20200519101002_add_error_message_column_to_jira_imports.rb
new file mode 100644
index 00000000000..478b5358056
--- /dev/null
+++ b/db/migrate/20200519101002_add_error_message_column_to_jira_imports.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddErrorMessageColumnToJiraImports < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ disable_ddl_transaction!
+
+ def up
+ unless column_exists?(:jira_imports, :error_message)
+ add_column :jira_imports, :error_message, :text
+ end
+
+ add_text_limit :jira_imports, :error_message, 1000
+ end
+
+ def down
+ return unless column_exists?(:jira_imports, :error_message)
+
+ remove_column :jira_imports, :error_message
+ end
+end
diff --git a/db/migrate/20181005125926_add_index_to_uploads_store.rb b/db/migrate/20200519115908_add_epics_confidential_index.rb
index d9e31225b6f..68a1715acb4 100644
--- a/db/migrate/20181005125926_add_index_to_uploads_store.rb
+++ b/db/migrate/20200519115908_add_epics_confidential_index.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class AddIndexToUploadsStore < ActiveRecord::Migration[4.2]
+class AddEpicsConfidentialIndex < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
@@ -8,10 +8,10 @@ class AddIndexToUploadsStore < ActiveRecord::Migration[4.2]
disable_ddl_transaction!
def up
- add_concurrent_index :uploads, :store
+ add_concurrent_index :epics, :confidential
end
def down
- remove_concurrent_index :uploads, :store
+ remove_concurrent_index :epics, :confidential
end
end
diff --git a/db/migrate/20200519141534_add_instance_level_variables_column_to_plan_limits.rb b/db/migrate/20200519141534_add_instance_level_variables_column_to_plan_limits.rb
new file mode 100644
index 00000000000..bf36e74a746
--- /dev/null
+++ b/db/migrate/20200519141534_add_instance_level_variables_column_to_plan_limits.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddInstanceLevelVariablesColumnToPlanLimits < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :plan_limits, :ci_instance_level_variables, :integer, default: 25, null: false
+ end
+end
diff --git a/db/migrate/20200519194042_update_container_expiration_policies_defaults.rb b/db/migrate/20200519194042_update_container_expiration_policies_defaults.rb
new file mode 100644
index 00000000000..071f50d16a0
--- /dev/null
+++ b/db/migrate/20200519194042_update_container_expiration_policies_defaults.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class UpdateContainerExpirationPoliciesDefaults < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ change_column_default :container_expiration_policies, :cadence, '1d'
+ change_column_default :container_expiration_policies, :keep_n, 10
+ change_column_default :container_expiration_policies, :older_than, '90d'
+ end
+ end
+
+ def down
+ with_lock_retries do
+ change_column_default :container_expiration_policies, :cadence, '7d'
+ change_column_default :container_expiration_policies, :keep_n, nil
+ change_column_default :container_expiration_policies, :older_than, nil
+ end
+ end
+end
diff --git a/db/migrate/20200520103514_add_todo_resolved_by_action.rb b/db/migrate/20200520103514_add_todo_resolved_by_action.rb
new file mode 100644
index 00000000000..0aa91091451
--- /dev/null
+++ b/db/migrate/20200520103514_add_todo_resolved_by_action.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddTodoResolvedByAction < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :todos, :resolved_by_action, :integer, limit: 2
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :todos, :resolved_by_action
+ end
+ end
+end
diff --git a/db/migrate/20200521022725_add_experience_level_to_user_preferences.rb b/db/migrate/20200521022725_add_experience_level_to_user_preferences.rb
new file mode 100644
index 00000000000..e70a13599c3
--- /dev/null
+++ b/db/migrate/20200521022725_add_experience_level_to_user_preferences.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddExperienceLevelToUserPreferences < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :user_preferences, :experience_level, :integer, limit: 2
+ end
+end
diff --git a/db/migrate/20200521225327_create_alert_management_alert_assignees.rb b/db/migrate/20200521225327_create_alert_management_alert_assignees.rb
new file mode 100644
index 00000000000..095b2fdfeee
--- /dev/null
+++ b/db/migrate/20200521225327_create_alert_management_alert_assignees.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class CreateAlertManagementAlertAssignees < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ ALERT_INDEX_NAME = 'index_alert_assignees_on_alert_id'
+ UNIQUE_INDEX_NAME = 'index_alert_assignees_on_user_id_and_alert_id'
+
+ def up
+ create_table :alert_management_alert_assignees do |t|
+ t.bigint :user_id, null: false
+ t.bigint :alert_id, null: false
+
+ t.index :alert_id, name: ALERT_INDEX_NAME
+ t.index [:user_id, :alert_id], unique: true, name: UNIQUE_INDEX_NAME
+ end
+ end
+
+ def down
+ # rubocop:disable Migration/DropTable
+ drop_table :alert_management_alert_assignees
+ # rubocop:enable Migration/DropTable
+ end
+end
diff --git a/db/migrate/20200521225337_add_foreign_key_to_user_id_on_alert_management_alert_assignees.rb b/db/migrate/20200521225337_add_foreign_key_to_user_id_on_alert_management_alert_assignees.rb
new file mode 100644
index 00000000000..9d97c68f78f
--- /dev/null
+++ b/db/migrate/20200521225337_add_foreign_key_to_user_id_on_alert_management_alert_assignees.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToUserIdOnAlertManagementAlertAssignees < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :alert_management_alert_assignees, :users, column: :user_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :alert_management_alert_assignees, column: :user_id
+ end
+ end
+end
diff --git a/db/migrate/20200521225346_add_foreign_key_to_alert_id_on_alert_mangagement_alert_assignees.rb b/db/migrate/20200521225346_add_foreign_key_to_alert_id_on_alert_mangagement_alert_assignees.rb
new file mode 100644
index 00000000000..1d6197edef9
--- /dev/null
+++ b/db/migrate/20200521225346_add_foreign_key_to_alert_id_on_alert_mangagement_alert_assignees.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToAlertIdOnAlertMangagementAlertAssignees < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :alert_management_alert_assignees, :alert_management_alerts, column: :alert_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :alert_management_alert_assignees, column: :alert_id
+ end
+ end
+end
diff --git a/db/migrate/20200522235146_add_index_on_snippet_type_and_id.rb b/db/migrate/20200522235146_add_index_on_snippet_type_and_id.rb
new file mode 100644
index 00000000000..0949e8049d1
--- /dev/null
+++ b/db/migrate/20200522235146_add_index_on_snippet_type_and_id.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexOnSnippetTypeAndId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :snippets, [:id, :type]
+ end
+
+ def down
+ remove_concurrent_index :snippets, [:id, :type]
+ end
+end
diff --git a/db/migrate/20200525114553_rename_user_type_index.rb b/db/migrate/20200525114553_rename_user_type_index.rb
new file mode 100644
index 00000000000..44ce142ffcb
--- /dev/null
+++ b/db/migrate/20200525114553_rename_user_type_index.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class RenameUserTypeIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :users, [:state, :user_type], name: 'index_users_on_state_and_user_type'
+ remove_concurrent_index_by_name :users, 'index_users_on_state_and_user_type_internal'
+ end
+
+ def down
+ add_concurrent_index :users, [:state, :user_type], where: 'ghost IS NOT TRUE', name: 'index_users_on_state_and_user_type_internal'
+ remove_concurrent_index_by_name :users, 'index_users_on_state_and_user_type'
+ end
+end
diff --git a/db/migrate/20200526013844_add_alert_events_to_services.rb b/db/migrate/20200526013844_add_alert_events_to_services.rb
new file mode 100644
index 00000000000..1dba7fcaad4
--- /dev/null
+++ b/db/migrate/20200526013844_add_alert_events_to_services.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddAlertEventsToServices < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :services, :alert_events, :boolean
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :services, :alert_events
+ end
+ end
+end
diff --git a/db/migrate/20200526120714_change_partial_indexes_on_services.rb b/db/migrate/20200526120714_change_partial_indexes_on_services.rb
new file mode 100644
index 00000000000..a4d58cda105
--- /dev/null
+++ b/db/migrate/20200526120714_change_partial_indexes_on_services.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class ChangePartialIndexesOnServices < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :services, [:type, :instance], unique: true, where: 'instance = true', name: 'index_services_on_type_and_instance_partial'
+ remove_concurrent_index_by_name :services, 'index_services_on_type_and_instance'
+
+ add_concurrent_index :services, [:type, :template], unique: true, where: 'template = true', name: 'index_services_on_type_and_template_partial'
+ remove_concurrent_index_by_name :services, 'index_services_on_type_and_template'
+ end
+
+ def down
+ add_concurrent_index :services, [:type, :instance], unique: true, where: 'instance IS TRUE', name: 'index_services_on_type_and_instance'
+ remove_concurrent_index_by_name :services, 'index_services_on_type_and_instance_partial'
+
+ add_concurrent_index :services, [:type, :template], unique: true, where: 'template IS TRUE', name: 'index_services_on_type_and_template'
+ remove_concurrent_index_by_name :services, 'index_services_on_type_and_template_partial'
+ end
+end
diff --git a/db/migrate/20200526142550_drop_null_constraint_on_group_import_state_jid.rb b/db/migrate/20200526142550_drop_null_constraint_on_group_import_state_jid.rb
new file mode 100644
index 00000000000..d0dfa126455
--- /dev/null
+++ b/db/migrate/20200526142550_drop_null_constraint_on_group_import_state_jid.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class DropNullConstraintOnGroupImportStateJid < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ change_column_null :group_import_states, :jid, true
+ end
+
+ def down
+ # No-op -- null values could have been added after this this constraint was removed.
+ end
+end
diff --git a/db/migrate/20200526153844_add_issues_last_edited_by_id_index.rb b/db/migrate/20200526153844_add_issues_last_edited_by_id_index.rb
new file mode 100644
index 00000000000..85f121a4c02
--- /dev/null
+++ b/db/migrate/20200526153844_add_issues_last_edited_by_id_index.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIssuesLastEditedByIdIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :issues, :last_edited_by_id
+ add_concurrent_index :epics, :last_edited_by_id
+ end
+
+ def down
+ remove_concurrent_index :issues, :last_edited_by_id
+ remove_concurrent_index :epics, :last_edited_by_id
+ end
+end
diff --git a/db/migrate/20200526164946_create_operations_feature_flags_issues.rb b/db/migrate/20200526164946_create_operations_feature_flags_issues.rb
new file mode 100644
index 00000000000..24876997cfd
--- /dev/null
+++ b/db/migrate/20200526164946_create_operations_feature_flags_issues.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class CreateOperationsFeatureFlagsIssues < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ create_table :operations_feature_flags_issues do |t|
+ t.references :feature_flag, index: false, foreign_key: { on_delete: :cascade, to_table: :operations_feature_flags }, null: false
+ t.bigint :issue_id, null: false
+
+ t.index [:feature_flag_id, :issue_id], unique: true, name: :index_ops_feature_flags_issues_on_feature_flag_id_and_issue_id
+ t.index :issue_id
+ end
+ end
+end
diff --git a/db/migrate/20200526164947_add_foreign_key_to_ops_feature_flags_issues.rb b/db/migrate/20200526164947_add_foreign_key_to_ops_feature_flags_issues.rb
new file mode 100644
index 00000000000..1cad53cb371
--- /dev/null
+++ b/db/migrate/20200526164947_add_foreign_key_to_ops_feature_flags_issues.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToOpsFeatureFlagsIssues < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :operations_feature_flags_issues, :issues, column: :issue_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :operations_feature_flags_issues, column: :issue_id
+ end
+ end
+end
diff --git a/db/migrate/20200527092027_add_link_type_to_release_links.rb b/db/migrate/20200527092027_add_link_type_to_release_links.rb
new file mode 100644
index 00000000000..5088775f665
--- /dev/null
+++ b/db/migrate/20200527092027_add_link_type_to_release_links.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddLinkTypeToReleaseLinks < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :release_links, :link_type, :integer, limit: 2, default: 0
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :release_links, :link_type
+ end
+ end
+end
diff --git a/db/migrate/20200527135313_add_requirements_build_reference.rb b/db/migrate/20200527135313_add_requirements_build_reference.rb
new file mode 100644
index 00000000000..3385243fbdd
--- /dev/null
+++ b/db/migrate/20200527135313_add_requirements_build_reference.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class AddRequirementsBuildReference < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_requirements_management_test_reports_on_build_id'
+
+ def up
+ add_column :requirements_management_test_reports, :build_id, :bigint
+ add_index :requirements_management_test_reports, :build_id, name: INDEX_NAME # rubocop:disable Migration/AddIndex
+
+ with_lock_retries do
+ add_foreign_key :requirements_management_test_reports, :ci_builds, column: :build_id, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :requirements_management_test_reports, :build_id
+ end
+ end
+end
diff --git a/db/migrate/20200527151413_create_ci_build_report_results_table.rb b/db/migrate/20200527151413_create_ci_build_report_results_table.rb
new file mode 100644
index 00000000000..7f854dd4891
--- /dev/null
+++ b/db/migrate/20200527151413_create_ci_build_report_results_table.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class CreateCiBuildReportResultsTable < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ create_table :ci_build_report_results, id: false do |t|
+ t.bigint :build_id, null: false, index: false, primary_key: true
+ t.bigint :project_id, null: false, index: true
+ t.jsonb :data, null: false, default: {}
+ end
+ end
+end
diff --git a/db/migrate/20200527152116_add_foreign_key_to_build_id_on_build_report_results.rb b/db/migrate/20200527152116_add_foreign_key_to_build_id_on_build_report_results.rb
new file mode 100644
index 00000000000..1c41389b15b
--- /dev/null
+++ b/db/migrate/20200527152116_add_foreign_key_to_build_id_on_build_report_results.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToBuildIdOnBuildReportResults < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :ci_build_report_results, :ci_builds, column: :build_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :ci_build_report_results, column: :build_id
+ end
+ end
+end
diff --git a/db/migrate/20200527152657_add_foreign_key_to_project_id_on_build_report_results.rb b/db/migrate/20200527152657_add_foreign_key_to_project_id_on_build_report_results.rb
new file mode 100644
index 00000000000..da870722bc3
--- /dev/null
+++ b/db/migrate/20200527152657_add_foreign_key_to_project_id_on_build_report_results.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToProjectIdOnBuildReportResults < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :ci_build_report_results, :projects, column: :project_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :ci_build_report_results, column: :project_id
+ end
+ end
+end
diff --git a/db/migrate/20200527170649_create_alert_management_alert_user_mentions.rb b/db/migrate/20200527170649_create_alert_management_alert_user_mentions.rb
new file mode 100644
index 00000000000..15e4ab2a357
--- /dev/null
+++ b/db/migrate/20200527170649_create_alert_management_alert_user_mentions.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class CreateAlertManagementAlertUserMentions < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ create_table :alert_management_alert_user_mentions do |t|
+ t.references :alert_management_alert, type: :bigint, index: false, null: false, foreign_key: { on_delete: :cascade }
+ t.bigint :note_id, null: true
+
+ t.integer :mentioned_users_ids, array: true
+ t.integer :mentioned_projects_ids, array: true
+ t.integer :mentioned_groups_ids, array: true
+ end
+
+ add_index :alert_management_alert_user_mentions, [:note_id], where: 'note_id IS NOT NULL', unique: true, name: 'index_alert_user_mentions_on_note_id'
+ add_index :alert_management_alert_user_mentions, [:alert_management_alert_id], where: 'note_id IS NULL', unique: true, name: 'index_alert_user_mentions_on_alert_id'
+ add_index :alert_management_alert_user_mentions, [:alert_management_alert_id, :note_id], unique: true, name: 'index_alert_user_mentions_on_alert_id_and_note_id'
+ end
+end
diff --git a/db/migrate/20200527211000_add_max_import_size.rb b/db/migrate/20200527211000_add_max_import_size.rb
new file mode 100644
index 00000000000..2779997dbb2
--- /dev/null
+++ b/db/migrate/20200527211000_add_max_import_size.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddMaxImportSize < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ add_column(:application_settings, :max_import_size, :integer, default: 50, null: false)
+ end
+
+ def down
+ remove_column(:application_settings, :max_import_size)
+ end
+end
diff --git a/db/migrate/20200528054112_add_index_to_package_name.rb b/db/migrate/20200528054112_add_index_to_package_name.rb
new file mode 100644
index 00000000000..4629c32ab3d
--- /dev/null
+++ b/db/migrate/20200528054112_add_index_to_package_name.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexToPackageName < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'package_name_index'.freeze
+
+ def up
+ add_concurrent_index(:packages_packages, :name, name: INDEX_NAME)
+ end
+
+ def down
+ remove_concurrent_index(:packages_packages, :name, name: INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20200528125905_add_project_id_user_id_status_ref_index_to_ci_pipelines.rb b/db/migrate/20200528125905_add_project_id_user_id_status_ref_index_to_ci_pipelines.rb
new file mode 100644
index 00000000000..7211490e337
--- /dev/null
+++ b/db/migrate/20200528125905_add_project_id_user_id_status_ref_index_to_ci_pipelines.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class AddProjectIdUserIdStatusRefIndexToCiPipelines < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ SOURCE_PARENT_PIPELINE = 12
+
+ def up
+ add_concurrent_index(
+ :ci_pipelines,
+ [:project_id, :user_id, :status, :ref],
+ where: "source != #{SOURCE_PARENT_PIPELINE}"
+ )
+ end
+
+ def down
+ remove_concurrent_index(
+ :ci_pipelines,
+ [:project_id, :user_id, :status, :ref],
+ where: "source != #{SOURCE_PARENT_PIPELINE}"
+ )
+ end
+end
diff --git a/db/migrate/20200528171933_remove_not_null_from_external_dashboard_url.rb b/db/migrate/20200528171933_remove_not_null_from_external_dashboard_url.rb
new file mode 100644
index 00000000000..d146c8b487b
--- /dev/null
+++ b/db/migrate/20200528171933_remove_not_null_from_external_dashboard_url.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+# See https://docs.gitlab.com/ee/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class RemoveNotNullFromExternalDashboardUrl < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ change_column_null :project_metrics_settings, :external_dashboard_url, true
+ end
+end
diff --git a/db/migrate/20200601210148_add_dashboard_timezone_to_project_metrics_setting.rb b/db/migrate/20200601210148_add_dashboard_timezone_to_project_metrics_setting.rb
new file mode 100644
index 00000000000..3f74ef28621
--- /dev/null
+++ b/db/migrate/20200601210148_add_dashboard_timezone_to_project_metrics_setting.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+# See https://docs.gitlab.com/ee/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddDashboardTimezoneToProjectMetricsSetting < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :project_metrics_settings, :dashboard_timezone, :integer, limit: 2, null: false, default: 0
+ end
+end
diff --git a/db/migrate/20200603073101_change_constraint_name_on_resource_state_events.rb b/db/migrate/20200603073101_change_constraint_name_on_resource_state_events.rb
new file mode 100644
index 00000000000..d37027bf2fb
--- /dev/null
+++ b/db/migrate/20200603073101_change_constraint_name_on_resource_state_events.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class ChangeConstraintNameOnResourceStateEvents < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ NEW_CONSTRAINT_NAME = 'state_events_must_belong_to_issue_or_merge_request_or_epic'
+ OLD_CONSTRAINT_NAME = 'resource_state_events_must_belong_to_issue_or_merge_request_or_'
+
+ def up
+ execute "ALTER TABLE resource_state_events RENAME CONSTRAINT #{OLD_CONSTRAINT_NAME} TO #{NEW_CONSTRAINT_NAME};"
+ end
+
+ def down
+ execute "ALTER TABLE resource_state_events RENAME CONSTRAINT #{NEW_CONSTRAINT_NAME} TO #{OLD_CONSTRAINT_NAME};"
+ end
+end
diff --git a/db/migrate/20200603180338_add_enforce_pat_expiration_to_application_settings.rb b/db/migrate/20200603180338_add_enforce_pat_expiration_to_application_settings.rb
new file mode 100644
index 00000000000..ca0abc70b64
--- /dev/null
+++ b/db/migrate/20200603180338_add_enforce_pat_expiration_to_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddEnforcePatExpirationToApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :enforce_pat_expiration, :boolean, default: true, null: false
+ end
+end
diff --git a/db/migrate/20200604143628_create_project_security_settings.rb b/db/migrate/20200604143628_create_project_security_settings.rb
new file mode 100644
index 00000000000..b1a08cf8781
--- /dev/null
+++ b/db/migrate/20200604143628_create_project_security_settings.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class CreateProjectSecuritySettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ create_table :project_security_settings, id: false do |t|
+ t.references :project, primary_key: true, index: false, foreign_key: { on_delete: :cascade }
+ t.timestamps_with_timezone
+
+ t.boolean :auto_fix_container_scanning, default: true, null: false
+ t.boolean :auto_fix_dast, default: true, null: false
+ t.boolean :auto_fix_dependency_scanning, default: true, null: false
+ t.boolean :auto_fix_sast, default: true, null: false
+ end
+ end
+ end
+
+ def down
+ with_lock_retries do
+ # rubocop:disable Migration/DropTable
+ drop_table :project_security_settings
+ # rubocop:enable Migration/DropTable
+ end
+ end
+end
diff --git a/db/migrate/20200604145731_create_board_user_preferences.rb b/db/migrate/20200604145731_create_board_user_preferences.rb
new file mode 100644
index 00000000000..36e5014fdbe
--- /dev/null
+++ b/db/migrate/20200604145731_create_board_user_preferences.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class CreateBoardUserPreferences < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ create_table :board_user_preferences do |t|
+ t.bigint :user_id, null: false, index: true
+ t.bigint :board_id, null: false, index: true
+ t.boolean :hide_labels
+ t.timestamps_with_timezone null: false
+ end
+
+ add_index :board_user_preferences, [:user_id, :board_id], unique: true
+ end
+
+ def down
+ # rubocop:disable Migration/DropTable
+ drop_table :board_user_preferences
+ # rubocop:enable Migration/DropTable
+ end
+end
diff --git a/db/migrate/20200604174544_add_users_foreign_key_to_board_user_preferences.rb b/db/migrate/20200604174544_add_users_foreign_key_to_board_user_preferences.rb
new file mode 100644
index 00000000000..8f60c41a9c7
--- /dev/null
+++ b/db/migrate/20200604174544_add_users_foreign_key_to_board_user_preferences.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddUsersForeignKeyToBoardUserPreferences < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :board_user_preferences, :users, column: :user_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :board_user_preferences, column: :user_id
+ end
+ end
+end
diff --git a/db/migrate/20200604174558_add_boards_foreign_key_to_board_user_preferences.rb b/db/migrate/20200604174558_add_boards_foreign_key_to_board_user_preferences.rb
new file mode 100644
index 00000000000..a18f0eac505
--- /dev/null
+++ b/db/migrate/20200604174558_add_boards_foreign_key_to_board_user_preferences.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddBoardsForeignKeyToBoardUserPreferences < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :board_user_preferences, :boards, column: :board_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :board_user_preferences, column: :board_id
+ end
+ end
+end
diff --git a/db/migrate/20200605003204_add_foreign_key_to_alert_management_alert_user_mentions.rb b/db/migrate/20200605003204_add_foreign_key_to_alert_management_alert_user_mentions.rb
new file mode 100644
index 00000000000..35a250521a6
--- /dev/null
+++ b/db/migrate/20200605003204_add_foreign_key_to_alert_management_alert_user_mentions.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToAlertManagementAlertUserMentions < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :alert_management_alert_user_mentions, :notes, column: :note_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :alert_management_alert_user_mentions, column: :note_id
+ end
+ end
+end
diff --git a/db/migrate/20200605093113_add_ip_address_to_audit_events.rb b/db/migrate/20200605093113_add_ip_address_to_audit_events.rb
new file mode 100644
index 00000000000..9f5694ddce2
--- /dev/null
+++ b/db/migrate/20200605093113_add_ip_address_to_audit_events.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddIpAddressToAuditEvents < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :audit_events, :ip_address, :inet
+ end
+end
diff --git a/db/migrate/20200608214008_change_column_default_project_incident_management_settings.rb b/db/migrate/20200608214008_change_column_default_project_incident_management_settings.rb
new file mode 100644
index 00000000000..1bfafb410c0
--- /dev/null
+++ b/db/migrate/20200608214008_change_column_default_project_incident_management_settings.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class ChangeColumnDefaultProjectIncidentManagementSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ change_column_default(:project_incident_management_settings, :create_issue, from: true, to: false)
+ end
+
+ def down
+ change_column_default(:project_incident_management_settings, :create_issue, from: false, to: true)
+ end
+end
diff --git a/db/migrate/20200609142506_remove_not_null_constraint_from_weight_events_table.rb b/db/migrate/20200609142506_remove_not_null_constraint_from_weight_events_table.rb
new file mode 100644
index 00000000000..af4d4dbbf42
--- /dev/null
+++ b/db/migrate/20200609142506_remove_not_null_constraint_from_weight_events_table.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class RemoveNotNullConstraintFromWeightEventsTable < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ change_column_null :resource_weight_events, :user_id, true
+ end
+end
diff --git a/db/migrate/20200609142507_remove_not_null_constraint_from_milestone_events_table.rb b/db/migrate/20200609142507_remove_not_null_constraint_from_milestone_events_table.rb
new file mode 100644
index 00000000000..41204afb014
--- /dev/null
+++ b/db/migrate/20200609142507_remove_not_null_constraint_from_milestone_events_table.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class RemoveNotNullConstraintFromMilestoneEventsTable < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ change_column_null :resource_milestone_events, :user_id, true
+ end
+end
diff --git a/db/migrate/20200609142508_remove_not_null_constraint_from_state_events_table.rb b/db/migrate/20200609142508_remove_not_null_constraint_from_state_events_table.rb
new file mode 100644
index 00000000000..ffa047a78f9
--- /dev/null
+++ b/db/migrate/20200609142508_remove_not_null_constraint_from_state_events_table.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class RemoveNotNullConstraintFromStateEventsTable < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ change_column_null :resource_state_events, :user_id, true
+ end
+end
diff --git a/db/migrate/20200609212701_add_incident_settings_to_all_existing_projects.rb b/db/migrate/20200609212701_add_incident_settings_to_all_existing_projects.rb
new file mode 100644
index 00000000000..60286e0dca6
--- /dev/null
+++ b/db/migrate/20200609212701_add_incident_settings_to_all_existing_projects.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+class AddIncidentSettingsToAllExistingProjects < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ # Add records to projects project_incident_management_settings
+ # to preserve behavior for existing projects that
+ # are using the create issue functionality with the default setting of true
+ query = <<-SQL
+ WITH project_ids AS (
+ SELECT DISTINCT issues.project_id AS id
+ FROM issues
+ LEFT OUTER JOIN project_incident_management_settings
+ ON project_incident_management_settings.project_id = issues.project_id
+ INNER JOIN label_links
+ ON label_links.target_type = 'Issue'
+ AND label_links.target_id = issues.id
+ INNER JOIN labels
+ ON labels.id = label_links.label_id
+ WHERE ( project_incident_management_settings.project_id IS NULL )
+ -- Use incident labels even though they could be manually added by users who
+ -- are not using alert funtionality.
+ AND labels.title = 'incident'
+ AND labels.color = '#CC0033'
+ AND labels.description = 'Denotes a disruption to IT services and the associated issues require immediate attention'
+ )
+ INSERT INTO project_incident_management_settings (project_id, create_issue, send_email, issue_template_key)
+ SELECT project_ids.id, TRUE, FALSE, NULL
+ FROM project_ids
+ ON CONFLICT (project_id) DO NOTHING;
+ SQL
+
+ execute(query)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20200615083635_add_composer_json_to_metadata.rb b/db/migrate/20200615083635_add_composer_json_to_metadata.rb
new file mode 100644
index 00000000000..0240d298d34
--- /dev/null
+++ b/db/migrate/20200615083635_add_composer_json_to_metadata.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddComposerJsonToMetadata < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :packages_composer_metadata, :composer_json, :jsonb, default: {}, null: false
+ end
+end
diff --git a/db/migrate/20200615121217_add_projects_foreign_key_to_project_access_tokens.rb b/db/migrate/20200615121217_add_projects_foreign_key_to_project_access_tokens.rb
new file mode 100644
index 00000000000..bc8956ff6df
--- /dev/null
+++ b/db/migrate/20200615121217_add_projects_foreign_key_to_project_access_tokens.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddProjectsForeignKeyToProjectAccessTokens < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :project_access_tokens, :projects, column: :project_id
+ end
+
+ def down
+ remove_foreign_key_if_exists :project_access_tokens, column: :project_id
+ end
+end
diff --git a/db/migrate/20200615123055_add_personal_access_token_foreign_key_to_project_access_tokens.rb b/db/migrate/20200615123055_add_personal_access_token_foreign_key_to_project_access_tokens.rb
new file mode 100644
index 00000000000..efe3fe13bab
--- /dev/null
+++ b/db/migrate/20200615123055_add_personal_access_token_foreign_key_to_project_access_tokens.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddPersonalAccessTokenForeignKeyToProjectAccessTokens < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :project_access_tokens, :personal_access_tokens, column: :personal_access_token_id
+ end
+
+ def down
+ remove_foreign_key_if_exists :project_access_tokens, column: :personal_access_token_id
+ end
+end
diff --git a/db/migrate/20200615232735_add_index_to_composer_metadata.rb b/db/migrate/20200615232735_add_index_to_composer_metadata.rb
new file mode 100644
index 00000000000..72a490c55d8
--- /dev/null
+++ b/db/migrate/20200615232735_add_index_to_composer_metadata.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexToComposerMetadata < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:packages_composer_metadata, [:package_id, :target_sha], unique: true)
+ end
+
+ def down
+ remove_concurrent_index(:packages_composer_metadata, [:package_id, :target_sha])
+ end
+end
diff --git a/db/post_migrate/20180104131052_schedule_set_confidential_note_events_on_webhooks.rb b/db/post_migrate/20180104131052_schedule_set_confidential_note_events_on_webhooks.rb
deleted file mode 100644
index 0822aebc2c6..00000000000
--- a/db/post_migrate/20180104131052_schedule_set_confidential_note_events_on_webhooks.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-class ScheduleSetConfidentialNoteEventsOnWebhooks < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- BATCH_SIZE = 1_000
- INTERVAL = 5.minutes
-
- disable_ddl_transaction!
-
- def up
- migration = Gitlab::BackgroundMigration::SetConfidentialNoteEventsOnWebhooks
- migration_name = migration.to_s.demodulize
- relation = migration::WebHook.hooks_to_update
-
- queue_background_migration_jobs_by_range_at_intervals(relation,
- migration_name,
- INTERVAL,
- batch_size: BATCH_SIZE)
- end
-
- def down
- end
-end
diff --git a/db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb b/db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb
deleted file mode 100644
index 66ad0a89539..00000000000
--- a/db/post_migrate/20180119121225_remove_redundant_pipeline_stages.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-class RemoveRedundantPipelineStages < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up(attempts: 100)
- remove_redundant_pipeline_stages!
- remove_outdated_index!
- add_unique_index!
- rescue ActiveRecord::RecordNotUnique
- retry if (attempts -= 1) > 0
-
- raise StandardError, <<~EOS
- Failed to add an unique index to ci_stages, despite retrying the
- migration 100 times.
-
- See https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/16580.
- EOS
- end
-
- def down
- remove_concurrent_index :ci_stages, [:pipeline_id, :name], unique: true
- add_concurrent_index :ci_stages, [:pipeline_id, :name]
- end
-
- private
-
- def remove_outdated_index!
- return unless index_exists?(:ci_stages, [:pipeline_id, :name])
-
- remove_concurrent_index :ci_stages, [:pipeline_id, :name]
- end
-
- def add_unique_index!
- add_concurrent_index :ci_stages, [:pipeline_id, :name], unique: true
- end
-
- def remove_redundant_pipeline_stages!
- disable_statement_timeout do
- redundant_stages_ids = <<~SQL
- SELECT id FROM ci_stages WHERE (pipeline_id, name) IN (
- SELECT pipeline_id, name FROM ci_stages
- GROUP BY pipeline_id, name HAVING COUNT(*) > 1
- )
- SQL
-
- execute <<~SQL
- UPDATE ci_builds SET stage_id = NULL WHERE stage_id IN (#{redundant_stages_ids})
- SQL
-
- execute <<~SQL
- DELETE FROM ci_stages WHERE id IN (#{redundant_stages_ids})
- SQL
- end
- end
-end
diff --git a/db/post_migrate/20180122154930_schedule_set_confidential_note_events_on_services.rb b/db/post_migrate/20180122154930_schedule_set_confidential_note_events_on_services.rb
deleted file mode 100644
index 98bbb34dda1..00000000000
--- a/db/post_migrate/20180122154930_schedule_set_confidential_note_events_on_services.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-class ScheduleSetConfidentialNoteEventsOnServices < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- BATCH_SIZE = 1_000
- INTERVAL = 20.minutes
-
- disable_ddl_transaction!
-
- def up
- migration = Gitlab::BackgroundMigration::SetConfidentialNoteEventsOnServices
- migration_name = migration.to_s.demodulize
- relation = migration::Service.services_to_update
-
- queue_background_migration_jobs_by_range_at_intervals(relation,
- migration_name,
- INTERVAL,
- batch_size: BATCH_SIZE)
- end
-
- def down
- end
-end
diff --git a/db/post_migrate/20180204200836_change_author_id_to_not_null_in_todos.rb b/db/post_migrate/20180204200836_change_author_id_to_not_null_in_todos.rb
deleted file mode 100644
index 54b8a91fa47..00000000000
--- a/db/post_migrate/20180204200836_change_author_id_to_not_null_in_todos.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-class ChangeAuthorIdToNotNullInTodos < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- class Todo < ActiveRecord::Base
- self.table_name = 'todos'
- include EachBatch
- end
-
- BATCH_SIZE = 1000
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- Todo.where(author_id: nil).each_batch(of: BATCH_SIZE) do |batch|
- batch.delete_all
- end
-
- change_column_null :todos, :author_id, false
- end
-
- def down
- change_column_null :todos, :author_id, true
- end
-end
diff --git a/db/post_migrate/20180212101828_add_tmp_partial_null_index_to_builds.rb b/db/post_migrate/20180212101828_add_tmp_partial_null_index_to_builds.rb
deleted file mode 100644
index f8badcac990..00000000000
--- a/db/post_migrate/20180212101828_add_tmp_partial_null_index_to_builds.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class AddTmpPartialNullIndexToBuilds < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:ci_builds, :id, where: 'stage_id IS NULL',
- name: 'tmp_id_partial_null_index')
- end
-
- def down
- remove_concurrent_index_by_name(:ci_builds, 'tmp_id_partial_null_index')
- end
-end
diff --git a/db/post_migrate/20180212101928_schedule_build_stage_migration.rb b/db/post_migrate/20180212101928_schedule_build_stage_migration.rb
deleted file mode 100644
index 2445ab1a130..00000000000
--- a/db/post_migrate/20180212101928_schedule_build_stage_migration.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class ScheduleBuildStageMigration < ActiveRecord::Migration[4.2]
- ##
- # This migration has been rescheduled to run again, see
- # `20180405101928_reschedule_builds_stages_migration.rb`
- #
-
- def up
- # noop
- end
-
- def down
- # noop
- end
-end
diff --git a/db/post_migrate/20180212102028_remove_tmp_partial_null_index_from_builds.rb b/db/post_migrate/20180212102028_remove_tmp_partial_null_index_from_builds.rb
deleted file mode 100644
index 2444df881b8..00000000000
--- a/db/post_migrate/20180212102028_remove_tmp_partial_null_index_from_builds.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class RemoveTmpPartialNullIndexFromBuilds < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- remove_concurrent_index_by_name(:ci_builds, 'tmp_id_partial_null_index')
- end
-
- def down
- add_concurrent_index(:ci_builds, :id, where: 'stage_id IS NULL',
- name: 'tmp_id_partial_null_index')
- end
-end
diff --git a/db/post_migrate/20180216121020_fill_pages_domain_verification_code.rb b/db/post_migrate/20180216121020_fill_pages_domain_verification_code.rb
deleted file mode 100644
index dae43ee14df..00000000000
--- a/db/post_migrate/20180216121020_fill_pages_domain_verification_code.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-class FillPagesDomainVerificationCode < ActiveRecord::Migration[4.2]
- DOWNTIME = false
-
- class PagesDomain < ActiveRecord::Base
- include EachBatch
- end
-
- # Allow this migration to resume if it fails partway through
- disable_ddl_transaction!
-
- def up
- PagesDomain.where(verification_code: [nil, '']).each_batch do |relation|
- connection.execute(set_codes_sql(relation))
-
- # Sleep 2 minutes between batches to not overload the DB with dead tuples
- sleep(2.minutes) unless relation.reorder(:id).last == PagesDomain.reorder(:id).last
- end
-
- change_column_null(:pages_domains, :verification_code, false)
- end
-
- def down
- change_column_null(:pages_domains, :verification_code, true)
- end
-
- private
-
- def set_codes_sql(relation)
- ids = relation.pluck(:id)
- whens = ids.map { |id| "WHEN #{id} THEN '#{SecureRandom.hex(16)}'" }
-
- <<~SQL
- UPDATE pages_domains
- SET verification_code =
- CASE id
- #{whens.join("\n")}
- END
- WHERE id IN(#{ids.join(',')})
- SQL
- end
-end
diff --git a/db/post_migrate/20180216121030_enqueue_verify_pages_domain_workers.rb b/db/post_migrate/20180216121030_enqueue_verify_pages_domain_workers.rb
deleted file mode 100644
index d776fb85f00..00000000000
--- a/db/post_migrate/20180216121030_enqueue_verify_pages_domain_workers.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class EnqueueVerifyPagesDomainWorkers < ActiveRecord::Migration[4.2]
- class PagesDomain < ActiveRecord::Base
- include EachBatch
- end
-
- def up
- PagesDomain.each_batch do |relation|
- ids = relation.pluck(:id).map { |id| [id] }
- PagesDomainVerificationWorker.bulk_perform_async(ids)
- end
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20180220150310_remove_empty_extern_uid_auth0_identities.rb b/db/post_migrate/20180220150310_remove_empty_extern_uid_auth0_identities.rb
deleted file mode 100644
index 86ef333685e..00000000000
--- a/db/post_migrate/20180220150310_remove_empty_extern_uid_auth0_identities.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-class RemoveEmptyExternUidAuth0Identities < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- class Identity < ActiveRecord::Base
- self.table_name = 'identities'
- include EachBatch
- end
-
- def up
- broken_auth0_identities.each_batch do |identity|
- identity.delete_all
- end
- end
-
- def broken_auth0_identities
- Identity.where(provider: 'auth0', extern_uid: [nil, ''])
- end
-
- def down
- end
-end
diff --git a/db/post_migrate/20180223124427_build_user_interacted_projects_table.rb b/db/post_migrate/20180223124427_build_user_interacted_projects_table.rb
deleted file mode 100644
index 1eb49d60da5..00000000000
--- a/db/post_migrate/20180223124427_build_user_interacted_projects_table.rb
+++ /dev/null
@@ -1,139 +0,0 @@
-require_relative '../migrate/20180223120443_create_user_interacted_projects_table.rb'
-# rubocop:disable AddIndex
-# rubocop:disable AddConcurrentForeignKey
-class BuildUserInteractedProjectsTable < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- UNIQUE_INDEX_NAME = 'index_user_interacted_projects_on_project_id_and_user_id'
-
- disable_ddl_transaction!
-
- def up
- PostgresStrategy.new.up
-
- if index_exists_by_name?(:user_interacted_projects, CreateUserInteractedProjectsTable::INDEX_NAME)
- remove_concurrent_index_by_name :user_interacted_projects, CreateUserInteractedProjectsTable::INDEX_NAME
- end
- end
-
- def down
- execute "TRUNCATE user_interacted_projects"
-
- if foreign_key_exists?(:user_interacted_projects, :users)
- remove_foreign_key :user_interacted_projects, :users
- end
-
- if foreign_key_exists?(:user_interacted_projects, :projects)
- remove_foreign_key :user_interacted_projects, :projects
- end
-
- if index_exists_by_name?(:user_interacted_projects, UNIQUE_INDEX_NAME)
- remove_concurrent_index_by_name :user_interacted_projects, UNIQUE_INDEX_NAME
- end
-
- unless index_exists_by_name?(:user_interacted_projects, CreateUserInteractedProjectsTable::INDEX_NAME)
- add_concurrent_index :user_interacted_projects, [:project_id, :user_id], name: CreateUserInteractedProjectsTable::INDEX_NAME
- end
- end
-
- class PostgresStrategy < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- BATCH_SIZE = 100_000
- SLEEP_TIME = 5
-
- def up
- with_index(:events, [:author_id, :project_id], name: 'events_user_interactions_temp', where: 'project_id IS NOT NULL') do
- insert_missing_records
-
- # Do this once without lock to speed up the second invocation
- remove_duplicates
- with_table_lock(:user_interacted_projects) do
- remove_duplicates
- create_unique_index
- end
-
- remove_without_project
- with_table_lock(:user_interacted_projects, :projects) do
- remove_without_project
- create_fk :user_interacted_projects, :projects, :project_id
- end
-
- remove_without_user
- with_table_lock(:user_interacted_projects, :users) do
- remove_without_user
- create_fk :user_interacted_projects, :users, :user_id
- end
- end
-
- execute "ANALYZE user_interacted_projects"
- end
-
- private
-
- def insert_missing_records
- iteration = 0
- records = 0
- begin
- Rails.logger.info "Building user_interacted_projects table, batch ##{iteration}" # rubocop:disable Gitlab/RailsLogger
- result = execute <<~SQL
- INSERT INTO user_interacted_projects (user_id, project_id)
- SELECT e.user_id, e.project_id
- FROM (SELECT DISTINCT author_id AS user_id, project_id FROM events WHERE project_id IS NOT NULL) AS e
- LEFT JOIN user_interacted_projects ucp USING (user_id, project_id)
- WHERE ucp.user_id IS NULL
- LIMIT #{BATCH_SIZE}
- SQL
- iteration += 1
- records += result.cmd_tuples
- Rails.logger.info "Building user_interacted_projects table, batch ##{iteration} complete, created #{records} overall" # rubocop:disable Gitlab/RailsLogger
- Kernel.sleep(SLEEP_TIME) if result.cmd_tuples > 0
- end while result.cmd_tuples > 0
- end
-
- def remove_duplicates
- execute <<~SQL
- WITH numbered AS (select ctid, ROW_NUMBER() OVER (PARTITION BY (user_id, project_id)) as row_number, user_id, project_id from user_interacted_projects)
- DELETE FROM user_interacted_projects WHERE ctid IN (SELECT ctid FROM numbered WHERE row_number > 1);
- SQL
- end
-
- def remove_without_project
- execute "DELETE FROM user_interacted_projects WHERE NOT EXISTS (SELECT 1 FROM projects WHERE id = user_interacted_projects.project_id)"
- end
-
- def remove_without_user
- execute "DELETE FROM user_interacted_projects WHERE NOT EXISTS (SELECT 1 FROM users WHERE id = user_interacted_projects.user_id)"
- end
-
- def create_fk(table, target, column)
- return if foreign_key_exists?(table, target, column: column)
-
- add_foreign_key table, target, column: column, on_delete: :cascade
- end
-
- def create_unique_index
- return if index_exists_by_name?(:user_interacted_projects, UNIQUE_INDEX_NAME)
-
- add_index :user_interacted_projects, [:project_id, :user_id], unique: true, name: UNIQUE_INDEX_NAME
- end
-
- # Protect table against concurrent data changes while still allowing reads
- def with_table_lock(*tables)
- ActiveRecord::Base.connection.transaction do
- execute "LOCK TABLE #{tables.join(", ")} IN SHARE MODE"
- yield
- end
- end
-
- def with_index(*args)
- add_concurrent_index(*args) unless index_exists?(*args)
- yield
- ensure
- remove_concurrent_index(*args) if index_exists?(*args)
- end
- end
-end
diff --git a/db/post_migrate/20180301084653_change_project_namespace_id_not_null.rb b/db/post_migrate/20180301084653_change_project_namespace_id_not_null.rb
deleted file mode 100644
index 62a239b0e7c..00000000000
--- a/db/post_migrate/20180301084653_change_project_namespace_id_not_null.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class ChangeProjectNamespaceIdNotNull < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- class Project < ActiveRecord::Base
- self.table_name = 'projects'
- include EachBatch
- end
-
- BATCH_SIZE = 1000
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- Project.where(namespace_id: nil).each_batch(of: BATCH_SIZE) do |batch|
- batch.delete_all
- end
-
- change_column_null :projects, :namespace_id, false
- end
-
- def down
- change_column_null :projects, :namespace_id, true
- end
-end
diff --git a/db/post_migrate/20180305100050_remove_permanent_from_redirect_routes.rb b/db/post_migrate/20180305100050_remove_permanent_from_redirect_routes.rb
deleted file mode 100644
index e363642b2ac..00000000000
--- a/db/post_migrate/20180305100050_remove_permanent_from_redirect_routes.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class RemovePermanentFromRedirectRoutes < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- disable_ddl_transaction!
-
- INDEX_NAME_PERM = "index_redirect_routes_on_path_text_pattern_ops_where_permanent"
- INDEX_NAME_TEMP = "index_redirect_routes_on_path_text_pattern_ops_where_temporary"
-
- def up
- # These indexes were created on Postgres only in:
- # ReworkRedirectRoutesIndexes:
- # https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/16211
- disable_statement_timeout do
- execute "DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME_PERM};"
- execute "DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME_TEMP};"
- end
-
- remove_column(:redirect_routes, :permanent)
- end
-
- def down
- add_column(:redirect_routes, :permanent, :boolean)
-
- disable_statement_timeout do
- execute("CREATE INDEX CONCURRENTLY #{INDEX_NAME_PERM} ON redirect_routes (lower(path) varchar_pattern_ops) where (permanent);")
- execute("CREATE INDEX CONCURRENTLY #{INDEX_NAME_TEMP} ON redirect_routes (lower(path) varchar_pattern_ops) where (not permanent or permanent is null) ;")
- end
- end
-end
diff --git a/db/post_migrate/20180306074045_migrate_create_trace_artifact_sidekiq_queue.rb b/db/post_migrate/20180306074045_migrate_create_trace_artifact_sidekiq_queue.rb
deleted file mode 100644
index fc74f6f1712..00000000000
--- a/db/post_migrate/20180306074045_migrate_create_trace_artifact_sidekiq_queue.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class MigrateCreateTraceArtifactSidekiqQueue < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- sidekiq_queue_migrate 'pipeline_default:create_trace_artifact', to: 'pipeline_background:archive_trace'
- end
-
- def down
- sidekiq_queue_migrate 'pipeline_background:archive_trace', to: 'pipeline_default:create_trace_artifact'
- end
-end
diff --git a/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb b/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb
deleted file mode 100644
index f0257e303f7..00000000000
--- a/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddPathIndexToRedirectRoutes < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
- disable_ddl_transaction!
-
- INDEX_NAME = 'index_redirect_routes_on_path_unique_text_pattern_ops'
-
- # Indexing on LOWER(path) varchar_pattern_ops speeds up the LIKE query in
- # RedirectRoute.matching_path_and_descendants
- #
- # This same index is also added in the `ReworkRedirectRoutesIndexes` so this
- # is a no-op in most cases.
- def up
- disable_statement_timeout do
- unless index_exists_by_name?(:redirect_routes, INDEX_NAME)
- execute("CREATE UNIQUE INDEX CONCURRENTLY #{INDEX_NAME} ON redirect_routes (lower(path) varchar_pattern_ops);")
- end
- end
- end
-
- def down
- # Do nothing in the DOWN. Since the index above is originally created in the
- # `ReworkRedirectRoutesIndexes`. This migration wouldn't have actually
- # created any new index.
- end
-end
diff --git a/db/post_migrate/20180307012445_migrate_update_head_pipeline_for_merge_request_sidekiq_queue.rb b/db/post_migrate/20180307012445_migrate_update_head_pipeline_for_merge_request_sidekiq_queue.rb
deleted file mode 100644
index 372c04429c7..00000000000
--- a/db/post_migrate/20180307012445_migrate_update_head_pipeline_for_merge_request_sidekiq_queue.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class MigrateUpdateHeadPipelineForMergeRequestSidekiqQueue < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- sidekiq_queue_migrate 'pipeline_default:update_head_pipeline_for_merge_request',
- to: 'pipeline_processing:update_head_pipeline_for_merge_request'
- end
-
- def down
- sidekiq_queue_migrate 'pipeline_processing:update_head_pipeline_for_merge_request',
- to: 'pipeline_default:update_head_pipeline_for_merge_request'
- end
-end
diff --git a/db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb b/db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb
deleted file mode 100644
index 213d97b71f7..00000000000
--- a/db/post_migrate/20180405101928_reschedule_builds_stages_migration.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-class RescheduleBuildsStagesMigration < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- ##
- # Rescheduled `20180212101928_schedule_build_stage_migration.rb`
- #
-
- DOWNTIME = false
- MIGRATION = 'MigrateBuildStage'.freeze
- BATCH_SIZE = 500
-
- disable_ddl_transaction!
-
- class Build < ActiveRecord::Base
- include EachBatch
- self.table_name = 'ci_builds'
- end
-
- def up
- disable_statement_timeout do
- Build.where('stage_id IS NULL').tap do |relation|
- queue_background_migration_jobs_by_range_at_intervals(relation,
- MIGRATION,
- 5.minutes,
- batch_size: BATCH_SIZE)
- end
- end
- end
-
- def down
- # noop
- end
-end
diff --git a/db/post_migrate/20180408143355_cleanup_users_rss_token_rename.rb b/db/post_migrate/20180408143355_cleanup_users_rss_token_rename.rb
deleted file mode 100644
index 813603cb3ad..00000000000
--- a/db/post_migrate/20180408143355_cleanup_users_rss_token_rename.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class CleanupUsersRssTokenRename < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- disable_ddl_transaction!
-
- def up
- cleanup_concurrent_column_rename :users, :rss_token, :feed_token
- end
-
- def down
- # rubocop:disable Migration/UpdateLargeTable
- rename_column_concurrently :users, :feed_token, :rss_token
- end
-end
diff --git a/db/post_migrate/20180409170809_populate_missing_project_ci_cd_settings.rb b/db/post_migrate/20180409170809_populate_missing_project_ci_cd_settings.rb
deleted file mode 100644
index a400a071e07..00000000000
--- a/db/post_migrate/20180409170809_populate_missing_project_ci_cd_settings.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class PopulateMissingProjectCiCdSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- # Projects created after the initial migration but before the code started
- # using ProjectCiCdSetting won't have a corresponding row in
- # project_ci_cd_settings, so let's fix that.
- execute <<~SQL
- INSERT INTO project_ci_cd_settings (project_id)
- SELECT id
- FROM projects
- WHERE NOT EXISTS (
- SELECT 1
- FROM project_ci_cd_settings
- WHERE project_ci_cd_settings.project_id = projects.id
- )
- SQL
- end
-
- def down
- # There's nothing to revert for this migration.
- end
-end
diff --git a/db/post_migrate/20180420080616_schedule_stages_index_migration.rb b/db/post_migrate/20180420080616_schedule_stages_index_migration.rb
deleted file mode 100644
index 2d72e75393f..00000000000
--- a/db/post_migrate/20180420080616_schedule_stages_index_migration.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-class ScheduleStagesIndexMigration < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- MIGRATION = 'MigrateStageIndex'.freeze
- BATCH_SIZE = 10000
-
- disable_ddl_transaction!
-
- class Stage < ActiveRecord::Base
- include EachBatch
- self.table_name = 'ci_stages'
- end
-
- def up
- disable_statement_timeout do
- Stage.all.tap do |relation|
- queue_background_migration_jobs_by_range_at_intervals(relation,
- MIGRATION,
- 5.minutes,
- batch_size: BATCH_SIZE)
- end
- end
- end
-
- def down
- # noop
- end
-end
diff --git a/db/post_migrate/20180424151928_fill_file_store.rb b/db/post_migrate/20180424151928_fill_file_store.rb
deleted file mode 100644
index 45fa10c9550..00000000000
--- a/db/post_migrate/20180424151928_fill_file_store.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-class FillFileStore < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- class JobArtifact < ActiveRecord::Base
- include EachBatch
- self.table_name = 'ci_job_artifacts'
- BATCH_SIZE = 10_000
-
- def self.params_for_background_migration
- yield self.where(file_store: nil), 'FillFileStoreJobArtifact', 5.minutes, BATCH_SIZE
- end
- end
-
- class LfsObject < ActiveRecord::Base
- include EachBatch
- self.table_name = 'lfs_objects'
- BATCH_SIZE = 10_000
-
- def self.params_for_background_migration
- yield self.where(file_store: nil), 'FillFileStoreLfsObject', 5.minutes, BATCH_SIZE
- end
- end
-
- class Upload < ActiveRecord::Base
- include EachBatch
- self.table_name = 'uploads'
- self.inheritance_column = :_type_disabled # Disable STI
- BATCH_SIZE = 10_000
-
- def self.params_for_background_migration
- yield self.where(store: nil), 'FillStoreUpload', 5.minutes, BATCH_SIZE
- end
- end
-
- def up
- # NOTE: Schedule background migrations that fill 'NULL' value by '1'(ObjectStorage::Store::LOCAL) on `file_store`, `store` columns
- #
- # Here are the target columns
- # - ci_job_artifacts.file_store
- # - lfs_objects.file_store
- # - uploads.store
-
- FillFileStore::JobArtifact.params_for_background_migration do |relation, class_name, delay_interval, batch_size|
- queue_background_migration_jobs_by_range_at_intervals(relation,
- class_name,
- delay_interval,
- batch_size: batch_size)
- end
-
- FillFileStore::LfsObject.params_for_background_migration do |relation, class_name, delay_interval, batch_size|
- queue_background_migration_jobs_by_range_at_intervals(relation,
- class_name,
- delay_interval,
- batch_size: batch_size)
- end
-
- FillFileStore::Upload.params_for_background_migration do |relation, class_name, delay_interval, batch_size|
- queue_background_migration_jobs_by_range_at_intervals(relation,
- class_name,
- delay_interval,
- batch_size: batch_size)
- end
- end
-
- def down
- # noop
- end
-end
diff --git a/db/post_migrate/20180430143705_backfill_runner_type_for_ci_runners_post_migrate.rb b/db/post_migrate/20180430143705_backfill_runner_type_for_ci_runners_post_migrate.rb
deleted file mode 100644
index ba1023866c5..00000000000
--- a/db/post_migrate/20180430143705_backfill_runner_type_for_ci_runners_post_migrate.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-class BackfillRunnerTypeForCiRunnersPostMigrate < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- INSTANCE_RUNNER_TYPE = 1
- PROJECT_RUNNER_TYPE = 3
-
- disable_ddl_transaction!
-
- def up
- # rubocop:disable Migration/UpdateColumnInBatches
- update_column_in_batches(:ci_runners, :runner_type, INSTANCE_RUNNER_TYPE) do |table, query|
- query.where(table[:is_shared].eq(true)).where(table[:runner_type].eq(nil))
- end
-
- update_column_in_batches(:ci_runners, :runner_type, PROJECT_RUNNER_TYPE) do |table, query|
- query.where(table[:is_shared].eq(false)).where(table[:runner_type].eq(nil))
- end
- end
-
- def down
- end
-end
diff --git a/db/post_migrate/20180507083701_set_minimal_project_build_timeout.rb b/db/post_migrate/20180507083701_set_minimal_project_build_timeout.rb
deleted file mode 100644
index 34edbb08bcf..00000000000
--- a/db/post_migrate/20180507083701_set_minimal_project_build_timeout.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class SetMinimalProjectBuildTimeout < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- MINIMUM_TIMEOUT = 600
-
- # Allow this migration to resume if it fails partway through
- disable_ddl_transaction!
-
- def up
- # rubocop:disable Migration/UpdateLargeTable
- # rubocop:disable Migration/UpdateColumnInBatches
- update_column_in_batches(:projects, :build_timeout, MINIMUM_TIMEOUT) do |table, query|
- query.where(table[:build_timeout].lt(MINIMUM_TIMEOUT))
- end
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20180511174224_add_unique_constraint_to_project_features_project_id.rb b/db/post_migrate/20180511174224_add_unique_constraint_to_project_features_project_id.rb
deleted file mode 100644
index a526001a91e..00000000000
--- a/db/post_migrate/20180511174224_add_unique_constraint_to_project_features_project_id.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-class AddUniqueConstraintToProjectFeaturesProjectId < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- class ProjectFeature < ActiveRecord::Base
- self.table_name = 'project_features'
-
- include EachBatch
- end
-
- def up
- remove_duplicates
-
- add_concurrent_index :project_features, :project_id, unique: true, name: 'index_project_features_on_project_id_unique'
- remove_concurrent_index_by_name :project_features, 'index_project_features_on_project_id'
- rename_index :project_features, 'index_project_features_on_project_id_unique', 'index_project_features_on_project_id'
- end
-
- def down
- rename_index :project_features, 'index_project_features_on_project_id', 'index_project_features_on_project_id_old'
- add_concurrent_index :project_features, :project_id
- remove_concurrent_index_by_name :project_features, 'index_project_features_on_project_id_old'
- end
-
- private
-
- def remove_duplicates
- features = ProjectFeature
- .select('MAX(id) AS max, COUNT(id), project_id')
- .group(:project_id)
- .having('COUNT(id) > 1')
-
- features.each do |feature|
- ProjectFeature
- .where(project_id: feature['project_id'])
- .where('id <> ?', feature['max'])
- .each_batch { |batch| batch.delete_all }
- end
- end
-end
diff --git a/db/post_migrate/20180512061621_add_not_null_constraint_to_project_features_project_id.rb b/db/post_migrate/20180512061621_add_not_null_constraint_to_project_features_project_id.rb
deleted file mode 100644
index e3abbc039e8..00000000000
--- a/db/post_migrate/20180512061621_add_not_null_constraint_to_project_features_project_id.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class AddNotNullConstraintToProjectFeaturesProjectId < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- class ProjectFeature < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'project_features'
- end
-
- def up
- ProjectFeature.where(project_id: nil).delete_all
-
- change_column_null :project_features, :project_id, false
- end
-
- def down
- change_column_null :project_features, :project_id, true
- end
-end
diff --git a/db/post_migrate/20180514161336_remove_gemnasium_service.rb b/db/post_migrate/20180514161336_remove_gemnasium_service.rb
deleted file mode 100644
index 5842bde474c..00000000000
--- a/db/post_migrate/20180514161336_remove_gemnasium_service.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class RemoveGemnasiumService < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- disable_statement_timeout
-
- execute("DELETE FROM services WHERE type='GemnasiumService';")
- end
-
- def down
- # noop
- end
-end
diff --git a/db/post_migrate/20180523125103_cleanup_merge_requests_allow_maintainer_to_push_rename.rb b/db/post_migrate/20180523125103_cleanup_merge_requests_allow_maintainer_to_push_rename.rb
deleted file mode 100644
index b3b539fd156..00000000000
--- a/db/post_migrate/20180523125103_cleanup_merge_requests_allow_maintainer_to_push_rename.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class CleanupMergeRequestsAllowMaintainerToPushRename < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- # NOOP
- end
-
- def down
- if column_exists?(:merge_requests, :allow_collaboration)
- # rubocop:disable Migration/UpdateLargeTable
- rename_column_concurrently :merge_requests, :allow_collaboration, :allow_maintainer_to_push
- end
- end
-end
diff --git a/db/post_migrate/20180529152628_schedule_to_archive_legacy_traces.rb b/db/post_migrate/20180529152628_schedule_to_archive_legacy_traces.rb
deleted file mode 100644
index 6246f6afab0..00000000000
--- a/db/post_migrate/20180529152628_schedule_to_archive_legacy_traces.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-class ScheduleToArchiveLegacyTraces < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- BATCH_SIZE = 5000
- BACKGROUND_MIGRATION_CLASS = 'ArchiveLegacyTraces'
-
- disable_ddl_transaction!
-
- class Build < ActiveRecord::Base
- include EachBatch
- self.table_name = 'ci_builds'
- self.inheritance_column = :_type_disabled # Disable STI
-
- scope :type_build, -> { where(type: 'Ci::Build') }
-
- scope :finished, -> { where(status: [:success, :failed, :canceled]) }
-
- scope :without_archived_trace, -> do
- where('NOT EXISTS (SELECT 1 FROM ci_job_artifacts WHERE ci_builds.id = ci_job_artifacts.job_id AND ci_job_artifacts.file_type = 3)')
- end
- end
-
- def up
- queue_background_migration_jobs_by_range_at_intervals(
- ::ScheduleToArchiveLegacyTraces::Build.type_build.finished.without_archived_trace,
- BACKGROUND_MIGRATION_CLASS,
- 5.minutes,
- batch_size: BATCH_SIZE)
- end
-
- def down
- # noop
- end
-end
diff --git a/db/post_migrate/20180603190921_migrate_object_storage_upload_sidekiq_queue.rb b/db/post_migrate/20180603190921_migrate_object_storage_upload_sidekiq_queue.rb
deleted file mode 100644
index bc7c3eb5385..00000000000
--- a/db/post_migrate/20180603190921_migrate_object_storage_upload_sidekiq_queue.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class MigrateObjectStorageUploadSidekiqQueue < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- sidekiq_queue_migrate 'object_storage_upload', to: 'object_storage:object_storage_background_move'
- end
-
- def down
- # do not migrate any jobs back because we would migrate also
- # jobs which were not part of the 'object_storage_upload'
- end
-end
diff --git a/db/post_migrate/20180604123514_cleanup_stages_position_migration.rb b/db/post_migrate/20180604123514_cleanup_stages_position_migration.rb
deleted file mode 100644
index 326cdfa27c3..00000000000
--- a/db/post_migrate/20180604123514_cleanup_stages_position_migration.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-class CleanupStagesPositionMigration < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- TMP_INDEX_NAME = 'tmp_id_stage_position_partial_null_index'.freeze
-
- disable_ddl_transaction!
-
- class Stages < ActiveRecord::Base
- include EachBatch
- self.table_name = 'ci_stages'
- end
-
- def up
- disable_statement_timeout do
- Gitlab::BackgroundMigration.steal('MigrateStageIndex')
-
- unless index_exists_by_name?(:ci_stages, TMP_INDEX_NAME)
- add_concurrent_index(:ci_stages, :id, where: 'position IS NULL', name: TMP_INDEX_NAME)
- end
-
- migratable = <<~SQL
- position IS NULL AND EXISTS (
- SELECT 1 FROM ci_builds WHERE stage_id = ci_stages.id AND stage_idx IS NOT NULL
- )
- SQL
-
- Stages.where(migratable).each_batch(of: 1000) do |batch|
- batch.pluck(:id).each do |stage|
- Gitlab::BackgroundMigration::MigrateStageIndex.new.perform(stage, stage)
- end
- end
-
- remove_concurrent_index_by_name(:ci_stages, TMP_INDEX_NAME)
- end
- end
-
- def down
- if index_exists_by_name?(:ci_stages, TMP_INDEX_NAME)
- disable_statement_timeout do
- remove_concurrent_index_by_name(:ci_stages, TMP_INDEX_NAME)
- end
- end
- end
-end
diff --git a/db/post_migrate/20180608201435_cleanup_merge_requests_allow_collaboration_rename.rb b/db/post_migrate/20180608201435_cleanup_merge_requests_allow_collaboration_rename.rb
deleted file mode 100644
index 5e892f8bace..00000000000
--- a/db/post_migrate/20180608201435_cleanup_merge_requests_allow_collaboration_rename.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class CleanupMergeRequestsAllowCollaborationRename < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- if column_exists?(:merge_requests, :allow_collaboration)
- cleanup_concurrent_column_rename :merge_requests, :allow_collaboration, :allow_maintainer_to_push
- end
- end
-
- def down
- # NOOP
- end
-end
diff --git a/db/post_migrate/20180629191052_add_partial_index_to_projects_for_last_repository_check_at.rb b/db/post_migrate/20180629191052_add_partial_index_to_projects_for_last_repository_check_at.rb
deleted file mode 100644
index 15c02cd77b8..00000000000
--- a/db/post_migrate/20180629191052_add_partial_index_to_projects_for_last_repository_check_at.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class AddPartialIndexToProjectsForLastRepositoryCheckAt < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- INDEX_NAME = "index_projects_on_last_repository_check_at"
-
- def up
- add_concurrent_index(:projects, :last_repository_check_at, where: "last_repository_check_at IS NOT NULL", name: INDEX_NAME)
- end
-
- def down
- remove_concurrent_index(:projects, :last_repository_check_at, where: "last_repository_check_at IS NOT NULL", name: INDEX_NAME)
- end
-end
diff --git a/db/post_migrate/20180702120647_enqueue_fix_cross_project_label_links.rb b/db/post_migrate/20180702120647_enqueue_fix_cross_project_label_links.rb
deleted file mode 100644
index 3d3d49e7564..00000000000
--- a/db/post_migrate/20180702120647_enqueue_fix_cross_project_label_links.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-class EnqueueFixCrossProjectLabelLinks < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- BATCH_SIZE = 100
- MIGRATION = 'FixCrossProjectLabelLinks'
- DELAY_INTERVAL = 5.minutes
-
- disable_ddl_transaction!
-
- class Label < ActiveRecord::Base
- self.table_name = 'labels'
- end
-
- class Namespace < ActiveRecord::Base
- self.table_name = 'namespaces'
-
- include ::EachBatch
-
- default_scope { where(type: 'Group', id: Label.where(type: 'GroupLabel').select('distinct group_id')) }
- end
-
- def up
- queue_background_migration_jobs_by_range_at_intervals(Namespace, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE)
- end
-
- def down
- # noop
- end
-end
diff --git a/db/post_migrate/20180704145007_update_project_indexes.rb b/db/post_migrate/20180704145007_update_project_indexes.rb
deleted file mode 100644
index 0a82f4535a0..00000000000
--- a/db/post_migrate/20180704145007_update_project_indexes.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class UpdateProjectIndexes < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- NEW_INDEX_NAME = 'idx_project_repository_check_partial'
-
- disable_ddl_transaction!
-
- def up
- add_concurrent_index(:projects,
- [:repository_storage, :created_at],
- name: NEW_INDEX_NAME,
- where: 'last_repository_check_at IS NULL'
- )
- end
-
- def down
- remove_concurrent_index_by_name(:projects, NEW_INDEX_NAME)
- end
-end
diff --git a/db/post_migrate/20180706223200_populate_site_statistics.rb b/db/post_migrate/20180706223200_populate_site_statistics.rb
deleted file mode 100644
index 6f887a0c18f..00000000000
--- a/db/post_migrate/20180706223200_populate_site_statistics.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-class PopulateSiteStatistics < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- transaction do
- execute('SET LOCAL statement_timeout TO 0') # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
-
- execute("UPDATE site_statistics SET repositories_count = (SELECT COUNT(*) FROM projects)")
- end
-
- transaction do
- execute('SET LOCAL statement_timeout TO 0') # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
-
- execute("UPDATE site_statistics SET wikis_count = (SELECT COUNT(*) FROM project_features WHERE wiki_access_level != 0)")
- end
- end
-
- def down
- # No downside in keeping the counter up-to-date
- end
-end
diff --git a/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb b/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb
deleted file mode 100644
index b272bad7f92..00000000000
--- a/db/post_migrate/20180809195358_migrate_null_wiki_access_levels.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# frozen_string_literal: true
-
-class MigrateNullWikiAccessLevels < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- class ProjectFeature < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'project_features'
- end
-
- def up
- ProjectFeature.where(wiki_access_level: nil).each_batch do |relation|
- relation.update_all(wiki_access_level: 20)
- end
-
- # We need to re-count wikis as previous attempt was not considering the NULLs.
- transaction do
- execute('SET LOCAL statement_timeout TO 0') # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
-
- execute("UPDATE site_statistics SET wikis_count = (SELECT COUNT(*) FROM project_features WHERE wiki_access_level != 0)")
- end
- end
-
- def down
- # there is no way to rollback this change, there are no downsides in keeping migrated data.
- end
-end
diff --git a/db/post_migrate/20180816161409_migrate_legacy_artifacts_to_job_artifacts.rb b/db/post_migrate/20180816161409_migrate_legacy_artifacts_to_job_artifacts.rb
deleted file mode 100644
index 6b0d1ef0d0c..00000000000
--- a/db/post_migrate/20180816161409_migrate_legacy_artifacts_to_job_artifacts.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-class MigrateLegacyArtifactsToJobArtifacts < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- MIGRATION = 'MigrateLegacyArtifacts'.freeze
- BATCH_SIZE = 100
-
- 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
- MigrateLegacyArtifactsToJobArtifacts::Build
- .with_legacy_artifacts.tap do |relation|
- queue_background_migration_jobs_by_range_at_intervals(relation,
- MIGRATION,
- 5.minutes,
- batch_size: BATCH_SIZE)
- end
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20180816193530_rename_login_root_namespaces.rb b/db/post_migrate/20180816193530_rename_login_root_namespaces.rb
deleted file mode 100644
index 70db8f46d05..00000000000
--- a/db/post_migrate/20180816193530_rename_login_root_namespaces.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-class RenameLoginRootNamespaces < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
- include Gitlab::Database::RenameReservedPathsMigration::V1
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- # We're taking over the /login namespace as part of a fix for the Jira integration
- def up
- disable_statement_timeout do
- rename_root_paths 'login'
- end
- end
-
- def down
- disable_statement_timeout do
- revert_renames
- end
- end
-end
diff --git a/db/post_migrate/20180826111825_recalculate_site_statistics.rb b/db/post_migrate/20180826111825_recalculate_site_statistics.rb
deleted file mode 100644
index 938707c9ba4..00000000000
--- a/db/post_migrate/20180826111825_recalculate_site_statistics.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class RecalculateSiteStatistics < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- transaction do
- execute('SET LOCAL statement_timeout TO 0') # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
-
- execute("UPDATE site_statistics SET repositories_count = (SELECT COUNT(*) FROM projects)")
- end
-
- transaction do
- execute('SET LOCAL statement_timeout TO 0') # see https://gitlab.com/gitlab-org/gitlab-foss/issues/48967
-
- execute("UPDATE site_statistics SET wikis_count = (SELECT COUNT(*) FROM project_features WHERE wiki_access_level != 0)")
- end
- end
-
- def down
- # No downside in keeping the counter up-to-date
- end
-end
diff --git a/db/post_migrate/20180913142237_schedule_digest_personal_access_tokens.rb b/db/post_migrate/20180913142237_schedule_digest_personal_access_tokens.rb
deleted file mode 100644
index 951cb3b088c..00000000000
--- a/db/post_migrate/20180913142237_schedule_digest_personal_access_tokens.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-class ScheduleDigestPersonalAccessTokens < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- BATCH_SIZE = 10_000
- MIGRATION = 'DigestColumn'
- DELAY_INTERVAL = 5.minutes.to_i
-
- disable_ddl_transaction!
-
- class PersonalAccessToken < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'personal_access_tokens'
- end
-
- def up
- PersonalAccessToken.where('token is NOT NULL').each_batch(of: BATCH_SIZE) do |batch, index|
- range = batch.pluck('MIN(id)', 'MAX(id)').first
- BackgroundMigrationWorker.perform_in(index * DELAY_INTERVAL, MIGRATION, ['PersonalAccessToken', :token, :token_digest, *range])
- end
- end
-
- def down
- # raise ActiveRecord::IrreversibleMigration
- end
-end
diff --git a/db/post_migrate/20180914162043_encrypt_web_hooks_columns.rb b/db/post_migrate/20180914162043_encrypt_web_hooks_columns.rb
deleted file mode 100644
index ef864f490bb..00000000000
--- a/db/post_migrate/20180914162043_encrypt_web_hooks_columns.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-# frozen_string_literal: true
-
-class EncryptWebHooksColumns < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- BATCH_SIZE = 10000
- RANGE_SIZE = 100
- MIGRATION = 'EncryptColumns'
- COLUMNS = [:token, :url]
-
- WebHook = ::Gitlab::BackgroundMigration::Models::EncryptColumns::WebHook
-
- disable_ddl_transaction!
-
- def up
- WebHook.each_batch(of: BATCH_SIZE) do |relation, index|
- delay = index * 2.minutes
-
- relation.each_batch(of: RANGE_SIZE) do |relation|
- range = relation.pluck('MIN(id)', 'MAX(id)').first
- args = [WebHook, COLUMNS, *range]
-
- BackgroundMigrationWorker.perform_in(delay, MIGRATION, args)
- end
- end
- end
-
- def down
- # noop
- end
-end
diff --git a/db/post_migrate/20180914201132_remove_sidekiq_throttling_from_application_settings.rb b/db/post_migrate/20180914201132_remove_sidekiq_throttling_from_application_settings.rb
deleted file mode 100644
index 2c007ec395d..00000000000
--- a/db/post_migrate/20180914201132_remove_sidekiq_throttling_from_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 RemoveSidekiqThrottlingFromApplicationSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- remove_column :application_settings, :sidekiq_throttling_enabled, :boolean, default: false
- remove_column :application_settings, :sidekiq_throttling_queues, :string
- remove_column :application_settings, :sidekiq_throttling_factor, :decimal
-
- Rails.cache.delete("ApplicationSetting:#{Gitlab::VERSION}:#{Rails.version}")
- end
-end
diff --git a/db/post_migrate/20180917172041_remove_wikis_count_from_site_statistics.rb b/db/post_migrate/20180917172041_remove_wikis_count_from_site_statistics.rb
deleted file mode 100644
index 3b8300dabeb..00000000000
--- a/db/post_migrate/20180917172041_remove_wikis_count_from_site_statistics.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-# frozen_string_literal: true
-class RemoveWikisCountFromSiteStatistics < ActiveRecord::Migration[4.2]
- def change
- remove_column :site_statistics, :wikis_count, :integer
- end
-end
diff --git a/db/post_migrate/20181008145341_steal_encrypt_columns.rb b/db/post_migrate/20181008145341_steal_encrypt_columns.rb
deleted file mode 100644
index 4102643ba13..00000000000
--- a/db/post_migrate/20181008145341_steal_encrypt_columns.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class StealEncryptColumns < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- Gitlab::BackgroundMigration.steal('EncryptColumns')
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20181008145359_remove_web_hooks_token_and_url.rb b/db/post_migrate/20181008145359_remove_web_hooks_token_and_url.rb
deleted file mode 100644
index 93e4458b795..00000000000
--- a/db/post_migrate/20181008145359_remove_web_hooks_token_and_url.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class RemoveWebHooksTokenAndUrl < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- remove_column :web_hooks, :token, :string
- remove_column :web_hooks, :url, :string, limit: 2000
- end
-end
diff --git a/db/post_migrate/20181008200441_remove_circuit_breaker.rb b/db/post_migrate/20181008200441_remove_circuit_breaker.rb
deleted file mode 100644
index 09491038e50..00000000000
--- a/db/post_migrate/20181008200441_remove_circuit_breaker.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveCircuitBreaker < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- # Set this constant to true if this migration requires downtime.
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- CIRCUIT_BREAKER_COLUMS_WITH_DEFAULT = {
- circuitbreaker_failure_count_threshold: 3,
- circuitbreaker_failure_reset_time: 1800,
- circuitbreaker_storage_timeout: 15,
- circuitbreaker_access_retries: 3,
- circuitbreaker_check_interval: 1
- }.freeze
-
- def up
- CIRCUIT_BREAKER_COLUMS_WITH_DEFAULT.keys.each do |column|
- remove_column(:application_settings, column) if column_exists?(:application_settings, column)
- end
- end
-
- def down
- CIRCUIT_BREAKER_COLUMS_WITH_DEFAULT.each do |column, default|
- # rubocop:disable Migration/AddColumnWithDefault
- add_column_with_default(:application_settings, column, :integer, default: default) unless column_exists?(:application_settings, column)
- # rubocop:enable Migration/AddColumnWithDefault
- end
- end
-end
diff --git a/db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb b/db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb
deleted file mode 100644
index 247f5980f7e..00000000000
--- a/db/post_migrate/20181010133639_backfill_store_project_full_path_in_repo.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class BackfillStoreProjectFullPathInRepo < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- BATCH_SIZE = 1_000
- DELAY_INTERVAL = 5.minutes
- UP_MIGRATION = 'BackfillProjectFullpathInRepoConfig::Up'
- DOWN_MIGRATION = 'BackfillProjectFullpathInRepoConfig::Down'
-
- disable_ddl_transaction!
-
- class Project < ActiveRecord::Base
- self.table_name = 'projects'
-
- include EachBatch
- end
-
- def up
- queue_background_migration_jobs_by_range_at_intervals(Project, UP_MIGRATION, DELAY_INTERVAL)
- end
-
- def down
- queue_background_migration_jobs_by_range_at_intervals(Project, DOWN_MIGRATION, DELAY_INTERVAL)
- end
-end
diff --git a/db/post_migrate/20181013005024_remove_koding_from_application_settings.rb b/db/post_migrate/20181013005024_remove_koding_from_application_settings.rb
deleted file mode 100644
index 550ad94f4ab..00000000000
--- a/db/post_migrate/20181013005024_remove_koding_from_application_settings.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveKodingFromApplicationSettings < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- remove_column :application_settings, :koding_enabled
- remove_column :application_settings, :koding_url
- end
-
- def down
- add_column :application_settings, :koding_enabled, :boolean # rubocop:disable Migration/SaferBooleanColumn
- add_column :application_settings, :koding_url, :string
- end
-end
diff --git a/db/post_migrate/20181022173835_enqueue_populate_cluster_kubernetes_namespace.rb b/db/post_migrate/20181022173835_enqueue_populate_cluster_kubernetes_namespace.rb
deleted file mode 100644
index 94a4574abff..00000000000
--- a/db/post_migrate/20181022173835_enqueue_populate_cluster_kubernetes_namespace.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-# frozen_string_literal: true
-
-class EnqueuePopulateClusterKubernetesNamespace < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- MIGRATION = 'PopulateClusterKubernetesNamespaceTable'.freeze
-
- disable_ddl_transaction!
-
- def up
- BackgroundMigrationWorker.perform_async(MIGRATION)
- end
-
- def down
- Clusters::KubernetesNamespace.delete_all
- end
-end
diff --git a/db/post_migrate/20181026091631_migrate_forbidden_redirect_uris.rb b/db/post_migrate/20181026091631_migrate_forbidden_redirect_uris.rb
deleted file mode 100644
index 7c2df832882..00000000000
--- a/db/post_migrate/20181026091631_migrate_forbidden_redirect_uris.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# frozen_string_literal: true
-
-class MigrateForbiddenRedirectUris < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- FORBIDDEN_SCHEMES = %w[data:// vbscript:// javascript://]
- NEW_URI = 'http://forbidden-scheme-has-been-overwritten'
-
- disable_ddl_transaction!
-
- def up
- update_forbidden_uris(:oauth_applications)
- update_forbidden_uris(:oauth_access_grants)
- end
-
- def down
- # noop
- end
-
- private
-
- def update_forbidden_uris(table_name)
- update_column_in_batches(table_name, :redirect_uri, NEW_URI) do |table, query|
- where_clause = FORBIDDEN_SCHEMES.map do |scheme|
- table[:redirect_uri].matches("#{scheme}%")
- end.inject(&:or)
-
- query.where(where_clause)
- end
- end
-end
diff --git a/db/post_migrate/20181030135124_fill_empty_finished_at_in_deployments.rb b/db/post_migrate/20181030135124_fill_empty_finished_at_in_deployments.rb
deleted file mode 100644
index 228841a14a0..00000000000
--- a/db/post_migrate/20181030135124_fill_empty_finished_at_in_deployments.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-
-class FillEmptyFinishedAtInDeployments < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- DEPLOYMENT_STATUS_SUCCESS = 2 # Equivalent to Deployment.statuses[:success]
-
- class Deployments < ActiveRecord::Base
- self.table_name = 'deployments'
-
- include EachBatch
- end
-
- def up
- FillEmptyFinishedAtInDeployments::Deployments
- .where('finished_at IS NULL')
- .where('status = ?', DEPLOYMENT_STATUS_SUCCESS)
- .each_batch(of: 10_000) do |relation|
- relation.update_all('finished_at=created_at')
- end
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20181101091005_steal_digest_column.rb b/db/post_migrate/20181101091005_steal_digest_column.rb
deleted file mode 100644
index 58ea710c18a..00000000000
--- a/db/post_migrate/20181101091005_steal_digest_column.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-# frozen_string_literal: true
-
-class StealDigestColumn < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- Gitlab::BackgroundMigration.steal('DigestColumn')
- end
-
- def down
- # raise ActiveRecord::IrreversibleMigration
- end
-end
diff --git a/db/post_migrate/20181101091124_remove_token_from_personal_access_tokens.rb b/db/post_migrate/20181101091124_remove_token_from_personal_access_tokens.rb
deleted file mode 100644
index 415373068d5..00000000000
--- a/db/post_migrate/20181101091124_remove_token_from_personal_access_tokens.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-class RemoveTokenFromPersonalAccessTokens < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def change
- remove_column :personal_access_tokens, :token, :string
- end
-end
diff --git a/db/post_migrate/20181105201455_steal_fill_store_upload.rb b/db/post_migrate/20181105201455_steal_fill_store_upload.rb
deleted file mode 100644
index a31a4eab472..00000000000
--- a/db/post_migrate/20181105201455_steal_fill_store_upload.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-class StealFillStoreUpload < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- BATCH_SIZE = 10_000
-
- disable_ddl_transaction!
-
- class Upload < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'uploads'
- self.inheritance_column = :_type_disabled # Disable STI
- end
-
- def up
- Gitlab::BackgroundMigration.steal('FillStoreUpload')
-
- Upload.where(store: nil).each_batch(of: BATCH_SIZE) do |batch|
- range = batch.pluck('MIN(id)', 'MAX(id)').first
-
- Gitlab::BackgroundMigration::FillStoreUpload.new.perform(*range)
- end
- end
-
- def down
- # noop
- end
-end
diff --git a/db/post_migrate/20181107054254_remove_restricted_todos_again.rb b/db/post_migrate/20181107054254_remove_restricted_todos_again.rb
deleted file mode 100644
index bbeb4e8a1de..00000000000
--- a/db/post_migrate/20181107054254_remove_restricted_todos_again.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# frozen_string_literal: true
-
-# rescheduling of the revised RemoveRestrictedTodosWithCte background migration
-class RemoveRestrictedTodosAgain < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- disable_ddl_transaction!
-
- MIGRATION = 'RemoveRestrictedTodos'.freeze
- BATCH_SIZE = 1000
- DELAY_INTERVAL = 5.minutes.to_i
-
- class Project < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'projects'
- end
-
- def up
- Project.where('EXISTS (SELECT 1 FROM todos WHERE todos.project_id = projects.id)')
- .each_batch(of: BATCH_SIZE) do |batch, index|
- range = batch.pluck('MIN(id)', 'MAX(id)').first
-
- BackgroundMigrationWorker.perform_in(index * DELAY_INTERVAL, MIGRATION, range)
- end
- end
-
- def down
- # nothing to do
- end
-end
diff --git a/db/post_migrate/20181121111200_schedule_runners_token_encryption.rb b/db/post_migrate/20181121111200_schedule_runners_token_encryption.rb
deleted file mode 100644
index ba82072fc98..00000000000
--- a/db/post_migrate/20181121111200_schedule_runners_token_encryption.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# frozen_string_literal: true
-
-class ScheduleRunnersTokenEncryption < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- BATCH_SIZE = 10000
- RANGE_SIZE = 2000
- MIGRATION = 'EncryptRunnersTokens'
-
- MODELS = [
- ::Gitlab::BackgroundMigration::Models::EncryptColumns::Settings,
- ::Gitlab::BackgroundMigration::Models::EncryptColumns::Namespace,
- ::Gitlab::BackgroundMigration::Models::EncryptColumns::Project,
- ::Gitlab::BackgroundMigration::Models::EncryptColumns::Runner
- ].freeze
-
- disable_ddl_transaction!
-
- def up
- MODELS.each do |model|
- model.each_batch(of: BATCH_SIZE) do |relation, index|
- delay = index * 4.minutes
-
- relation.each_batch(of: RANGE_SIZE) do |relation|
- range = relation.pluck('MIN(id)', 'MAX(id)').first
- args = [model.name.demodulize.downcase, *range]
-
- BackgroundMigrationWorker.perform_in(delay, MIGRATION, args)
- end
- end
- end
- end
-
- def down
- # no-op
- end
-end
diff --git a/db/post_migrate/20181123042307_drop_site_statistics.rb b/db/post_migrate/20181123042307_drop_site_statistics.rb
deleted file mode 100644
index 8986374ef65..00000000000
--- a/db/post_migrate/20181123042307_drop_site_statistics.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 DropSiteStatistics < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- drop_table :site_statistics
- end
-
- def down
- create_table :site_statistics do |t|
- t.integer :repositories_count, default: 0, null: false
- end
-
- execute('INSERT INTO site_statistics (id) VALUES(1)')
- end
-end
diff --git a/db/post_migrate/20181130102132_backfill_hashed_project_repositories.rb b/db/post_migrate/20181130102132_backfill_hashed_project_repositories.rb
deleted file mode 100644
index 7814cdba58a..00000000000
--- a/db/post_migrate/20181130102132_backfill_hashed_project_repositories.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-# frozen_string_literal: true
-
-class BackfillHashedProjectRepositories < ActiveRecord::Migration[4.2]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
- BATCH_SIZE = 1_000
- DELAY_INTERVAL = 5.minutes
- MIGRATION = 'BackfillHashedProjectRepositories'
-
- disable_ddl_transaction!
-
- class Project < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'projects'
- end
-
- def up
- queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, DELAY_INTERVAL)
- end
-
- def down
- # no-op: since there could have been existing rows before the migration do not remove anything
- end
-end
diff --git a/db/post_migrate/20181219130552_update_project_import_visibility_level.rb b/db/post_migrate/20181219130552_update_project_import_visibility_level.rb
deleted file mode 100644
index bfa452578a3..00000000000
--- a/db/post_migrate/20181219130552_update_project_import_visibility_level.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# frozen_string_literal: true
-
-class UpdateProjectImportVisibilityLevel < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- BATCH_SIZE = 100
-
- PRIVATE = 0
- INTERNAL = 10
-
- disable_ddl_transaction!
-
- class Namespace < ActiveRecord::Base
- self.table_name = 'namespaces'
- end
-
- class Project < ActiveRecord::Base
- include EachBatch
-
- belongs_to :namespace
-
- IMPORT_TYPE = 'gitlab_project'
-
- scope :with_group_visibility, ->(visibility) do
- joins(:namespace)
- .where(namespaces: { type: 'Group', visibility_level: visibility })
- .where(import_type: IMPORT_TYPE)
- .where('projects.visibility_level > namespaces.visibility_level')
- end
-
- self.table_name = 'projects'
- end
-
- def up
- # Update project's visibility to be the same as the group
- # if it is more restrictive than `PUBLIC`.
- update_projects_visibility(PRIVATE)
- update_projects_visibility(INTERNAL)
- end
-
- def down
- # no-op: unrecoverable data migration
- end
-
- private
-
- def update_projects_visibility(visibility)
- say_with_time("Updating project visibility to #{visibility} on #{Project::IMPORT_TYPE} imports.") do
- Project.with_group_visibility(visibility).select(:id).each_batch(of: BATCH_SIZE) do |batch, _index|
- batch_sql = batch.select(:id).to_sql
-
- say("Updating #{batch.size} items.", true)
-
- execute("UPDATE projects SET visibility_level = '#{visibility}' WHERE id IN (#{batch_sql})")
- end
- end
- end
-end
diff --git a/db/post_migrate/20181219145520_migrate_cluster_configure_worker_sidekiq_queue.rb b/db/post_migrate/20181219145520_migrate_cluster_configure_worker_sidekiq_queue.rb
deleted file mode 100644
index c37f8c039c0..00000000000
--- a/db/post_migrate/20181219145520_migrate_cluster_configure_worker_sidekiq_queue.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class MigrateClusterConfigureWorkerSidekiqQueue < ActiveRecord::Migration[5.0]
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- def up
- sidekiq_queue_migrate 'gcp_cluster:cluster_platform_configure', to: 'gcp_cluster:cluster_configure'
- end
-
- def down
- sidekiq_queue_migrate 'gcp_cluster:cluster_configure', to: 'gcp_cluster:cluster_platform_configure'
- end
-end
diff --git a/db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb b/db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb
index e2ec7b62d31..b41c55ce622 100644
--- a/db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb
+++ b/db/post_migrate/20200310215714_migrate_saml_identities_to_scim_identities.rb
@@ -20,7 +20,7 @@ class MigrateSamlIdentitiesToScimIdentities < ActiveRecord::Migration[6.0]
record.attributes.extract!("extern_uid", "user_id", "group_id", "active", "created_at", "updated_at")
end
- Gitlab::Database.bulk_insert(:scim_identities, data_to_insert, on_conflict: :do_nothing)
+ Gitlab::Database.bulk_insert(:scim_identities, data_to_insert, on_conflict: :do_nothing) # rubocop:disable Gitlab/BulkInsert
end
end
diff --git a/db/post_migrate/20200406102120_backfill_deployment_clusters_from_deployments.rb b/db/post_migrate/20200406102120_backfill_deployment_clusters_from_deployments.rb
index 2db270d303c..76b00796d1a 100644
--- a/db/post_migrate/20200406102120_backfill_deployment_clusters_from_deployments.rb
+++ b/db/post_migrate/20200406102120_backfill_deployment_clusters_from_deployments.rb
@@ -17,7 +17,7 @@ class BackfillDeploymentClustersFromDeployments < ActiveRecord::Migration[6.0]
class Deployment < ActiveRecord::Base
include EachBatch
- default_scope { where('cluster_id IS NOT NULL') }
+ default_scope { where('cluster_id IS NOT NULL') } # rubocop:disable Cop/DefaultScope
self.table_name = 'deployments'
end
diff --git a/db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb b/db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb
new file mode 100644
index 00000000000..cfe0daaf50f
--- /dev/null
+++ b/db/post_migrate/20200408132152_remove_namespaces_trial_ends_on.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class RemoveNamespacesTrialEndsOn < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :namespaces, 'index_namespaces_on_trial_ends_on'
+
+ with_lock_retries do
+ remove_column :namespaces, :trial_ends_on
+ end
+ end
+
+ def down
+ unless column_exists?(:namespaces, :trial_ends_on)
+ with_lock_retries do
+ add_column :namespaces, :trial_ends_on, :datetime_with_timezone
+ end
+ end
+
+ add_concurrent_index :namespaces, :trial_ends_on, using: 'btree', where: 'trial_ends_on IS NOT NULL'
+ end
+end
diff --git a/db/post_migrate/20200421195234_backfill_status_page_published_incidents.rb b/db/post_migrate/20200421195234_backfill_status_page_published_incidents.rb
new file mode 100644
index 00000000000..fa7a5a9d924
--- /dev/null
+++ b/db/post_migrate/20200421195234_backfill_status_page_published_incidents.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+class BackfillStatusPagePublishedIncidents < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ class Incident < ActiveRecord::Base
+ self.table_name = 'status_page_published_incidents'
+ end
+
+ class StatusPageIssue < ActiveRecord::Base
+ include ::EachBatch
+
+ self.table_name = 'issues'
+
+ scope :published_only, -> do
+ joins('INNER JOIN status_page_settings ON status_page_settings.project_id = issues.project_id')
+ .where('status_page_settings.enabled = true')
+ .where(confidential: false)
+ end
+ end
+
+ def up
+ current_time = Time.current
+
+ StatusPageIssue.published_only.each_batch do |batch|
+ incidents = batch.map do |status_page_issue|
+ {
+ issue_id: status_page_issue.id,
+ created_at: current_time,
+ updated_at: current_time
+ }
+ end
+
+ Incident.insert_all(incidents, unique_by: :issue_id)
+ end
+ end
+
+ def down
+ # no op
+
+ # While we expect this table to be empty at the point of
+ # the up migration, there is no reliable way to determine
+ # whether records were added as a part of the migration
+ # or after it has run.
+ end
+end
diff --git a/db/post_migrate/20200518114540_schedule_fix_ruby_object_in_audit_events.rb b/db/post_migrate/20200518114540_schedule_fix_ruby_object_in_audit_events.rb
new file mode 100644
index 00000000000..e4335089540
--- /dev/null
+++ b/db/post_migrate/20200518114540_schedule_fix_ruby_object_in_audit_events.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+class ScheduleFixRubyObjectInAuditEvents < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_audit_events_on_ruby_object_in_details'
+ INTERVAL = 2.minutes.to_i
+ BATCH_SIZE = 1_000
+ MIGRATION = 'FixRubyObjectInAuditEvents'
+
+ disable_ddl_transaction!
+
+ class AuditEvent < ActiveRecord::Base
+ self.table_name = 'audit_events'
+
+ include ::EachBatch
+ end
+
+ def up
+ return unless Gitlab.ee?
+
+ # create temporary index for audit_events with ruby/object in details field, may take well over 1h
+ add_concurrent_index(:audit_events, :id, where: "details ~~ '%ruby/object%'", name: INDEX_NAME)
+
+ relation = AuditEvent.where("details ~~ '%ruby/object%'")
+
+ queue_background_migration_jobs_by_range_at_intervals(
+ relation,
+ MIGRATION,
+ INTERVAL,
+ batch_size: BATCH_SIZE
+ )
+ end
+
+ def down
+ # temporary index is to be dropped in a different migration in an upcoming release
+ # https://gitlab.com/gitlab-org/gitlab/issues/196842
+ remove_concurrent_index_by_name(:audit_events, INDEX_NAME)
+ end
+end
diff --git a/db/post_migrate/20200518133123_add_index_on_starting_ending_at_to_metrics_dashboard_annotations.rb b/db/post_migrate/20200518133123_add_index_on_starting_ending_at_to_metrics_dashboard_annotations.rb
new file mode 100644
index 00000000000..3094fff0d1d
--- /dev/null
+++ b/db/post_migrate/20200518133123_add_index_on_starting_ending_at_to_metrics_dashboard_annotations.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexOnStartingEndingAtToMetricsDashboardAnnotations < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_metrics_dashboard_annotations_on_timespan_end'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :metrics_dashboard_annotations, 'COALESCE(ending_at, starting_at)', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :metrics_dashboard_annotations, 'COALESCE(ending_at, starting_at)', name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20200519171058_update_index_ci_builds_on_commit_id_and_artifacts_expireatandidpartial.rb b/db/post_migrate/20200519171058_update_index_ci_builds_on_commit_id_and_artifacts_expireatandidpartial.rb
new file mode 100644
index 00000000000..e09ad4bdadf
--- /dev/null
+++ b/db/post_migrate/20200519171058_update_index_ci_builds_on_commit_id_and_artifacts_expireatandidpartial.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class UpdateIndexCiBuildsOnCommitIdAndArtifactsExpireatandidpartial < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ disable_ddl_transaction!
+
+ OLD_INDEX_NAME = 'index_ci_builds_on_commit_id_and_artifacts_expireatandidpartial'
+ NEW_INDEX_NAME = 'index_ci_builds_on_commit_id_artifacts_expired_at_and_id'
+
+ OLD_CLAUSE = "type::text = 'Ci::Build'::text AND (retried = false OR retried IS NULL) AND
+ (name::text = ANY (ARRAY['sast'::character varying,
+ 'dependency_scanning'::character varying,
+ 'sast:container'::character varying,
+ 'container_scanning'::character varying,
+ 'dast'::character varying]::text[]))"
+
+ NEW_CLAUSE = "type::text = 'Ci::Build'::text AND (retried = false OR retried IS NULL) AND
+ (name::text = ANY (ARRAY['sast'::character varying,
+ 'secret_detection'::character varying,
+ 'dependency_scanning'::character varying,
+ 'container_scanning'::character varying,
+ 'dast'::character varying]::text[]))"
+
+ def up
+ add_concurrent_index :ci_builds, [:commit_id, :artifacts_expire_at, :id], name: NEW_INDEX_NAME, where: NEW_CLAUSE
+ remove_concurrent_index_by_name :ci_builds, OLD_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :ci_builds, [:commit_id, :artifacts_expire_at, :id], name: OLD_INDEX_NAME, where: OLD_CLAUSE
+ remove_concurrent_index_by_name :ci_builds, NEW_INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20200525121014_drop_users_ghost_column.rb b/db/post_migrate/20200525121014_drop_users_ghost_column.rb
new file mode 100644
index 00000000000..1f80bc74b9d
--- /dev/null
+++ b/db/post_migrate/20200525121014_drop_users_ghost_column.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class DropUsersGhostColumn < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :users, 'index_users_on_ghost'
+
+ with_lock_retries do
+ remove_column :users, :ghost
+ end
+ end
+
+ def down
+ unless column_exists?(:users, :ghost)
+ with_lock_retries do
+ add_column :users, :ghost, :boolean # rubocop:disable Migration/AddColumnsToWideTables
+ end
+ end
+
+ execute 'UPDATE users set ghost = TRUE WHERE user_type = 5'
+
+ add_concurrent_index :users, :ghost
+ end
+end
diff --git a/db/post_migrate/20200525144525_migrate_stuck_import_jobs_queue_to_stuck_project_import_jobs.rb b/db/post_migrate/20200525144525_migrate_stuck_import_jobs_queue_to_stuck_project_import_jobs.rb
new file mode 100644
index 00000000000..57e25c928f1
--- /dev/null
+++ b/db/post_migrate/20200525144525_migrate_stuck_import_jobs_queue_to_stuck_project_import_jobs.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class MigrateStuckImportJobsQueueToStuckProjectImportJobs < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ sidekiq_queue_migrate 'cronjob:stuck_import_jobs', to: 'cronjob:import_stuck_project_import_jobs'
+ end
+
+ def down
+ sidekiq_queue_migrate 'cronjob:import_stuck_project_import_jobs', to: 'cronjob:stuck_import_jobs'
+ end
+end
diff --git a/db/post_migrate/20200526000407_seed_repository_storages_weighted.rb b/db/post_migrate/20200526000407_seed_repository_storages_weighted.rb
new file mode 100644
index 00000000000..e5a0acb9cd8
--- /dev/null
+++ b/db/post_migrate/20200526000407_seed_repository_storages_weighted.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class SeedRepositoryStoragesWeighted < ActiveRecord::Migration[6.0]
+ class ApplicationSetting < ActiveRecord::Base
+ serialize :repository_storages
+ self.table_name = 'application_settings'
+ end
+
+ def up
+ ApplicationSetting.all.each do |settings|
+ storages = Gitlab.config.repositories.storages.keys.collect do |storage|
+ weight = settings.repository_storages.include?(storage) ? 100 : 0
+ [storage, weight]
+ end
+
+ settings.repository_storages_weighted = Hash[storages]
+ settings.save!
+ end
+ end
+
+ def down
+ end
+end
diff --git a/db/post_migrate/20200527094322_drop_vulnerability_confidence_index.rb b/db/post_migrate/20200527094322_drop_vulnerability_confidence_index.rb
new file mode 100644
index 00000000000..e9a9dd5eff8
--- /dev/null
+++ b/db/post_migrate/20200527094322_drop_vulnerability_confidence_index.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class DropVulnerabilityConfidenceIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_vulnerability_on_id_and_confidence_eq_zero'
+
+ def up
+ Gitlab::BackgroundMigration.steal('RemoveUndefinedVulnerabilityConfidenceLevel')
+
+ remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index(:vulnerabilities, :id, where: 'confidence = 0', name: INDEX_NAME)
+ end
+end
diff --git a/db/post_migrate/20200527095401_drop_vulnerability_occurrence_confidence_index.rb b/db/post_migrate/20200527095401_drop_vulnerability_occurrence_confidence_index.rb
new file mode 100644
index 00000000000..99fe4da7686
--- /dev/null
+++ b/db/post_migrate/20200527095401_drop_vulnerability_occurrence_confidence_index.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class DropVulnerabilityOccurrenceConfidenceIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_vulnerability_occurrences_on_id_and_confidence_eq_zero'
+
+ def up
+ Gitlab::BackgroundMigration.steal('RemoveUndefinedOccurrenceConfidenceLevel')
+
+ remove_concurrent_index_by_name :vulnerability_occurrences, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index(:vulnerability_occurrences, :id, where: 'confidence = 0', name: INDEX_NAME)
+ end
+end
diff --git a/db/post_migrate/20200528123703_add_merge_request_partial_index_to_events.rb b/db/post_migrate/20200528123703_add_merge_request_partial_index_to_events.rb
new file mode 100644
index 00000000000..bf2269e77ab
--- /dev/null
+++ b/db/post_migrate/20200528123703_add_merge_request_partial_index_to_events.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddMergeRequestPartialIndexToEvents < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_events_on_author_id_and_created_at_merge_requests'
+
+ def up
+ add_concurrent_index(
+ :events,
+ [:author_id, :created_at],
+ name: INDEX_NAME,
+ where: "(target_type = 'MergeRequest')"
+ )
+ end
+
+ def down
+ remove_concurrent_index :events, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20200602013900_add_limit_to_designs_filename.rb b/db/post_migrate/20200602013900_add_limit_to_designs_filename.rb
new file mode 100644
index 00000000000..88732648965
--- /dev/null
+++ b/db/post_migrate/20200602013900_add_limit_to_designs_filename.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddLimitToDesignsFilename < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit(:design_management_designs, :filename, 255, validate: false)
+ end
+
+ def down
+ remove_text_limit(:design_management_designs, :filename)
+ end
+end
diff --git a/db/post_migrate/20200602013901_cap_designs_filename_length_to_new_limit.rb b/db/post_migrate/20200602013901_cap_designs_filename_length_to_new_limit.rb
new file mode 100644
index 00000000000..0458481c6bd
--- /dev/null
+++ b/db/post_migrate/20200602013901_cap_designs_filename_length_to_new_limit.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+class CapDesignsFilenameLengthToNewLimit < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ CHAR_LENGTH = 255
+ MODIFIED_NAME = 'gitlab-modified-'
+ MODIFIED_EXTENSION = '.jpg'
+
+ def up
+ arel_table = Arel::Table.new(:design_management_designs)
+
+ # Design filenames larger than the limit will be renamed to "gitlab-modified-{id}.jpg",
+ # which will be valid and unique. The design file itself will appear broken, as it is
+ # understood that no designs with filenames that exceed this limit will be legitimate.
+ # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/33565/diffs#note_355789080
+ new_value_clause = Arel::Nodes::NamedFunction.new(
+ 'CONCAT',
+ [
+ Arel::Nodes.build_quoted(MODIFIED_NAME),
+ arel_table[:id],
+ Arel::Nodes.build_quoted(MODIFIED_EXTENSION)
+ ]
+ )
+ where_clause = Arel::Nodes::NamedFunction.new(
+ 'CHAR_LENGTH',
+ [arel_table[:filename]]
+ ).gt(CHAR_LENGTH)
+
+ update_arel = Arel::UpdateManager.new.table(arel_table)
+ .set([[arel_table[:filename], new_value_clause]])
+ .where(where_clause)
+
+ ActiveRecord::Base.connection.execute(update_arel.to_sql)
+ end
+
+ def down
+ # no-op : the original filename is lost forever
+ end
+end
diff --git a/db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb b/db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb
new file mode 100644
index 00000000000..1935eaa1237
--- /dev/null
+++ b/db/post_migrate/20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb
@@ -0,0 +1,178 @@
+# frozen_string_literal: true
+
+# This migration adds or updates the routes for all the entities affected by
+# post-migration '20200511083541_cleanup_projects_with_missing_namespace'
+# - A route is added for the 'lost-and-found' group
+# - A route is added for the Ghost user (if not already defined)
+# - The routes for all the orphaned projects that were moved under the 'lost-and-found'
+# group are updated to reflect the new path
+class UpdateRoutesForLostAndFoundGroupAndOrphanedProjects < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ class User < ActiveRecord::Base
+ self.table_name = 'users'
+
+ LOST_AND_FOUND_GROUP = 'lost-and-found'
+ USER_TYPE_GHOST = 5
+ ACCESS_LEVEL_OWNER = 50
+
+ has_one :namespace, -> { where(type: nil) },
+ foreign_key: :owner_id, inverse_of: :owner, autosave: true,
+ class_name: 'UpdateRoutesForLostAndFoundGroupAndOrphanedProjects::Namespace'
+
+ def lost_and_found_group
+ # Find the 'lost-and-found' group
+ # There should only be one Group owned by the Ghost user starting with 'lost-and-found'
+ Group
+ .joins('INNER JOIN members ON namespaces.id = members.source_id')
+ .where('namespaces.type = ?', 'Group')
+ .where('members.type = ?', 'GroupMember')
+ .where('members.source_type = ?', 'Namespace')
+ .where('members.user_id = ?', self.id)
+ .where('members.access_level = ?', ACCESS_LEVEL_OWNER)
+ .find_by(Group.arel_table[:name].matches("#{LOST_AND_FOUND_GROUP}%"))
+ end
+
+ class << self
+ # Return the ghost user
+ def ghost
+ User.find_by(user_type: USER_TYPE_GHOST)
+ end
+ end
+ end
+
+ # Temporary Concern to not repeat the same methods twice
+ module HasPath
+ extend ActiveSupport::Concern
+
+ def full_path
+ if parent && path
+ parent.full_path + '/' + path
+ else
+ path
+ end
+ end
+
+ def full_name
+ if parent && name
+ parent.full_name + ' / ' + name
+ else
+ name
+ end
+ end
+ end
+
+ class Namespace < ActiveRecord::Base
+ include HasPath
+
+ self.table_name = 'namespaces'
+
+ belongs_to :owner, class_name: 'UpdateRoutesForLostAndFoundGroupAndOrphanedProjects::User'
+ belongs_to :parent, class_name: "UpdateRoutesForLostAndFoundGroupAndOrphanedProjects::Namespace"
+ has_many :children, foreign_key: :parent_id,
+ class_name: "UpdateRoutesForLostAndFoundGroupAndOrphanedProjects::Namespace"
+ has_many :projects, class_name: "UpdateRoutesForLostAndFoundGroupAndOrphanedProjects::Project"
+
+ def ensure_route!
+ unless Route.for_source('Namespace', self.id)
+ Route.create!(
+ source_id: self.id,
+ source_type: 'Namespace',
+ path: self.full_path,
+ name: self.full_name
+ )
+ end
+ end
+
+ def generate_unique_path
+ # Generate a unique path if there is no route for the namespace
+ # (an existing route guarantees that the path is already unique)
+ unless Route.for_source('Namespace', self.id)
+ self.path = Uniquify.new.string(self.path) do |str|
+ Route.where(path: str).exists?
+ end
+ end
+ end
+ end
+
+ class Group < Namespace
+ # Disable STI to allow us to manually set "type = 'Group'"
+ # Otherwise rails forces "type = CleanupProjectsWithMissingNamespace::Group"
+ self.inheritance_column = :_type_disabled
+ end
+
+ class Route < ActiveRecord::Base
+ self.table_name = 'routes'
+
+ def self.for_source(source_type, source_id)
+ Route.find_by(source_type: source_type, source_id: source_id)
+ end
+ end
+
+ class Project < ActiveRecord::Base
+ include HasPath
+
+ self.table_name = 'projects'
+
+ belongs_to :group, -> { where(type: 'Group') }, foreign_key: 'namespace_id',
+ class_name: "UpdateRoutesForLostAndFoundGroupAndOrphanedProjects::Group"
+ belongs_to :namespace,
+ class_name: "UpdateRoutesForLostAndFoundGroupAndOrphanedProjects::Namespace"
+
+ alias_method :parent, :namespace
+ alias_attribute :parent_id, :namespace_id
+
+ def ensure_route!
+ Route.find_or_initialize_by(source_type: 'Project', source_id: self.id).tap do |record|
+ record.path = self.full_path
+ record.name = self.full_name
+ record.save!
+ end
+ end
+ end
+
+ def up
+ # Reset the column information of all the models that update the database
+ # to ensure the Active Record's knowledge of the table structure is current
+ Namespace.reset_column_information
+ Route.reset_column_information
+
+ # Find the ghost user, its namespace and the "lost and found" group
+ ghost_user = User.ghost
+ return unless ghost_user # No reason to continue if there is no Ghost user
+
+ ghost_namespace = ghost_user.namespace
+ lost_and_found_group = ghost_user.lost_and_found_group
+
+ # No reason to continue if there is no 'lost-and-found' group
+ # 1. No orphaned projects were found in this instance, or
+ # 2. The 'lost-and-found' group and the orphaned projects have been already deleted
+ return unless lost_and_found_group
+
+ # Update the 'lost-and-found' group description to be more self-explanatory
+ lost_and_found_group.generate_unique_path
+ lost_and_found_group.description =
+ 'Group for storing projects that were not properly deleted. '\
+ 'It should be considered as a system level Group with non-working '\
+ 'projects inside it. The contents may be deleted with a future update. '\
+ 'More info: gitlab.com/gitlab-org/gitlab/-/issues/198603'
+ lost_and_found_group.save!
+
+ # Update the routes for the Ghost user, the "lost and found" group
+ # and all the orphaned projects
+ ghost_namespace.ensure_route!
+ lost_and_found_group.ensure_route!
+
+ # The following does a fast index scan by namespace_id
+ # No reason to process in batches:
+ # - 66 projects in GitLab.com, less than 1ms execution time to fetch them
+ # with a constant update time for each
+ lost_and_found_group.projects.each do |project|
+ project.ensure_route!
+ end
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20200608072931_backfill_imported_snippet_repositories.rb b/db/post_migrate/20200608072931_backfill_imported_snippet_repositories.rb
new file mode 100644
index 00000000000..0566524fa90
--- /dev/null
+++ b/db/post_migrate/20200608072931_backfill_imported_snippet_repositories.rb
@@ -0,0 +1,47 @@
+# frozen_string_literal: true
+
+class BackfillImportedSnippetRepositories < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ DELAY_INTERVAL = 2.minutes.to_i
+ BATCH_SIZE = 200
+ MIGRATION = 'BackfillSnippetRepositories'
+
+ disable_ddl_transaction!
+
+ class Snippet < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'snippets'
+ self.inheritance_column = :_type_disabled
+ end
+
+ class SnippetRepository < ActiveRecord::Base
+ self.table_name = 'snippet_repositories'
+ end
+
+ def up
+ index = 1
+
+ Snippet.select(:id).where.not(id: SnippetRepository.select(:snippet_id)).each_batch(of: BATCH_SIZE, column: 'id') do |batch|
+ split_in_consecutive_batches(batch).each do |ids_batch|
+ migrate_in(index * DELAY_INTERVAL, MIGRATION, [ids_batch.first, ids_batch.last])
+
+ index += 1
+ end
+ end
+ end
+
+ def down
+ # no-op
+ end
+
+ private
+
+ def split_in_consecutive_batches(relation)
+ ids = relation.pluck(:id)
+
+ (ids.first..ids.last).to_a.split {|i| !ids.include?(i) }.select(&:present?)
+ end
+end
diff --git a/db/post_migrate/20200608075553_add_index_on_user_id_and_created_at_and_source_to_ci_pipelines.rb b/db/post_migrate/20200608075553_add_index_on_user_id_and_created_at_and_source_to_ci_pipelines.rb
new file mode 100644
index 00000000000..5df9cacdff6
--- /dev/null
+++ b/db/post_migrate/20200608075553_add_index_on_user_id_and_created_at_and_source_to_ci_pipelines.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexOnUserIdAndCreatedAtAndSourceToCiPipelines < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_pipelines, [:user_id, :created_at, :source]
+ remove_concurrent_index :ci_pipelines, [:user_id, :created_at]
+ end
+
+ def down
+ add_concurrent_index :ci_pipelines, [:user_id, :created_at]
+ remove_concurrent_index :ci_pipelines, [:user_id, :created_at, :source]
+ end
+end
diff --git a/db/post_migrate/20200609002841_add_partial_index_on_locked_state_id_to_merge_requests.rb b/db/post_migrate/20200609002841_add_partial_index_on_locked_state_id_to_merge_requests.rb
new file mode 100644
index 00000000000..076c8fd8715
--- /dev/null
+++ b/db/post_migrate/20200609002841_add_partial_index_on_locked_state_id_to_merge_requests.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddPartialIndexOnLockedStateIdToMergeRequests < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = "idx_merge_requests_on_target_project_id_and_locked_state"
+ LOCKED_STATE_ID = 4
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :merge_requests, :target_project_id, where: "(state_id = #{LOCKED_STATE_ID})", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :merge_requests, name: INDEX_NAME
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index 38a8f98a1f3..7cd30c15c33 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -1,7 +1,5 @@
SET search_path=public;
-CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
-
CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
CREATE TABLE public.abuse_reports (
@@ -24,6 +22,39 @@ CREATE SEQUENCE public.abuse_reports_id_seq
ALTER SEQUENCE public.abuse_reports_id_seq OWNED BY public.abuse_reports.id;
+CREATE TABLE public.alert_management_alert_assignees (
+ id bigint NOT NULL,
+ user_id bigint NOT NULL,
+ alert_id bigint NOT NULL
+);
+
+CREATE SEQUENCE public.alert_management_alert_assignees_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.alert_management_alert_assignees_id_seq OWNED BY public.alert_management_alert_assignees.id;
+
+CREATE TABLE public.alert_management_alert_user_mentions (
+ id bigint NOT NULL,
+ alert_management_alert_id bigint NOT NULL,
+ note_id bigint,
+ mentioned_users_ids integer[],
+ mentioned_projects_ids integer[],
+ mentioned_groups_ids integer[]
+);
+
+CREATE SEQUENCE public.alert_management_alert_user_mentions_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.alert_management_alert_user_mentions_id_seq OWNED BY public.alert_management_alert_user_mentions.id;
+
CREATE TABLE public.alert_management_alerts (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -441,7 +472,14 @@ CREATE TABLE public.application_settings (
container_registry_vendor text DEFAULT ''::text NOT NULL,
container_registry_version text DEFAULT ''::text NOT NULL,
container_registry_features text[] DEFAULT '{}'::text[] NOT NULL,
+ spam_check_endpoint_url text,
+ spam_check_endpoint_enabled boolean DEFAULT false NOT NULL,
+ elasticsearch_pause_indexing boolean DEFAULT false NOT NULL,
+ repository_storages_weighted jsonb DEFAULT '{}'::jsonb NOT NULL,
+ max_import_size integer DEFAULT 50 NOT NULL,
+ enforce_pat_expiration boolean DEFAULT true NOT NULL,
CONSTRAINT check_d03919528d CHECK ((char_length(container_registry_vendor) <= 255)),
+ CONSTRAINT check_d820146492 CHECK ((char_length(spam_check_endpoint_url) <= 255)),
CONSTRAINT check_e5aba18f02 CHECK ((char_length(container_registry_version) <= 255))
);
@@ -659,7 +697,8 @@ CREATE TABLE public.audit_events (
entity_type character varying NOT NULL,
details text,
created_at timestamp without time zone,
- updated_at timestamp without time zone
+ updated_at timestamp without time zone,
+ ip_address inet
);
CREATE SEQUENCE public.audit_events_id_seq
@@ -785,6 +824,24 @@ CREATE SEQUENCE public.board_project_recent_visits_id_seq
ALTER SEQUENCE public.board_project_recent_visits_id_seq OWNED BY public.board_project_recent_visits.id;
+CREATE TABLE public.board_user_preferences (
+ id bigint NOT NULL,
+ user_id bigint NOT NULL,
+ board_id bigint NOT NULL,
+ hide_labels boolean,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE public.board_user_preferences_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.board_user_preferences_id_seq OWNED BY public.board_user_preferences.id;
+
CREATE TABLE public.boards (
id integer NOT NULL,
project_id integer,
@@ -886,6 +943,21 @@ CREATE SEQUENCE public.ci_build_needs_id_seq
ALTER SEQUENCE public.ci_build_needs_id_seq OWNED BY public.ci_build_needs.id;
+CREATE TABLE public.ci_build_report_results (
+ build_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ data jsonb DEFAULT '{}'::jsonb NOT NULL
+);
+
+CREATE SEQUENCE public.ci_build_report_results_build_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.ci_build_report_results_build_id_seq OWNED BY public.ci_build_report_results.build_id;
+
CREATE TABLE public.ci_build_trace_chunks (
id bigint NOT NULL,
build_id integer NOT NULL,
@@ -1288,7 +1360,8 @@ CREATE TABLE public.ci_pipelines (
merge_request_id integer,
source_sha bytea,
target_sha bytea,
- external_pull_request_id bigint
+ external_pull_request_id bigint,
+ ci_ref_id bigint
);
CREATE TABLE public.ci_pipelines_config (
@@ -1316,12 +1389,10 @@ ALTER SEQUENCE public.ci_pipelines_id_seq OWNED BY public.ci_pipelines.id;
CREATE TABLE public.ci_refs (
id bigint NOT NULL,
- project_id integer NOT NULL,
- lock_version integer DEFAULT 0,
- last_updated_by_pipeline_id integer,
- tag boolean DEFAULT false NOT NULL,
- ref character varying(255) NOT NULL,
- status character varying(255) NOT NULL
+ project_id bigint NOT NULL,
+ lock_version integer DEFAULT 0 NOT NULL,
+ status smallint DEFAULT 0 NOT NULL,
+ ref_path text NOT NULL
);
CREATE SEQUENCE public.ci_refs_id_seq
@@ -1971,9 +2042,9 @@ CREATE TABLE public.container_expiration_policies (
updated_at timestamp with time zone NOT NULL,
next_run_at timestamp with time zone,
name_regex character varying(255),
- cadence character varying(12) DEFAULT '7d'::character varying NOT NULL,
- older_than character varying(12),
- keep_n integer,
+ cadence character varying(12) DEFAULT '1d'::character varying NOT NULL,
+ older_than character varying(12) DEFAULT '90d'::character varying,
+ keep_n integer DEFAULT 10,
enabled boolean DEFAULT true NOT NULL,
name_regex_keep text,
CONSTRAINT container_expiration_policies_name_regex_keep CHECK ((char_length(name_regex_keep) <= 255))
@@ -3112,6 +3183,31 @@ CREATE TABLE public.group_deletion_schedules (
marked_for_deletion_on date NOT NULL
);
+CREATE TABLE public.group_deploy_keys (
+ id bigint NOT NULL,
+ user_id bigint,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ last_used_at timestamp with time zone,
+ expires_at timestamp with time zone,
+ key text NOT NULL,
+ title text,
+ fingerprint text NOT NULL,
+ fingerprint_sha256 bytea,
+ CONSTRAINT check_cc0365908d CHECK ((char_length(title) <= 255)),
+ CONSTRAINT check_e4526dcf91 CHECK ((char_length(fingerprint) <= 255)),
+ CONSTRAINT check_f58fa0a0f7 CHECK ((char_length(key) <= 4096))
+);
+
+CREATE SEQUENCE public.group_deploy_keys_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.group_deploy_keys_id_seq OWNED BY public.group_deploy_keys.id;
+
CREATE TABLE public.group_deploy_tokens (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -3153,7 +3249,7 @@ CREATE TABLE public.group_import_states (
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
status smallint DEFAULT 0 NOT NULL,
- jid text NOT NULL,
+ jid text,
last_error text,
CONSTRAINT check_87b58f6b30 CHECK ((char_length(last_error) <= 255)),
CONSTRAINT check_96558fff96 CHECK ((char_length(jid) <= 100))
@@ -3511,7 +3607,9 @@ CREATE TABLE public.jira_imports (
jid character varying(255),
jira_project_key character varying(255) NOT NULL,
jira_project_name character varying(255) NOT NULL,
- scheduled_at timestamp with time zone
+ scheduled_at timestamp with time zone,
+ error_message text,
+ CONSTRAINT check_9ed451c5b1 CHECK ((char_length(error_message) <= 1000))
);
CREATE SEQUENCE public.jira_imports_id_seq
@@ -4194,7 +4292,6 @@ CREATE TABLE public.namespaces (
cached_markdown_version integer,
project_creation_level integer,
runners_token character varying,
- trial_ends_on timestamp with time zone,
file_template_project_id integer,
saml_discovery_token character varying,
runners_token_encrypted character varying,
@@ -4480,6 +4577,21 @@ CREATE SEQUENCE public.operations_feature_flags_id_seq
ALTER SEQUENCE public.operations_feature_flags_id_seq OWNED BY public.operations_feature_flags.id;
+CREATE TABLE public.operations_feature_flags_issues (
+ id bigint NOT NULL,
+ feature_flag_id bigint NOT NULL,
+ issue_id bigint NOT NULL
+);
+
+CREATE SEQUENCE public.operations_feature_flags_issues_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.operations_feature_flags_issues_id_seq OWNED BY public.operations_feature_flags_issues.id;
+
CREATE TABLE public.operations_scopes (
id bigint NOT NULL,
strategy_id bigint NOT NULL,
@@ -4560,6 +4672,12 @@ CREATE SEQUENCE public.packages_build_infos_id_seq
ALTER SEQUENCE public.packages_build_infos_id_seq OWNED BY public.packages_build_infos.id;
+CREATE TABLE public.packages_composer_metadata (
+ package_id bigint NOT NULL,
+ target_sha bytea NOT NULL,
+ composer_json jsonb DEFAULT '{}'::jsonb NOT NULL
+);
+
CREATE TABLE public.packages_conan_file_metadata (
id bigint NOT NULL,
package_file_id bigint NOT NULL,
@@ -4861,7 +4979,8 @@ CREATE TABLE public.plan_limits (
group_hooks integer DEFAULT 50 NOT NULL,
ci_project_subscriptions integer DEFAULT 2 NOT NULL,
ci_pipeline_schedules integer DEFAULT 10 NOT NULL,
- offset_pagination_limit integer DEFAULT 50000 NOT NULL
+ offset_pagination_limit integer DEFAULT 50000 NOT NULL,
+ ci_instance_level_variables integer DEFAULT 25 NOT NULL
);
CREATE SEQUENCE public.plan_limits_id_seq
@@ -4923,6 +5042,11 @@ CREATE SEQUENCE public.programming_languages_id_seq
ALTER SEQUENCE public.programming_languages_id_seq OWNED BY public.programming_languages.id;
+CREATE TABLE public.project_access_tokens (
+ personal_access_token_id bigint NOT NULL,
+ project_id bigint NOT NULL
+);
+
CREATE TABLE public.project_alerting_settings (
project_id integer NOT NULL,
encrypted_token character varying NOT NULL,
@@ -5150,7 +5274,7 @@ ALTER SEQUENCE public.project_import_data_id_seq OWNED BY public.project_import_
CREATE TABLE public.project_incident_management_settings (
project_id integer NOT NULL,
- create_issue boolean DEFAULT true NOT NULL,
+ create_issue boolean DEFAULT false NOT NULL,
send_email boolean DEFAULT false NOT NULL,
issue_template_key text
);
@@ -5166,7 +5290,8 @@ ALTER SEQUENCE public.project_incident_management_settings_project_id_seq OWNED
CREATE TABLE public.project_metrics_settings (
project_id integer NOT NULL,
- external_dashboard_url character varying NOT NULL
+ external_dashboard_url character varying,
+ dashboard_timezone smallint DEFAULT 0 NOT NULL
);
CREATE TABLE public.project_mirror_data (
@@ -5259,12 +5384,32 @@ CREATE SEQUENCE public.project_repository_storage_moves_id_seq
ALTER SEQUENCE public.project_repository_storage_moves_id_seq OWNED BY public.project_repository_storage_moves.id;
+CREATE TABLE public.project_security_settings (
+ project_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ auto_fix_container_scanning boolean DEFAULT true NOT NULL,
+ auto_fix_dast boolean DEFAULT true NOT NULL,
+ auto_fix_dependency_scanning boolean DEFAULT true NOT NULL,
+ auto_fix_sast boolean DEFAULT true NOT NULL
+);
+
+CREATE SEQUENCE public.project_security_settings_project_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.project_security_settings_project_id_seq OWNED BY public.project_security_settings.project_id;
+
CREATE TABLE public.project_settings (
project_id integer NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
push_rule_id bigint,
show_default_award_emojis boolean DEFAULT true,
+ allow_merge_on_skipped_pipeline boolean,
CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL))
);
@@ -5679,7 +5824,8 @@ CREATE TABLE public.release_links (
name character varying NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
- filepath character varying(128)
+ filepath character varying(128),
+ link_type smallint DEFAULT 0
);
CREATE SEQUENCE public.release_links_id_seq
@@ -5773,6 +5919,25 @@ CREATE SEQUENCE public.requirements_id_seq
ALTER SEQUENCE public.requirements_id_seq OWNED BY public.requirements.id;
+CREATE TABLE public.requirements_management_test_reports (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ requirement_id bigint NOT NULL,
+ pipeline_id bigint,
+ author_id bigint,
+ state smallint NOT NULL,
+ build_id bigint
+);
+
+CREATE SEQUENCE public.requirements_management_test_reports_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.requirements_management_test_reports_id_seq OWNED BY public.requirements_management_test_reports.id;
+
CREATE TABLE public.resource_label_events (
id bigint NOT NULL,
action integer NOT NULL,
@@ -5798,7 +5963,7 @@ ALTER SEQUENCE public.resource_label_events_id_seq OWNED BY public.resource_labe
CREATE TABLE public.resource_milestone_events (
id bigint NOT NULL,
- user_id bigint NOT NULL,
+ user_id bigint,
issue_id bigint,
merge_request_id bigint,
milestone_id bigint,
@@ -5818,13 +5983,13 @@ ALTER SEQUENCE public.resource_milestone_events_id_seq OWNED BY public.resource_
CREATE TABLE public.resource_state_events (
id bigint NOT NULL,
- user_id bigint NOT NULL,
+ user_id bigint,
issue_id bigint,
merge_request_id bigint,
created_at timestamp with time zone NOT NULL,
state smallint NOT NULL,
epic_id integer,
- CONSTRAINT resource_state_events_must_belong_to_issue_or_merge_request CHECK ((((issue_id <> NULL::bigint) AND (merge_request_id IS NULL)) OR ((merge_request_id <> NULL::bigint) AND (issue_id IS NULL))))
+ CONSTRAINT state_events_must_belong_to_issue_or_merge_request_or_epic CHECK ((((issue_id <> NULL::bigint) AND (merge_request_id IS NULL) AND (epic_id IS NULL)) OR ((issue_id IS NULL) AND (merge_request_id <> NULL::bigint) AND (epic_id IS NULL)) OR ((issue_id IS NULL) AND (merge_request_id IS NULL) AND (epic_id <> NULL::integer))))
);
CREATE SEQUENCE public.resource_state_events_id_seq
@@ -5838,7 +6003,7 @@ ALTER SEQUENCE public.resource_state_events_id_seq OWNED BY public.resource_stat
CREATE TABLE public.resource_weight_events (
id bigint NOT NULL,
- user_id bigint NOT NULL,
+ user_id bigint,
issue_id bigint NOT NULL,
weight integer,
created_at timestamp with time zone NOT NULL
@@ -6073,7 +6238,8 @@ CREATE TABLE public.services (
template boolean DEFAULT false,
instance boolean DEFAULT false NOT NULL,
comment_detail smallint,
- inherit_from_id bigint
+ inherit_from_id bigint,
+ alert_events boolean
);
CREATE SEQUENCE public.services_id_seq
@@ -6483,7 +6649,8 @@ CREATE TABLE public.todos (
updated_at timestamp without time zone,
note_id integer,
commit_id character varying,
- group_id integer
+ group_id integer,
+ resolved_by_action smallint
);
CREATE SEQUENCE public.todos_id_seq
@@ -6673,7 +6840,8 @@ CREATE TABLE public.user_preferences (
setup_for_company boolean,
render_whitespace_in_code boolean,
tab_width smallint,
- feature_filter_type bigint
+ feature_filter_type bigint,
+ experience_level smallint
);
CREATE SEQUENCE public.user_preferences_id_seq
@@ -6783,7 +6951,6 @@ CREATE TABLE public.users (
auditor boolean DEFAULT false NOT NULL,
require_two_factor_authentication_from_group boolean DEFAULT false NOT NULL,
two_factor_grace_period integer DEFAULT 48 NOT NULL,
- ghost boolean,
last_activity_on date,
notified_of_own_activity boolean,
preferred_language character varying,
@@ -7283,6 +7450,10 @@ ALTER SEQUENCE public.zoom_meetings_id_seq OWNED BY public.zoom_meetings.id;
ALTER TABLE ONLY public.abuse_reports ALTER COLUMN id SET DEFAULT nextval('public.abuse_reports_id_seq'::regclass);
+ALTER TABLE ONLY public.alert_management_alert_assignees ALTER COLUMN id SET DEFAULT nextval('public.alert_management_alert_assignees_id_seq'::regclass);
+
+ALTER TABLE ONLY public.alert_management_alert_user_mentions ALTER COLUMN id SET DEFAULT nextval('public.alert_management_alert_user_mentions_id_seq'::regclass);
+
ALTER TABLE ONLY public.alert_management_alerts ALTER COLUMN id SET DEFAULT nextval('public.alert_management_alerts_id_seq'::regclass);
ALTER TABLE ONLY public.alerts_service_data ALTER COLUMN id SET DEFAULT nextval('public.alerts_service_data_id_seq'::regclass);
@@ -7335,6 +7506,8 @@ ALTER TABLE ONLY public.board_labels ALTER COLUMN id SET DEFAULT nextval('public
ALTER TABLE ONLY public.board_project_recent_visits ALTER COLUMN id SET DEFAULT nextval('public.board_project_recent_visits_id_seq'::regclass);
+ALTER TABLE ONLY public.board_user_preferences ALTER COLUMN id SET DEFAULT nextval('public.board_user_preferences_id_seq'::regclass);
+
ALTER TABLE ONLY public.boards ALTER COLUMN id SET DEFAULT nextval('public.boards_id_seq'::regclass);
ALTER TABLE ONLY public.broadcast_messages ALTER COLUMN id SET DEFAULT nextval('public.broadcast_messages_id_seq'::regclass);
@@ -7345,6 +7518,8 @@ ALTER TABLE ONLY public.chat_teams ALTER COLUMN id SET DEFAULT nextval('public.c
ALTER TABLE ONLY public.ci_build_needs ALTER COLUMN id SET DEFAULT nextval('public.ci_build_needs_id_seq'::regclass);
+ALTER TABLE ONLY public.ci_build_report_results ALTER COLUMN build_id SET DEFAULT nextval('public.ci_build_report_results_build_id_seq'::regclass);
+
ALTER TABLE ONLY public.ci_build_trace_chunks ALTER COLUMN id SET DEFAULT nextval('public.ci_build_trace_chunks_id_seq'::regclass);
ALTER TABLE ONLY public.ci_build_trace_section_names ALTER COLUMN id SET DEFAULT nextval('public.ci_build_trace_section_names_id_seq'::regclass);
@@ -7547,6 +7722,8 @@ ALTER TABLE ONLY public.grafana_integrations ALTER COLUMN id SET DEFAULT nextval
ALTER TABLE ONLY public.group_custom_attributes ALTER COLUMN id SET DEFAULT nextval('public.group_custom_attributes_id_seq'::regclass);
+ALTER TABLE ONLY public.group_deploy_keys ALTER COLUMN id SET DEFAULT nextval('public.group_deploy_keys_id_seq'::regclass);
+
ALTER TABLE ONLY public.group_deploy_tokens ALTER COLUMN id SET DEFAULT nextval('public.group_deploy_tokens_id_seq'::regclass);
ALTER TABLE ONLY public.group_group_links ALTER COLUMN id SET DEFAULT nextval('public.group_group_links_id_seq'::regclass);
@@ -7661,6 +7838,8 @@ ALTER TABLE ONLY public.operations_feature_flags ALTER COLUMN id SET DEFAULT nex
ALTER TABLE ONLY public.operations_feature_flags_clients ALTER COLUMN id SET DEFAULT nextval('public.operations_feature_flags_clients_id_seq'::regclass);
+ALTER TABLE ONLY public.operations_feature_flags_issues ALTER COLUMN id SET DEFAULT nextval('public.operations_feature_flags_issues_id_seq'::regclass);
+
ALTER TABLE ONLY public.operations_scopes ALTER COLUMN id SET DEFAULT nextval('public.operations_scopes_id_seq'::regclass);
ALTER TABLE ONLY public.operations_strategies ALTER COLUMN id SET DEFAULT nextval('public.operations_strategies_id_seq'::regclass);
@@ -7737,6 +7916,8 @@ ALTER TABLE ONLY public.project_repository_states ALTER COLUMN id SET DEFAULT ne
ALTER TABLE ONLY public.project_repository_storage_moves ALTER COLUMN id SET DEFAULT nextval('public.project_repository_storage_moves_id_seq'::regclass);
+ALTER TABLE ONLY public.project_security_settings ALTER COLUMN project_id SET DEFAULT nextval('public.project_security_settings_project_id_seq'::regclass);
+
ALTER TABLE ONLY public.project_statistics ALTER COLUMN id SET DEFAULT nextval('public.project_statistics_id_seq'::regclass);
ALTER TABLE ONLY public.project_tracing_settings ALTER COLUMN id SET DEFAULT nextval('public.project_tracing_settings_id_seq'::regclass);
@@ -7777,6 +7958,8 @@ ALTER TABLE ONLY public.remote_mirrors ALTER COLUMN id SET DEFAULT nextval('publ
ALTER TABLE ONLY public.requirements ALTER COLUMN id SET DEFAULT nextval('public.requirements_id_seq'::regclass);
+ALTER TABLE ONLY public.requirements_management_test_reports ALTER COLUMN id SET DEFAULT nextval('public.requirements_management_test_reports_id_seq'::regclass);
+
ALTER TABLE ONLY public.resource_label_events ALTER COLUMN id SET DEFAULT nextval('public.resource_label_events_id_seq'::regclass);
ALTER TABLE ONLY public.resource_milestone_events ALTER COLUMN id SET DEFAULT nextval('public.resource_milestone_events_id_seq'::regclass);
@@ -7914,6 +8097,12 @@ ALTER TABLE ONLY public.zoom_meetings ALTER COLUMN id SET DEFAULT nextval('publi
ALTER TABLE ONLY public.abuse_reports
ADD CONSTRAINT abuse_reports_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY public.alert_management_alert_assignees
+ ADD CONSTRAINT alert_management_alert_assignees_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.alert_management_alert_user_mentions
+ ADD CONSTRAINT alert_management_alert_user_mentions_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY public.alert_management_alerts
ADD CONSTRAINT alert_management_alerts_pkey PRIMARY KEY (id);
@@ -7998,6 +8187,9 @@ ALTER TABLE ONLY public.board_labels
ALTER TABLE ONLY public.board_project_recent_visits
ADD CONSTRAINT board_project_recent_visits_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY public.board_user_preferences
+ ADD CONSTRAINT board_user_preferences_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY public.boards
ADD CONSTRAINT boards_pkey PRIMARY KEY (id);
@@ -8010,6 +8202,9 @@ ALTER TABLE ONLY public.chat_names
ALTER TABLE ONLY public.chat_teams
ADD CONSTRAINT chat_teams_pkey PRIMARY KEY (id);
+ALTER TABLE public.design_management_designs
+ ADD CONSTRAINT check_07155e2715 CHECK ((char_length((filename)::text) <= 255)) NOT VALID;
+
ALTER TABLE public.ci_job_artifacts
ADD CONSTRAINT check_27f0f6dbab CHECK ((file_store IS NOT NULL)) NOT VALID;
@@ -8022,6 +8217,9 @@ ALTER TABLE public.lfs_objects
ALTER TABLE ONLY public.ci_build_needs
ADD CONSTRAINT ci_build_needs_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY public.ci_build_report_results
+ ADD CONSTRAINT ci_build_report_results_pkey PRIMARY KEY (build_id);
+
ALTER TABLE ONLY public.ci_build_trace_chunks
ADD CONSTRAINT ci_build_trace_chunks_pkey PRIMARY KEY (id);
@@ -8334,6 +8532,9 @@ ALTER TABLE ONLY public.group_custom_attributes
ALTER TABLE ONLY public.group_deletion_schedules
ADD CONSTRAINT group_deletion_schedules_pkey PRIMARY KEY (group_id);
+ALTER TABLE ONLY public.group_deploy_keys
+ ADD CONSTRAINT group_deploy_keys_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY public.group_deploy_tokens
ADD CONSTRAINT group_deploy_tokens_pkey PRIMARY KEY (id);
@@ -8511,6 +8712,9 @@ ALTER TABLE ONLY public.operations_feature_flag_scopes
ALTER TABLE ONLY public.operations_feature_flags_clients
ADD CONSTRAINT operations_feature_flags_clients_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY public.operations_feature_flags_issues
+ ADD CONSTRAINT operations_feature_flags_issues_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY public.operations_feature_flags
ADD CONSTRAINT operations_feature_flags_pkey PRIMARY KEY (id);
@@ -8529,6 +8733,9 @@ ALTER TABLE ONLY public.operations_user_lists
ALTER TABLE ONLY public.packages_build_infos
ADD CONSTRAINT packages_build_infos_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY public.packages_composer_metadata
+ ADD CONSTRAINT packages_composer_metadata_pkey PRIMARY KEY (package_id);
+
ALTER TABLE ONLY public.packages_conan_file_metadata
ADD CONSTRAINT packages_conan_file_metadata_pkey PRIMARY KEY (id);
@@ -8589,6 +8796,9 @@ ALTER TABLE ONLY public.pool_repositories
ALTER TABLE ONLY public.programming_languages
ADD CONSTRAINT programming_languages_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY public.project_access_tokens
+ ADD CONSTRAINT project_access_tokens_pkey PRIMARY KEY (personal_access_token_id, project_id);
+
ALTER TABLE ONLY public.project_alerting_settings
ADD CONSTRAINT project_alerting_settings_pkey PRIMARY KEY (project_id);
@@ -8649,6 +8859,9 @@ ALTER TABLE ONLY public.project_repository_states
ALTER TABLE ONLY public.project_repository_storage_moves
ADD CONSTRAINT project_repository_storage_moves_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY public.project_security_settings
+ ADD CONSTRAINT project_security_settings_pkey PRIMARY KEY (project_id);
+
ALTER TABLE ONLY public.project_settings
ADD CONSTRAINT project_settings_pkey PRIMARY KEY (project_id);
@@ -8709,6 +8922,9 @@ ALTER TABLE ONLY public.releases
ALTER TABLE ONLY public.remote_mirrors
ADD CONSTRAINT remote_mirrors_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY public.requirements_management_test_reports
+ ADD CONSTRAINT requirements_management_test_reports_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY public.requirements
ADD CONSTRAINT requirements_pkey PRIMARY KEY (id);
@@ -8952,8 +9168,6 @@ CREATE UNIQUE INDEX design_management_designs_versions_uniqueness ON public.desi
CREATE INDEX design_user_mentions_on_design_id_and_note_id_index ON public.design_user_mentions USING btree (design_id, note_id);
-CREATE INDEX dev_index_route_on_path_trigram ON public.routes USING gin (path public.gin_trgm_ops);
-
CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_and_note_id_index ON public.epic_user_mentions USING btree (epic_id, note_id);
CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_index ON public.epic_user_mentions USING btree (epic_id) WHERE (note_id IS NULL);
@@ -8990,6 +9204,8 @@ CREATE INDEX idx_merge_requests_on_state_id_and_merge_status ON public.merge_req
CREATE INDEX idx_merge_requests_on_target_project_id_and_iid_opened ON public.merge_requests USING btree (target_project_id, iid) WHERE (state_id = 1);
+CREATE INDEX idx_merge_requests_on_target_project_id_and_locked_state ON public.merge_requests USING btree (target_project_id) WHERE (state_id = 4);
+
CREATE UNIQUE INDEX idx_metrics_users_starred_dashboard_on_user_project_dashboard ON public.metrics_users_starred_dashboards USING btree (user_id, project_id, dashboard_path);
CREATE INDEX idx_mr_cc_diff_files_on_mr_cc_id_and_sha ON public.merge_request_context_commit_diff_files USING btree (merge_request_context_commit_id, sha);
@@ -9030,12 +9246,22 @@ CREATE UNIQUE INDEX idx_vulnerability_issue_links_on_vulnerability_id_and_link_t
CREATE INDEX index_abuse_reports_on_user_id ON public.abuse_reports USING btree (user_id);
+CREATE INDEX index_alert_assignees_on_alert_id ON public.alert_management_alert_assignees USING btree (alert_id);
+
+CREATE UNIQUE INDEX index_alert_assignees_on_user_id_and_alert_id ON public.alert_management_alert_assignees USING btree (user_id, alert_id);
+
CREATE INDEX index_alert_management_alerts_on_issue_id ON public.alert_management_alerts USING btree (issue_id);
CREATE UNIQUE INDEX index_alert_management_alerts_on_project_id_and_fingerprint ON public.alert_management_alerts USING btree (project_id, fingerprint);
CREATE UNIQUE INDEX index_alert_management_alerts_on_project_id_and_iid ON public.alert_management_alerts USING btree (project_id, iid);
+CREATE UNIQUE INDEX index_alert_user_mentions_on_alert_id ON public.alert_management_alert_user_mentions USING btree (alert_management_alert_id) WHERE (note_id IS NULL);
+
+CREATE UNIQUE INDEX index_alert_user_mentions_on_alert_id_and_note_id ON public.alert_management_alert_user_mentions USING btree (alert_management_alert_id, note_id);
+
+CREATE UNIQUE INDEX index_alert_user_mentions_on_note_id ON public.alert_management_alert_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL);
+
CREATE INDEX index_alerts_service_data_on_service_id ON public.alerts_service_data USING btree (service_id);
CREATE INDEX index_allowed_email_domains_on_group_id ON public.allowed_email_domains USING btree (group_id);
@@ -9126,6 +9352,8 @@ CREATE INDEX index_approvers_on_user_id ON public.approvers USING btree (user_id
CREATE INDEX index_audit_events_on_entity_id_and_entity_type_and_id_desc ON public.audit_events USING btree (entity_id, entity_type, id DESC);
+CREATE INDEX index_audit_events_on_ruby_object_in_details ON public.audit_events USING btree (id) WHERE (details ~~ '%ruby/object%'::text);
+
CREATE INDEX index_award_emoji_on_awardable_type_and_awardable_id ON public.award_emoji USING btree (awardable_type, awardable_id);
CREATE INDEX index_award_emoji_on_user_id_and_name ON public.award_emoji USING btree (user_id, name);
@@ -9162,6 +9390,12 @@ CREATE INDEX index_board_project_recent_visits_on_user_id ON public.board_projec
CREATE UNIQUE INDEX index_board_project_recent_visits_on_user_project_and_board ON public.board_project_recent_visits USING btree (user_id, project_id, board_id);
+CREATE INDEX index_board_user_preferences_on_board_id ON public.board_user_preferences USING btree (board_id);
+
+CREATE INDEX index_board_user_preferences_on_user_id ON public.board_user_preferences USING btree (user_id);
+
+CREATE UNIQUE INDEX index_board_user_preferences_on_user_id_and_board_id ON public.board_user_preferences USING btree (user_id, board_id);
+
CREATE INDEX index_boards_on_group_id ON public.boards USING btree (group_id);
CREATE INDEX index_boards_on_milestone_id ON public.boards USING btree (milestone_id);
@@ -9180,6 +9414,8 @@ CREATE UNIQUE INDEX index_chat_teams_on_namespace_id ON public.chat_teams USING
CREATE UNIQUE INDEX index_ci_build_needs_on_build_id_and_name ON public.ci_build_needs USING btree (build_id, name);
+CREATE INDEX index_ci_build_report_results_on_project_id ON public.ci_build_report_results USING btree (project_id);
+
CREATE UNIQUE INDEX index_ci_build_trace_chunks_on_build_id_and_chunk_index ON public.ci_build_trace_chunks USING btree (build_id, chunk_index);
CREATE UNIQUE INDEX index_ci_build_trace_section_names_on_project_id_and_name ON public.ci_build_trace_section_names USING btree (project_id, name);
@@ -9202,8 +9438,6 @@ CREATE INDEX index_ci_builds_on_artifacts_expire_at ON public.ci_builds USING bt
CREATE INDEX index_ci_builds_on_auto_canceled_by_id ON public.ci_builds USING btree (auto_canceled_by_id);
-CREATE INDEX index_ci_builds_on_commit_id_and_artifacts_expireatandidpartial ON public.ci_builds USING btree (commit_id, artifacts_expire_at, id) 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])));
-
CREATE INDEX index_ci_builds_on_commit_id_and_stage_idx_and_created_at ON public.ci_builds USING btree (commit_id, stage_idx, created_at);
CREATE INDEX index_ci_builds_on_commit_id_and_status_and_type ON public.ci_builds USING btree (commit_id, status, type);
@@ -9212,7 +9446,7 @@ CREATE INDEX index_ci_builds_on_commit_id_and_type_and_name_and_ref ON public.ci
CREATE INDEX index_ci_builds_on_commit_id_and_type_and_ref ON public.ci_builds USING btree (commit_id, type, ref);
-CREATE INDEX index_ci_builds_on_name_and_security_type_eq_ci_build ON public.ci_builds USING btree (name, id) 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, ('license_scanning'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text));
+CREATE INDEX index_ci_builds_on_commit_id_artifacts_expired_at_and_id ON public.ci_builds USING btree (commit_id, artifacts_expire_at, id) WHERE (((type)::text = 'Ci::Build'::text) AND ((retried = false) OR (retried IS NULL)) AND ((name)::text = ANY (ARRAY[('sast'::character varying)::text, ('secret_detection'::character varying)::text, ('dependency_scanning'::character varying)::text, ('container_scanning'::character varying)::text, ('dast'::character varying)::text])));
CREATE INDEX index_ci_builds_on_project_id_and_id ON public.ci_builds USING btree (project_id, id);
@@ -9258,6 +9492,8 @@ CREATE UNIQUE INDEX index_ci_instance_variables_on_key ON public.ci_instance_var
CREATE INDEX index_ci_job_artifacts_file_store_is_null ON public.ci_job_artifacts USING btree (id) WHERE (file_store IS NULL);
+CREATE INDEX index_ci_job_artifacts_for_terraform_reports ON public.ci_job_artifacts USING btree (project_id, id) WHERE (file_type = 18);
+
CREATE INDEX index_ci_job_artifacts_on_expire_at_and_job_id ON public.ci_job_artifacts USING btree (expire_at, job_id);
CREATE INDEX index_ci_job_artifacts_on_file_store ON public.ci_job_artifacts USING btree (file_store);
@@ -9284,14 +9520,14 @@ CREATE INDEX index_ci_pipeline_schedules_on_owner_id ON public.ci_pipeline_sched
CREATE INDEX index_ci_pipeline_schedules_on_project_id ON public.ci_pipeline_schedules USING btree (project_id);
-CREATE INDEX index_ci_pipeline_variables_on_pipeline_id ON public.ci_pipeline_variables USING btree (pipeline_id) WHERE ((key)::text = 'AUTO_DEVOPS_MODSECURITY_SEC_RULE_ENGINE'::text);
-
CREATE UNIQUE INDEX index_ci_pipeline_variables_on_pipeline_id_and_key ON public.ci_pipeline_variables USING btree (pipeline_id, key);
CREATE INDEX index_ci_pipelines_config_on_pipeline_id ON public.ci_pipelines_config USING btree (pipeline_id);
CREATE INDEX index_ci_pipelines_on_auto_canceled_by_id ON public.ci_pipelines USING btree (auto_canceled_by_id);
+CREATE INDEX index_ci_pipelines_on_ci_ref_id ON public.ci_pipelines USING btree (ci_ref_id) WHERE (ci_ref_id IS NOT NULL);
+
CREATE INDEX index_ci_pipelines_on_external_pull_request_id ON public.ci_pipelines USING btree (external_pull_request_id) WHERE (external_pull_request_id IS NOT NULL);
CREATE INDEX index_ci_pipelines_on_merge_request_id ON public.ci_pipelines USING btree (merge_request_id) WHERE (merge_request_id IS NOT NULL);
@@ -9312,15 +9548,15 @@ CREATE INDEX index_ci_pipelines_on_project_id_and_status_and_config_source ON pu
CREATE INDEX index_ci_pipelines_on_project_id_and_status_and_updated_at ON public.ci_pipelines USING btree (project_id, status, updated_at);
+CREATE INDEX index_ci_pipelines_on_project_id_and_user_id_and_status_and_ref ON public.ci_pipelines USING btree (project_id, user_id, status, ref) WHERE (source <> 12);
+
CREATE INDEX index_ci_pipelines_on_project_idandrefandiddesc ON public.ci_pipelines USING btree (project_id, ref, id DESC);
CREATE INDEX index_ci_pipelines_on_status ON public.ci_pipelines USING btree (status);
-CREATE INDEX index_ci_pipelines_on_user_id_and_created_at ON public.ci_pipelines USING btree (user_id, created_at);
+CREATE INDEX index_ci_pipelines_on_user_id_and_created_at_and_source ON public.ci_pipelines USING btree (user_id, created_at, source);
-CREATE INDEX index_ci_refs_on_last_updated_by_pipeline_id ON public.ci_refs USING btree (last_updated_by_pipeline_id);
-
-CREATE UNIQUE INDEX index_ci_refs_on_project_id_and_ref_and_tag ON public.ci_refs USING btree (project_id, ref, tag);
+CREATE UNIQUE INDEX index_ci_refs_on_project_id_and_ref_path ON public.ci_refs USING btree (project_id, ref_path);
CREATE UNIQUE INDEX index_ci_resource_groups_on_project_id_and_key ON public.ci_resource_groups USING btree (project_id, key);
@@ -9382,8 +9618,6 @@ CREATE INDEX index_ci_triggers_on_owner_id ON public.ci_triggers USING btree (ow
CREATE INDEX index_ci_triggers_on_project_id ON public.ci_triggers USING btree (project_id);
-CREATE INDEX index_ci_variables_on_project_id ON public.ci_variables USING btree (project_id) WHERE ((key)::text = 'AUTO_DEVOPS_MODSECURITY_SEC_RULE_ENGINE'::text);
-
CREATE UNIQUE INDEX index_ci_variables_on_project_id_and_key_and_environment_scope ON public.ci_variables USING btree (project_id, key, environment_scope);
CREATE UNIQUE INDEX index_cluster_groups_on_cluster_id_and_group_id ON public.cluster_groups USING btree (cluster_id, group_id);
@@ -9582,6 +9816,8 @@ CREATE INDEX index_epics_on_author_id ON public.epics USING btree (author_id);
CREATE INDEX index_epics_on_closed_by_id ON public.epics USING btree (closed_by_id);
+CREATE INDEX index_epics_on_confidential ON public.epics USING btree (confidential);
+
CREATE INDEX index_epics_on_due_date_sourcing_epic_id ON public.epics USING btree (due_date_sourcing_epic_id) WHERE (due_date_sourcing_epic_id IS NOT NULL);
CREATE INDEX index_epics_on_due_date_sourcing_milestone_id ON public.epics USING btree (due_date_sourcing_milestone_id);
@@ -9596,6 +9832,8 @@ CREATE INDEX index_epics_on_group_id_and_iid_varchar_pattern ON public.epics USI
CREATE INDEX index_epics_on_iid ON public.epics USING btree (iid);
+CREATE INDEX index_epics_on_last_edited_by_id ON public.epics USING btree (last_edited_by_id);
+
CREATE INDEX index_epics_on_lock_version ON public.epics USING btree (lock_version) WHERE (lock_version IS NULL);
CREATE INDEX index_epics_on_parent_id ON public.epics USING btree (parent_id);
@@ -9610,6 +9848,8 @@ CREATE INDEX index_events_on_action ON public.events USING btree (action);
CREATE INDEX index_events_on_author_id_and_created_at ON public.events USING btree (author_id, created_at);
+CREATE INDEX index_events_on_author_id_and_created_at_merge_requests ON public.events USING btree (author_id, created_at) WHERE ((target_type)::text = 'MergeRequest'::text);
+
CREATE INDEX index_events_on_author_id_and_project_id ON public.events USING btree (author_id, project_id);
CREATE INDEX index_events_on_group_id_partial ON public.events USING btree (group_id) WHERE (group_id IS NOT NULL);
@@ -9622,6 +9862,8 @@ CREATE INDEX index_events_on_target_type_and_target_id ON public.events USING bt
CREATE INDEX index_evidences_on_release_id ON public.evidences USING btree (release_id);
+CREATE INDEX index_expired_and_not_notified_personal_access_tokens ON public.personal_access_tokens USING btree (id, expires_at) WHERE ((impersonation = false) AND (revoked = false) AND (expire_notification_delivered = false));
+
CREATE UNIQUE INDEX index_external_pull_requests_on_project_and_branches ON public.external_pull_requests USING btree (project_id, source_branch, target_branch);
CREATE UNIQUE INDEX index_feature_flag_scopes_on_flag_id_and_environment_scope ON public.operations_feature_flag_scopes USING btree (feature_flag_id, environment_scope);
@@ -9750,6 +9992,12 @@ CREATE INDEX index_group_deletion_schedules_on_marked_for_deletion_on ON public.
CREATE INDEX index_group_deletion_schedules_on_user_id ON public.group_deletion_schedules USING btree (user_id);
+CREATE UNIQUE INDEX index_group_deploy_keys_on_fingerprint ON public.group_deploy_keys USING btree (fingerprint);
+
+CREATE INDEX index_group_deploy_keys_on_fingerprint_sha256 ON public.group_deploy_keys USING btree (fingerprint_sha256);
+
+CREATE INDEX index_group_deploy_keys_on_user_id ON public.group_deploy_keys USING btree (user_id);
+
CREATE INDEX index_group_deploy_tokens_on_deploy_token_id ON public.group_deploy_tokens USING btree (deploy_token_id);
CREATE UNIQUE INDEX index_group_deploy_tokens_on_group_and_deploy_token_ids ON public.group_deploy_tokens USING btree (group_id, deploy_token_id);
@@ -9828,6 +10076,8 @@ CREATE INDEX index_issues_on_description_trigram ON public.issues USING gin (des
CREATE INDEX index_issues_on_duplicated_to_id ON public.issues USING btree (duplicated_to_id) WHERE (duplicated_to_id IS NOT NULL);
+CREATE INDEX index_issues_on_last_edited_by_id ON public.issues USING btree (last_edited_by_id);
+
CREATE INDEX index_issues_on_lock_version ON public.issues USING btree (lock_version) WHERE (lock_version IS NULL);
CREATE INDEX index_issues_on_milestone_id ON public.issues USING btree (milestone_id);
@@ -10034,6 +10284,8 @@ CREATE INDEX index_metrics_dashboard_annotations_on_cluster_id_and_3_columns ON
CREATE INDEX index_metrics_dashboard_annotations_on_environment_id_and_3_col ON public.metrics_dashboard_annotations USING btree (environment_id, dashboard_path, starting_at, ending_at) WHERE (environment_id IS NOT NULL);
+CREATE INDEX index_metrics_dashboard_annotations_on_timespan_end ON public.metrics_dashboard_annotations USING btree (COALESCE(ending_at, starting_at));
+
CREATE INDEX index_metrics_users_starred_dashboards_on_project_id ON public.metrics_users_starred_dashboards USING btree (project_id);
CREATE INDEX index_milestone_releases_on_release_id ON public.milestone_releases USING btree (release_id);
@@ -10096,8 +10348,6 @@ CREATE UNIQUE INDEX index_namespaces_on_runners_token_encrypted ON public.namesp
CREATE INDEX index_namespaces_on_shared_and_extra_runners_minutes_limit ON public.namespaces USING btree (shared_runners_minutes_limit, extra_shared_runners_minutes_limit);
-CREATE INDEX index_namespaces_on_trial_ends_on ON public.namespaces USING btree (trial_ends_on) WHERE (trial_ends_on IS NOT NULL);
-
CREATE INDEX index_namespaces_on_type_partial ON public.namespaces USING btree (type) WHERE (type IS NOT NULL);
CREATE INDEX index_non_requested_project_members_on_source_id_and_type ON public.members USING btree (source_id, source_type) WHERE ((requested_at IS NULL) AND ((type)::text = 'ProjectMember'::text));
@@ -10156,6 +10406,8 @@ CREATE INDEX index_on_users_name_lower ON public.users USING btree (lower((name)
CREATE INDEX index_open_project_tracker_data_on_service_id ON public.open_project_tracker_data USING btree (service_id);
+CREATE INDEX index_operations_feature_flags_issues_on_issue_id ON public.operations_feature_flags_issues USING btree (issue_id);
+
CREATE UNIQUE INDEX index_operations_feature_flags_on_project_id_and_iid ON public.operations_feature_flags USING btree (project_id, iid);
CREATE UNIQUE INDEX index_operations_feature_flags_on_project_id_and_name ON public.operations_feature_flags USING btree (project_id, name);
@@ -10170,12 +10422,16 @@ CREATE UNIQUE INDEX index_operations_user_lists_on_project_id_and_iid ON public.
CREATE UNIQUE INDEX index_operations_user_lists_on_project_id_and_name ON public.operations_user_lists USING btree (project_id, name);
+CREATE UNIQUE INDEX index_ops_feature_flags_issues_on_feature_flag_id_and_issue_id ON public.operations_feature_flags_issues USING btree (feature_flag_id, issue_id);
+
CREATE UNIQUE INDEX index_ops_strategies_user_lists_on_strategy_id_and_user_list_id ON public.operations_strategies_user_lists USING btree (strategy_id, user_list_id);
CREATE UNIQUE INDEX index_packages_build_infos_on_package_id ON public.packages_build_infos USING btree (package_id);
CREATE INDEX index_packages_build_infos_on_pipeline_id ON public.packages_build_infos USING btree (pipeline_id);
+CREATE UNIQUE INDEX index_packages_composer_metadata_on_package_id_and_target_sha ON public.packages_composer_metadata USING btree (package_id, target_sha);
+
CREATE UNIQUE INDEX index_packages_conan_file_metadata_on_package_file_id ON public.packages_conan_file_metadata USING btree (package_file_id);
CREATE UNIQUE INDEX index_packages_conan_metadata_on_package_id_username_channel ON public.packages_conan_metadata USING btree (package_id, package_username, package_channel);
@@ -10258,6 +10514,8 @@ CREATE UNIQUE INDEX index_pool_repositories_on_source_project_id_and_shard_id ON
CREATE UNIQUE INDEX index_programming_languages_on_name ON public.programming_languages USING btree (name);
+CREATE INDEX index_project_access_tokens_on_project_id ON public.project_access_tokens USING btree (project_id);
+
CREATE UNIQUE INDEX index_project_aliases_on_name ON public.project_aliases USING btree (name);
CREATE INDEX index_project_aliases_on_project_id ON public.project_aliases USING btree (project_id);
@@ -10504,6 +10762,14 @@ CREATE INDEX index_remote_mirrors_on_project_id ON public.remote_mirrors USING b
CREATE UNIQUE INDEX index_repository_languages_on_project_and_languages_id ON public.repository_languages USING btree (project_id, programming_language_id);
+CREATE INDEX index_requirements_management_test_reports_on_author_id ON public.requirements_management_test_reports USING btree (author_id);
+
+CREATE INDEX index_requirements_management_test_reports_on_build_id ON public.requirements_management_test_reports USING btree (build_id);
+
+CREATE INDEX index_requirements_management_test_reports_on_pipeline_id ON public.requirements_management_test_reports USING btree (pipeline_id);
+
+CREATE INDEX index_requirements_management_test_reports_on_requirement_id ON public.requirements_management_test_reports USING btree (requirement_id);
+
CREATE INDEX index_requirements_on_author_id ON public.requirements USING btree (author_id);
CREATE INDEX index_requirements_on_created_at ON public.requirements USING btree (created_at);
@@ -10576,6 +10842,8 @@ CREATE UNIQUE INDEX index_scim_identities_on_user_id_and_group_id ON public.scim
CREATE UNIQUE INDEX index_scim_oauth_access_tokens_on_group_id_and_token_encrypted ON public.scim_oauth_access_tokens USING btree (group_id, token_encrypted);
+CREATE INDEX index_security_ci_builds_on_name_and_id ON public.ci_builds USING btree (name, id) 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, ('secret_detection'::character varying)::text, ('license_scanning'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text));
+
CREATE INDEX index_self_managed_prometheus_alert_events_on_environment_id ON public.self_managed_prometheus_alert_events USING btree (environment_id);
CREATE INDEX index_sent_notifications_on_noteable_type_noteable_id ON public.sent_notifications USING btree (noteable_id) WHERE ((noteable_type)::text = 'Issue'::text);
@@ -10602,9 +10870,9 @@ CREATE INDEX index_services_on_type ON public.services USING btree (type);
CREATE INDEX index_services_on_type_and_id_and_template_when_active ON public.services USING btree (type, id, template) WHERE (active = true);
-CREATE UNIQUE INDEX index_services_on_type_and_instance ON public.services USING btree (type, instance) WHERE (instance IS TRUE);
+CREATE UNIQUE INDEX index_services_on_type_and_instance_partial ON public.services USING btree (type, instance) WHERE (instance = true);
-CREATE UNIQUE INDEX index_services_on_type_and_template ON public.services USING btree (type, template) WHERE (template IS TRUE);
+CREATE UNIQUE INDEX index_services_on_type_and_template_partial ON public.services USING btree (type, template) WHERE (template = true);
CREATE UNIQUE INDEX index_shards_on_name ON public.shards USING btree (name);
@@ -10632,6 +10900,8 @@ CREATE INDEX index_snippets_on_description_trigram ON public.snippets USING gin
CREATE INDEX index_snippets_on_file_name_trigram ON public.snippets USING gin (file_name public.gin_trgm_ops);
+CREATE INDEX index_snippets_on_id_and_type ON public.snippets USING btree (id, type);
+
CREATE INDEX index_snippets_on_project_id_and_visibility_level ON public.snippets USING btree (project_id, visibility_level);
CREATE INDEX index_snippets_on_title_trigram ON public.snippets USING gin (title public.gin_trgm_ops);
@@ -10788,8 +11058,6 @@ CREATE INDEX index_users_on_email_trigram ON public.users USING gin (email publi
CREATE INDEX index_users_on_feed_token ON public.users USING btree (feed_token);
-CREATE INDEX index_users_on_ghost ON public.users USING btree (ghost);
-
CREATE INDEX index_users_on_group_view ON public.users USING btree (group_view);
CREATE INDEX index_users_on_incoming_email_token ON public.users USING btree (incoming_email_token);
@@ -10806,7 +11074,7 @@ CREATE UNIQUE INDEX index_users_on_reset_password_token ON public.users USING bt
CREATE INDEX index_users_on_state ON public.users USING btree (state);
-CREATE INDEX index_users_on_state_and_user_type_internal ON public.users USING btree (state, user_type) WHERE (ghost IS NOT TRUE);
+CREATE INDEX index_users_on_state_and_user_type ON public.users USING btree (state, user_type);
CREATE UNIQUE INDEX index_users_on_static_object_token ON public.users USING btree (static_object_token);
@@ -10878,8 +11146,6 @@ CREATE UNIQUE INDEX index_vulnerability_occurrence_identifiers_on_unique_keys ON
CREATE INDEX index_vulnerability_occurrence_pipelines_on_pipeline_id ON public.vulnerability_occurrence_pipelines USING btree (pipeline_id);
-CREATE INDEX index_vulnerability_occurrences_on_id_and_confidence_eq_zero ON public.vulnerability_occurrences USING btree (id) WHERE (confidence = 0);
-
CREATE INDEX index_vulnerability_occurrences_on_primary_identifier_id ON public.vulnerability_occurrences USING btree (primary_identifier_id);
CREATE INDEX index_vulnerability_occurrences_on_scanner_id ON public.vulnerability_occurrences USING btree (scanner_id);
@@ -10890,8 +11156,6 @@ CREATE UNIQUE INDEX index_vulnerability_occurrences_on_uuid ON public.vulnerabil
CREATE INDEX index_vulnerability_occurrences_on_vulnerability_id ON public.vulnerability_occurrences USING btree (vulnerability_id);
-CREATE INDEX index_vulnerability_on_id_and_confidence_eq_zero ON public.vulnerabilities USING btree (id) WHERE (confidence = 0);
-
CREATE UNIQUE INDEX index_vulnerability_scanners_on_project_id_and_external_id ON public.vulnerability_scanners USING btree (project_id, external_id);
CREATE UNIQUE INDEX index_vulnerability_user_mentions_on_note_id ON public.vulnerability_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL);
@@ -10960,6 +11224,8 @@ CREATE INDEX note_mentions_temp_index ON public.notes USING btree (id, noteable_
CREATE UNIQUE INDEX one_canonical_wiki_page_slug_per_metadata ON public.wiki_page_slugs USING btree (wiki_page_meta_id) WHERE (canonical = true);
+CREATE INDEX package_name_index ON public.packages_packages USING btree (name);
+
CREATE INDEX packages_packages_verification_checksum_partial ON public.packages_package_files USING btree (verification_checksum) WHERE (verification_checksum IS NOT NULL);
CREATE INDEX packages_packages_verification_failure_partial ON public.packages_package_files USING btree (verification_failure) WHERE (verification_failure IS NOT NULL);
@@ -11171,6 +11437,9 @@ ALTER TABLE ONLY public.deploy_keys_projects
ALTER TABLE ONLY public.issue_assignees
ADD CONSTRAINT fk_5e0c8d9154 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.project_access_tokens
+ ADD CONSTRAINT fk_5f7e8450e1 FOREIGN KEY (personal_access_token_id) REFERENCES public.personal_access_tokens(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.merge_requests
ADD CONSTRAINT fk_6149611a04 FOREIGN KEY (assignee_id) REFERENCES public.users(id) ON DELETE SET NULL;
@@ -11381,6 +11650,9 @@ ALTER TABLE ONLY public.fork_network_members
ALTER TABLE ONLY public.vulnerabilities
ADD CONSTRAINT fk_b1de915a15 FOREIGN KEY (author_id) REFERENCES public.users(id) ON DELETE SET NULL;
+ALTER TABLE ONLY public.project_access_tokens
+ ADD CONSTRAINT fk_b27801bfbf FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.protected_tag_create_access_levels
ADD CONSTRAINT fk_b4eb82fe3c FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE;
@@ -11456,6 +11728,9 @@ ALTER TABLE ONLY public.lists
ALTER TABLE ONLY public.metrics_users_starred_dashboards
ADD CONSTRAINT fk_d76a2b9a8c FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.ci_pipelines
+ ADD CONSTRAINT fk_d80e161c54 FOREIGN KEY (ci_ref_id) REFERENCES public.ci_refs(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY public.system_note_metadata
ADD CONSTRAINT fk_d83a918cb1 FOREIGN KEY (note_id) REFERENCES public.notes(id) ON DELETE CASCADE;
@@ -11591,6 +11866,9 @@ ALTER TABLE ONLY public.events
ALTER TABLE ONLY public.ip_restrictions
ADD CONSTRAINT fk_rails_04a93778d5 FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.ci_build_report_results
+ ADD CONSTRAINT fk_rails_056d298d48 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.ci_daily_build_group_report_results
ADD CONSTRAINT fk_rails_0667f7608c FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
@@ -11660,6 +11938,9 @@ ALTER TABLE ONLY public.diff_note_positions
ALTER TABLE ONLY public.users_security_dashboard_projects
ADD CONSTRAINT fk_rails_150cd5682c FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.ci_build_report_results
+ ADD CONSTRAINT fk_rails_16cb1ff064 FOREIGN KEY (build_id) REFERENCES public.ci_builds(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.project_deploy_tokens
ADD CONSTRAINT fk_rails_170e03cbaf FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
@@ -11699,9 +11980,6 @@ ALTER TABLE ONLY public.epic_user_mentions
ALTER TABLE ONLY public.approver_groups
ADD CONSTRAINT fk_rails_1cdcbd7723 FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE;
-ALTER TABLE ONLY public.ci_refs
- ADD CONSTRAINT fk_rails_1da48d19ce FOREIGN KEY (last_updated_by_pipeline_id) REFERENCES public.ci_pipelines(id) ON DELETE SET NULL;
-
ALTER TABLE ONLY public.packages_tags
ADD CONSTRAINT fk_rails_1dfc868911 FOREIGN KEY (package_id) REFERENCES public.packages_packages(id) ON DELETE CASCADE;
@@ -11729,6 +12007,9 @@ ALTER TABLE ONLY public.service_desk_settings
ALTER TABLE ONLY public.group_custom_attributes
ADD CONSTRAINT fk_rails_246e0db83a FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.requirements_management_test_reports
+ ADD CONSTRAINT fk_rails_24cecc1e68 FOREIGN KEY (pipeline_id) REFERENCES public.ci_pipelines(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY public.group_wiki_repositories
ADD CONSTRAINT fk_rails_26f867598c FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE;
@@ -11951,6 +12232,9 @@ ALTER TABLE ONLY public.clusters_applications_knative
ALTER TABLE ONLY public.terraform_states
ADD CONSTRAINT fk_rails_558901b030 FOREIGN KEY (locked_by_user_id) REFERENCES public.users(id);
+ALTER TABLE ONLY public.group_deploy_keys
+ ADD CONSTRAINT fk_rails_5682fc07f8 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE RESTRICT;
+
ALTER TABLE ONLY public.issue_user_mentions
ADD CONSTRAINT fk_rails_57581fda73 FOREIGN KEY (issue_id) REFERENCES public.issues(id) ON DELETE CASCADE;
@@ -12065,6 +12349,9 @@ ALTER TABLE ONLY public.geo_hashed_storage_migrated_events
ALTER TABLE ONLY public.plan_limits
ADD CONSTRAINT fk_rails_69f8b6184f FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.operations_feature_flags_issues
+ ADD CONSTRAINT fk_rails_6a8856ca4f FOREIGN KEY (feature_flag_id) REFERENCES public.operations_feature_flags(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.prometheus_alerts
ADD CONSTRAINT fk_rails_6d9b283465 FOREIGN KEY (environment_id) REFERENCES public.environments(id) ON DELETE CASCADE;
@@ -12164,6 +12451,9 @@ ALTER TABLE ONLY public.snippet_repositories
ALTER TABLE ONLY public.gpg_key_subkeys
ADD CONSTRAINT fk_rails_8b2c90b046 FOREIGN KEY (gpg_key_id) REFERENCES public.gpg_keys(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.board_user_preferences
+ ADD CONSTRAINT fk_rails_8b3b23ce82 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.allowed_email_domains
ADD CONSTRAINT fk_rails_8b5da859f9 FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE;
@@ -12188,6 +12478,9 @@ ALTER TABLE ONLY public.design_user_mentions
ALTER TABLE ONLY public.clusters_kubernetes_namespaces
ADD CONSTRAINT fk_rails_8df789f3ab FOREIGN KEY (environment_id) REFERENCES public.environments(id) ON DELETE SET NULL;
+ALTER TABLE ONLY public.alert_management_alert_user_mentions
+ ADD CONSTRAINT fk_rails_8e48eca0fe FOREIGN KEY (alert_management_alert_id) REFERENCES public.alert_management_alerts(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.project_daily_statistics
ADD CONSTRAINT fk_rails_8e549b272d FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
@@ -12212,6 +12505,9 @@ ALTER TABLE ONLY public.list_user_preferences
ALTER TABLE ONLY public.board_labels
ADD CONSTRAINT fk_rails_9374a16edd FOREIGN KEY (board_id) REFERENCES public.boards(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.alert_management_alert_assignees
+ ADD CONSTRAINT fk_rails_93c0f6703b FOREIGN KEY (alert_id) REFERENCES public.alert_management_alerts(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.scim_identities
ADD CONSTRAINT fk_rails_9421a0bffb FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
@@ -12320,6 +12616,9 @@ ALTER TABLE ONLY public.ci_build_trace_sections
ALTER TABLE ONLY public.clusters
ADD CONSTRAINT fk_rails_ac3a663d79 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE SET NULL;
+ALTER TABLE ONLY public.packages_composer_metadata
+ ADD CONSTRAINT fk_rails_ad48c2e5bb FOREIGN KEY (package_id) REFERENCES public.packages_packages(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.analytics_cycle_analytics_group_stages
ADD CONSTRAINT fk_rails_ae5da3409b FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE;
@@ -12470,6 +12769,9 @@ ALTER TABLE ONLY public.subscriptions
ALTER TABLE ONLY public.operations_strategies
ADD CONSTRAINT fk_rails_d183b6e6dd FOREIGN KEY (feature_flag_id) REFERENCES public.operations_feature_flags(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.requirements_management_test_reports
+ ADD CONSTRAINT fk_rails_d1e8b498bf FOREIGN KEY (author_id) REFERENCES public.users(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY public.pool_repositories
ADD CONSTRAINT fk_rails_d2711daad4 FOREIGN KEY (source_project_id) REFERENCES public.projects(id) ON DELETE SET NULL;
@@ -12479,6 +12781,9 @@ ALTER TABLE ONLY public.group_group_links
ALTER TABLE ONLY public.vulnerability_issue_links
ADD CONSTRAINT fk_rails_d459c19036 FOREIGN KEY (vulnerability_id) REFERENCES public.vulnerabilities(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.alert_management_alert_assignees
+ ADD CONSTRAINT fk_rails_d47570ac62 FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.geo_hashed_storage_attachments_events
ADD CONSTRAINT fk_rails_d496b088e9 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
@@ -12491,6 +12796,9 @@ ALTER TABLE ONLY public.dependency_proxy_blobs
ALTER TABLE ONLY public.issues_prometheus_alert_events
ADD CONSTRAINT fk_rails_db5b756534 FOREIGN KEY (issue_id) REFERENCES public.issues(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.board_user_preferences
+ ADD CONSTRAINT fk_rails_dbebdaa8fe FOREIGN KEY (board_id) REFERENCES public.boards(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.vulnerability_occurrence_pipelines
ADD CONSTRAINT fk_rails_dc3ae04693 FOREIGN KEY (occurrence_id) REFERENCES public.vulnerability_occurrences(id) ON DELETE CASCADE;
@@ -12530,6 +12838,9 @@ ALTER TABLE ONLY public.approval_merge_request_rule_sources
ALTER TABLE ONLY public.prometheus_alerts
ADD CONSTRAINT fk_rails_e6351447ec FOREIGN KEY (prometheus_metric_id) REFERENCES public.prometheus_metrics(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.requirements_management_test_reports
+ ADD CONSTRAINT fk_rails_e67d085910 FOREIGN KEY (build_id) REFERENCES public.ci_builds(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY public.merge_request_metrics
ADD CONSTRAINT fk_rails_e6d7c24d1b FOREIGN KEY (merge_request_id) REFERENCES public.merge_requests(id) ON DELETE CASCADE;
@@ -12548,12 +12859,18 @@ ALTER TABLE ONLY public.merge_request_blocks
ALTER TABLE ONLY public.protected_branch_unprotect_access_levels
ADD CONSTRAINT fk_rails_e9eb8dc025 FOREIGN KEY (protected_branch_id) REFERENCES public.protected_branches(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.alert_management_alert_user_mentions
+ ADD CONSTRAINT fk_rails_eb2de0cdef FOREIGN KEY (note_id) REFERENCES public.notes(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.ci_daily_report_results
ADD CONSTRAINT fk_rails_ebc2931b90 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY public.cluster_providers_aws
ADD CONSTRAINT fk_rails_ed1fdfaeb2 FOREIGN KEY (created_by_user_id) REFERENCES public.users(id) ON DELETE SET NULL;
+ALTER TABLE ONLY public.project_security_settings
+ ADD CONSTRAINT fk_rails_ed4abe1338 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.ci_daily_build_group_report_results
ADD CONSTRAINT fk_rails_ee072d13b3 FOREIGN KEY (last_pipeline_id) REFERENCES public.ci_pipelines(id) ON DELETE CASCADE;
@@ -12614,6 +12931,12 @@ ALTER TABLE ONLY public.merge_trains
ALTER TABLE ONLY public.ci_runner_namespaces
ADD CONSTRAINT fk_rails_f9d9ed3308 FOREIGN KEY (namespace_id) REFERENCES public.namespaces(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.requirements_management_test_reports
+ ADD CONSTRAINT fk_rails_fb3308ad55 FOREIGN KEY (requirement_id) REFERENCES public.requirements(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.operations_feature_flags_issues
+ ADD CONSTRAINT fk_rails_fb4d2a7cb1 FOREIGN KEY (issue_id) REFERENCES public.issues(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.board_project_recent_visits
ADD CONSTRAINT fk_rails_fb6fc419cb FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
@@ -12648,282 +12971,6 @@ ALTER TABLE ONLY public.u2f_registrations
ADD CONSTRAINT fk_u2f_registrations_user_id FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
COPY "schema_migrations" (version) FROM STDIN;
-20171230123729
-20180101160629
-20180101160630
-20180102220145
-20180103123548
-20180104131052
-20180105212544
-20180109183319
-20180113220114
-20180115094742
-20180115113902
-20180115201419
-20180116193854
-20180119121225
-20180119135717
-20180119160751
-20180122154930
-20180122162010
-20180125214301
-20180129193323
-20180201102129
-20180201110056
-20180201145907
-20180204200836
-20180206200543
-20180208183958
-20180209115333
-20180209165249
-20180212030105
-20180212101828
-20180212101928
-20180212102028
-20180213131630
-20180214093516
-20180214155405
-20180215181245
-20180216120000
-20180216120010
-20180216120020
-20180216120030
-20180216120040
-20180216120050
-20180216121020
-20180216121030
-20180219153455
-20180220150310
-20180221151752
-20180222043024
-20180223120443
-20180223124427
-20180223144945
-20180226050030
-20180227182112
-20180228172924
-20180301010859
-20180301084653
-20180302152117
-20180305095250
-20180305100050
-20180305144721
-20180306074045
-20180306134842
-20180306164012
-20180307012445
-20180308052825
-20180308125206
-20180309121820
-20180309160427
-20180314100728
-20180314145917
-20180315160435
-20180319190020
-20180320182229
-20180323150945
-20180326202229
-20180327101207
-20180330121048
-20180403035759
-20180405101928
-20180405142733
-20180408143354
-20180408143355
-20180409170809
-20180413022611
-20180416155103
-20180417090132
-20180417101040
-20180417101940
-20180418053107
-20180420010016
-20180420010616
-20180420080616
-20180423204600
-20180424090541
-20180424134533
-20180424151928
-20180424160449
-20180425075446
-20180425131009
-20180425205249
-20180426102016
-20180430101916
-20180430143705
-20180502122856
-20180503131624
-20180503141722
-20180503150427
-20180503175053
-20180503175054
-20180503193542
-20180503193953
-20180503200320
-20180504195842
-20180507083701
-20180508055821
-20180508100222
-20180508102840
-20180508135515
-20180511090724
-20180511131058
-20180511174224
-20180512061621
-20180514161336
-20180515005612
-20180515121227
-20180517082340
-20180523042841
-20180523125103
-20180524132016
-20180529093006
-20180529152628
-20180530135500
-20180531185349
-20180531220618
-20180601213245
-20180603190921
-20180604123514
-20180607071808
-20180608091413
-20180608110058
-20180608201435
-20180612103626
-20180613081317
-20180625113853
-20180626125654
-20180628124813
-20180629153018
-20180629191052
-20180702120647
-20180702124358
-20180702134423
-20180704145007
-20180704204006
-20180705160945
-20180706223200
-20180710162338
-20180711103851
-20180711103922
-20180713092803
-20180717125853
-20180718005113
-20180720023512
-20180722103201
-20180723135214
-20180726172057
-20180807153545
-20180808162000
-20180809195358
-20180813101999
-20180813102000
-20180814153625
-20180815040323
-20180815160409
-20180815170510
-20180815175440
-20180816161409
-20180816193530
-20180824202952
-20180826111825
-20180831164905
-20180831164907
-20180831164908
-20180831164909
-20180831164910
-20180901171833
-20180901200537
-20180902070406
-20180906101639
-20180907015926
-20180910115836
-20180910153412
-20180910153413
-20180912111628
-20180913142237
-20180914162043
-20180914201132
-20180916011959
-20180917172041
-20180924141949
-20180924190739
-20180924201039
-20180925200829
-20180927073410
-20181002172433
-20181005110927
-20181005125926
-20181006004100
-20181008145341
-20181008145359
-20181008200441
-20181009190428
-20181010133639
-20181010235606
-20181013005024
-20181014203236
-20181015155839
-20181016141739
-20181016152238
-20181017001059
-20181019032400
-20181019032408
-20181019105553
-20181022135539
-20181022173835
-20181023104858
-20181023144439
-20181025115728
-20181026091631
-20181026143227
-20181027114222
-20181028120717
-20181030135124
-20181030154446
-20181031145139
-20181031190558
-20181031190559
-20181101091005
-20181101091124
-20181101144347
-20181101191341
-20181105201455
-20181106135939
-20181107054254
-20181108091549
-20181112103239
-20181115140140
-20181116050532
-20181116141415
-20181116141504
-20181119081539
-20181119132520
-20181120082911
-20181120091639
-20181120151656
-20181121101842
-20181121101843
-20181121111200
-20181122160027
-20181123042307
-20181123135036
-20181123144235
-20181126150622
-20181126153547
-20181128123704
-20181129104854
-20181129104944
-20181130102132
-20181203002526
-20181205171941
-20181211092510
-20181211092514
-20181212104941
-20181212171634
-20181219130552
-20181219145520
-20181219145521
20181228175414
20190102152410
20190103140724
@@ -13700,6 +13747,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200323134519
20200324093258
20200324115359
+20200325094612
20200325104755
20200325104756
20200325104833
@@ -13720,6 +13768,11 @@ COPY "schema_migrations" (version) FROM STDIN;
20200330121000
20200330123739
20200330132913
+20200330203826
+20200330203837
+20200331103637
+20200331113728
+20200331113738
20200331132103
20200331195952
20200331220930
@@ -13756,6 +13809,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200407222647
20200408110856
20200408125046
+20200408132152
20200408133211
20200408153842
20200408154331
@@ -13805,8 +13859,11 @@ COPY "schema_migrations" (version) FROM STDIN;
20200420172752
20200420172927
20200420201933
+20200421054930
+20200421054948
20200421092907
20200421111005
+20200421195234
20200421233150
20200422091541
20200422213749
@@ -13826,11 +13883,14 @@ COPY "schema_migrations" (version) FROM STDIN;
20200429001827
20200429002150
20200429015603
+20200429023324
20200429181335
20200429181955
20200429182245
20200430103158
+20200430123614
20200430130048
+20200430174637
20200505164958
20200505171834
20200505172405
@@ -13838,7 +13898,11 @@ COPY "schema_migrations" (version) FROM STDIN;
20200506125731
20200506154421
20200507221434
+20200508021128
+20200508050301
20200508091106
+20200508140959
+20200508203901
20200511080113
20200511083541
20200511092246
@@ -13854,9 +13918,14 @@ COPY "schema_migrations" (version) FROM STDIN;
20200511145545
20200511162057
20200511162115
+20200511181027
+20200511191027
+20200511208012
20200511220023
20200512085150
+20200512160004
20200512164334
+20200512195442
20200513160930
20200513171959
20200513224143
@@ -13867,5 +13936,67 @@ COPY "schema_migrations" (version) FROM STDIN;
20200514000132
20200514000340
20200515155620
+20200518091745
+20200518114540
+20200518133123
+20200519074709
+20200519101002
+20200519115908
+20200519141534
+20200519171058
+20200519194042
+20200520103514
+20200521022725
+20200521225327
+20200521225337
+20200521225346
+20200522235146
+20200525114553
+20200525121014
+20200525144525
+20200526000407
+20200526013844
+20200526120714
+20200526142550
+20200526153844
+20200526164946
+20200526164947
+20200527092027
+20200527094322
+20200527095401
+20200527135313
+20200527151413
+20200527152116
+20200527152657
+20200527170649
+20200527211000
+20200528054112
+20200528123703
+20200528125905
+20200528171933
+20200601210148
+20200602013900
+20200602013901
+20200602143020
+20200603073101
+20200603180338
+20200604143628
+20200604145731
+20200604174544
+20200604174558
+20200605003204
+20200605093113
+20200608072931
+20200608075553
+20200608214008
+20200609002841
+20200609142506
+20200609142507
+20200609142508
+20200609212701
+20200615083635
+20200615121217
+20200615123055
+20200615232735
\.