summaryrefslogtreecommitdiff
path: root/db/migrate
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/migrate
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'db/migrate')
-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
310 files changed, 2491 insertions, 5105 deletions
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