From 7e9c479f7de77702622631cff2628a9c8dcbc627 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 19 Nov 2020 08:27:35 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-6-stable-ee --- db/fixtures/development/02_application_settings.rb | 3 + db/fixtures/development/12_snippets.rb | 26 +- db/fixtures/production/010_settings.rb | 4 + ...8212414_add_feature_flag_events_to_web_hooks.rb | 9 + ...licy_worker_settings_to_application_settings.rb | 19 + ...icy_cleanup_status_to_container_repositories.rb | 26 + ...d_ci_jwt_signing_key_to_application_settings.rb | 13 + ...ion_settings_encrypted_ci_jwt_signing_key_iv.rb | 17 + .../20201008013434_generate_ci_jwt_signing_key.rb | 32 ++ ...01008075620_add_releases_events_to_web_hooks.rb | 9 + .../20201008125643_create_csv_issue_imports.rb | 18 + ...ex_defaults_on_container_expiration_policies.rb | 21 + ...08224441_add_position_into_security_findings.rb | 19 + ...3022_remove_not_null_constraint_on_framework.rb | 33 ++ ...piration_policies_worker_capacity_constraint.rb | 22 + db/migrate/20201012134230_create_ci_test_cases.rb | 27 + .../20201012135330_create_ci_test_case_failures.rb | 22 + ...01012140110_add_projects_fk_to_ci_test_cases.rb | 19 + ...52_add_ci_builds_fk_to_ci_test_case_failures.rb | 19 + ...1014163633_specify_primary_key_where_missing.rb | 46 ++ ...add_project_foreign_key_to_csv_issue_imports.rb | 19 + ...25_add_user_foreign_key_to_csv_issue_imports.rb | 19 + ...add_index_on_state_for_dast_site_validations.rb | 22 + ..._add_ci_build_id_to_terraform_state_versions.rb | 28 + ..._project_id_and_id_to_container_repositories.rb | 18 + ...on_scan_id_and_position_of_security_findings.rb | 18 + ...01019101549_add_es_custom_analyzers_settings.rb | 12 + ...dd_sha256_and_filecount_to_pages_deployments.rb | 22 + ...new_user_signups_cap_to_application_settings.rb | 9 + ...9130244_remove_license_compliance_temp_index.rb | 18 + ...lt_branch_to_daily_build_group_report_result.rb | 11 + .../20201019161924_add_partitioned_table_view.rb | 44 ++ db/migrate/20201019172704_add_partitions_view.rb | 39 ++ ...07_create_analytics_devops_adoption_segments.rb | 24 + ...956_add_index_route_on_name_trigram_to_route.rb | 18 + ...analytics_devops_adoption_segment_selections.rb | 17 + ..._foreign_key_project_id_to_segment_selection.rb | 19 + ...dd_foreign_key_group_id_to_segment_selection.rb | 19 + ...59_add_check_constraint_to_segment_selection.rb | 19 + ...index_to_ci_daily_build_group_report_results.rb | 24 + ...ection_token_revocation_application_settings.rb | 21 + ...ection_token_revocation_application_settings.rb | 17 + .../20201021220101_add_merge_trains_enabled.rb | 9 + ...2080802_add_repository_read_only_to_snippets.rb | 9 + ...201022094845_add_historical_data_recorded_at.rb | 13 + ...022094846_update_historical_data_recorded_at.rb | 31 ++ ...1022103304_add_availability_to_user_statuses.rb | 9 + ...44501_create_snippet_repository_storage_move.rb | 32 ++ ...dd_has_vulnerabilities_into_project_settings.rb | 19 + ...dex_project_settings_on_project_id_partially.rb | 18 + ...14628_create_merge_request_cleanup_schedules.rb | 27 + .../20201026200736_seed_merge_trains_enabled.rb | 19 + ...002551_migrate_services_to_http_integrations.rb | 51 ++ .../20201027135651_add_auto_rollback_setting.rb | 19 + ...dex_to_oauth_access_grants_resource_owner_id.rb | 18 + ...211138_increase_default_diff_max_patch_bytes.rb | 9 + ...add_temporary_index_to_vulnerabilities_table.rb | 18 + ...028184640_add_helm_major_version_to_clusters.rb | 12 + ...efault_diff_max_patch_bytes_to_minimum_200kb.rb | 20 + ...ame_application_settings_to_allow_deny_names.rb | 21 + ...029144444_create_vulnerability_finding_links.rb | 25 + ...equirements_access_level_to_project_features.rb | 19 + ...30200115_add_iid_to_design_management_design.rb | 9 + ..._on_design_management_designs_iid_project_id.rb | 21 + ...to_incident_issues_on_project_and_created_at.rb | 30 ++ .../20201103095752_add_issues_closed_at_index.rb | 17 + ...1537_add_index_active_billable_users_to_user.rb | 21 + ...333_create_packages_package_file_build_infos.rb | 30 ++ ...1103202213_update_packages_build_infos_index.rb | 22 + .../20201104204739_create_bulk_import_trackers.rb | 42 ++ ...21637_add_uploads_size_to_project_statistics.rb | 13 + ...ds_size_to_namespace_root_storage_statistics.rb | 13 + ...tifact_size_lsif_of_plan_limits_from20_to100.rb | 21 + ...s_enabled_and_issuetype_to_jira_tracker_data.rb | 13 + ...dd_text_limit_to_jira_tracker_data_issuetype.rb | 17 + .../20201106134139_add_pipelines_created_index.rb | 19 + ...al_after_user_signup_to_application_settings.rb | 9 + .../20201109144634_add_region_field_to_aws_role.rb | 21 + ..._revocation_token_types_application_settings.rb | 13 + ..._revocation_token_types_application_settings.rb | 17 + ...erability_occurrences_on_project_fingerprint.rb | 18 + .../20201110110454_extend_postgres_indexes_view.rb | 55 ++ ...29_change_index_mr_metrics_target_project_id.rb | 20 + ...318_add_cloud_license_auth_token_to_settings.rb | 13 + ...e_auth_token_application_settings_text_limit.rb | 17 + ...0201111152859_add_missing_expression_indexes.rb | 43 ++ .../20201112195322_reseed_merge_trains_enabled.rb | 19 + ...073808_schedule_blocked_by_links_replacement.rb | 6 +- ...0201019094741_rename_sitemap_root_namespaces.rb | 24 + ...20102551_remove_index_service_for_usage_data.rb | 18 + ..._scanned_resources_count_from_security_scans.rb | 13 + ..._populate_vulnerability_feedback_pipeline_id.rb | 33 ++ ...ng_dismissal_information_for_vulnerabilities.rb | 23 + ...82809_backfill_jira_tracker_deployment_type2.rb | 32 ++ ...ob_verification_primary_worker_sidekiq_queue.rb | 18 + ...up_application_settings_to_allow_deny_rename.rb | 19 + .../20201030203854_backfill_design_iids.rb | 27 + ...dule_blocked_by_links_replacement_second_try.rb | 30 ++ .../20201102112206_rename_sitemap_namespace.rb | 24 + ...storage_size_limit_from_application_settings.rb | 13 + ...l_check_on_iid_on_design_manangement_designs.rb | 17 + ...01102152945_truncate_security_findings_table.rb | 19 + ..._remove_terraform_state_verification_columns.rb | 29 + ...ule_merge_request_cleanup_schedules_backfill.rb | 30 ++ ...192526_schedule_populate_has_vulnerabilities.rb | 24 + ...723_add_merge_request_jira_reference_indexes.rb | 44 ++ .../20201106134950_deduplicate_epic_iids.rb | 121 +++++ db/schema_migrations/20200908212414 | 1 + db/schema_migrations/20200920130356 | 1 + db/schema_migrations/20200928123510 | 1 + db/schema_migrations/20201008011523 | 1 + db/schema_migrations/20201008011937 | 1 + db/schema_migrations/20201008013434 | 1 + db/schema_migrations/20201008075620 | 1 + db/schema_migrations/20201008125643 | 1 + db/schema_migrations/20201008144854 | 1 + db/schema_migrations/20201008224441 | 1 + db/schema_migrations/20201012073022 | 1 + db/schema_migrations/20201012122428 | 1 + db/schema_migrations/20201012134230 | 1 + db/schema_migrations/20201012135330 | 1 + db/schema_migrations/20201012140110 | 1 + db/schema_migrations/20201012140452 | 1 + db/schema_migrations/20201014163633 | 1 + db/schema_migrations/20201015121805 | 1 + db/schema_migrations/20201015121825 | 1 + db/schema_migrations/20201015194852 | 1 + db/schema_migrations/20201015231049 | 1 + db/schema_migrations/20201016074302 | 1 + db/schema_migrations/20201019091307 | 1 + db/schema_migrations/20201019094741 | 1 + db/schema_migrations/20201019101549 | 1 + db/schema_migrations/20201019111952 | 1 + db/schema_migrations/20201019113009 | 1 + db/schema_migrations/20201019130244 | 1 + db/schema_migrations/20201019152046 | 1 + db/schema_migrations/20201019161924 | 1 + db/schema_migrations/20201019172704 | 1 + db/schema_migrations/20201020102551 | 1 + db/schema_migrations/20201021085007 | 1 + db/schema_migrations/20201021101956 | 1 + db/schema_migrations/20201021102554 | 1 + db/schema_migrations/20201021105347 | 1 + db/schema_migrations/20201021105600 | 1 + db/schema_migrations/20201021105959 | 1 + db/schema_migrations/20201021142812 | 1 + db/schema_migrations/20201021152210 | 1 + db/schema_migrations/20201021190539 | 1 + db/schema_migrations/20201021220101 | 1 + db/schema_migrations/20201022080802 | 1 + db/schema_migrations/20201022094845 | 1 + db/schema_migrations/20201022094846 | 1 + db/schema_migrations/20201022103304 | 1 + db/schema_migrations/20201022144501 | 1 + db/schema_migrations/20201022191817 | 1 + db/schema_migrations/20201022192254 | 1 + db/schema_migrations/20201023114628 | 1 + db/schema_migrations/20201026051643 | 1 + db/schema_migrations/20201026182253 | 1 + db/schema_migrations/20201026200736 | 1 + db/schema_migrations/20201027002551 | 1 + db/schema_migrations/20201027135651 | 1 + db/schema_migrations/20201027210127 | 1 + db/schema_migrations/20201027211138 | 1 + db/schema_migrations/20201028160831 | 1 + db/schema_migrations/20201028160832 | 1 + db/schema_migrations/20201028182809 | 1 + db/schema_migrations/20201028184640 | 1 + db/schema_migrations/20201028204306 | 1 + db/schema_migrations/20201029052241 | 1 + db/schema_migrations/20201029143650 | 1 + db/schema_migrations/20201029144157 | 1 + db/schema_migrations/20201029144444 | 1 + db/schema_migrations/20201030092151 | 1 + db/schema_migrations/20201030200115 | 1 + db/schema_migrations/20201030200539 | 1 + db/schema_migrations/20201030203854 | 1 + db/schema_migrations/20201102073808 | 1 + db/schema_migrations/20201102112206 | 1 + db/schema_migrations/20201102114018 | 1 + db/schema_migrations/20201102152554 | 1 + db/schema_migrations/20201102152945 | 1 + db/schema_migrations/20201102184743 | 1 + db/schema_migrations/20201103013242 | 1 + db/schema_migrations/20201103095752 | 1 + db/schema_migrations/20201103110018 | 1 + db/schema_migrations/20201103171537 | 1 + db/schema_migrations/20201103184333 | 1 + db/schema_migrations/20201103192526 | 1 + db/schema_migrations/20201103202213 | 1 + db/schema_migrations/20201104204739 | 1 + db/schema_migrations/20201105021637 | 1 + db/schema_migrations/20201105024127 | 1 + db/schema_migrations/20201105135051 | 1 + db/schema_migrations/20201105143211 | 1 + db/schema_migrations/20201105143312 | 1 + db/schema_migrations/20201106082723 | 1 + db/schema_migrations/20201106134139 | 1 + db/schema_migrations/20201106134950 | 1 + db/schema_migrations/20201107032257 | 1 + db/schema_migrations/20201109144634 | 1 + db/schema_migrations/20201109180311 | 1 + db/schema_migrations/20201109184023 | 1 + db/schema_migrations/20201110035029 | 1 + db/schema_migrations/20201110110454 | 1 + db/schema_migrations/20201110133629 | 1 + db/schema_migrations/20201111110318 | 1 + db/schema_migrations/20201111110918 | 1 + db/schema_migrations/20201111152859 | 1 + db/schema_migrations/20201112195322 | 1 + db/structure.sql | 600 ++++++++++++++++++--- 211 files changed, 2978 insertions(+), 81 deletions(-) create mode 100644 db/migrate/20200908212414_add_feature_flag_events_to_web_hooks.rb create mode 100644 db/migrate/20200920130356_add_container_expiration_policy_worker_settings_to_application_settings.rb create mode 100644 db/migrate/20200928123510_add_expiration_policy_cleanup_status_to_container_repositories.rb create mode 100644 db/migrate/20201008011523_add_ci_jwt_signing_key_to_application_settings.rb create mode 100644 db/migrate/20201008011937_add_text_limit_to_application_settings_encrypted_ci_jwt_signing_key_iv.rb create mode 100644 db/migrate/20201008013434_generate_ci_jwt_signing_key.rb create mode 100644 db/migrate/20201008075620_add_releases_events_to_web_hooks.rb create mode 100644 db/migrate/20201008125643_create_csv_issue_imports.rb create mode 100644 db/migrate/20201008144854_set_regex_defaults_on_container_expiration_policies.rb create mode 100644 db/migrate/20201008224441_add_position_into_security_findings.rb create mode 100644 db/migrate/20201012073022_remove_not_null_constraint_on_framework.rb create mode 100644 db/migrate/20201012122428_add_container_registry_expiration_policies_worker_capacity_constraint.rb create mode 100644 db/migrate/20201012134230_create_ci_test_cases.rb create mode 100644 db/migrate/20201012135330_create_ci_test_case_failures.rb create mode 100644 db/migrate/20201012140110_add_projects_fk_to_ci_test_cases.rb create mode 100644 db/migrate/20201012140452_add_ci_builds_fk_to_ci_test_case_failures.rb create mode 100644 db/migrate/20201014163633_specify_primary_key_where_missing.rb create mode 100644 db/migrate/20201015121805_add_project_foreign_key_to_csv_issue_imports.rb create mode 100644 db/migrate/20201015121825_add_user_foreign_key_to_csv_issue_imports.rb create mode 100644 db/migrate/20201015194852_add_index_on_state_for_dast_site_validations.rb create mode 100644 db/migrate/20201015231049_add_ci_build_id_to_terraform_state_versions.rb create mode 100644 db/migrate/20201016074302_add_index_project_id_and_id_to_container_repositories.rb create mode 100644 db/migrate/20201019091307_add_unique_index_on_scan_id_and_position_of_security_findings.rb create mode 100644 db/migrate/20201019101549_add_es_custom_analyzers_settings.rb create mode 100644 db/migrate/20201019111952_add_sha256_and_filecount_to_pages_deployments.rb create mode 100644 db/migrate/20201019113009_add_new_user_signups_cap_to_application_settings.rb create mode 100644 db/migrate/20201019130244_remove_license_compliance_temp_index.rb create mode 100644 db/migrate/20201019152046_add_default_branch_to_daily_build_group_report_result.rb create mode 100644 db/migrate/20201019161924_add_partitioned_table_view.rb create mode 100644 db/migrate/20201019172704_add_partitions_view.rb create mode 100644 db/migrate/20201021085007_create_analytics_devops_adoption_segments.rb create mode 100644 db/migrate/20201021101956_add_index_route_on_name_trigram_to_route.rb create mode 100644 db/migrate/20201021102554_create_analytics_devops_adoption_segment_selections.rb create mode 100644 db/migrate/20201021105347_add_foreign_key_project_id_to_segment_selection.rb create mode 100644 db/migrate/20201021105600_add_foreign_key_group_id_to_segment_selection.rb create mode 100644 db/migrate/20201021105959_add_check_constraint_to_segment_selection.rb create mode 100644 db/migrate/20201021142812_add_index_to_ci_daily_build_group_report_results.rb create mode 100644 db/migrate/20201021152210_add_secret_detection_token_revocation_application_settings.rb create mode 100644 db/migrate/20201021190539_add_text_limit_to_secret_detection_token_revocation_application_settings.rb create mode 100644 db/migrate/20201021220101_add_merge_trains_enabled.rb create mode 100644 db/migrate/20201022080802_add_repository_read_only_to_snippets.rb create mode 100644 db/migrate/20201022094845_add_historical_data_recorded_at.rb create mode 100644 db/migrate/20201022094846_update_historical_data_recorded_at.rb create mode 100644 db/migrate/20201022103304_add_availability_to_user_statuses.rb create mode 100644 db/migrate/20201022144501_create_snippet_repository_storage_move.rb create mode 100644 db/migrate/20201022191817_add_has_vulnerabilities_into_project_settings.rb create mode 100644 db/migrate/20201022192254_index_project_settings_on_project_id_partially.rb create mode 100644 db/migrate/20201023114628_create_merge_request_cleanup_schedules.rb create mode 100644 db/migrate/20201026200736_seed_merge_trains_enabled.rb create mode 100644 db/migrate/20201027002551_migrate_services_to_http_integrations.rb create mode 100644 db/migrate/20201027135651_add_auto_rollback_setting.rb create mode 100644 db/migrate/20201027210127_add_index_to_oauth_access_grants_resource_owner_id.rb create mode 100644 db/migrate/20201027211138_increase_default_diff_max_patch_bytes.rb create mode 100644 db/migrate/20201028160831_add_temporary_index_to_vulnerabilities_table.rb create mode 100644 db/migrate/20201028184640_add_helm_major_version_to_clusters.rb create mode 100644 db/migrate/20201028204306_migrate_default_diff_max_patch_bytes_to_minimum_200kb.rb create mode 100644 db/migrate/20201029143650_rename_application_settings_to_allow_deny_names.rb create mode 100644 db/migrate/20201029144444_create_vulnerability_finding_links.rb create mode 100644 db/migrate/20201030092151_add_requirements_access_level_to_project_features.rb create mode 100644 db/migrate/20201030200115_add_iid_to_design_management_design.rb create mode 100644 db/migrate/20201030200539_add_index_on_design_management_designs_iid_project_id.rb create mode 100644 db/migrate/20201102184743_add_index_to_incident_issues_on_project_and_created_at.rb create mode 100644 db/migrate/20201103095752_add_issues_closed_at_index.rb create mode 100644 db/migrate/20201103171537_add_index_active_billable_users_to_user.rb create mode 100644 db/migrate/20201103184333_create_packages_package_file_build_infos.rb create mode 100644 db/migrate/20201103202213_update_packages_build_infos_index.rb create mode 100644 db/migrate/20201104204739_create_bulk_import_trackers.rb create mode 100644 db/migrate/20201105021637_add_uploads_size_to_project_statistics.rb create mode 100644 db/migrate/20201105024127_add_uploads_size_to_namespace_root_storage_statistics.rb create mode 100644 db/migrate/20201105135051_change_default_value_of_ci_max_artifact_size_lsif_of_plan_limits_from20_to100.rb create mode 100644 db/migrate/20201105143211_add_vulnerabilities_enabled_and_issuetype_to_jira_tracker_data.rb create mode 100644 db/migrate/20201105143312_add_text_limit_to_jira_tracker_data_issuetype.rb create mode 100644 db/migrate/20201106134139_add_pipelines_created_index.rb create mode 100644 db/migrate/20201107032257_add_default_true_require_admin_approval_after_user_signup_to_application_settings.rb create mode 100644 db/migrate/20201109144634_add_region_field_to_aws_role.rb create mode 100644 db/migrate/20201109180311_add_secret_detection_revocation_token_types_application_settings.rb create mode 100644 db/migrate/20201109184023_add_text_limit_to_secret_detection_revocation_token_types_application_settings.rb create mode 100644 db/migrate/20201110035029_created_index_for_vulnerability_occurrences_on_project_fingerprint.rb create mode 100644 db/migrate/20201110110454_extend_postgres_indexes_view.rb create mode 100644 db/migrate/20201110133629_change_index_mr_metrics_target_project_id.rb create mode 100644 db/migrate/20201111110318_add_cloud_license_auth_token_to_settings.rb create mode 100644 db/migrate/20201111110918_add_cloud_license_auth_token_application_settings_text_limit.rb create mode 100644 db/migrate/20201111152859_add_missing_expression_indexes.rb create mode 100644 db/migrate/20201112195322_reseed_merge_trains_enabled.rb create mode 100644 db/post_migrate/20201019094741_rename_sitemap_root_namespaces.rb create mode 100644 db/post_migrate/20201020102551_remove_index_service_for_usage_data.rb create mode 100644 db/post_migrate/20201026051643_remove_scanned_resources_count_from_security_scans.rb create mode 100644 db/post_migrate/20201026182253_schedule_populate_vulnerability_feedback_pipeline_id.rb create mode 100644 db/post_migrate/20201028160832_schedule_populate_missing_dismissal_information_for_vulnerabilities.rb create mode 100644 db/post_migrate/20201028182809_backfill_jira_tracker_deployment_type2.rb create mode 100644 db/post_migrate/20201029052241_migrate_geo_blob_verification_primary_worker_sidekiq_queue.rb create mode 100644 db/post_migrate/20201029144157_cleanup_application_settings_to_allow_deny_rename.rb create mode 100644 db/post_migrate/20201030203854_backfill_design_iids.rb create mode 100644 db/post_migrate/20201102073808_schedule_blocked_by_links_replacement_second_try.rb create mode 100644 db/post_migrate/20201102112206_rename_sitemap_namespace.rb create mode 100644 db/post_migrate/20201102114018_remove_storage_size_limit_from_application_settings.rb create mode 100644 db/post_migrate/20201102152554_add_not_null_check_on_iid_on_design_manangement_designs.rb create mode 100644 db/post_migrate/20201102152945_truncate_security_findings_table.rb create mode 100644 db/post_migrate/20201103013242_remove_terraform_state_verification_columns.rb create mode 100644 db/post_migrate/20201103110018_schedule_merge_request_cleanup_schedules_backfill.rb create mode 100644 db/post_migrate/20201103192526_schedule_populate_has_vulnerabilities.rb create mode 100644 db/post_migrate/20201106082723_add_merge_request_jira_reference_indexes.rb create mode 100644 db/post_migrate/20201106134950_deduplicate_epic_iids.rb create mode 100644 db/schema_migrations/20200908212414 create mode 100644 db/schema_migrations/20200920130356 create mode 100644 db/schema_migrations/20200928123510 create mode 100644 db/schema_migrations/20201008011523 create mode 100644 db/schema_migrations/20201008011937 create mode 100644 db/schema_migrations/20201008013434 create mode 100644 db/schema_migrations/20201008075620 create mode 100644 db/schema_migrations/20201008125643 create mode 100644 db/schema_migrations/20201008144854 create mode 100644 db/schema_migrations/20201008224441 create mode 100644 db/schema_migrations/20201012073022 create mode 100644 db/schema_migrations/20201012122428 create mode 100644 db/schema_migrations/20201012134230 create mode 100644 db/schema_migrations/20201012135330 create mode 100644 db/schema_migrations/20201012140110 create mode 100644 db/schema_migrations/20201012140452 create mode 100644 db/schema_migrations/20201014163633 create mode 100644 db/schema_migrations/20201015121805 create mode 100644 db/schema_migrations/20201015121825 create mode 100644 db/schema_migrations/20201015194852 create mode 100644 db/schema_migrations/20201015231049 create mode 100644 db/schema_migrations/20201016074302 create mode 100644 db/schema_migrations/20201019091307 create mode 100644 db/schema_migrations/20201019094741 create mode 100644 db/schema_migrations/20201019101549 create mode 100644 db/schema_migrations/20201019111952 create mode 100644 db/schema_migrations/20201019113009 create mode 100644 db/schema_migrations/20201019130244 create mode 100644 db/schema_migrations/20201019152046 create mode 100644 db/schema_migrations/20201019161924 create mode 100644 db/schema_migrations/20201019172704 create mode 100644 db/schema_migrations/20201020102551 create mode 100644 db/schema_migrations/20201021085007 create mode 100644 db/schema_migrations/20201021101956 create mode 100644 db/schema_migrations/20201021102554 create mode 100644 db/schema_migrations/20201021105347 create mode 100644 db/schema_migrations/20201021105600 create mode 100644 db/schema_migrations/20201021105959 create mode 100644 db/schema_migrations/20201021142812 create mode 100644 db/schema_migrations/20201021152210 create mode 100644 db/schema_migrations/20201021190539 create mode 100644 db/schema_migrations/20201021220101 create mode 100644 db/schema_migrations/20201022080802 create mode 100644 db/schema_migrations/20201022094845 create mode 100644 db/schema_migrations/20201022094846 create mode 100644 db/schema_migrations/20201022103304 create mode 100644 db/schema_migrations/20201022144501 create mode 100644 db/schema_migrations/20201022191817 create mode 100644 db/schema_migrations/20201022192254 create mode 100644 db/schema_migrations/20201023114628 create mode 100644 db/schema_migrations/20201026051643 create mode 100644 db/schema_migrations/20201026182253 create mode 100644 db/schema_migrations/20201026200736 create mode 100644 db/schema_migrations/20201027002551 create mode 100644 db/schema_migrations/20201027135651 create mode 100644 db/schema_migrations/20201027210127 create mode 100644 db/schema_migrations/20201027211138 create mode 100644 db/schema_migrations/20201028160831 create mode 100644 db/schema_migrations/20201028160832 create mode 100644 db/schema_migrations/20201028182809 create mode 100644 db/schema_migrations/20201028184640 create mode 100644 db/schema_migrations/20201028204306 create mode 100644 db/schema_migrations/20201029052241 create mode 100644 db/schema_migrations/20201029143650 create mode 100644 db/schema_migrations/20201029144157 create mode 100644 db/schema_migrations/20201029144444 create mode 100644 db/schema_migrations/20201030092151 create mode 100644 db/schema_migrations/20201030200115 create mode 100644 db/schema_migrations/20201030200539 create mode 100644 db/schema_migrations/20201030203854 create mode 100644 db/schema_migrations/20201102073808 create mode 100644 db/schema_migrations/20201102112206 create mode 100644 db/schema_migrations/20201102114018 create mode 100644 db/schema_migrations/20201102152554 create mode 100644 db/schema_migrations/20201102152945 create mode 100644 db/schema_migrations/20201102184743 create mode 100644 db/schema_migrations/20201103013242 create mode 100644 db/schema_migrations/20201103095752 create mode 100644 db/schema_migrations/20201103110018 create mode 100644 db/schema_migrations/20201103171537 create mode 100644 db/schema_migrations/20201103184333 create mode 100644 db/schema_migrations/20201103192526 create mode 100644 db/schema_migrations/20201103202213 create mode 100644 db/schema_migrations/20201104204739 create mode 100644 db/schema_migrations/20201105021637 create mode 100644 db/schema_migrations/20201105024127 create mode 100644 db/schema_migrations/20201105135051 create mode 100644 db/schema_migrations/20201105143211 create mode 100644 db/schema_migrations/20201105143312 create mode 100644 db/schema_migrations/20201106082723 create mode 100644 db/schema_migrations/20201106134139 create mode 100644 db/schema_migrations/20201106134950 create mode 100644 db/schema_migrations/20201107032257 create mode 100644 db/schema_migrations/20201109144634 create mode 100644 db/schema_migrations/20201109180311 create mode 100644 db/schema_migrations/20201109184023 create mode 100644 db/schema_migrations/20201110035029 create mode 100644 db/schema_migrations/20201110110454 create mode 100644 db/schema_migrations/20201110133629 create mode 100644 db/schema_migrations/20201111110318 create mode 100644 db/schema_migrations/20201111110918 create mode 100644 db/schema_migrations/20201111152859 create mode 100644 db/schema_migrations/20201112195322 (limited to 'db') diff --git a/db/fixtures/development/02_application_settings.rb b/db/fixtures/development/02_application_settings.rb index 67486d2ab5f..46da3205d8f 100644 --- a/db/fixtures/development/02_application_settings.rb +++ b/db/fixtures/development/02_application_settings.rb @@ -7,4 +7,7 @@ ApplicationSetting.create_from_defaults puts "Enable hashed storage for every new projects.".color(:green) ApplicationSetting.current_without_cache.update!(hashed_storage_enabled: true) +puts "Generate CI JWT signing key".color(:green) +ApplicationSetting.current_without_cache.update!(ci_jwt_signing_key: OpenSSL::PKey::RSA.new(2048).to_pem) + print '.' diff --git a/db/fixtures/development/12_snippets.rb b/db/fixtures/development/12_snippets.rb index 8ceabcdcd9b..6d31007b320 100644 --- a/db/fixtures/development/12_snippets.rb +++ b/db/fixtures/development/12_snippets.rb @@ -1,6 +1,28 @@ require './spec/support/sidekiq_middleware' SNIPPET_REPO_URL = "https://gitlab.com/gitlab-org/gitlab-snippet-test.git" +BUNDLE_PATH = File.join(Rails.root, 'db/fixtures/development/gitlab-snippet-test.bundle') + +class Gitlab::Seeder::SnippetRepository + def initialize(snippet) + @snippet = snippet + end + + def import + if File.exists?(BUNDLE_PATH) + @snippet.repository.create_from_bundle(BUNDLE_PATH) + else + @snippet.repository.import_repository(SNIPPET_REPO_URL) + @snippet.repository.bundle_to_disk(BUNDLE_PATH) + end + end + + def self.cleanup + File.delete(BUNDLE_PATH) if File.exists?(BUNDLE_PATH) + rescue => e + warn "\nError cleaning up snippet bundle: #{e}" + end +end Gitlab::Seeder.quiet do 20.times do |i| @@ -14,7 +36,7 @@ Gitlab::Seeder.quiet do content: 'foo' }).tap do |snippet| unless snippet.repository_exists? - snippet.repository.import_repository(SNIPPET_REPO_URL) + Gitlab::Seeder::SnippetRepository.new(snippet).import end snippet.track_snippet_repository(snippet.repository.storage) @@ -23,5 +45,7 @@ Gitlab::Seeder.quiet do print('.') end + + Gitlab::Seeder::SnippetRepository.cleanup end diff --git a/db/fixtures/production/010_settings.rb b/db/fixtures/production/010_settings.rb index 7626cdb0b9c..65f70a9e715 100644 --- a/db/fixtures/production/010_settings.rb +++ b/db/fixtures/production/010_settings.rb @@ -24,3 +24,7 @@ if ENV['GITLAB_PROMETHEUS_METRICS_ENABLED'].present? settings.prometheus_metrics_enabled = value save(settings, 'Prometheus metrics enabled flag') end + +settings = Gitlab::CurrentSettings.current_application_settings +settings.ci_jwt_signing_key = OpenSSL::PKey::RSA.new(2048).to_pem +save(settings, 'CI JWT signing key') diff --git a/db/migrate/20200908212414_add_feature_flag_events_to_web_hooks.rb b/db/migrate/20200908212414_add_feature_flag_events_to_web_hooks.rb new file mode 100644 index 00000000000..40e2b37b390 --- /dev/null +++ b/db/migrate/20200908212414_add_feature_flag_events_to_web_hooks.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddFeatureFlagEventsToWebHooks < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :web_hooks, :feature_flag_events, :boolean, null: false, default: false + end +end diff --git a/db/migrate/20200920130356_add_container_expiration_policy_worker_settings_to_application_settings.rb b/db/migrate/20200920130356_add_container_expiration_policy_worker_settings_to_application_settings.rb new file mode 100644 index 00000000000..7501f150283 --- /dev/null +++ b/db/migrate/20200920130356_add_container_expiration_policy_worker_settings_to_application_settings.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddContainerExpirationPolicyWorkerSettingsToApplicationSettings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + unless column_exists?(:application_settings, :container_registry_expiration_policies_worker_capacity) + add_column(:application_settings, :container_registry_expiration_policies_worker_capacity, :integer, default: 0, null: false) + end + end + + def down + if column_exists?(:application_settings, :container_registry_expiration_policies_worker_capacity) + remove_column(:application_settings, :container_registry_expiration_policies_worker_capacity) + end + end +end diff --git a/db/migrate/20200928123510_add_expiration_policy_cleanup_status_to_container_repositories.rb b/db/migrate/20200928123510_add_expiration_policy_cleanup_status_to_container_repositories.rb new file mode 100644 index 00000000000..4d611a56e9c --- /dev/null +++ b/db/migrate/20200928123510_add_expiration_policy_cleanup_status_to_container_repositories.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class AddExpirationPolicyCleanupStatusToContainerRepositories < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'idx_container_repositories_on_exp_cleanup_status_and_start_date' + + disable_ddl_transaction! + + def up + unless column_exists?(:container_repositories, :expiration_policy_cleanup_status) + add_column(:container_repositories, :expiration_policy_cleanup_status, :integer, limit: 2, default: 0, null: false) + end + + add_concurrent_index(:container_repositories, [:expiration_policy_cleanup_status, :expiration_policy_started_at], name: INDEX_NAME) + end + + def down + remove_concurrent_index(:container_repositories, [:expiration_policy_cleanup_status, :expiration_policy_started_at], name: INDEX_NAME) + + if column_exists?(:container_repositories, :expiration_policy_cleanup_status) + remove_column(:container_repositories, :expiration_policy_cleanup_status) + end + end +end diff --git a/db/migrate/20201008011523_add_ci_jwt_signing_key_to_application_settings.rb b/db/migrate/20201008011523_add_ci_jwt_signing_key_to_application_settings.rb new file mode 100644 index 00000000000..c51f7e8b706 --- /dev/null +++ b/db/migrate/20201008011523_add_ci_jwt_signing_key_to_application_settings.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddCiJwtSigningKeyToApplicationSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20201001011937_add_text_limit_to_application_settings_encrypted_ci_jwt_signing_key_iv + def change + add_column :application_settings, :encrypted_ci_jwt_signing_key, :text + add_column :application_settings, :encrypted_ci_jwt_signing_key_iv, :text + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20201008011937_add_text_limit_to_application_settings_encrypted_ci_jwt_signing_key_iv.rb b/db/migrate/20201008011937_add_text_limit_to_application_settings_encrypted_ci_jwt_signing_key_iv.rb new file mode 100644 index 00000000000..39f6eb2106a --- /dev/null +++ b/db/migrate/20201008011937_add_text_limit_to_application_settings_encrypted_ci_jwt_signing_key_iv.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddTextLimitToApplicationSettingsEncryptedCiJwtSigningKeyIv < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :encrypted_ci_jwt_signing_key_iv, 255 + end + + def down + remove_text_limit :application_settings, :encrypted_ci_jwt_signing_key_iv + end +end diff --git a/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb b/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb new file mode 100644 index 00000000000..7983a56f439 --- /dev/null +++ b/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +class GenerateCiJwtSigningKey < ActiveRecord::Migration[6.0] + DOWNTIME = false + + class ApplicationSetting < ActiveRecord::Base + self.table_name = 'application_settings' + + attr_encrypted :ci_jwt_signing_key, { + mode: :per_attribute_iv, + key: Rails.application.secrets.db_key_base[0..31], + algorithm: 'aes-256-gcm', + encode: true + } + end + + def up + ApplicationSetting.reset_column_information + + ApplicationSetting.find_each do |application_setting| + application_setting.update(ci_jwt_signing_key: OpenSSL::PKey::RSA.new(2048).to_pem) + end + end + + def down + ApplicationSetting.reset_column_information + + ApplicationSetting.find_each do |application_setting| + application_setting.update_columns(encrypted_ci_jwt_signing_key: nil, encrypted_ci_jwt_signing_key_iv: nil) + end + end +end diff --git a/db/migrate/20201008075620_add_releases_events_to_web_hooks.rb b/db/migrate/20201008075620_add_releases_events_to_web_hooks.rb new file mode 100644 index 00000000000..f6df213f162 --- /dev/null +++ b/db/migrate/20201008075620_add_releases_events_to_web_hooks.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddReleasesEventsToWebHooks < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :web_hooks, :releases_events, :boolean, null: false, default: false + end +end diff --git a/db/migrate/20201008125643_create_csv_issue_imports.rb b/db/migrate/20201008125643_create_csv_issue_imports.rb new file mode 100644 index 00000000000..be3206af6d8 --- /dev/null +++ b/db/migrate/20201008125643_create_csv_issue_imports.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class CreateCsvIssueImports < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + create_table :csv_issue_imports do |t| + t.bigint :project_id, null: false, index: true + t.bigint :user_id, null: false, index: true + + t.timestamps_with_timezone + end + end + + def down + drop_table :csv_issue_imports + end +end diff --git a/db/migrate/20201008144854_set_regex_defaults_on_container_expiration_policies.rb b/db/migrate/20201008144854_set_regex_defaults_on_container_expiration_policies.rb new file mode 100644 index 00000000000..45c411fc238 --- /dev/null +++ b/db/migrate/20201008144854_set_regex_defaults_on_container_expiration_policies.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class SetRegexDefaultsOnContainerExpirationPolicies < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + change_column_default :container_expiration_policies, :name_regex, '.*' + change_column_default :container_expiration_policies, :enabled, false + end + end + + def down + with_lock_retries do + change_column_default :container_expiration_policies, :name_regex, nil + change_column_default :container_expiration_policies, :enabled, true + end + end +end diff --git a/db/migrate/20201008224441_add_position_into_security_findings.rb b/db/migrate/20201008224441_add_position_into_security_findings.rb new file mode 100644 index 00000000000..ee6d5370f83 --- /dev/null +++ b/db/migrate/20201008224441_add_position_into_security_findings.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddPositionIntoSecurityFindings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :security_findings, :position, :integer + end + end + + def down + with_lock_retries do + remove_column :security_findings, :position + end + end +end diff --git a/db/migrate/20201012073022_remove_not_null_constraint_on_framework.rb b/db/migrate/20201012073022_remove_not_null_constraint_on_framework.rb new file mode 100644 index 00000000000..b8cc8984575 --- /dev/null +++ b/db/migrate/20201012073022_remove_not_null_constraint_on_framework.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class RemoveNotNullConstraintOnFramework < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + GDPR_FRAMEWORK_ID = 1 + + disable_ddl_transaction! + + class TmpComplianceProjectFrameworkSetting < ActiveRecord::Base + self.table_name = 'project_compliance_framework_settings' + self.primary_key = :project_id + + include EachBatch + end + + def up + change_column_null :project_compliance_framework_settings, :framework, true + end + + def down + # Custom frameworks cannot be rolled back easily since we don't have enum for them. + # To make the database consistent, we mark them as GDPR framework. + # Note: framework customization will be implemented in the next 1-3 releases so data + # corruption due to the rollback is unlikely. + TmpComplianceProjectFrameworkSetting.each_batch(of: 100) do |query| + query.where(framework: nil).update_all(framework: GDPR_FRAMEWORK_ID) + end + + change_column_null :project_compliance_framework_settings, :framework, false + end +end diff --git a/db/migrate/20201012122428_add_container_registry_expiration_policies_worker_capacity_constraint.rb b/db/migrate/20201012122428_add_container_registry_expiration_policies_worker_capacity_constraint.rb new file mode 100644 index 00000000000..e4f7d1309a3 --- /dev/null +++ b/db/migrate/20201012122428_add_container_registry_expiration_policies_worker_capacity_constraint.rb @@ -0,0 +1,22 @@ +# 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 AddContainerRegistryExpirationPoliciesWorkerCapacityConstraint < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + CONSTRAINT_NAME = 'app_settings_registry_exp_policies_worker_capacity_positive' + + disable_ddl_transaction! + + def up + add_check_constraint :application_settings, 'container_registry_expiration_policies_worker_capacity >= 0', CONSTRAINT_NAME + end + + def down + remove_check_constraint :application_settings, CONSTRAINT_NAME + end +end diff --git a/db/migrate/20201012134230_create_ci_test_cases.rb b/db/migrate/20201012134230_create_ci_test_cases.rb new file mode 100644 index 00000000000..fd1bcaf1093 --- /dev/null +++ b/db/migrate/20201012134230_create_ci_test_cases.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class CreateCiTestCases < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless table_exists?(:ci_test_cases) + create_table :ci_test_cases do |t| + t.bigint :project_id, null: false + t.text :key_hash, null: false + + t.index [:project_id, :key_hash], unique: true + # NOTE: FK for projects will be added on a separate migration as per guidelines + end + end + + add_text_limit :ci_test_cases, :key_hash, 64 + end + + def down + drop_table :ci_test_cases + end +end diff --git a/db/migrate/20201012135330_create_ci_test_case_failures.rb b/db/migrate/20201012135330_create_ci_test_case_failures.rb new file mode 100644 index 00000000000..7eaf7b5256d --- /dev/null +++ b/db/migrate/20201012135330_create_ci_test_case_failures.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class CreateCiTestCaseFailures < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + create_table :ci_test_case_failures do |t| + t.datetime_with_timezone :failed_at + t.bigint :test_case_id, null: false + t.bigint :build_id, null: false + + t.index [:test_case_id, :failed_at, :build_id], name: 'index_test_case_failures_unique_columns', unique: true, order: { failed_at: :desc } + t.index :build_id + t.foreign_key :ci_test_cases, column: :test_case_id, on_delete: :cascade + # NOTE: FK for ci_builds will be added on a separate migration as per guidelines + end + end + + def down + drop_table :ci_test_case_failures + end +end diff --git a/db/migrate/20201012140110_add_projects_fk_to_ci_test_cases.rb b/db/migrate/20201012140110_add_projects_fk_to_ci_test_cases.rb new file mode 100644 index 00000000000..d30b332e41a --- /dev/null +++ b/db/migrate/20201012140110_add_projects_fk_to_ci_test_cases.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddProjectsFkToCiTestCases < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :ci_test_cases, :projects, column: :project_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :ci_test_cases, column: :project_id + end + end +end diff --git a/db/migrate/20201012140452_add_ci_builds_fk_to_ci_test_case_failures.rb b/db/migrate/20201012140452_add_ci_builds_fk_to_ci_test_case_failures.rb new file mode 100644 index 00000000000..0f2fdf071fa --- /dev/null +++ b/db/migrate/20201012140452_add_ci_builds_fk_to_ci_test_case_failures.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddCiBuildsFkToCiTestCaseFailures < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :ci_test_case_failures, :ci_builds, column: :build_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :ci_test_case_failures, column: :build_id + end + end +end diff --git a/db/migrate/20201014163633_specify_primary_key_where_missing.rb b/db/migrate/20201014163633_specify_primary_key_where_missing.rb new file mode 100644 index 00000000000..bca111dacf2 --- /dev/null +++ b/db/migrate/20201014163633_specify_primary_key_where_missing.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +class SpecifyPrimaryKeyWhereMissing < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + TABLES = { + project_authorizations: [:index_project_authorizations_on_user_id_project_id_access_level, %i(user_id project_id access_level)], + analytics_language_trend_repository_languages: [:analytics_repository_languages_unique_index, %i(programming_language_id project_id snapshot_date)], + approval_project_rules_protected_branches: [:index_approval_project_rules_protected_branches_unique, %i(approval_project_rule_id protected_branch_id)], + ci_build_trace_sections: [:index_ci_build_trace_sections_on_build_id_and_section_name_id, %i(build_id section_name_id)], + deployment_merge_requests: [:idx_deployment_merge_requests_unique_index, %i(deployment_id merge_request_id)], + issue_assignees: [:index_issue_assignees_on_issue_id_and_user_id, %i(issue_id user_id)], + issues_prometheus_alert_events: [:issue_id_prometheus_alert_event_id_index, %i(issue_id prometheus_alert_event_id)], + issues_self_managed_prometheus_alert_events: [:issue_id_self_managed_prometheus_alert_event_id_index, %i(issue_id self_managed_prometheus_alert_event_id)], + merge_request_diff_commits: [:index_merge_request_diff_commits_on_mr_diff_id_and_order, %i(merge_request_diff_id relative_order)], + merge_request_diff_files: [:index_merge_request_diff_files_on_mr_diff_id_and_order, %i(merge_request_diff_id relative_order)], + milestone_releases: [:index_miletone_releases_on_milestone_and_release, %i(milestone_id release_id)], + project_pages_metadata: [:index_project_pages_metadata_on_project_id, %i(project_id)], + push_event_payloads: [:index_push_event_payloads_on_event_id, %i(event_id)], + repository_languages: [:index_repository_languages_on_project_and_languages_id, %i(project_id programming_language_id)], + user_interacted_projects: [:index_user_interacted_projects_on_project_id_and_user_id, %i(project_id user_id)], + users_security_dashboard_projects: [:users_security_dashboard_projects_unique_index, %i(project_id user_id)] + }.freeze + + def up + TABLES.each do |table, (unique_index, _)| + with_lock_retries do + execute "ALTER TABLE #{table} ADD CONSTRAINT #{table}_pkey PRIMARY KEY USING INDEX #{unique_index}" if index_exists_by_name?(table, unique_index) + end + end + end + + def down + TABLES.each do |table, (unique_index, columns)| + add_concurrent_index table, columns, name: unique_index, unique: true + + with_lock_retries do + execute "ALTER TABLE #{table} DROP CONSTRAINT #{table}_pkey" + end + end + end +end diff --git a/db/migrate/20201015121805_add_project_foreign_key_to_csv_issue_imports.rb b/db/migrate/20201015121805_add_project_foreign_key_to_csv_issue_imports.rb new file mode 100644 index 00000000000..9476d2d55bd --- /dev/null +++ b/db/migrate/20201015121805_add_project_foreign_key_to_csv_issue_imports.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddProjectForeignKeyToCsvIssueImports < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :csv_issue_imports, :projects, column: :project_id + end + + def down + with_lock_retries do + remove_foreign_key :csv_issue_imports, column: :project_id + end + end +end diff --git a/db/migrate/20201015121825_add_user_foreign_key_to_csv_issue_imports.rb b/db/migrate/20201015121825_add_user_foreign_key_to_csv_issue_imports.rb new file mode 100644 index 00000000000..ae91695bff4 --- /dev/null +++ b/db/migrate/20201015121825_add_user_foreign_key_to_csv_issue_imports.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddUserForeignKeyToCsvIssueImports < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :csv_issue_imports, :users, column: :user_id + end + + def down + with_lock_retries do + remove_foreign_key :csv_issue_imports, column: :user_id + end + end +end diff --git a/db/migrate/20201015194852_add_index_on_state_for_dast_site_validations.rb b/db/migrate/20201015194852_add_index_on_state_for_dast_site_validations.rb new file mode 100644 index 00000000000..785d7c8829c --- /dev/null +++ b/db/migrate/20201015194852_add_index_on_state_for_dast_site_validations.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class AddIndexOnStateForDastSiteValidations < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + OLD_INDEX_NAME = 'index_dast_site_validations_on_url_base' + NEW_INDEX_NAME = 'index_dast_site_validations_on_url_base_and_state' + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :dast_site_validations, [:url_base, :state], name: NEW_INDEX_NAME + remove_concurrent_index_by_name :dast_site_validations, OLD_INDEX_NAME + end + + def down + add_concurrent_index :dast_site_validations, :url_base, name: OLD_INDEX_NAME + remove_concurrent_index_by_name :dast_site_validations, NEW_INDEX_NAME + end +end diff --git a/db/migrate/20201015231049_add_ci_build_id_to_terraform_state_versions.rb b/db/migrate/20201015231049_add_ci_build_id_to_terraform_state_versions.rb new file mode 100644 index 00000000000..539b2af5fc4 --- /dev/null +++ b/db/migrate/20201015231049_add_ci_build_id_to_terraform_state_versions.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class AddCiBuildIdToTerraformStateVersions < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_terraform_state_versions_on_ci_build_id' + + disable_ddl_transaction! + + def up + unless column_exists?(:terraform_state_versions, :ci_build_id) + add_column :terraform_state_versions, :ci_build_id, :bigint + end + + add_concurrent_index :terraform_state_versions, :ci_build_id, name: INDEX_NAME + add_concurrent_foreign_key :terraform_state_versions, :ci_builds, column: :ci_build_id, on_delete: :nullify + end + + def down + with_lock_retries do + remove_foreign_key_if_exists :terraform_state_versions, :ci_builds, column: :ci_build_id + end + + remove_concurrent_index_by_name :terraform_state_versions, INDEX_NAME + remove_column :terraform_state_versions, :ci_build_id + end +end diff --git a/db/migrate/20201016074302_add_index_project_id_and_id_to_container_repositories.rb b/db/migrate/20201016074302_add_index_project_id_and_id_to_container_repositories.rb new file mode 100644 index 00000000000..b2e7c62ba0c --- /dev/null +++ b/db/migrate/20201016074302_add_index_project_id_and_id_to_container_repositories.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexProjectIdAndIdToContainerRepositories < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_container_repositories_on_project_id_and_id' + + disable_ddl_transaction! + + def up + add_concurrent_index(:container_repositories, [:project_id, :id], name: INDEX_NAME) + end + + def down + remove_concurrent_index(:container_repositories, [:project_id, :id], name: INDEX_NAME) + end +end diff --git a/db/migrate/20201019091307_add_unique_index_on_scan_id_and_position_of_security_findings.rb b/db/migrate/20201019091307_add_unique_index_on_scan_id_and_position_of_security_findings.rb new file mode 100644 index 00000000000..3303e41d8a1 --- /dev/null +++ b/db/migrate/20201019091307_add_unique_index_on_scan_id_and_position_of_security_findings.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddUniqueIndexOnScanIdAndPositionOfSecurityFindings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_security_findings_on_scan_id_and_position' + + disable_ddl_transaction! + + def up + add_concurrent_index :security_findings, [:scan_id, :position], unique: true, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :security_findings, INDEX_NAME + end +end diff --git a/db/migrate/20201019101549_add_es_custom_analyzers_settings.rb b/db/migrate/20201019101549_add_es_custom_analyzers_settings.rb new file mode 100644 index 00000000000..47fd9ebbb8e --- /dev/null +++ b/db/migrate/20201019101549_add_es_custom_analyzers_settings.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class AddEsCustomAnalyzersSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :application_settings, :elasticsearch_analyzers_smartcn_enabled, :bool, null: false, default: false + add_column :application_settings, :elasticsearch_analyzers_smartcn_search, :bool, null: false, default: false + add_column :application_settings, :elasticsearch_analyzers_kuromoji_enabled, :bool, null: false, default: false + add_column :application_settings, :elasticsearch_analyzers_kuromoji_search, :bool, null: false, default: false + end +end diff --git a/db/migrate/20201019111952_add_sha256_and_filecount_to_pages_deployments.rb b/db/migrate/20201019111952_add_sha256_and_filecount_to_pages_deployments.rb new file mode 100644 index 00000000000..1921701626d --- /dev/null +++ b/db/migrate/20201019111952_add_sha256_and_filecount_to_pages_deployments.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class AddSha256AndFilecountToPagesDeployments < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + # pages_deployments were never enabled on any production/staging + # environments, so we safely delete them for people who enabled + # them locally + execute "DELETE FROM pages_deployments" + + # rubocop:disable Rails/NotNullColumn + add_column :pages_deployments, :file_count, :integer, null: false + add_column :pages_deployments, :file_sha256, :binary, null: false + # rubocop:enable Rails/NotNullColumn + end + + def down + remove_column :pages_deployments, :file_sha256 + remove_column :pages_deployments, :file_count + end +end diff --git a/db/migrate/20201019113009_add_new_user_signups_cap_to_application_settings.rb b/db/migrate/20201019113009_add_new_user_signups_cap_to_application_settings.rb new file mode 100644 index 00000000000..8754b0d481e --- /dev/null +++ b/db/migrate/20201019113009_add_new_user_signups_cap_to_application_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddNewUserSignupsCapToApplicationSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :application_settings, :new_user_signups_cap, :integer + end +end diff --git a/db/migrate/20201019130244_remove_license_compliance_temp_index.rb b/db/migrate/20201019130244_remove_license_compliance_temp_index.rb new file mode 100644 index 00000000000..d0383d999ed --- /dev/null +++ b/db/migrate/20201019130244_remove_license_compliance_temp_index.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class RemoveLicenseComplianceTempIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_ci_job_artifacts_on_license_compliance_file_types' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :ci_job_artifacts, name: INDEX_NAME + end + + def down + add_concurrent_index :ci_job_artifacts, [:job_id, :file_type], where: 'file_type = 10 OR file_type = 101', name: INDEX_NAME + end +end diff --git a/db/migrate/20201019152046_add_default_branch_to_daily_build_group_report_result.rb b/db/migrate/20201019152046_add_default_branch_to_daily_build_group_report_result.rb new file mode 100644 index 00000000000..8a0051b8106 --- /dev/null +++ b/db/migrate/20201019152046_add_default_branch_to_daily_build_group_report_result.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddDefaultBranchToDailyBuildGroupReportResult < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :ci_daily_build_group_report_results, :default_branch, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20201019161924_add_partitioned_table_view.rb b/db/migrate/20201019161924_add_partitioned_table_view.rb new file mode 100644 index 00000000000..45bbfda40ff --- /dev/null +++ b/db/migrate/20201019161924_add_partitioned_table_view.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +class AddPartitionedTableView < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + execute(<<~SQL) + CREATE OR REPLACE VIEW postgres_partitioned_tables AS + SELECT + pg_namespace.nspname::text || '.'::text || pg_class.relname::text AS identifier, + pg_class.oid AS oid, + pg_namespace.nspname AS schema, + pg_class.relname AS name, + CASE partitioned_tables.partstrat + WHEN 'l' THEN 'list' + WHEN 'r' THEN 'range' + WHEN 'h' THEN 'hash' + END as strategy, + array_agg(pg_attribute.attname) as key_columns + FROM ( + SELECT + partrelid, + partstrat, + unnest(partattrs) as column_position + FROM pg_partitioned_table + ) partitioned_tables + INNER JOIN pg_class + ON partitioned_tables.partrelid = pg_class.oid + INNER JOIN pg_namespace + ON pg_class.relnamespace = pg_namespace.oid + INNER JOIN pg_attribute + ON pg_attribute.attrelid = pg_class.oid + AND pg_attribute.attnum = partitioned_tables.column_position + WHERE pg_namespace.nspname = current_schema() + GROUP BY identifier, pg_class.oid, schema, name, strategy; + SQL + end + + def down + execute(<<~SQL) + DROP VIEW IF EXISTS postgres_partitioned_tables + SQL + end +end diff --git a/db/migrate/20201019172704_add_partitions_view.rb b/db/migrate/20201019172704_add_partitions_view.rb new file mode 100644 index 00000000000..991d137faf3 --- /dev/null +++ b/db/migrate/20201019172704_add_partitions_view.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +class AddPartitionsView < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + execute(<<~SQL) + CREATE OR REPLACE VIEW postgres_partitions AS + SELECT + pg_namespace.nspname::text || '.'::text || pg_class.relname::text AS identifier, + pg_class.oid AS oid, + pg_namespace.nspname AS schema, + pg_class.relname AS name, + parent_namespace.nspname::text || '.'::text || parent_class.relname::text AS parent_identifier, + pg_get_expr(pg_class.relpartbound, pg_inherits.inhrelid) AS condition + FROM pg_class + INNER JOIN pg_namespace + ON pg_namespace.oid = pg_class.relnamespace + INNER JOIN pg_inherits + ON pg_class.oid = pg_inherits.inhrelid + INNER JOIN pg_class parent_class + ON pg_inherits.inhparent = parent_class.oid + INNER JOIN pg_namespace parent_namespace + ON parent_class.relnamespace = parent_namespace.oid + WHERE pg_class.relispartition + AND pg_namespace.nspname IN ( + current_schema(), + 'gitlab_partitions_dynamic', + 'gitlab_partitions_static' + ) + SQL + end + + def down + execute(<<~SQL) + DROP VIEW IF EXISTS postgres_partitions + SQL + end +end diff --git a/db/migrate/20201021085007_create_analytics_devops_adoption_segments.rb b/db/migrate/20201021085007_create_analytics_devops_adoption_segments.rb new file mode 100644 index 00000000000..3e322675ba6 --- /dev/null +++ b/db/migrate/20201021085007_create_analytics_devops_adoption_segments.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class CreateAnalyticsDevopsAdoptionSegments < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + create_table :analytics_devops_adoption_segments, if_not_exists: true do |t| + t.text :name, null: false, index: { unique: true } + t.datetime_with_timezone :last_recorded_at + + t.timestamps_with_timezone + end + + add_text_limit :analytics_devops_adoption_segments, :name, 255 + end + + def down + drop_table :analytics_devops_adoption_segments + end +end diff --git a/db/migrate/20201021101956_add_index_route_on_name_trigram_to_route.rb b/db/migrate/20201021101956_add_index_route_on_name_trigram_to_route.rb new file mode 100644 index 00000000000..cf65c7500c5 --- /dev/null +++ b/db/migrate/20201021101956_add_index_route_on_name_trigram_to_route.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexRouteOnNameTrigramToRoute < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_route_on_name_trigram' + + disable_ddl_transaction! + + def up + add_concurrent_index :routes, :name, name: INDEX_NAME, using: :gin, opclass: { name: :gin_trgm_ops } + end + + def down + remove_concurrent_index_by_name(:routes, INDEX_NAME) + end +end diff --git a/db/migrate/20201021102554_create_analytics_devops_adoption_segment_selections.rb b/db/migrate/20201021102554_create_analytics_devops_adoption_segment_selections.rb new file mode 100644 index 00000000000..c5aac7a82a5 --- /dev/null +++ b/db/migrate/20201021102554_create_analytics_devops_adoption_segment_selections.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class CreateAnalyticsDevopsAdoptionSegmentSelections < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + create_table :analytics_devops_adoption_segment_selections do |t| + t.references :segment, index: { name: 'index_on_segment_selections_segment_id' }, null: false, foreign_key: { to_table: :analytics_devops_adoption_segments, on_delete: :cascade } + t.bigint :group_id + t.bigint :project_id + t.index [:group_id, :segment_id], unique: true, name: 'index_on_segment_selections_group_id_segment_id' + t.index [:project_id, :segment_id], unique: true, name: 'index_on_segment_selections_project_id_segment_id' + + t.timestamps_with_timezone + end + end +end diff --git a/db/migrate/20201021105347_add_foreign_key_project_id_to_segment_selection.rb b/db/migrate/20201021105347_add_foreign_key_project_id_to_segment_selection.rb new file mode 100644 index 00000000000..651770e059c --- /dev/null +++ b/db/migrate/20201021105347_add_foreign_key_project_id_to_segment_selection.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddForeignKeyProjectIdToSegmentSelection < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key(:analytics_devops_adoption_segment_selections, :projects, column: :project_id, on_delete: :cascade) + end + + def down + with_lock_retries do + remove_foreign_key :analytics_devops_adoption_segment_selections, column: :project_id + end + end +end diff --git a/db/migrate/20201021105600_add_foreign_key_group_id_to_segment_selection.rb b/db/migrate/20201021105600_add_foreign_key_group_id_to_segment_selection.rb new file mode 100644 index 00000000000..3ee73ee3a64 --- /dev/null +++ b/db/migrate/20201021105600_add_foreign_key_group_id_to_segment_selection.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddForeignKeyGroupIdToSegmentSelection < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key(:analytics_devops_adoption_segment_selections, :namespaces, column: :group_id, on_delete: :cascade) + end + + def down + with_lock_retries do + remove_foreign_key :analytics_devops_adoption_segment_selections, column: :group_id + end + end +end diff --git a/db/migrate/20201021105959_add_check_constraint_to_segment_selection.rb b/db/migrate/20201021105959_add_check_constraint_to_segment_selection.rb new file mode 100644 index 00000000000..68fec36aa8a --- /dev/null +++ b/db/migrate/20201021105959_add_check_constraint_to_segment_selection.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddCheckConstraintToSegmentSelection < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + CONSTRAINT_NAME = 'segment_selection_project_id_or_group_id_required' + + def up + add_check_constraint :analytics_devops_adoption_segment_selections, '(project_id != NULL AND group_id IS NULL) OR (group_id != NULL AND project_id IS NULL)', CONSTRAINT_NAME + end + + def down + remove_check_constraint :analytics_devops_adoption_segment_selections, CONSTRAINT_NAME + end +end diff --git a/db/migrate/20201021142812_add_index_to_ci_daily_build_group_report_results.rb b/db/migrate/20201021142812_add_index_to_ci_daily_build_group_report_results.rb new file mode 100644 index 00000000000..c811e3deeda --- /dev/null +++ b/db/migrate/20201021142812_add_index_to_ci_daily_build_group_report_results.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class AddIndexToCiDailyBuildGroupReportResults < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_ci_daily_build_group_report_results_on_project_and_date' + + disable_ddl_transaction! + + def up + add_concurrent_index( + :ci_daily_build_group_report_results, + [:project_id, :date], + order: { date: :desc }, + where: "default_branch = TRUE AND (data -> 'coverage') IS NOT NULL", + name: INDEX_NAME + ) + end + + def down + remove_concurrent_index_by_name(:ci_daily_build_group_report_results, INDEX_NAME) + end +end diff --git a/db/migrate/20201021152210_add_secret_detection_token_revocation_application_settings.rb b/db/migrate/20201021152210_add_secret_detection_token_revocation_application_settings.rb new file mode 100644 index 00000000000..6334dcd8c1a --- /dev/null +++ b/db/migrate/20201021152210_add_secret_detection_token_revocation_application_settings.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddSecretDetectionTokenRevocationApplicationSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + add_column :application_settings, :secret_detection_token_revocation_enabled, :boolean, default: false, null: false + add_column :application_settings, :secret_detection_token_revocation_url, :text, null: true # rubocop:disable Migration/AddLimitToTextColumns + + add_column :application_settings, :encrypted_secret_detection_token_revocation_token, :text + add_column :application_settings, :encrypted_secret_detection_token_revocation_token_iv, :text + end + + def down + remove_column :application_settings, :secret_detection_token_revocation_enabled + remove_column :application_settings, :secret_detection_token_revocation_url + + remove_column :application_settings, :encrypted_secret_detection_token_revocation_token + remove_column :application_settings, :encrypted_secret_detection_token_revocation_token_iv + end +end diff --git a/db/migrate/20201021190539_add_text_limit_to_secret_detection_token_revocation_application_settings.rb b/db/migrate/20201021190539_add_text_limit_to_secret_detection_token_revocation_application_settings.rb new file mode 100644 index 00000000000..ea5e12322d0 --- /dev/null +++ b/db/migrate/20201021190539_add_text_limit_to_secret_detection_token_revocation_application_settings.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddTextLimitToSecretDetectionTokenRevocationApplicationSettings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :secret_detection_token_revocation_url, 255 + end + + def down + remove_text_limit :application_settings, :secret_detection_token_revocation_url + end +end diff --git a/db/migrate/20201021220101_add_merge_trains_enabled.rb b/db/migrate/20201021220101_add_merge_trains_enabled.rb new file mode 100644 index 00000000000..88a71897435 --- /dev/null +++ b/db/migrate/20201021220101_add_merge_trains_enabled.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddMergeTrainsEnabled < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :project_ci_cd_settings, :merge_trains_enabled, :boolean, default: false, allow_null: false + end +end diff --git a/db/migrate/20201022080802_add_repository_read_only_to_snippets.rb b/db/migrate/20201022080802_add_repository_read_only_to_snippets.rb new file mode 100644 index 00000000000..d0cb329fb02 --- /dev/null +++ b/db/migrate/20201022080802_add_repository_read_only_to_snippets.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddRepositoryReadOnlyToSnippets < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :snippets, :repository_read_only, :boolean, default: false, null: false + end +end diff --git a/db/migrate/20201022094845_add_historical_data_recorded_at.rb b/db/migrate/20201022094845_add_historical_data_recorded_at.rb new file mode 100644 index 00000000000..c90889e2d38 --- /dev/null +++ b/db/migrate/20201022094845_add_historical_data_recorded_at.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddHistoricalDataRecordedAt < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + add_column(:historical_data, :recorded_at, :timestamptz) + end + + def down + remove_column(:historical_data, :recorded_at) + end +end diff --git a/db/migrate/20201022094846_update_historical_data_recorded_at.rb b/db/migrate/20201022094846_update_historical_data_recorded_at.rb new file mode 100644 index 00000000000..bd1889149bb --- /dev/null +++ b/db/migrate/20201022094846_update_historical_data_recorded_at.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class UpdateHistoricalDataRecordedAt < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + update_value = Arel.sql("COALESCE(created_at, date + '12:00'::time AT TIME ZONE '#{Time.zone&.tzinfo&.name || "Etc/UTC"}')") + + update_column_in_batches(:historical_data, :recorded_at, update_value) do |table, query| + query.where(table[:recorded_at].eq(nil)) + end + + add_not_null_constraint :historical_data, :recorded_at + + change_column_null :historical_data, :date, true + end + + def down + change_column_null :historical_data, :date, false + + remove_not_null_constraint :historical_data, :recorded_at + + update_column_in_batches(:historical_data, :recorded_at, nil) do |table, query| + query.where(table[:recorded_at].not_eq(nil)) + end + end +end diff --git a/db/migrate/20201022103304_add_availability_to_user_statuses.rb b/db/migrate/20201022103304_add_availability_to_user_statuses.rb new file mode 100644 index 00000000000..9144c81fcfb --- /dev/null +++ b/db/migrate/20201022103304_add_availability_to_user_statuses.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddAvailabilityToUserStatuses < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :user_statuses, :availability, :integer, limit: 2, default: 0, null: false + end +end diff --git a/db/migrate/20201022144501_create_snippet_repository_storage_move.rb b/db/migrate/20201022144501_create_snippet_repository_storage_move.rb new file mode 100644 index 00000000000..7db38191942 --- /dev/null +++ b/db/migrate/20201022144501_create_snippet_repository_storage_move.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +class CreateSnippetRepositoryStorageMove < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless table_exists?(:snippet_repository_storage_moves) + with_lock_retries do + create_table :snippet_repository_storage_moves do |t| + t.timestamps_with_timezone + t.references :snippet, index: true, null: false, foreign_key: { on_delete: :cascade } + t.integer :state, limit: 2, default: 1, null: false + t.text :source_storage_name, null: false + t.text :destination_storage_name, null: false + end + end + end + + add_text_limit(:snippet_repository_storage_moves, :source_storage_name, 255, constraint_name: 'snippet_repository_storage_moves_source_storage_name') + add_text_limit(:snippet_repository_storage_moves, :destination_storage_name, 255, constraint_name: 'snippet_repository_storage_moves_destination_storage_name') + end + + def down + with_lock_retries do + drop_table :snippet_repository_storage_moves + end + end +end diff --git a/db/migrate/20201022191817_add_has_vulnerabilities_into_project_settings.rb b/db/migrate/20201022191817_add_has_vulnerabilities_into_project_settings.rb new file mode 100644 index 00000000000..bb2d683c4e2 --- /dev/null +++ b/db/migrate/20201022191817_add_has_vulnerabilities_into_project_settings.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddHasVulnerabilitiesIntoProjectSettings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :project_settings, :has_vulnerabilities, :boolean, default: false, null: false + end + end + + def down + with_lock_retries do + remove_column :project_settings, :has_vulnerabilities + end + end +end diff --git a/db/migrate/20201022192254_index_project_settings_on_project_id_partially.rb b/db/migrate/20201022192254_index_project_settings_on_project_id_partially.rb new file mode 100644 index 00000000000..57247bd0f22 --- /dev/null +++ b/db/migrate/20201022192254_index_project_settings_on_project_id_partially.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class IndexProjectSettingsOnProjectIdPartially < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_project_settings_on_project_id_partially' + + disable_ddl_transaction! + + def up + add_concurrent_index :project_settings, :project_id, name: INDEX_NAME, where: 'has_vulnerabilities IS TRUE' + end + + def down + remove_concurrent_index_by_name :project_settings, INDEX_NAME + end +end diff --git a/db/migrate/20201023114628_create_merge_request_cleanup_schedules.rb b/db/migrate/20201023114628_create_merge_request_cleanup_schedules.rb new file mode 100644 index 00000000000..f63738682b1 --- /dev/null +++ b/db/migrate/20201023114628_create_merge_request_cleanup_schedules.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class CreateMergeRequestCleanupSchedules < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + create_table :merge_request_cleanup_schedules, id: false do |t| + t.references :merge_request, primary_key: true, index: { unique: true }, null: false, foreign_key: { on_delete: :cascade } + t.datetime_with_timezone :scheduled_at, null: false + t.datetime_with_timezone :completed_at, null: true + + t.timestamps_with_timezone + + t.index :scheduled_at, where: 'completed_at IS NULL', name: 'index_mr_cleanup_schedules_timestamps' + end + end + end + + def down + with_lock_retries do + drop_table :merge_request_cleanup_schedules + end + end +end diff --git a/db/migrate/20201026200736_seed_merge_trains_enabled.rb b/db/migrate/20201026200736_seed_merge_trains_enabled.rb new file mode 100644 index 00000000000..c22c2a408bc --- /dev/null +++ b/db/migrate/20201026200736_seed_merge_trains_enabled.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class SeedMergeTrainsEnabled < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + update_column_in_batches(:project_ci_cd_settings, :merge_trains_enabled, true) do |table, query| + query.where(table[:merge_pipelines_enabled].eq(true)) + end + end + + def down + # no-op + end +end diff --git a/db/migrate/20201027002551_migrate_services_to_http_integrations.rb b/db/migrate/20201027002551_migrate_services_to_http_integrations.rb new file mode 100644 index 00000000000..5fe05320862 --- /dev/null +++ b/db/migrate/20201027002551_migrate_services_to_http_integrations.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +class MigrateServicesToHttpIntegrations < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + ALERT_SERVICE_TYPE = 'AlertsService' + SERVICE_NAMES_IDENTIFIER = { + name: 'HTTP endpoint', + identifier: 'legacy' + } + + class HttpIntegration < ActiveRecord::Base + self.table_name = 'alert_management_http_integrations' + end + + # For each Alerts service, + # Create the matching HttpIntegration + def up + HttpIntegration.reset_column_information + + sql = <<~SQL + SELECT * FROM services + JOIN alerts_service_data + ON (services.id = alerts_service_data.service_id) + WHERE type = '#{ALERT_SERVICE_TYPE}' + AND active = TRUE + SQL + + current_time = Time.current + + values = select_all(sql).map do |alerts_service| + { + project_id: alerts_service['project_id'], + name: SERVICE_NAMES_IDENTIFIER[:name], + endpoint_identifier: SERVICE_NAMES_IDENTIFIER[:identifier], + encrypted_token: alerts_service['encrypted_token'], + encrypted_token_iv: alerts_service['encrypted_token_iv'], + active: alerts_service['active'], + updated_at: current_time, + created_at: current_time + } + end + + HttpIntegration.insert_all(values) if values.present? + end + + def down + # no-op + end +end diff --git a/db/migrate/20201027135651_add_auto_rollback_setting.rb b/db/migrate/20201027135651_add_auto_rollback_setting.rb new file mode 100644 index 00000000000..8e916ac9d36 --- /dev/null +++ b/db/migrate/20201027135651_add_auto_rollback_setting.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddAutoRollbackSetting < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_column :project_ci_cd_settings, :auto_rollback_enabled, :boolean, default: false, null: false + end + end + + def down + with_lock_retries do + remove_column :project_ci_cd_settings, :auto_rollback_enabled + end + end +end diff --git a/db/migrate/20201027210127_add_index_to_oauth_access_grants_resource_owner_id.rb b/db/migrate/20201027210127_add_index_to_oauth_access_grants_resource_owner_id.rb new file mode 100644 index 00000000000..035d2fb4386 --- /dev/null +++ b/db/migrate/20201027210127_add_index_to_oauth_access_grants_resource_owner_id.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddIndexToOauthAccessGrantsResourceOwnerId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_oauth_access_grants_on_resource_owner_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :oauth_access_grants, %i[resource_owner_id application_id created_at], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :oauth_access_grants, INDEX_NAME + end +end diff --git a/db/migrate/20201027211138_increase_default_diff_max_patch_bytes.rb b/db/migrate/20201027211138_increase_default_diff_max_patch_bytes.rb new file mode 100644 index 00000000000..92d9025706f --- /dev/null +++ b/db/migrate/20201027211138_increase_default_diff_max_patch_bytes.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class IncreaseDefaultDiffMaxPatchBytes < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + change_column_default(:application_settings, :diff_max_patch_bytes, from: 102400, to: 204800) + end +end diff --git a/db/migrate/20201028160831_add_temporary_index_to_vulnerabilities_table.rb b/db/migrate/20201028160831_add_temporary_index_to_vulnerabilities_table.rb new file mode 100644 index 00000000000..05bb75be75a --- /dev/null +++ b/db/migrate/20201028160831_add_temporary_index_to_vulnerabilities_table.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddTemporaryIndexToVulnerabilitiesTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'temporary_index_vulnerabilities_on_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :vulnerabilities, :id, where: "state = 2 AND (dismissed_at IS NULL OR dismissed_by_id IS NULL)", name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME + end +end diff --git a/db/migrate/20201028184640_add_helm_major_version_to_clusters.rb b/db/migrate/20201028184640_add_helm_major_version_to_clusters.rb new file mode 100644 index 00000000000..2169fd41826 --- /dev/null +++ b/db/migrate/20201028184640_add_helm_major_version_to_clusters.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 AddHelmMajorVersionToClusters < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column(:clusters, :helm_major_version, :integer, default: 2, null: false) + end +end diff --git a/db/migrate/20201028204306_migrate_default_diff_max_patch_bytes_to_minimum_200kb.rb b/db/migrate/20201028204306_migrate_default_diff_max_patch_bytes_to_minimum_200kb.rb new file mode 100644 index 00000000000..11d47904e67 --- /dev/null +++ b/db/migrate/20201028204306_migrate_default_diff_max_patch_bytes_to_minimum_200kb.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class MigrateDefaultDiffMaxPatchBytesToMinimum200kb < ActiveRecord::Migration[6.0] + DOWNTIME = false + MAX_SIZE = 200.kilobytes + + class ApplicationSetting < ActiveRecord::Base + self.table_name = 'application_settings' + end + + def up + table = ApplicationSetting.arel_table + ApplicationSetting.where(table[:diff_max_patch_bytes].lt(MAX_SIZE)).update_all(diff_max_patch_bytes: MAX_SIZE) + end + + def down + table = ApplicationSetting.arel_table + ApplicationSetting.where(table[:diff_max_patch_bytes].eq(MAX_SIZE)).update_all(diff_max_patch_bytes: 100.kilobytes) + end +end diff --git a/db/migrate/20201029143650_rename_application_settings_to_allow_deny_names.rb b/db/migrate/20201029143650_rename_application_settings_to_allow_deny_names.rb new file mode 100644 index 00000000000..2d96da91069 --- /dev/null +++ b/db/migrate/20201029143650_rename_application_settings_to_allow_deny_names.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class RenameApplicationSettingsToAllowDenyNames < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + rename_column_concurrently :application_settings, :domain_blacklist_enabled, :domain_denylist_enabled + rename_column_concurrently :application_settings, :domain_blacklist, :domain_denylist + rename_column_concurrently :application_settings, :domain_whitelist, :domain_allowlist + end + + def down + undo_rename_column_concurrently :application_settings, :domain_blacklist_enabled, :domain_denylist_enabled + undo_rename_column_concurrently :application_settings, :domain_blacklist, :domain_denylist + undo_rename_column_concurrently :application_settings, :domain_whitelist, :domain_allowlist + end +end diff --git a/db/migrate/20201029144444_create_vulnerability_finding_links.rb b/db/migrate/20201029144444_create_vulnerability_finding_links.rb new file mode 100644 index 00000000000..80f93b9a0af --- /dev/null +++ b/db/migrate/20201029144444_create_vulnerability_finding_links.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class CreateVulnerabilityFindingLinks < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + create_table :vulnerability_finding_links, if_not_exists: true do |t| + t.timestamps_with_timezone null: false + t.references :vulnerability_occurrence, index: { name: 'finding_links_on_vulnerability_occurrence_id' }, null: false, foreign_key: { on_delete: :cascade } + t.text :name, limit: 255 + t.text :url, limit: 2048, null: false + end + + add_text_limit :vulnerability_finding_links, :name, 255 + add_text_limit :vulnerability_finding_links, :url, 2048 + end + + def down + drop_table :vulnerability_finding_links + end +end diff --git a/db/migrate/20201030092151_add_requirements_access_level_to_project_features.rb b/db/migrate/20201030092151_add_requirements_access_level_to_project_features.rb new file mode 100644 index 00000000000..e4ba7b2adb9 --- /dev/null +++ b/db/migrate/20201030092151_add_requirements_access_level_to_project_features.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddRequirementsAccessLevelToProjectFeatures < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + unless column_exists?(:project_features, :requirements_access_level) + with_lock_retries { add_column :project_features, :requirements_access_level, :integer, default: 20, null: false } + end + end + + def down + if column_exists?(:project_features, :requirements_access_level) + with_lock_retries { remove_column :project_features, :requirements_access_level } + end + end +end diff --git a/db/migrate/20201030200115_add_iid_to_design_management_design.rb b/db/migrate/20201030200115_add_iid_to_design_management_design.rb new file mode 100644 index 00000000000..c31cd86d5e2 --- /dev/null +++ b/db/migrate/20201030200115_add_iid_to_design_management_design.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddIidToDesignManagementDesign < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column :design_management_designs, :iid, :integer + end +end diff --git a/db/migrate/20201030200539_add_index_on_design_management_designs_iid_project_id.rb b/db/migrate/20201030200539_add_index_on_design_management_designs_iid_project_id.rb new file mode 100644 index 00000000000..3ff50c299cb --- /dev/null +++ b/db/migrate/20201030200539_add_index_on_design_management_designs_iid_project_id.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddIndexOnDesignManagementDesignsIidProjectId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME = 'index_design_management_designs_on_iid_and_project_id' + + def up + add_concurrent_index :design_management_designs, [:project_id, :iid], + name: INDEX_NAME, + unique: true + end + + def down + remove_concurrent_index_by_name :design_management_designs, INDEX_NAME + end +end diff --git a/db/migrate/20201102184743_add_index_to_incident_issues_on_project_and_created_at.rb b/db/migrate/20201102184743_add_index_to_incident_issues_on_project_and_created_at.rb new file mode 100644 index 00000000000..1fd900002c3 --- /dev/null +++ b/db/migrate/20201102184743_add_index_to_incident_issues_on_project_and_created_at.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class AddIndexToIncidentIssuesOnProjectAndCreatedAt < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + INCIDENT_TYPE = 1 + OLD_INDEX_NAME = 'index_issues_project_id_issue_type_incident' + NEW_INDEX_NAME = 'index_issues_on_project_id_and_created_at_issue_type_incident' + + DOWNTIME = false + disable_ddl_transaction! + + def up + add_concurrent_index :issues, + [:project_id, :created_at], + where: "issue_type = #{INCIDENT_TYPE}", + name: NEW_INDEX_NAME + + remove_concurrent_index_by_name :issues, OLD_INDEX_NAME + end + + def down + add_concurrent_index :issues, + :project_id, + where: "issue_type = #{INCIDENT_TYPE}", + name: OLD_INDEX_NAME + + remove_concurrent_index_by_name :issues, NEW_INDEX_NAME + end +end diff --git a/db/migrate/20201103095752_add_issues_closed_at_index.rb b/db/migrate/20201103095752_add_issues_closed_at_index.rb new file mode 100644 index 00000000000..7a8ee4e8d67 --- /dev/null +++ b/db/migrate/20201103095752_add_issues_closed_at_index.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIssuesClosedAtIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index(:issues, [:project_id, :closed_at]) + end + + def down + remove_concurrent_index_by_name(:issues, 'index_issues_on_project_id_and_closed_at') + end +end diff --git a/db/migrate/20201103171537_add_index_active_billable_users_to_user.rb b/db/migrate/20201103171537_add_index_active_billable_users_to_user.rb new file mode 100644 index 00000000000..3ad7a3f4ca3 --- /dev/null +++ b/db/migrate/20201103171537_add_index_active_billable_users_to_user.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddIndexActiveBillableUsersToUser < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'active_billable_users' + HUMAN_TYPE = 'NULL' + HUMAN_SVC_BOT_TYPES = "#{HUMAN_TYPE}, 6, 4" + BOT_TYPES = '2,6,1,3,7,8' + + disable_ddl_transaction! + + def up + add_concurrent_index :users, :id, name: INDEX_NAME, where: "(state = 'active' AND (user_type is #{HUMAN_TYPE} or user_type in (#{HUMAN_SVC_BOT_TYPES}))) and ((users.user_type IS #{HUMAN_TYPE}) OR (users.user_type <> ALL ('{#{BOT_TYPES}}')))" + end + + def down + remove_concurrent_index_by_name(:users, INDEX_NAME) + end +end diff --git a/db/migrate/20201103184333_create_packages_package_file_build_infos.rb b/db/migrate/20201103184333_create_packages_package_file_build_infos.rb new file mode 100644 index 00000000000..9cb6869cae4 --- /dev/null +++ b/db/migrate/20201103184333_create_packages_package_file_build_infos.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class CreatePackagesPackageFileBuildInfos < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + unless table_exists?(:packages_package_file_build_infos) + with_lock_retries do + create_table :packages_package_file_build_infos do |t| + t.references :package_file, index: true, + null: false, + foreign_key: { to_table: :packages_package_files, on_delete: :cascade }, + type: :bigint + t.references :pipeline, index: true, + null: true, + foreign_key: { to_table: :ci_pipelines, on_delete: :nullify }, + type: :bigint + end + end + end + end + + def down + with_lock_retries do + drop_table :packages_package_file_build_infos + end + end +end diff --git a/db/migrate/20201103202213_update_packages_build_infos_index.rb b/db/migrate/20201103202213_update_packages_build_infos_index.rb new file mode 100644 index 00000000000..d737517045b --- /dev/null +++ b/db/migrate/20201103202213_update_packages_build_infos_index.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class UpdatePackagesBuildInfosIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + NEW_INDEX_NAME = 'idx_packages_build_infos_on_package_id' + OLD_INDEX_NAME = 'index_packages_build_infos_on_package_id' + + def up + add_concurrent_index :packages_build_infos, :package_id, name: NEW_INDEX_NAME + remove_concurrent_index_by_name :packages_build_infos, OLD_INDEX_NAME + end + + def down + # No op. It is possible records would validate the UNIQUE constraint, so it + # cannot be added back to the index. + end +end diff --git a/db/migrate/20201104204739_create_bulk_import_trackers.rb b/db/migrate/20201104204739_create_bulk_import_trackers.rb new file mode 100644 index 00000000000..906bd06248d --- /dev/null +++ b/db/migrate/20201104204739_create_bulk_import_trackers.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +class CreateBulkImportTrackers < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + with_lock_retries do + unless table_exists?(:bulk_import_trackers) + create_table :bulk_import_trackers do |t| + t.references :bulk_import_entity, + null: false, + index: false, + foreign_key: { on_delete: :cascade } + + t.text :relation, null: false + t.text :next_page + t.boolean :has_next_page, default: false, null: false + + t.index %w(bulk_import_entity_id relation), + unique: true, + name: :bulk_import_trackers_uniq_relation_by_entity + end + end + end + + add_check_constraint :bulk_import_trackers, + '(has_next_page IS FALSE or next_page IS NOT NULL)', + 'check_next_page_requirement' + add_text_limit :bulk_import_trackers, :relation, 255 + add_text_limit :bulk_import_trackers, :next_page, 255 + end + + def down + with_lock_retries do + drop_table :bulk_import_trackers + end + end +end diff --git a/db/migrate/20201105021637_add_uploads_size_to_project_statistics.rb b/db/migrate/20201105021637_add_uploads_size_to_project_statistics.rb new file mode 100644 index 00000000000..1d2251f6c37 --- /dev/null +++ b/db/migrate/20201105021637_add_uploads_size_to_project_statistics.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddUploadsSizeToProjectStatistics < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + add_column :project_statistics, :uploads_size, :bigint, default: 0, null: false + end + + def down + remove_column :project_statistics, :uploads_size + end +end diff --git a/db/migrate/20201105024127_add_uploads_size_to_namespace_root_storage_statistics.rb b/db/migrate/20201105024127_add_uploads_size_to_namespace_root_storage_statistics.rb new file mode 100644 index 00000000000..c3cccc7d5f2 --- /dev/null +++ b/db/migrate/20201105024127_add_uploads_size_to_namespace_root_storage_statistics.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddUploadsSizeToNamespaceRootStorageStatistics < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + add_column :namespace_root_storage_statistics, :uploads_size, :bigint, default: 0, null: false + end + + def down + remove_column :namespace_root_storage_statistics, :uploads_size + end +end diff --git a/db/migrate/20201105135051_change_default_value_of_ci_max_artifact_size_lsif_of_plan_limits_from20_to100.rb b/db/migrate/20201105135051_change_default_value_of_ci_max_artifact_size_lsif_of_plan_limits_from20_to100.rb new file mode 100644 index 00000000000..d53f81ecabb --- /dev/null +++ b/db/migrate/20201105135051_change_default_value_of_ci_max_artifact_size_lsif_of_plan_limits_from20_to100.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class ChangeDefaultValueOfCiMaxArtifactSizeLsifOfPlanLimitsFrom20To100 < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + change_column_default :plan_limits, :ci_max_artifact_size_lsif, 100 + execute('UPDATE plan_limits SET ci_max_artifact_size_lsif = 100 WHERE ci_max_artifact_size_lsif = 20') + end + end + + def down + with_lock_retries do + change_column_default :plan_limits, :ci_max_artifact_size_lsif, 20 + execute('UPDATE plan_limits SET ci_max_artifact_size_lsif = 20 WHERE ci_max_artifact_size_lsif = 100') + end + end +end diff --git a/db/migrate/20201105143211_add_vulnerabilities_enabled_and_issuetype_to_jira_tracker_data.rb b/db/migrate/20201105143211_add_vulnerabilities_enabled_and_issuetype_to_jira_tracker_data.rb new file mode 100644 index 00000000000..27269de611c --- /dev/null +++ b/db/migrate/20201105143211_add_vulnerabilities_enabled_and_issuetype_to_jira_tracker_data.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddVulnerabilitiesEnabledAndIssuetypeToJiraTrackerData < ActiveRecord::Migration[6.0] + DOWNTIME = false + + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20201105143312_add_text_limit_to_jira_tracker_data_issuetype.rb + def change + add_column :jira_tracker_data, :vulnerabilities_issuetype, :text + add_column :jira_tracker_data, :vulnerabilities_enabled, :boolean, default: false, null: false + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20201105143312_add_text_limit_to_jira_tracker_data_issuetype.rb b/db/migrate/20201105143312_add_text_limit_to_jira_tracker_data_issuetype.rb new file mode 100644 index 00000000000..4a81b0ce7af --- /dev/null +++ b/db/migrate/20201105143312_add_text_limit_to_jira_tracker_data_issuetype.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddTextLimitToJiraTrackerDataIssuetype < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :jira_tracker_data, :vulnerabilities_issuetype, 255 + end + + def down + remove_text_limit :jira_tracker_data, :vulnerabilities_issuetype + end +end diff --git a/db/migrate/20201106134139_add_pipelines_created_index.rb b/db/migrate/20201106134139_add_pipelines_created_index.rb new file mode 100644 index 00000000000..aaf6643cf0b --- /dev/null +++ b/db/migrate/20201106134139_add_pipelines_created_index.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddPipelinesCreatedIndex < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + INDEX_NAME = :index_ci_pipelines_on_project_id_and_status_and_created_at + + disable_ddl_transaction! + + def up + add_concurrent_index :ci_pipelines, [:project_id, :status, :created_at], name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :ci_pipelines, INDEX_NAME + end +end diff --git a/db/migrate/20201107032257_add_default_true_require_admin_approval_after_user_signup_to_application_settings.rb b/db/migrate/20201107032257_add_default_true_require_admin_approval_after_user_signup_to_application_settings.rb new file mode 100644 index 00000000000..196f7bd8359 --- /dev/null +++ b/db/migrate/20201107032257_add_default_true_require_admin_approval_after_user_signup_to_application_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddDefaultTrueRequireAdminApprovalAfterUserSignupToApplicationSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + change_column_default :application_settings, :require_admin_approval_after_user_signup, from: false, to: true + end +end diff --git a/db/migrate/20201109144634_add_region_field_to_aws_role.rb b/db/migrate/20201109144634_add_region_field_to_aws_role.rb new file mode 100644 index 00000000000..ced75f24552 --- /dev/null +++ b/db/migrate/20201109144634_add_region_field_to_aws_role.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddRegionFieldToAwsRole < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + unless column_exists?(:aws_roles, :region) + add_column :aws_roles, :region, :text + end + + add_text_limit :aws_roles, :region, 255 + end + + def down + remove_column :aws_roles, :region + end +end diff --git a/db/migrate/20201109180311_add_secret_detection_revocation_token_types_application_settings.rb b/db/migrate/20201109180311_add_secret_detection_revocation_token_types_application_settings.rb new file mode 100644 index 00000000000..0823655f92f --- /dev/null +++ b/db/migrate/20201109180311_add_secret_detection_revocation_token_types_application_settings.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddSecretDetectionRevocationTokenTypesApplicationSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + add_column :application_settings, :secret_detection_revocation_token_types_url, :text, null: true # rubocop:disable Migration/AddLimitToTextColumns + end + + def down + remove_column :application_settings, :secret_detection_revocation_token_types_url + end +end diff --git a/db/migrate/20201109184023_add_text_limit_to_secret_detection_revocation_token_types_application_settings.rb b/db/migrate/20201109184023_add_text_limit_to_secret_detection_revocation_token_types_application_settings.rb new file mode 100644 index 00000000000..9e0329aafcc --- /dev/null +++ b/db/migrate/20201109184023_add_text_limit_to_secret_detection_revocation_token_types_application_settings.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddTextLimitToSecretDetectionRevocationTokenTypesApplicationSettings < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :secret_detection_revocation_token_types_url, 255 + end + + def down + remove_text_limit :application_settings, :secret_detection_revocation_token_types_url + end +end diff --git a/db/migrate/20201110035029_created_index_for_vulnerability_occurrences_on_project_fingerprint.rb b/db/migrate/20201110035029_created_index_for_vulnerability_occurrences_on_project_fingerprint.rb new file mode 100644 index 00000000000..fed117d5f08 --- /dev/null +++ b/db/migrate/20201110035029_created_index_for_vulnerability_occurrences_on_project_fingerprint.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class CreatedIndexForVulnerabilityOccurrencesOnProjectFingerprint < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_vulnerability_occurrences_on_project_fingerprint' + + disable_ddl_transaction! + + def up + add_concurrent_index :vulnerability_occurrences, :project_fingerprint, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :vulnerability_occurrences, INDEX_NAME + end +end diff --git a/db/migrate/20201110110454_extend_postgres_indexes_view.rb b/db/migrate/20201110110454_extend_postgres_indexes_view.rb new file mode 100644 index 00000000000..4e9172024d3 --- /dev/null +++ b/db/migrate/20201110110454_extend_postgres_indexes_view.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +class ExtendPostgresIndexesView < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + execute(<<~SQL) + DROP VIEW postgres_indexes; + + CREATE VIEW postgres_indexes AS + SELECT (pg_namespace.nspname::text || '.'::text) || pg_class.relname::text AS identifier, + pg_index.indexrelid, + pg_namespace.nspname AS schema, + pg_class.relname AS name, + pg_index.indisunique AS "unique", + pg_index.indisvalid AS valid_index, + pg_class.relispartition AS partitioned, + pg_index.indisexclusion AS exclusion, + pg_index.indexprs IS NOT NULL as expression, + pg_index.indpred IS NOT NULL as partial, + pg_indexes.indexdef AS definition, + pg_relation_size(pg_class.oid::regclass) AS ondisk_size_bytes + FROM pg_index + JOIN pg_class ON pg_class.oid = pg_index.indexrelid + JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid + JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname + WHERE pg_namespace.nspname <> 'pg_catalog'::name + AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])); + SQL + end + + def down + execute(<<~SQL) + DROP VIEW postgres_indexes; + + CREATE VIEW postgres_indexes AS + SELECT (pg_namespace.nspname::text || '.'::text) || pg_class.relname::text AS identifier, + pg_index.indexrelid, + pg_namespace.nspname AS schema, + pg_class.relname AS name, + pg_index.indisunique AS "unique", + pg_index.indisvalid AS valid_index, + pg_class.relispartition AS partitioned, + pg_index.indisexclusion AS exclusion, + pg_indexes.indexdef AS definition, + pg_relation_size(pg_class.oid::regclass) AS ondisk_size_bytes + FROM pg_index + JOIN pg_class ON pg_class.oid = pg_index.indexrelid + JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid + JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname + WHERE pg_namespace.nspname <> 'pg_catalog'::name + AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])); + SQL + end +end diff --git a/db/migrate/20201110133629_change_index_mr_metrics_target_project_id.rb b/db/migrate/20201110133629_change_index_mr_metrics_target_project_id.rb new file mode 100644 index 00000000000..5bd810207d8 --- /dev/null +++ b/db/migrate/20201110133629_change_index_mr_metrics_target_project_id.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class ChangeIndexMrMetricsTargetProjectId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + + DOWNTIME = false + INDEX_NAME = 'index_merge_request_metrics_on_target_project_id_merged_at' + NULLS_LAST_INDEX_NAME = 'index_mr_metrics_on_target_project_id_merged_at_nulls_last' + + def up + add_concurrent_index :merge_request_metrics, [:target_project_id, :merged_at, :id], order: { merged_at: 'DESC NULLS LAST', id: 'DESC' }, name: NULLS_LAST_INDEX_NAME + remove_concurrent_index_by_name(:merge_request_metrics, INDEX_NAME) + end + + def down + add_concurrent_index :merge_request_metrics, [:target_project_id, :merged_at], name: INDEX_NAME + remove_concurrent_index_by_name(:merge_request_metrics, NULLS_LAST_INDEX_NAME) + end +end diff --git a/db/migrate/20201111110318_add_cloud_license_auth_token_to_settings.rb b/db/migrate/20201111110318_add_cloud_license_auth_token_to_settings.rb new file mode 100644 index 00000000000..e2069835597 --- /dev/null +++ b/db/migrate/20201111110318_add_cloud_license_auth_token_to_settings.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddCloudLicenseAuthTokenToSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + # rubocop:disable Migration/AddLimitToTextColumns + # limit is added in 20201111110918_add_cloud_license_auth_token_application_settings_text_limit + def change + add_column :application_settings, :encrypted_cloud_license_auth_token, :text + add_column :application_settings, :encrypted_cloud_license_auth_token_iv, :text + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20201111110918_add_cloud_license_auth_token_application_settings_text_limit.rb b/db/migrate/20201111110918_add_cloud_license_auth_token_application_settings_text_limit.rb new file mode 100644 index 00000000000..fd1ee5e07bf --- /dev/null +++ b/db/migrate/20201111110918_add_cloud_license_auth_token_application_settings_text_limit.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddCloudLicenseAuthTokenApplicationSettingsTextLimit < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :encrypted_cloud_license_auth_token_iv, 255 + end + + def down + remove_text_limit :application_settings, :encrypted_cloud_license_auth_token_iv + end +end diff --git a/db/migrate/20201111152859_add_missing_expression_indexes.rb b/db/migrate/20201111152859_add_missing_expression_indexes.rb new file mode 100644 index 00000000000..e2742f7f3bc --- /dev/null +++ b/db/migrate/20201111152859_add_missing_expression_indexes.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +class AddMissingExpressionIndexes < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + INDEXES = [ + [:namespaces, :index_on_namespaces_lower_name, 'LOWER(name)'], + [:namespaces, :index_on_namespaces_lower_path, 'LOWER(path)'], + [:projects, :index_on_projects_lower_path, 'LOWER(path)'], + [:routes, :index_on_routes_lower_path, 'LOWER(path)'], + [:users, :index_on_users_lower_username, 'LOWER(username)'], + [:users, :index_on_users_lower_email, 'LOWER(email)'] + ] + + def up + # Those indexes had been introduced before, but they haven't been + # captured in structure.sql. For installations that already have it, + # this is a no-op - others will get it retroactively with + # this migration. + + tables = Set.new + + INDEXES.each do |(table, name, expression)| + unless index_name_exists?(table, name) + add_concurrent_index table, expression, name: name + tables.add(table) + end + end + + # Rebuild statistics on affected tables only + tables.each do |table| + execute("ANALYZE #{table}") + end + end + + def down + # no-op + end +end diff --git a/db/migrate/20201112195322_reseed_merge_trains_enabled.rb b/db/migrate/20201112195322_reseed_merge_trains_enabled.rb new file mode 100644 index 00000000000..777c59d16b1 --- /dev/null +++ b/db/migrate/20201112195322_reseed_merge_trains_enabled.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class ReseedMergeTrainsEnabled < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + update_column_in_batches(:project_ci_cd_settings, :merge_trains_enabled, true) do |table, query| + query.where(table[:merge_pipelines_enabled].eq(true)) + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20201015073808_schedule_blocked_by_links_replacement.rb b/db/post_migrate/20201015073808_schedule_blocked_by_links_replacement.rb index 7833d7c4c04..dd8cbb57136 100644 --- a/db/post_migrate/20201015073808_schedule_blocked_by_links_replacement.rb +++ b/db/post_migrate/20201015073808_schedule_blocked_by_links_replacement.rb @@ -19,10 +19,8 @@ class ScheduleBlockedByLinksReplacement < ActiveRecord::Migration[6.0] end def up - relation = IssueLink.where(link_type: 2) - - queue_background_migration_jobs_by_range_at_intervals( - relation, MIGRATION, INTERVAL, batch_size: BATCH_SIZE) + # no-op + # superseded by db/post_migrate/20201102073808_schedule_blocked_by_links_replacement_second_try.rb end def down diff --git a/db/post_migrate/20201019094741_rename_sitemap_root_namespaces.rb b/db/post_migrate/20201019094741_rename_sitemap_root_namespaces.rb new file mode 100644 index 00000000000..20812a53bfb --- /dev/null +++ b/db/post_migrate/20201019094741_rename_sitemap_root_namespaces.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class RenameSitemapRootNamespaces < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + include Gitlab::Database::RenameReservedPathsMigration::V1 + + DOWNTIME = false + + disable_ddl_transaction! + + # We're taking over the /sitemap.xml and /sitemap.xml.gz namespaces + # since they're necessary for the default behavior of Sitemaps + def up + disable_statement_timeout do + rename_root_paths(['sitemap.xml', 'sitemap.xml.gz']) + end + end + + def down + disable_statement_timeout do + revert_renames + end + end +end diff --git a/db/post_migrate/20201020102551_remove_index_service_for_usage_data.rb b/db/post_migrate/20201020102551_remove_index_service_for_usage_data.rb new file mode 100644 index 00000000000..a0d39ecd2c1 --- /dev/null +++ b/db/post_migrate/20201020102551_remove_index_service_for_usage_data.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class RemoveIndexServiceForUsageData < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_services_on_type_id_when_active_not_instance_not_template' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :services, INDEX_NAME + end + + def down + add_concurrent_index :services, [:type, :id], where: 'active = TRUE AND instance = FALSE AND template = FALSE', name: INDEX_NAME + end +end diff --git a/db/post_migrate/20201026051643_remove_scanned_resources_count_from_security_scans.rb b/db/post_migrate/20201026051643_remove_scanned_resources_count_from_security_scans.rb new file mode 100644 index 00000000000..208448e2278 --- /dev/null +++ b/db/post_migrate/20201026051643_remove_scanned_resources_count_from_security_scans.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class RemoveScannedResourcesCountFromSecurityScans < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + remove_column :security_scans, :scanned_resources_count + end + + def down + add_column :security_scans, :scanned_resources_count, :integer + end +end diff --git a/db/post_migrate/20201026182253_schedule_populate_vulnerability_feedback_pipeline_id.rb b/db/post_migrate/20201026182253_schedule_populate_vulnerability_feedback_pipeline_id.rb new file mode 100644 index 00000000000..2df475ab2a8 --- /dev/null +++ b/db/post_migrate/20201026182253_schedule_populate_vulnerability_feedback_pipeline_id.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class SchedulePopulateVulnerabilityFeedbackPipelineId < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INTERVAL = 2.minutes.to_i + BATCH_SIZE = 100 + MIGRATION = 'PopulateVulnerabilityFeedbackPipelineId' + + disable_ddl_transaction! + + def up + return unless Gitlab.ee? + + vulnerability_feedback = exec_query <<~SQL + SELECT DISTINCT "vulnerability_feedback"."project_id" + FROM "vulnerability_feedback" + WHERE "vulnerability_feedback"."pipeline_id" IS NULL + ORDER BY "vulnerability_feedback"."project_id" ASC + SQL + + return if vulnerability_feedback.rows.blank? + + vulnerability_feedback.rows.flatten.in_groups_of(BATCH_SIZE, false).each_with_index do |project_ids, index| + migrate_in(index * INTERVAL, MIGRATION, [project_ids]) + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20201028160832_schedule_populate_missing_dismissal_information_for_vulnerabilities.rb b/db/post_migrate/20201028160832_schedule_populate_missing_dismissal_information_for_vulnerabilities.rb new file mode 100644 index 00000000000..f358ea863db --- /dev/null +++ b/db/post_migrate/20201028160832_schedule_populate_missing_dismissal_information_for_vulnerabilities.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class SchedulePopulateMissingDismissalInformationForVulnerabilities < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + BATCH_SIZE = 1_000 + DELAY_INTERVAL = 3.minutes.to_i + MIGRATION_CLASS = 'PopulateMissingVulnerabilityDismissalInformation' + + disable_ddl_transaction! + + def up + ::Gitlab::BackgroundMigration::PopulateMissingVulnerabilityDismissalInformation::Vulnerability.broken.each_batch(of: BATCH_SIZE) do |batch, index| + vulnerability_ids = batch.pluck(:id) + migrate_in(index * DELAY_INTERVAL, MIGRATION_CLASS, vulnerability_ids) + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20201028182809_backfill_jira_tracker_deployment_type2.rb b/db/post_migrate/20201028182809_backfill_jira_tracker_deployment_type2.rb new file mode 100644 index 00000000000..63a0554433c --- /dev/null +++ b/db/post_migrate/20201028182809_backfill_jira_tracker_deployment_type2.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +class BackfillJiraTrackerDeploymentType2 < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + MIGRATION = 'BackfillJiraTrackerDeploymentType2' + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 1000 + + disable_ddl_transaction! + + class JiraTrackerData < ActiveRecord::Base + include EachBatch + + self.table_name = 'jira_tracker_data' + end + + def up + queue_background_migration_jobs_by_range_at_intervals( + JiraTrackerData.where(deployment_type: 0), + MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE, + track_jobs: true) + end + + def down + # NOOP + end +end diff --git a/db/post_migrate/20201029052241_migrate_geo_blob_verification_primary_worker_sidekiq_queue.rb b/db/post_migrate/20201029052241_migrate_geo_blob_verification_primary_worker_sidekiq_queue.rb new file mode 100644 index 00000000000..64d22863389 --- /dev/null +++ b/db/post_migrate/20201029052241_migrate_geo_blob_verification_primary_worker_sidekiq_queue.rb @@ -0,0 +1,18 @@ +# 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 MigrateGeoBlobVerificationPrimaryWorkerSidekiqQueue < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + sidekiq_queue_migrate 'geo:geo_blob_verification_primary', to: 'geo:geo_verification' + end + + def down + sidekiq_queue_migrate 'geo:geo_verification', to: 'geo:geo_blob_verification_primary' + end +end diff --git a/db/post_migrate/20201029144157_cleanup_application_settings_to_allow_deny_rename.rb b/db/post_migrate/20201029144157_cleanup_application_settings_to_allow_deny_rename.rb new file mode 100644 index 00000000000..bb6fe4258c5 --- /dev/null +++ b/db/post_migrate/20201029144157_cleanup_application_settings_to_allow_deny_rename.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class CleanupApplicationSettingsToAllowDenyRename < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + + def up + cleanup_concurrent_column_rename :application_settings, :domain_blacklist_enabled, :domain_denylist_enabled + cleanup_concurrent_column_rename :application_settings, :domain_blacklist, :domain_denylist + cleanup_concurrent_column_rename :application_settings, :domain_whitelist, :domain_allowlist + end + + def down + undo_cleanup_concurrent_column_rename :application_settings, :domain_blacklist_enabled, :domain_denylist_enabled + undo_cleanup_concurrent_column_rename :application_settings, :domain_blacklist, :domain_denylist + undo_cleanup_concurrent_column_rename :application_settings, :domain_whitelist, :domain_allowlist + end +end diff --git a/db/post_migrate/20201030203854_backfill_design_iids.rb b/db/post_migrate/20201030203854_backfill_design_iids.rb new file mode 100644 index 00000000000..7acca6ad93d --- /dev/null +++ b/db/post_migrate/20201030203854_backfill_design_iids.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class BackfillDesignIids < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + class Designs < ActiveRecord::Base + include EachBatch + + self.table_name = 'design_management_designs' + end + + def up + backfill = ::Gitlab::BackgroundMigration::BackfillDesignInternalIds.new(Designs) + + Designs.select(:project_id).distinct.each_batch(of: 100, column: :project_id) do |relation| + backfill.perform(relation) + end + end + + def down + # NOOP + end +end diff --git a/db/post_migrate/20201102073808_schedule_blocked_by_links_replacement_second_try.rb b/db/post_migrate/20201102073808_schedule_blocked_by_links_replacement_second_try.rb new file mode 100644 index 00000000000..217d4f81d26 --- /dev/null +++ b/db/post_migrate/20201102073808_schedule_blocked_by_links_replacement_second_try.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class ScheduleBlockedByLinksReplacementSecondTry < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INTERVAL = 2.minutes + # at the time of writing there were 12931 blocked_by issues: + # estimated time is 13 batches * 2 minutes -> 26 minutes + BATCH_SIZE = 1000 + MIGRATION = 'ReplaceBlockedByLinks' + + disable_ddl_transaction! + + class IssueLink < ActiveRecord::Base + include EachBatch + + self.table_name = 'issue_links' + end + + def up + relation = IssueLink.where(link_type: 2) + + queue_background_migration_jobs_by_range_at_intervals( + relation, MIGRATION, INTERVAL, batch_size: BATCH_SIZE) + end + + def down + end +end diff --git a/db/post_migrate/20201102112206_rename_sitemap_namespace.rb b/db/post_migrate/20201102112206_rename_sitemap_namespace.rb new file mode 100644 index 00000000000..b2e610d68db --- /dev/null +++ b/db/post_migrate/20201102112206_rename_sitemap_namespace.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class RenameSitemapNamespace < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + include Gitlab::Database::RenameReservedPathsMigration::V1 + + DOWNTIME = false + + disable_ddl_transaction! + + # We're taking over the /sitemap namespace + # since it's necessary for the default behavior of Sitemaps + def up + disable_statement_timeout do + rename_root_paths(['sitemap']) + end + end + + def down + disable_statement_timeout do + revert_renames + end + end +end diff --git a/db/post_migrate/20201102114018_remove_storage_size_limit_from_application_settings.rb b/db/post_migrate/20201102114018_remove_storage_size_limit_from_application_settings.rb new file mode 100644 index 00000000000..6646cf2ad0c --- /dev/null +++ b/db/post_migrate/20201102114018_remove_storage_size_limit_from_application_settings.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class RemoveStorageSizeLimitFromApplicationSettings < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + remove_column :application_settings, :namespace_storage_size_limit + end + + def down + add_column :application_settings, :namespace_storage_size_limit, :bigint, default: 0 + end +end diff --git a/db/post_migrate/20201102152554_add_not_null_check_on_iid_on_design_manangement_designs.rb b/db/post_migrate/20201102152554_add_not_null_check_on_iid_on_design_manangement_designs.rb new file mode 100644 index 00000000000..861a0c3c27a --- /dev/null +++ b/db/post_migrate/20201102152554_add_not_null_check_on_iid_on_design_manangement_designs.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddNotNullCheckOnIidOnDesignManangementDesigns < ActiveRecord::Migration[6.0] + include ::Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_not_null_constraint(:design_management_designs, :iid) + end + + def down + remove_not_null_constraint(:design_management_designs, :iid) + end +end diff --git a/db/post_migrate/20201102152945_truncate_security_findings_table.rb b/db/post_migrate/20201102152945_truncate_security_findings_table.rb new file mode 100644 index 00000000000..8bfaa31f0de --- /dev/null +++ b/db/post_migrate/20201102152945_truncate_security_findings_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class TruncateSecurityFindingsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + return unless Gitlab.dev_env_or_com? + + with_lock_retries do + connection.execute('TRUNCATE security_findings RESTART IDENTITY') + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20201103013242_remove_terraform_state_verification_columns.rb b/db/post_migrate/20201103013242_remove_terraform_state_verification_columns.rb new file mode 100644 index 00000000000..b1cd9790ead --- /dev/null +++ b/db/post_migrate/20201103013242_remove_terraform_state_verification_columns.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class RemoveTerraformStateVerificationColumns < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + transaction do + remove_column :terraform_states, :verification_retry_at, :datetime_with_timezone + remove_column :terraform_states, :verified_at, :datetime_with_timezone + remove_column :terraform_states, :verification_retry_count, :integer, limit: 2 + remove_column :terraform_states, :verification_checksum, :binary, using: 'verification_checksum::bytea' + remove_column :terraform_states, :verification_failure, :text + end + end + + def down + add_column(:terraform_states, :verification_retry_at, :datetime_with_timezone) unless column_exists?(:terraform_states, :verification_retry_at) + add_column(:terraform_states, :verified_at, :datetime_with_timezone) unless column_exists?(:terraform_states, :verified_at) + add_column(:terraform_states, :verification_retry_count, :integer, limit: 2) unless column_exists?(:terraform_states, :verification_retry_count) + add_column(:terraform_states, :verification_checksum, :binary, using: 'verification_checksum::bytea') unless column_exists?(:terraform_states, :verification_checksum) + add_column(:terraform_states, :verification_failure, :text) unless column_exists?(:terraform_states, :verification_failure) + + add_text_limit :terraform_states, :verification_failure, 255 + end +end diff --git a/db/post_migrate/20201103110018_schedule_merge_request_cleanup_schedules_backfill.rb b/db/post_migrate/20201103110018_schedule_merge_request_cleanup_schedules_backfill.rb new file mode 100644 index 00000000000..77057205b09 --- /dev/null +++ b/db/post_migrate/20201103110018_schedule_merge_request_cleanup_schedules_backfill.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class ScheduleMergeRequestCleanupSchedulesBackfill < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + MIGRATION = 'BackfillMergeRequestCleanupSchedules' + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 10_000 + TEMP_INDEX_NAME = 'merge_requests_state_id_temp_index' + + disable_ddl_transaction! + + def up + add_concurrent_index :merge_requests, :id, name: TEMP_INDEX_NAME, where: "state_id IN (2, 3)" + + eligible_mrs = Gitlab::BackgroundMigration::BackfillMergeRequestCleanupSchedules::MergeRequest.eligible + + queue_background_migration_jobs_by_range_at_intervals( + eligible_mrs, + MIGRATION, + DELAY_INTERVAL, + batch_size: BATCH_SIZE + ) + end + + def down + remove_concurrent_index_by_name :merge_requests, TEMP_INDEX_NAME + end +end diff --git a/db/post_migrate/20201103192526_schedule_populate_has_vulnerabilities.rb b/db/post_migrate/20201103192526_schedule_populate_has_vulnerabilities.rb new file mode 100644 index 00000000000..bed90af09dc --- /dev/null +++ b/db/post_migrate/20201103192526_schedule_populate_has_vulnerabilities.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class SchedulePopulateHasVulnerabilities < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + BATCH_SIZE = 1_000 + DELAY_INTERVAL = 2.minutes + MIGRATION_CLASS = 'PopulateHasVulnerabilities' + + disable_ddl_transaction! + + def up + Gitlab::BackgroundMigration::PopulateHasVulnerabilities::Vulnerability.distinct.each_batch(of: BATCH_SIZE, column: :project_id) do |batch, index| + project_ids = batch.pluck(:project_id) + + migrate_in(index * DELAY_INTERVAL, MIGRATION_CLASS, project_ids) + end + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20201106082723_add_merge_request_jira_reference_indexes.rb b/db/post_migrate/20201106082723_add_merge_request_jira_reference_indexes.rb new file mode 100644 index 00000000000..d69f57c6088 --- /dev/null +++ b/db/post_migrate/20201106082723_add_merge_request_jira_reference_indexes.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +class AddMergeRequestJiraReferenceIndexes < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + DESCRIPTION_INDEX_NAME = 'index_merge_requests_on_target_project_id_iid_jira_description' + TITLE_INDEX_NAME = 'index_merge_requests_on_target_project_id_and_iid_jira_title' + + JIRA_KEY_REGEX = '[A-Z][A-Z_0-9]+-\d+' + + disable_ddl_transaction! + + def up + add_concurrent_index( + :merge_requests, + [:target_project_id, :iid], + name: TITLE_INDEX_NAME, + using: :btree, + where: "(merge_requests.title)::text ~ '#{JIRA_KEY_REGEX}'::text" + ) + + add_concurrent_index( + :merge_requests, + [:target_project_id, :iid], + name: DESCRIPTION_INDEX_NAME, + using: :btree, + where: "(merge_requests.description)::text ~ '#{JIRA_KEY_REGEX}'::text" + ) + end + + def down + remove_concurrent_index_by_name( + :merge_requests, + TITLE_INDEX_NAME + ) + + remove_concurrent_index_by_name( + :merge_requests, + DESCRIPTION_INDEX_NAME + ) + end +end diff --git a/db/post_migrate/20201106134950_deduplicate_epic_iids.rb b/db/post_migrate/20201106134950_deduplicate_epic_iids.rb new file mode 100644 index 00000000000..bc7daf9329d --- /dev/null +++ b/db/post_migrate/20201106134950_deduplicate_epic_iids.rb @@ -0,0 +1,121 @@ +# frozen_string_literal: true + +class DeduplicateEpicIids < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'index_epics_on_group_id_and_iid' + + disable_ddl_transaction! + + class Epic < ActiveRecord::Base + end + + class InternalId < ActiveRecord::Base + class << self + def generate_next(subject, scope, usage, init) + InternalIdGenerator.new(subject, scope, usage, init).generate + end + end + + # Increments #last_value and saves the record + # + # The operation locks the record and gathers a `ROW SHARE` lock (in PostgreSQL). + # As such, the increment is atomic and safe to be called concurrently. + def increment_and_save! + update_and_save { self.last_value = (last_value || 0) + 1 } + end + + private + + def update_and_save(&block) + lock! + yield + save! + last_value + end + end + + # See app/models/internal_id + class InternalIdGenerator + attr_reader :subject, :scope, :scope_attrs, :usage, :init + + def initialize(subject, scope, usage, init = nil) + @subject = subject + @scope = scope + @usage = usage + @init = init + + raise ArgumentError, 'Scope is not well-defined, need at least one column for scope (given: 0)' if scope.empty? || usage.to_s != 'epics' + end + + # Generates next internal id and returns it + # init: Block that gets called to initialize InternalId record if not present + # Make sure to not throw exceptions in the absence of records (if this is expected). + def generate + subject.transaction do + # Create a record in internal_ids if one does not yet exist + # and increment its last value + # + # Note this will acquire a ROW SHARE lock on the InternalId record + record.increment_and_save! + end + end + + def record + @record ||= (lookup || create_record) + end + + def lookup + InternalId.find_by(**scope, usage: usage_value) + end + + def usage_value + 4 # see Enums::InternalId - this is the value for epics + end + + # Create InternalId record for (scope, usage) combination, if it doesn't exist + # + # We blindly insert without synchronization. If another process + # was faster in doing this, we'll realize once we hit the unique key constraint + # violation. We can safely roll-back the nested transaction and perform + # a lookup instead to retrieve the record. + def create_record + raise ArgumentError, 'Cannot initialize without init!' unless init + + instance = subject.is_a?(::Class) ? nil : subject + + subject.transaction(requires_new: true) do + InternalId.create!( + **scope, + usage: usage_value, + last_value: init.call(instance, scope) || 0 + ) + end + rescue ActiveRecord::RecordNotUnique + lookup + end + end + + def up + duplicate_epic_ids = ApplicationRecord.connection.execute('SELECT iid, group_id, COUNT(*) FROM epics GROUP BY iid, group_id HAVING COUNT(*) > 1;') + + duplicate_epic_ids.each do |dup| + Epic.where(iid: dup['iid'], group_id: dup['group_id']).last(dup['count'] - 1).each do |epic| + new_iid = InternalId.generate_next(epic, + { namespace_id: epic.group_id }, + :epics, ->(instance, _) { instance.class.where(group_id: epic.group_id).maximum(:iid) } + ) + + epic.update!(iid: new_iid) + end + end + + add_concurrent_index :epics, [:group_id, :iid], unique: true, name: INDEX_NAME + end + + def down + # only remove the index, as we do not want to create the duplicates back + remove_concurrent_index :epics, [:group_id, :iid], name: INDEX_NAME + end +end diff --git a/db/schema_migrations/20200908212414 b/db/schema_migrations/20200908212414 new file mode 100644 index 00000000000..208f9affc91 --- /dev/null +++ b/db/schema_migrations/20200908212414 @@ -0,0 +1 @@ +a9605126178d887bbf526a4a33b7060b072eff7a8d6712e3552099f7e615f88b \ No newline at end of file diff --git a/db/schema_migrations/20200920130356 b/db/schema_migrations/20200920130356 new file mode 100644 index 00000000000..ab0575958ec --- /dev/null +++ b/db/schema_migrations/20200920130356 @@ -0,0 +1 @@ +80d2beb7a1c5f60a4bf3462054fa5bcd0488152b6754f8a7164046201fcb08ed \ No newline at end of file diff --git a/db/schema_migrations/20200928123510 b/db/schema_migrations/20200928123510 new file mode 100644 index 00000000000..db9d2889739 --- /dev/null +++ b/db/schema_migrations/20200928123510 @@ -0,0 +1 @@ +1e274e744ed9e225e2ee09afc15871a1af63857f95c5d787e8efd9943fce1bed \ No newline at end of file diff --git a/db/schema_migrations/20201008011523 b/db/schema_migrations/20201008011523 new file mode 100644 index 00000000000..845ee2f5b96 --- /dev/null +++ b/db/schema_migrations/20201008011523 @@ -0,0 +1 @@ +b7b49ca4c021b7caa9f8612ad9b69d4ec6d79894db2e43266bfe26f2e0bffe08 \ No newline at end of file diff --git a/db/schema_migrations/20201008011937 b/db/schema_migrations/20201008011937 new file mode 100644 index 00000000000..258daf9a836 --- /dev/null +++ b/db/schema_migrations/20201008011937 @@ -0,0 +1 @@ +8af89bb3e63bfca24cee8fdf6f0dd587fae7d81bfeaf6d427f84c7b37c9664ba \ No newline at end of file diff --git a/db/schema_migrations/20201008013434 b/db/schema_migrations/20201008013434 new file mode 100644 index 00000000000..9ec9dd8277c --- /dev/null +++ b/db/schema_migrations/20201008013434 @@ -0,0 +1 @@ +966f6e95189b551cba0ef548cb410911c0beee30d0a265ae21d90321ecbb2a00 \ No newline at end of file diff --git a/db/schema_migrations/20201008075620 b/db/schema_migrations/20201008075620 new file mode 100644 index 00000000000..a0a5d6a7314 --- /dev/null +++ b/db/schema_migrations/20201008075620 @@ -0,0 +1 @@ +f9bc943b61460b1a9a6db8189ab5b21eba46e14650c68658175299b14d48a030 \ No newline at end of file diff --git a/db/schema_migrations/20201008125643 b/db/schema_migrations/20201008125643 new file mode 100644 index 00000000000..121dcbc0281 --- /dev/null +++ b/db/schema_migrations/20201008125643 @@ -0,0 +1 @@ +b7b15717435e06ea386c941c5a021b73f986ad3f41f2bd6f890738a79b710207 \ No newline at end of file diff --git a/db/schema_migrations/20201008144854 b/db/schema_migrations/20201008144854 new file mode 100644 index 00000000000..f4b71f06acd --- /dev/null +++ b/db/schema_migrations/20201008144854 @@ -0,0 +1 @@ +250785e18682cc10afb4f04546e5ff6dff9ab6c6673df84692c8221d6fe820ac \ No newline at end of file diff --git a/db/schema_migrations/20201008224441 b/db/schema_migrations/20201008224441 new file mode 100644 index 00000000000..1f27662d754 --- /dev/null +++ b/db/schema_migrations/20201008224441 @@ -0,0 +1 @@ +d0ca8f0dbe0cf0fbbdd715867f3ae20862683433d919ee5cd942086d21f3b44d \ No newline at end of file diff --git a/db/schema_migrations/20201012073022 b/db/schema_migrations/20201012073022 new file mode 100644 index 00000000000..b7ce136a7e3 --- /dev/null +++ b/db/schema_migrations/20201012073022 @@ -0,0 +1 @@ +234711b96d3869fe826dfd71ae29e0f75e50302bc29a4e60f436ec76b4be3efb \ No newline at end of file diff --git a/db/schema_migrations/20201012122428 b/db/schema_migrations/20201012122428 new file mode 100644 index 00000000000..13e7e9c2cd6 --- /dev/null +++ b/db/schema_migrations/20201012122428 @@ -0,0 +1 @@ +d43764a44f6578548d8b7838dc011b7693da0b7d65cbcc1fff96a212d655024e \ No newline at end of file diff --git a/db/schema_migrations/20201012134230 b/db/schema_migrations/20201012134230 new file mode 100644 index 00000000000..2bf2175ef60 --- /dev/null +++ b/db/schema_migrations/20201012134230 @@ -0,0 +1 @@ +1673018885366e92eb47f5fc705ea8251c2db49b5c14b788e84b10d8db91af48 \ No newline at end of file diff --git a/db/schema_migrations/20201012135330 b/db/schema_migrations/20201012135330 new file mode 100644 index 00000000000..8ecce197faa --- /dev/null +++ b/db/schema_migrations/20201012135330 @@ -0,0 +1 @@ +18ccd2059d9a19a51ea0162c46a1293e280759daffa54ba58ba5e431ee7aba93 \ No newline at end of file diff --git a/db/schema_migrations/20201012140110 b/db/schema_migrations/20201012140110 new file mode 100644 index 00000000000..1bbfe820a5d --- /dev/null +++ b/db/schema_migrations/20201012140110 @@ -0,0 +1 @@ +e266655483655e1ecbb4f65594ef5b985c3f0449231755f589f3e293e28c9f6b \ No newline at end of file diff --git a/db/schema_migrations/20201012140452 b/db/schema_migrations/20201012140452 new file mode 100644 index 00000000000..11bc272341d --- /dev/null +++ b/db/schema_migrations/20201012140452 @@ -0,0 +1 @@ +d62928276708c26656070f803ea6271be74a1fe9802877258d4a8cf19df32d09 \ No newline at end of file diff --git a/db/schema_migrations/20201014163633 b/db/schema_migrations/20201014163633 new file mode 100644 index 00000000000..6025edca343 --- /dev/null +++ b/db/schema_migrations/20201014163633 @@ -0,0 +1 @@ +591bb8d685c686cced324825e7bec01711aee328176c1c5396a9e61847cb6fab \ No newline at end of file diff --git a/db/schema_migrations/20201015121805 b/db/schema_migrations/20201015121805 new file mode 100644 index 00000000000..50c3cd1285c --- /dev/null +++ b/db/schema_migrations/20201015121805 @@ -0,0 +1 @@ +b8d5890fe5569127e794eea831fc18f8e5708b326e8037963fe2f6ae7f120e27 \ No newline at end of file diff --git a/db/schema_migrations/20201015121825 b/db/schema_migrations/20201015121825 new file mode 100644 index 00000000000..b853c405ba0 --- /dev/null +++ b/db/schema_migrations/20201015121825 @@ -0,0 +1 @@ +76e5a5bb535019da28041d1c7dddd8a18d3b04f688b38edc0c4214d3a4d6e357 \ No newline at end of file diff --git a/db/schema_migrations/20201015194852 b/db/schema_migrations/20201015194852 new file mode 100644 index 00000000000..665135a7e3e --- /dev/null +++ b/db/schema_migrations/20201015194852 @@ -0,0 +1 @@ +1b12f68f7d8c56ecdd7d6d7551d81f5d95d1b4dc5f8d4c67eb239b8640128531 \ No newline at end of file diff --git a/db/schema_migrations/20201015231049 b/db/schema_migrations/20201015231049 new file mode 100644 index 00000000000..17a4147993a --- /dev/null +++ b/db/schema_migrations/20201015231049 @@ -0,0 +1 @@ +cae3c41e344f15fa5a9cf71546a0bf209ead964fd3efefba39aba79afd60e0be \ No newline at end of file diff --git a/db/schema_migrations/20201016074302 b/db/schema_migrations/20201016074302 new file mode 100644 index 00000000000..e0ed03f0ac3 --- /dev/null +++ b/db/schema_migrations/20201016074302 @@ -0,0 +1 @@ +de07bcc8166421d01382038d930cabb6a4749b314f05ca148e8d13cff947447c \ No newline at end of file diff --git a/db/schema_migrations/20201019091307 b/db/schema_migrations/20201019091307 new file mode 100644 index 00000000000..6b74c804ed8 --- /dev/null +++ b/db/schema_migrations/20201019091307 @@ -0,0 +1 @@ +f19ab0de07415e728849ef4e56804909a3a4a57ad8f55fe71a27bc43c535ac66 \ No newline at end of file diff --git a/db/schema_migrations/20201019094741 b/db/schema_migrations/20201019094741 new file mode 100644 index 00000000000..5e53ab91e9b --- /dev/null +++ b/db/schema_migrations/20201019094741 @@ -0,0 +1 @@ +16ef5ba153f1145dcd2578bb8c860d4e1a975d5df3a1b1d9315946e632a95999 \ No newline at end of file diff --git a/db/schema_migrations/20201019101549 b/db/schema_migrations/20201019101549 new file mode 100644 index 00000000000..9b22cf277fb --- /dev/null +++ b/db/schema_migrations/20201019101549 @@ -0,0 +1 @@ +1bd99d7d6b972ea66495f21358e3b8731532219fcf75731bf643c312eb56820d \ No newline at end of file diff --git a/db/schema_migrations/20201019111952 b/db/schema_migrations/20201019111952 new file mode 100644 index 00000000000..7fe9fcf3b2f --- /dev/null +++ b/db/schema_migrations/20201019111952 @@ -0,0 +1 @@ +82d6ed3e066c15352abdb58d58d195f48aa7b1d17bbb28f58f42c19ae67fab54 \ No newline at end of file diff --git a/db/schema_migrations/20201019113009 b/db/schema_migrations/20201019113009 new file mode 100644 index 00000000000..88d91b79607 --- /dev/null +++ b/db/schema_migrations/20201019113009 @@ -0,0 +1 @@ +fe57e8e74ebbe0e9567c1487e6e4f8b499afa6404c73424157c43ae79c005f08 \ No newline at end of file diff --git a/db/schema_migrations/20201019130244 b/db/schema_migrations/20201019130244 new file mode 100644 index 00000000000..b37e6eeae70 --- /dev/null +++ b/db/schema_migrations/20201019130244 @@ -0,0 +1 @@ +fcd2cc46dae4f4da96ac5a2100a9de9bd360defee82a9c9d6cfbda0e1507ee66 \ No newline at end of file diff --git a/db/schema_migrations/20201019152046 b/db/schema_migrations/20201019152046 new file mode 100644 index 00000000000..bc364a38a46 --- /dev/null +++ b/db/schema_migrations/20201019152046 @@ -0,0 +1 @@ +e5b3bcac7150df4443879db05b18b6aeb01271d99965b2468278954dedf8413b \ No newline at end of file diff --git a/db/schema_migrations/20201019161924 b/db/schema_migrations/20201019161924 new file mode 100644 index 00000000000..3857a5cb5a1 --- /dev/null +++ b/db/schema_migrations/20201019161924 @@ -0,0 +1 @@ +47aba29a35e24113c9f198c731ba95597a2a6cd5d16b01a958644ce3e1a96170 \ No newline at end of file diff --git a/db/schema_migrations/20201019172704 b/db/schema_migrations/20201019172704 new file mode 100644 index 00000000000..0bf2d30205f --- /dev/null +++ b/db/schema_migrations/20201019172704 @@ -0,0 +1 @@ +2a426e1a7cc6283e777667a1b4a6987f011c6cfd189ec702abc55d13a8499eca \ No newline at end of file diff --git a/db/schema_migrations/20201020102551 b/db/schema_migrations/20201020102551 new file mode 100644 index 00000000000..f658f1fdc0a --- /dev/null +++ b/db/schema_migrations/20201020102551 @@ -0,0 +1 @@ +ba16ad5a51494f436dc47ffb924f94ce7795bfd3b9061ca58d1c8dda238245e9 \ No newline at end of file diff --git a/db/schema_migrations/20201021085007 b/db/schema_migrations/20201021085007 new file mode 100644 index 00000000000..59567962e80 --- /dev/null +++ b/db/schema_migrations/20201021085007 @@ -0,0 +1 @@ +552f8a042bdecb7511d63e129438faff3fde8e1086cc88f7a79269b2b7098a65 \ No newline at end of file diff --git a/db/schema_migrations/20201021101956 b/db/schema_migrations/20201021101956 new file mode 100644 index 00000000000..bf3e1092fd1 --- /dev/null +++ b/db/schema_migrations/20201021101956 @@ -0,0 +1 @@ +47158d21bd1a800e5a9da1bfea25870f14cc0b094e5f3e9a4b7608b8a9eca180 \ No newline at end of file diff --git a/db/schema_migrations/20201021102554 b/db/schema_migrations/20201021102554 new file mode 100644 index 00000000000..c2bd788943b --- /dev/null +++ b/db/schema_migrations/20201021102554 @@ -0,0 +1 @@ +90936786a9c2a9d035d13be87021b2f8278342cd11992d58753ca5a5413ed9d7 \ No newline at end of file diff --git a/db/schema_migrations/20201021105347 b/db/schema_migrations/20201021105347 new file mode 100644 index 00000000000..86117fd6538 --- /dev/null +++ b/db/schema_migrations/20201021105347 @@ -0,0 +1 @@ +d7683f7a2db6aa27606756c158fa029c932230713b165917bc05a491f10e7adf \ No newline at end of file diff --git a/db/schema_migrations/20201021105600 b/db/schema_migrations/20201021105600 new file mode 100644 index 00000000000..14d2edb23a6 --- /dev/null +++ b/db/schema_migrations/20201021105600 @@ -0,0 +1 @@ +9b90dd436cc1c315eacc60acbc5f6b3b94029b82b4fcb27a41abc4941ad9a4ad \ No newline at end of file diff --git a/db/schema_migrations/20201021105959 b/db/schema_migrations/20201021105959 new file mode 100644 index 00000000000..2ddfcb102c9 --- /dev/null +++ b/db/schema_migrations/20201021105959 @@ -0,0 +1 @@ +d924e4ad9ff67d01d660db3b3a1b9e5d74cecb1a127d598d1d1193cbfa499030 \ No newline at end of file diff --git a/db/schema_migrations/20201021142812 b/db/schema_migrations/20201021142812 new file mode 100644 index 00000000000..d4ddf2a3595 --- /dev/null +++ b/db/schema_migrations/20201021142812 @@ -0,0 +1 @@ +81b9b79f2ca8830b9d9e9315d93421875dfe44cfa0da6f4e9166567452a2363b \ No newline at end of file diff --git a/db/schema_migrations/20201021152210 b/db/schema_migrations/20201021152210 new file mode 100644 index 00000000000..78358b24bad --- /dev/null +++ b/db/schema_migrations/20201021152210 @@ -0,0 +1 @@ +853dbc604fc8ce4d82e6040aa7a7970ae194f09bafb2749077cd9f48d2708eac \ No newline at end of file diff --git a/db/schema_migrations/20201021190539 b/db/schema_migrations/20201021190539 new file mode 100644 index 00000000000..902213f9029 --- /dev/null +++ b/db/schema_migrations/20201021190539 @@ -0,0 +1 @@ +1d0689b5182ac391473075aeabb0e341fb8634dbf0aa87dbb6d48cc0e61d2ada \ No newline at end of file diff --git a/db/schema_migrations/20201021220101 b/db/schema_migrations/20201021220101 new file mode 100644 index 00000000000..cda2e4076a5 --- /dev/null +++ b/db/schema_migrations/20201021220101 @@ -0,0 +1 @@ +72580665fcb0fca332ede450690902c0a7afb6159feff41df1bc10a3cf6607f2 \ No newline at end of file diff --git a/db/schema_migrations/20201022080802 b/db/schema_migrations/20201022080802 new file mode 100644 index 00000000000..c84c8c6ffbe --- /dev/null +++ b/db/schema_migrations/20201022080802 @@ -0,0 +1 @@ +809d93d367ff9310063904ee3c266914311ef54e8c7f9d6d7fd924d25890bf19 \ No newline at end of file diff --git a/db/schema_migrations/20201022094845 b/db/schema_migrations/20201022094845 new file mode 100644 index 00000000000..3bc0b95b711 --- /dev/null +++ b/db/schema_migrations/20201022094845 @@ -0,0 +1 @@ +16b402740c6b1dd21908265085e516f63f8858424724ba97f46658e7bd5f7bf2 \ No newline at end of file diff --git a/db/schema_migrations/20201022094846 b/db/schema_migrations/20201022094846 new file mode 100644 index 00000000000..40ef0760dc8 --- /dev/null +++ b/db/schema_migrations/20201022094846 @@ -0,0 +1 @@ +588c5f99d34652bbd5bde86351cbdb8c0455af0c31a440bfb63df02f12fd588f \ No newline at end of file diff --git a/db/schema_migrations/20201022103304 b/db/schema_migrations/20201022103304 new file mode 100644 index 00000000000..e54cb431bd4 --- /dev/null +++ b/db/schema_migrations/20201022103304 @@ -0,0 +1 @@ +aa15aad0b51f313f3cd59e1065023146fe53c6bd50319656ae992f8f43e1525e \ No newline at end of file diff --git a/db/schema_migrations/20201022144501 b/db/schema_migrations/20201022144501 new file mode 100644 index 00000000000..4e82b2785d0 --- /dev/null +++ b/db/schema_migrations/20201022144501 @@ -0,0 +1 @@ +f9a573d50f8b4aeb3d8d2cc2f0223ab9970776d663e49e0f022e96158593d929 \ No newline at end of file diff --git a/db/schema_migrations/20201022191817 b/db/schema_migrations/20201022191817 new file mode 100644 index 00000000000..619ae381a72 --- /dev/null +++ b/db/schema_migrations/20201022191817 @@ -0,0 +1 @@ +205cb628e9637bcd1acb90c5211b71b51015fa5f50aadcacd5fbafc4f09c00d0 \ No newline at end of file diff --git a/db/schema_migrations/20201022192254 b/db/schema_migrations/20201022192254 new file mode 100644 index 00000000000..c09518b0e6c --- /dev/null +++ b/db/schema_migrations/20201022192254 @@ -0,0 +1 @@ +9f942de6f83629a144e9d460b4bed7a246afe95275b5913745109fc0ab9dacc1 \ No newline at end of file diff --git a/db/schema_migrations/20201023114628 b/db/schema_migrations/20201023114628 new file mode 100644 index 00000000000..458392082ca --- /dev/null +++ b/db/schema_migrations/20201023114628 @@ -0,0 +1 @@ +f4fb466c74e1366d5980a54d6e5fc42fe78237cae33d8cdaf5573d2fe75f8a5a \ No newline at end of file diff --git a/db/schema_migrations/20201026051643 b/db/schema_migrations/20201026051643 new file mode 100644 index 00000000000..f3290df0d23 --- /dev/null +++ b/db/schema_migrations/20201026051643 @@ -0,0 +1 @@ +bb20b72c7fa65735f37d896cc098d27edd4cc07c3083fdb567e4b421309703a7 \ No newline at end of file diff --git a/db/schema_migrations/20201026182253 b/db/schema_migrations/20201026182253 new file mode 100644 index 00000000000..a8da92aa906 --- /dev/null +++ b/db/schema_migrations/20201026182253 @@ -0,0 +1 @@ +ab2b8af98a8a29658f92c302d45668c7b9f8f5234ef35f4311a0f0ebbd954ec8 \ No newline at end of file diff --git a/db/schema_migrations/20201026200736 b/db/schema_migrations/20201026200736 new file mode 100644 index 00000000000..7ed57505c3e --- /dev/null +++ b/db/schema_migrations/20201026200736 @@ -0,0 +1 @@ +691fe3335de3e072bc5612705c4d16744ff17e334025ddd78eb37309f87441e3 \ No newline at end of file diff --git a/db/schema_migrations/20201027002551 b/db/schema_migrations/20201027002551 new file mode 100644 index 00000000000..f4a5527fac7 --- /dev/null +++ b/db/schema_migrations/20201027002551 @@ -0,0 +1 @@ +34e357b739235d627e543e1bc7202e0cf26f5b1ca8021bb25357e29e883f785b \ No newline at end of file diff --git a/db/schema_migrations/20201027135651 b/db/schema_migrations/20201027135651 new file mode 100644 index 00000000000..eb3a5080c0f --- /dev/null +++ b/db/schema_migrations/20201027135651 @@ -0,0 +1 @@ +3f24bfc2d18ffa5f171e027d4e7aaf9994b255e5806e2de57fd36b4a193db122 \ No newline at end of file diff --git a/db/schema_migrations/20201027210127 b/db/schema_migrations/20201027210127 new file mode 100644 index 00000000000..ab0ba73f588 --- /dev/null +++ b/db/schema_migrations/20201027210127 @@ -0,0 +1 @@ +c269a999cabce99d26f3be303656bbb27f2b843b639755b112ad350d4cb5b5c6 \ No newline at end of file diff --git a/db/schema_migrations/20201027211138 b/db/schema_migrations/20201027211138 new file mode 100644 index 00000000000..5e36445702b --- /dev/null +++ b/db/schema_migrations/20201027211138 @@ -0,0 +1 @@ +402e9a6e92802888ba01ee216850ab5b0fe9997a84415c9ffe8d5d37a9823220 \ No newline at end of file diff --git a/db/schema_migrations/20201028160831 b/db/schema_migrations/20201028160831 new file mode 100644 index 00000000000..de94901dcc5 --- /dev/null +++ b/db/schema_migrations/20201028160831 @@ -0,0 +1 @@ +4b0c70d8cd2648149011adab4f302922483436406f361c3037f26efb12b19042 \ No newline at end of file diff --git a/db/schema_migrations/20201028160832 b/db/schema_migrations/20201028160832 new file mode 100644 index 00000000000..4b0da32b638 --- /dev/null +++ b/db/schema_migrations/20201028160832 @@ -0,0 +1 @@ +9ea8e8f1234d6291ea00e725d380bfe33d804853b90da1221be8781b3dd9bb77 \ No newline at end of file diff --git a/db/schema_migrations/20201028182809 b/db/schema_migrations/20201028182809 new file mode 100644 index 00000000000..6747bd58d72 --- /dev/null +++ b/db/schema_migrations/20201028182809 @@ -0,0 +1 @@ +c51bf825045ef80714f3903f25321785883da3d612725f6fa67ec3ddd12d5808 \ No newline at end of file diff --git a/db/schema_migrations/20201028184640 b/db/schema_migrations/20201028184640 new file mode 100644 index 00000000000..4cac95e4e7b --- /dev/null +++ b/db/schema_migrations/20201028184640 @@ -0,0 +1 @@ +5520cca016af07fb2e009c0e3254362f106a9cc808cbb61e280221be82be1b25 \ No newline at end of file diff --git a/db/schema_migrations/20201028204306 b/db/schema_migrations/20201028204306 new file mode 100644 index 00000000000..03b68c9a0d1 --- /dev/null +++ b/db/schema_migrations/20201028204306 @@ -0,0 +1 @@ +ec5bab20a1b591b77b48b85dc0b871e88a41891d256201b7d8eb86195ef1c4ad \ No newline at end of file diff --git a/db/schema_migrations/20201029052241 b/db/schema_migrations/20201029052241 new file mode 100644 index 00000000000..8257e4d3681 --- /dev/null +++ b/db/schema_migrations/20201029052241 @@ -0,0 +1 @@ +87e330bc15accb10733825b079cf89e78d905a7c4080075489857085f014bfe7 \ No newline at end of file diff --git a/db/schema_migrations/20201029143650 b/db/schema_migrations/20201029143650 new file mode 100644 index 00000000000..c6f00890f4f --- /dev/null +++ b/db/schema_migrations/20201029143650 @@ -0,0 +1 @@ +c718bc731f7dc3e1f0104dfdb79a3dc46c46849153ec9b228600eeb5a92465e7 \ No newline at end of file diff --git a/db/schema_migrations/20201029144157 b/db/schema_migrations/20201029144157 new file mode 100644 index 00000000000..7fdac19230f --- /dev/null +++ b/db/schema_migrations/20201029144157 @@ -0,0 +1 @@ +a61310c95a1302871ea18881d45bc0c7357baa8f24daa31b7e2174318dab5707 \ No newline at end of file diff --git a/db/schema_migrations/20201029144444 b/db/schema_migrations/20201029144444 new file mode 100644 index 00000000000..1ab20b33da5 --- /dev/null +++ b/db/schema_migrations/20201029144444 @@ -0,0 +1 @@ +50e4e42c804d3abdcfe9ab2bbb890262d4b2ddd93bff1b2af1da1e55a0300cf5 \ No newline at end of file diff --git a/db/schema_migrations/20201030092151 b/db/schema_migrations/20201030092151 new file mode 100644 index 00000000000..7b39a8e0dca --- /dev/null +++ b/db/schema_migrations/20201030092151 @@ -0,0 +1 @@ +ced03562d300f99abf687c258a25bf280a6c4f1798a893ee8a79189c09f19e6e \ No newline at end of file diff --git a/db/schema_migrations/20201030200115 b/db/schema_migrations/20201030200115 new file mode 100644 index 00000000000..ed9c743f538 --- /dev/null +++ b/db/schema_migrations/20201030200115 @@ -0,0 +1 @@ +bef50f2417b9676c89aea838f7b9c85fb88af9f52c197d8eb4613a9c91bc7741 \ No newline at end of file diff --git a/db/schema_migrations/20201030200539 b/db/schema_migrations/20201030200539 new file mode 100644 index 00000000000..f8e7642befb --- /dev/null +++ b/db/schema_migrations/20201030200539 @@ -0,0 +1 @@ +2f6c7efc1716d02dd40adb08bd09b9f1e63e4248619678c0562f4b8d581e6065 \ No newline at end of file diff --git a/db/schema_migrations/20201030203854 b/db/schema_migrations/20201030203854 new file mode 100644 index 00000000000..6a337c366aa --- /dev/null +++ b/db/schema_migrations/20201030203854 @@ -0,0 +1 @@ +3937235469c8fb1f2b0af9cdf38933db5ae61552d1a9050755cec5f7c16ebb66 \ No newline at end of file diff --git a/db/schema_migrations/20201102073808 b/db/schema_migrations/20201102073808 new file mode 100644 index 00000000000..9e77ee028a5 --- /dev/null +++ b/db/schema_migrations/20201102073808 @@ -0,0 +1 @@ +153b437ac481f4d79cd5bdee45dd3932f3cb58bf5dce793573c4b651a3b9314f \ No newline at end of file diff --git a/db/schema_migrations/20201102112206 b/db/schema_migrations/20201102112206 new file mode 100644 index 00000000000..5bbba26e110 --- /dev/null +++ b/db/schema_migrations/20201102112206 @@ -0,0 +1 @@ +a861c91ebc7f7892020ba10a151df761b38bf69d5e02bcdf72a965eb266e6aff \ No newline at end of file diff --git a/db/schema_migrations/20201102114018 b/db/schema_migrations/20201102114018 new file mode 100644 index 00000000000..33615073453 --- /dev/null +++ b/db/schema_migrations/20201102114018 @@ -0,0 +1 @@ +dc1c372f4976e3747d7201406123a54e3852d9ea9516089043a93698a09e2f9f \ No newline at end of file diff --git a/db/schema_migrations/20201102152554 b/db/schema_migrations/20201102152554 new file mode 100644 index 00000000000..f52694965c6 --- /dev/null +++ b/db/schema_migrations/20201102152554 @@ -0,0 +1 @@ +7ec73c06ccc4c9f618e0455d0a7aae3b591bf52b5ddb1b3f1678d2fd50b9fd5e \ No newline at end of file diff --git a/db/schema_migrations/20201102152945 b/db/schema_migrations/20201102152945 new file mode 100644 index 00000000000..cb4ae9c2598 --- /dev/null +++ b/db/schema_migrations/20201102152945 @@ -0,0 +1 @@ +55ffd18d5f55ee0fd51a31d50cf2d51595740c72ca23d5134d93e2da3fc186ff \ No newline at end of file diff --git a/db/schema_migrations/20201102184743 b/db/schema_migrations/20201102184743 new file mode 100644 index 00000000000..da002122e5d --- /dev/null +++ b/db/schema_migrations/20201102184743 @@ -0,0 +1 @@ +040e73d690cb315627fe16c931273aa1f86dfabb481dc2086f787d067b87642f \ No newline at end of file diff --git a/db/schema_migrations/20201103013242 b/db/schema_migrations/20201103013242 new file mode 100644 index 00000000000..1f592b4a619 --- /dev/null +++ b/db/schema_migrations/20201103013242 @@ -0,0 +1 @@ +8a30cf20f71e0cb198caf6f77a19e4da55b83eb38bdb5888cd2674373d94cede \ No newline at end of file diff --git a/db/schema_migrations/20201103095752 b/db/schema_migrations/20201103095752 new file mode 100644 index 00000000000..4888f7c5dfb --- /dev/null +++ b/db/schema_migrations/20201103095752 @@ -0,0 +1 @@ +3427cf92dc785f399329b00a3dded01dd2a6386cafbd0ef4b732bfcf522ce615 \ No newline at end of file diff --git a/db/schema_migrations/20201103110018 b/db/schema_migrations/20201103110018 new file mode 100644 index 00000000000..82ab2fda543 --- /dev/null +++ b/db/schema_migrations/20201103110018 @@ -0,0 +1 @@ +8a45a6186d7e18f1dea43593dc0226860fc2e8d3ae386f50a022958b758c7c75 \ No newline at end of file diff --git a/db/schema_migrations/20201103171537 b/db/schema_migrations/20201103171537 new file mode 100644 index 00000000000..4621c0e4802 --- /dev/null +++ b/db/schema_migrations/20201103171537 @@ -0,0 +1 @@ +3120428427e3c0c94799501b1d31f384c98899f2ef9bda6f95066c94afd5ecf8 \ No newline at end of file diff --git a/db/schema_migrations/20201103184333 b/db/schema_migrations/20201103184333 new file mode 100644 index 00000000000..0475ea2b466 --- /dev/null +++ b/db/schema_migrations/20201103184333 @@ -0,0 +1 @@ +a3117169b472fffd6302a4da17850a11474c196fd06ebeb3f6b28705d59c74ba \ No newline at end of file diff --git a/db/schema_migrations/20201103192526 b/db/schema_migrations/20201103192526 new file mode 100644 index 00000000000..8fe11ed16d6 --- /dev/null +++ b/db/schema_migrations/20201103192526 @@ -0,0 +1 @@ +bb137c3a41a40e740f8ae65b43d7f9218f52d6d5eaf53c8a64b3336a8f16141b \ No newline at end of file diff --git a/db/schema_migrations/20201103202213 b/db/schema_migrations/20201103202213 new file mode 100644 index 00000000000..74b0b1888d2 --- /dev/null +++ b/db/schema_migrations/20201103202213 @@ -0,0 +1 @@ +af006a3c01620c258a253b5c9ccca6faa4cb46a97dddbfeecc0ecc4454eb46e6 \ No newline at end of file diff --git a/db/schema_migrations/20201104204739 b/db/schema_migrations/20201104204739 new file mode 100644 index 00000000000..83794fd569f --- /dev/null +++ b/db/schema_migrations/20201104204739 @@ -0,0 +1 @@ +9431c771b14d61851e8e69b3a789f222463bbe460078a35c8ad3cbcf8df8b077 \ No newline at end of file diff --git a/db/schema_migrations/20201105021637 b/db/schema_migrations/20201105021637 new file mode 100644 index 00000000000..05a76d22568 --- /dev/null +++ b/db/schema_migrations/20201105021637 @@ -0,0 +1 @@ +b04e37c8713a333afbff4c7034d9f3ffca4a4490d0b563b73d9e6bffd45f3f6a \ No newline at end of file diff --git a/db/schema_migrations/20201105024127 b/db/schema_migrations/20201105024127 new file mode 100644 index 00000000000..fecda19cb2f --- /dev/null +++ b/db/schema_migrations/20201105024127 @@ -0,0 +1 @@ +afeff8d6bf5ca14f955f5d387e8d219e852e9617b80fe07ed2e1b57af19fd4fa \ No newline at end of file diff --git a/db/schema_migrations/20201105135051 b/db/schema_migrations/20201105135051 new file mode 100644 index 00000000000..26ebc47fd3a --- /dev/null +++ b/db/schema_migrations/20201105135051 @@ -0,0 +1 @@ +41cc59ebfeed647b2525191befa43c1faeb1c133a687a5c93124f4b4c745117a \ No newline at end of file diff --git a/db/schema_migrations/20201105143211 b/db/schema_migrations/20201105143211 new file mode 100644 index 00000000000..6ddf20c1d68 --- /dev/null +++ b/db/schema_migrations/20201105143211 @@ -0,0 +1 @@ +b614435cdb654ebbd11bcc5ac0ed69352219e51b368d8f10c0b2998c5258caf9 \ No newline at end of file diff --git a/db/schema_migrations/20201105143312 b/db/schema_migrations/20201105143312 new file mode 100644 index 00000000000..fe616c85dc9 --- /dev/null +++ b/db/schema_migrations/20201105143312 @@ -0,0 +1 @@ +decdc314dbcf6b8ac2ce140f81f9d342efca0d98bbeff10c7a041568a67b63f3 \ No newline at end of file diff --git a/db/schema_migrations/20201106082723 b/db/schema_migrations/20201106082723 new file mode 100644 index 00000000000..0bb6a3b85b8 --- /dev/null +++ b/db/schema_migrations/20201106082723 @@ -0,0 +1 @@ +a2dc0d31af6834adf6634f6051d7d451fc48d31492d96efe57547c3e9d61a64d \ No newline at end of file diff --git a/db/schema_migrations/20201106134139 b/db/schema_migrations/20201106134139 new file mode 100644 index 00000000000..245cbbf712e --- /dev/null +++ b/db/schema_migrations/20201106134139 @@ -0,0 +1 @@ +9b1008df64741ad313ddf51969c18d609cd01a7255563fe0395d2bbf4d288e30 \ No newline at end of file diff --git a/db/schema_migrations/20201106134950 b/db/schema_migrations/20201106134950 new file mode 100644 index 00000000000..b36cccd4c40 --- /dev/null +++ b/db/schema_migrations/20201106134950 @@ -0,0 +1 @@ +f6e4e62dbd992fc8283f3d7872bb33f1b6bea1b366806caf8f7a65140584c0c1 \ No newline at end of file diff --git a/db/schema_migrations/20201107032257 b/db/schema_migrations/20201107032257 new file mode 100644 index 00000000000..4ea5f763dc0 --- /dev/null +++ b/db/schema_migrations/20201107032257 @@ -0,0 +1 @@ +07160ee3c92e68273042df979640c3927abbb187f79e1a4645471e28061e1c2c \ No newline at end of file diff --git a/db/schema_migrations/20201109144634 b/db/schema_migrations/20201109144634 new file mode 100644 index 00000000000..8f47a75dfb8 --- /dev/null +++ b/db/schema_migrations/20201109144634 @@ -0,0 +1 @@ +cbb2a2027fb6083771e97510a00c07a4ded0576e89fafd6cff4faba4e21c82c0 \ No newline at end of file diff --git a/db/schema_migrations/20201109180311 b/db/schema_migrations/20201109180311 new file mode 100644 index 00000000000..0752e2dabb3 --- /dev/null +++ b/db/schema_migrations/20201109180311 @@ -0,0 +1 @@ +49143d2a7dd0a53c051151b0cdc93745a0fa1b01e6d54bb663e147c2064d9290 \ No newline at end of file diff --git a/db/schema_migrations/20201109184023 b/db/schema_migrations/20201109184023 new file mode 100644 index 00000000000..7a66c0f0f4c --- /dev/null +++ b/db/schema_migrations/20201109184023 @@ -0,0 +1 @@ +698bcedf387fc01fbb7f1899f0f7660ba86a197fa72cf71d998cc90e3d1da9f3 \ No newline at end of file diff --git a/db/schema_migrations/20201110035029 b/db/schema_migrations/20201110035029 new file mode 100644 index 00000000000..9631f17bce0 --- /dev/null +++ b/db/schema_migrations/20201110035029 @@ -0,0 +1 @@ +21245809e056dfefedc4d2c6a8e2bf642bfcee480a863f8707ba6fa6b748a2e0 \ No newline at end of file diff --git a/db/schema_migrations/20201110110454 b/db/schema_migrations/20201110110454 new file mode 100644 index 00000000000..5b721550325 --- /dev/null +++ b/db/schema_migrations/20201110110454 @@ -0,0 +1 @@ +f008d77d2a0aef463a924923d5a338030758d6b9c194756a0490b51a95681127 \ No newline at end of file diff --git a/db/schema_migrations/20201110133629 b/db/schema_migrations/20201110133629 new file mode 100644 index 00000000000..487b5eab7c1 --- /dev/null +++ b/db/schema_migrations/20201110133629 @@ -0,0 +1 @@ +83773b825db9b2671fd4ffb2c0d6733036737385ce7a933040011026b34ba1e1 \ No newline at end of file diff --git a/db/schema_migrations/20201111110318 b/db/schema_migrations/20201111110318 new file mode 100644 index 00000000000..0a88f8f09df --- /dev/null +++ b/db/schema_migrations/20201111110318 @@ -0,0 +1 @@ +4168c39fe93b1c11d8080e07167f79c8234c74a7b274332174d9e861f2084ada \ No newline at end of file diff --git a/db/schema_migrations/20201111110918 b/db/schema_migrations/20201111110918 new file mode 100644 index 00000000000..cfc30e2bcfc --- /dev/null +++ b/db/schema_migrations/20201111110918 @@ -0,0 +1 @@ +f5705da7bce46d98ca798c85f08d8a6a0577839aabacd0ba9b50e0b7351a4e96 \ No newline at end of file diff --git a/db/schema_migrations/20201111152859 b/db/schema_migrations/20201111152859 new file mode 100644 index 00000000000..2d5b337b857 --- /dev/null +++ b/db/schema_migrations/20201111152859 @@ -0,0 +1 @@ +4c5baa6a09a339fac544f830d5ef822b1e7e4eae8431bd91df5113125accbc77 \ No newline at end of file diff --git a/db/schema_migrations/20201112195322 b/db/schema_migrations/20201112195322 new file mode 100644 index 00000000000..ba4c7e9d50f --- /dev/null +++ b/db/schema_migrations/20201112195322 @@ -0,0 +1 @@ +644bf793b3b62330bfb1f4dc406e6dd01cbcf4651ebfd2873fb551c757c8a3b4 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 4e6fc7e9260..f29f9178a26 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -8953,6 +8953,43 @@ CREATE SEQUENCE analytics_cycle_analytics_project_stages_id_seq ALTER SEQUENCE analytics_cycle_analytics_project_stages_id_seq OWNED BY analytics_cycle_analytics_project_stages.id; +CREATE TABLE analytics_devops_adoption_segment_selections ( + id bigint NOT NULL, + segment_id bigint NOT NULL, + group_id bigint, + project_id bigint, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + CONSTRAINT segment_selection_project_id_or_group_id_required CHECK ((((project_id <> NULL::bigint) AND (group_id IS NULL)) OR ((group_id <> NULL::bigint) AND (project_id IS NULL)))) +); + +CREATE SEQUENCE analytics_devops_adoption_segment_selections_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE analytics_devops_adoption_segment_selections_id_seq OWNED BY analytics_devops_adoption_segment_selections.id; + +CREATE TABLE analytics_devops_adoption_segments ( + id bigint NOT NULL, + name text NOT NULL, + last_recorded_at timestamp with time zone, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + CONSTRAINT check_4be7a006fd CHECK ((char_length(name) <= 255)) +); + +CREATE SEQUENCE analytics_devops_adoption_segments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE analytics_devops_adoption_segments_id_seq OWNED BY analytics_devops_adoption_segments.id; + CREATE TABLE analytics_instance_statistics_measurements ( id bigint NOT NULL, count bigint NOT NULL, @@ -9046,7 +9083,6 @@ CREATE TABLE application_settings ( max_attachment_size integer DEFAULT 10 NOT NULL, default_project_visibility integer DEFAULT 0 NOT NULL, default_snippet_visibility integer DEFAULT 0 NOT NULL, - domain_whitelist text, user_oauth_applications boolean DEFAULT true, after_sign_out_path character varying, session_expire_delay integer DEFAULT 10080 NOT NULL, @@ -9082,8 +9118,6 @@ CREATE TABLE application_settings ( elasticsearch_search boolean DEFAULT false NOT NULL, repository_storages character varying DEFAULT 'default'::character varying, enabled_git_access_protocol character varying, - domain_blacklist_enabled boolean DEFAULT false, - domain_blacklist text, usage_ping_enabled boolean DEFAULT true NOT NULL, sign_in_text_html text, help_page_text_html text, @@ -9171,7 +9205,7 @@ CREATE TABLE application_settings ( custom_project_templates_group_id integer, usage_stats_set_by_user_id integer, receive_max_input_size integer, - diff_max_patch_bytes integer DEFAULT 102400 NOT NULL, + diff_max_patch_bytes integer DEFAULT 204800 NOT NULL, archive_builds_in_seconds integer, commit_email_hostname character varying, protected_ci_variables boolean DEFAULT true NOT NULL, @@ -9257,7 +9291,6 @@ CREATE TABLE application_settings ( email_restrictions_enabled boolean DEFAULT false NOT NULL, email_restrictions text, npm_package_requests_forwarding boolean DEFAULT true NOT NULL, - namespace_storage_size_limit bigint DEFAULT 0 NOT NULL, seat_link_enabled boolean DEFAULT true NOT NULL, container_expiration_policies_enable_historic_entries boolean DEFAULT false NOT NULL, issues_create_limit integer DEFAULT 0 NOT NULL, @@ -9291,16 +9324,39 @@ CREATE TABLE application_settings ( gitpod_enabled boolean DEFAULT false NOT NULL, gitpod_url text DEFAULT 'https://gitpod.io/'::text, abuse_notification_email character varying, - require_admin_approval_after_user_signup boolean DEFAULT false NOT NULL, + require_admin_approval_after_user_signup boolean DEFAULT true NOT NULL, help_page_documentation_base_url text, automatic_purchased_storage_allocation boolean DEFAULT false NOT NULL, + encrypted_ci_jwt_signing_key text, + encrypted_ci_jwt_signing_key_iv text, + container_registry_expiration_policies_worker_capacity integer DEFAULT 0 NOT NULL, + elasticsearch_analyzers_smartcn_enabled boolean DEFAULT false NOT NULL, + elasticsearch_analyzers_smartcn_search boolean DEFAULT false NOT NULL, + elasticsearch_analyzers_kuromoji_enabled boolean DEFAULT false NOT NULL, + elasticsearch_analyzers_kuromoji_search boolean DEFAULT false NOT NULL, + secret_detection_token_revocation_enabled boolean DEFAULT false NOT NULL, + secret_detection_token_revocation_url text, + encrypted_secret_detection_token_revocation_token text, + encrypted_secret_detection_token_revocation_token_iv text, + domain_denylist_enabled boolean DEFAULT false, + domain_denylist text, + domain_allowlist text, + new_user_signups_cap integer, + encrypted_cloud_license_auth_token text, + encrypted_cloud_license_auth_token_iv text, + secret_detection_revocation_token_types_url text, + CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)), CONSTRAINT check_2dba05b802 CHECK ((char_length(gitpod_url) <= 255)), CONSTRAINT check_51700b31b5 CHECK ((char_length(default_branch_name) <= 255)), CONSTRAINT check_57123c9593 CHECK ((char_length(help_page_documentation_base_url) <= 255)), + CONSTRAINT check_85a39b68ff CHECK ((char_length(encrypted_ci_jwt_signing_key_iv) <= 255)), + CONSTRAINT check_9a719834eb CHECK ((char_length(secret_detection_token_revocation_url) <= 255)), CONSTRAINT check_9c6c447a13 CHECK ((char_length(maintenance_mode_message) <= 255)), + CONSTRAINT check_a5704163cc CHECK ((char_length(secret_detection_revocation_token_types_url) <= 255)), CONSTRAINT check_d03919528d CHECK ((char_length(container_registry_vendor) <= 255)), CONSTRAINT check_d820146492 CHECK ((char_length(spam_check_endpoint_url) <= 255)), - CONSTRAINT check_e5aba18f02 CHECK ((char_length(container_registry_version) <= 255)) + CONSTRAINT check_e5aba18f02 CHECK ((char_length(container_registry_version) <= 255)), + CONSTRAINT check_ef6176834f CHECK ((char_length(encrypted_cloud_license_auth_token_iv) <= 255)) ); CREATE SEQUENCE application_settings_id_seq @@ -9608,7 +9664,9 @@ CREATE TABLE aws_roles ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, role_arn character varying(2048), - role_external_id character varying(64) NOT NULL + role_external_id character varying(64) NOT NULL, + region text, + CONSTRAINT check_57adedab55 CHECK ((char_length(region) <= 255)) ); CREATE TABLE background_migration_jobs ( @@ -9865,6 +9923,26 @@ CREATE SEQUENCE bulk_import_entities_id_seq ALTER SEQUENCE bulk_import_entities_id_seq OWNED BY bulk_import_entities.id; +CREATE TABLE bulk_import_trackers ( + id bigint NOT NULL, + bulk_import_entity_id bigint NOT NULL, + relation text NOT NULL, + next_page text, + has_next_page boolean DEFAULT false NOT NULL, + CONSTRAINT check_2d45cae629 CHECK ((char_length(relation) <= 255)), + CONSTRAINT check_40aeaa600b CHECK ((char_length(next_page) <= 255)), + CONSTRAINT check_next_page_requirement CHECK (((has_next_page IS FALSE) OR (next_page IS NOT NULL))) +); + +CREATE SEQUENCE bulk_import_trackers_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE bulk_import_trackers_id_seq OWNED BY bulk_import_trackers.id; + CREATE TABLE bulk_imports ( id bigint NOT NULL, user_id integer NOT NULL, @@ -10129,7 +10207,8 @@ CREATE TABLE ci_daily_build_group_report_results ( last_pipeline_id bigint NOT NULL, ref_path text NOT NULL, group_name text NOT NULL, - data jsonb NOT NULL + data jsonb NOT NULL, + default_branch boolean DEFAULT false NOT NULL ); CREATE SEQUENCE ci_daily_build_group_report_results_id_seq @@ -10653,6 +10732,38 @@ CREATE SEQUENCE ci_subscriptions_projects_id_seq ALTER SEQUENCE ci_subscriptions_projects_id_seq OWNED BY ci_subscriptions_projects.id; +CREATE TABLE ci_test_case_failures ( + id bigint NOT NULL, + failed_at timestamp with time zone, + test_case_id bigint NOT NULL, + build_id bigint NOT NULL +); + +CREATE SEQUENCE ci_test_case_failures_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE ci_test_case_failures_id_seq OWNED BY ci_test_case_failures.id; + +CREATE TABLE ci_test_cases ( + id bigint NOT NULL, + project_id bigint NOT NULL, + key_hash text NOT NULL, + CONSTRAINT check_dd3c5d1c15 CHECK ((char_length(key_hash) <= 64)) +); + +CREATE SEQUENCE ci_test_cases_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE ci_test_cases_id_seq OWNED BY ci_test_cases.id; + CREATE TABLE ci_trigger_requests ( id integer NOT NULL, trigger_id integer NOT NULL, @@ -10883,7 +10994,8 @@ CREATE TABLE clusters ( namespace_per_environment boolean DEFAULT true NOT NULL, management_project_id integer, cleanup_status smallint DEFAULT 1 NOT NULL, - cleanup_status_reason text + cleanup_status_reason text, + helm_major_version integer DEFAULT 2 NOT NULL ); CREATE TABLE clusters_applications_cert_managers ( @@ -11197,11 +11309,11 @@ CREATE TABLE container_expiration_policies ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, next_run_at timestamp with time zone, - name_regex character varying(255), + name_regex character varying(255) DEFAULT '.*'::character varying, cadence character varying(12) DEFAULT '1d'::character varying NOT NULL, older_than character varying(12) DEFAULT '90d'::character varying, keep_n integer DEFAULT 10, - enabled boolean DEFAULT true NOT NULL, + enabled boolean DEFAULT false NOT NULL, name_regex_keep text, CONSTRAINT container_expiration_policies_name_regex_keep CHECK ((char_length(name_regex_keep) <= 255)) ); @@ -11213,7 +11325,8 @@ CREATE TABLE container_repositories ( created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, status smallint, - expiration_policy_started_at timestamp with time zone + expiration_policy_started_at timestamp with time zone, + expiration_policy_cleanup_status smallint DEFAULT 0 NOT NULL ); CREATE SEQUENCE container_repositories_id_seq @@ -11270,6 +11383,23 @@ CREATE SEQUENCE conversational_development_index_metrics_id_seq ALTER SEQUENCE conversational_development_index_metrics_id_seq OWNED BY conversational_development_index_metrics.id; +CREATE TABLE csv_issue_imports ( + id bigint NOT NULL, + project_id bigint NOT NULL, + user_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE csv_issue_imports_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE csv_issue_imports_id_seq OWNED BY csv_issue_imports.id; + CREATE TABLE custom_emoji ( id bigint NOT NULL, namespace_id bigint NOT NULL, @@ -11547,7 +11677,9 @@ CREATE TABLE design_management_designs ( issue_id integer, filename character varying NOT NULL, relative_position integer, - CONSTRAINT check_07155e2715 CHECK ((char_length((filename)::text) <= 255)) + iid integer, + CONSTRAINT check_07155e2715 CHECK ((char_length((filename)::text) <= 255)), + CONSTRAINT check_cfb92df01a CHECK ((iid IS NOT NULL)) ); CREATE SEQUENCE design_management_designs_id_seq @@ -12647,10 +12779,12 @@ CREATE TABLE group_wiki_repositories ( CREATE TABLE historical_data ( id integer NOT NULL, - date date NOT NULL, + date date, active_user_count integer, created_at timestamp without time zone, - updated_at timestamp without time zone + updated_at timestamp without time zone, + recorded_at timestamp with time zone, + CONSTRAINT check_640e8cf66c CHECK ((recorded_at IS NOT NULL)) ); CREATE SEQUENCE historical_data_id_seq @@ -13063,6 +13197,9 @@ CREATE TABLE jira_tracker_data ( project_key text, issues_enabled boolean DEFAULT false NOT NULL, deployment_type smallint DEFAULT 0 NOT NULL, + vulnerabilities_issuetype text, + vulnerabilities_enabled boolean DEFAULT false NOT NULL, + CONSTRAINT check_0bf84b76e9 CHECK ((char_length(vulnerabilities_issuetype) <= 255)), CONSTRAINT check_214cf6a48b CHECK ((char_length(project_key) <= 255)) ); @@ -13354,6 +13491,23 @@ CREATE SEQUENCE merge_request_blocks_id_seq ALTER SEQUENCE merge_request_blocks_id_seq OWNED BY merge_request_blocks.id; +CREATE TABLE merge_request_cleanup_schedules ( + merge_request_id bigint NOT NULL, + scheduled_at timestamp with time zone NOT NULL, + completed_at timestamp with time zone, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE merge_request_cleanup_schedules_merge_request_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE merge_request_cleanup_schedules_merge_request_id_seq OWNED BY merge_request_cleanup_schedules.merge_request_id; + CREATE TABLE merge_request_context_commit_diff_files ( sha bytea NOT NULL, relative_order integer NOT NULL, @@ -13724,7 +13878,8 @@ CREATE TABLE namespace_root_storage_statistics ( storage_size bigint DEFAULT 0 NOT NULL, packages_size bigint DEFAULT 0 NOT NULL, snippets_size bigint DEFAULT 0 NOT NULL, - pipeline_artifacts_size bigint DEFAULT 0 NOT NULL + pipeline_artifacts_size bigint DEFAULT 0 NOT NULL, + uploads_size bigint DEFAULT 0 NOT NULL ); CREATE TABLE namespace_settings ( @@ -14298,6 +14453,21 @@ CREATE TABLE packages_nuget_metadata ( CONSTRAINT packages_nuget_metadata_project_url_constraint CHECK ((char_length(project_url) <= 255)) ); +CREATE TABLE packages_package_file_build_infos ( + id bigint NOT NULL, + package_file_id bigint NOT NULL, + pipeline_id bigint +); + +CREATE SEQUENCE packages_package_file_build_infos_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE packages_package_file_build_infos_id_seq OWNED BY packages_package_file_build_infos.id; + CREATE TABLE packages_package_files ( id bigint NOT NULL, package_id bigint NOT NULL, @@ -14380,6 +14550,8 @@ CREATE TABLE pages_deployments ( file_store smallint NOT NULL, size integer NOT NULL, file text NOT NULL, + file_count integer NOT NULL, + file_sha256 bytea NOT NULL, CONSTRAINT check_f0fe8032dd CHECK ((char_length(file) <= 255)) ); @@ -14524,7 +14696,7 @@ CREATE TABLE plan_limits ( offset_pagination_limit integer DEFAULT 50000 NOT NULL, ci_instance_level_variables integer DEFAULT 25 NOT NULL, storage_size_limit integer DEFAULT 0 NOT NULL, - ci_max_artifact_size_lsif integer DEFAULT 20 NOT NULL, + ci_max_artifact_size_lsif integer DEFAULT 100 NOT NULL, ci_max_artifact_size_archive integer DEFAULT 0 NOT NULL, ci_max_artifact_size_metadata integer DEFAULT 0 NOT NULL, ci_max_artifact_size_trace integer DEFAULT 0 NOT NULL, @@ -14615,6 +14787,8 @@ CREATE VIEW postgres_indexes AS pg_index.indisvalid AS valid_index, pg_class.relispartition AS partitioned, pg_index.indisexclusion AS exclusion, + (pg_index.indexprs IS NOT NULL) AS expression, + (pg_index.indpred IS NOT NULL) AS partial, pg_indexes.indexdef AS definition, pg_relation_size((pg_class.oid)::regclass) AS ondisk_size_bytes FROM (((pg_index @@ -14623,6 +14797,48 @@ CREATE VIEW postgres_indexes AS JOIN pg_indexes ON ((pg_class.relname = pg_indexes.indexname))) WHERE ((pg_namespace.nspname <> 'pg_catalog'::name) AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name]))); +CREATE VIEW postgres_partitioned_tables AS + SELECT (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text) AS identifier, + pg_class.oid, + pg_namespace.nspname AS schema, + pg_class.relname AS name, + CASE partitioned_tables.partstrat + WHEN 'l'::"char" THEN 'list'::text + WHEN 'r'::"char" THEN 'range'::text + WHEN 'h'::"char" THEN 'hash'::text + ELSE NULL::text + END AS strategy, + array_agg(pg_attribute.attname) AS key_columns + FROM (((( SELECT pg_partitioned_table.partrelid, + pg_partitioned_table.partstrat, + unnest(pg_partitioned_table.partattrs) AS column_position + FROM pg_partitioned_table) partitioned_tables + JOIN pg_class ON ((partitioned_tables.partrelid = pg_class.oid))) + JOIN pg_namespace ON ((pg_class.relnamespace = pg_namespace.oid))) + JOIN pg_attribute ON (((pg_attribute.attrelid = pg_class.oid) AND (pg_attribute.attnum = partitioned_tables.column_position)))) + WHERE (pg_namespace.nspname = "current_schema"()) + GROUP BY (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text), pg_class.oid, pg_namespace.nspname, pg_class.relname, + CASE partitioned_tables.partstrat + WHEN 'l'::"char" THEN 'list'::text + WHEN 'r'::"char" THEN 'range'::text + WHEN 'h'::"char" THEN 'hash'::text + ELSE NULL::text + END; + +CREATE VIEW postgres_partitions AS + SELECT (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text) AS identifier, + pg_class.oid, + pg_namespace.nspname AS schema, + pg_class.relname AS name, + (((parent_namespace.nspname)::text || '.'::text) || (parent_class.relname)::text) AS parent_identifier, + pg_get_expr(pg_class.relpartbound, pg_inherits.inhrelid) AS condition + FROM ((((pg_class + JOIN pg_namespace ON ((pg_namespace.oid = pg_class.relnamespace))) + JOIN pg_inherits ON ((pg_class.oid = pg_inherits.inhrelid))) + JOIN pg_class parent_class ON ((pg_inherits.inhparent = parent_class.oid))) + JOIN pg_namespace parent_namespace ON ((parent_class.relnamespace = parent_namespace.oid))) + WHERE (pg_class.relispartition AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name]))); + CREATE TABLE postgres_reindex_actions ( id bigint NOT NULL, action_start timestamp with time zone NOT NULL, @@ -14717,7 +14933,9 @@ CREATE TABLE project_ci_cd_settings ( group_runners_enabled boolean DEFAULT true NOT NULL, merge_pipelines_enabled boolean, default_git_depth integer, - forward_deployment_enabled boolean + forward_deployment_enabled boolean, + merge_trains_enabled boolean DEFAULT false, + auto_rollback_enabled boolean DEFAULT false NOT NULL ); CREATE SEQUENCE project_ci_cd_settings_id_seq @@ -14731,7 +14949,7 @@ ALTER SEQUENCE project_ci_cd_settings_id_seq OWNED BY project_ci_cd_settings.id; CREATE TABLE project_compliance_framework_settings ( project_id bigint NOT NULL, - framework smallint NOT NULL, + framework smallint, framework_id bigint, CONSTRAINT check_d348de9e2d CHECK ((framework_id IS NOT NULL)) ); @@ -14842,7 +15060,8 @@ CREATE TABLE project_features ( repository_access_level integer DEFAULT 20 NOT NULL, pages_access_level integer NOT NULL, forking_access_level integer, - metrics_dashboard_access_level integer + metrics_dashboard_access_level integer, + requirements_access_level integer DEFAULT 20 NOT NULL ); CREATE SEQUENCE project_features_id_seq @@ -15041,6 +15260,7 @@ CREATE TABLE project_settings ( allow_merge_on_skipped_pipeline boolean, squash_option smallint DEFAULT 3, has_confluence boolean DEFAULT false NOT NULL, + has_vulnerabilities boolean DEFAULT false NOT NULL, CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL)) ); @@ -15058,7 +15278,8 @@ CREATE TABLE project_statistics ( packages_size bigint DEFAULT 0 NOT NULL, wiki_size bigint, snippets_size bigint, - pipeline_artifacts_size bigint DEFAULT 0 NOT NULL + pipeline_artifacts_size bigint DEFAULT 0 NOT NULL, + uploads_size bigint DEFAULT 0 NOT NULL ); CREATE SEQUENCE project_statistics_id_seq @@ -15840,6 +16061,7 @@ CREATE TABLE security_findings ( confidence smallint NOT NULL, project_fingerprint text NOT NULL, deduplicated boolean DEFAULT false NOT NULL, + "position" integer, CONSTRAINT check_b9508c6df8 CHECK ((char_length(project_fingerprint) <= 40)) ); @@ -15857,8 +16079,7 @@ CREATE TABLE security_scans ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, build_id bigint NOT NULL, - scan_type smallint NOT NULL, - scanned_resources_count integer + scan_type smallint NOT NULL ); CREATE SEQUENCE security_scans_id_seq @@ -16049,6 +16270,27 @@ CREATE TABLE snippet_repositories ( CONSTRAINT snippet_repositories_verification_failure_text_limit CHECK ((char_length(verification_failure) <= 255)) ); +CREATE TABLE snippet_repository_storage_moves ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + snippet_id bigint NOT NULL, + state smallint DEFAULT 1 NOT NULL, + source_storage_name text NOT NULL, + destination_storage_name text NOT NULL, + CONSTRAINT snippet_repository_storage_moves_destination_storage_name CHECK ((char_length(destination_storage_name) <= 255)), + CONSTRAINT snippet_repository_storage_moves_source_storage_name CHECK ((char_length(source_storage_name) <= 255)) +); + +CREATE SEQUENCE snippet_repository_storage_moves_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE snippet_repository_storage_moves_id_seq OWNED BY snippet_repository_storage_moves.id; + CREATE TABLE snippet_statistics ( snippet_id bigint NOT NULL, repository_size bigint DEFAULT 0 NOT NULL, @@ -16092,7 +16334,8 @@ CREATE TABLE snippets ( description_html text, encrypted_secret_token character varying(255), encrypted_secret_token_iv character varying(255), - secret boolean DEFAULT false NOT NULL + secret boolean DEFAULT false NOT NULL, + repository_read_only boolean DEFAULT false NOT NULL ); CREATE SEQUENCE snippets_id_seq @@ -16356,6 +16599,7 @@ CREATE TABLE terraform_state_versions ( verified_at timestamp with time zone, verification_checksum bytea, verification_failure text, + ci_build_id bigint, CONSTRAINT check_0824bb7bbd CHECK ((char_length(file) <= 255)), CONSTRAINT tf_state_versions_verification_failure_text_limit CHECK ((char_length(verification_failure) <= 255)) ); @@ -16381,13 +16625,7 @@ CREATE TABLE terraform_states ( locked_by_user_id bigint, uuid character varying(32) NOT NULL, name character varying(255), - verification_retry_at timestamp with time zone, - verified_at timestamp with time zone, - verification_retry_count smallint, - verification_checksum bytea, - verification_failure text, - versioning_enabled boolean DEFAULT false NOT NULL, - CONSTRAINT check_21a47163ea CHECK ((char_length(verification_failure) <= 255)) + versioning_enabled boolean DEFAULT false NOT NULL ); CREATE SEQUENCE terraform_states_id_seq @@ -16649,7 +16887,8 @@ CREATE TABLE user_statuses ( cached_markdown_version integer, emoji character varying DEFAULT 'speech_balloon'::character varying NOT NULL, message character varying(100), - message_html character varying + message_html character varying, + availability smallint DEFAULT 0 NOT NULL ); CREATE SEQUENCE user_statuses_user_id_seq @@ -16929,6 +17168,26 @@ CREATE SEQUENCE vulnerability_feedback_id_seq ALTER SEQUENCE vulnerability_feedback_id_seq OWNED BY vulnerability_feedback.id; +CREATE TABLE vulnerability_finding_links ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + vulnerability_occurrence_id bigint NOT NULL, + name text, + url text NOT NULL, + CONSTRAINT check_55f0a95439 CHECK ((char_length(name) <= 255)), + CONSTRAINT check_b7fe886df6 CHECK ((char_length(url) <= 2048)) +); + +CREATE SEQUENCE vulnerability_finding_links_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE vulnerability_finding_links_id_seq OWNED BY vulnerability_finding_links.id; + CREATE TABLE vulnerability_historical_statistics ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -17166,7 +17425,9 @@ CREATE TABLE web_hooks ( encrypted_token_iv character varying, encrypted_url character varying, encrypted_url_iv character varying, - deployment_events boolean DEFAULT false NOT NULL + deployment_events boolean DEFAULT false NOT NULL, + releases_events boolean DEFAULT false NOT NULL, + feature_flag_events boolean DEFAULT false NOT NULL ); CREATE SEQUENCE web_hooks_id_seq @@ -17333,6 +17594,10 @@ ALTER TABLE ONLY analytics_cycle_analytics_group_value_streams ALTER COLUMN id S ALTER TABLE ONLY analytics_cycle_analytics_project_stages ALTER COLUMN id SET DEFAULT nextval('analytics_cycle_analytics_project_stages_id_seq'::regclass); +ALTER TABLE ONLY analytics_devops_adoption_segment_selections ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_segment_selections_id_seq'::regclass); + +ALTER TABLE ONLY analytics_devops_adoption_segments ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_segments_id_seq'::regclass); + ALTER TABLE ONLY analytics_instance_statistics_measurements ALTER COLUMN id SET DEFAULT nextval('analytics_instance_statistics_measurements_id_seq'::regclass); ALTER TABLE ONLY appearances ALTER COLUMN id SET DEFAULT nextval('appearances_id_seq'::regclass); @@ -17395,6 +17660,8 @@ ALTER TABLE ONLY bulk_import_configurations ALTER COLUMN id SET DEFAULT nextval( ALTER TABLE ONLY bulk_import_entities ALTER COLUMN id SET DEFAULT nextval('bulk_import_entities_id_seq'::regclass); +ALTER TABLE ONLY bulk_import_trackers ALTER COLUMN id SET DEFAULT nextval('bulk_import_trackers_id_seq'::regclass); + ALTER TABLE ONLY bulk_imports ALTER COLUMN id SET DEFAULT nextval('bulk_imports_id_seq'::regclass); ALTER TABLE ONLY chat_names ALTER COLUMN id SET DEFAULT nextval('chat_names_id_seq'::regclass); @@ -17469,6 +17736,10 @@ ALTER TABLE ONLY ci_stages ALTER COLUMN id SET DEFAULT nextval('ci_stages_id_seq ALTER TABLE ONLY ci_subscriptions_projects ALTER COLUMN id SET DEFAULT nextval('ci_subscriptions_projects_id_seq'::regclass); +ALTER TABLE ONLY ci_test_case_failures ALTER COLUMN id SET DEFAULT nextval('ci_test_case_failures_id_seq'::regclass); + +ALTER TABLE ONLY ci_test_cases ALTER COLUMN id SET DEFAULT nextval('ci_test_cases_id_seq'::regclass); + ALTER TABLE ONLY ci_trigger_requests ALTER COLUMN id SET DEFAULT nextval('ci_trigger_requests_id_seq'::regclass); ALTER TABLE ONLY ci_triggers ALTER COLUMN id SET DEFAULT nextval('ci_triggers_id_seq'::regclass); @@ -17523,6 +17794,8 @@ ALTER TABLE ONLY container_repositories ALTER COLUMN id SET DEFAULT nextval('con ALTER TABLE ONLY conversational_development_index_metrics ALTER COLUMN id SET DEFAULT nextval('conversational_development_index_metrics_id_seq'::regclass); +ALTER TABLE ONLY csv_issue_imports ALTER COLUMN id SET DEFAULT nextval('csv_issue_imports_id_seq'::regclass); + ALTER TABLE ONLY custom_emoji ALTER COLUMN id SET DEFAULT nextval('custom_emoji_id_seq'::regclass); ALTER TABLE ONLY dast_scanner_profiles ALTER COLUMN id SET DEFAULT nextval('dast_scanner_profiles_id_seq'::regclass); @@ -17719,6 +17992,8 @@ ALTER TABLE ONLY merge_request_assignees ALTER COLUMN id SET DEFAULT nextval('me ALTER TABLE ONLY merge_request_blocks ALTER COLUMN id SET DEFAULT nextval('merge_request_blocks_id_seq'::regclass); +ALTER TABLE ONLY merge_request_cleanup_schedules ALTER COLUMN merge_request_id SET DEFAULT nextval('merge_request_cleanup_schedules_merge_request_id_seq'::regclass); + ALTER TABLE ONLY merge_request_context_commits ALTER COLUMN id SET DEFAULT nextval('merge_request_context_commits_id_seq'::regclass); ALTER TABLE ONLY merge_request_diff_details ALTER COLUMN merge_request_diff_id SET DEFAULT nextval('merge_request_diff_details_merge_request_diff_id_seq'::regclass); @@ -17793,6 +18068,8 @@ ALTER TABLE ONLY packages_events ALTER COLUMN id SET DEFAULT nextval('packages_e ALTER TABLE ONLY packages_maven_metadata ALTER COLUMN id SET DEFAULT nextval('packages_maven_metadata_id_seq'::regclass); +ALTER TABLE ONLY packages_package_file_build_infos ALTER COLUMN id SET DEFAULT nextval('packages_package_file_build_infos_id_seq'::regclass); + ALTER TABLE ONLY packages_package_files ALTER COLUMN id SET DEFAULT nextval('packages_package_files_id_seq'::regclass); ALTER TABLE ONLY packages_packages ALTER COLUMN id SET DEFAULT nextval('packages_packages_id_seq'::regclass); @@ -17943,6 +18220,8 @@ ALTER TABLE ONLY slack_integrations ALTER COLUMN id SET DEFAULT nextval('slack_i ALTER TABLE ONLY smartcard_identities ALTER COLUMN id SET DEFAULT nextval('smartcard_identities_id_seq'::regclass); +ALTER TABLE ONLY snippet_repository_storage_moves ALTER COLUMN id SET DEFAULT nextval('snippet_repository_storage_moves_id_seq'::regclass); + ALTER TABLE ONLY snippet_user_mentions ALTER COLUMN id SET DEFAULT nextval('snippet_user_mentions_id_seq'::regclass); ALTER TABLE ONLY snippets ALTER COLUMN id SET DEFAULT nextval('snippets_id_seq'::regclass); @@ -18015,6 +18294,8 @@ ALTER TABLE ONLY vulnerability_exports ALTER COLUMN id SET DEFAULT nextval('vuln ALTER TABLE ONLY vulnerability_feedback ALTER COLUMN id SET DEFAULT nextval('vulnerability_feedback_id_seq'::regclass); +ALTER TABLE ONLY vulnerability_finding_links ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_links_id_seq'::regclass); + ALTER TABLE ONLY vulnerability_historical_statistics ALTER COLUMN id SET DEFAULT nextval('vulnerability_historical_statistics_id_seq'::regclass); ALTER TABLE ONLY vulnerability_identifiers ALTER COLUMN id SET DEFAULT nextval('vulnerability_identifiers_id_seq'::regclass); @@ -18276,9 +18557,18 @@ ALTER TABLE ONLY analytics_cycle_analytics_group_value_streams ALTER TABLE ONLY analytics_cycle_analytics_project_stages ADD CONSTRAINT analytics_cycle_analytics_project_stages_pkey PRIMARY KEY (id); +ALTER TABLE ONLY analytics_devops_adoption_segment_selections + ADD CONSTRAINT analytics_devops_adoption_segment_selections_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY analytics_devops_adoption_segments + ADD CONSTRAINT analytics_devops_adoption_segments_pkey PRIMARY KEY (id); + ALTER TABLE ONLY analytics_instance_statistics_measurements ADD CONSTRAINT analytics_instance_statistics_measurements_pkey PRIMARY KEY (id); +ALTER TABLE ONLY analytics_language_trend_repository_languages + ADD CONSTRAINT analytics_language_trend_repository_languages_pkey PRIMARY KEY (programming_language_id, project_id, snapshot_date); + ALTER TABLE ONLY appearances ADD CONSTRAINT appearances_pkey PRIMARY KEY (id); @@ -18309,6 +18599,9 @@ ALTER TABLE ONLY approval_project_rules_groups ALTER TABLE ONLY approval_project_rules ADD CONSTRAINT approval_project_rules_pkey PRIMARY KEY (id); +ALTER TABLE ONLY approval_project_rules_protected_branches + ADD CONSTRAINT approval_project_rules_protected_branches_pkey PRIMARY KEY (approval_project_rule_id, protected_branch_id); + ALTER TABLE ONLY approval_project_rules_users ADD CONSTRAINT approval_project_rules_users_pkey PRIMARY KEY (id); @@ -18381,6 +18674,9 @@ ALTER TABLE ONLY bulk_import_configurations ALTER TABLE ONLY bulk_import_entities ADD CONSTRAINT bulk_import_entities_pkey PRIMARY KEY (id); +ALTER TABLE ONLY bulk_import_trackers + ADD CONSTRAINT bulk_import_trackers_pkey PRIMARY KEY (id); + ALTER TABLE ONLY bulk_imports ADD CONSTRAINT bulk_imports_pkey PRIMARY KEY (id); @@ -18411,6 +18707,9 @@ ALTER TABLE ONLY ci_build_trace_chunks ALTER TABLE ONLY ci_build_trace_section_names ADD CONSTRAINT ci_build_trace_section_names_pkey PRIMARY KEY (id); +ALTER TABLE ONLY ci_build_trace_sections + ADD CONSTRAINT ci_build_trace_sections_pkey PRIMARY KEY (build_id, section_name_id); + ALTER TABLE ONLY ci_builds_metadata ADD CONSTRAINT ci_builds_metadata_pkey PRIMARY KEY (id); @@ -18498,6 +18797,12 @@ ALTER TABLE ONLY ci_stages ALTER TABLE ONLY ci_subscriptions_projects ADD CONSTRAINT ci_subscriptions_projects_pkey PRIMARY KEY (id); +ALTER TABLE ONLY ci_test_case_failures + ADD CONSTRAINT ci_test_case_failures_pkey PRIMARY KEY (id); + +ALTER TABLE ONLY ci_test_cases + ADD CONSTRAINT ci_test_cases_pkey PRIMARY KEY (id); + ALTER TABLE ONLY ci_trigger_requests ADD CONSTRAINT ci_trigger_requests_pkey PRIMARY KEY (id); @@ -18582,6 +18887,9 @@ ALTER TABLE ONLY container_repositories ALTER TABLE ONLY conversational_development_index_metrics ADD CONSTRAINT conversational_development_index_metrics_pkey PRIMARY KEY (id); +ALTER TABLE ONLY csv_issue_imports + ADD CONSTRAINT csv_issue_imports_pkey PRIMARY KEY (id); + ALTER TABLE ONLY custom_emoji ADD CONSTRAINT custom_emoji_pkey PRIMARY KEY (id); @@ -18615,6 +18923,9 @@ ALTER TABLE ONLY deploy_tokens ALTER TABLE ONLY deployment_clusters ADD CONSTRAINT deployment_clusters_pkey PRIMARY KEY (deployment_id); +ALTER TABLE ONLY deployment_merge_requests + ADD CONSTRAINT deployment_merge_requests_pkey PRIMARY KEY (deployment_id, merge_request_id); + ALTER TABLE ONLY deployments ADD CONSTRAINT deployments_pkey PRIMARY KEY (id); @@ -18813,6 +19124,9 @@ ALTER TABLE ONLY issuable_severities ALTER TABLE ONLY issuable_slas ADD CONSTRAINT issuable_slas_pkey PRIMARY KEY (id); +ALTER TABLE ONLY issue_assignees + ADD CONSTRAINT issue_assignees_pkey PRIMARY KEY (issue_id, user_id); + ALTER TABLE ONLY issue_email_participants ADD CONSTRAINT issue_email_participants_pkey PRIMARY KEY (id); @@ -18831,6 +19145,12 @@ ALTER TABLE ONLY issue_user_mentions ALTER TABLE ONLY issues ADD CONSTRAINT issues_pkey PRIMARY KEY (id); +ALTER TABLE ONLY issues_prometheus_alert_events + ADD CONSTRAINT issues_prometheus_alert_events_pkey PRIMARY KEY (issue_id, prometheus_alert_event_id); + +ALTER TABLE ONLY issues_self_managed_prometheus_alert_events + ADD CONSTRAINT issues_self_managed_prometheus_alert_events_pkey PRIMARY KEY (issue_id, self_managed_prometheus_alert_event_id); + ALTER TABLE ONLY sprints ADD CONSTRAINT iteration_start_and_due_daterange_group_id_constraint EXCLUDE USING gist (group_id WITH =, daterange(start_date, due_date, '[]'::text) WITH &&) WHERE ((group_id IS NOT NULL)); @@ -18891,12 +19211,21 @@ ALTER TABLE ONLY merge_request_assignees ALTER TABLE ONLY merge_request_blocks ADD CONSTRAINT merge_request_blocks_pkey PRIMARY KEY (id); +ALTER TABLE ONLY merge_request_cleanup_schedules + ADD CONSTRAINT merge_request_cleanup_schedules_pkey PRIMARY KEY (merge_request_id); + ALTER TABLE ONLY merge_request_context_commits ADD CONSTRAINT merge_request_context_commits_pkey PRIMARY KEY (id); +ALTER TABLE ONLY merge_request_diff_commits + ADD CONSTRAINT merge_request_diff_commits_pkey PRIMARY KEY (merge_request_diff_id, relative_order); + ALTER TABLE ONLY merge_request_diff_details ADD CONSTRAINT merge_request_diff_details_pkey PRIMARY KEY (merge_request_diff_id); +ALTER TABLE ONLY merge_request_diff_files + ADD CONSTRAINT merge_request_diff_files_pkey PRIMARY KEY (merge_request_diff_id, relative_order); + ALTER TABLE ONLY merge_request_diffs ADD CONSTRAINT merge_request_diffs_pkey PRIMARY KEY (id); @@ -18924,6 +19253,9 @@ ALTER TABLE ONLY metrics_dashboard_annotations ALTER TABLE ONLY metrics_users_starred_dashboards ADD CONSTRAINT metrics_users_starred_dashboards_pkey PRIMARY KEY (id); +ALTER TABLE ONLY milestone_releases + ADD CONSTRAINT milestone_releases_pkey PRIMARY KEY (milestone_id, release_id); + ALTER TABLE ONLY milestones ADD CONSTRAINT milestones_pkey PRIMARY KEY (id); @@ -19023,6 +19355,9 @@ ALTER TABLE ONLY packages_nuget_dependency_link_metadata ALTER TABLE ONLY packages_nuget_metadata ADD CONSTRAINT packages_nuget_metadata_pkey PRIMARY KEY (package_id); +ALTER TABLE ONLY packages_package_file_build_infos + ADD CONSTRAINT packages_package_file_build_infos_pkey PRIMARY KEY (id); + ALTER TABLE ONLY packages_package_files ADD CONSTRAINT packages_package_files_pkey PRIMARY KEY (id); @@ -19077,6 +19412,9 @@ ALTER TABLE ONLY project_alerting_settings ALTER TABLE ONLY project_aliases ADD CONSTRAINT project_aliases_pkey PRIMARY KEY (id); +ALTER TABLE ONLY project_authorizations + ADD CONSTRAINT project_authorizations_pkey PRIMARY KEY (user_id, project_id, access_level); + ALTER TABLE ONLY project_auto_devops ADD CONSTRAINT project_auto_devops_pkey PRIMARY KEY (id); @@ -19122,6 +19460,9 @@ ALTER TABLE ONLY project_metrics_settings ALTER TABLE ONLY project_mirror_data ADD CONSTRAINT project_mirror_data_pkey PRIMARY KEY (id); +ALTER TABLE ONLY project_pages_metadata + ADD CONSTRAINT project_pages_metadata_pkey PRIMARY KEY (project_id); + ALTER TABLE ONLY project_repositories ADD CONSTRAINT project_repositories_pkey PRIMARY KEY (id); @@ -19179,6 +19520,9 @@ ALTER TABLE ONLY protected_tag_create_access_levels ALTER TABLE ONLY protected_tags ADD CONSTRAINT protected_tags_pkey PRIMARY KEY (id); +ALTER TABLE ONLY push_event_payloads + ADD CONSTRAINT push_event_payloads_pkey PRIMARY KEY (event_id); + ALTER TABLE ONLY push_rules ADD CONSTRAINT push_rules_pkey PRIMARY KEY (id); @@ -19197,6 +19541,9 @@ ALTER TABLE ONLY releases ALTER TABLE ONLY remote_mirrors ADD CONSTRAINT remote_mirrors_pkey PRIMARY KEY (id); +ALTER TABLE ONLY repository_languages + ADD CONSTRAINT repository_languages_pkey PRIMARY KEY (project_id, programming_language_id); + ALTER TABLE ONLY required_code_owners_sections ADD CONSTRAINT required_code_owners_sections_pkey PRIMARY KEY (id); @@ -19278,6 +19625,9 @@ ALTER TABLE ONLY smartcard_identities ALTER TABLE ONLY snippet_repositories ADD CONSTRAINT snippet_repositories_pkey PRIMARY KEY (snippet_id); +ALTER TABLE ONLY snippet_repository_storage_moves + ADD CONSTRAINT snippet_repository_storage_moves_pkey PRIMARY KEY (id); + ALTER TABLE ONLY snippet_statistics ADD CONSTRAINT snippet_statistics_pkey PRIMARY KEY (snippet_id); @@ -19362,6 +19712,9 @@ ALTER TABLE ONLY user_details ALTER TABLE ONLY user_highest_roles ADD CONSTRAINT user_highest_roles_pkey PRIMARY KEY (user_id); +ALTER TABLE ONLY user_interacted_projects + ADD CONSTRAINT user_interacted_projects_pkey PRIMARY KEY (project_id, user_id); + ALTER TABLE ONLY user_preferences ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (id); @@ -19377,6 +19730,9 @@ ALTER TABLE ONLY users_ops_dashboard_projects ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (id); +ALTER TABLE ONLY users_security_dashboard_projects + ADD CONSTRAINT users_security_dashboard_projects_pkey PRIMARY KEY (project_id, user_id); + ALTER TABLE ONLY users_star_projects ADD CONSTRAINT users_star_projects_pkey PRIMARY KEY (id); @@ -19392,6 +19748,9 @@ ALTER TABLE ONLY vulnerability_exports ALTER TABLE ONLY vulnerability_feedback ADD CONSTRAINT vulnerability_feedback_pkey PRIMARY KEY (id); +ALTER TABLE ONLY vulnerability_finding_links + ADD CONSTRAINT vulnerability_finding_links_pkey PRIMARY KEY (id); + ALTER TABLE ONLY vulnerability_historical_statistics ADD CONSTRAINT vulnerability_historical_statistics_pkey PRIMARY KEY (id); @@ -19576,14 +19935,14 @@ CREATE INDEX product_analytics_events_exper_project_id_collector_tstamp_idx9 ON CREATE INDEX product_analytics_events_experi_project_id_collector_tstamp_idx ON gitlab_partitions_static.product_analytics_events_experimental_00 USING btree (project_id, collector_tstamp); +CREATE INDEX active_billable_users ON users USING btree (id) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[NULL::integer, 6, 4]))) AND ((user_type IS NULL) OR (user_type <> ALL ('{2,6,1,3,7,8}'::smallint[])))); + CREATE INDEX analytics_index_audit_events_on_created_at_and_author_id ON audit_events USING btree (created_at, author_id); CREATE INDEX analytics_index_events_on_created_at_and_author_id ON events USING btree (created_at, author_id); CREATE INDEX analytics_repository_languages_on_project_id ON analytics_language_trend_repository_languages USING btree (project_id); -CREATE UNIQUE INDEX analytics_repository_languages_unique_index ON analytics_language_trend_repository_languages USING btree (programming_language_id, project_id, snapshot_date); - CREATE UNIQUE INDEX any_approver_merge_request_rule_type_unique_index ON approval_merge_request_rules USING btree (merge_request_id, rule_type) WHERE (rule_type = 4); CREATE UNIQUE INDEX any_approver_project_rule_type_unique_index ON approval_project_rules USING btree (project_id) WHERE (rule_type = 3); @@ -19604,6 +19963,8 @@ CREATE INDEX backup_labels_title_idx ON backup_labels USING btree (title); CREATE INDEX backup_labels_type_project_id_idx ON backup_labels USING btree (type, project_id); +CREATE UNIQUE INDEX bulk_import_trackers_uniq_relation_by_entity ON bulk_import_trackers USING btree (bulk_import_entity_id, relation); + CREATE INDEX ci_builds_gitlab_monitor_metrics ON ci_builds USING btree (status, created_at, project_id) WHERE ((type)::text = 'Ci::Build'::text); CREATE INDEX code_owner_approval_required ON protected_branches USING btree (project_id, code_owner_approval_required) WHERE (code_owner_approval_required = true); @@ -19618,15 +19979,17 @@ CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_and_note_id_index ON epic_user CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_index ON epic_user_mentions USING btree (epic_id) WHERE (note_id IS NULL); +CREATE INDEX finding_links_on_vulnerability_occurrence_id ON vulnerability_finding_links USING btree (vulnerability_occurrence_id); + CREATE INDEX idx_audit_events_on_entity_id_desc_author_id_created_at ON audit_events USING btree (entity_id, entity_type, id DESC, author_id, created_at); CREATE INDEX idx_ci_pipelines_artifacts_locked ON ci_pipelines USING btree (ci_ref_id, id) WHERE (locked = 1); CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at_enabled ON container_expiration_policies USING btree (project_id, next_run_at, enabled); -CREATE INDEX idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace ON deployment_clusters USING btree (cluster_id, kubernetes_namespace); +CREATE INDEX idx_container_repositories_on_exp_cleanup_status_and_start_date ON container_repositories USING btree (expiration_policy_cleanup_status, expiration_policy_started_at); -CREATE UNIQUE INDEX idx_deployment_merge_requests_unique_index ON deployment_merge_requests USING btree (deployment_id, merge_request_id); +CREATE INDEX idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace ON deployment_clusters USING btree (cluster_id, kubernetes_namespace); CREATE UNIQUE INDEX idx_environment_merge_requests_unique_index ON deployment_merge_requests USING btree (environment_id, merge_request_id); @@ -19668,6 +20031,8 @@ CREATE INDEX idx_mr_cc_diff_files_on_mr_cc_id_and_sha ON merge_request_context_c CREATE UNIQUE INDEX idx_on_compliance_management_frameworks_namespace_id_name ON compliance_management_frameworks USING btree (namespace_id, name); +CREATE INDEX idx_packages_build_infos_on_package_id ON packages_build_infos USING btree (package_id); + CREATE INDEX idx_packages_packages_on_project_id_name_version_package_type ON packages_packages USING btree (project_id, name, version, package_type); CREATE UNIQUE INDEX idx_pkgs_dep_links_on_pkg_id_dependency_id_dependency_type ON packages_dependency_links USING btree (package_id, dependency_id, dependency_type); @@ -19756,6 +20121,8 @@ CREATE INDEX index_analytics_ca_project_stages_on_start_event_label_id ON analyt CREATE INDEX index_analytics_cycle_analytics_group_stages_custom_only ON analytics_cycle_analytics_group_stages USING btree (id) WHERE (custom = true); +CREATE UNIQUE INDEX index_analytics_devops_adoption_segments_on_name ON analytics_devops_adoption_segments USING btree (name); + CREATE INDEX index_application_settings_on_custom_project_templates_group_id ON application_settings USING btree (custom_project_templates_group_id); CREATE INDEX index_application_settings_on_file_template_project_id ON application_settings USING btree (file_template_project_id); @@ -19796,8 +20163,6 @@ CREATE INDEX index_approval_project_rules_on_rule_type ON approval_project_rules CREATE INDEX index_approval_project_rules_protected_branches_pb_id ON approval_project_rules_protected_branches USING btree (protected_branch_id); -CREATE UNIQUE INDEX index_approval_project_rules_protected_branches_unique ON approval_project_rules_protected_branches USING btree (approval_project_rule_id, protected_branch_id); - CREATE UNIQUE INDEX index_approval_project_rules_users_1 ON approval_project_rules_users USING btree (approval_project_rule_id, user_id); CREATE INDEX index_approval_project_rules_users_2 ON approval_project_rules_users USING btree (user_id); @@ -19922,8 +20287,6 @@ CREATE UNIQUE INDEX index_ci_build_trace_chunks_on_build_id_and_chunk_index ON c CREATE UNIQUE INDEX index_ci_build_trace_section_names_on_project_id_and_name ON ci_build_trace_section_names USING btree (project_id, name); -CREATE UNIQUE INDEX index_ci_build_trace_sections_on_build_id_and_section_name_id ON ci_build_trace_sections USING btree (build_id, section_name_id); - CREATE INDEX index_ci_build_trace_sections_on_project_id ON ci_build_trace_sections USING btree (project_id); CREATE INDEX index_ci_build_trace_sections_on_section_name_id ON ci_build_trace_sections USING btree (section_name_id); @@ -19984,6 +20347,8 @@ CREATE UNIQUE INDEX index_ci_builds_runner_session_on_build_id ON ci_builds_runn CREATE INDEX index_ci_daily_build_group_report_results_on_last_pipeline_id ON ci_daily_build_group_report_results USING btree (last_pipeline_id); +CREATE INDEX index_ci_daily_build_group_report_results_on_project_and_date ON ci_daily_build_group_report_results USING btree (project_id, date DESC) WHERE ((default_branch = true) AND ((data -> 'coverage'::text) IS NOT NULL)); + CREATE INDEX index_ci_deleted_objects_on_pick_up_at ON ci_deleted_objects USING btree (pick_up_at); CREATE INDEX index_ci_freeze_periods_on_project_id ON ci_freeze_periods USING btree (project_id); @@ -20002,8 +20367,6 @@ CREATE INDEX index_ci_job_artifacts_on_file_store ON ci_job_artifacts USING btre CREATE UNIQUE INDEX index_ci_job_artifacts_on_job_id_and_file_type ON ci_job_artifacts USING btree (job_id, file_type); -CREATE INDEX index_ci_job_artifacts_on_license_compliance_file_types ON ci_job_artifacts USING btree (job_id, file_type) WHERE ((file_type = 10) OR (file_type = 101)); - CREATE INDEX index_ci_job_artifacts_on_project_id ON ci_job_artifacts USING btree (project_id); CREATE INDEX index_ci_job_artifacts_on_project_id_for_security_reports ON ci_job_artifacts USING btree (project_id) WHERE (file_type = ANY (ARRAY[5, 6, 7, 8])); @@ -20064,6 +20427,8 @@ CREATE INDEX index_ci_pipelines_on_project_id_and_source ON ci_pipelines USING b CREATE INDEX index_ci_pipelines_on_project_id_and_status_and_config_source ON ci_pipelines USING btree (project_id, status, config_source); +CREATE INDEX index_ci_pipelines_on_project_id_and_status_and_created_at ON ci_pipelines USING btree (project_id, status, created_at); + CREATE INDEX index_ci_pipelines_on_project_id_and_status_and_updated_at ON ci_pipelines USING btree (project_id, status, updated_at); CREATE INDEX index_ci_pipelines_on_project_id_and_user_id_and_status_and_ref ON ci_pipelines USING btree (project_id, user_id, status, ref) WHERE (source <> 12); @@ -20130,6 +20495,10 @@ CREATE INDEX index_ci_subscriptions_projects_on_upstream_project_id ON ci_subscr CREATE UNIQUE INDEX index_ci_subscriptions_projects_unique_subscription ON ci_subscriptions_projects USING btree (downstream_project_id, upstream_project_id); +CREATE INDEX index_ci_test_case_failures_on_build_id ON ci_test_case_failures USING btree (build_id); + +CREATE UNIQUE INDEX index_ci_test_cases_on_project_id_and_key_hash ON ci_test_cases USING btree (project_id, key_hash); + CREATE INDEX index_ci_trigger_requests_on_commit_id ON ci_trigger_requests USING btree (commit_id); CREATE INDEX index_ci_trigger_requests_on_trigger_id_and_id ON ci_trigger_requests USING btree (trigger_id, id DESC); @@ -20216,12 +20585,18 @@ CREATE INDEX index_container_expiration_policies_on_next_run_at_and_enabled ON c CREATE INDEX index_container_repositories_on_project_id ON container_repositories USING btree (project_id); +CREATE INDEX index_container_repositories_on_project_id_and_id ON container_repositories USING btree (project_id, id); + CREATE UNIQUE INDEX index_container_repositories_on_project_id_and_name ON container_repositories USING btree (project_id, name); CREATE INDEX index_container_repository_on_name_trigram ON container_repositories USING gin (name gin_trgm_ops); CREATE INDEX index_created_at_on_codeowner_approval_merge_request_rules ON approval_merge_request_rules USING btree (created_at) WHERE ((rule_type = 2) AND (section <> 'codeowners'::text)); +CREATE INDEX index_csv_issue_imports_on_project_id ON csv_issue_imports USING btree (project_id); + +CREATE INDEX index_csv_issue_imports_on_user_id ON csv_issue_imports USING btree (user_id); + CREATE UNIQUE INDEX index_custom_emoji_on_namespace_id_and_name ON custom_emoji USING btree (namespace_id, name); CREATE UNIQUE INDEX index_daily_build_group_report_results_unique_columns ON ci_daily_build_group_report_results USING btree (project_id, ref_path, date, group_name); @@ -20236,7 +20611,7 @@ CREATE INDEX index_dast_site_tokens_on_project_id ON dast_site_tokens USING btre CREATE INDEX index_dast_site_validations_on_dast_site_token_id ON dast_site_validations USING btree (dast_site_token_id); -CREATE INDEX index_dast_site_validations_on_url_base ON dast_site_validations USING btree (url_base); +CREATE INDEX index_dast_site_validations_on_url_base_and_state ON dast_site_validations USING btree (url_base, state); CREATE INDEX index_dast_sites_on_dast_site_validation_id ON dast_sites USING btree (dast_site_validation_id); @@ -20302,6 +20677,8 @@ CREATE INDEX index_description_versions_on_merge_request_id ON description_versi CREATE INDEX index_design_management_designs_issue_id_relative_position_id ON design_management_designs USING btree (issue_id, relative_position, id); +CREATE UNIQUE INDEX index_design_management_designs_on_iid_and_project_id ON design_management_designs USING btree (project_id, iid); + CREATE UNIQUE INDEX index_design_management_designs_on_issue_id_and_filename ON design_management_designs USING btree (issue_id, filename); CREATE INDEX index_design_management_designs_on_project_id ON design_management_designs USING btree (project_id); @@ -20384,6 +20761,8 @@ CREATE INDEX index_epics_on_group_id ON epics USING btree (group_id); CREATE UNIQUE INDEX index_epics_on_group_id_and_external_key ON epics USING btree (group_id, external_key) WHERE (external_key IS NOT NULL); +CREATE UNIQUE INDEX index_epics_on_group_id_and_iid ON epics USING btree (group_id, iid); + CREATE INDEX index_epics_on_group_id_and_iid_varchar_pattern ON epics USING btree (group_id, ((iid)::character varying) varchar_pattern_ops); CREATE INDEX index_epics_on_iid ON epics USING btree (iid); @@ -20628,8 +21007,6 @@ CREATE UNIQUE INDEX index_issuable_severities_on_issue_id ON issuable_severities CREATE UNIQUE INDEX index_issuable_slas_on_issue_id ON issuable_slas USING btree (issue_id); -CREATE UNIQUE INDEX index_issue_assignees_on_issue_id_and_user_id ON issue_assignees USING btree (issue_id, user_id); - CREATE INDEX index_issue_assignees_on_user_id ON issue_assignees USING btree (user_id); CREATE UNIQUE INDEX index_issue_email_participants_on_issue_id_and_email ON issue_email_participants USING btree (issue_id, email); @@ -20670,6 +21047,10 @@ CREATE INDEX index_issues_on_milestone_id ON issues USING btree (milestone_id); CREATE INDEX index_issues_on_moved_to_id ON issues USING btree (moved_to_id) WHERE (moved_to_id IS NOT NULL); +CREATE INDEX index_issues_on_project_id_and_closed_at ON issues USING btree (project_id, closed_at); + +CREATE INDEX index_issues_on_project_id_and_created_at_issue_type_incident ON issues USING btree (project_id, created_at) WHERE (issue_type = 1); + CREATE UNIQUE INDEX index_issues_on_project_id_and_external_key ON issues USING btree (project_id, external_key) WHERE (external_key IS NOT NULL); CREATE UNIQUE INDEX index_issues_on_project_id_and_iid ON issues USING btree (project_id, iid); @@ -20684,8 +21065,6 @@ CREATE INDEX index_issues_on_updated_at ON issues USING btree (updated_at); CREATE INDEX index_issues_on_updated_by_id ON issues USING btree (updated_by_id) WHERE (updated_by_id IS NOT NULL); -CREATE INDEX index_issues_project_id_issue_type_incident ON issues USING btree (project_id) WHERE (issue_type = 1); - CREATE UNIQUE INDEX index_jira_connect_installations_on_client_key ON jira_connect_installations USING btree (client_key); CREATE INDEX index_jira_connect_subscriptions_on_namespace_id ON jira_connect_subscriptions USING btree (namespace_id); @@ -20786,14 +21165,12 @@ CREATE INDEX index_merge_request_assignees_on_user_id ON merge_request_assignees CREATE INDEX index_merge_request_blocks_on_blocked_merge_request_id ON merge_request_blocks USING btree (blocked_merge_request_id); -CREATE UNIQUE INDEX index_merge_request_diff_commits_on_mr_diff_id_and_order ON merge_request_diff_commits USING btree (merge_request_diff_id, relative_order); +CREATE UNIQUE INDEX index_merge_request_cleanup_schedules_on_merge_request_id ON merge_request_cleanup_schedules USING btree (merge_request_id); CREATE INDEX index_merge_request_diff_commits_on_sha ON merge_request_diff_commits USING btree (sha); CREATE INDEX index_merge_request_diff_details_on_merge_request_diff_id ON merge_request_diff_details USING btree (merge_request_diff_id); -CREATE UNIQUE INDEX index_merge_request_diff_files_on_mr_diff_id_and_order ON merge_request_diff_files USING btree (merge_request_diff_id, relative_order); - CREATE INDEX index_merge_request_diffs_by_id_partial ON merge_request_diffs USING btree (id) WHERE ((files_count > 0) AND ((NOT stored_externally) OR (stored_externally IS NULL))); CREATE INDEX index_merge_request_diffs_on_external_diff_store ON merge_request_diffs USING btree (external_diff_store); @@ -20816,8 +21193,6 @@ CREATE INDEX index_merge_request_metrics_on_pipeline_id ON merge_request_metrics CREATE INDEX index_merge_request_metrics_on_target_project_id ON merge_request_metrics USING btree (target_project_id); -CREATE INDEX index_merge_request_metrics_on_target_project_id_merged_at ON merge_request_metrics USING btree (target_project_id, merged_at); - CREATE UNIQUE INDEX index_merge_request_reviewers_on_merge_request_id_and_user_id ON merge_request_reviewers USING btree (merge_request_id, user_id); CREATE INDEX index_merge_request_reviewers_on_user_id ON merge_request_reviewers USING btree (user_id); @@ -20858,8 +21233,12 @@ CREATE UNIQUE INDEX index_merge_requests_on_target_project_id_and_iid ON merge_r CREATE INDEX index_merge_requests_on_target_project_id_and_iid_and_state_id ON merge_requests USING btree (target_project_id, iid, state_id); +CREATE INDEX index_merge_requests_on_target_project_id_and_iid_jira_title ON merge_requests USING btree (target_project_id, iid) WHERE ((title)::text ~ '[A-Z][A-Z_0-9]+-\d+'::text); + CREATE INDEX index_merge_requests_on_target_project_id_and_target_branch ON merge_requests USING btree (target_project_id, target_branch) WHERE ((state_id = 1) AND (merge_when_pipeline_succeeds = true)); +CREATE INDEX index_merge_requests_on_target_project_id_iid_jira_description ON merge_requests USING btree (target_project_id, iid) WHERE (description ~ '[A-Z][A-Z_0-9]+-\d+'::text); + CREATE INDEX index_merge_requests_on_title ON merge_requests USING btree (title); CREATE INDEX index_merge_requests_on_title_trigram ON merge_requests USING gin (title gin_trgm_ops); @@ -20896,14 +21275,16 @@ CREATE INDEX index_milestones_on_title ON milestones USING btree (title); CREATE INDEX index_milestones_on_title_trigram ON milestones USING gin (title gin_trgm_ops); -CREATE UNIQUE INDEX index_miletone_releases_on_milestone_and_release ON milestone_releases USING btree (milestone_id, release_id); - CREATE INDEX index_mirror_data_on_next_execution_and_retry_count ON project_mirror_data USING btree (next_execution_timestamp, retry_count); CREATE UNIQUE INDEX index_mr_blocks_on_blocking_and_blocked_mr_ids ON merge_request_blocks USING btree (blocking_merge_request_id, blocked_merge_request_id); +CREATE INDEX index_mr_cleanup_schedules_timestamps ON merge_request_cleanup_schedules USING btree (scheduled_at) WHERE (completed_at IS NULL); + CREATE UNIQUE INDEX index_mr_context_commits_on_merge_request_id_and_sha ON merge_request_context_commits USING btree (merge_request_id, sha); +CREATE INDEX index_mr_metrics_on_target_project_id_merged_at_nulls_last ON merge_request_metrics USING btree (target_project_id, merged_at DESC NULLS LAST, id DESC); + CREATE UNIQUE INDEX index_namespace_aggregation_schedules_on_namespace_id ON namespace_aggregation_schedules USING btree (namespace_id); CREATE UNIQUE INDEX index_namespace_root_storage_statistics_on_namespace_id ON namespace_root_storage_statistics USING btree (namespace_id); @@ -20974,6 +21355,8 @@ CREATE INDEX index_notification_settings_on_user_id ON notification_settings USI CREATE UNIQUE INDEX index_notifications_on_user_id_and_source_id_and_source_type ON notification_settings USING btree (user_id, source_id, source_type); +CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON oauth_access_grants USING btree (resource_owner_id, application_id, created_at); + CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON oauth_access_grants USING btree (token); CREATE INDEX index_oauth_access_tokens_on_application_id ON oauth_access_tokens USING btree (application_id); @@ -21000,6 +21383,24 @@ CREATE UNIQUE INDEX index_on_instance_statistics_recorded_at_and_identifier ON a CREATE INDEX index_on_label_links_all_columns ON label_links USING btree (target_id, label_id, target_type); +CREATE INDEX index_on_namespaces_lower_name ON namespaces USING btree (lower((name)::text)); + +CREATE INDEX index_on_namespaces_lower_path ON namespaces USING btree (lower((path)::text)); + +CREATE INDEX index_on_projects_lower_path ON projects USING btree (lower((path)::text)); + +CREATE INDEX index_on_routes_lower_path ON routes USING btree (lower((path)::text)); + +CREATE UNIQUE INDEX index_on_segment_selections_group_id_segment_id ON analytics_devops_adoption_segment_selections USING btree (group_id, segment_id); + +CREATE UNIQUE INDEX index_on_segment_selections_project_id_segment_id ON analytics_devops_adoption_segment_selections USING btree (project_id, segment_id); + +CREATE INDEX index_on_segment_selections_segment_id ON analytics_devops_adoption_segment_selections USING btree (segment_id); + +CREATE INDEX index_on_users_lower_email ON users USING btree (lower((email)::text)); + +CREATE INDEX index_on_users_lower_username ON users USING btree (lower((username)::text)); + CREATE INDEX index_on_users_name_lower ON users USING btree (lower((name)::text)); CREATE INDEX index_open_project_tracker_data_on_service_id ON open_project_tracker_data USING btree (service_id); @@ -21024,8 +21425,6 @@ CREATE UNIQUE INDEX index_ops_feature_flags_issues_on_feature_flag_id_and_issue_ CREATE UNIQUE INDEX index_ops_strategies_user_lists_on_strategy_id_and_user_list_id ON operations_strategies_user_lists USING btree (strategy_id, user_list_id); -CREATE UNIQUE INDEX index_packages_build_infos_on_package_id ON packages_build_infos USING btree (package_id); - CREATE INDEX index_packages_build_infos_on_pipeline_id ON packages_build_infos USING btree (pipeline_id); CREATE UNIQUE INDEX index_packages_composer_metadata_on_package_id_and_target_sha ON packages_composer_metadata USING btree (package_id, target_sha); @@ -21046,6 +21445,10 @@ CREATE INDEX index_packages_nuget_dl_metadata_on_dependency_link_id ON packages_ CREATE UNIQUE INDEX index_packages_on_project_id_name_version_unique_when_generic ON packages_packages USING btree (project_id, name, version) WHERE (package_type = 7); +CREATE INDEX index_packages_package_file_build_infos_on_package_file_id ON packages_package_file_build_infos USING btree (package_file_id); + +CREATE INDEX index_packages_package_file_build_infos_on_pipeline_id ON packages_package_file_build_infos USING btree (pipeline_id); + CREATE INDEX index_packages_package_files_on_file_store ON packages_package_files USING btree (file_store); CREATE INDEX index_packages_package_files_on_package_id_and_file_name ON packages_package_files USING btree (package_id, file_name); @@ -21140,8 +21543,6 @@ CREATE INDEX index_project_aliases_on_project_id ON project_aliases USING btree CREATE INDEX index_project_authorizations_on_project_id ON project_authorizations USING btree (project_id); -CREATE UNIQUE INDEX index_project_authorizations_on_user_id_project_id_access_level ON project_authorizations USING btree (user_id, project_id, access_level); - CREATE UNIQUE INDEX index_project_auto_devops_on_project_id ON project_auto_devops USING btree (project_id); CREATE UNIQUE INDEX index_project_ci_cd_settings_on_project_id ON project_ci_cd_settings USING btree (project_id); @@ -21194,8 +21595,6 @@ CREATE INDEX index_project_pages_metadata_on_artifacts_archive_id ON project_pag CREATE INDEX index_project_pages_metadata_on_pages_deployment_id ON project_pages_metadata USING btree (pages_deployment_id); -CREATE UNIQUE INDEX index_project_pages_metadata_on_project_id ON project_pages_metadata USING btree (project_id); - CREATE INDEX index_project_pages_metadata_on_project_id_and_deployed_is_true ON project_pages_metadata USING btree (project_id) WHERE (deployed = true); CREATE UNIQUE INDEX index_project_repositories_on_disk_path ON project_repositories USING btree (disk_path); @@ -21208,6 +21607,8 @@ CREATE UNIQUE INDEX index_project_repository_states_on_project_id ON project_rep CREATE INDEX index_project_repository_storage_moves_on_project_id ON project_repository_storage_moves USING btree (project_id); +CREATE INDEX index_project_settings_on_project_id_partially ON project_settings USING btree (project_id) WHERE (has_vulnerabilities IS TRUE); + CREATE UNIQUE INDEX index_project_settings_on_push_rule_id ON project_settings USING btree (push_rule_id); CREATE INDEX index_project_statistics_on_namespace_id ON project_statistics USING btree (namespace_id); @@ -21368,8 +21769,6 @@ CREATE INDEX index_protected_tags_on_project_id ON protected_tags USING btree (p CREATE UNIQUE INDEX index_protected_tags_on_project_id_and_name ON protected_tags USING btree (project_id, name); -CREATE UNIQUE INDEX index_push_event_payloads_on_event_id ON push_event_payloads USING btree (event_id); - CREATE INDEX index_push_rules_on_is_sample ON push_rules USING btree (is_sample) WHERE is_sample; CREATE INDEX index_push_rules_on_project_id ON push_rules USING btree (project_id); @@ -21394,8 +21793,6 @@ CREATE INDEX index_remote_mirrors_on_last_successful_update_at ON remote_mirrors CREATE INDEX index_remote_mirrors_on_project_id ON remote_mirrors USING btree (project_id); -CREATE UNIQUE INDEX index_repository_languages_on_project_and_languages_id ON repository_languages USING btree (project_id, programming_language_id); - CREATE INDEX index_required_code_owners_sections_on_protected_branch_id ON required_code_owners_sections USING btree (protected_branch_id); CREATE INDEX index_requirements_management_test_reports_on_author_id ON requirements_management_test_reports USING btree (author_id); @@ -21472,6 +21869,8 @@ CREATE INDEX index_reviews_on_merge_request_id ON reviews USING btree (merge_req CREATE INDEX index_reviews_on_project_id ON reviews USING btree (project_id); +CREATE INDEX index_route_on_name_trigram ON routes USING gin (name gin_trgm_ops); + CREATE UNIQUE INDEX index_routes_on_path ON routes USING btree (path); CREATE INDEX index_routes_on_path_text_pattern_ops ON routes USING btree (path varchar_pattern_ops); @@ -21502,6 +21901,8 @@ CREATE INDEX index_security_findings_on_project_fingerprint ON security_findings CREATE INDEX index_security_findings_on_scan_id_and_deduplicated ON security_findings USING btree (scan_id, deduplicated); +CREATE UNIQUE INDEX index_security_findings_on_scan_id_and_position ON security_findings USING btree (scan_id, "position"); + CREATE INDEX index_security_findings_on_scanner_id ON security_findings USING btree (scanner_id); CREATE INDEX index_security_findings_on_severity ON security_findings USING btree (severity); @@ -21536,8 +21937,6 @@ CREATE UNIQUE INDEX index_services_on_type_and_template_partial ON services USIN CREATE INDEX index_services_on_type_id_when_active_and_project_id_not_null ON services USING btree (type, id) WHERE ((active = true) AND (project_id IS NOT NULL)); -CREATE INDEX index_services_on_type_id_when_active_not_instance_not_template ON services USING btree (type, id) WHERE ((active = true) AND (instance = false) AND (template = false)); - CREATE UNIQUE INDEX index_services_on_unique_group_id_and_type ON services USING btree (group_id, type); CREATE UNIQUE INDEX index_shards_on_name ON shards USING btree (name); @@ -21554,6 +21953,8 @@ CREATE UNIQUE INDEX index_snippet_repositories_on_disk_path ON snippet_repositor CREATE INDEX index_snippet_repositories_on_shard_id ON snippet_repositories USING btree (shard_id); +CREATE INDEX index_snippet_repository_storage_moves_on_snippet_id ON snippet_repository_storage_moves USING btree (snippet_id); + CREATE UNIQUE INDEX index_snippet_user_mentions_on_note_id ON snippet_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL); CREATE INDEX index_snippets_on_author_id ON snippets USING btree (author_id); @@ -21632,6 +22033,8 @@ CREATE INDEX index_term_agreements_on_term_id ON term_agreements USING btree (te CREATE INDEX index_term_agreements_on_user_id ON term_agreements USING btree (user_id); +CREATE INDEX index_terraform_state_versions_on_ci_build_id ON terraform_state_versions USING btree (ci_build_id); + CREATE INDEX index_terraform_state_versions_on_created_by_user_id ON terraform_state_versions USING btree (created_by_user_id); CREATE UNIQUE INDEX index_terraform_state_versions_on_state_id_and_version ON terraform_state_versions USING btree (terraform_state_id, version); @@ -21644,6 +22047,8 @@ CREATE UNIQUE INDEX index_terraform_states_on_project_id_and_name ON terraform_s CREATE UNIQUE INDEX index_terraform_states_on_uuid ON terraform_states USING btree (uuid); +CREATE UNIQUE INDEX index_test_case_failures_unique_columns ON ci_test_case_failures USING btree (test_case_id, failed_at DESC, build_id); + CREATE INDEX index_timelogs_on_issue_id ON timelogs USING btree (issue_id); CREATE INDEX index_timelogs_on_merge_request_id ON timelogs USING btree (merge_request_id); @@ -21708,8 +22113,6 @@ CREATE UNIQUE INDEX index_user_details_on_user_id ON user_details USING btree (u CREATE INDEX index_user_highest_roles_on_user_id_and_highest_access_level ON user_highest_roles USING btree (user_id, highest_access_level); -CREATE UNIQUE INDEX index_user_interacted_projects_on_project_id_and_user_id ON user_interacted_projects USING btree (project_id, user_id); - CREATE INDEX index_user_interacted_projects_on_user_id ON user_interacted_projects USING btree (user_id); CREATE INDEX index_user_preferences_on_gitpod_enabled ON user_preferences USING btree (gitpod_enabled); @@ -21838,6 +22241,8 @@ CREATE INDEX index_vulnerability_occurrences_for_issue_links_migration ON vulner CREATE INDEX index_vulnerability_occurrences_on_primary_identifier_id ON vulnerability_occurrences USING btree (primary_identifier_id); +CREATE INDEX index_vulnerability_occurrences_on_project_fingerprint ON vulnerability_occurrences USING btree (project_fingerprint); + CREATE INDEX index_vulnerability_occurrences_on_scanner_id ON vulnerability_occurrences USING btree (scanner_id); CREATE UNIQUE INDEX index_vulnerability_occurrences_on_unique_keys ON vulnerability_occurrences USING btree (project_id, primary_identifier_id, location_fingerprint, scanner_id); @@ -21904,10 +22309,6 @@ CREATE INDEX issue_id_issues_prometheus_alert_events_index ON issues_prometheus_ CREATE INDEX issue_id_issues_self_managed_rometheus_alert_events_index ON issues_self_managed_prometheus_alert_events USING btree (self_managed_prometheus_alert_event_id); -CREATE UNIQUE INDEX issue_id_prometheus_alert_event_id_index ON issues_prometheus_alert_events USING btree (issue_id, prometheus_alert_event_id); - -CREATE UNIQUE INDEX issue_id_self_managed_prometheus_alert_event_id_index ON issues_self_managed_prometheus_alert_events USING btree (issue_id, self_managed_prometheus_alert_event_id); - CREATE UNIQUE INDEX issue_user_mentions_on_issue_id_and_note_id_index ON issue_user_mentions USING btree (issue_id, note_id); CREATE UNIQUE INDEX issue_user_mentions_on_issue_id_index ON issue_user_mentions USING btree (issue_id) WHERE (note_id IS NULL); @@ -21920,6 +22321,8 @@ CREATE UNIQUE INDEX merge_request_user_mentions_on_mr_id_and_note_id_index ON me CREATE UNIQUE INDEX merge_request_user_mentions_on_mr_id_index ON merge_request_user_mentions USING btree (merge_request_id) WHERE (note_id IS NULL); +CREATE INDEX merge_requests_state_id_temp_index ON merge_requests USING btree (id) WHERE (state_id = ANY (ARRAY[2, 3])); + CREATE INDEX note_mentions_temp_index ON notes USING btree (id, noteable_type) WHERE (note ~~ '%@%'::text); CREATE UNIQUE INDEX one_canonical_wiki_page_slug_per_metadata ON wiki_page_slugs USING btree (wiki_page_meta_id) WHERE (canonical = true); @@ -21946,6 +22349,8 @@ CREATE UNIQUE INDEX snippet_user_mentions_on_snippet_id_index ON snippet_user_me CREATE UNIQUE INDEX taggings_idx ON taggings USING btree (tag_id, taggable_id, taggable_type, context, tagger_id, tagger_type); +CREATE INDEX temporary_index_vulnerabilities_on_id ON vulnerabilities USING btree (id) WHERE ((state = 2) AND ((dismissed_at IS NULL) OR (dismissed_by_id IS NULL))); + CREATE UNIQUE INDEX term_agreements_unique_index ON term_agreements USING btree (user_id, term_id); CREATE INDEX terraform_state_versions_verification_checksum_partial ON terraform_state_versions USING btree (verification_checksum) WHERE (verification_checksum IS NOT NULL); @@ -21964,8 +22369,6 @@ CREATE INDEX tmp_index_for_email_unconfirmation_migration ON emails USING btree CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id); -CREATE UNIQUE INDEX users_security_dashboard_projects_unique_index ON users_security_dashboard_projects USING btree (project_id, user_id); - CREATE UNIQUE INDEX vulnerability_feedback_unique_idx ON vulnerability_feedback USING btree (project_id, category, feedback_type, project_fingerprint); CREATE UNIQUE INDEX vulnerability_occurrence_pipelines_on_unique_keys ON vulnerability_occurrence_pipelines USING btree (occurrence_id, pipeline_id); @@ -22240,6 +22643,12 @@ ALTER TABLE ONLY clusters_applications_runners ALTER TABLE ONLY design_management_designs_versions ADD CONSTRAINT fk_03c671965c FOREIGN KEY (design_id) REFERENCES design_management_designs(id) ON DELETE CASCADE; +ALTER TABLE ONLY terraform_state_versions + ADD CONSTRAINT fk_04b91e4a9f FOREIGN KEY (ci_build_id) REFERENCES ci_builds(id) ON DELETE SET NULL; + +ALTER TABLE ONLY ci_test_cases + ADD CONSTRAINT fk_0526c30ded FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY issues ADD CONSTRAINT fk_05f1e72feb FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL; @@ -22423,6 +22832,9 @@ ALTER TABLE ONLY deploy_keys_projects ALTER TABLE ONLY issue_assignees ADD CONSTRAINT fk_5e0c8d9154 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; +ALTER TABLE ONLY csv_issue_imports + ADD CONSTRAINT fk_5e1572387c FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + ALTER TABLE ONLY project_access_tokens ADD CONSTRAINT fk_5f7e8450e1 FOREIGN KEY (personal_access_token_id) REFERENCES personal_access_tokens(id) ON DELETE CASCADE; @@ -22750,6 +23162,9 @@ ALTER TABLE ONLY ci_sources_pipelines ALTER TABLE ONLY geo_event_log ADD CONSTRAINT fk_d5af95fcd9 FOREIGN KEY (lfs_object_deleted_event_id) REFERENCES geo_lfs_object_deleted_events(id) ON DELETE CASCADE; +ALTER TABLE ONLY ci_test_case_failures + ADD CONSTRAINT fk_d69404d827 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE; + ALTER TABLE ONLY lists ADD CONSTRAINT fk_d6cf4279f7 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -22774,6 +23189,9 @@ ALTER TABLE ONLY project_group_links ALTER TABLE ONLY epics ADD CONSTRAINT fk_dccd3f98fc FOREIGN KEY (assignee_id) REFERENCES users(id) ON DELETE SET NULL; +ALTER TABLE ONLY analytics_devops_adoption_segment_selections + ADD CONSTRAINT fk_ded7fe0344 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY issues ADD CONSTRAINT fk_df75a7c8b8 FOREIGN KEY (promoted_to_epic_id) REFERENCES epics(id) ON DELETE SET NULL; @@ -22795,6 +23213,9 @@ ALTER TABLE ONLY merge_requests ALTER TABLE ONLY issue_links ADD CONSTRAINT fk_e71bb44f1f FOREIGN KEY (target_id) REFERENCES issues(id) ON DELETE CASCADE; +ALTER TABLE ONLY csv_issue_imports + ADD CONSTRAINT fk_e71c0ae362 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY namespaces ADD CONSTRAINT fk_e7a0b20a6b FOREIGN KEY (custom_project_templates_group_id) REFERENCES namespaces(id) ON DELETE SET NULL; @@ -22834,6 +23255,9 @@ ALTER TABLE ONLY clusters ALTER TABLE ONLY epics ADD CONSTRAINT fk_f081aa4489 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY analytics_devops_adoption_segment_selections + ADD CONSTRAINT fk_f1472b95f3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY boards ADD CONSTRAINT fk_f15266b5f9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -22903,6 +23327,9 @@ ALTER TABLE ONLY ip_restrictions ALTER TABLE ONLY terraform_state_versions ADD CONSTRAINT fk_rails_04f176e239 FOREIGN KEY (terraform_state_id) REFERENCES terraform_states(id) ON DELETE CASCADE; +ALTER TABLE ONLY analytics_devops_adoption_segment_selections + ADD CONSTRAINT fk_rails_053f00a9da FOREIGN KEY (segment_id) REFERENCES analytics_devops_adoption_segments(id) ON DELETE CASCADE; + ALTER TABLE ONLY ci_build_report_results ADD CONSTRAINT fk_rails_056d298d48 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -23182,6 +23609,9 @@ ALTER TABLE ONLY snippet_user_mentions ALTER TABLE ONLY clusters_applications_helm ADD CONSTRAINT fk_rails_3e2b1c06bc FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_package_file_build_infos + ADD CONSTRAINT fk_rails_3e3f630188 FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE SET NULL; + ALTER TABLE ONLY epic_user_mentions ADD CONSTRAINT fk_rails_3eaf4d88cc FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE; @@ -23251,6 +23681,9 @@ ALTER TABLE ONLY ci_pipeline_artifacts ALTER TABLE ONLY group_deletion_schedules ADD CONSTRAINT fk_rails_4b8c694a6c FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY snippet_repository_storage_moves + ADD CONSTRAINT fk_rails_4b950f5b94 FOREIGN KEY (snippet_id) REFERENCES snippets(id) ON DELETE CASCADE; + ALTER TABLE ONLY design_management_designs ADD CONSTRAINT fk_rails_4bb1073360 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -23563,6 +23996,9 @@ ALTER TABLE ONLY merge_request_diff_details ALTER TABLE ONLY clusters_applications_crossplane ADD CONSTRAINT fk_rails_87186702df FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE; +ALTER TABLE ONLY packages_package_file_build_infos + ADD CONSTRAINT fk_rails_871ca3ae21 FOREIGN KEY (package_file_id) REFERENCES packages_package_files(id) ON DELETE CASCADE; + ALTER TABLE ONLY ci_runner_namespaces ADD CONSTRAINT fk_rails_8767676b7a FOREIGN KEY (runner_id) REFERENCES ci_runners(id) ON DELETE CASCADE; @@ -23632,6 +24068,9 @@ ALTER TABLE ONLY project_error_tracking_settings ALTER TABLE ONLY list_user_preferences ADD CONSTRAINT fk_rails_916d72cafd FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; +ALTER TABLE ONLY merge_request_cleanup_schedules + ADD CONSTRAINT fk_rails_92dd0e705c FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; + ALTER TABLE ONLY board_labels ADD CONSTRAINT fk_rails_9374a16edd FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE; @@ -23764,6 +24203,9 @@ ALTER TABLE ONLY analytics_cycle_analytics_group_stages ALTER TABLE ONLY metrics_dashboard_annotations ADD CONSTRAINT fk_rails_aeb11a7643 FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE; +ALTER TABLE ONLY bulk_import_trackers + ADD CONSTRAINT fk_rails_aed566d3f3 FOREIGN KEY (bulk_import_entity_id) REFERENCES bulk_import_entities(id) ON DELETE CASCADE; + ALTER TABLE ONLY pool_repositories ADD CONSTRAINT fk_rails_af3f8c5d62 FOREIGN KEY (shard_id) REFERENCES shards(id) ON DELETE RESTRICT; @@ -23914,6 +24356,9 @@ ALTER TABLE ONLY gpg_signatures ALTER TABLE ONLY board_group_recent_visits ADD CONSTRAINT fk_rails_ca04c38720 FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE; +ALTER TABLE ONLY vulnerability_finding_links + ADD CONSTRAINT fk_rails_cbdfde27ce FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE; + ALTER TABLE ONLY issues_self_managed_prometheus_alert_events ADD CONSTRAINT fk_rails_cc5d88bbb0 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE; @@ -24040,6 +24485,9 @@ ALTER TABLE ONLY merge_request_blocks ALTER TABLE ONLY protected_branch_unprotect_access_levels ADD CONSTRAINT fk_rails_e9eb8dc025 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE; +ALTER TABLE ONLY ci_test_case_failures + ADD CONSTRAINT fk_rails_eab6349715 FOREIGN KEY (test_case_id) REFERENCES ci_test_cases(id) ON DELETE CASCADE; + ALTER TABLE ONLY alert_management_alert_user_mentions ADD CONSTRAINT fk_rails_eb2de0cdef FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE; -- cgit v1.2.3