From 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 19 Sep 2022 23:18:09 +0000 Subject: Add latest changes from gitlab-org/gitlab@15-4-stable-ee --- db/docs/analytics_cycle_analytics_aggregations.yml | 2 +- ...alytics_cycle_analytics_group_value_streams.yml | 2 +- ...nalytics_cycle_analytics_issue_stage_events.yml | 2 +- ..._cycle_analytics_merge_request_stage_events.yml | 2 +- .../analytics_cycle_analytics_project_stages.yml | 2 +- ...nalytics_cycle_analytics_stage_event_hashes.yml | 2 +- db/docs/analytics_devops_adoption_segments.yml | 2 +- db/docs/analytics_devops_adoption_snapshots.yml | 2 +- ...alytics_language_trend_repository_languages.yml | 4 +- db/docs/analytics_usage_trends_measurements.yml | 2 +- db/docs/ci_partitions.yml | 9 + .../conversational_development_index_metrics.yml | 2 +- db/docs/dora_configurations.yml | 9 + db/docs/dora_daily_metrics.yml | 4 +- db/docs/events.yml | 4 +- db/docs/fork_networks.yml | 4 +- db/docs/ghost_user_migrations.yml | 9 + db/docs/insights.yml | 2 +- db/docs/issue_metrics.yml | 2 +- db/docs/merge_request_metrics.yml | 2 +- db/docs/merge_request_predictions.yml | 9 + db/docs/onboarding_progresses.yml | 2 +- db/docs/packages_rpm_metadata.yml | 9 + .../protected_environment_deploy_access_levels.yml | 2 +- db/docs/sbom_vulnerable_component_versions.yml | 11 + db/docs/spam_logs.yml | 6 +- db/docs/vulnerability_advisories.yml | 11 + .../044_add_security_training_providers.rb | 5 + db/fixtures/development/14_pipelines.rb | 6 +- db/fixtures/development/17_cycle_analytics.rb | 2 + db/fixtures/development/24_forks.rb | 2 + db/fixtures/development/33_triage_ops.rb | 66 +-- .../98_gitlab_instance_administration_project.rb | 5 +- .../004_add_security_training_providers.rb | 5 + ..._requests_forwarding_to_application_settings.rb | 13 + ..._diff_preview_in_email_to_namespace_settings.rb | 9 + ...ion_flow_enforcement_to_application_settings.rb | 10 + .../20220726171440_create_ghost_user_migrations.rb | 12 + ...6171450_add_user_fk_to_ghost_user_migrations.rb | 15 + ...4853_add_auto_ban_user_to_namespace_settings.rb | 10 + ...14_add_auto_ban_user_to_application_settings.rb | 8 + ...220815152905_create_vulnerability_advisories.rb | 25 ++ ...16_create_sbom_vulnerable_component_versions.rb | 18 + ...ow_diff_preview_in_email_to_project_settings.rb | 9 + ...225_add_max_pages_custom_domains_per_project.rb | 20 + ...20818132108_add_deleted_on_to_ml_experiments.rb | 7 + ...gn_key_to_sbom_vulnerable_component_versions.rb | 19 + ...gn_key_to_sbom_vulnerable_component_versions.rb | 19 + ...102651_add_namespace_id_to_broadcast_message.rb | 9 + ...d_index_and_foreign_key_to_broadcast_message.rb | 17 + ...spaces_sync_triggers_to_traversal_ids_update.rb | 35 ++ ..._existing_work_item_type_backfill_migrations.rb | 22 + ...631_add_cube_api_key_to_application_settings.rb | 11 + ...e_not_null_constraint_for_confidence_columns.rb | 15 + ...8094411_add_rpm_max_file_size_to_plan_limits.rb | 9 + .../20220828131848_create_packages_rpm_metadata.rb | 30 ++ ...356_replace_index_on_credit_card_validations.rb | 20 + ...30082928_add_text_limit_to_cube_api_base_url.rb | 13 + ...220830114228_create_dora_configuration_table.rb | 16 + db/migrate/20220831182105_add_constraints_view.rb | 32 ++ ...20220901035722_add_temp_project_member_index.rb | 16 + ...901124637_add_last_downloaded_at_to_packages.rb | 7 + ...onments_project_name_lower_pattern_ops_index.rb | 15 + ...1212027_add_merge_request_id_to_environments.rb | 7 + db/migrate/20220902065314_create_ci_partitions.rb | 9 + ...220902065316_create_default_partition_record.rb | 21 + ...20220902065317_add_partition_id_to_ci_builds.rb | 11 + ...65558_add_partition_id_to_ci_builds_metadata.rb | 9 + ...2065611_add_partition_id_to_ci_job_artifacts.rb | 9 + ...20902065623_add_partition_id_to_ci_pipelines.rb | 9 + ...20220902065635_add_partition_id_to_ci_stages.rb | 9 + ...47_add_partition_id_to_ci_pipeline_variables.rb | 9 + ...165931_index_evironments_on_merge_request_id.rb | 15 + ..._constraint_to_environments_merge_request_id.rb | 13 + ...d_column_branch_filter_strategy_to_web_hooks.rb | 7 + ...ime_and_end_time_and_status_to_ml_candidates.rb | 9 + ...06204832_add_locked_to_ci_pipeline_artifacts.rb | 20 + db/migrate/20220907124320_add_internal_to_notes.rb | 9 + ...al_reason_to_vulnerability_state_transitions.rb | 7 + ...p_over_limt_notified_at_to_namespace_details.rb | 20 + ...s_project_name_lower_pattern_ops_state_index.rb | 15 + ...20912180807_add_epoch_column_to_rpm_metadata.rb | 7 + ...ions_cadences_last_run_date_to_next_run_date.rb | 13 + ...5141_change_namespace_id_not_null_in_members.rb | 13 + ...s_namespace_foreign_key_on_delete_constraint.rb | 30 ++ ...20915140802_create_merge_request_predictions.rb | 20 + ...3042_remove_duplicate_project_authorizations.rb | 3 +- ...0011_schedule_remove_self_managed_wiki_notes.rb | 35 ++ ...add_tmp_index_job_artifacts_id_and_expire_at.rb | 29 ++ ...080509_fix_incorrect_job_artifacts_expire_at.rb | 31 ++ ..._backfill_cluster_agents_has_vulnerabilities.rb | 30 ++ ...lnerabilities_project_id_id_active_cis_index.rb | 24 ++ ...220706145113_backfill_namespace_id_on_issues.rb | 28 ++ ...move_tmp_idx_merge_requests_draft_and_status.rb | 18 + ...p_index_group_membership_namespace_id_column.rb | 17 + ...en_source_licence_for_recent_public_projects.rb | 33 ++ ...02011_schedule_destroy_invalid_group_members.rb | 30 ++ ...dd_note_metadata_temp_index_on_id_where_task.rb | 15 + ...e_task_system_note_wording_to_checklist_item.rb | 28 ++ ...ename_web_hooks_service_id_to_integration_id.rb | 13 + ...rop_uuid_and_id_index_from_security_findings.rb | 15 + ...44_update_start_date_for_iterations_cadences.rb | 53 +++ ...non_migrated_index_on_container_repositories.rb | 25 ++ ...22071909_remove_other_role_from_user_details.rb | 9 + ...90656_drop_build_coverage_regex_from_project.rb | 13 + ...0220822094804_add_issues_authorization_index.rb | 15 + ...e_removal_partial_trigram_indexes_for_issues.rb | 16 + ...8_add_tmp_index_approval_merge_request_rules.rb | 19 + ...tmp_index_todos_attention_request_action_idx.rb | 18 + ...825142324_replace_issues_authorization_index.rb | 18 + ...0220826165048_drop_temporary_job_trace_index.rb | 13 + ...75058_fully_remove_temporary_job_trace_index.rb | 15 + ...temporary_index_for_orphaned_invited_members.rb | 21 + ...20830061704_orphaned_invited_members_cleanup.rb | 29 ++ ...temporary_index_for_orphaned_invited_members.rb | 21 + ..._reschedule_issue_work_item_type_id_backfill.rb | 40 ++ ...20831021358_add_index_on_issue_health_status.rb | 16 + ...2802_delete_approval_rules_for_vulnerability.rb | 42 ++ ...725_schedule_destroy_invalid_project_members.rb | 28 ++ ..._callouts_on_attention_request_feature_names.rb | 18 + ...1355_cleanup_attention_request_user_callouts.rb | 18 + ...00_remove_partial_trigram_indexes_for_issues.rb | 25 ++ ...06_add_not_null_to_board_group_recent_visits.rb | 17 + ..._add_not_null_to_board_project_recent_visits.rb | 17 + ..._null_records_from_board_group_recent_visits.rb | 15 + ...ull_records_from_board_project_recent_visits.rb | 15 + ...gs_table_to_gitlab_partitions_dynamic_schema.rb | 232 +++++++++++ ...ot_null_constraint_board_group_recent_visits.rb | 15 + ..._null_constraint_board_project_recent_visits.rb | 15 + ...ge_request_reviewers_attention_request_state.rb | 18 + ...merge_requests_reviewers_state_to_unreviewed.rb | 30 ++ ..._async_index_to_todos_to_cover_pending_query.rb | 16 + ...source_license_for_projects_less_than_one_mb.rb | 33 ++ ...i_pipeline_artifacts_unlocked_with_expire_at.rb | 17 + ...5146_remove_free_user_cap_remediation_worker.rb | 11 + ...onments_project_name_lower_pattern_ops_index.rb | 16 + ...20912085047_add_index_to_todos_pending_query.rb | 16 + ...33_prepare_create_internal_notes_index_on_id.rb | 13 + ...m_note_metadata_on_attention_request_actions.rb | 17 + ...eanup_attention_request_related_system_notes.rb | 30 ++ ...p_index_cadence_create_iterations_automation.rb | 21 + ...ions_cadences_last_run_date_to_next_run_date.rb | 13 + ...e_id_partition_id_index_to_ci_build_metadata.rb | 14 + ...d_id_partition_id_index_to_ci_build_metadata.rb | 14 + ...0916112841_remove_unused_aggregation_columns.rb | 59 +++ db/schema_migrations/20220406193806 | 1 + db/schema_migrations/20220601110011 | 1 + db/schema_migrations/20220603125200 | 1 + db/schema_migrations/20220606054503 | 1 + db/schema_migrations/20220606080509 | 1 + db/schema_migrations/20220615154500 | 1 + db/schema_migrations/20220616171355 | 1 + db/schema_migrations/20220706145113 | 1 + db/schema_migrations/20220707192420 | 1 + db/schema_migrations/20220711142148 | 1 + db/schema_migrations/20220726171440 | 1 + db/schema_migrations/20220726171450 | 1 + db/schema_migrations/20220726225114 | 1 + db/schema_migrations/20220801155858 | 1 + db/schema_migrations/20220803004853 | 1 + db/schema_migrations/20220803235114 | 1 + db/schema_migrations/20220809002011 | 1 + db/schema_migrations/20220809214730 | 1 + db/schema_migrations/20220809223215 | 1 + db/schema_migrations/20220815061621 | 1 + db/schema_migrations/20220815152905 | 1 + db/schema_migrations/20220816075638 | 1 + db/schema_migrations/20220816135816 | 1 + db/schema_migrations/20220816163444 | 1 + db/schema_migrations/20220817122907 | 1 + db/schema_migrations/20220818095225 | 1 + db/schema_migrations/20220818132108 | 1 + db/schema_migrations/20220819153725 | 1 + db/schema_migrations/20220819162852 | 1 + db/schema_migrations/20220820221036 | 1 + db/schema_migrations/20220822071909 | 1 + db/schema_migrations/20220822090656 | 1 + db/schema_migrations/20220822094804 | 1 + db/schema_migrations/20220822102651 | 1 + db/schema_migrations/20220822103638 | 1 + db/schema_migrations/20220823084747 | 1 + db/schema_migrations/20220824114218 | 1 + db/schema_migrations/20220824175648 | 1 + db/schema_migrations/20220824194103 | 1 + db/schema_migrations/20220825061250 | 1 + db/schema_migrations/20220825105631 | 1 + db/schema_migrations/20220825134827 | 1 + db/schema_migrations/20220825142324 | 1 + db/schema_migrations/20220826165048 | 1 + db/schema_migrations/20220826175058 | 1 + db/schema_migrations/20220828094411 | 1 + db/schema_migrations/20220828131848 | 1 + db/schema_migrations/20220829183356 | 1 + db/schema_migrations/20220830051704 | 1 + db/schema_migrations/20220830061704 | 1 + db/schema_migrations/20220830071704 | 1 + db/schema_migrations/20220830082928 | 1 + db/schema_migrations/20220830114228 | 1 + db/schema_migrations/20220830172142 | 1 + db/schema_migrations/20220831021358 | 1 + db/schema_migrations/20220831132802 | 1 + db/schema_migrations/20220831182105 | 1 + db/schema_migrations/20220901035722 | 1 + db/schema_migrations/20220901035725 | 1 + db/schema_migrations/20220901071310 | 1 + db/schema_migrations/20220901071355 | 1 + db/schema_migrations/20220901073300 | 1 + db/schema_migrations/20220901124637 | 1 + db/schema_migrations/20220901131828 | 1 + db/schema_migrations/20220901184106 | 1 + db/schema_migrations/20220901184246 | 1 + db/schema_migrations/20220901212027 | 1 + db/schema_migrations/20220902065314 | 1 + db/schema_migrations/20220902065316 | 1 + db/schema_migrations/20220902065317 | 1 + db/schema_migrations/20220902065558 | 1 + db/schema_migrations/20220902065611 | 1 + db/schema_migrations/20220902065623 | 1 + db/schema_migrations/20220902065635 | 1 + db/schema_migrations/20220902065647 | 1 + db/schema_migrations/20220902111016 | 1 + db/schema_migrations/20220902111038 | 1 + db/schema_migrations/20220902165931 | 1 + db/schema_migrations/20220902170131 | 1 + db/schema_migrations/20220902204048 | 1 + db/schema_migrations/20220904173342 | 1 + db/schema_migrations/20220904173430 | 1 + db/schema_migrations/20220905090300 | 1 + db/schema_migrations/20220905090339 | 1 + db/schema_migrations/20220905112710 | 1 + db/schema_migrations/20220906074449 | 1 + db/schema_migrations/20220906093857 | 1 + db/schema_migrations/20220906155105 | 1 + db/schema_migrations/20220906204832 | 1 + db/schema_migrations/20220906212931 | 1 + db/schema_migrations/20220907124320 | 1 + db/schema_migrations/20220908125146 | 1 + db/schema_migrations/20220909091410 | 1 + db/schema_migrations/20220909094752 | 1 + db/schema_migrations/20220909113809 | 1 + db/schema_migrations/20220909114220 | 1 + db/schema_migrations/20220912085047 | 1 + db/schema_migrations/20220912110433 | 1 + db/schema_migrations/20220912180807 | 1 + db/schema_migrations/20220913030552 | 1 + db/schema_migrations/20220913030624 | 1 + db/schema_migrations/20220913082728 | 1 + db/schema_migrations/20220913082930 | 1 + db/schema_migrations/20220913083015 | 1 + db/schema_migrations/20220914005141 | 1 + db/schema_migrations/20220914010233 | 1 + db/schema_migrations/20220914093408 | 1 + db/schema_migrations/20220915103831 | 1 + db/schema_migrations/20220915140802 | 1 + db/schema_migrations/20220916112841 | 1 + db/structure.sql | 460 +++++++++++++++++---- 256 files changed, 2885 insertions(+), 132 deletions(-) create mode 100644 db/docs/ci_partitions.yml create mode 100644 db/docs/dora_configurations.yml create mode 100644 db/docs/ghost_user_migrations.yml create mode 100644 db/docs/merge_request_predictions.yml create mode 100644 db/docs/packages_rpm_metadata.yml create mode 100644 db/docs/sbom_vulnerable_component_versions.yml create mode 100644 db/docs/vulnerability_advisories.yml create mode 100644 db/fixtures/development/044_add_security_training_providers.rb create mode 100644 db/fixtures/production/004_add_security_training_providers.rb create mode 100644 db/migrate/20220406193806_add_maven_package_requests_forwarding_to_application_settings.rb create mode 100644 db/migrate/20220603125200_add_show_diff_preview_in_email_to_namespace_settings.rb create mode 100644 db/migrate/20220711142148_add_invitation_flow_enforcement_to_application_settings.rb create mode 100644 db/migrate/20220726171440_create_ghost_user_migrations.rb create mode 100644 db/migrate/20220726171450_add_user_fk_to_ghost_user_migrations.rb create mode 100644 db/migrate/20220803004853_add_auto_ban_user_to_namespace_settings.rb create mode 100644 db/migrate/20220803235114_add_auto_ban_user_to_application_settings.rb create mode 100644 db/migrate/20220815152905_create_vulnerability_advisories.rb create mode 100644 db/migrate/20220816135816_create_sbom_vulnerable_component_versions.rb create mode 100644 db/migrate/20220817122907_re_add_show_diff_preview_in_email_to_project_settings.rb create mode 100644 db/migrate/20220818095225_add_max_pages_custom_domains_per_project.rb create mode 100644 db/migrate/20220818132108_add_deleted_on_to_ml_experiments.rb create mode 100644 db/migrate/20220819153725_add_vulnerability_advisory_foreign_key_to_sbom_vulnerable_component_versions.rb create mode 100644 db/migrate/20220819162852_add_sbom_component_version_foreign_key_to_sbom_vulnerable_component_versions.rb create mode 100644 db/migrate/20220822102651_add_namespace_id_to_broadcast_message.rb create mode 100644 db/migrate/20220822103638_add_index_and_foreign_key_to_broadcast_message.rb create mode 100644 db/migrate/20220824175648_limit_namespaces_sync_triggers_to_traversal_ids_update.rb create mode 100644 db/migrate/20220824194103_remove_existing_work_item_type_backfill_migrations.rb create mode 100644 db/migrate/20220825105631_add_cube_api_key_to_application_settings.rb create mode 100644 db/migrate/20220825134827_remove_not_null_constraint_for_confidence_columns.rb create mode 100644 db/migrate/20220828094411_add_rpm_max_file_size_to_plan_limits.rb create mode 100644 db/migrate/20220828131848_create_packages_rpm_metadata.rb create mode 100644 db/migrate/20220829183356_replace_index_on_credit_card_validations.rb create mode 100644 db/migrate/20220830082928_add_text_limit_to_cube_api_base_url.rb create mode 100644 db/migrate/20220830114228_create_dora_configuration_table.rb create mode 100644 db/migrate/20220831182105_add_constraints_view.rb create mode 100644 db/migrate/20220901035722_add_temp_project_member_index.rb create mode 100644 db/migrate/20220901124637_add_last_downloaded_at_to_packages.rb create mode 100644 db/migrate/20220901131828_add_environments_project_name_lower_pattern_ops_index.rb create mode 100644 db/migrate/20220901212027_add_merge_request_id_to_environments.rb create mode 100644 db/migrate/20220902065314_create_ci_partitions.rb create mode 100644 db/migrate/20220902065316_create_default_partition_record.rb create mode 100644 db/migrate/20220902065317_add_partition_id_to_ci_builds.rb create mode 100644 db/migrate/20220902065558_add_partition_id_to_ci_builds_metadata.rb create mode 100644 db/migrate/20220902065611_add_partition_id_to_ci_job_artifacts.rb create mode 100644 db/migrate/20220902065623_add_partition_id_to_ci_pipelines.rb create mode 100644 db/migrate/20220902065635_add_partition_id_to_ci_stages.rb create mode 100644 db/migrate/20220902065647_add_partition_id_to_ci_pipeline_variables.rb create mode 100644 db/migrate/20220902165931_index_evironments_on_merge_request_id.rb create mode 100644 db/migrate/20220902170131_add_fk_constraint_to_environments_merge_request_id.rb create mode 100644 db/migrate/20220906093857_add_column_branch_filter_strategy_to_web_hooks.rb create mode 100644 db/migrate/20220906155105_add_start_time_and_end_time_and_status_to_ml_candidates.rb create mode 100644 db/migrate/20220906204832_add_locked_to_ci_pipeline_artifacts.rb create mode 100644 db/migrate/20220907124320_add_internal_to_notes.rb create mode 100644 db/migrate/20220909091410_add_dismissal_reason_to_vulnerability_state_transitions.rb create mode 100644 db/migrate/20220909094752_add_free_user_cap_over_limt_notified_at_to_namespace_details.rb create mode 100644 db/migrate/20220909113809_add_environments_project_name_lower_pattern_ops_state_index.rb create mode 100644 db/migrate/20220912180807_add_epoch_column_to_rpm_metadata.rb create mode 100644 db/migrate/20220913082930_rename_iterations_cadences_last_run_date_to_next_run_date.rb create mode 100644 db/migrate/20220914005141_change_namespace_id_not_null_in_members.rb create mode 100644 db/migrate/20220914010233_change_members_namespace_foreign_key_on_delete_constraint.rb create mode 100644 db/migrate/20220915140802_create_merge_request_predictions.rb create mode 100644 db/post_migrate/20220601110011_schedule_remove_self_managed_wiki_notes.rb create mode 100644 db/post_migrate/20220606054503_add_tmp_index_job_artifacts_id_and_expire_at.rb create mode 100644 db/post_migrate/20220606080509_fix_incorrect_job_artifacts_expire_at.rb create mode 100644 db/post_migrate/20220615154500_schedule_backfill_cluster_agents_has_vulnerabilities.rb create mode 100644 db/post_migrate/20220616171355_update_vulnerabilities_project_id_id_active_cis_index.rb create mode 100644 db/post_migrate/20220706145113_backfill_namespace_id_on_issues.rb create mode 100644 db/post_migrate/20220707192420_remove_tmp_idx_merge_requests_draft_and_status.rb create mode 100644 db/post_migrate/20220726225114_remove_tmp_index_group_membership_namespace_id_column.rb create mode 100644 db/post_migrate/20220801155858_schedule_disable_legacy_open_source_licence_for_recent_public_projects.rb create mode 100644 db/post_migrate/20220809002011_schedule_destroy_invalid_group_members.rb create mode 100644 db/post_migrate/20220809214730_add_note_metadata_temp_index_on_id_where_task.rb create mode 100644 db/post_migrate/20220809223215_change_task_system_note_wording_to_checklist_item.rb create mode 100644 db/post_migrate/20220815061621_rename_web_hooks_service_id_to_integration_id.rb create mode 100644 db/post_migrate/20220816075638_drop_uuid_and_id_index_from_security_findings.rb create mode 100644 db/post_migrate/20220816163444_update_start_date_for_iterations_cadences.rb create mode 100644 db/post_migrate/20220820221036_update_tmp_non_migrated_index_on_container_repositories.rb create mode 100644 db/post_migrate/20220822071909_remove_other_role_from_user_details.rb create mode 100644 db/post_migrate/20220822090656_drop_build_coverage_regex_from_project.rb create mode 100644 db/post_migrate/20220822094804_add_issues_authorization_index.rb create mode 100644 db/post_migrate/20220823084747_prepare_removal_partial_trigram_indexes_for_issues.rb create mode 100644 db/post_migrate/20220824114218_add_tmp_index_approval_merge_request_rules.rb create mode 100644 db/post_migrate/20220825061250_drop_tmp_index_todos_attention_request_action_idx.rb create mode 100644 db/post_migrate/20220825142324_replace_issues_authorization_index.rb create mode 100644 db/post_migrate/20220826165048_drop_temporary_job_trace_index.rb create mode 100644 db/post_migrate/20220826175058_fully_remove_temporary_job_trace_index.rb create mode 100644 db/post_migrate/20220830051704_add_temporary_index_for_orphaned_invited_members.rb create mode 100644 db/post_migrate/20220830061704_orphaned_invited_members_cleanup.rb create mode 100644 db/post_migrate/20220830071704_remove_temporary_index_for_orphaned_invited_members.rb create mode 100644 db/post_migrate/20220830172142_reschedule_issue_work_item_type_id_backfill.rb create mode 100644 db/post_migrate/20220831021358_add_index_on_issue_health_status.rb create mode 100644 db/post_migrate/20220831132802_delete_approval_rules_for_vulnerability.rb create mode 100644 db/post_migrate/20220901035725_schedule_destroy_invalid_project_members.rb create mode 100644 db/post_migrate/20220901071310_add_tmp_index_user_callouts_on_attention_request_feature_names.rb create mode 100644 db/post_migrate/20220901071355_cleanup_attention_request_user_callouts.rb create mode 100644 db/post_migrate/20220901073300_remove_partial_trigram_indexes_for_issues.rb create mode 100644 db/post_migrate/20220901184106_add_not_null_to_board_group_recent_visits.rb create mode 100644 db/post_migrate/20220901184246_add_not_null_to_board_project_recent_visits.rb create mode 100644 db/post_migrate/20220902111016_delete_null_records_from_board_group_recent_visits.rb create mode 100644 db/post_migrate/20220902111038_delete_null_records_from_board_project_recent_visits.rb create mode 100644 db/post_migrate/20220902204048_move_security_findings_table_to_gitlab_partitions_dynamic_schema.rb create mode 100644 db/post_migrate/20220904173342_validate_not_null_constraint_board_group_recent_visits.rb create mode 100644 db/post_migrate/20220904173430_validate_not_null_constraint_board_project_recent_visits.rb create mode 100644 db/post_migrate/20220905090300_add_tmp_index_merge_request_reviewers_attention_request_state.rb create mode 100644 db/post_migrate/20220905090339_reset_attention_requested_merge_requests_reviewers_state_to_unreviewed.rb create mode 100644 db/post_migrate/20220905112710_add_async_index_to_todos_to_cover_pending_query.rb create mode 100644 db/post_migrate/20220906074449_schedule_disable_legacy_open_source_license_for_projects_less_than_one_mb.rb create mode 100644 db/post_migrate/20220906212931_add_partial_index_for_ci_pipeline_artifacts_unlocked_with_expire_at.rb create mode 100644 db/post_migrate/20220908125146_remove_free_user_cap_remediation_worker.rb create mode 100644 db/post_migrate/20220909114220_drop_environments_project_name_lower_pattern_ops_index.rb create mode 100644 db/post_migrate/20220912085047_add_index_to_todos_pending_query.rb create mode 100644 db/post_migrate/20220912110433_prepare_create_internal_notes_index_on_id.rb create mode 100644 db/post_migrate/20220913030552_add_tmp_index_system_note_metadata_on_attention_request_actions.rb create mode 100644 db/post_migrate/20220913030624_cleanup_attention_request_related_system_notes.rb create mode 100644 db/post_migrate/20220913082728_drop_index_cadence_create_iterations_automation.rb create mode 100644 db/post_migrate/20220913083015_clean_up_rename_iterations_cadences_last_run_date_to_next_run_date.rb create mode 100644 db/post_migrate/20220914093408_add_unique_id_partition_id_index_to_ci_build_metadata.rb create mode 100644 db/post_migrate/20220915103831_add_unique_build_id_partition_id_index_to_ci_build_metadata.rb create mode 100644 db/post_migrate/20220916112841_remove_unused_aggregation_columns.rb create mode 100644 db/schema_migrations/20220406193806 create mode 100644 db/schema_migrations/20220601110011 create mode 100644 db/schema_migrations/20220603125200 create mode 100644 db/schema_migrations/20220606054503 create mode 100644 db/schema_migrations/20220606080509 create mode 100644 db/schema_migrations/20220615154500 create mode 100644 db/schema_migrations/20220616171355 create mode 100644 db/schema_migrations/20220706145113 create mode 100644 db/schema_migrations/20220707192420 create mode 100644 db/schema_migrations/20220711142148 create mode 100644 db/schema_migrations/20220726171440 create mode 100644 db/schema_migrations/20220726171450 create mode 100644 db/schema_migrations/20220726225114 create mode 100644 db/schema_migrations/20220801155858 create mode 100644 db/schema_migrations/20220803004853 create mode 100644 db/schema_migrations/20220803235114 create mode 100644 db/schema_migrations/20220809002011 create mode 100644 db/schema_migrations/20220809214730 create mode 100644 db/schema_migrations/20220809223215 create mode 100644 db/schema_migrations/20220815061621 create mode 100644 db/schema_migrations/20220815152905 create mode 100644 db/schema_migrations/20220816075638 create mode 100644 db/schema_migrations/20220816135816 create mode 100644 db/schema_migrations/20220816163444 create mode 100644 db/schema_migrations/20220817122907 create mode 100644 db/schema_migrations/20220818095225 create mode 100644 db/schema_migrations/20220818132108 create mode 100644 db/schema_migrations/20220819153725 create mode 100644 db/schema_migrations/20220819162852 create mode 100644 db/schema_migrations/20220820221036 create mode 100644 db/schema_migrations/20220822071909 create mode 100644 db/schema_migrations/20220822090656 create mode 100644 db/schema_migrations/20220822094804 create mode 100644 db/schema_migrations/20220822102651 create mode 100644 db/schema_migrations/20220822103638 create mode 100644 db/schema_migrations/20220823084747 create mode 100644 db/schema_migrations/20220824114218 create mode 100644 db/schema_migrations/20220824175648 create mode 100644 db/schema_migrations/20220824194103 create mode 100644 db/schema_migrations/20220825061250 create mode 100644 db/schema_migrations/20220825105631 create mode 100644 db/schema_migrations/20220825134827 create mode 100644 db/schema_migrations/20220825142324 create mode 100644 db/schema_migrations/20220826165048 create mode 100644 db/schema_migrations/20220826175058 create mode 100644 db/schema_migrations/20220828094411 create mode 100644 db/schema_migrations/20220828131848 create mode 100644 db/schema_migrations/20220829183356 create mode 100644 db/schema_migrations/20220830051704 create mode 100644 db/schema_migrations/20220830061704 create mode 100644 db/schema_migrations/20220830071704 create mode 100644 db/schema_migrations/20220830082928 create mode 100644 db/schema_migrations/20220830114228 create mode 100644 db/schema_migrations/20220830172142 create mode 100644 db/schema_migrations/20220831021358 create mode 100644 db/schema_migrations/20220831132802 create mode 100644 db/schema_migrations/20220831182105 create mode 100644 db/schema_migrations/20220901035722 create mode 100644 db/schema_migrations/20220901035725 create mode 100644 db/schema_migrations/20220901071310 create mode 100644 db/schema_migrations/20220901071355 create mode 100644 db/schema_migrations/20220901073300 create mode 100644 db/schema_migrations/20220901124637 create mode 100644 db/schema_migrations/20220901131828 create mode 100644 db/schema_migrations/20220901184106 create mode 100644 db/schema_migrations/20220901184246 create mode 100644 db/schema_migrations/20220901212027 create mode 100644 db/schema_migrations/20220902065314 create mode 100644 db/schema_migrations/20220902065316 create mode 100644 db/schema_migrations/20220902065317 create mode 100644 db/schema_migrations/20220902065558 create mode 100644 db/schema_migrations/20220902065611 create mode 100644 db/schema_migrations/20220902065623 create mode 100644 db/schema_migrations/20220902065635 create mode 100644 db/schema_migrations/20220902065647 create mode 100644 db/schema_migrations/20220902111016 create mode 100644 db/schema_migrations/20220902111038 create mode 100644 db/schema_migrations/20220902165931 create mode 100644 db/schema_migrations/20220902170131 create mode 100644 db/schema_migrations/20220902204048 create mode 100644 db/schema_migrations/20220904173342 create mode 100644 db/schema_migrations/20220904173430 create mode 100644 db/schema_migrations/20220905090300 create mode 100644 db/schema_migrations/20220905090339 create mode 100644 db/schema_migrations/20220905112710 create mode 100644 db/schema_migrations/20220906074449 create mode 100644 db/schema_migrations/20220906093857 create mode 100644 db/schema_migrations/20220906155105 create mode 100644 db/schema_migrations/20220906204832 create mode 100644 db/schema_migrations/20220906212931 create mode 100644 db/schema_migrations/20220907124320 create mode 100644 db/schema_migrations/20220908125146 create mode 100644 db/schema_migrations/20220909091410 create mode 100644 db/schema_migrations/20220909094752 create mode 100644 db/schema_migrations/20220909113809 create mode 100644 db/schema_migrations/20220909114220 create mode 100644 db/schema_migrations/20220912085047 create mode 100644 db/schema_migrations/20220912110433 create mode 100644 db/schema_migrations/20220912180807 create mode 100644 db/schema_migrations/20220913030552 create mode 100644 db/schema_migrations/20220913030624 create mode 100644 db/schema_migrations/20220913082728 create mode 100644 db/schema_migrations/20220913082930 create mode 100644 db/schema_migrations/20220913083015 create mode 100644 db/schema_migrations/20220914005141 create mode 100644 db/schema_migrations/20220914010233 create mode 100644 db/schema_migrations/20220914093408 create mode 100644 db/schema_migrations/20220915103831 create mode 100644 db/schema_migrations/20220915140802 create mode 100644 db/schema_migrations/20220916112841 (limited to 'db') diff --git a/db/docs/analytics_cycle_analytics_aggregations.yml b/db/docs/analytics_cycle_analytics_aggregations.yml index b79cb949d1f..ab92c5c078b 100644 --- a/db/docs/analytics_cycle_analytics_aggregations.yml +++ b/db/docs/analytics_cycle_analytics_aggregations.yml @@ -4,6 +4,6 @@ classes: - Analytics::CycleAnalytics::Aggregation feature_categories: - value_stream_management -description: TODO +description: Stores Value Stream Analytics aggregation related metadata for top-level groups. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79942 milestone: '14.9' diff --git a/db/docs/analytics_cycle_analytics_group_value_streams.yml b/db/docs/analytics_cycle_analytics_group_value_streams.yml index d41ed8168d0..8942439dddd 100644 --- a/db/docs/analytics_cycle_analytics_group_value_streams.yml +++ b/db/docs/analytics_cycle_analytics_group_value_streams.yml @@ -4,6 +4,6 @@ classes: - Analytics::CycleAnalytics::GroupValueStream feature_categories: - value_stream_management -description: TODO +description: Store group level Value Stream objects. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/36658 milestone: '13.2' diff --git a/db/docs/analytics_cycle_analytics_issue_stage_events.yml b/db/docs/analytics_cycle_analytics_issue_stage_events.yml index cc993799033..b3f6a9f4716 100644 --- a/db/docs/analytics_cycle_analytics_issue_stage_events.yml +++ b/db/docs/analytics_cycle_analytics_issue_stage_events.yml @@ -4,6 +4,6 @@ classes: - Analytics::CycleAnalytics::IssueStageEvent feature_categories: - value_stream_management -description: TODO +description: Contains various Issue-related timestamps for aggregating Value Stream Analytics data. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68950 milestone: '14.3' diff --git a/db/docs/analytics_cycle_analytics_merge_request_stage_events.yml b/db/docs/analytics_cycle_analytics_merge_request_stage_events.yml index 796db2a54af..ae3074d544b 100644 --- a/db/docs/analytics_cycle_analytics_merge_request_stage_events.yml +++ b/db/docs/analytics_cycle_analytics_merge_request_stage_events.yml @@ -4,6 +4,6 @@ classes: - Analytics::CycleAnalytics::MergeRequestStageEvent feature_categories: - value_stream_management -description: TODO +description: Contains various MergeRequest-related timestamps for aggregating Value Stream Analytics data. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68950 milestone: '14.3' diff --git a/db/docs/analytics_cycle_analytics_project_stages.yml b/db/docs/analytics_cycle_analytics_project_stages.yml index 051f1c585ba..1ff917faf94 100644 --- a/db/docs/analytics_cycle_analytics_project_stages.yml +++ b/db/docs/analytics_cycle_analytics_project_stages.yml @@ -4,6 +4,6 @@ classes: - Analytics::CycleAnalytics::ProjectStage feature_categories: - value_stream_management -description: TODO +description: Persists project level value stream analytics stages. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/15061 milestone: '12.2' diff --git a/db/docs/analytics_cycle_analytics_stage_event_hashes.yml b/db/docs/analytics_cycle_analytics_stage_event_hashes.yml index cec953a261d..3df5ee1c172 100644 --- a/db/docs/analytics_cycle_analytics_stage_event_hashes.yml +++ b/db/docs/analytics_cycle_analytics_stage_event_hashes.yml @@ -4,6 +4,6 @@ classes: - Analytics::CycleAnalytics::StageEventHash feature_categories: - value_stream_management -description: TODO +description: Stores hashes of Value Stream Analytics stage configurations. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67259 milestone: '14.2' diff --git a/db/docs/analytics_devops_adoption_segments.yml b/db/docs/analytics_devops_adoption_segments.yml index 18abfcaff09..4b22c5926c2 100644 --- a/db/docs/analytics_devops_adoption_segments.yml +++ b/db/docs/analytics_devops_adoption_segments.yml @@ -4,6 +4,6 @@ classes: - Analytics::DevopsAdoption::EnabledNamespace feature_categories: - devops_reports -description: TODO +description: Stores a reference to the Namespace which is enabled for the DevOps report. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45748 milestone: '13.6' diff --git a/db/docs/analytics_devops_adoption_snapshots.yml b/db/docs/analytics_devops_adoption_snapshots.yml index 8bb87fd08fc..3fcaea684d6 100644 --- a/db/docs/analytics_devops_adoption_snapshots.yml +++ b/db/docs/analytics_devops_adoption_snapshots.yml @@ -4,6 +4,6 @@ classes: - Analytics::DevopsAdoption::Snapshot feature_categories: - devops_reports -description: TODO +description: Contains periodical DevOps Adoption data points. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47388 milestone: '13.7' diff --git a/db/docs/analytics_language_trend_repository_languages.yml b/db/docs/analytics_language_trend_repository_languages.yml index b27543dffaf..c42328b6bc8 100644 --- a/db/docs/analytics_language_trend_repository_languages.yml +++ b/db/docs/analytics_language_trend_repository_languages.yml @@ -3,7 +3,7 @@ table_name: analytics_language_trend_repository_languages classes: - Analytics::LanguageTrend::RepositoryLanguage feature_categories: -- devops_reports -description: TODO +- source_code_management +description: Contains snapshot data about the used programming languages over time. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/16491 milestone: '12.3' diff --git a/db/docs/analytics_usage_trends_measurements.yml b/db/docs/analytics_usage_trends_measurements.yml index 88e66fd7c98..1672c195e3d 100644 --- a/db/docs/analytics_usage_trends_measurements.yml +++ b/db/docs/analytics_usage_trends_measurements.yml @@ -4,6 +4,6 @@ classes: - Analytics::UsageTrends::Measurement feature_categories: - devops_reports -description: TODO +description: Contains periodically snapshotted database record counts. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62797 milestone: '14.0' diff --git a/db/docs/ci_partitions.yml b/db/docs/ci_partitions.yml new file mode 100644 index 00000000000..8dfa31f05f9 --- /dev/null +++ b/db/docs/ci_partitions.yml @@ -0,0 +1,9 @@ +--- +table_name: ci_partitions +classes: +- Ci::Partition +feature_categories: +- continuous_integration +description: Database partitioning metadata for CI tables +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96856 +milestone: '15.4' diff --git a/db/docs/conversational_development_index_metrics.yml b/db/docs/conversational_development_index_metrics.yml index fb96c376953..9371f9f1bfb 100644 --- a/db/docs/conversational_development_index_metrics.yml +++ b/db/docs/conversational_development_index_metrics.yml @@ -4,6 +4,6 @@ classes: - DevOpsReport::Metric feature_categories: - devops_reports -description: TODO +description: Contains data for calculating DevOps score. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/26dde5f55f1dac2e6bea4f7e1dfa51c72dc756cb milestone: '9.3' diff --git a/db/docs/dora_configurations.yml b/db/docs/dora_configurations.yml new file mode 100644 index 00000000000..e13cf088670 --- /dev/null +++ b/db/docs/dora_configurations.yml @@ -0,0 +1,9 @@ +--- +table_name: dora_configurations +classes: +- Dora::Configuration +feature_categories: +- continuous_delivery +description: Stores project specific configurations for DORA4 calculations. +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96561 +milestone: '15.4' diff --git a/db/docs/dora_daily_metrics.yml b/db/docs/dora_daily_metrics.yml index 210af9f6472..09f2ad02bfe 100644 --- a/db/docs/dora_daily_metrics.yml +++ b/db/docs/dora_daily_metrics.yml @@ -3,7 +3,7 @@ table_name: dora_daily_metrics classes: - Dora::DailyMetrics feature_categories: -- value_stream_management -description: TODO +- continuous_delivery +description: Stores daily snapshots of DORA4 metrics per environment. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55473 milestone: '13.10' diff --git a/db/docs/events.yml b/db/docs/events.yml index 9ad923a25c7..d766bc7cae3 100644 --- a/db/docs/events.yml +++ b/db/docs/events.yml @@ -4,7 +4,7 @@ classes: - Event - PushEvent feature_categories: -- value_stream_management -description: TODO +- users +description: Stores user generated events. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/a847501fd2ffc1c4becc7d0d352d80168d9b3568 milestone: "<6.0" diff --git a/db/docs/fork_networks.yml b/db/docs/fork_networks.yml index f0978b3fcc4..51123405baf 100644 --- a/db/docs/fork_networks.yml +++ b/db/docs/fork_networks.yml @@ -3,7 +3,7 @@ table_name: fork_networks classes: - ForkNetwork feature_categories: -- devops_reports -description: TODO +- source_code_management +description: When a project is first forked, a row is created in this table. Also referenced by the fork_network_members table. This is used to know which projects can send merge reqeusts to each other. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/3098 milestone: '10.1' diff --git a/db/docs/ghost_user_migrations.yml b/db/docs/ghost_user_migrations.yml new file mode 100644 index 00000000000..f4e69e71baa --- /dev/null +++ b/db/docs/ghost_user_migrations.yml @@ -0,0 +1,9 @@ +--- +table_name: ghost_user_migrations +classes: +- GhostUserMigration +feature_categories: +- users +description: Users records awaiting for their associated records to be migrated to ghost user +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/95473 +milestone: '15.4' diff --git a/db/docs/insights.yml b/db/docs/insights.yml index 988893208a7..2439f289340 100644 --- a/db/docs/insights.yml +++ b/db/docs/insights.yml @@ -4,6 +4,6 @@ classes: - Insight feature_categories: - value_stream_management -description: TODO +description: The table is used to specify a project which contains the group level insights configuration. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/9665 milestone: '11.9' diff --git a/db/docs/issue_metrics.yml b/db/docs/issue_metrics.yml index a451e649128..3d2055a155c 100644 --- a/db/docs/issue_metrics.yml +++ b/db/docs/issue_metrics.yml @@ -4,6 +4,6 @@ classes: - Issue::Metrics feature_categories: - value_stream_management -description: TODO +description: Store various metrics for issues. introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/516c838a1846d049814765afa85c28a3c14a5b9f milestone: '8.12' diff --git a/db/docs/merge_request_metrics.yml b/db/docs/merge_request_metrics.yml index 5faf14d0875..0b166eee455 100644 --- a/db/docs/merge_request_metrics.yml +++ b/db/docs/merge_request_metrics.yml @@ -5,6 +5,6 @@ classes: feature_categories: - value_stream_management - code_review -description: Store various metrics for merge requests +description: Store various metrics for merge requests. introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/5986 milestone: '8.12' diff --git a/db/docs/merge_request_predictions.yml b/db/docs/merge_request_predictions.yml new file mode 100644 index 00000000000..7495f0934a4 --- /dev/null +++ b/db/docs/merge_request_predictions.yml @@ -0,0 +1,9 @@ +--- +table_name: merge_request_predictions +classes: +- MergeRequest::Prediction +feature_categories: +- workflow_automation +description: Includes machine learning model predictions +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/97622 +milestone: '15.4' diff --git a/db/docs/onboarding_progresses.yml b/db/docs/onboarding_progresses.yml index 4166b934570..80b70fe0b1f 100644 --- a/db/docs/onboarding_progresses.yml +++ b/db/docs/onboarding_progresses.yml @@ -1,7 +1,7 @@ --- table_name: onboarding_progresses classes: -- OnboardingProgress +- Onboarding::Progress feature_categories: - onboarding description: TODO diff --git a/db/docs/packages_rpm_metadata.yml b/db/docs/packages_rpm_metadata.yml new file mode 100644 index 00000000000..cd34529ff0c --- /dev/null +++ b/db/docs/packages_rpm_metadata.yml @@ -0,0 +1,9 @@ +--- +table_name: packages_rpm_metadata +classes: +- Packages::Rpm::Metadatum +feature_categories: +- package_registry +description: Rpm package metadata +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96019 +milestone: '15.4' diff --git a/db/docs/protected_environment_deploy_access_levels.yml b/db/docs/protected_environment_deploy_access_levels.yml index cd3bba9171f..c25044dc7e2 100644 --- a/db/docs/protected_environment_deploy_access_levels.yml +++ b/db/docs/protected_environment_deploy_access_levels.yml @@ -1,7 +1,7 @@ --- table_name: protected_environment_deploy_access_levels classes: -- ProtectedEnvironment::DeployAccessLevel +- ProtectedEnvironments::DeployAccessLevel feature_categories: - continuous_delivery description: https://docs.gitlab.com/ee/ci/environments/protected_environments.html diff --git a/db/docs/sbom_vulnerable_component_versions.yml b/db/docs/sbom_vulnerable_component_versions.yml new file mode 100644 index 00000000000..147af9c046b --- /dev/null +++ b/db/docs/sbom_vulnerable_component_versions.yml @@ -0,0 +1,11 @@ +--- +table_name: sbom_vulnerable_component_versions +classes: +- Sbom::VulnerableComponentVersion +feature_categories: +- container_scanning +- dependency_scanning +- license_compliance +description: Stores information about vulnerable SBoM components +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/95622 +milestone: '15.4' diff --git a/db/docs/spam_logs.yml b/db/docs/spam_logs.yml index 35fa08ef46d..6e16b3600c8 100644 --- a/db/docs/spam_logs.yml +++ b/db/docs/spam_logs.yml @@ -3,7 +3,7 @@ table_name: spam_logs classes: - SpamLog feature_categories: -- authentication_and_authorization -description: TODO -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/d20e75a8d80c2828336cd22897ea6868d666f8a5 +- instance_resiliency +description: Logs users flagged by the Akismet anti-spam integration. +introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/2266 milestone: '8.5' diff --git a/db/docs/vulnerability_advisories.yml b/db/docs/vulnerability_advisories.yml new file mode 100644 index 00000000000..2c88be94a11 --- /dev/null +++ b/db/docs/vulnerability_advisories.yml @@ -0,0 +1,11 @@ +--- +table_name: vulnerability_advisories +classes: +- Vulnerabilities::Advisory +feature_categories: +- container_scanning +- dependency_scanning +- license_compliance +description: Stores vulnerability advisories +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/95622 +milestone: '15.4' diff --git a/db/fixtures/development/044_add_security_training_providers.rb b/db/fixtures/development/044_add_security_training_providers.rb new file mode 100644 index 00000000000..6fbd9f66127 --- /dev/null +++ b/db/fixtures/development/044_add_security_training_providers.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +Gitlab::Seeder.quiet do + ::Gitlab::DatabaseImporters::Security::TrainingProviders::Importer.upsert_providers +end diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb index e8fa3ee2110..8f63ce3dbfe 100644 --- a/db/fixtures/development/14_pipelines.rb +++ b/db/fixtures/development/14_pipelines.rb @@ -60,7 +60,7 @@ class Gitlab::Seeder::Pipelines ::Ci::ProcessPipelineService.new(pipeline).execute end - ::Gitlab::Seeder::Ci::DailyBuildGroupReportResult.new(@project).seed if @project.last_pipeline + ::Gitlab::Seeders::Ci::DailyBuildGroupReportResult.new(@project).seed if @project.last_pipeline end private @@ -129,7 +129,7 @@ class Gitlab::Seeder::Pipelines end def setup_artifacts(build) - return unless build.stage == "build" + return unless build.stage_name == "build" artifacts_cache_file(artifacts_archive_path) do |file| build.job_artifacts.build(project: build.project, file_type: :archive, file_format: :zip, file: file) @@ -141,7 +141,7 @@ class Gitlab::Seeder::Pipelines end def setup_test_reports(build) - return unless build.stage == "test" && build.name == "rspec:osx" + return unless build.stage_name == "test" && build.name == "rspec:osx" if build.ref == build.project.default_branch artifacts_cache_file(test_reports_pass_path) do |file| diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb index fa19775a571..8e9952e9ba1 100644 --- a/db/fixtures/development/17_cycle_analytics.rb +++ b/db/fixtures/development/17_cycle_analytics.rb @@ -154,6 +154,8 @@ class Gitlab::Seeder::CycleAnalytics @developers << user end + + AuthorizedProjectUpdate::ProjectRecalculateService.new(project).execute end def create_new_vsm_project diff --git a/db/fixtures/development/24_forks.rb b/db/fixtures/development/24_forks.rb index 536d9f9e2ba..a3db84ab1b7 100644 --- a/db/fixtures/development/24_forks.rb +++ b/db/fixtures/development/24_forks.rb @@ -24,6 +24,8 @@ Sidekiq::Testing.inline! do # the `after_commit` queue to ensure the job is run now. fork_project.send(:_run_after_commit_queue) fork_project.import_state.send(:_run_after_commit_queue) + # We should also force-run the project authorizations refresh job for the created project. + AuthorizedProjectUpdate::ProjectRecalculateService.new(fork_project).execute # Expire repository cache after import to ensure # valid_repo? call below returns a correct answer diff --git a/db/fixtures/development/33_triage_ops.rb b/db/fixtures/development/33_triage_ops.rb index b2dd3861169..14832ee4af9 100644 --- a/db/fixtures/development/33_triage_ops.rb +++ b/db/fixtures/development/33_triage_ops.rb @@ -7,6 +7,42 @@ class Gitlab::Seeder::TriageOps WEBHOOK_URL = 'http://0.0.0.0:$PORT$' WEBHOOK_TOKEN = "triage-ops-webhook-token" + WORK_TYPE_LABELS = %w( + bug::availability + bug::mobile + bug::performance + bug::vulnerability + feature::addition + feature::consolidation + feature::enhancement + feature::removal + maintenance::dependency + maintenance::pipelines + maintenance::refactor + maintenance::test-gap + maintenance::usability + maintenance::workflow + type::bug + type::feature + type::maintenance + ) + + WORKFLOW_LABELS = %w( + workflow::blocked + workflow::design + workflow::in dev + workflow::in review + workflow::planning breakdown + workflow::production + workflow::ready + workflow::ready for design + workflow::ready for development + workflow::ready for review + workflow::refinement + workflow::validation backlog + workflow::verification + ) + def seed! puts "Updating settings to allow web hooks to localhost" ApplicationSetting.current_without_cache.update!(allow_local_requests_from_web_hooks_and_services: true) @@ -33,8 +69,12 @@ class Gitlab::Seeder::TriageOps ensure_webhook_for('gitlab-org') puts "Ensuring work type labels" - ensure_work_type_labels_for('gitlab-com') - ensure_work_type_labels_for('gitlab-org') + ensure_labels_for(WORK_TYPE_LABELS, 'gitlab-com') + ensure_labels_for(WORK_TYPE_LABELS, 'gitlab-org') + + puts "Ensuring workflow type labels" + ensure_labels_for(WORKFLOW_LABELS, 'gitlab-com') + ensure_labels_for(WORKFLOW_LABELS, 'gitlab-org') end end end @@ -89,27 +129,7 @@ class Gitlab::Seeder::TriageOps puts "Hook with url '#{hook.url}' and token '#{hook.token}' for '#{group_path}' is present now." end - def ensure_work_type_labels_for(group_path) - label_titles = [ - 'bug::availability', - 'bug::mobile', - 'bug::performance', - 'bug::vulnerability', - 'feature::addition', - 'feature::consolidation', - 'feature::enhancement', - 'feature::removal', - 'maintenance::dependency', - 'maintenance::pipelines', - 'maintenance::refactor', - 'maintenance::test-gap', - 'maintenance::usability', - 'maintenance::workflow', - 'type::bug', - 'type::feature', - 'type::maintenance', - ] - + def ensure_labels_for(label_titles, group_path) group = Group.find_by_full_path(group_path) label_titles.each do |label_title| diff --git a/db/fixtures/development/98_gitlab_instance_administration_project.rb b/db/fixtures/development/98_gitlab_instance_administration_project.rb index 9f50ce6a7e4..3338f2bd2fc 100644 --- a/db/fixtures/development/98_gitlab_instance_administration_project.rb +++ b/db/fixtures/development/98_gitlab_instance_administration_project.rb @@ -1,7 +1,10 @@ # frozen_string_literal: true response = Sidekiq::Worker.skipping_transaction_check do - ::Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService.new.execute + result = ::Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService.new.execute + AuthorizedProjectUpdate::ProjectRecalculateService.new(result[:project]).execute + + result end if response[:status] == :success diff --git a/db/fixtures/production/004_add_security_training_providers.rb b/db/fixtures/production/004_add_security_training_providers.rb new file mode 100644 index 00000000000..6fbd9f66127 --- /dev/null +++ b/db/fixtures/production/004_add_security_training_providers.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +Gitlab::Seeder.quiet do + ::Gitlab::DatabaseImporters::Security::TrainingProviders::Importer.upsert_providers +end diff --git a/db/migrate/20220406193806_add_maven_package_requests_forwarding_to_application_settings.rb b/db/migrate/20220406193806_add_maven_package_requests_forwarding_to_application_settings.rb new file mode 100644 index 00000000000..60b2efd3e9c --- /dev/null +++ b/db/migrate/20220406193806_add_maven_package_requests_forwarding_to_application_settings.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddMavenPackageRequestsForwardingToApplicationSettings < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def up + add_column(:application_settings, :maven_package_requests_forwarding, :boolean, default: true, null: false) + end + + def down + remove_column(:application_settings, :maven_package_requests_forwarding) + end +end diff --git a/db/migrate/20220603125200_add_show_diff_preview_in_email_to_namespace_settings.rb b/db/migrate/20220603125200_add_show_diff_preview_in_email_to_namespace_settings.rb new file mode 100644 index 00000000000..ad32d589840 --- /dev/null +++ b/db/migrate/20220603125200_add_show_diff_preview_in_email_to_namespace_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddShowDiffPreviewInEmailToNamespaceSettings < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :namespace_settings, :show_diff_preview_in_email, :boolean, default: true, null: false + end +end diff --git a/db/migrate/20220711142148_add_invitation_flow_enforcement_to_application_settings.rb b/db/migrate/20220711142148_add_invitation_flow_enforcement_to_application_settings.rb new file mode 100644 index 00000000000..f323faf9aa1 --- /dev/null +++ b/db/migrate/20220711142148_add_invitation_flow_enforcement_to_application_settings.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddInvitationFlowEnforcementToApplicationSettings < Gitlab::Database::Migration[2.0] + def change + add_column :application_settings, :invitation_flow_enforcement, + :boolean, + default: false, + null: false + end +end diff --git a/db/migrate/20220726171440_create_ghost_user_migrations.rb b/db/migrate/20220726171440_create_ghost_user_migrations.rb new file mode 100644 index 00000000000..c64ca4f7765 --- /dev/null +++ b/db/migrate/20220726171440_create_ghost_user_migrations.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class CreateGhostUserMigrations < Gitlab::Database::Migration[2.0] + def change + create_table :ghost_user_migrations do |t| + t.bigint :user_id, index: { unique: true }, null: false + t.bigint :initiator_user_id + t.timestamps_with_timezone null: false + t.boolean :hard_delete, default: false, null: false + end + end +end diff --git a/db/migrate/20220726171450_add_user_fk_to_ghost_user_migrations.rb b/db/migrate/20220726171450_add_user_fk_to_ghost_user_migrations.rb new file mode 100644 index 00000000000..5904d132d1b --- /dev/null +++ b/db/migrate/20220726171450_add_user_fk_to_ghost_user_migrations.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddUserFkToGhostUserMigrations < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :ghost_user_migrations, :users, column: :user_id, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key :ghost_user_migrations, column: :user_id + end + end +end diff --git a/db/migrate/20220803004853_add_auto_ban_user_to_namespace_settings.rb b/db/migrate/20220803004853_add_auto_ban_user_to_namespace_settings.rb new file mode 100644 index 00000000000..6e03177ce7a --- /dev/null +++ b/db/migrate/20220803004853_add_auto_ban_user_to_namespace_settings.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddAutoBanUserToNamespaceSettings < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :namespace_settings, :auto_ban_user_on_excessive_projects_download, :boolean, + default: false, null: false + end +end diff --git a/db/migrate/20220803235114_add_auto_ban_user_to_application_settings.rb b/db/migrate/20220803235114_add_auto_ban_user_to_application_settings.rb new file mode 100644 index 00000000000..3b57c340921 --- /dev/null +++ b/db/migrate/20220803235114_add_auto_ban_user_to_application_settings.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class AddAutoBanUserToApplicationSettings < Gitlab::Database::Migration[2.0] + def change + add_column :application_settings, :auto_ban_user_on_excessive_projects_download, :boolean, + default: false, null: false + end +end diff --git a/db/migrate/20220815152905_create_vulnerability_advisories.rb b/db/migrate/20220815152905_create_vulnerability_advisories.rb new file mode 100644 index 00000000000..f01a17c6352 --- /dev/null +++ b/db/migrate/20220815152905_create_vulnerability_advisories.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class CreateVulnerabilityAdvisories < Gitlab::Database::Migration[2.0] + def change + create_table :vulnerability_advisories, id: false do |t| + t.uuid :uuid, null: false + t.timestamps_with_timezone null: false + t.primary_key :id + t.date :created_date, null: false + t.date :published_date, null: false + t.text :description, limit: 2048 + t.text :title, limit: 2048 + t.text :component_name, limit: 2048 + t.text :solution, limit: 2048 + t.text :not_impacted, limit: 2048 + t.text :cvss_v2, limit: 128 + t.text :cvss_v3, limit: 128 + t.text :affected_range, limit: 32 + t.text :identifiers, array: true, default: [] + t.text :fixed_versions, array: true, default: [] + t.text :urls, array: true, default: [] + t.text :links, array: true, default: [] + end + end +end diff --git a/db/migrate/20220816135816_create_sbom_vulnerable_component_versions.rb b/db/migrate/20220816135816_create_sbom_vulnerable_component_versions.rb new file mode 100644 index 00000000000..6f50376f6fa --- /dev/null +++ b/db/migrate/20220816135816_create_sbom_vulnerable_component_versions.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class CreateSbomVulnerableComponentVersions < Gitlab::Database::Migration[2.0] + ADVISORY_INDEX_NAME = "index_vulnerable_component_versions_on_vulnerability_advisory" + SBOM_COMPONENT_INDEX_NAME = "index_vulnerable_component_versions_on_sbom_component_version" + + def change + create_table :sbom_vulnerable_component_versions do |t| + t.references :vulnerability_advisory, + index: { name: ADVISORY_INDEX_NAME } + + t.references :sbom_component_version, + index: { name: SBOM_COMPONENT_INDEX_NAME } + + t.timestamps_with_timezone null: false + end + end +end diff --git a/db/migrate/20220817122907_re_add_show_diff_preview_in_email_to_project_settings.rb b/db/migrate/20220817122907_re_add_show_diff_preview_in_email_to_project_settings.rb new file mode 100644 index 00000000000..bb5649e3a99 --- /dev/null +++ b/db/migrate/20220817122907_re_add_show_diff_preview_in_email_to_project_settings.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class ReAddShowDiffPreviewInEmailToProjectSettings < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :project_settings, :show_diff_preview_in_email, :boolean, default: true, null: false + end +end diff --git a/db/migrate/20220818095225_add_max_pages_custom_domains_per_project.rb b/db/migrate/20220818095225_add_max_pages_custom_domains_per_project.rb new file mode 100644 index 00000000000..c5e1f5aede6 --- /dev/null +++ b/db/migrate/20220818095225_add_max_pages_custom_domains_per_project.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddMaxPagesCustomDomainsPerProject < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + CONSTRAINT_NAME = "app_settings_max_pages_custom_domains_per_project_check" + + def up + return if column_exists?(:application_settings, :max_pages_custom_domains_per_project) + + add_column :application_settings, :max_pages_custom_domains_per_project, :integer, null: false, default: 0 + add_check_constraint :application_settings, "max_pages_custom_domains_per_project >= 0", CONSTRAINT_NAME + end + + def down + return unless column_exists?(:application_settings, :max_pages_custom_domains_per_project) + + remove_column :application_settings, :max_pages_custom_domains_per_project + end +end diff --git a/db/migrate/20220818132108_add_deleted_on_to_ml_experiments.rb b/db/migrate/20220818132108_add_deleted_on_to_ml_experiments.rb new file mode 100644 index 00000000000..e6ba9f78553 --- /dev/null +++ b/db/migrate/20220818132108_add_deleted_on_to_ml_experiments.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddDeletedOnToMlExperiments < Gitlab::Database::Migration[2.0] + def change + add_column :ml_experiments, :deleted_on, :datetime_with_timezone, index: true + end +end diff --git a/db/migrate/20220819153725_add_vulnerability_advisory_foreign_key_to_sbom_vulnerable_component_versions.rb b/db/migrate/20220819153725_add_vulnerability_advisory_foreign_key_to_sbom_vulnerable_component_versions.rb new file mode 100644 index 00000000000..7f0c817875f --- /dev/null +++ b/db/migrate/20220819153725_add_vulnerability_advisory_foreign_key_to_sbom_vulnerable_component_versions.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddVulnerabilityAdvisoryForeignKeyToSbomVulnerableComponentVersions < Gitlab::Database::Migration[2.0] + SOURCE_TABLE = :sbom_vulnerable_component_versions + TARGET_TABLE = :vulnerability_advisories + COLUMN = :vulnerability_advisory_id + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key SOURCE_TABLE, TARGET_TABLE, column: COLUMN, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key SOURCE_TABLE, column: COLUMN + end + end +end diff --git a/db/migrate/20220819162852_add_sbom_component_version_foreign_key_to_sbom_vulnerable_component_versions.rb b/db/migrate/20220819162852_add_sbom_component_version_foreign_key_to_sbom_vulnerable_component_versions.rb new file mode 100644 index 00000000000..a4f2005693c --- /dev/null +++ b/db/migrate/20220819162852_add_sbom_component_version_foreign_key_to_sbom_vulnerable_component_versions.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddSbomComponentVersionForeignKeyToSbomVulnerableComponentVersions < Gitlab::Database::Migration[2.0] + SOURCE_TABLE = :sbom_vulnerable_component_versions + TARGET_TABLE = :sbom_component_versions + COLUMN = :sbom_component_version_id + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key SOURCE_TABLE, TARGET_TABLE, column: COLUMN, on_delete: :cascade + end + + def down + with_lock_retries do + remove_foreign_key SOURCE_TABLE, column: COLUMN + end + end +end diff --git a/db/migrate/20220822102651_add_namespace_id_to_broadcast_message.rb b/db/migrate/20220822102651_add_namespace_id_to_broadcast_message.rb new file mode 100644 index 00000000000..5413f447366 --- /dev/null +++ b/db/migrate/20220822102651_add_namespace_id_to_broadcast_message.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddNamespaceIdToBroadcastMessage < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :broadcast_messages, :namespace_id, :bigint + end +end diff --git a/db/migrate/20220822103638_add_index_and_foreign_key_to_broadcast_message.rb b/db/migrate/20220822103638_add_index_and_foreign_key_to_broadcast_message.rb new file mode 100644 index 00000000000..a577e5ad157 --- /dev/null +++ b/db/migrate/20220822103638_add_index_and_foreign_key_to_broadcast_message.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexAndForeignKeyToBroadcastMessage < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_broadcast_messages_on_namespace_id' + + def up + add_concurrent_index :broadcast_messages, :namespace_id, name: INDEX_NAME + add_concurrent_foreign_key :broadcast_messages, :namespaces, column: :namespace_id, on_delete: :cascade + end + + def down + remove_foreign_key_if_exists :broadcast_messages, column: :namespace_id + remove_concurrent_index_by_name :broadcast_messages, name: INDEX_NAME + end +end diff --git a/db/migrate/20220824175648_limit_namespaces_sync_triggers_to_traversal_ids_update.rb b/db/migrate/20220824175648_limit_namespaces_sync_triggers_to_traversal_ids_update.rb new file mode 100644 index 00000000000..142744b5493 --- /dev/null +++ b/db/migrate/20220824175648_limit_namespaces_sync_triggers_to_traversal_ids_update.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class LimitNamespacesSyncTriggersToTraversalIdsUpdate < Gitlab::Database::Migration[2.0] + include Gitlab::Database::SchemaHelpers + + enable_lock_retries! + + TABLE_NAME = 'namespaces' + EVENT_TABLE_NAME = 'namespaces_sync_events' + FUNCTION_NAME = 'insert_namespaces_sync_event' + OLD_TRIGGER_ON_INSERT = 'trigger_namespaces_parent_id_on_insert' + OLD_TRIGGER_ON_UPDATE = 'trigger_namespaces_parent_id_on_update' + NEW_TRIGGER_ON_UPDATE = 'trigger_namespaces_traversal_ids_on_update' + + def up + create_trigger(TABLE_NAME, NEW_TRIGGER_ON_UPDATE, FUNCTION_NAME, fires: 'AFTER UPDATE') do + <<~SQL + WHEN (OLD.traversal_ids IS DISTINCT FROM NEW.traversal_ids) + SQL + end + drop_trigger(TABLE_NAME, OLD_TRIGGER_ON_UPDATE) + drop_trigger(TABLE_NAME, OLD_TRIGGER_ON_INSERT) + end + + # Revert both triggers to the version defined in db/migrate/20211011141242_create_namespaces_sync_trigger.rb + def down + create_trigger(TABLE_NAME, OLD_TRIGGER_ON_INSERT, FUNCTION_NAME, fires: 'AFTER INSERT') + create_trigger(TABLE_NAME, OLD_TRIGGER_ON_UPDATE, FUNCTION_NAME, fires: 'AFTER UPDATE') do + <<~SQL + WHEN (OLD.parent_id IS DISTINCT FROM NEW.parent_id) + SQL + end + drop_trigger(TABLE_NAME, NEW_TRIGGER_ON_UPDATE) + end +end diff --git a/db/migrate/20220824194103_remove_existing_work_item_type_backfill_migrations.rb b/db/migrate/20220824194103_remove_existing_work_item_type_backfill_migrations.rb new file mode 100644 index 00000000000..ed970e30099 --- /dev/null +++ b/db/migrate/20220824194103_remove_existing_work_item_type_backfill_migrations.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +class RemoveExistingWorkItemTypeBackfillMigrations < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + JOB_CLASS_NAME = 'BackfillWorkItemTypeIdForIssues' + + class BatchedMigration < MigrationRecord + self.table_name = 'batched_background_migrations' + end + + def up + # cleaning up so we can remove a custom batching strategy that is no longer necessary + # some environments might already have this background migrations scheduled and probably completed + BatchedMigration.where(job_class_name: JOB_CLASS_NAME).delete_all + end + + def down + # no-op + # we will reschedule this migration in the future, no need to add back here + end +end diff --git a/db/migrate/20220825105631_add_cube_api_key_to_application_settings.rb b/db/migrate/20220825105631_add_cube_api_key_to_application_settings.rb new file mode 100644 index 00000000000..6ee5ad52315 --- /dev/null +++ b/db/migrate/20220825105631_add_cube_api_key_to_application_settings.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddCubeApiKeyToApplicationSettings < Gitlab::Database::Migration[2.0] + def change + # rubocop:disable Migration/AddLimitToTextColumns + add_column :application_settings, :cube_api_base_url, :text + add_column :application_settings, :encrypted_cube_api_key, :binary + add_column :application_settings, :encrypted_cube_api_key_iv, :binary + # rubocop:enable Migration/AddLimitToTextColumns + end +end diff --git a/db/migrate/20220825134827_remove_not_null_constraint_for_confidence_columns.rb b/db/migrate/20220825134827_remove_not_null_constraint_for_confidence_columns.rb new file mode 100644 index 00000000000..e41d93ebf8b --- /dev/null +++ b/db/migrate/20220825134827_remove_not_null_constraint_for_confidence_columns.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class RemoveNotNullConstraintForConfidenceColumns < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + change_column_null :vulnerabilities, :confidence, true + change_column_null :vulnerability_occurrences, :confidence, true + change_column_null :security_findings, :confidence, true + end + + def down + # no-op: We can not set `NOT NULL` constraint here as there can be NULL values already. + end +end diff --git a/db/migrate/20220828094411_add_rpm_max_file_size_to_plan_limits.rb b/db/migrate/20220828094411_add_rpm_max_file_size_to_plan_limits.rb new file mode 100644 index 00000000000..32489fd5bce --- /dev/null +++ b/db/migrate/20220828094411_add_rpm_max_file_size_to_plan_limits.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddRpmMaxFileSizeToPlanLimits < Gitlab::Database::Migration[2.0] + DOWNTIME = false + + def change + add_column :plan_limits, :rpm_max_file_size, :bigint, default: 5.gigabytes, null: false + end +end diff --git a/db/migrate/20220828131848_create_packages_rpm_metadata.rb b/db/migrate/20220828131848_create_packages_rpm_metadata.rb new file mode 100644 index 00000000000..bfaa441fc78 --- /dev/null +++ b/db/migrate/20220828131848_create_packages_rpm_metadata.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class CreatePackagesRpmMetadata < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + with_lock_retries do + create_table :packages_rpm_metadata, id: false do |t| + t.references :package, + primary_key: true, + default: nil, + index: true, + foreign_key: { to_table: :packages_packages, on_delete: :cascade }, + type: :bigint + t.text :release, default: '1', null: false, limit: 128 + t.text :summary, default: '', null: false, limit: 1000 + t.text :description, default: '', null: false, limit: 5000 + t.text :arch, default: '', null: false, limit: 255 + t.text :license, null: true, limit: 1000 + t.text :url, null: true, limit: 1000 + end + end + end + + def down + with_lock_retries do + drop_table :packages_rpm_metadata + end + end +end diff --git a/db/migrate/20220829183356_replace_index_on_credit_card_validations.rb b/db/migrate/20220829183356_replace_index_on_credit_card_validations.rb new file mode 100644 index 00000000000..05fa7f75feb --- /dev/null +++ b/db/migrate/20220829183356_replace_index_on_credit_card_validations.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class ReplaceIndexOnCreditCardValidations < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + OLD_INDEX_NAME = 'index_user_credit_card_validations_meta_data_full_match' + NEW_INDEX_NAME = 'index_user_credit_card_validations_meta_data_full_match_lower' + OLD_FIELDS = [:holder_name, :expiration_date, :last_digits, :credit_card_validated_at] + NEW_FIELDS = 'lower(holder_name), expiration_date, last_digits, credit_card_validated_at' + + def up + add_concurrent_index :user_credit_card_validations, NEW_FIELDS, name: NEW_INDEX_NAME + remove_concurrent_index :user_credit_card_validations, OLD_FIELDS, name: OLD_INDEX_NAME + end + + def down + add_concurrent_index :user_credit_card_validations, OLD_FIELDS, name: OLD_INDEX_NAME + remove_concurrent_index :user_credit_card_validations, NEW_FIELDS, name: NEW_INDEX_NAME + end +end diff --git a/db/migrate/20220830082928_add_text_limit_to_cube_api_base_url.rb b/db/migrate/20220830082928_add_text_limit_to_cube_api_base_url.rb new file mode 100644 index 00000000000..7bab796a47f --- /dev/null +++ b/db/migrate/20220830082928_add_text_limit_to_cube_api_base_url.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddTextLimitToCubeApiBaseUrl < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_text_limit :application_settings, :cube_api_base_url, 512 + end + + def down + remove_text_limit :application_settings, :cube_api_base_url + end +end diff --git a/db/migrate/20220830114228_create_dora_configuration_table.rb b/db/migrate/20220830114228_create_dora_configuration_table.rb new file mode 100644 index 00000000000..ee5960d14b6 --- /dev/null +++ b/db/migrate/20220830114228_create_dora_configuration_table.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class CreateDoraConfigurationTable < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + create_table :dora_configurations do |t| + t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } + t.text :branches_for_lead_time_for_changes, null: false, array: true, default: [] + end + end + + def down + drop_table :dora_configurations + end +end diff --git a/db/migrate/20220831182105_add_constraints_view.rb b/db/migrate/20220831182105_add_constraints_view.rb new file mode 100644 index 00000000000..03c183b6e9f --- /dev/null +++ b/db/migrate/20220831182105_add_constraints_view.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +class AddConstraintsView < Gitlab::Database::Migration[2.0] + def up + execute(<<~SQL) + CREATE OR REPLACE VIEW postgres_constraints + AS + SELECT + pg_constraint.oid AS oid, + pg_constraint.conname AS name, + pg_constraint.contype AS constraint_type, + pg_constraint.convalidated AS constraint_valid, + (SELECT array_agg(attname ORDER BY ordering) + FROM unnest(pg_constraint.conkey) WITH ORDINALITY attnums(attnum, ordering) + INNER JOIN pg_attribute ON pg_attribute.attnum = attnums.attnum AND pg_attribute.attrelid = pg_class.oid + ) AS column_names, + pg_namespace.nspname::text || '.'::text || pg_class.relname::text AS table_identifier, + -- pg_constraint reports a 0 oid rather than null if the constraint is not a partition child constraint. + nullif(pg_constraint.conparentid, 0) AS parent_constraint_oid, + pg_get_constraintdef(pg_constraint.oid) AS definition + FROM pg_constraint + INNER JOIN pg_class ON pg_constraint.conrelid = pg_class.oid + INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid; + SQL + end + + def down + execute(<<~SQL) + DROP VIEW postgres_constraints; + SQL + end +end diff --git a/db/migrate/20220901035722_add_temp_project_member_index.rb b/db/migrate/20220901035722_add_temp_project_member_index.rb new file mode 100644 index 00000000000..0765ef09b5c --- /dev/null +++ b/db/migrate/20220901035722_add_temp_project_member_index.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddTempProjectMemberIndex < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TABLE_NAME = :members + INDEX_NAME = 'index_project_members_on_id_temp' + + def up + add_concurrent_index TABLE_NAME, :id, name: INDEX_NAME, where: "source_type = 'Project'" + end + + def down + remove_concurrent_index TABLE_NAME, :id, name: INDEX_NAME + end +end diff --git a/db/migrate/20220901124637_add_last_downloaded_at_to_packages.rb b/db/migrate/20220901124637_add_last_downloaded_at_to_packages.rb new file mode 100644 index 00000000000..0172ab573ea --- /dev/null +++ b/db/migrate/20220901124637_add_last_downloaded_at_to_packages.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddLastDownloadedAtToPackages < Gitlab::Database::Migration[2.0] + def change + add_column :packages_packages, :last_downloaded_at, :datetime_with_timezone + end +end diff --git a/db/migrate/20220901131828_add_environments_project_name_lower_pattern_ops_index.rb b/db/migrate/20220901131828_add_environments_project_name_lower_pattern_ops_index.rb new file mode 100644 index 00000000000..d8b7cd9be28 --- /dev/null +++ b/db/migrate/20220901131828_add_environments_project_name_lower_pattern_ops_index.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddEnvironmentsProjectNameLowerPatternOpsIndex < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_environments_on_project_name_varchar_pattern_ops' + + def up + add_concurrent_index :environments, 'project_id, lower(name) varchar_pattern_ops', name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :environments, INDEX_NAME + end +end diff --git a/db/migrate/20220901212027_add_merge_request_id_to_environments.rb b/db/migrate/20220901212027_add_merge_request_id_to_environments.rb new file mode 100644 index 00000000000..4a230c737ae --- /dev/null +++ b/db/migrate/20220901212027_add_merge_request_id_to_environments.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddMergeRequestIdToEnvironments < Gitlab::Database::Migration[2.0] + def change + add_column :environments, :merge_request_id, :bigint + end +end diff --git a/db/migrate/20220902065314_create_ci_partitions.rb b/db/migrate/20220902065314_create_ci_partitions.rb new file mode 100644 index 00000000000..1a8a4f172f8 --- /dev/null +++ b/db/migrate/20220902065314_create_ci_partitions.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class CreateCiPartitions < Gitlab::Database::Migration[2.0] + def change + create_table :ci_partitions do |t| + t.timestamps_with_timezone null: false + end + end +end diff --git a/db/migrate/20220902065316_create_default_partition_record.rb b/db/migrate/20220902065316_create_default_partition_record.rb new file mode 100644 index 00000000000..6493fb23d4c --- /dev/null +++ b/db/migrate/20220902065316_create_default_partition_record.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class CreateDefaultPartitionRecord < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_ci + + def up + execute(<<~SQL) + INSERT INTO "ci_partitions" ("id", "created_at", "updated_at") + VALUES (100, now(), now()); + SQL + + reset_pk_sequence!('ci_partitions') + end + + def down + execute(<<~SQL) + DELETE FROM "ci_partitions" WHERE "ci_partitions"."id" = 100; + SQL + end +end diff --git a/db/migrate/20220902065317_add_partition_id_to_ci_builds.rb b/db/migrate/20220902065317_add_partition_id_to_ci_builds.rb new file mode 100644 index 00000000000..6257164b44e --- /dev/null +++ b/db/migrate/20220902065317_add_partition_id_to_ci_builds.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddPartitionIdToCiBuilds < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + # rubocop:disable Migration/AddColumnsToWideTables + def change + add_column :ci_builds, :partition_id, :bigint, default: 100, null: false + end + # rubocop:enable Migration/AddColumnsToWideTables +end diff --git a/db/migrate/20220902065558_add_partition_id_to_ci_builds_metadata.rb b/db/migrate/20220902065558_add_partition_id_to_ci_builds_metadata.rb new file mode 100644 index 00000000000..e04ea99539f --- /dev/null +++ b/db/migrate/20220902065558_add_partition_id_to_ci_builds_metadata.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddPartitionIdToCiBuildsMetadata < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :ci_builds_metadata, :partition_id, :bigint, default: 100, null: false + end +end diff --git a/db/migrate/20220902065611_add_partition_id_to_ci_job_artifacts.rb b/db/migrate/20220902065611_add_partition_id_to_ci_job_artifacts.rb new file mode 100644 index 00000000000..1d9eeb0330e --- /dev/null +++ b/db/migrate/20220902065611_add_partition_id_to_ci_job_artifacts.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddPartitionIdToCiJobArtifacts < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :ci_job_artifacts, :partition_id, :bigint, default: 100, null: false + end +end diff --git a/db/migrate/20220902065623_add_partition_id_to_ci_pipelines.rb b/db/migrate/20220902065623_add_partition_id_to_ci_pipelines.rb new file mode 100644 index 00000000000..bb3e7c27ee8 --- /dev/null +++ b/db/migrate/20220902065623_add_partition_id_to_ci_pipelines.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddPartitionIdToCiPipelines < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :ci_pipelines, :partition_id, :bigint, default: 100, null: false + end +end diff --git a/db/migrate/20220902065635_add_partition_id_to_ci_stages.rb b/db/migrate/20220902065635_add_partition_id_to_ci_stages.rb new file mode 100644 index 00000000000..0ddbf491ee9 --- /dev/null +++ b/db/migrate/20220902065635_add_partition_id_to_ci_stages.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddPartitionIdToCiStages < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :ci_stages, :partition_id, :bigint, default: 100, null: false + end +end diff --git a/db/migrate/20220902065647_add_partition_id_to_ci_pipeline_variables.rb b/db/migrate/20220902065647_add_partition_id_to_ci_pipeline_variables.rb new file mode 100644 index 00000000000..14f17b371b4 --- /dev/null +++ b/db/migrate/20220902065647_add_partition_id_to_ci_pipeline_variables.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddPartitionIdToCiPipelineVariables < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column :ci_pipeline_variables, :partition_id, :bigint, default: 100, null: false + end +end diff --git a/db/migrate/20220902165931_index_evironments_on_merge_request_id.rb b/db/migrate/20220902165931_index_evironments_on_merge_request_id.rb new file mode 100644 index 00000000000..9d9f84e94ee --- /dev/null +++ b/db/migrate/20220902165931_index_evironments_on_merge_request_id.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class IndexEvironmentsOnMergeRequestId < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'index_environments_on_merge_request_id' + + disable_ddl_transaction! + + def up + add_concurrent_index :environments, :merge_request_id, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :environments, INDEX_NAME + end +end diff --git a/db/migrate/20220902170131_add_fk_constraint_to_environments_merge_request_id.rb b/db/migrate/20220902170131_add_fk_constraint_to_environments_merge_request_id.rb new file mode 100644 index 00000000000..863aefe56fb --- /dev/null +++ b/db/migrate/20220902170131_add_fk_constraint_to_environments_merge_request_id.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddFkConstraintToEnvironmentsMergeRequestId < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_concurrent_foreign_key :environments, :merge_requests, column: :merge_request_id, on_delete: :nullify + end + + def down + remove_foreign_key_if_exists :environments, column: :merge_request_id + end +end diff --git a/db/migrate/20220906093857_add_column_branch_filter_strategy_to_web_hooks.rb b/db/migrate/20220906093857_add_column_branch_filter_strategy_to_web_hooks.rb new file mode 100644 index 00000000000..739bedda9e0 --- /dev/null +++ b/db/migrate/20220906093857_add_column_branch_filter_strategy_to_web_hooks.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddColumnBranchFilterStrategyToWebHooks < Gitlab::Database::Migration[2.0] + def change + add_column :web_hooks, :branch_filter_strategy, :integer, null: false, default: 0, limit: 2 + end +end diff --git a/db/migrate/20220906155105_add_start_time_and_end_time_and_status_to_ml_candidates.rb b/db/migrate/20220906155105_add_start_time_and_end_time_and_status_to_ml_candidates.rb new file mode 100644 index 00000000000..68138881139 --- /dev/null +++ b/db/migrate/20220906155105_add_start_time_and_end_time_and_status_to_ml_candidates.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddStartTimeAndEndTimeAndStatusToMlCandidates < Gitlab::Database::Migration[2.0] + def change + add_column :ml_candidates, :start_time, :bigint + add_column :ml_candidates, :end_time, :bigint + add_column :ml_candidates, :status, :smallint, default: 0, null: false + end +end diff --git a/db/migrate/20220906204832_add_locked_to_ci_pipeline_artifacts.rb b/db/migrate/20220906204832_add_locked_to_ci_pipeline_artifacts.rb new file mode 100644 index 00000000000..dae4c560bb2 --- /dev/null +++ b/db/migrate/20220906204832_add_locked_to_ci_pipeline_artifacts.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddLockedToCiPipelineArtifacts < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TABLE_NAME = 'ci_pipeline_artifacts' + COLUMN_NAME = 'locked' + + def up + with_lock_retries do + add_column TABLE_NAME, COLUMN_NAME, :smallint, default: 2 + end + end + + def down + with_lock_retries do + remove_column TABLE_NAME, COLUMN_NAME + end + end +end diff --git a/db/migrate/20220907124320_add_internal_to_notes.rb b/db/migrate/20220907124320_add_internal_to_notes.rb new file mode 100644 index 00000000000..081914f7830 --- /dev/null +++ b/db/migrate/20220907124320_add_internal_to_notes.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddInternalToNotes < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + add_column(:notes, :internal, :boolean, default: false, null: false) + end +end diff --git a/db/migrate/20220909091410_add_dismissal_reason_to_vulnerability_state_transitions.rb b/db/migrate/20220909091410_add_dismissal_reason_to_vulnerability_state_transitions.rb new file mode 100644 index 00000000000..01fcb3aa6e1 --- /dev/null +++ b/db/migrate/20220909091410_add_dismissal_reason_to_vulnerability_state_transitions.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddDismissalReasonToVulnerabilityStateTransitions < Gitlab::Database::Migration[2.0] + def change + add_column :vulnerability_state_transitions, :dismissal_reason, :smallint + end +end diff --git a/db/migrate/20220909094752_add_free_user_cap_over_limt_notified_at_to_namespace_details.rb b/db/migrate/20220909094752_add_free_user_cap_over_limt_notified_at_to_namespace_details.rb new file mode 100644 index 00000000000..775705eae73 --- /dev/null +++ b/db/migrate/20220909094752_add_free_user_cap_over_limt_notified_at_to_namespace_details.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddFreeUserCapOverLimtNotifiedAtToNamespaceDetails < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TABLE_NAME = 'namespace_details' + COLUMN_NAME = 'free_user_cap_over_limt_notified_at' + + def up + with_lock_retries do + add_column(TABLE_NAME, COLUMN_NAME, :datetime_with_timezone) + end + end + + def down + with_lock_retries do + remove_column TABLE_NAME, COLUMN_NAME + end + end +end diff --git a/db/migrate/20220909113809_add_environments_project_name_lower_pattern_ops_state_index.rb b/db/migrate/20220909113809_add_environments_project_name_lower_pattern_ops_state_index.rb new file mode 100644 index 00000000000..870c809beb6 --- /dev/null +++ b/db/migrate/20220909113809_add_environments_project_name_lower_pattern_ops_state_index.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddEnvironmentsProjectNameLowerPatternOpsStateIndex < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_environments_on_project_name_varchar_pattern_ops_state' + + def up + add_concurrent_index :environments, 'project_id, lower(name) varchar_pattern_ops, state', name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :environments, INDEX_NAME + end +end diff --git a/db/migrate/20220912180807_add_epoch_column_to_rpm_metadata.rb b/db/migrate/20220912180807_add_epoch_column_to_rpm_metadata.rb new file mode 100644 index 00000000000..842d917c8a3 --- /dev/null +++ b/db/migrate/20220912180807_add_epoch_column_to_rpm_metadata.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddEpochColumnToRpmMetadata < Gitlab::Database::Migration[2.0] + def change + add_column :packages_rpm_metadata, :epoch, :integer, null: false, default: 0 + end +end diff --git a/db/migrate/20220913082930_rename_iterations_cadences_last_run_date_to_next_run_date.rb b/db/migrate/20220913082930_rename_iterations_cadences_last_run_date_to_next_run_date.rb new file mode 100644 index 00000000000..2adc4202b79 --- /dev/null +++ b/db/migrate/20220913082930_rename_iterations_cadences_last_run_date_to_next_run_date.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class RenameIterationsCadencesLastRunDateToNextRunDate < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + rename_column_concurrently :iterations_cadences, :last_run_date, :next_run_date + end + + def down + undo_rename_column_concurrently :iterations_cadences, :last_run_date, :next_run_date + end +end diff --git a/db/migrate/20220914005141_change_namespace_id_not_null_in_members.rb b/db/migrate/20220914005141_change_namespace_id_not_null_in_members.rb new file mode 100644 index 00000000000..250746b95b8 --- /dev/null +++ b/db/migrate/20220914005141_change_namespace_id_not_null_in_members.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class ChangeNamespaceIdNotNullInMembers < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_not_null_constraint :members, :member_namespace_id, validate: false + end + + def down + remove_not_null_constraint :members, :member_namespace_id + end +end diff --git a/db/migrate/20220914010233_change_members_namespace_foreign_key_on_delete_constraint.rb b/db/migrate/20220914010233_change_members_namespace_foreign_key_on_delete_constraint.rb new file mode 100644 index 00000000000..2ee98d59c3e --- /dev/null +++ b/db/migrate/20220914010233_change_members_namespace_foreign_key_on_delete_constraint.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class ChangeMembersNamespaceForeignKeyOnDeleteConstraint < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TARGET_COLUMN = :member_namespace_id + + def up + # add the new FK before removing the old one + add_concurrent_foreign_key( + :members, + :namespaces, + column: TARGET_COLUMN, + name: fk_name("#{TARGET_COLUMN}_new"), + on_delete: :cascade, + validate: false + ) + end + + def down + with_lock_retries do + remove_foreign_key_if_exists(:members, column: TARGET_COLUMN, name: fk_name("#{TARGET_COLUMN}_new")) + end + end + + def fk_name(column_name) + # generate a FK name + concurrent_foreign_key_name(:members, column_name) + end +end diff --git a/db/migrate/20220915140802_create_merge_request_predictions.rb b/db/migrate/20220915140802_create_merge_request_predictions.rb new file mode 100644 index 00000000000..20cd7e58092 --- /dev/null +++ b/db/migrate/20220915140802_create_merge_request_predictions.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class CreateMergeRequestPredictions < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def up + create_table :merge_request_predictions, id: false do |t| + t.references :merge_request, + primary_key: true, null: false, type: :bigint, + index: false, foreign_key: { on_delete: :cascade } + + t.timestamps_with_timezone null: false + t.jsonb :suggested_reviewers, null: false, default: {} + end + end + + def down + drop_table :merge_request_predictions + end +end diff --git a/db/post_migrate/20210812013042_remove_duplicate_project_authorizations.rb b/db/post_migrate/20210812013042_remove_duplicate_project_authorizations.rb index 6fdc30d09c6..1c2e2b52e8b 100644 --- a/db/post_migrate/20210812013042_remove_duplicate_project_authorizations.rb +++ b/db/post_migrate/20210812013042_remove_duplicate_project_authorizations.rb @@ -55,7 +55,8 @@ class RemoveDuplicateProjectAuthorizations < ActiveRecord::Migration[6.1] end def batch(&block) - order = Gitlab::Pagination::Keyset::Order.build([ + order = Gitlab::Pagination::Keyset::Order.build( + [ Gitlab::Pagination::Keyset::ColumnOrderDefinition.new( attribute_name: 'user_id', order_expression: ProjectAuthorization.arel_table[:user_id].asc, diff --git a/db/post_migrate/20220601110011_schedule_remove_self_managed_wiki_notes.rb b/db/post_migrate/20220601110011_schedule_remove_self_managed_wiki_notes.rb new file mode 100644 index 00000000000..9e6594bb9b6 --- /dev/null +++ b/db/post_migrate/20220601110011_schedule_remove_self_managed_wiki_notes.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class ScheduleRemoveSelfManagedWikiNotes < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + MIGRATION = 'RemoveSelfManagedWikiNotes' + INTERVAL = 2.minutes + + disable_ddl_transaction! + + def up + return if skip_migration? + + queue_batched_background_migration( + MIGRATION, + :notes, + :id, + job_interval: INTERVAL, + batch_size: 10_000, + sub_batch_size: 1_000 + ) + end + + def down + return if skip_migration? + + delete_batched_background_migration(MIGRATION, :notes, :id, []) + end + + private + + def skip_migration? + Gitlab.staging? || Gitlab.com? + end +end diff --git a/db/post_migrate/20220606054503_add_tmp_index_job_artifacts_id_and_expire_at.rb b/db/post_migrate/20220606054503_add_tmp_index_job_artifacts_id_and_expire_at.rb new file mode 100644 index 00000000000..28346eb1a97 --- /dev/null +++ b/db/post_migrate/20220606054503_add_tmp_index_job_artifacts_id_and_expire_at.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class AddTmpIndexJobArtifactsIdAndExpireAt < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'tmp_index_ci_job_artifacts_on_id_expire_at_file_type_trace' + + EXPIRE_AT_ON_22_MIDNIGHT_IN_TIMEZONE_OR_TRACE = <<~SQL + (EXTRACT(day FROM timezone('UTC', expire_at)) IN (21, 22, 23) + AND EXTRACT(minute FROM timezone('UTC', expire_at)) IN (0, 30, 45) + AND EXTRACT(second FROM timezone('UTC', expire_at)) = 0) + OR file_type = 3 + SQL + + def up + return if Gitlab.com? + return if index_exists_by_name?(:ci_job_artifacts, INDEX_NAME) + + add_concurrent_index :ci_job_artifacts, :id, + where: EXPIRE_AT_ON_22_MIDNIGHT_IN_TIMEZONE_OR_TRACE, name: INDEX_NAME + end + + def down + return if Gitlab.com? + return unless index_exists_by_name?(:ci_job_artifacts, INDEX_NAME) + + remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME + end +end diff --git a/db/post_migrate/20220606080509_fix_incorrect_job_artifacts_expire_at.rb b/db/post_migrate/20220606080509_fix_incorrect_job_artifacts_expire_at.rb new file mode 100644 index 00000000000..8fea22f5579 --- /dev/null +++ b/db/post_migrate/20220606080509_fix_incorrect_job_artifacts_expire_at.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class FixIncorrectJobArtifactsExpireAt < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_ci + + MIGRATION = 'RemoveBackfilledJobArtifactsExpireAt' + BATCH_CLASS = 'RemoveBackfilledJobArtifactsExpireAtBatchingStrategy' + BATCH_SIZE = 500 + INTERVAL = 2.minutes.freeze + + def up + return if Gitlab.com? + + queue_batched_background_migration( + MIGRATION, + :ci_job_artifacts, + :id, + job_interval: INTERVAL, + batch_class_name: BATCH_CLASS, + batch_size: BATCH_SIZE + ) + end + + def down + return if Gitlab.com? + + delete_batched_background_migration(MIGRATION, :ci_job_artifacts, :id, []) + end +end diff --git a/db/post_migrate/20220615154500_schedule_backfill_cluster_agents_has_vulnerabilities.rb b/db/post_migrate/20220615154500_schedule_backfill_cluster_agents_has_vulnerabilities.rb new file mode 100644 index 00000000000..74aeb2947a9 --- /dev/null +++ b/db/post_migrate/20220615154500_schedule_backfill_cluster_agents_has_vulnerabilities.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class ScheduleBackfillClusterAgentsHasVulnerabilities < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + MIGRATION = 'BackfillClusterAgentsHasVulnerabilities' + DELAY_INTERVAL = 2.minutes + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + ensure_batched_background_migration_is_finished( + job_class_name: 'BackfillVulnerabilityReadsClusterAgent', + table_name: :vulnerability_reads, + column_name: :id, + job_arguments: [] + ) + + queue_batched_background_migration( + MIGRATION, + :cluster_agents, + :id, + job_interval: DELAY_INTERVAL + ) + end + + def down + delete_batched_background_migration(MIGRATION, :cluster_agents, :id, []) + end +end diff --git a/db/post_migrate/20220616171355_update_vulnerabilities_project_id_id_active_cis_index.rb b/db/post_migrate/20220616171355_update_vulnerabilities_project_id_id_active_cis_index.rb new file mode 100644 index 00000000000..047ae0d1132 --- /dev/null +++ b/db/post_migrate/20220616171355_update_vulnerabilities_project_id_id_active_cis_index.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class UpdateVulnerabilitiesProjectIdIdActiveCisIndex < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + NEW_INDEX_NAME = 'idx_vulnerabilities_on_project_id_and_id_active_cis_dft_branch' + OLD_INDEX_NAME = 'index_vulnerabilities_on_project_id_and_id_active_cis' + OLD_INDEX_FILTER_CONDITION = 'report_type = 7 AND state = ANY(ARRAY[1, 4])' + NEW_INDEX_FILTER_CONDITION = 'report_type = 7 AND state = ANY(ARRAY[1, 4]) AND present_on_default_branch IS TRUE' + + def up + add_concurrent_index :vulnerabilities, [:project_id, :id], + where: NEW_INDEX_FILTER_CONDITION, + name: NEW_INDEX_NAME + + remove_concurrent_index_by_name(:vulnerabilities, OLD_INDEX_NAME) + end + + def down + add_concurrent_index :vulnerabilities, [:project_id, :id], where: OLD_INDEX_FILTER_CONDITION, name: OLD_INDEX_NAME + + remove_concurrent_index_by_name(:vulnerabilities, NEW_INDEX_NAME) + end +end diff --git a/db/post_migrate/20220706145113_backfill_namespace_id_on_issues.rb b/db/post_migrate/20220706145113_backfill_namespace_id_on_issues.rb new file mode 100644 index 00000000000..8114967ac8e --- /dev/null +++ b/db/post_migrate/20220706145113_backfill_namespace_id_on_issues.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class BackfillNamespaceIdOnIssues < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + MIGRATION = 'BackfillProjectNamespaceOnIssues' + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 500 + MAX_BATCH_SIZE = 10_000 + SUB_BATCH_SIZE = 10 + + def up + queue_batched_background_migration( + MIGRATION, + :issues, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :issues, :id, []) + end +end diff --git a/db/post_migrate/20220707192420_remove_tmp_idx_merge_requests_draft_and_status.rb b/db/post_migrate/20220707192420_remove_tmp_idx_merge_requests_draft_and_status.rb new file mode 100644 index 00000000000..a8cfea02463 --- /dev/null +++ b/db/post_migrate/20220707192420_remove_tmp_idx_merge_requests_draft_and_status.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class RemoveTmpIdxMergeRequestsDraftAndStatus < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = "tmp_index_merge_requests_draft_and_status" + CORRECTED_REGEXP_STR = "^(\\[draft\\]|\\(draft\\)|draft:|draft|\\[WIP\\]|WIP:|WIP)" + + def up + remove_concurrent_index_by_name :merge_requests, INDEX_NAME + end + + def down + add_concurrent_index :merge_requests, :id, + where: "draft = false AND state_id = 1 AND ((title)::text ~* '#{CORRECTED_REGEXP_STR}'::text)", + name: INDEX_NAME + end +end diff --git a/db/post_migrate/20220726225114_remove_tmp_index_group_membership_namespace_id_column.rb b/db/post_migrate/20220726225114_remove_tmp_index_group_membership_namespace_id_column.rb new file mode 100644 index 00000000000..db47be6a1e3 --- /dev/null +++ b/db/post_migrate/20220726225114_remove_tmp_index_group_membership_namespace_id_column.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveTmpIndexGroupMembershipNamespaceIdColumn < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'tmp_index_for_namespace_id_migration_on_group_members' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :members, INDEX_NAME + end + + def down + add_concurrent_index :members, :id, + where: "members.member_namespace_id IS NULL and members.type = 'GroupMember'", + name: INDEX_NAME + end +end diff --git a/db/post_migrate/20220801155858_schedule_disable_legacy_open_source_licence_for_recent_public_projects.rb b/db/post_migrate/20220801155858_schedule_disable_legacy_open_source_licence_for_recent_public_projects.rb new file mode 100644 index 00000000000..a662cfe4be3 --- /dev/null +++ b/db/post_migrate/20220801155858_schedule_disable_legacy_open_source_licence_for_recent_public_projects.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class ScheduleDisableLegacyOpenSourceLicenceForRecentPublicProjects < Gitlab::Database::Migration[2.0] + MIGRATION = 'DisableLegacyOpenSourceLicenceForRecentPublicProjects' + INTERVAL = 2.minutes + BATCH_SIZE = 1_000 + MAX_BATCH_SIZE = 5_000 + SUB_BATCH_SIZE = 200 + + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + return unless Gitlab.com? + + queue_batched_background_migration( + MIGRATION, + :projects, + :id, + job_interval: INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + return unless Gitlab.com? + + delete_batched_background_migration(MIGRATION, :projects, :id, []) + end +end diff --git a/db/post_migrate/20220809002011_schedule_destroy_invalid_group_members.rb b/db/post_migrate/20220809002011_schedule_destroy_invalid_group_members.rb new file mode 100644 index 00000000000..3db21c290b9 --- /dev/null +++ b/db/post_migrate/20220809002011_schedule_destroy_invalid_group_members.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class ScheduleDestroyInvalidGroupMembers < Gitlab::Database::Migration[2.0] + MIGRATION = 'DestroyInvalidGroupMembers' + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 1_000 + MAX_BATCH_SIZE = 2_000 + SUB_BATCH_SIZE = 50 + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + disable_ddl_transaction! + + def up + queue_batched_background_migration( + MIGRATION, + :members, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE, + gitlab_schema: :gitlab_main + ) + end + + def down + delete_batched_background_migration(MIGRATION, :members, :id, []) + end +end diff --git a/db/post_migrate/20220809214730_add_note_metadata_temp_index_on_id_where_task.rb b/db/post_migrate/20220809214730_add_note_metadata_temp_index_on_id_where_task.rb new file mode 100644 index 00000000000..1c5a1b68041 --- /dev/null +++ b/db/post_migrate/20220809214730_add_note_metadata_temp_index_on_id_where_task.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddNoteMetadataTempIndexOnIdWhereTask < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'tmp_index_system_note_metadata_on_id_where_task' + + disable_ddl_transaction! + + def up + add_concurrent_index :system_note_metadata, [:id, :action], where: "action = 'task'", name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :system_note_metadata, INDEX_NAME + end +end diff --git a/db/post_migrate/20220809223215_change_task_system_note_wording_to_checklist_item.rb b/db/post_migrate/20220809223215_change_task_system_note_wording_to_checklist_item.rb new file mode 100644 index 00000000000..df7c2d325d2 --- /dev/null +++ b/db/post_migrate/20220809223215_change_task_system_note_wording_to_checklist_item.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class ChangeTaskSystemNoteWordingToChecklistItem < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + MIGRATION = 'RenameTaskSystemNoteToChecklistItem' + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 10_000 + MAX_BATCH_SIZE = 20_000 + SUB_BATCH_SIZE = 100 + + def up + queue_batched_background_migration( + MIGRATION, + :system_note_metadata, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :system_note_metadata, :id, []) + end +end diff --git a/db/post_migrate/20220815061621_rename_web_hooks_service_id_to_integration_id.rb b/db/post_migrate/20220815061621_rename_web_hooks_service_id_to_integration_id.rb new file mode 100644 index 00000000000..6bcee7f51df --- /dev/null +++ b/db/post_migrate/20220815061621_rename_web_hooks_service_id_to_integration_id.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class RenameWebHooksServiceIdToIntegrationId < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + rename_column_concurrently :web_hooks, :service_id, :integration_id + end + + def down + undo_rename_column_concurrently :web_hooks, :service_id, :integration_id + end +end diff --git a/db/post_migrate/20220816075638_drop_uuid_and_id_index_from_security_findings.rb b/db/post_migrate/20220816075638_drop_uuid_and_id_index_from_security_findings.rb new file mode 100644 index 00000000000..7a41e0b7835 --- /dev/null +++ b/db/post_migrate/20220816075638_drop_uuid_and_id_index_from_security_findings.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class DropUuidAndIdIndexFromSecurityFindings < Gitlab::Database::Migration[2.0] + INDEX_NAME = :index_on_security_findings_uuid_and_id_order_desc + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :security_findings, name: INDEX_NAME + end + + def down + add_concurrent_index :security_findings, [:uuid, :id], order: { id: :desc }, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20220816163444_update_start_date_for_iterations_cadences.rb b/db/post_migrate/20220816163444_update_start_date_for_iterations_cadences.rb new file mode 100644 index 00000000000..631e8941add --- /dev/null +++ b/db/post_migrate/20220816163444_update_start_date_for_iterations_cadences.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +class UpdateStartDateForIterationsCadences < Gitlab::Database::Migration[2.0] + include ::Gitlab::Database::DynamicModelHelpers + + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + def up + each_batch_range('iterations_cadences', connection: connection) do |min, max| + execute(<<~SQL) + UPDATE iterations_cadences + SET start_date=ic.first_upcoming_iteration_start_date + FROM ( + SELECT ic.id, sprints2.first_upcoming_iteration_start_date + FROM iterations_cadences as ic, + LATERAL ( + -- For each cadence, query for the due date of its current iteration + SELECT due_date as current_iteration_due_date FROM sprints + WHERE iterations_cadence_id=ic.id AND start_date <= current_date AND due_date >= current_date + LIMIT 1 + ) as sprints1, + LATERAL ( + -- For each cadence, query for the start date of the first upcoming iteration (i.e, it starts after the current iteration) + SELECT start_date as first_upcoming_iteration_start_date FROM sprints + WHERE iterations_cadence_id=ic.id AND start_date > sprints1.current_iteration_due_date + ORDER BY start_date ASC LIMIT 1 + ) as sprints2 + WHERE ic.automatic=true AND ic.id BETWEEN #{min} AND #{max} + ) as ic + WHERE iterations_cadences.id=ic.id; + SQL + end + end + + def down + each_batch_range('iterations_cadences', connection: connection) do |min, max| + execute(<<~SQL) + UPDATE iterations_cadences + SET start_date=ic.first_iteration_start_date + FROM ( + SELECT ic.id, sprints.start_date as first_iteration_start_date + FROM iterations_cadences as ic, + LATERAL ( + SELECT start_date FROM sprints WHERE iterations_cadence_id=ic.id ORDER BY start_date ASC LIMIT 1 + ) as sprints + WHERE ic.automatic=true AND ic.id BETWEEN #{min} AND #{max} + ) as ic + WHERE iterations_cadences.id=ic.id; + SQL + end + end +end diff --git a/db/post_migrate/20220820221036_update_tmp_non_migrated_index_on_container_repositories.rb b/db/post_migrate/20220820221036_update_tmp_non_migrated_index_on_container_repositories.rb new file mode 100644 index 00000000000..eea58ad7951 --- /dev/null +++ b/db/post_migrate/20220820221036_update_tmp_non_migrated_index_on_container_repositories.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class UpdateTmpNonMigratedIndexOnContainerRepositories < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + NEW_INDEX_NAME = 'tmp_index_container_repos_on_non_migrated' + OLD_INDEX_NAME = 'tmp_idx_container_repos_on_non_migrated' + MIGRATION_PHASE_1_ENDED_AT = '2022-01-23' + + def up + add_concurrent_index :container_repositories, + [:project_id, :id], + name: NEW_INDEX_NAME, + where: "migration_state != 'import_done'" + remove_concurrent_index_by_name :container_repositories, OLD_INDEX_NAME + end + + def down + add_concurrent_index :container_repositories, + [:project_id, :id], + name: OLD_INDEX_NAME, + where: "migration_state != 'import_done' AND created_at < '#{MIGRATION_PHASE_1_ENDED_AT}'" + remove_concurrent_index_by_name :container_repositories, NEW_INDEX_NAME + end +end diff --git a/db/post_migrate/20220822071909_remove_other_role_from_user_details.rb b/db/post_migrate/20220822071909_remove_other_role_from_user_details.rb new file mode 100644 index 00000000000..a0177bf2605 --- /dev/null +++ b/db/post_migrate/20220822071909_remove_other_role_from_user_details.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class RemoveOtherRoleFromUserDetails < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def change + remove_column :user_details, :other_role, :text + end +end diff --git a/db/post_migrate/20220822090656_drop_build_coverage_regex_from_project.rb b/db/post_migrate/20220822090656_drop_build_coverage_regex_from_project.rb new file mode 100644 index 00000000000..70c6b660318 --- /dev/null +++ b/db/post_migrate/20220822090656_drop_build_coverage_regex_from_project.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class DropBuildCoverageRegexFromProject < Gitlab::Database::Migration[2.0] + enable_lock_retries! + + def up + remove_column :projects, :build_coverage_regex + end + + def down + add_column :projects, :build_coverage_regex, :string # rubocop: disable Migration/AddColumnsToWideTables + end +end diff --git a/db/post_migrate/20220822094804_add_issues_authorization_index.rb b/db/post_migrate/20220822094804_add_issues_authorization_index.rb new file mode 100644 index 00000000000..e09b5f8d93b --- /dev/null +++ b/db/post_migrate/20220822094804_add_issues_authorization_index.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddIssuesAuthorizationIndex < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'idx_open_issues_on_project_and_confidential_and_author_and_id' + + def up + prepare_async_index :issues, [:project_id, :confidential, :author_id, :id], name: INDEX_NAME, where: 'state_id = 1' + end + + def down + unprepare_async_index :issues, INDEX_NAME + end +end diff --git a/db/post_migrate/20220823084747_prepare_removal_partial_trigram_indexes_for_issues.rb b/db/post_migrate/20220823084747_prepare_removal_partial_trigram_indexes_for_issues.rb new file mode 100644 index 00000000000..a8ea6abdcba --- /dev/null +++ b/db/post_migrate/20220823084747_prepare_removal_partial_trigram_indexes_for_issues.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class PrepareRemovalPartialTrigramIndexesForIssues < Gitlab::Database::Migration[2.0] + TITLE_INDEX_NAME = 'index_issues_on_title_trigram_non_latin' + DESCRIPTION_INDEX_NAME = 'index_issues_on_description_trigram_non_latin' + + def up + prepare_async_index_removal :issues, :title, name: TITLE_INDEX_NAME + prepare_async_index_removal :issues, :description, name: DESCRIPTION_INDEX_NAME + end + + def down + unprepare_async_index_by_name :issues, DESCRIPTION_INDEX_NAME + unprepare_async_index_by_name :issues, TITLE_INDEX_NAME + end +end diff --git a/db/post_migrate/20220824114218_add_tmp_index_approval_merge_request_rules.rb b/db/post_migrate/20220824114218_add_tmp_index_approval_merge_request_rules.rb new file mode 100644 index 00000000000..64171b3053e --- /dev/null +++ b/db/post_migrate/20220824114218_add_tmp_index_approval_merge_request_rules.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddTmpIndexApprovalMergeRequestRules < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TMP_INDEX_NAME = 'tmp_index_approval_merge_request_rules_on_report_type_equal_one' + + def up + # to be removed as part of https://gitlab.com/gitlab-org/gitlab/-/issues/372224 + add_concurrent_index :approval_merge_request_rules, + [:id, :report_type], + name: TMP_INDEX_NAME, + where: "report_type = 1" + end + + def down + remove_concurrent_index_by_name :approval_merge_request_rules, TMP_INDEX_NAME + end +end diff --git a/db/post_migrate/20220825061250_drop_tmp_index_todos_attention_request_action_idx.rb b/db/post_migrate/20220825061250_drop_tmp_index_todos_attention_request_action_idx.rb new file mode 100644 index 00000000000..091de49e1c9 --- /dev/null +++ b/db/post_migrate/20220825061250_drop_tmp_index_todos_attention_request_action_idx.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class DropTmpIndexTodosAttentionRequestActionIdx < Gitlab::Database::Migration[2.0] + INDEX_NAME = "tmp_index_todos_attention_request_action" + ATTENTION_REQUESTED = 10 + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :todos, INDEX_NAME + end + + def down + add_concurrent_index :todos, [:id], + where: "action = #{ATTENTION_REQUESTED}", + name: INDEX_NAME + end +end diff --git a/db/post_migrate/20220825142324_replace_issues_authorization_index.rb b/db/post_migrate/20220825142324_replace_issues_authorization_index.rb new file mode 100644 index 00000000000..b033cb22490 --- /dev/null +++ b/db/post_migrate/20220825142324_replace_issues_authorization_index.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class ReplaceIssuesAuthorizationIndex < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'idx_open_issues_on_project_and_confidential_and_author_and_id' + OLD_INDEX_NAME = 'idx_open_issues_on_project_id_and_confidential' + + def up + add_concurrent_index :issues, [:project_id, :confidential, :author_id, :id], name: INDEX_NAME, where: 'state_id = 1' + remove_concurrent_index_by_name :issues, OLD_INDEX_NAME + end + + def down + add_concurrent_index :issues, [:project_id, :confidential], name: OLD_INDEX_NAME, where: 'state_id = 1' + remove_concurrent_index_by_name :issues, INDEX_NAME + end +end diff --git a/db/post_migrate/20220826165048_drop_temporary_job_trace_index.rb b/db/post_migrate/20220826165048_drop_temporary_job_trace_index.rb new file mode 100644 index 00000000000..0cad7cd1968 --- /dev/null +++ b/db/post_migrate/20220826165048_drop_temporary_job_trace_index.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class DropTemporaryJobTraceIndex < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'tmp_index_ci_job_artifacts_on_id_where_trace_and_expire_at' + + def up + prepare_async_index_removal :ci_job_artifacts, :id, name: INDEX_NAME + end + + def down + unprepare_async_index_by_name :ci_job_artifacts, INDEX_NAME + end +end diff --git a/db/post_migrate/20220826175058_fully_remove_temporary_job_trace_index.rb b/db/post_migrate/20220826175058_fully_remove_temporary_job_trace_index.rb new file mode 100644 index 00000000000..2a18e63106a --- /dev/null +++ b/db/post_migrate/20220826175058_fully_remove_temporary_job_trace_index.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class FullyRemoveTemporaryJobTraceIndex < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'tmp_index_ci_job_artifacts_on_id_where_trace_and_expire_at' + + 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, :id, name: INDEX_NAME + end +end diff --git a/db/post_migrate/20220830051704_add_temporary_index_for_orphaned_invited_members.rb b/db/post_migrate/20220830051704_add_temporary_index_for_orphaned_invited_members.rb new file mode 100644 index 00000000000..90254ac3d86 --- /dev/null +++ b/db/post_migrate/20220830051704_add_temporary_index_for_orphaned_invited_members.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class AddTemporaryIndexForOrphanedInvitedMembers < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TMP_INDEX_NAME = 'tmp_idx_orphaned_invited_members' + + def up + add_concurrent_index('members', :id, where: query_condition, name: TMP_INDEX_NAME) + end + + def down + remove_concurrent_index_by_name('members', TMP_INDEX_NAME) if index_exists_by_name?('members', TMP_INDEX_NAME) + end + + private + + def query_condition + 'invite_token IS NULL and invite_accepted_at IS NOT NULL AND user_id IS NULL' + end +end diff --git a/db/post_migrate/20220830061704_orphaned_invited_members_cleanup.rb b/db/post_migrate/20220830061704_orphaned_invited_members_cleanup.rb new file mode 100644 index 00000000000..c5249510164 --- /dev/null +++ b/db/post_migrate/20220830061704_orphaned_invited_members_cleanup.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class OrphanedInvitedMembersCleanup < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + # rubocop:disable Style/SymbolProc + membership.where(query_condition).each_batch(of: 100) do |relation| + relation.delete_all + end + # rubocop:enable Style/SymbolProc + end + + def down + # This migration is irreversible + end + + private + + def membership + @membership ||= define_batchable_model('members') + end + + def query_condition + 'invite_token IS NULL and invite_accepted_at IS NOT NULL AND user_id IS NULL' + end +end diff --git a/db/post_migrate/20220830071704_remove_temporary_index_for_orphaned_invited_members.rb b/db/post_migrate/20220830071704_remove_temporary_index_for_orphaned_invited_members.rb new file mode 100644 index 00000000000..c6b712da4c0 --- /dev/null +++ b/db/post_migrate/20220830071704_remove_temporary_index_for_orphaned_invited_members.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class RemoveTemporaryIndexForOrphanedInvitedMembers < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TMP_INDEX_NAME = 'tmp_idx_orphaned_invited_members' + + def up + remove_concurrent_index_by_name('members', TMP_INDEX_NAME) if index_exists_by_name?('members', TMP_INDEX_NAME) + end + + def down + add_concurrent_index('members', :id, where: query_condition, name: TMP_INDEX_NAME) + end + + private + + def query_condition + 'invite_token IS NULL and invite_accepted_at IS NOT NULL AND user_id IS NULL' + end +end diff --git a/db/post_migrate/20220830172142_reschedule_issue_work_item_type_id_backfill.rb b/db/post_migrate/20220830172142_reschedule_issue_work_item_type_id_backfill.rb new file mode 100644 index 00000000000..5495f0e53b4 --- /dev/null +++ b/db/post_migrate/20220830172142_reschedule_issue_work_item_type_id_backfill.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +class RescheduleIssueWorkItemTypeIdBackfill < Gitlab::Database::Migration[2.0] + MIGRATION = 'BackfillWorkItemTypeIdForIssues' + BATCH_SIZE = 10_000 + MAX_BATCH_SIZE = 30_000 + SUB_BATCH_SIZE = 100 + INTERVAL = 1.minute + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + class MigrationWorkItemType < MigrationRecord + self.table_name = 'work_item_types' + + def self.id_by_type + where(namespace_id: nil).order(:base_type).pluck(:base_type, :id).to_h + end + end + + def up + # We expect no more than 5 types. Only 3 of them are expected to have associated issues at the moment + MigrationWorkItemType.id_by_type.each do |base_type, type_id| + queue_batched_background_migration( + MIGRATION, + :issues, + :id, + base_type, + type_id, + job_interval: INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + end + + def down + Gitlab::Database::BackgroundMigration::BatchedMigration.where(job_class_name: MIGRATION).delete_all + end +end diff --git a/db/post_migrate/20220831021358_add_index_on_issue_health_status.rb b/db/post_migrate/20220831021358_add_index_on_issue_health_status.rb new file mode 100644 index 00000000000..940bf6b5c38 --- /dev/null +++ b/db/post_migrate/20220831021358_add_index_on_issue_health_status.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddIndexOnIssueHealthStatus < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TABLE_NAME = :issues + INDEX_NAME = 'index_issues_on_project_id_health_status_created_at_id' + + def up + add_concurrent_index TABLE_NAME, [:project_id, :health_status, :created_at, :id], name: INDEX_NAME + end + + def down + remove_concurrent_index TABLE_NAME, [:project_id, :health_status, :created_at, :id], name: INDEX_NAME + end +end diff --git a/db/post_migrate/20220831132802_delete_approval_rules_for_vulnerability.rb b/db/post_migrate/20220831132802_delete_approval_rules_for_vulnerability.rb new file mode 100644 index 00000000000..b29678f1826 --- /dev/null +++ b/db/post_migrate/20220831132802_delete_approval_rules_for_vulnerability.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +class DeleteApprovalRulesForVulnerability < Gitlab::Database::Migration[2.0] + restrict_gitlab_migration gitlab_schema: :gitlab_main + disable_ddl_transaction! + + BATCH_SIZE = 500 + MAX_BATCH_SIZE = 1_000 + SUB_BATCH_SIZE = 10 + MIGRATION = 'DeleteApprovalRulesWithVulnerability' + INTERVAL = 2.minutes + + def up + return unless Gitlab.ee? + + queue_batched_background_migration( + MIGRATION, + :approval_project_rules, + :id, + job_interval: INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + + queue_batched_background_migration( + MIGRATION, + :approval_merge_request_rules, + :id, + job_interval: INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + # the data deleted is related to a feature removed in 15.0: https://gitlab.com/gitlab-org/gitlab/-/issues/357300 + delete_batched_background_migration(MIGRATION, :approval_project_rules, :id, []) + delete_batched_background_migration(MIGRATION, :approval_merge_request_rules, :id, []) + end +end diff --git a/db/post_migrate/20220901035725_schedule_destroy_invalid_project_members.rb b/db/post_migrate/20220901035725_schedule_destroy_invalid_project_members.rb new file mode 100644 index 00000000000..bc90232f855 --- /dev/null +++ b/db/post_migrate/20220901035725_schedule_destroy_invalid_project_members.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class ScheduleDestroyInvalidProjectMembers < Gitlab::Database::Migration[2.0] + MIGRATION = 'DestroyInvalidProjectMembers' + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 50_000 + MAX_BATCH_SIZE = 100_000 + SUB_BATCH_SIZE = 200 + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :members, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE, + gitlab_schema: :gitlab_main + ) + end + + def down + delete_batched_background_migration(MIGRATION, :members, :id, []) + end +end diff --git a/db/post_migrate/20220901071310_add_tmp_index_user_callouts_on_attention_request_feature_names.rb b/db/post_migrate/20220901071310_add_tmp_index_user_callouts_on_attention_request_feature_names.rb new file mode 100644 index 00000000000..10b339b90c1 --- /dev/null +++ b/db/post_migrate/20220901071310_add_tmp_index_user_callouts_on_attention_request_feature_names.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddTmpIndexUserCalloutsOnAttentionRequestFeatureNames < Gitlab::Database::Migration[2.0] + INDEX_NAME = "tmp_index_user_callouts_on_attention_request_feature_names" + ATTENTION_REQUEST_CALLOUTS = [47, 48] + + disable_ddl_transaction! + + def up + add_concurrent_index :user_callouts, [:id], + where: "feature_name IN (#{ATTENTION_REQUEST_CALLOUTS.join(',')})", + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :user_callouts, INDEX_NAME + end +end diff --git a/db/post_migrate/20220901071355_cleanup_attention_request_user_callouts.rb b/db/post_migrate/20220901071355_cleanup_attention_request_user_callouts.rb new file mode 100644 index 00000000000..cbd0d120bb8 --- /dev/null +++ b/db/post_migrate/20220901071355_cleanup_attention_request_user_callouts.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true +class CleanupAttentionRequestUserCallouts < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + ATTENTION_REQUEST_CALLOUTS = [47, 48] + # 47 and 48 were removed with https://gitlab.com/gitlab-org/gitlab/-/merge_requests/95446 + + def up + define_batchable_model('user_callouts') + .where(feature_name: ATTENTION_REQUEST_CALLOUTS) + .each_batch { |batch| batch.delete_all } # rubocop:disable Style/SymbolProc + end + + def down + # Attention request feature has been reverted. + end +end diff --git a/db/post_migrate/20220901073300_remove_partial_trigram_indexes_for_issues.rb b/db/post_migrate/20220901073300_remove_partial_trigram_indexes_for_issues.rb new file mode 100644 index 00000000000..096b74bc1c6 --- /dev/null +++ b/db/post_migrate/20220901073300_remove_partial_trigram_indexes_for_issues.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class RemovePartialTrigramIndexesForIssues < Gitlab::Database::Migration[2.0] + TITLE_INDEX_NAME = 'index_issues_on_title_trigram_non_latin' + DESCRIPTION_INDEX_NAME = 'index_issues_on_description_trigram_non_latin' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :issues, TITLE_INDEX_NAME + remove_concurrent_index_by_name :issues, DESCRIPTION_INDEX_NAME + end + + def down + add_concurrent_index :issues, :title, + name: TITLE_INDEX_NAME, + using: :gin, opclass: { description: :gin_trgm_ops }, + where: "title NOT SIMILAR TO '[\\u0000-\\u218F]*' OR description NOT SIMILAR TO '[\\u0000-\\u218F]*'" + + add_concurrent_index :issues, :description, + name: DESCRIPTION_INDEX_NAME, + using: :gin, opclass: { description: :gin_trgm_ops }, + where: "title NOT SIMILAR TO '[\\u0000-\\u218F]*' OR description NOT SIMILAR TO '[\\u0000-\\u218F]*'" + end +end diff --git a/db/post_migrate/20220901184106_add_not_null_to_board_group_recent_visits.rb b/db/post_migrate/20220901184106_add_not_null_to_board_group_recent_visits.rb new file mode 100644 index 00000000000..1dead32efb6 --- /dev/null +++ b/db/post_migrate/20220901184106_add_not_null_to_board_group_recent_visits.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddNotNullToBoardGroupRecentVisits < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_not_null_constraint :board_group_recent_visits, :user_id, validate: false + add_not_null_constraint :board_group_recent_visits, :group_id, validate: false + add_not_null_constraint :board_group_recent_visits, :board_id, validate: false + end + + def down + remove_not_null_constraint :board_group_recent_visits, :user_id + remove_not_null_constraint :board_group_recent_visits, :board_id + remove_not_null_constraint :board_group_recent_visits, :group_id + end +end diff --git a/db/post_migrate/20220901184246_add_not_null_to_board_project_recent_visits.rb b/db/post_migrate/20220901184246_add_not_null_to_board_project_recent_visits.rb new file mode 100644 index 00000000000..4f0cb4d3d68 --- /dev/null +++ b/db/post_migrate/20220901184246_add_not_null_to_board_project_recent_visits.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddNotNullToBoardProjectRecentVisits < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + add_not_null_constraint :board_project_recent_visits, :user_id, validate: false + add_not_null_constraint :board_project_recent_visits, :project_id, validate: false + add_not_null_constraint :board_project_recent_visits, :board_id, validate: false + end + + def down + remove_not_null_constraint :board_project_recent_visits, :user_id + remove_not_null_constraint :board_project_recent_visits, :project_id + remove_not_null_constraint :board_project_recent_visits, :board_id + end +end diff --git a/db/post_migrate/20220902111016_delete_null_records_from_board_group_recent_visits.rb b/db/post_migrate/20220902111016_delete_null_records_from_board_group_recent_visits.rb new file mode 100644 index 00000000000..4b55ecc013d --- /dev/null +++ b/db/post_migrate/20220902111016_delete_null_records_from_board_group_recent_visits.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class DeleteNullRecordsFromBoardGroupRecentVisits < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + execute('DELETE FROM board_group_recent_visits WHERE user_id is null OR group_id is null OR board_id is null') + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20220902111038_delete_null_records_from_board_project_recent_visits.rb b/db/post_migrate/20220902111038_delete_null_records_from_board_project_recent_visits.rb new file mode 100644 index 00000000000..bb261f80f73 --- /dev/null +++ b/db/post_migrate/20220902111038_delete_null_records_from_board_project_recent_visits.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class DeleteNullRecordsFromBoardProjectRecentVisits < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + execute('DELETE FROM board_project_recent_visits WHERE user_id is null OR project_id is null OR board_id is null') + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20220902204048_move_security_findings_table_to_gitlab_partitions_dynamic_schema.rb b/db/post_migrate/20220902204048_move_security_findings_table_to_gitlab_partitions_dynamic_schema.rb new file mode 100644 index 00000000000..7b80b6a15bd --- /dev/null +++ b/db/post_migrate/20220902204048_move_security_findings_table_to_gitlab_partitions_dynamic_schema.rb @@ -0,0 +1,232 @@ +# frozen_string_literal: true + +# rubocop:disable Migration/WithLockRetriesDisallowedMethod +class MoveSecurityFindingsTableToGitlabPartitionsDynamicSchema < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_MAPPING_OF_PARTITION = { + index_security_findings_on_unique_columns: :security_findings_1_uuid_scan_id_partition_number_idx, + index_security_findings_on_confidence: :security_findings_1_confidence_idx, + index_security_findings_on_project_fingerprint: :security_findings_1_project_fingerprint_idx, + index_security_findings_on_scan_id_and_deduplicated: :security_findings_1_scan_id_deduplicated_idx, + index_security_findings_on_scan_id_and_id: :security_findings_1_scan_id_id_idx, + index_security_findings_on_scanner_id: :security_findings_1_scanner_id_idx, + index_security_findings_on_severity: :security_findings_1_severity_idx + }.freeze + + INDEX_MAPPING_AFTER_CREATING_FROM_PARTITION = { + partition_name_placeholder_pkey: :security_findings_pkey, + partition_name_placeholder_uuid_scan_id_partition_number_idx: :index_security_findings_on_unique_columns, + partition_name_placeholder_confidence_idx: :index_security_findings_on_confidence, + partition_name_placeholder_project_fingerprint_idx: :index_security_findings_on_project_fingerprint, + partition_name_placeholder_scan_id_deduplicated_idx: :index_security_findings_on_scan_id_and_deduplicated, + partition_name_placeholder_scan_id_id_idx: :index_security_findings_on_scan_id_and_id, + partition_name_placeholder_scanner_id_idx: :index_security_findings_on_scanner_id, + partition_name_placeholder_severity_idx: :index_security_findings_on_severity + }.freeze + + INDEX_MAPPING_AFTER_CREATING_FROM_ITSELF = { + security_findings_pkey1: :security_findings_pkey, + security_findings_uuid_scan_id_partition_number_idx1: :index_security_findings_on_unique_columns, + security_findings_confidence_idx1: :index_security_findings_on_confidence, + security_findings_project_fingerprint_idx1: :index_security_findings_on_project_fingerprint, + security_findings_scan_id_deduplicated_idx1: :index_security_findings_on_scan_id_and_deduplicated, + security_findings_scan_id_id_idx1: :index_security_findings_on_scan_id_and_id, + security_findings_scanner_id_idx1: :index_security_findings_on_scanner_id, + security_findings_severity_idx1: :index_security_findings_on_severity + }.freeze + + LATEST_PARTITION_SQL = <<~SQL + SELECT + partitions.relname AS partition_name + FROM pg_inherits + JOIN pg_class parent ON pg_inherits.inhparent = parent.oid + JOIN pg_class partitions ON pg_inherits.inhrelid = partitions.oid + WHERE + parent.relname = 'security_findings' + ORDER BY (regexp_matches(partitions.relname, 'security_findings_(\\d+)'))[1]::int DESC + LIMIT 1 + SQL + + CURRENT_CHECK_CONSTRAINT_SQL = <<~SQL + SELECT + pg_get_constraintdef(pg_catalog.pg_constraint.oid) + FROM + pg_catalog.pg_constraint + INNER JOIN pg_class ON pg_class.oid = pg_catalog.pg_constraint.conrelid + WHERE + conname = 'check_partition_number' AND + pg_class.relname = 'security_findings' + SQL + + def up + with_lock_retries do + lock_tables + + execute(<<~SQL) + ALTER TABLE security_findings RENAME TO security_findings_#{candidate_partition_number}; + SQL + + execute(<<~SQL) + ALTER INDEX security_findings_pkey RENAME TO security_findings_#{candidate_partition_number}_pkey; + SQL + + execute(<<~SQL) + CREATE TABLE security_findings ( + LIKE security_findings_#{candidate_partition_number} INCLUDING ALL + ) PARTITION BY LIST (partition_number); + SQL + + execute(<<~SQL) + ALTER SEQUENCE security_findings_id_seq OWNED BY #{connection.current_schema}.security_findings.id; + SQL + + execute(<<~SQL) + ALTER TABLE security_findings + ADD CONSTRAINT fk_rails_729b763a54 FOREIGN KEY (scanner_id) REFERENCES vulnerability_scanners(id) ON DELETE CASCADE; + SQL + + execute(<<~SQL) + ALTER TABLE security_findings + ADD CONSTRAINT fk_rails_bb63863cf1 FOREIGN KEY (scan_id) REFERENCES security_scans(id) ON DELETE CASCADE; + SQL + + execute(<<~SQL) + ALTER TABLE security_findings_#{candidate_partition_number} SET SCHEMA gitlab_partitions_dynamic; + SQL + + execute(<<~SQL) + ALTER TABLE security_findings ATTACH PARTITION gitlab_partitions_dynamic.security_findings_#{candidate_partition_number} FOR VALUES IN (#{candidate_partition_number}); + SQL + + execute(<<~SQL) + ALTER TABLE security_findings DROP CONSTRAINT check_partition_number; + SQL + + index_mapping = INDEX_MAPPING_OF_PARTITION.transform_values do |value| + value.to_s.sub('partition_name_placeholder', "security_findings_#{candidate_partition_number}") + end + + rename_indices('gitlab_partitions_dynamic', index_mapping) + end + end + + def down + # If there is already a partition for the `security_findings` table, + # we can promote that table to be the original one to save the data. + # Otherwise, we have to bring back the non-partitioned `security_findings` + # table from the partitioned one. + if latest_partition + create_non_partitioned_security_findings_with_data + else + create_non_partitioned_security_findings_without_data + end + end + + private + + def lock_tables + execute(<<~SQL) + LOCK TABLE vulnerability_scanners, security_scans, security_findings IN ACCESS EXCLUSIVE MODE + SQL + end + + def current_check_constraint + execute(CURRENT_CHECK_CONSTRAINT_SQL).first['pg_get_constraintdef'] + end + + def candidate_partition_number + @candidate_partition_number ||= current_check_constraint.match(/partition_number\s?=\s?(\d+)/).captures.first + end + + def latest_partition + @latest_partition ||= execute(LATEST_PARTITION_SQL).first&.fetch('partition_name', nil) + end + + def latest_partition_number + latest_partition.match(/security_findings_(\d+)/).captures.first + end + + # rubocop:disable Migration/DropTable (These methods are called from the `down` method) + def create_non_partitioned_security_findings_with_data + with_lock_retries do + lock_tables + + execute(<<~SQL) + ALTER TABLE security_findings DETACH PARTITION gitlab_partitions_dynamic.#{latest_partition}; + SQL + + execute(<<~SQL) + ALTER TABLE gitlab_partitions_dynamic.#{latest_partition} SET SCHEMA #{connection.current_schema}; + SQL + + execute(<<~SQL) + ALTER SEQUENCE security_findings_id_seq OWNED BY #{latest_partition}.id; + SQL + + execute(<<~SQL) + DROP TABLE security_findings; + SQL + + execute(<<~SQL) + ALTER TABLE #{latest_partition} RENAME TO security_findings; + SQL + + index_mapping = INDEX_MAPPING_AFTER_CREATING_FROM_PARTITION.transform_keys do |key| + key.to_s.sub('partition_name_placeholder', latest_partition) + end + + rename_indices(connection.current_schema, index_mapping) + end + + add_check_constraint(:security_findings, "(partition_number = #{latest_partition_number})", :check_partition_number) + end + + def create_non_partitioned_security_findings_without_data + with_lock_retries do + lock_tables + + execute(<<~SQL) + ALTER TABLE security_findings RENAME TO security_findings_1; + SQL + + execute(<<~SQL) + CREATE TABLE security_findings ( + LIKE security_findings_1 INCLUDING ALL + ); + SQL + + execute(<<~SQL) + ALTER SEQUENCE security_findings_id_seq OWNED BY #{connection.current_schema}.security_findings.id; + SQL + + execute(<<~SQL) + DROP TABLE security_findings_1; + SQL + + execute(<<~SQL) + ALTER TABLE ONLY security_findings + ADD CONSTRAINT fk_rails_729b763a54 FOREIGN KEY (scanner_id) REFERENCES vulnerability_scanners(id) ON DELETE CASCADE; + SQL + + execute(<<~SQL) + ALTER TABLE ONLY security_findings + ADD CONSTRAINT fk_rails_bb63863cf1 FOREIGN KEY (scan_id) REFERENCES security_scans(id) ON DELETE CASCADE; + SQL + + rename_indices(connection.current_schema, INDEX_MAPPING_AFTER_CREATING_FROM_ITSELF) + end + + add_check_constraint(:security_findings, "(partition_number = 1)", :check_partition_number) + end + + def rename_indices(schema, mapping) + mapping.each do |index_name, new_index_name| + execute(<<~SQL) + ALTER INDEX #{schema}.#{index_name} RENAME TO #{new_index_name}; + SQL + end + end + # rubocop:enable Migration/DropTable +end +# rubocop:enable Migration/WithLockRetriesDisallowedMethod diff --git a/db/post_migrate/20220904173342_validate_not_null_constraint_board_group_recent_visits.rb b/db/post_migrate/20220904173342_validate_not_null_constraint_board_group_recent_visits.rb new file mode 100644 index 00000000000..0e5a504d0eb --- /dev/null +++ b/db/post_migrate/20220904173342_validate_not_null_constraint_board_group_recent_visits.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ValidateNotNullConstraintBoardGroupRecentVisits < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + validate_not_null_constraint :board_group_recent_visits, :user_id + validate_not_null_constraint :board_group_recent_visits, :group_id + validate_not_null_constraint :board_group_recent_visits, :board_id + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20220904173430_validate_not_null_constraint_board_project_recent_visits.rb b/db/post_migrate/20220904173430_validate_not_null_constraint_board_project_recent_visits.rb new file mode 100644 index 00000000000..ff73a179f69 --- /dev/null +++ b/db/post_migrate/20220904173430_validate_not_null_constraint_board_project_recent_visits.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ValidateNotNullConstraintBoardProjectRecentVisits < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + validate_not_null_constraint :board_project_recent_visits, :user_id + validate_not_null_constraint :board_project_recent_visits, :project_id + validate_not_null_constraint :board_project_recent_visits, :board_id + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20220905090300_add_tmp_index_merge_request_reviewers_attention_request_state.rb b/db/post_migrate/20220905090300_add_tmp_index_merge_request_reviewers_attention_request_state.rb new file mode 100644 index 00000000000..e192f76484c --- /dev/null +++ b/db/post_migrate/20220905090300_add_tmp_index_merge_request_reviewers_attention_request_state.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class AddTmpIndexMergeRequestReviewersAttentionRequestState < Gitlab::Database::Migration[2.0] + INDEX_NAME = "tmp_index_merge_request_reviewers_on_attention_requested_state" + ATTENTION_REQUESTED_STATE = 2 + + disable_ddl_transaction! + + def up + add_concurrent_index :merge_request_reviewers, [:id], + where: "state = #{ATTENTION_REQUESTED_STATE}", + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :merge_request_reviewers, INDEX_NAME + end +end diff --git a/db/post_migrate/20220905090339_reset_attention_requested_merge_requests_reviewers_state_to_unreviewed.rb b/db/post_migrate/20220905090339_reset_attention_requested_merge_requests_reviewers_state_to_unreviewed.rb new file mode 100644 index 00000000000..d335095e674 --- /dev/null +++ b/db/post_migrate/20220905090339_reset_attention_requested_merge_requests_reviewers_state_to_unreviewed.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class ResetAttentionRequestedMergeRequestsReviewersStateToUnreviewed < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + BATCH_SIZE = 500 + + class MergeRequestReviewer < MigrationRecord + self.table_name = 'merge_request_reviewers' + + enum state: { + unreviewed: 0, + reviewed: 1, + attention_requested: 2 + } + + include ::EachBatch + end + + def up + MergeRequestReviewer + .where(state: MergeRequestReviewer.states['attention_requested']) + .each_batch(of: BATCH_SIZE) { |batch| batch.update_all(state: MergeRequestReviewer.states['unreviewed']) } + end + + def down + # no op + end +end diff --git a/db/post_migrate/20220905112710_add_async_index_to_todos_to_cover_pending_query.rb b/db/post_migrate/20220905112710_add_async_index_to_todos_to_cover_pending_query.rb new file mode 100644 index 00000000000..e2bca2fae1a --- /dev/null +++ b/db/post_migrate/20220905112710_add_async_index_to_todos_to_cover_pending_query.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddAsyncIndexToTodosToCoverPendingQuery < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_on_todos_user_project_target_and_state' + COLUMNS = %i[user_id project_id target_type target_id id].freeze + + def up + prepare_async_index :todos, COLUMNS, name: INDEX_NAME, where: "state = 'pending'" + end + + def down + unprepare_async_index :todos, COLUMNS, name: INDEX_NAME, where: "state='pending'" + end +end diff --git a/db/post_migrate/20220906074449_schedule_disable_legacy_open_source_license_for_projects_less_than_one_mb.rb b/db/post_migrate/20220906074449_schedule_disable_legacy_open_source_license_for_projects_less_than_one_mb.rb new file mode 100644 index 00000000000..ee48ace13e0 --- /dev/null +++ b/db/post_migrate/20220906074449_schedule_disable_legacy_open_source_license_for_projects_less_than_one_mb.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class ScheduleDisableLegacyOpenSourceLicenseForProjectsLessThanOneMb < Gitlab::Database::Migration[2.0] + MIGRATION = 'DisableLegacyOpenSourceLicenseForProjectsLessThanOneMb' + INTERVAL = 2.minutes + BATCH_SIZE = 4_000 + MAX_BATCH_SIZE = 50_000 + SUB_BATCH_SIZE = 250 + + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + return unless Gitlab.com? + + queue_batched_background_migration( + MIGRATION, + :project_settings, + :project_id, + job_interval: INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + return unless Gitlab.com? + + delete_batched_background_migration(MIGRATION, :project_settings, :project_id, []) + end +end diff --git a/db/post_migrate/20220906212931_add_partial_index_for_ci_pipeline_artifacts_unlocked_with_expire_at.rb b/db/post_migrate/20220906212931_add_partial_index_for_ci_pipeline_artifacts_unlocked_with_expire_at.rb new file mode 100644 index 00000000000..a24187dd56b --- /dev/null +++ b/db/post_migrate/20220906212931_add_partial_index_for_ci_pipeline_artifacts_unlocked_with_expire_at.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddPartialIndexForCiPipelineArtifactsUnlockedWithExpireAt < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + TABLE_NAME = 'ci_pipeline_artifacts' + INDEX_NAME = 'ci_pipeline_artifacts_on_expire_at_for_removal' + CONDITIONS = 'locked = 0 AND expire_at IS NOT NULL' + + def up + add_concurrent_index TABLE_NAME, [:expire_at], where: CONDITIONS, name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end +end diff --git a/db/post_migrate/20220908125146_remove_free_user_cap_remediation_worker.rb b/db/post_migrate/20220908125146_remove_free_user_cap_remediation_worker.rb new file mode 100644 index 00000000000..e95ea9c58b4 --- /dev/null +++ b/db/post_migrate/20220908125146_remove_free_user_cap_remediation_worker.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class RemoveFreeUserCapRemediationWorker < Gitlab::Database::Migration[2.0] + def up + Sidekiq::Cron::Job.find('free_user_cap_data_remediation')&.destroy + end + + def down + # no-op + end +end diff --git a/db/post_migrate/20220909114220_drop_environments_project_name_lower_pattern_ops_index.rb b/db/post_migrate/20220909114220_drop_environments_project_name_lower_pattern_ops_index.rb new file mode 100644 index 00000000000..3ab71809039 --- /dev/null +++ b/db/post_migrate/20220909114220_drop_environments_project_name_lower_pattern_ops_index.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# reverts db/migrate/20220901131828_add_environments_project_name_lower_pattern_ops_index.rb +class DropEnvironmentsProjectNameLowerPatternOpsIndex < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_environments_on_project_name_varchar_pattern_ops' + + def up + remove_concurrent_index_by_name :environments, INDEX_NAME + end + + def down + add_concurrent_index :environments, 'project_id, lower(name) varchar_pattern_ops', name: INDEX_NAME + end +end diff --git a/db/post_migrate/20220912085047_add_index_to_todos_pending_query.rb b/db/post_migrate/20220912085047_add_index_to_todos_pending_query.rb new file mode 100644 index 00000000000..7d721421463 --- /dev/null +++ b/db/post_migrate/20220912085047_add_index_to_todos_pending_query.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddIndexToTodosPendingQuery < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_on_todos_user_project_target_and_state' + COLUMNS = %i[user_id project_id target_type target_id id].freeze + + def up + add_concurrent_index :todos, COLUMNS, name: INDEX_NAME, where: "state = 'pending'" + end + + def down + remove_concurrent_index_by_name :todos, INDEX_NAME + end +end diff --git a/db/post_migrate/20220912110433_prepare_create_internal_notes_index_on_id.rb b/db/post_migrate/20220912110433_prepare_create_internal_notes_index_on_id.rb new file mode 100644 index 00000000000..241bdfa4715 --- /dev/null +++ b/db/post_migrate/20220912110433_prepare_create_internal_notes_index_on_id.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class PrepareCreateInternalNotesIndexOnId < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'index_notes_on_id_where_internal' + + def up + prepare_async_index :notes, :id, where: 'internal = true', name: INDEX_NAME + end + + def down + unprepare_async_index_by_name :notes, INDEX_NAME + end +end diff --git a/db/post_migrate/20220913030552_add_tmp_index_system_note_metadata_on_attention_request_actions.rb b/db/post_migrate/20220913030552_add_tmp_index_system_note_metadata_on_attention_request_actions.rb new file mode 100644 index 00000000000..3418dabc0e9 --- /dev/null +++ b/db/post_migrate/20220913030552_add_tmp_index_system_note_metadata_on_attention_request_actions.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddTmpIndexSystemNoteMetadataOnAttentionRequestActions < Gitlab::Database::Migration[2.0] + INDEX_NAME = "tmp_index_system_note_metadata_on_attention_request_actions" + + disable_ddl_transaction! + + def up + add_concurrent_index :system_note_metadata, [:id], + where: "action IN ('attention_requested', 'attention_request_removed')", + name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name :system_note_metadata, INDEX_NAME + end +end diff --git a/db/post_migrate/20220913030624_cleanup_attention_request_related_system_notes.rb b/db/post_migrate/20220913030624_cleanup_attention_request_related_system_notes.rb new file mode 100644 index 00000000000..b7d6908696b --- /dev/null +++ b/db/post_migrate/20220913030624_cleanup_attention_request_related_system_notes.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class CleanupAttentionRequestRelatedSystemNotes < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + BATCH_SIZE = 100 + + class SystemNoteMetadata < MigrationRecord + include EachBatch + + self.table_name = 'system_note_metadata' + end + + class Note < MigrationRecord + self.table_name = 'notes' + end + + def up + SystemNoteMetadata + .where(action: %w[attention_requested attention_request_removed]) + .each_batch(of: BATCH_SIZE) do |batch| + Note.where(id: batch.pluck(:note_id)).delete_all + end + end + + def down + # no op + end +end diff --git a/db/post_migrate/20220913082728_drop_index_cadence_create_iterations_automation.rb b/db/post_migrate/20220913082728_drop_index_cadence_create_iterations_automation.rb new file mode 100644 index 00000000000..8b961bc1c7e --- /dev/null +++ b/db/post_migrate/20220913082728_drop_index_cadence_create_iterations_automation.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class DropIndexCadenceCreateIterationsAutomation < Gitlab::Database::Migration[2.0] + INDEX_NAME = 'cadence_create_iterations_automation' + + disable_ddl_transaction! + + def up + remove_concurrent_index_by_name :iterations_cadences, INDEX_NAME + end + + def down + execute( + <<-SQL + CREATE INDEX CONCURRENTLY #{INDEX_NAME} ON iterations_cadences + USING BTREE(automatic, duration_in_weeks, (DATE ((COALESCE("iterations_cadences"."last_run_date", DATE('01-01-1970')) + "iterations_cadences"."duration_in_weeks" * INTERVAL '1 week')))) + WHERE duration_in_weeks IS NOT NULL + SQL + ) + end +end diff --git a/db/post_migrate/20220913083015_clean_up_rename_iterations_cadences_last_run_date_to_next_run_date.rb b/db/post_migrate/20220913083015_clean_up_rename_iterations_cadences_last_run_date_to_next_run_date.rb new file mode 100644 index 00000000000..7618e1841bd --- /dev/null +++ b/db/post_migrate/20220913083015_clean_up_rename_iterations_cadences_last_run_date_to_next_run_date.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class CleanUpRenameIterationsCadencesLastRunDateToNextRunDate < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + cleanup_concurrent_column_rename :iterations_cadences, :last_run_date, :next_run_date + end + + def down + undo_cleanup_concurrent_column_rename :iterations_cadences, :last_run_date, :next_run_date + end +end diff --git a/db/post_migrate/20220914093408_add_unique_id_partition_id_index_to_ci_build_metadata.rb b/db/post_migrate/20220914093408_add_unique_id_partition_id_index_to_ci_build_metadata.rb new file mode 100644 index 00000000000..1f40118c809 --- /dev/null +++ b/db/post_migrate/20220914093408_add_unique_id_partition_id_index_to_ci_build_metadata.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddUniqueIdPartitionIdIndexToCiBuildMetadata < Gitlab::Database::Migration[2.0] + TABLE_NAME = :ci_builds_metadata + INDEX_NAME = :index_ci_builds_metadata_on_id_partition_id_unique + + def up + prepare_async_index(TABLE_NAME, %i[id partition_id], unique: true, name: INDEX_NAME) + end + + def down + unprepare_async_index(:ci_builds_metadata, %i[id partition_id], name: INDEX_NAME) + end +end diff --git a/db/post_migrate/20220915103831_add_unique_build_id_partition_id_index_to_ci_build_metadata.rb b/db/post_migrate/20220915103831_add_unique_build_id_partition_id_index_to_ci_build_metadata.rb new file mode 100644 index 00000000000..74b60390057 --- /dev/null +++ b/db/post_migrate/20220915103831_add_unique_build_id_partition_id_index_to_ci_build_metadata.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddUniqueBuildIdPartitionIdIndexToCiBuildMetadata < Gitlab::Database::Migration[2.0] + TABLE_NAME = :ci_builds_metadata + INDEX_NAME = :index_ci_builds_metadata_on_build_id_partition_id_unique + + def up + prepare_async_index(TABLE_NAME, %i[build_id partition_id], unique: true, name: INDEX_NAME) + end + + def down + unprepare_async_index(:ci_builds_metadata, %i[build_id partition_id], name: INDEX_NAME) + end +end diff --git a/db/post_migrate/20220916112841_remove_unused_aggregation_columns.rb b/db/post_migrate/20220916112841_remove_unused_aggregation_columns.rb new file mode 100644 index 00000000000..f5333c84042 --- /dev/null +++ b/db/post_migrate/20220916112841_remove_unused_aggregation_columns.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +class RemoveUnusedAggregationColumns < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + def up + with_lock_retries do + remove_column :analytics_cycle_analytics_aggregations, :last_full_run_processed_records + remove_column :analytics_cycle_analytics_aggregations, :last_full_run_runtimes_in_seconds + remove_column :analytics_cycle_analytics_aggregations, :last_full_run_issues_updated_at + remove_column :analytics_cycle_analytics_aggregations, :last_full_run_mrs_updated_at + remove_column :analytics_cycle_analytics_aggregations, :last_full_run_issues_id + remove_column :analytics_cycle_analytics_aggregations, :last_full_run_merge_requests_id + end + end + + def down + with_lock_retries do + add_column(:analytics_cycle_analytics_aggregations, + :last_full_run_processed_records, + :integer, + array: true, + default: [], + null: false, + if_not_exists: true) + add_column(:analytics_cycle_analytics_aggregations, + :last_full_run_runtimes_in_seconds, + :integer, + array: true, + default: [], + null: false, + if_not_exists: true) + add_column(:analytics_cycle_analytics_aggregations, + :last_full_run_issues_updated_at, + :datetime_with_timezone, + if_not_exists: true) + add_column(:analytics_cycle_analytics_aggregations, + :last_full_run_mrs_updated_at, + :datetime_with_timezone, + if_not_exists: true) + add_column(:analytics_cycle_analytics_aggregations, + :last_full_run_issues_id, + :integer, + if_not_exists: true) + add_column(:analytics_cycle_analytics_aggregations, + :last_full_run_merge_requests_id, + :integer, + if_not_exists: true) + end + + add_check_constraint(:analytics_cycle_analytics_aggregations, + 'CARDINALITY(last_full_run_runtimes_in_seconds) <= 10', + 'chk_rails_7810292ec9') + + add_check_constraint(:analytics_cycle_analytics_aggregations, + 'CARDINALITY(last_full_run_processed_records) <= 10', + 'chk_rails_8b9e89687c') + end +end diff --git a/db/schema_migrations/20220406193806 b/db/schema_migrations/20220406193806 new file mode 100644 index 00000000000..a5dfed18303 --- /dev/null +++ b/db/schema_migrations/20220406193806 @@ -0,0 +1 @@ +f2ed979f3af7aec03defc737add2e5d5bf4aad080d501003744ee42f902074d5 \ No newline at end of file diff --git a/db/schema_migrations/20220601110011 b/db/schema_migrations/20220601110011 new file mode 100644 index 00000000000..64c76649095 --- /dev/null +++ b/db/schema_migrations/20220601110011 @@ -0,0 +1 @@ +9dc41d0d5f1c87f27327b254c955eada4fcc5c6158c513128e6fbdadd6c34932 \ No newline at end of file diff --git a/db/schema_migrations/20220603125200 b/db/schema_migrations/20220603125200 new file mode 100644 index 00000000000..5da1d1992ab --- /dev/null +++ b/db/schema_migrations/20220603125200 @@ -0,0 +1 @@ +7631f2c1f9b2647ae6de47675305a2d5c1b213229c85b6f161412f83884bad87 \ No newline at end of file diff --git a/db/schema_migrations/20220606054503 b/db/schema_migrations/20220606054503 new file mode 100644 index 00000000000..1ec25932ece --- /dev/null +++ b/db/schema_migrations/20220606054503 @@ -0,0 +1 @@ +ed815f5e2766913ded3479c2cdc8a885ab7164ae280e309cba34394668392a2b \ No newline at end of file diff --git a/db/schema_migrations/20220606080509 b/db/schema_migrations/20220606080509 new file mode 100644 index 00000000000..7403068a8da --- /dev/null +++ b/db/schema_migrations/20220606080509 @@ -0,0 +1 @@ +3afc50d92878da71453cfb23ad29d16123e4986e3304aff62013f4655b065d38 \ No newline at end of file diff --git a/db/schema_migrations/20220615154500 b/db/schema_migrations/20220615154500 new file mode 100644 index 00000000000..36e35ec7d3a --- /dev/null +++ b/db/schema_migrations/20220615154500 @@ -0,0 +1 @@ +fd138239f6970b892fdb8190fb65b3364bb9ba5396100ba3d5d695eef6436dcf \ No newline at end of file diff --git a/db/schema_migrations/20220616171355 b/db/schema_migrations/20220616171355 new file mode 100644 index 00000000000..cd212025f70 --- /dev/null +++ b/db/schema_migrations/20220616171355 @@ -0,0 +1 @@ +63ec85b4f8b7eb15c232c4a25c1e63027c38c23caf81a89c4d05227a6be00e4b \ No newline at end of file diff --git a/db/schema_migrations/20220706145113 b/db/schema_migrations/20220706145113 new file mode 100644 index 00000000000..8ed19a92025 --- /dev/null +++ b/db/schema_migrations/20220706145113 @@ -0,0 +1 @@ +e37da383a2e69e5e3157180b33017fc64af6ee009fc3dd317ae69931d37c6350 \ No newline at end of file diff --git a/db/schema_migrations/20220707192420 b/db/schema_migrations/20220707192420 new file mode 100644 index 00000000000..2122f9ed954 --- /dev/null +++ b/db/schema_migrations/20220707192420 @@ -0,0 +1 @@ +b3d06405e0e0398579077d255901bed4b6f86f89a93dae8e97ddec9c2c496837 \ No newline at end of file diff --git a/db/schema_migrations/20220711142148 b/db/schema_migrations/20220711142148 new file mode 100644 index 00000000000..709ce89616a --- /dev/null +++ b/db/schema_migrations/20220711142148 @@ -0,0 +1 @@ +d7062e116066ac922d42f43ef8ee6783d6bc3a30d6c36b4d70788ce47bba076f \ No newline at end of file diff --git a/db/schema_migrations/20220726171440 b/db/schema_migrations/20220726171440 new file mode 100644 index 00000000000..3bd56cb8346 --- /dev/null +++ b/db/schema_migrations/20220726171440 @@ -0,0 +1 @@ +5fce175152ab9c954b35d612800b381634248fe0c02b5dfc06c4650b8df9e787 \ No newline at end of file diff --git a/db/schema_migrations/20220726171450 b/db/schema_migrations/20220726171450 new file mode 100644 index 00000000000..76a5597f9fe --- /dev/null +++ b/db/schema_migrations/20220726171450 @@ -0,0 +1 @@ +86d469a9dc2d22451728d310bd2b830c5cdb69033bdf6b5fe30d45c6c6b8ae4b \ No newline at end of file diff --git a/db/schema_migrations/20220726225114 b/db/schema_migrations/20220726225114 new file mode 100644 index 00000000000..32f1eb44d17 --- /dev/null +++ b/db/schema_migrations/20220726225114 @@ -0,0 +1 @@ +24e39665566d86ddca2bfc134fd37e11840edc9bc34add077e39fa7e5b8272d5 \ No newline at end of file diff --git a/db/schema_migrations/20220801155858 b/db/schema_migrations/20220801155858 new file mode 100644 index 00000000000..16e0ee3a0a4 --- /dev/null +++ b/db/schema_migrations/20220801155858 @@ -0,0 +1 @@ +aa09e7e3cdc7c7ee011b92a1ccbebdddefd9dfc2717af03a40073c6bc5be4001 \ No newline at end of file diff --git a/db/schema_migrations/20220803004853 b/db/schema_migrations/20220803004853 new file mode 100644 index 00000000000..59f9dcd0d50 --- /dev/null +++ b/db/schema_migrations/20220803004853 @@ -0,0 +1 @@ +39f8ae1258fa9cab98e5231d5adfe7fdf648b50fba29790aaa46786f2b2f6f04 \ No newline at end of file diff --git a/db/schema_migrations/20220803235114 b/db/schema_migrations/20220803235114 new file mode 100644 index 00000000000..469005b8bef --- /dev/null +++ b/db/schema_migrations/20220803235114 @@ -0,0 +1 @@ +a669aca9370ecd086b582164e68366ca459754b26e096301c2dc7121a7e9ab58 \ No newline at end of file diff --git a/db/schema_migrations/20220809002011 b/db/schema_migrations/20220809002011 new file mode 100644 index 00000000000..952c468b1cb --- /dev/null +++ b/db/schema_migrations/20220809002011 @@ -0,0 +1 @@ +12bc6c4a89c4362024d66a21690412f8946b8f6eaf9dc09cccaf8d54b7f45b17 \ No newline at end of file diff --git a/db/schema_migrations/20220809214730 b/db/schema_migrations/20220809214730 new file mode 100644 index 00000000000..0358f9b1798 --- /dev/null +++ b/db/schema_migrations/20220809214730 @@ -0,0 +1 @@ +ac9e478c7aaa351059d38dddf9a94eda7481a2bbcd4e9e5361fffb0c999be945 \ No newline at end of file diff --git a/db/schema_migrations/20220809223215 b/db/schema_migrations/20220809223215 new file mode 100644 index 00000000000..84f5e9314a5 --- /dev/null +++ b/db/schema_migrations/20220809223215 @@ -0,0 +1 @@ +1f383c2db106880e8a909b9292023ae099e224d733c87e356c61038bc84cf702 \ No newline at end of file diff --git a/db/schema_migrations/20220815061621 b/db/schema_migrations/20220815061621 new file mode 100644 index 00000000000..66fc6a68014 --- /dev/null +++ b/db/schema_migrations/20220815061621 @@ -0,0 +1 @@ +60a7782e9eaed833362e314fe3ae35f881ee051d9b529c59638833ce92d2db2d \ No newline at end of file diff --git a/db/schema_migrations/20220815152905 b/db/schema_migrations/20220815152905 new file mode 100644 index 00000000000..9e71fe96edc --- /dev/null +++ b/db/schema_migrations/20220815152905 @@ -0,0 +1 @@ +8494a4a9c708ddfc63d86891b83f01c0883d8b88ebea2177980780a381d74704 \ No newline at end of file diff --git a/db/schema_migrations/20220816075638 b/db/schema_migrations/20220816075638 new file mode 100644 index 00000000000..9f4e1fbc3ee --- /dev/null +++ b/db/schema_migrations/20220816075638 @@ -0,0 +1 @@ +78e03575edb66cfaeea75f2ff653efc77156ca9e0b1ea0fa989172c3caa0b195 \ No newline at end of file diff --git a/db/schema_migrations/20220816135816 b/db/schema_migrations/20220816135816 new file mode 100644 index 00000000000..ff2b64004dd --- /dev/null +++ b/db/schema_migrations/20220816135816 @@ -0,0 +1 @@ +47dcd45d2b9c35c4e3ca707d54a983e8321dd86b2b66d4bccca9001884bc6d13 \ No newline at end of file diff --git a/db/schema_migrations/20220816163444 b/db/schema_migrations/20220816163444 new file mode 100644 index 00000000000..83429df6a43 --- /dev/null +++ b/db/schema_migrations/20220816163444 @@ -0,0 +1 @@ +acb8985c03358890280d3a0bbd52215896461cfdd7b4379b488a0aa87ed8182f \ No newline at end of file diff --git a/db/schema_migrations/20220817122907 b/db/schema_migrations/20220817122907 new file mode 100644 index 00000000000..fb6951e19d5 --- /dev/null +++ b/db/schema_migrations/20220817122907 @@ -0,0 +1 @@ +4db4f50d2e23527516eccdeae60059803df7add21ca7a2c40f1670dba9744496 \ No newline at end of file diff --git a/db/schema_migrations/20220818095225 b/db/schema_migrations/20220818095225 new file mode 100644 index 00000000000..9f420931b9d --- /dev/null +++ b/db/schema_migrations/20220818095225 @@ -0,0 +1 @@ +ec31d14ce1a9f7b08985c2d304ab768a41139e81b694dcb1ec920623201504e6 \ No newline at end of file diff --git a/db/schema_migrations/20220818132108 b/db/schema_migrations/20220818132108 new file mode 100644 index 00000000000..77683e61f2e --- /dev/null +++ b/db/schema_migrations/20220818132108 @@ -0,0 +1 @@ +7abea29f31054d1e0337d3fa434f55cc1c354701da89e257c764b85cd2cc2768 \ No newline at end of file diff --git a/db/schema_migrations/20220819153725 b/db/schema_migrations/20220819153725 new file mode 100644 index 00000000000..617303214e4 --- /dev/null +++ b/db/schema_migrations/20220819153725 @@ -0,0 +1 @@ +5819791e71e9118680e24eceef92364c78ed51dda375db9902f693147ddd9765 \ No newline at end of file diff --git a/db/schema_migrations/20220819162852 b/db/schema_migrations/20220819162852 new file mode 100644 index 00000000000..b1d1fcb4c70 --- /dev/null +++ b/db/schema_migrations/20220819162852 @@ -0,0 +1 @@ +1e0109c4e1a0512864f3ed16d0a9bc82b40b5c6fb1586acaffe18191821df18f \ No newline at end of file diff --git a/db/schema_migrations/20220820221036 b/db/schema_migrations/20220820221036 new file mode 100644 index 00000000000..6f7c4059487 --- /dev/null +++ b/db/schema_migrations/20220820221036 @@ -0,0 +1 @@ +16825936e8e6a4f0a1f001a83ecf81f180ee2eb15589eebe821fee2706456cef \ No newline at end of file diff --git a/db/schema_migrations/20220822071909 b/db/schema_migrations/20220822071909 new file mode 100644 index 00000000000..fd8af68d1ee --- /dev/null +++ b/db/schema_migrations/20220822071909 @@ -0,0 +1 @@ +60a72830780190214d6c86fc2d07dc0fc138f6cc258689c1d106bb456b130047 \ No newline at end of file diff --git a/db/schema_migrations/20220822090656 b/db/schema_migrations/20220822090656 new file mode 100644 index 00000000000..bc1ec6d44b9 --- /dev/null +++ b/db/schema_migrations/20220822090656 @@ -0,0 +1 @@ +696550615046e26d4012d8b5a5fb741d85c23d4d0d08a4a781da0123c0543de1 \ No newline at end of file diff --git a/db/schema_migrations/20220822094804 b/db/schema_migrations/20220822094804 new file mode 100644 index 00000000000..6e4e3b0d5e1 --- /dev/null +++ b/db/schema_migrations/20220822094804 @@ -0,0 +1 @@ +035e918bcb674fdf1300a5bccbad87806311e6de8589f2db57d7af9cd0108ee9 \ No newline at end of file diff --git a/db/schema_migrations/20220822102651 b/db/schema_migrations/20220822102651 new file mode 100644 index 00000000000..851535d2924 --- /dev/null +++ b/db/schema_migrations/20220822102651 @@ -0,0 +1 @@ +2bf5f851ee8919f2306a36ae299cd3c30943d5cc3356981bab2091ff104ef127 \ No newline at end of file diff --git a/db/schema_migrations/20220822103638 b/db/schema_migrations/20220822103638 new file mode 100644 index 00000000000..5633f697b1b --- /dev/null +++ b/db/schema_migrations/20220822103638 @@ -0,0 +1 @@ +9aee5b0e3475736170d7169fd3c8ac9933d976ee69a2769dea29ee4bc553af27 \ No newline at end of file diff --git a/db/schema_migrations/20220823084747 b/db/schema_migrations/20220823084747 new file mode 100644 index 00000000000..d748dee5916 --- /dev/null +++ b/db/schema_migrations/20220823084747 @@ -0,0 +1 @@ +f192ab50bed6dd03ae9c9c51c89d870ad6d2d1cbae129ed2da31fc061b9901d4 \ No newline at end of file diff --git a/db/schema_migrations/20220824114218 b/db/schema_migrations/20220824114218 new file mode 100644 index 00000000000..bddb1a00d0b --- /dev/null +++ b/db/schema_migrations/20220824114218 @@ -0,0 +1 @@ +7674883ca0ee06d9e70841ca8e01a8e4e74eb5958797032a134afa6790699c86 \ No newline at end of file diff --git a/db/schema_migrations/20220824175648 b/db/schema_migrations/20220824175648 new file mode 100644 index 00000000000..7a54d9c2a41 --- /dev/null +++ b/db/schema_migrations/20220824175648 @@ -0,0 +1 @@ +5f2c56f9dd6f7ddbf34718f37fc9c37dfd9afeeae9cd2efb9fd465874b6ea8c0 \ No newline at end of file diff --git a/db/schema_migrations/20220824194103 b/db/schema_migrations/20220824194103 new file mode 100644 index 00000000000..388bc5dfe66 --- /dev/null +++ b/db/schema_migrations/20220824194103 @@ -0,0 +1 @@ +5bc756cf41923c2287c73e298d21ba49bae2ff6edad1629d078d192cb85dc5b8 \ No newline at end of file diff --git a/db/schema_migrations/20220825061250 b/db/schema_migrations/20220825061250 new file mode 100644 index 00000000000..62ce31a672a --- /dev/null +++ b/db/schema_migrations/20220825061250 @@ -0,0 +1 @@ +0338843ad56b423559e613f00df205122b4f6db194cf49712b2ff46b2ad030e0 \ No newline at end of file diff --git a/db/schema_migrations/20220825105631 b/db/schema_migrations/20220825105631 new file mode 100644 index 00000000000..6d6691cc6a4 --- /dev/null +++ b/db/schema_migrations/20220825105631 @@ -0,0 +1 @@ +2e5f7b79076a35fdb61aec46dea27d45f81e47c20f962f12b494fc7a8c714813 \ No newline at end of file diff --git a/db/schema_migrations/20220825134827 b/db/schema_migrations/20220825134827 new file mode 100644 index 00000000000..256a203e005 --- /dev/null +++ b/db/schema_migrations/20220825134827 @@ -0,0 +1 @@ +f70447919b6346e3bcdc029e1493166efd28ae562b94013d80ac280e19787e2a \ No newline at end of file diff --git a/db/schema_migrations/20220825142324 b/db/schema_migrations/20220825142324 new file mode 100644 index 00000000000..98f8863d3d7 --- /dev/null +++ b/db/schema_migrations/20220825142324 @@ -0,0 +1 @@ +9df1108b41fdb4546d4c62edffba2a386bcdf486749096b3fb49d289e5c9698d \ No newline at end of file diff --git a/db/schema_migrations/20220826165048 b/db/schema_migrations/20220826165048 new file mode 100644 index 00000000000..0539118356d --- /dev/null +++ b/db/schema_migrations/20220826165048 @@ -0,0 +1 @@ +75cb9d7b4a0bc8ad26b3bf6bf41a4414bcc4307607de058fc35fe4ece7009423 \ No newline at end of file diff --git a/db/schema_migrations/20220826175058 b/db/schema_migrations/20220826175058 new file mode 100644 index 00000000000..55449ae1047 --- /dev/null +++ b/db/schema_migrations/20220826175058 @@ -0,0 +1 @@ +2553878c425173fc41e64723814d4bca8f3f59f98479080e74a85f327412f3d4 \ No newline at end of file diff --git a/db/schema_migrations/20220828094411 b/db/schema_migrations/20220828094411 new file mode 100644 index 00000000000..50acfab59b9 --- /dev/null +++ b/db/schema_migrations/20220828094411 @@ -0,0 +1 @@ +7373697e5064a5ecca5881e7b98a30deba033bf8d79d2121cd17200f72815252 \ No newline at end of file diff --git a/db/schema_migrations/20220828131848 b/db/schema_migrations/20220828131848 new file mode 100644 index 00000000000..0cd8dbbebaa --- /dev/null +++ b/db/schema_migrations/20220828131848 @@ -0,0 +1 @@ +d38668a9110a69f12c4d60886ace04da4f6dd7f250763a888d3c428a74032b7d \ No newline at end of file diff --git a/db/schema_migrations/20220829183356 b/db/schema_migrations/20220829183356 new file mode 100644 index 00000000000..087a8a8ab6b --- /dev/null +++ b/db/schema_migrations/20220829183356 @@ -0,0 +1 @@ +4d8be5080046eff9c3736cd2494c02b2d2cb1eeea2753479617cb344bc5b1cbb \ No newline at end of file diff --git a/db/schema_migrations/20220830051704 b/db/schema_migrations/20220830051704 new file mode 100644 index 00000000000..5785862da4f --- /dev/null +++ b/db/schema_migrations/20220830051704 @@ -0,0 +1 @@ +aa0b767ad0e38500e0eef83d5c8306054952363166f8cc2076ce48feeac1b0e1 \ No newline at end of file diff --git a/db/schema_migrations/20220830061704 b/db/schema_migrations/20220830061704 new file mode 100644 index 00000000000..7a0db1acc65 --- /dev/null +++ b/db/schema_migrations/20220830061704 @@ -0,0 +1 @@ +badc3556e1dea545bbf8b55fb33065f45598df9b3fda74bffd28e89d7485e0b4 \ No newline at end of file diff --git a/db/schema_migrations/20220830071704 b/db/schema_migrations/20220830071704 new file mode 100644 index 00000000000..bc9d7fd0f8b --- /dev/null +++ b/db/schema_migrations/20220830071704 @@ -0,0 +1 @@ +85e401f0920c6eb13b6756f191ccdf70494ca40f8133f05bbd5f23ba295b115d \ No newline at end of file diff --git a/db/schema_migrations/20220830082928 b/db/schema_migrations/20220830082928 new file mode 100644 index 00000000000..9c7cf011ab7 --- /dev/null +++ b/db/schema_migrations/20220830082928 @@ -0,0 +1 @@ +4d7bde950a405f424c0bf3828d21e6bfd16746e091e177abfb397114c5b5b53c \ No newline at end of file diff --git a/db/schema_migrations/20220830114228 b/db/schema_migrations/20220830114228 new file mode 100644 index 00000000000..44b26221fd5 --- /dev/null +++ b/db/schema_migrations/20220830114228 @@ -0,0 +1 @@ +fad5bab727bdaed1d17950d320baecd995dcc8a91816e2cfcdff6d1b393c637d \ No newline at end of file diff --git a/db/schema_migrations/20220830172142 b/db/schema_migrations/20220830172142 new file mode 100644 index 00000000000..3db3c5f4948 --- /dev/null +++ b/db/schema_migrations/20220830172142 @@ -0,0 +1 @@ +77d17e190cc1b879960763ef32458480897e3da9483503d99c18b5aacd080ce3 \ No newline at end of file diff --git a/db/schema_migrations/20220831021358 b/db/schema_migrations/20220831021358 new file mode 100644 index 00000000000..186bfbdb4c3 --- /dev/null +++ b/db/schema_migrations/20220831021358 @@ -0,0 +1 @@ +a1bca159b3ea6abbe3f3178bb1106b3b1886de74dfcdf0a41ec8a48ac6bd421a \ No newline at end of file diff --git a/db/schema_migrations/20220831132802 b/db/schema_migrations/20220831132802 new file mode 100644 index 00000000000..542bf0c240b --- /dev/null +++ b/db/schema_migrations/20220831132802 @@ -0,0 +1 @@ +ce0fdbed5966929816028cdd27f597ebb722ff0058d4e78b700a96952dd1274f \ No newline at end of file diff --git a/db/schema_migrations/20220831182105 b/db/schema_migrations/20220831182105 new file mode 100644 index 00000000000..6f4b0f46ff1 --- /dev/null +++ b/db/schema_migrations/20220831182105 @@ -0,0 +1 @@ +80828666cac381dde65dc208764b6e1c7fe703b63c708410f72afdd33886fc60 \ No newline at end of file diff --git a/db/schema_migrations/20220901035722 b/db/schema_migrations/20220901035722 new file mode 100644 index 00000000000..aa9ea1cdf21 --- /dev/null +++ b/db/schema_migrations/20220901035722 @@ -0,0 +1 @@ +afcbf032220e9e40ab6ae25d6ac8ea9df7f46649bf70219be9b206af6d9d0c7c \ No newline at end of file diff --git a/db/schema_migrations/20220901035725 b/db/schema_migrations/20220901035725 new file mode 100644 index 00000000000..3c60c0188a2 --- /dev/null +++ b/db/schema_migrations/20220901035725 @@ -0,0 +1 @@ +877ff6aab260278dfa3e886f093f34ee8004bbdaec2aabc12cebee37a879fd8d \ No newline at end of file diff --git a/db/schema_migrations/20220901071310 b/db/schema_migrations/20220901071310 new file mode 100644 index 00000000000..9134d6669a0 --- /dev/null +++ b/db/schema_migrations/20220901071310 @@ -0,0 +1 @@ +dee16fbf6edef6da0c9c55b0dca290bc1a1939b8d747ace6594a4d73a70adc7d \ No newline at end of file diff --git a/db/schema_migrations/20220901071355 b/db/schema_migrations/20220901071355 new file mode 100644 index 00000000000..5e8681b9ff0 --- /dev/null +++ b/db/schema_migrations/20220901071355 @@ -0,0 +1 @@ +3fe94b8d0102c5b5ed7824477cf4a535e42da9a232a320f770442530c77eb960 \ No newline at end of file diff --git a/db/schema_migrations/20220901073300 b/db/schema_migrations/20220901073300 new file mode 100644 index 00000000000..47cba2c6c05 --- /dev/null +++ b/db/schema_migrations/20220901073300 @@ -0,0 +1 @@ +92ca7bd3f150c9d447e6ab2152b7039379fece41bdef85addcf59b464dc95eb8 \ No newline at end of file diff --git a/db/schema_migrations/20220901124637 b/db/schema_migrations/20220901124637 new file mode 100644 index 00000000000..b5a08a248e0 --- /dev/null +++ b/db/schema_migrations/20220901124637 @@ -0,0 +1 @@ +59ea43b60e0fb009823d82e99494a7fcb31eeaddc0a6ccbf43009977cdd32526 \ No newline at end of file diff --git a/db/schema_migrations/20220901131828 b/db/schema_migrations/20220901131828 new file mode 100644 index 00000000000..b41fef9415b --- /dev/null +++ b/db/schema_migrations/20220901131828 @@ -0,0 +1 @@ +c32756c482bdda948f911d0405d2373673041c57ebc514cfc5f172ba6fda9185 \ No newline at end of file diff --git a/db/schema_migrations/20220901184106 b/db/schema_migrations/20220901184106 new file mode 100644 index 00000000000..d529617762a --- /dev/null +++ b/db/schema_migrations/20220901184106 @@ -0,0 +1 @@ +3934393670a67a38e0e558f7be2cb2b2a51d268c49f5992624dedfb2bc826ee4 \ No newline at end of file diff --git a/db/schema_migrations/20220901184246 b/db/schema_migrations/20220901184246 new file mode 100644 index 00000000000..556f3ff1b3e --- /dev/null +++ b/db/schema_migrations/20220901184246 @@ -0,0 +1 @@ +fe06d38ab5a86850e5b915243dd70d0fe7fef9a61d9bd54c71651aa8eb1eb0e3 \ No newline at end of file diff --git a/db/schema_migrations/20220901212027 b/db/schema_migrations/20220901212027 new file mode 100644 index 00000000000..8112c3492eb --- /dev/null +++ b/db/schema_migrations/20220901212027 @@ -0,0 +1 @@ +3e29afa3670370b8f5801523711d0689f1228a880b1941c44798f4bc76bedbb0 \ No newline at end of file diff --git a/db/schema_migrations/20220902065314 b/db/schema_migrations/20220902065314 new file mode 100644 index 00000000000..8197a41403d --- /dev/null +++ b/db/schema_migrations/20220902065314 @@ -0,0 +1 @@ +d1ca445a17c742d435cba3d898e61242a3df9c92caeadecba147fce858d8cb80 \ No newline at end of file diff --git a/db/schema_migrations/20220902065316 b/db/schema_migrations/20220902065316 new file mode 100644 index 00000000000..e9c3598206e --- /dev/null +++ b/db/schema_migrations/20220902065316 @@ -0,0 +1 @@ +910d87fbab226671b8e12b236be43970f6b2a3083f30df9586b3f8edf779f4af \ No newline at end of file diff --git a/db/schema_migrations/20220902065317 b/db/schema_migrations/20220902065317 new file mode 100644 index 00000000000..fa60ee97fef --- /dev/null +++ b/db/schema_migrations/20220902065317 @@ -0,0 +1 @@ +11c65391a6744d7d7c303c6593dafa8e6dca392675974a2a1df2c164afbd4fe1 \ No newline at end of file diff --git a/db/schema_migrations/20220902065558 b/db/schema_migrations/20220902065558 new file mode 100644 index 00000000000..2886e656d41 --- /dev/null +++ b/db/schema_migrations/20220902065558 @@ -0,0 +1 @@ +cce779cc52b2bb175ccd3d07ac6a7df3711ae362fa0a5004bfc58fa1eb440e1f \ No newline at end of file diff --git a/db/schema_migrations/20220902065611 b/db/schema_migrations/20220902065611 new file mode 100644 index 00000000000..365cb0f6194 --- /dev/null +++ b/db/schema_migrations/20220902065611 @@ -0,0 +1 @@ +8ec0cc23559ba1b83042bed4abf8c47487ecb999fa66e602fbf4a9edac0569ec \ No newline at end of file diff --git a/db/schema_migrations/20220902065623 b/db/schema_migrations/20220902065623 new file mode 100644 index 00000000000..cf75e086f31 --- /dev/null +++ b/db/schema_migrations/20220902065623 @@ -0,0 +1 @@ +4f2076138e65849d60cf093f140afa1abaa7beea4d6c95048e6743168a7f17a9 \ No newline at end of file diff --git a/db/schema_migrations/20220902065635 b/db/schema_migrations/20220902065635 new file mode 100644 index 00000000000..bd131598d78 --- /dev/null +++ b/db/schema_migrations/20220902065635 @@ -0,0 +1 @@ +49a86fa87974f2c0cdc5a38726ab792f70c43e7f215495323d0999fd9f6e45f6 \ No newline at end of file diff --git a/db/schema_migrations/20220902065647 b/db/schema_migrations/20220902065647 new file mode 100644 index 00000000000..31ee9352fe6 --- /dev/null +++ b/db/schema_migrations/20220902065647 @@ -0,0 +1 @@ +812f25371d731d03bd4727328ad0daaf954595e24a314dd5f1adccdc3a4532c4 \ No newline at end of file diff --git a/db/schema_migrations/20220902111016 b/db/schema_migrations/20220902111016 new file mode 100644 index 00000000000..33ea3c75bba --- /dev/null +++ b/db/schema_migrations/20220902111016 @@ -0,0 +1 @@ +13a36d34ff1c812a8993be87721b9d9472c26cfb6fcd8f56e9aa3c59d97183a9 \ No newline at end of file diff --git a/db/schema_migrations/20220902111038 b/db/schema_migrations/20220902111038 new file mode 100644 index 00000000000..ecfad43fff1 --- /dev/null +++ b/db/schema_migrations/20220902111038 @@ -0,0 +1 @@ +65c55f8fe4037d0e492f1c2a4ff83481a0da3ab17f6c63a56c181fba5d5822ba \ No newline at end of file diff --git a/db/schema_migrations/20220902165931 b/db/schema_migrations/20220902165931 new file mode 100644 index 00000000000..3933f0d87fb --- /dev/null +++ b/db/schema_migrations/20220902165931 @@ -0,0 +1 @@ +b29e850775a327dcf6e37e25a43066a0638a55a4e0bd6b818cf496f0b97c6f82 \ No newline at end of file diff --git a/db/schema_migrations/20220902170131 b/db/schema_migrations/20220902170131 new file mode 100644 index 00000000000..e598289a154 --- /dev/null +++ b/db/schema_migrations/20220902170131 @@ -0,0 +1 @@ +5b1c25848e3e890fe27c3a43effce093af5f0fe42118c7976919acef84387a0a \ No newline at end of file diff --git a/db/schema_migrations/20220902204048 b/db/schema_migrations/20220902204048 new file mode 100644 index 00000000000..c5fc6ee1448 --- /dev/null +++ b/db/schema_migrations/20220902204048 @@ -0,0 +1 @@ +577a3808889d0e53af3c45ee38e852b8e653f7292c0144769811e4662e9c8c7b \ No newline at end of file diff --git a/db/schema_migrations/20220904173342 b/db/schema_migrations/20220904173342 new file mode 100644 index 00000000000..951b667372c --- /dev/null +++ b/db/schema_migrations/20220904173342 @@ -0,0 +1 @@ +407fd539c6ff5cb8e71a2da80fe9dfb0002a45d5fce84a391b2332a653d6e09e \ No newline at end of file diff --git a/db/schema_migrations/20220904173430 b/db/schema_migrations/20220904173430 new file mode 100644 index 00000000000..6c1750b8784 --- /dev/null +++ b/db/schema_migrations/20220904173430 @@ -0,0 +1 @@ +28b91d351f3d23377d79116bdd268871f755675efb3df647e2bea51482e1aff8 \ No newline at end of file diff --git a/db/schema_migrations/20220905090300 b/db/schema_migrations/20220905090300 new file mode 100644 index 00000000000..32d1ab47c9e --- /dev/null +++ b/db/schema_migrations/20220905090300 @@ -0,0 +1 @@ +e15a37d20202e204fcf02ab68d3b616eec0501c2c323db69ed2fb39df0d017f6 \ No newline at end of file diff --git a/db/schema_migrations/20220905090339 b/db/schema_migrations/20220905090339 new file mode 100644 index 00000000000..52c2e038c93 --- /dev/null +++ b/db/schema_migrations/20220905090339 @@ -0,0 +1 @@ +f3a7e9c501498b22786960694a8c1f35d2db69c8c48319f99dfb81c41aa5c6ca \ No newline at end of file diff --git a/db/schema_migrations/20220905112710 b/db/schema_migrations/20220905112710 new file mode 100644 index 00000000000..9f20a8cc9b6 --- /dev/null +++ b/db/schema_migrations/20220905112710 @@ -0,0 +1 @@ +85db0670a8557421a59678f19324411d61220eae12ea68f565d458a7393f6b2e \ No newline at end of file diff --git a/db/schema_migrations/20220906074449 b/db/schema_migrations/20220906074449 new file mode 100644 index 00000000000..df657642eb3 --- /dev/null +++ b/db/schema_migrations/20220906074449 @@ -0,0 +1 @@ +fc34cdbddc61ee9c23b790101f911d21892cf2ace34e3615b920817374c803f9 \ No newline at end of file diff --git a/db/schema_migrations/20220906093857 b/db/schema_migrations/20220906093857 new file mode 100644 index 00000000000..a5bc36ab6ef --- /dev/null +++ b/db/schema_migrations/20220906093857 @@ -0,0 +1 @@ +394f346e3a93f8a6b74fd0461eb59f569c6a18f90ae653c330a38e3a3706b5f6 \ No newline at end of file diff --git a/db/schema_migrations/20220906155105 b/db/schema_migrations/20220906155105 new file mode 100644 index 00000000000..b5aec9a8279 --- /dev/null +++ b/db/schema_migrations/20220906155105 @@ -0,0 +1 @@ +a3eb4d190652c43f95f8823f11957064fcf097a1fd6641562a09de5ae02ceb6e \ No newline at end of file diff --git a/db/schema_migrations/20220906204832 b/db/schema_migrations/20220906204832 new file mode 100644 index 00000000000..a63248d6221 --- /dev/null +++ b/db/schema_migrations/20220906204832 @@ -0,0 +1 @@ +bda120b4684900c0763af116557930a77b2dfa3c3884ae7f8d4183db546fa019 \ No newline at end of file diff --git a/db/schema_migrations/20220906212931 b/db/schema_migrations/20220906212931 new file mode 100644 index 00000000000..38f14a166e7 --- /dev/null +++ b/db/schema_migrations/20220906212931 @@ -0,0 +1 @@ +0a6bd5578f5180fac269ffd8a78fc87b7bd95be4b0246890d5c57d79f2a856f8 \ No newline at end of file diff --git a/db/schema_migrations/20220907124320 b/db/schema_migrations/20220907124320 new file mode 100644 index 00000000000..59077465bf9 --- /dev/null +++ b/db/schema_migrations/20220907124320 @@ -0,0 +1 @@ +5b645f66351e9515826be882767ad07671b7b5fad7b942bc74325b05c84130ac \ No newline at end of file diff --git a/db/schema_migrations/20220908125146 b/db/schema_migrations/20220908125146 new file mode 100644 index 00000000000..2b8475f0d70 --- /dev/null +++ b/db/schema_migrations/20220908125146 @@ -0,0 +1 @@ +d5d264f90203ba371edcf0688d1227aa69cbf0018033d141257e4c88072ee7d7 \ No newline at end of file diff --git a/db/schema_migrations/20220909091410 b/db/schema_migrations/20220909091410 new file mode 100644 index 00000000000..49738ad23af --- /dev/null +++ b/db/schema_migrations/20220909091410 @@ -0,0 +1 @@ +34e485c0c94960fc07a3f529aed749c2bbc1a72bb49d064225a37b85134f70f2 \ No newline at end of file diff --git a/db/schema_migrations/20220909094752 b/db/schema_migrations/20220909094752 new file mode 100644 index 00000000000..4660f31f8d0 --- /dev/null +++ b/db/schema_migrations/20220909094752 @@ -0,0 +1 @@ +2a0fb7dc05ed2949745cb85df20ad0f46f38f9efc6e7d84e559cff3f647fed9e \ No newline at end of file diff --git a/db/schema_migrations/20220909113809 b/db/schema_migrations/20220909113809 new file mode 100644 index 00000000000..9bf2a6b0e03 --- /dev/null +++ b/db/schema_migrations/20220909113809 @@ -0,0 +1 @@ +ec9f278411b727587be787eabfa356f3c497b1927283a85063d7067495097fe0 \ No newline at end of file diff --git a/db/schema_migrations/20220909114220 b/db/schema_migrations/20220909114220 new file mode 100644 index 00000000000..7100121ace6 --- /dev/null +++ b/db/schema_migrations/20220909114220 @@ -0,0 +1 @@ +2a5833aca02f3d42f0bd0c6861fb244166b9f8bd2a5b29a1d97df9b8cdea5c11 \ No newline at end of file diff --git a/db/schema_migrations/20220912085047 b/db/schema_migrations/20220912085047 new file mode 100644 index 00000000000..7279f94eb21 --- /dev/null +++ b/db/schema_migrations/20220912085047 @@ -0,0 +1 @@ +30d9f3352daa48f529486030e30667a1339b04e96b207be815505477ab498adb \ No newline at end of file diff --git a/db/schema_migrations/20220912110433 b/db/schema_migrations/20220912110433 new file mode 100644 index 00000000000..0e31168be7d --- /dev/null +++ b/db/schema_migrations/20220912110433 @@ -0,0 +1 @@ +3bf30b096f71664f5bfae88cc21b1d7992ebcbbb6eb9eb15348bc689291bffd2 \ No newline at end of file diff --git a/db/schema_migrations/20220912180807 b/db/schema_migrations/20220912180807 new file mode 100644 index 00000000000..77fb556b1fd --- /dev/null +++ b/db/schema_migrations/20220912180807 @@ -0,0 +1 @@ +6959c82221a22ac1a2aba39a1a023f227989ac26b08fc0aa5a0596f597e0098c \ No newline at end of file diff --git a/db/schema_migrations/20220913030552 b/db/schema_migrations/20220913030552 new file mode 100644 index 00000000000..6d6a68788dc --- /dev/null +++ b/db/schema_migrations/20220913030552 @@ -0,0 +1 @@ +39538feebc6f7f4e1822148567ed369eee1a7ed7ee718f7e913e2b585cc0e808 \ No newline at end of file diff --git a/db/schema_migrations/20220913030624 b/db/schema_migrations/20220913030624 new file mode 100644 index 00000000000..8a0641b4f8c --- /dev/null +++ b/db/schema_migrations/20220913030624 @@ -0,0 +1 @@ +baac0b236b7e91f9aacd03f3cf1ce84974f6c389529143e9b2813d9b70224e53 \ No newline at end of file diff --git a/db/schema_migrations/20220913082728 b/db/schema_migrations/20220913082728 new file mode 100644 index 00000000000..18b538fada9 --- /dev/null +++ b/db/schema_migrations/20220913082728 @@ -0,0 +1 @@ +0143a083e7083e9324a0e27a3a42083b56939cf841eb3d9c26d26b4b774d55d0 \ No newline at end of file diff --git a/db/schema_migrations/20220913082930 b/db/schema_migrations/20220913082930 new file mode 100644 index 00000000000..8afd779b269 --- /dev/null +++ b/db/schema_migrations/20220913082930 @@ -0,0 +1 @@ +3ae91ffae238c36a8e5ea021acfca8faa1c817d87078a5df9cf8213f259548a7 \ No newline at end of file diff --git a/db/schema_migrations/20220913083015 b/db/schema_migrations/20220913083015 new file mode 100644 index 00000000000..4f6b2a9459a --- /dev/null +++ b/db/schema_migrations/20220913083015 @@ -0,0 +1 @@ +19012eef52669209fa487d8a72d3e4363a6588250d9cb068ce7ffed72f95ac11 \ No newline at end of file diff --git a/db/schema_migrations/20220914005141 b/db/schema_migrations/20220914005141 new file mode 100644 index 00000000000..88859155884 --- /dev/null +++ b/db/schema_migrations/20220914005141 @@ -0,0 +1 @@ +df7862d3bab250feb867ecf60134bbfdffdfd6ea4f3a5a9b2c7e546e0aa89e3f \ No newline at end of file diff --git a/db/schema_migrations/20220914010233 b/db/schema_migrations/20220914010233 new file mode 100644 index 00000000000..777c73c0be6 --- /dev/null +++ b/db/schema_migrations/20220914010233 @@ -0,0 +1 @@ +be86548616ce5b4e6f0caf6db79c49ac523766257d20c6f5465d21a0e53f46d0 \ No newline at end of file diff --git a/db/schema_migrations/20220914093408 b/db/schema_migrations/20220914093408 new file mode 100644 index 00000000000..d18e80f8bfc --- /dev/null +++ b/db/schema_migrations/20220914093408 @@ -0,0 +1 @@ +3dfa9c266943018e06463b1eaf80fed67df602a9f3ee22c2054c6a05040a7382 \ No newline at end of file diff --git a/db/schema_migrations/20220915103831 b/db/schema_migrations/20220915103831 new file mode 100644 index 00000000000..29a516c0e60 --- /dev/null +++ b/db/schema_migrations/20220915103831 @@ -0,0 +1 @@ +86eeefedacc05cd6d4da63fd24b55af8e32f00d1c4e21b3f507d08310504adee \ No newline at end of file diff --git a/db/schema_migrations/20220915140802 b/db/schema_migrations/20220915140802 new file mode 100644 index 00000000000..676e295aa14 --- /dev/null +++ b/db/schema_migrations/20220915140802 @@ -0,0 +1 @@ +9b0f19a59e104f0df6abac7d58012701dcf9a031116f5cc643e407506e186cc2 \ No newline at end of file diff --git a/db/schema_migrations/20220916112841 b/db/schema_migrations/20220916112841 new file mode 100644 index 00000000000..23013f9fdb3 --- /dev/null +++ b/db/schema_migrations/20220916112841 @@ -0,0 +1 @@ +0bc8cd07786c950037731a0443e0d7da9c9692da39f13787b24769dbd122ba88 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index b055d831ce6..bfdb4e508f2 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -22,6 +22,40 @@ RETURN NULL; END $$; +CREATE FUNCTION function_for_trigger_a645cee67576() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + NEW."service_id" := NEW."integration_id"; + RETURN NEW; +END +$$; + +CREATE FUNCTION function_for_trigger_a87bcfdf0f0b() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + IF NEW."service_id" IS NULL AND NEW."integration_id" IS NOT NULL THEN + NEW."service_id" = NEW."integration_id"; + END IF; + + IF NEW."integration_id" IS NULL AND NEW."service_id" IS NOT NULL THEN + NEW."integration_id" = NEW."service_id"; + END IF; + + RETURN NEW; +END +$$; + +CREATE FUNCTION function_for_trigger_aca5c963d732() RETURNS trigger + LANGUAGE plpgsql + AS $$ +BEGIN + NEW."integration_id" := NEW."service_id"; + RETURN NEW; +END +$$; + CREATE FUNCTION gitlab_schema_prevent_write() RETURNS trigger LANGUAGE plpgsql AS $$ @@ -423,6 +457,22 @@ CREATE TABLE loose_foreign_keys_deleted_records ( ) PARTITION BY LIST (partition); +CREATE TABLE security_findings ( + id bigint NOT NULL, + scan_id bigint NOT NULL, + scanner_id bigint NOT NULL, + severity smallint NOT NULL, + confidence smallint, + project_fingerprint text, + deduplicated boolean DEFAULT false NOT NULL, + uuid uuid, + overridden_uuid uuid, + partition_number integer DEFAULT 1 NOT NULL, + CONSTRAINT check_6c2851a8c9 CHECK ((uuid IS NOT NULL)), + CONSTRAINT check_b9508c6df8 CHECK ((char_length(project_fingerprint) <= 40)) +) +PARTITION BY LIST (partition_number); + CREATE TABLE verification_codes ( created_at timestamp with time zone DEFAULT now() NOT NULL, visitor_id_code text NOT NULL, @@ -10767,18 +10817,12 @@ CREATE TABLE analytics_cycle_analytics_aggregations ( group_id bigint NOT NULL, incremental_runtimes_in_seconds integer[] DEFAULT '{}'::integer[] NOT NULL, incremental_processed_records integer[] DEFAULT '{}'::integer[] NOT NULL, - last_full_run_runtimes_in_seconds integer[] DEFAULT '{}'::integer[] NOT NULL, - last_full_run_processed_records integer[] DEFAULT '{}'::integer[] NOT NULL, last_incremental_issues_id integer, last_incremental_merge_requests_id integer, - last_full_run_issues_id integer, - last_full_run_merge_requests_id integer, last_incremental_run_at timestamp with time zone, last_incremental_issues_updated_at timestamp with time zone, last_incremental_merge_requests_updated_at timestamp with time zone, last_full_run_at timestamp with time zone, - last_full_run_issues_updated_at timestamp with time zone, - last_full_run_mrs_updated_at timestamp with time zone, last_consistency_check_updated_at timestamp with time zone, enabled boolean DEFAULT true NOT NULL, full_runtimes_in_seconds integer[] DEFAULT '{}'::integer[] NOT NULL, @@ -10796,8 +10840,6 @@ CREATE TABLE analytics_cycle_analytics_aggregations ( last_consistency_check_merge_requests_end_event_timestamp timestamp with time zone, last_consistency_check_merge_requests_issuable_id bigint, CONSTRAINT chk_rails_1ef688e577 CHECK ((cardinality(incremental_runtimes_in_seconds) <= 10)), - CONSTRAINT chk_rails_7810292ec9 CHECK ((cardinality(last_full_run_processed_records) <= 10)), - CONSTRAINT chk_rails_8b9e89687c CHECK ((cardinality(last_full_run_runtimes_in_seconds) <= 10)), CONSTRAINT chk_rails_e16bf3913a CHECK ((cardinality(incremental_processed_records) <= 10)), CONSTRAINT full_processed_records_size CHECK ((cardinality(full_processed_records) <= 10)), CONSTRAINT full_runtimes_in_seconds_size CHECK ((cardinality(full_runtimes_in_seconds) <= 10)) @@ -11426,6 +11468,7 @@ CREATE TABLE application_settings ( inactive_projects_min_size_mb integer DEFAULT 0 NOT NULL, inactive_projects_send_warning_email_after_months integer DEFAULT 1 NOT NULL, delayed_group_deletion boolean DEFAULT true NOT NULL, + maven_package_requests_forwarding boolean DEFAULT true NOT NULL, arkose_labs_namespace text DEFAULT 'client'::text NOT NULL, max_export_size integer DEFAULT 0, encrypted_slack_app_signing_secret bytea, @@ -11456,13 +11499,20 @@ CREATE TABLE application_settings ( error_tracking_api_url text, git_rate_limit_users_allowlist text[] DEFAULT '{}'::text[] NOT NULL, error_tracking_access_token_encrypted text, + invitation_flow_enforcement boolean DEFAULT false NOT NULL, package_registry_cleanup_policies_worker_capacity integer DEFAULT 2 NOT NULL, deactivate_dormant_users_period integer DEFAULT 90 NOT NULL, + auto_ban_user_on_excessive_projects_download boolean DEFAULT false NOT NULL, + max_pages_custom_domains_per_project integer DEFAULT 0 NOT NULL, + cube_api_base_url text, + encrypted_cube_api_key bytea, + encrypted_cube_api_key_iv bytea, CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)), CONSTRAINT app_settings_container_registry_pre_import_tags_rate_positive CHECK ((container_registry_pre_import_tags_rate >= (0)::numeric)), CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)), CONSTRAINT app_settings_ext_pipeline_validation_service_url_text_limit CHECK ((char_length(external_pipeline_validation_service_url) <= 255)), CONSTRAINT app_settings_git_rate_limit_users_allowlist_max_usernames CHECK ((cardinality(git_rate_limit_users_allowlist) <= 100)), + CONSTRAINT app_settings_max_pages_custom_domains_per_project_check CHECK ((max_pages_custom_domains_per_project >= 0)), CONSTRAINT app_settings_p_cleanup_package_file_worker_capacity_positive CHECK ((packages_cleanup_package_file_worker_capacity >= 0)), CONSTRAINT app_settings_pkg_registry_cleanup_pol_worker_capacity_gte_zero CHECK ((package_registry_cleanup_policies_worker_capacity >= 0)), CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)), @@ -11488,6 +11538,7 @@ CREATE TABLE application_settings ( CONSTRAINT check_7ccfe2764a CHECK ((char_length(arkose_labs_namespace) <= 255)), CONSTRAINT check_85a39b68ff CHECK ((char_length(encrypted_ci_jwt_signing_key_iv) <= 255)), CONSTRAINT check_8dca35398a CHECK ((char_length(public_runner_releases_url) <= 255)), + CONSTRAINT check_8e7df605a1 CHECK ((char_length(cube_api_base_url) <= 512)), 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)), @@ -12022,7 +12073,10 @@ CREATE TABLE board_group_recent_visits ( updated_at timestamp with time zone NOT NULL, user_id integer, board_id integer, - group_id integer + group_id integer, + CONSTRAINT check_409f6caea4 CHECK ((user_id IS NOT NULL)), + CONSTRAINT check_ddc74243ef CHECK ((group_id IS NOT NULL)), + CONSTRAINT check_fa7711a898 CHECK ((board_id IS NOT NULL)) ); CREATE SEQUENCE board_group_recent_visits_id_seq @@ -12055,7 +12109,10 @@ CREATE TABLE board_project_recent_visits ( updated_at timestamp with time zone NOT NULL, user_id integer, project_id integer, - board_id integer + board_id integer, + CONSTRAINT check_0386e26981 CHECK ((board_id IS NOT NULL)), + CONSTRAINT check_d9cc9b79da CHECK ((project_id IS NOT NULL)), + CONSTRAINT check_df7762a99a CHECK ((user_id IS NOT NULL)) ); CREATE SEQUENCE board_project_recent_visits_id_seq @@ -12250,7 +12307,8 @@ CREATE TABLE broadcast_messages ( broadcast_type smallint DEFAULT 1 NOT NULL, dismissable boolean, target_access_levels integer[] DEFAULT '{}'::integer[] NOT NULL, - theme smallint DEFAULT 0 NOT NULL + theme smallint DEFAULT 0 NOT NULL, + namespace_id bigint ); CREATE SEQUENCE broadcast_messages_id_seq @@ -12579,6 +12637,7 @@ CREATE TABLE ci_builds ( scheduling_type smallint, id bigint NOT NULL, stage_id bigint, + partition_id bigint DEFAULT 100 NOT NULL, CONSTRAINT check_1e2fbd1b39 CHECK ((lock_version IS NOT NULL)) ); @@ -12605,7 +12664,8 @@ CREATE TABLE ci_builds_metadata ( build_id bigint NOT NULL, id bigint NOT NULL, runtime_runner_features jsonb DEFAULT '{}'::jsonb NOT NULL, - id_tokens jsonb DEFAULT '{}'::jsonb NOT NULL + id_tokens jsonb DEFAULT '{}'::jsonb NOT NULL, + partition_id bigint DEFAULT 100 NOT NULL ); CREATE SEQUENCE ci_builds_metadata_id_seq @@ -12770,6 +12830,7 @@ CREATE TABLE ci_job_artifacts ( job_id bigint NOT NULL, locked smallint DEFAULT 2, original_filename text, + partition_id bigint DEFAULT 100 NOT NULL, CONSTRAINT check_27f0f6dbab CHECK ((file_store IS NOT NULL)), CONSTRAINT check_85573000db CHECK ((char_length(original_filename) <= 512)) ); @@ -12875,6 +12936,21 @@ CREATE SEQUENCE ci_namespace_monthly_usages_id_seq ALTER SEQUENCE ci_namespace_monthly_usages_id_seq OWNED BY ci_namespace_monthly_usages.id; +CREATE TABLE ci_partitions ( + id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE ci_partitions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE ci_partitions_id_seq OWNED BY ci_partitions.id; + CREATE TABLE ci_pending_builds ( id bigint NOT NULL, build_id bigint NOT NULL, @@ -12916,6 +12992,7 @@ CREATE TABLE ci_pipeline_artifacts ( verification_retry_count smallint, verification_checksum bytea, verification_failure text, + locked smallint DEFAULT 2, CONSTRAINT check_191b5850ec CHECK ((char_length(file) <= 255)), CONSTRAINT check_abeeb71caf CHECK ((file IS NOT NULL)), CONSTRAINT ci_pipeline_artifacts_verification_failure_text_limit CHECK ((char_length(verification_failure) <= 255)) @@ -13018,7 +13095,8 @@ CREATE TABLE ci_pipeline_variables ( encrypted_value_iv character varying, pipeline_id integer NOT NULL, variable_type smallint DEFAULT 1 NOT NULL, - raw boolean DEFAULT true NOT NULL + raw boolean DEFAULT true NOT NULL, + partition_id bigint DEFAULT 100 NOT NULL ); CREATE SEQUENCE ci_pipeline_variables_id_seq @@ -13060,6 +13138,7 @@ CREATE TABLE ci_pipelines ( external_pull_request_id bigint, ci_ref_id bigint, locked smallint DEFAULT 1 NOT NULL, + partition_id bigint DEFAULT 100 NOT NULL, CONSTRAINT check_d7e99a025e CHECK ((lock_version IS NOT NULL)) ); @@ -13364,6 +13443,7 @@ CREATE TABLE ci_stages ( lock_version integer DEFAULT 0, "position" integer, id bigint NOT NULL, + partition_id bigint DEFAULT 100 NOT NULL, CONSTRAINT check_81b431e49b CHECK ((lock_version IS NOT NULL)) ); @@ -14757,6 +14837,21 @@ CREATE SEQUENCE dingtalk_tracker_data_id_seq ALTER SEQUENCE dingtalk_tracker_data_id_seq OWNED BY dingtalk_tracker_data.id; +CREATE TABLE dora_configurations ( + id bigint NOT NULL, + project_id bigint NOT NULL, + branches_for_lead_time_for_changes text[] DEFAULT '{}'::text[] NOT NULL +); + +CREATE SEQUENCE dora_configurations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE dora_configurations_id_seq OWNED BY dora_configurations.id; + CREATE TABLE dora_daily_metrics ( id bigint NOT NULL, environment_id bigint NOT NULL, @@ -14934,7 +15029,8 @@ CREATE TABLE environments ( slug character varying NOT NULL, auto_stop_at timestamp with time zone, auto_delete_at timestamp with time zone, - tier smallint + tier smallint, + merge_request_id bigint ); CREATE SEQUENCE environments_id_seq @@ -15704,6 +15800,24 @@ CREATE SEQUENCE geo_reset_checksum_events_id_seq ALTER SEQUENCE geo_reset_checksum_events_id_seq OWNED BY geo_reset_checksum_events.id; +CREATE TABLE ghost_user_migrations ( + id bigint NOT NULL, + user_id bigint NOT NULL, + initiator_user_id bigint, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + hard_delete boolean DEFAULT false NOT NULL +); + +CREATE SEQUENCE ghost_user_migrations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE ghost_user_migrations_id_seq OWNED BY ghost_user_migrations.id; + CREATE TABLE gitlab_subscription_histories ( id bigint NOT NULL, gitlab_subscription_created_at timestamp with time zone, @@ -16709,7 +16823,6 @@ CREATE TABLE iterations_cadences ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, start_date date, - last_run_date date, duration_in_weeks integer, iterations_in_advance integer, active boolean DEFAULT true NOT NULL, @@ -16717,6 +16830,7 @@ CREATE TABLE iterations_cadences ( title text NOT NULL, roll_over boolean DEFAULT false NOT NULL, description text, + next_run_date date, CONSTRAINT check_5c5d2b44bd CHECK ((char_length(description) <= 5000)), CONSTRAINT check_fedff82d3b CHECK ((char_length(title) <= 255)) ); @@ -17378,6 +17492,22 @@ CREATE SEQUENCE merge_request_metrics_id_seq ALTER SEQUENCE merge_request_metrics_id_seq OWNED BY merge_request_metrics.id; +CREATE TABLE merge_request_predictions ( + merge_request_id bigint NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + suggested_reviewers jsonb DEFAULT '{}'::jsonb NOT NULL +); + +CREATE SEQUENCE merge_request_predictions_merge_request_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE merge_request_predictions_merge_request_id_seq OWNED BY merge_request_predictions.merge_request_id; + CREATE TABLE merge_request_reviewers ( id bigint NOT NULL, user_id bigint NOT NULL, @@ -17643,7 +17773,10 @@ CREATE TABLE ml_candidates ( updated_at timestamp with time zone NOT NULL, iid uuid NOT NULL, experiment_id bigint NOT NULL, - user_id bigint + user_id bigint, + start_time bigint, + end_time bigint, + status smallint DEFAULT 0 NOT NULL ); CREATE SEQUENCE ml_candidates_id_seq @@ -17663,6 +17796,7 @@ CREATE TABLE ml_experiments ( project_id bigint NOT NULL, user_id bigint, name text NOT NULL, + deleted_on timestamp with time zone, CONSTRAINT check_ee07a0be2c CHECK ((char_length(name) <= 255)) ); @@ -17725,7 +17859,8 @@ CREATE TABLE namespace_details ( updated_at timestamp with time zone, cached_markdown_version integer, description text, - description_html text + description_html text, + free_user_cap_over_limt_notified_at timestamp with time zone ); CREATE TABLE namespace_limits ( @@ -17781,12 +17916,14 @@ CREATE TABLE namespace_settings ( subgroup_runner_token_expiration_interval integer, project_runner_token_expiration_interval integer, exclude_from_free_user_cap boolean DEFAULT false NOT NULL, + show_diff_preview_in_email boolean DEFAULT true NOT NULL, enabled_git_access_protocol smallint DEFAULT 0 NOT NULL, unique_project_download_limit smallint DEFAULT 0 NOT NULL, unique_project_download_limit_interval_in_seconds integer DEFAULT 0 NOT NULL, project_import_level smallint DEFAULT 50 NOT NULL, include_for_free_user_cap_preview boolean DEFAULT false NOT NULL, unique_project_download_limit_allowlist text[] DEFAULT '{}'::text[] NOT NULL, + auto_ban_user_on_excessive_projects_download boolean DEFAULT false NOT NULL, CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255)), CONSTRAINT namespace_settings_unique_project_download_limit_allowlist_size CHECK ((cardinality(unique_project_download_limit_allowlist) <= 100)) ); @@ -17934,7 +18071,8 @@ CREATE TABLE notes ( resolved_by_push boolean, review_id bigint, confidential boolean, - last_edited_at timestamp with time zone + last_edited_at timestamp with time zone, + internal boolean DEFAULT false NOT NULL ); CREATE SEQUENCE notes_id_seq @@ -18771,7 +18909,8 @@ CREATE TABLE packages_packages ( version character varying, package_type smallint NOT NULL, creator_id integer, - status smallint DEFAULT 0 NOT NULL + status smallint DEFAULT 0 NOT NULL, + last_downloaded_at timestamp with time zone ); CREATE SEQUENCE packages_packages_id_seq @@ -18790,6 +18929,23 @@ CREATE TABLE packages_pypi_metadata ( CONSTRAINT check_379019d5da CHECK ((char_length(required_python) <= 255)) ); +CREATE TABLE packages_rpm_metadata ( + package_id bigint NOT NULL, + release text DEFAULT '1'::text NOT NULL, + summary text DEFAULT ''::text NOT NULL, + description text DEFAULT ''::text NOT NULL, + arch text DEFAULT ''::text NOT NULL, + license text, + url text, + epoch integer DEFAULT 0 NOT NULL, + CONSTRAINT check_3798bae3d6 CHECK ((char_length(arch) <= 255)), + CONSTRAINT check_5d29ba59ac CHECK ((char_length(description) <= 5000)), + CONSTRAINT check_6e8cbd536d CHECK ((char_length(url) <= 1000)), + CONSTRAINT check_845ba4d7d0 CHECK ((char_length(license) <= 1000)), + CONSTRAINT check_b010bf4870 CHECK ((char_length(summary) <= 1000)), + CONSTRAINT check_c3e2fc2e89 CHECK ((char_length(release) <= 128)) +); + CREATE TABLE packages_rubygems_metadata ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, @@ -19077,7 +19233,8 @@ CREATE TABLE plan_limits ( web_hook_calls_low integer DEFAULT 0 NOT NULL, project_ci_variables integer DEFAULT 200 NOT NULL, group_ci_variables integer DEFAULT 200 NOT NULL, - ci_max_artifact_size_cyclonedx integer DEFAULT 1 NOT NULL + ci_max_artifact_size_cyclonedx integer DEFAULT 1 NOT NULL, + rpm_max_file_size bigint DEFAULT '5368709120'::bigint NOT NULL ); CREATE SEQUENCE plan_limits_id_seq @@ -19160,6 +19317,21 @@ CREATE VIEW postgres_autovacuum_activity AS COMMENT ON VIEW postgres_autovacuum_activity IS 'Contains information about PostgreSQL backends currently performing autovacuum operations on the tables indicated here.'; +CREATE VIEW postgres_constraints AS + SELECT pg_constraint.oid, + pg_constraint.conname AS name, + pg_constraint.contype AS constraint_type, + pg_constraint.convalidated AS constraint_valid, + ( SELECT array_agg(pg_attribute.attname ORDER BY attnums.ordering) AS array_agg + FROM (unnest(pg_constraint.conkey) WITH ORDINALITY attnums(attnum, ordering) + JOIN pg_attribute ON (((pg_attribute.attnum = attnums.attnum) AND (pg_attribute.attrelid = pg_class.oid))))) AS column_names, + (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text) AS table_identifier, + NULLIF(pg_constraint.conparentid, (0)::oid) AS parent_constraint_oid, + pg_get_constraintdef(pg_constraint.oid) AS definition + FROM ((pg_constraint + JOIN pg_class ON ((pg_constraint.conrelid = pg_class.oid))) + JOIN pg_namespace ON ((pg_class.relnamespace = pg_namespace.oid))); + CREATE VIEW postgres_foreign_keys AS SELECT pg_constraint.oid, pg_constraint.conname AS name, @@ -19898,6 +20070,7 @@ CREATE TABLE project_settings ( target_platforms character varying[] DEFAULT '{}'::character varying[] NOT NULL, enforce_auth_checks_on_uploads boolean DEFAULT true NOT NULL, selective_code_owner_removals boolean DEFAULT false NOT NULL, + show_diff_preview_in_email boolean DEFAULT true NOT NULL, CONSTRAINT check_3a03e7557a CHECK ((char_length(previous_default_branch) <= 4096)), CONSTRAINT check_b09644994b CHECK ((char_length(squash_commit_template) <= 500)), CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL)), @@ -19980,7 +20153,6 @@ CREATE TABLE projects ( mirror_user_id integer, shared_runners_enabled boolean DEFAULT true NOT NULL, runners_token character varying, - build_coverage_regex character varying, build_allow_git_fetch boolean DEFAULT true NOT NULL, build_timeout integer DEFAULT 3600 NOT NULL, mirror_trigger_builds boolean DEFAULT false NOT NULL, @@ -20819,6 +20991,23 @@ CREATE SEQUENCE sbom_sources_id_seq ALTER SEQUENCE sbom_sources_id_seq OWNED BY sbom_sources.id; +CREATE TABLE sbom_vulnerable_component_versions ( + id bigint NOT NULL, + vulnerability_advisory_id bigint, + sbom_component_version_id bigint, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +); + +CREATE SEQUENCE sbom_vulnerable_component_versions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE sbom_vulnerable_component_versions_id_seq OWNED BY sbom_vulnerable_component_versions.id; + CREATE TABLE schema_migrations ( version character varying NOT NULL, finished_at timestamp with time zone DEFAULT now() @@ -20860,22 +21049,6 @@ CREATE SEQUENCE scim_oauth_access_tokens_id_seq ALTER SEQUENCE scim_oauth_access_tokens_id_seq OWNED BY scim_oauth_access_tokens.id; -CREATE TABLE security_findings ( - id bigint NOT NULL, - scan_id bigint NOT NULL, - scanner_id bigint NOT NULL, - severity smallint NOT NULL, - confidence smallint NOT NULL, - project_fingerprint text, - deduplicated boolean DEFAULT false NOT NULL, - uuid uuid, - overridden_uuid uuid, - partition_number integer DEFAULT 1 NOT NULL, - CONSTRAINT check_6c2851a8c9 CHECK ((uuid IS NOT NULL)), - CONSTRAINT check_b9508c6df8 CHECK ((char_length(project_fingerprint) <= 40)), - CONSTRAINT check_partition_number CHECK ((partition_number = 1)) -); - CREATE SEQUENCE security_findings_id_seq START WITH 1 INCREMENT BY 1 @@ -21853,7 +22026,6 @@ CREATE TABLE user_details ( job_title character varying(200) DEFAULT ''::character varying NOT NULL, bio character varying(255) DEFAULT ''::character varying NOT NULL, webauthn_xid text, - other_role text, provisioned_by_group_id bigint, pronouns text, pronunciation text, @@ -21862,7 +22034,6 @@ CREATE TABLE user_details ( requires_credit_card_verification boolean DEFAULT false NOT NULL, CONSTRAINT check_245664af82 CHECK ((char_length(webauthn_xid) <= 100)), CONSTRAINT check_a73b398c60 CHECK ((char_length(phone) <= 50)), - CONSTRAINT check_b132136b01 CHECK ((char_length(other_role) <= 100)), CONSTRAINT check_eeeaf8d4f0 CHECK ((char_length(pronouns) <= 50)), CONSTRAINT check_f932ed37db CHECK ((char_length(pronunciation) <= 255)) ); @@ -22226,7 +22397,7 @@ CREATE TABLE vulnerabilities ( state smallint DEFAULT 1 NOT NULL, severity smallint NOT NULL, severity_overridden boolean DEFAULT false, - confidence smallint NOT NULL, + confidence smallint, confidence_overridden boolean DEFAULT false, resolved_by_id bigint, resolved_at timestamp with time zone, @@ -22250,6 +22421,44 @@ CREATE SEQUENCE vulnerabilities_id_seq ALTER SEQUENCE vulnerabilities_id_seq OWNED BY vulnerabilities.id; +CREATE TABLE vulnerability_advisories ( + uuid uuid NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + id bigint NOT NULL, + created_date date NOT NULL, + published_date date NOT NULL, + description text, + title text, + component_name text, + solution text, + not_impacted text, + cvss_v2 text, + cvss_v3 text, + affected_range text, + identifiers text[] DEFAULT '{}'::text[], + fixed_versions text[] DEFAULT '{}'::text[], + urls text[] DEFAULT '{}'::text[], + links text[] DEFAULT '{}'::text[], + CONSTRAINT check_3ab0544d19 CHECK ((char_length(title) <= 2048)), + CONSTRAINT check_3b57023409 CHECK ((char_length(affected_range) <= 32)), + CONSTRAINT check_4d5cd7be9c CHECK ((char_length(component_name) <= 2048)), + CONSTRAINT check_962f256a51 CHECK ((char_length(solution) <= 2048)), + CONSTRAINT check_aae93955fb CHECK ((char_length(cvss_v3) <= 128)), + CONSTRAINT check_b8a17497f3 CHECK ((char_length(cvss_v2) <= 128)), + CONSTRAINT check_c05a35f418 CHECK ((char_length(not_impacted) <= 2048)), + CONSTRAINT check_ff9f6483b6 CHECK ((char_length(description) <= 2048)) +); + +CREATE SEQUENCE vulnerability_advisories_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE vulnerability_advisories_id_seq OWNED BY vulnerability_advisories.id; + CREATE TABLE vulnerability_exports ( id bigint NOT NULL, created_at timestamp with time zone NOT NULL, @@ -22538,7 +22747,7 @@ CREATE TABLE vulnerability_occurrences ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, severity smallint NOT NULL, - confidence smallint NOT NULL, + confidence smallint, report_type smallint NOT NULL, project_id integer NOT NULL, scanner_id bigint NOT NULL, @@ -22652,6 +22861,7 @@ CREATE TABLE vulnerability_state_transitions ( updated_at timestamp with time zone NOT NULL, author_id bigint, comment text, + dismissal_reason smallint, CONSTRAINT check_fca4a7ca39 CHECK ((char_length(comment) <= 255)) ); @@ -22750,7 +22960,9 @@ CREATE TABLE web_hooks ( backoff_count smallint DEFAULT 0 NOT NULL, disabled_until timestamp with time zone, encrypted_url_variables bytea, - encrypted_url_variables_iv bytea + encrypted_url_variables_iv bytea, + integration_id integer, + branch_filter_strategy smallint DEFAULT 0 NOT NULL ); CREATE SEQUENCE web_hooks_id_seq @@ -23129,6 +23341,8 @@ ALTER TABLE ONLY ci_namespace_mirrors ALTER COLUMN id SET DEFAULT nextval('ci_na ALTER TABLE ONLY ci_namespace_monthly_usages ALTER COLUMN id SET DEFAULT nextval('ci_namespace_monthly_usages_id_seq'::regclass); +ALTER TABLE ONLY ci_partitions ALTER COLUMN id SET DEFAULT nextval('ci_partitions_id_seq'::regclass); + ALTER TABLE ONLY ci_pending_builds ALTER COLUMN id SET DEFAULT nextval('ci_pending_builds_id_seq'::regclass); ALTER TABLE ONLY ci_pipeline_artifacts ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_artifacts_id_seq'::regclass); @@ -23291,6 +23505,8 @@ ALTER TABLE ONLY diff_note_positions ALTER COLUMN id SET DEFAULT nextval('diff_n ALTER TABLE ONLY dingtalk_tracker_data ALTER COLUMN id SET DEFAULT nextval('dingtalk_tracker_data_id_seq'::regclass); +ALTER TABLE ONLY dora_configurations ALTER COLUMN id SET DEFAULT nextval('dora_configurations_id_seq'::regclass); + ALTER TABLE ONLY dora_daily_metrics ALTER COLUMN id SET DEFAULT nextval('dora_daily_metrics_id_seq'::regclass); ALTER TABLE ONLY draft_notes ALTER COLUMN id SET DEFAULT nextval('draft_notes_id_seq'::regclass); @@ -23379,6 +23595,8 @@ ALTER TABLE ONLY geo_repository_updated_events ALTER COLUMN id SET DEFAULT nextv ALTER TABLE ONLY geo_reset_checksum_events ALTER COLUMN id SET DEFAULT nextval('geo_reset_checksum_events_id_seq'::regclass); +ALTER TABLE ONLY ghost_user_migrations ALTER COLUMN id SET DEFAULT nextval('ghost_user_migrations_id_seq'::regclass); + ALTER TABLE ONLY gitlab_subscription_histories ALTER COLUMN id SET DEFAULT nextval('gitlab_subscription_histories_id_seq'::regclass); ALTER TABLE ONLY gitlab_subscriptions ALTER COLUMN id SET DEFAULT nextval('gitlab_subscriptions_id_seq'::regclass); @@ -23529,6 +23747,8 @@ ALTER TABLE ONLY merge_request_diffs ALTER COLUMN id SET DEFAULT nextval('merge_ ALTER TABLE ONLY merge_request_metrics ALTER COLUMN id SET DEFAULT nextval('merge_request_metrics_id_seq'::regclass); +ALTER TABLE ONLY merge_request_predictions ALTER COLUMN merge_request_id SET DEFAULT nextval('merge_request_predictions_merge_request_id_seq'::regclass); + ALTER TABLE ONLY merge_request_reviewers ALTER COLUMN id SET DEFAULT nextval('merge_request_reviewers_id_seq'::regclass); ALTER TABLE ONLY merge_request_user_mentions ALTER COLUMN id SET DEFAULT nextval('merge_request_user_mentions_id_seq'::regclass); @@ -23793,6 +24013,8 @@ ALTER TABLE ONLY sbom_occurrences ALTER COLUMN id SET DEFAULT nextval('sbom_occu ALTER TABLE ONLY sbom_sources ALTER COLUMN id SET DEFAULT nextval('sbom_sources_id_seq'::regclass); +ALTER TABLE ONLY sbom_vulnerable_component_versions ALTER COLUMN id SET DEFAULT nextval('sbom_vulnerable_component_versions_id_seq'::regclass); + ALTER TABLE ONLY scim_identities ALTER COLUMN id SET DEFAULT nextval('scim_identities_id_seq'::regclass); ALTER TABLE ONLY scim_oauth_access_tokens ALTER COLUMN id SET DEFAULT nextval('scim_oauth_access_tokens_id_seq'::regclass); @@ -23913,6 +24135,8 @@ ALTER TABLE ONLY users_statistics ALTER COLUMN id SET DEFAULT nextval('users_sta ALTER TABLE ONLY vulnerabilities ALTER COLUMN id SET DEFAULT nextval('vulnerabilities_id_seq'::regclass); +ALTER TABLE ONLY vulnerability_advisories ALTER COLUMN id SET DEFAULT nextval('vulnerability_advisories_id_seq'::regclass); + ALTER TABLE ONLY vulnerability_exports ALTER COLUMN id SET DEFAULT nextval('vulnerability_exports_id_seq'::regclass); ALTER TABLE ONLY vulnerability_external_issue_links ALTER COLUMN id SET DEFAULT nextval('vulnerability_external_issue_links_id_seq'::regclass); @@ -24786,6 +25010,9 @@ ALTER TABLE ONLY chat_teams ALTER TABLE vulnerability_scanners ADD CONSTRAINT check_37608c9db5 CHECK ((char_length(vendor) <= 255)) NOT VALID; +ALTER TABLE members + ADD CONSTRAINT check_508774aac0 CHECK ((member_namespace_id IS NOT NULL)) NOT VALID; + ALTER TABLE sprints ADD CONSTRAINT check_ccd8a1eae0 CHECK ((start_date IS NOT NULL)) NOT VALID; @@ -24858,6 +25085,9 @@ ALTER TABLE ONLY ci_namespace_mirrors ALTER TABLE ONLY ci_namespace_monthly_usages ADD CONSTRAINT ci_namespace_monthly_usages_pkey PRIMARY KEY (id); +ALTER TABLE ONLY ci_partitions + ADD CONSTRAINT ci_partitions_pkey PRIMARY KEY (id); + ALTER TABLE ONLY ci_pending_builds ADD CONSTRAINT ci_pending_builds_pkey PRIMARY KEY (id); @@ -25134,6 +25364,9 @@ ALTER TABLE ONLY diff_note_positions ALTER TABLE ONLY dingtalk_tracker_data ADD CONSTRAINT dingtalk_tracker_data_pkey PRIMARY KEY (id); +ALTER TABLE ONLY dora_configurations + ADD CONSTRAINT dora_configurations_pkey PRIMARY KEY (id); + ALTER TABLE ONLY dora_daily_metrics ADD CONSTRAINT dora_daily_metrics_pkey PRIMARY KEY (id); @@ -25272,6 +25505,9 @@ ALTER TABLE ONLY geo_repository_updated_events ALTER TABLE ONLY geo_reset_checksum_events ADD CONSTRAINT geo_reset_checksum_events_pkey PRIMARY KEY (id); +ALTER TABLE ONLY ghost_user_migrations + ADD CONSTRAINT ghost_user_migrations_pkey PRIMARY KEY (id); + ALTER TABLE ONLY gitlab_subscription_histories ADD CONSTRAINT gitlab_subscription_histories_pkey PRIMARY KEY (id); @@ -25536,6 +25772,9 @@ ALTER TABLE ONLY merge_request_diffs ALTER TABLE ONLY merge_request_metrics ADD CONSTRAINT merge_request_metrics_pkey PRIMARY KEY (id); +ALTER TABLE ONLY merge_request_predictions + ADD CONSTRAINT merge_request_predictions_pkey PRIMARY KEY (merge_request_id); + ALTER TABLE ONLY merge_request_reviewers ADD CONSTRAINT merge_request_reviewers_pkey PRIMARY KEY (id); @@ -25752,6 +25991,9 @@ ALTER TABLE ONLY packages_packages ALTER TABLE ONLY packages_pypi_metadata ADD CONSTRAINT packages_pypi_metadata_pkey PRIMARY KEY (package_id); +ALTER TABLE ONLY packages_rpm_metadata + ADD CONSTRAINT packages_rpm_metadata_pkey PRIMARY KEY (package_id); + ALTER TABLE ONLY packages_rubygems_metadata ADD CONSTRAINT packages_rubygems_metadata_pkey PRIMARY KEY (package_id); @@ -26013,6 +26255,9 @@ ALTER TABLE ONLY sbom_occurrences ALTER TABLE ONLY sbom_sources ADD CONSTRAINT sbom_sources_pkey PRIMARY KEY (id); +ALTER TABLE ONLY sbom_vulnerable_component_versions + ADD CONSTRAINT sbom_vulnerable_component_versions_pkey PRIMARY KEY (id); + ALTER TABLE ONLY schema_migrations ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); @@ -26229,6 +26474,9 @@ ALTER TABLE ONLY verification_codes ALTER TABLE ONLY vulnerabilities ADD CONSTRAINT vulnerabilities_pkey PRIMARY KEY (id); +ALTER TABLE ONLY vulnerability_advisories + ADD CONSTRAINT vulnerability_advisories_pkey PRIMARY KEY (id); + ALTER TABLE ONLY vulnerability_exports ADD CONSTRAINT vulnerability_exports_pkey PRIMARY KEY (id); @@ -27268,10 +27516,10 @@ CREATE INDEX ca_aggregations_last_full_run_at ON analytics_cycle_analytics_aggre CREATE INDEX ca_aggregations_last_incremental_run_at ON analytics_cycle_analytics_aggregations USING btree (last_incremental_run_at NULLS FIRST) WHERE (enabled IS TRUE); -CREATE INDEX cadence_create_iterations_automation ON iterations_cadences USING btree (automatic, duration_in_weeks, date((COALESCE(last_run_date, '1970-01-01'::date) + ((duration_in_weeks)::double precision * '7 days'::interval)))) WHERE (duration_in_weeks IS NOT NULL); - 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 ci_pipeline_artifacts_on_expire_at_for_removal ON ci_pipeline_artifacts USING btree (expire_at) WHERE ((locked = 0) AND (expire_at IS NOT NULL)); + CREATE INDEX code_owner_approval_required ON protected_branches USING btree (project_id, code_owner_approval_required) WHERE (code_owner_approval_required = true); CREATE UNIQUE INDEX commit_user_mentions_on_commit_id_and_note_id_unique_index ON commit_user_mentions USING btree (commit_id, note_id); @@ -27404,7 +27652,7 @@ CREATE UNIQUE INDEX idx_on_external_status_checks_project_id_external_url ON ext CREATE UNIQUE INDEX idx_on_external_status_checks_project_id_name ON external_status_checks USING btree (project_id, name); -CREATE INDEX idx_open_issues_on_project_id_and_confidential ON issues USING btree (project_id, confidential) WHERE (state_id = 1); +CREATE INDEX idx_open_issues_on_project_and_confidential_and_author_and_id ON issues USING btree (project_id, confidential, author_id, id) WHERE (state_id = 1); CREATE INDEX idx_packages_debian_group_component_files_on_architecture_id ON packages_debian_group_component_files USING btree (architecture_id); @@ -27472,6 +27720,8 @@ CREATE UNIQUE INDEX idx_vuln_signatures_on_occurrences_id_and_signature_sha ON v CREATE UNIQUE INDEX idx_vuln_signatures_uniqueness_signature_sha ON vulnerability_finding_signatures USING btree (finding_id, algorithm_type, signature_sha); +CREATE INDEX idx_vulnerabilities_on_project_id_and_id_active_cis_dft_branch ON vulnerabilities USING btree (project_id, id) WHERE ((report_type = 7) AND (state = ANY (ARRAY[1, 4])) AND (present_on_default_branch IS TRUE)); + CREATE INDEX idx_vulnerabilities_partial_devops_adoption_and_default_branch ON vulnerabilities USING btree (project_id, created_at, present_on_default_branch) WHERE (state <> 1); CREATE UNIQUE INDEX idx_vulnerability_ext_issue_links_on_vulne_id_and_ext_issue ON vulnerability_external_issue_links USING btree (vulnerability_id, external_type, external_project_key, external_issue_key); @@ -27740,6 +27990,8 @@ CREATE INDEX index_boards_on_project_id ON boards USING btree (project_id); CREATE INDEX index_broadcast_message_on_ends_at_and_broadcast_type_and_id ON broadcast_messages USING btree (ends_at, broadcast_type, id); +CREATE INDEX index_broadcast_messages_on_namespace_id ON broadcast_messages USING btree (namespace_id); + CREATE INDEX index_btree_namespaces_traversal_ids ON namespaces USING btree (traversal_ids); CREATE INDEX index_bulk_import_configurations_on_bulk_import_id ON bulk_import_configurations USING btree (bulk_import_id); @@ -28358,6 +28610,8 @@ CREATE UNIQUE INDEX index_diff_note_positions_on_note_id_and_diff_type ON diff_n CREATE INDEX index_dingtalk_tracker_data_on_integration_id ON dingtalk_tracker_data USING btree (integration_id); +CREATE UNIQUE INDEX index_dora_configurations_on_project_id ON dora_configurations USING btree (project_id); + CREATE UNIQUE INDEX index_dora_daily_metrics_on_environment_id_and_date ON dora_daily_metrics USING btree (environment_id, date); CREATE INDEX index_draft_notes_on_author_id ON draft_notes USING btree (author_id); @@ -28384,6 +28638,8 @@ CREATE INDEX index_emails_on_user_id ON emails USING btree (user_id); CREATE INDEX index_enabled_clusters_on_id ON clusters USING btree (id) WHERE (enabled = true); +CREATE INDEX index_environments_on_merge_request_id ON environments USING btree (merge_request_id); + CREATE INDEX index_environments_on_name_varchar_pattern_ops ON environments USING btree (name varchar_pattern_ops); CREATE UNIQUE INDEX index_environments_on_project_id_and_name ON environments USING btree (project_id, name); @@ -28394,6 +28650,8 @@ CREATE INDEX index_environments_on_project_id_and_tier ON environments USING btr CREATE INDEX index_environments_on_project_id_state_environment_type ON environments USING btree (project_id, state, environment_type); +CREATE INDEX index_environments_on_project_name_varchar_pattern_ops_state ON environments USING btree (project_id, lower((name)::text) varchar_pattern_ops, state); + CREATE INDEX index_environments_on_state_and_auto_delete_at ON environments USING btree (auto_delete_at) WHERE ((auto_delete_at IS NOT NULL) AND ((state)::text = 'stopped'::text)); CREATE INDEX index_environments_on_state_and_auto_stop_at ON environments USING btree (state, auto_stop_at) WHERE ((auto_stop_at IS NOT NULL) AND ((state)::text = 'available'::text)); @@ -28582,6 +28840,8 @@ CREATE INDEX index_geo_repository_updated_events_on_source ON geo_repository_upd CREATE INDEX index_geo_reset_checksum_events_on_project_id ON geo_reset_checksum_events USING btree (project_id); +CREATE UNIQUE INDEX index_ghost_user_migrations_on_user_id ON ghost_user_migrations USING btree (user_id); + CREATE INDEX index_gin_ci_namespace_mirrors_on_traversal_ids ON ci_namespace_mirrors USING gin (traversal_ids); CREATE INDEX index_gin_ci_pending_builds_on_namespace_traversal_ids ON ci_pending_builds USING gin (namespace_traversal_ids); @@ -28812,8 +29072,6 @@ CREATE INDEX index_issues_on_confidential ON issues USING btree (confidential); CREATE INDEX index_issues_on_description_trigram ON issues USING gin (description gin_trgm_ops); -CREATE INDEX index_issues_on_description_trigram_non_latin ON issues USING gin (description gin_trgm_ops) WHERE (((title)::text !~ similar_escape('[\u0000-\u218F]*'::text, NULL::text)) OR (description !~ similar_escape('[\u0000-\u218F]*'::text, NULL::text))); - CREATE INDEX index_issues_on_duplicated_to_id ON issues USING btree (duplicated_to_id) WHERE (duplicated_to_id IS NOT NULL); CREATE INDEX index_issues_on_id_and_weight ON issues USING btree (id, weight); @@ -28842,14 +29100,14 @@ CREATE INDEX index_issues_on_project_id_closed_at_desc_state_id_and_id ON issues CREATE INDEX index_issues_on_project_id_closed_at_state_id_and_id ON issues USING btree (project_id, closed_at, state_id, id); +CREATE INDEX index_issues_on_project_id_health_status_created_at_id ON issues USING btree (project_id, health_status, created_at, id); + CREATE INDEX index_issues_on_promoted_to_epic_id ON issues USING btree (promoted_to_epic_id) WHERE (promoted_to_epic_id IS NOT NULL); CREATE INDEX index_issues_on_sprint_id ON issues USING btree (sprint_id); CREATE INDEX index_issues_on_title_trigram ON issues USING gin (title gin_trgm_ops); -CREATE INDEX index_issues_on_title_trigram_non_latin ON issues USING gin (title gin_trgm_ops) WHERE (((title)::text !~ similar_escape('[\u0000-\u218F]*'::text, NULL::text)) OR (description !~ similar_escape('[\u0000-\u218F]*'::text, NULL::text))); - 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); @@ -29310,7 +29568,7 @@ CREATE INDEX index_on_projects_path ON projects USING btree (path); CREATE INDEX index_on_routes_lower_path ON routes USING btree (lower((path)::text)); -CREATE INDEX index_on_security_findings_uuid_and_id_order_desc ON security_findings USING btree (uuid, id DESC); +CREATE INDEX index_on_todos_user_project_target_and_state ON todos USING btree (user_id, project_id, target_type, target_id, id) WHERE ((state)::text = 'pending'::text); CREATE INDEX index_on_users_lower_email ON users USING btree (lower((email)::text)); @@ -29432,6 +29690,8 @@ CREATE INDEX index_packages_packages_on_project_id_and_version ON packages_packa CREATE INDEX index_packages_project_id_name_partial_for_nuget ON packages_packages USING btree (project_id, name) WHERE (((name)::text <> 'NuGet.Temporary.Package'::text) AND (version IS NOT NULL) AND (package_type = 4)); +CREATE INDEX index_packages_rpm_metadata_on_package_id ON packages_rpm_metadata USING btree (package_id); + CREATE INDEX index_packages_tags_on_package_id ON packages_tags USING btree (package_id); CREATE INDEX index_packages_tags_on_package_id_and_updated_at ON packages_tags USING btree (package_id, updated_at DESC); @@ -29572,6 +29832,8 @@ CREATE INDEX index_project_group_links_on_project_id ON project_group_links USIN CREATE INDEX index_project_import_data_on_project_id ON project_import_data USING btree (project_id); +CREATE INDEX index_project_members_on_id_temp ON members USING btree (id) WHERE ((source_type)::text = 'Project'::text); + CREATE INDEX index_project_mirror_data_on_last_successful_update_at ON project_mirror_data USING btree (last_successful_update_at); CREATE INDEX index_project_mirror_data_on_last_update_at_and_retry_count ON project_mirror_data USING btree (last_update_at, retry_count); @@ -29938,20 +30200,6 @@ CREATE INDEX index_secure_ci_builds_on_user_id_name_created_at ON ci_builds USIN CREATE INDEX index_security_ci_builds_on_name_and_id_parser_features ON ci_builds USING btree (name, id) WHERE (((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('sast'::character varying)::text, ('secret_detection'::character varying)::text, ('coverage_fuzzing'::character varying)::text, ('license_scanning'::character varying)::text, ('apifuzzer_fuzz'::character varying)::text, ('apifuzzer_fuzz_dnd'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text)); -CREATE INDEX index_security_findings_on_confidence ON security_findings USING btree (confidence); - -CREATE INDEX index_security_findings_on_project_fingerprint ON security_findings USING btree (project_fingerprint); - -CREATE INDEX index_security_findings_on_scan_id_and_deduplicated ON security_findings USING btree (scan_id, deduplicated); - -CREATE INDEX index_security_findings_on_scan_id_and_id ON security_findings USING btree (scan_id, id); - -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); - -CREATE UNIQUE INDEX index_security_findings_on_unique_columns ON security_findings USING btree (uuid, scan_id, partition_number); - CREATE INDEX index_security_scans_on_created_at ON security_scans USING btree (created_at); CREATE INDEX index_security_scans_on_date_created_at_and_id ON security_scans USING btree (date(timezone('UTC'::text, created_at)), id); @@ -30238,7 +30486,7 @@ CREATE UNIQUE INDEX index_user_canonical_emails_on_user_id ON user_canonical_ema CREATE UNIQUE INDEX index_user_canonical_emails_on_user_id_and_canonical_email ON user_canonical_emails USING btree (user_id, canonical_email); -CREATE INDEX index_user_credit_card_validations_meta_data_full_match ON user_credit_card_validations USING btree (holder_name, expiration_date, last_digits, credit_card_validated_at); +CREATE INDEX index_user_credit_card_validations_meta_data_full_match_lower ON user_credit_card_validations USING btree (lower(holder_name), expiration_date, last_digits, credit_card_validated_at); CREATE INDEX index_user_credit_card_validations_meta_data_partial_match ON user_credit_card_validations USING btree (expiration_date, last_digits, network, credit_card_validated_at); @@ -30364,8 +30612,6 @@ CREATE INDEX index_vulnerabilities_on_last_edited_by_id ON vulnerabilities USING CREATE INDEX index_vulnerabilities_on_milestone_id ON vulnerabilities USING btree (milestone_id); -CREATE INDEX index_vulnerabilities_on_project_id_and_id_active_cis ON vulnerabilities USING btree (project_id, id) WHERE ((report_type = 7) AND (state = ANY (ARRAY[1, 4]))); - CREATE INDEX index_vulnerabilities_on_project_id_and_state_and_severity ON vulnerabilities USING btree (project_id, state, severity); CREATE INDEX index_vulnerabilities_on_resolved_by_id ON vulnerabilities USING btree (resolved_by_id); @@ -30486,6 +30732,10 @@ CREATE UNIQUE INDEX index_vulnerability_statistics_on_unique_project_id ON vulne CREATE UNIQUE INDEX index_vulnerability_user_mentions_on_note_id ON vulnerability_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL); +CREATE INDEX index_vulnerable_component_versions_on_sbom_component_version ON sbom_vulnerable_component_versions USING btree (sbom_component_version_id); + +CREATE INDEX index_vulnerable_component_versions_on_vulnerability_advisory ON sbom_vulnerable_component_versions USING btree (vulnerability_advisory_id); + CREATE UNIQUE INDEX index_vulns_user_mentions_on_vulnerability_id ON vulnerability_user_mentions USING btree (vulnerability_id) WHERE (note_id IS NULL); CREATE UNIQUE INDEX index_vulns_user_mentions_on_vulnerability_id_and_note_id ON vulnerability_user_mentions USING btree (vulnerability_id, note_id); @@ -30496,6 +30746,8 @@ CREATE INDEX index_web_hook_logs_part_on_web_hook_id ON ONLY web_hook_logs USING CREATE INDEX index_web_hooks_on_group_id ON web_hooks USING btree (group_id) WHERE ((type)::text = 'GroupHook'::text); +CREATE INDEX index_web_hooks_on_integration_id ON web_hooks USING btree (integration_id); + CREATE INDEX index_web_hooks_on_project_id ON web_hooks USING btree (project_id); CREATE INDEX index_web_hooks_on_project_id_recent_failures ON web_hooks USING btree (project_id, recent_failures); @@ -30590,6 +30842,20 @@ CREATE UNIQUE INDEX partial_index_sop_configs_on_project_id ON security_orchestr CREATE INDEX partial_index_user_id_app_id_created_at_token_not_revoked ON oauth_access_tokens USING btree (resource_owner_id, application_id, created_at) WHERE (revoked_at IS NULL); +CREATE INDEX security_findings_confidence_idx ON ONLY security_findings USING btree (confidence); + +CREATE INDEX security_findings_project_fingerprint_idx ON ONLY security_findings USING btree (project_fingerprint); + +CREATE INDEX security_findings_scan_id_deduplicated_idx ON ONLY security_findings USING btree (scan_id, deduplicated); + +CREATE INDEX security_findings_scan_id_id_idx ON ONLY security_findings USING btree (scan_id, id); + +CREATE INDEX security_findings_scanner_id_idx ON ONLY security_findings USING btree (scanner_id); + +CREATE INDEX security_findings_severity_idx ON ONLY security_findings USING btree (severity); + +CREATE UNIQUE INDEX security_findings_uuid_scan_id_partition_number_idx ON ONLY security_findings USING btree (uuid, scan_id, partition_number); + CREATE UNIQUE INDEX snippet_user_mentions_on_snippet_id_and_note_id_index ON snippet_user_mentions USING btree (snippet_id, note_id); CREATE UNIQUE INDEX snippet_user_mentions_on_snippet_id_index ON snippet_user_mentions USING btree (snippet_id) WHERE (note_id IS NULL); @@ -30598,17 +30864,17 @@ CREATE UNIQUE INDEX taggings_idx ON taggings USING btree (tag_id, taggable_id, t CREATE UNIQUE INDEX term_agreements_unique_index ON term_agreements USING btree (user_id, term_id); -CREATE INDEX tmp_idx_container_repos_on_non_migrated ON container_repositories USING btree (project_id, id) WHERE ((migration_state <> 'import_done'::text) AND (created_at < '2022-01-23 00:00:00'::timestamp without time zone)); +CREATE INDEX tmp_index_approval_merge_request_rules_on_report_type_equal_one ON approval_merge_request_rules USING btree (id, report_type) WHERE (report_type = 1); CREATE INDEX tmp_index_ci_job_artifacts_on_expire_at_where_locked_unknown ON ci_job_artifacts USING btree (expire_at, job_id) WHERE ((locked = 2) AND (expire_at IS NOT NULL)); -CREATE INDEX tmp_index_ci_job_artifacts_on_id_where_trace_and_expire_at ON ci_job_artifacts USING btree (id) WHERE ((file_type = 3) AND (expire_at = ANY (ARRAY['2021-04-22 00:00:00+00'::timestamp with time zone, '2021-05-22 00:00:00+00'::timestamp with time zone, '2021-06-22 00:00:00+00'::timestamp with time zone, '2022-01-22 00:00:00+00'::timestamp with time zone, '2022-02-22 00:00:00+00'::timestamp with time zone, '2022-03-22 00:00:00+00'::timestamp with time zone, '2022-04-22 00:00:00+00'::timestamp with time zone]))); +CREATE INDEX tmp_index_ci_job_artifacts_on_id_expire_at_file_type_trace ON ci_job_artifacts USING btree (id) WHERE (((date_part('day'::text, timezone('UTC'::text, expire_at)) = ANY (ARRAY[(21)::double precision, (22)::double precision, (23)::double precision])) AND (date_part('minute'::text, timezone('UTC'::text, expire_at)) = ANY (ARRAY[(0)::double precision, (30)::double precision, (45)::double precision])) AND (date_part('second'::text, timezone('UTC'::text, expire_at)) = (0)::double precision)) OR (file_type = 3)); CREATE INDEX tmp_index_cis_vulnerability_reads_on_id ON vulnerability_reads USING btree (id) WHERE (report_type = 7); -CREATE INDEX tmp_index_container_repositories_on_id_migration_state ON container_repositories USING btree (id, migration_state); +CREATE INDEX tmp_index_container_repos_on_non_migrated ON container_repositories USING btree (project_id, id) WHERE (migration_state <> 'import_done'::text); -CREATE INDEX tmp_index_for_namespace_id_migration_on_group_members ON members USING btree (id) WHERE ((member_namespace_id IS NULL) AND ((type)::text = 'GroupMember'::text)); +CREATE INDEX tmp_index_container_repositories_on_id_migration_state ON container_repositories USING btree (id, migration_state); CREATE INDEX tmp_index_for_null_project_namespace_id ON projects USING btree (id) WHERE (project_namespace_id IS NULL); @@ -30618,7 +30884,7 @@ CREATE INDEX tmp_index_issues_on_issue_type_and_id ON issues USING btree (issue_ CREATE INDEX tmp_index_members_on_state ON members USING btree (state) WHERE (state = 2); -CREATE INDEX tmp_index_merge_requests_draft_and_status ON merge_requests USING btree (id) WHERE ((draft = false) AND (state_id = 1) AND ((title)::text ~* '^(\[draft\]|\(draft\)|draft:|draft|\[WIP\]|WIP:|WIP)'::text)); +CREATE INDEX tmp_index_merge_request_reviewers_on_attention_requested_state ON merge_request_reviewers USING btree (id) WHERE (state = 2); CREATE INDEX tmp_index_migrated_container_registries ON container_repositories USING btree (project_id) WHERE ((migration_state = 'import_done'::text) OR (created_at >= '2022-01-23 00:00:00'::timestamp without time zone)); @@ -30628,7 +30894,11 @@ CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING CREATE INDEX tmp_index_project_statistics_cont_registry_size ON project_statistics USING btree (project_id) WHERE (container_registry_size = 0); -CREATE INDEX tmp_index_todos_attention_request_action ON todos USING btree (id) WHERE (action = 10); +CREATE INDEX tmp_index_system_note_metadata_on_attention_request_actions ON system_note_metadata USING btree (id) WHERE ((action)::text = ANY ((ARRAY['attention_requested'::character varying, 'attention_request_removed'::character varying])::text[])); + +CREATE INDEX tmp_index_system_note_metadata_on_id_where_task ON system_note_metadata USING btree (id, action) WHERE ((action)::text = 'task'::text); + +CREATE INDEX tmp_index_user_callouts_on_attention_request_feature_names ON user_callouts USING btree (id) WHERE (feature_name = ANY (ARRAY[47, 48])); CREATE INDEX tmp_index_vulnerability_occurrences_on_id_and_scanner_id ON vulnerability_occurrences USING btree (id, scanner_id) WHERE (report_type = ANY (ARRAY[7, 99])); @@ -31962,6 +32232,12 @@ CREATE TRIGGER nullify_merge_request_metrics_build_data_on_update BEFORE UPDATE CREATE TRIGGER projects_loose_fk_trigger AFTER DELETE ON projects REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records(); +CREATE TRIGGER trigger_a645cee67576 BEFORE UPDATE OF integration_id ON web_hooks FOR EACH ROW EXECUTE FUNCTION function_for_trigger_a645cee67576(); + +CREATE TRIGGER trigger_a87bcfdf0f0b BEFORE INSERT ON web_hooks FOR EACH ROW EXECUTE FUNCTION function_for_trigger_a87bcfdf0f0b(); + +CREATE TRIGGER trigger_aca5c963d732 BEFORE UPDATE OF service_id ON web_hooks FOR EACH ROW EXECUTE FUNCTION function_for_trigger_aca5c963d732(); + CREATE TRIGGER trigger_delete_project_namespace_on_project_delete AFTER DELETE ON projects FOR EACH ROW WHEN ((old.project_namespace_id IS NOT NULL)) EXECUTE FUNCTION delete_associated_project_namespace(); CREATE TRIGGER trigger_has_external_issue_tracker_on_delete AFTER DELETE ON integrations FOR EACH ROW WHEN ((((old.category)::text = 'issue_tracker'::text) AND (old.active = true) AND (old.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker(); @@ -31982,9 +32258,7 @@ CREATE TRIGGER trigger_insert_or_update_vulnerability_reads_from_occurrences AFT CREATE TRIGGER trigger_insert_vulnerability_reads_from_vulnerability AFTER UPDATE ON vulnerabilities FOR EACH ROW WHEN (((old.present_on_default_branch IS NOT TRUE) AND (new.present_on_default_branch IS TRUE))) EXECUTE FUNCTION insert_vulnerability_reads_from_vulnerability(); -CREATE TRIGGER trigger_namespaces_parent_id_on_insert AFTER INSERT ON namespaces FOR EACH ROW EXECUTE FUNCTION insert_namespaces_sync_event(); - -CREATE TRIGGER trigger_namespaces_parent_id_on_update AFTER UPDATE ON namespaces FOR EACH ROW WHEN ((old.parent_id IS DISTINCT FROM new.parent_id)) EXECUTE FUNCTION insert_namespaces_sync_event(); +CREATE TRIGGER trigger_namespaces_traversal_ids_on_update AFTER UPDATE ON namespaces FOR EACH ROW WHEN ((old.traversal_ids IS DISTINCT FROM new.traversal_ids)) EXECUTE FUNCTION insert_namespaces_sync_event(); CREATE TRIGGER trigger_projects_parent_id_on_insert AFTER INSERT ON projects FOR EACH ROW EXECUTE FUNCTION insert_projects_sync_event(); @@ -32014,6 +32288,9 @@ ALTER TABLE ONLY deployments ALTER TABLE ONLY epics ADD CONSTRAINT fk_013c9f36ca FOREIGN KEY (due_date_sourcing_epic_id) REFERENCES epics(id) ON DELETE SET NULL; +ALTER TABLE ONLY environments + ADD CONSTRAINT fk_01a033a308 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE SET NULL; + ALTER TABLE ONLY incident_management_escalation_rules ADD CONSTRAINT fk_0314ee86eb FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; @@ -32110,6 +32387,9 @@ ALTER TABLE ONLY boards ALTER TABLE ONLY epics ADD CONSTRAINT fk_1fbed67632 FOREIGN KEY (start_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL; +ALTER TABLE ONLY ghost_user_migrations + ADD CONSTRAINT fk_202e642a2f FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; + ALTER TABLE ONLY coverage_fuzzing_corpuses ADD CONSTRAINT fk_204d40056a FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -32173,6 +32453,9 @@ ALTER TABLE ONLY lfs_objects_projects ALTER TABLE ONLY vulnerability_merge_request_links ADD CONSTRAINT fk_2ef3954596 FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE; +ALTER TABLE ONLY members + ADD CONSTRAINT fk_2f85abf8f1 FOREIGN KEY (member_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE NOT VALID; + ALTER TABLE ONLY analytics_cycle_analytics_group_stages ADD CONSTRAINT fk_3078345d6d FOREIGN KEY (stage_event_hash_id) REFERENCES analytics_cycle_analytics_stage_event_hashes(id) ON DELETE CASCADE; @@ -32416,6 +32699,9 @@ ALTER TABLE ONLY vulnerabilities ALTER TABLE ONLY issue_customer_relations_contacts ADD CONSTRAINT fk_7b92f835bb FOREIGN KEY (contact_id) REFERENCES customer_relations_contacts(id) ON DELETE CASCADE; +ALTER TABLE ONLY broadcast_messages + ADD CONSTRAINT fk_7bf2ec43da FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE; + ALTER TABLE ONLY vulnerabilities ADD CONSTRAINT fk_7c5bb22a22 FOREIGN KEY (due_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL; @@ -32473,6 +32759,9 @@ ALTER TABLE ONLY requirements_management_test_reports ALTER TABLE ONLY issues ADD CONSTRAINT fk_899c8f3231 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY sbom_vulnerable_component_versions + ADD CONSTRAINT fk_8a2a1197f9 FOREIGN KEY (sbom_component_version_id) REFERENCES sbom_component_versions(id) ON DELETE CASCADE; + ALTER TABLE ONLY protected_branch_merge_access_levels ADD CONSTRAINT fk_8a3072ccb3 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE; @@ -32773,6 +33062,9 @@ ALTER TABLE ONLY lists ALTER TABLE ONLY agent_activity_events ADD CONSTRAINT fk_d6f785c9fc FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL; +ALTER TABLE ONLY sbom_vulnerable_component_versions + ADD CONSTRAINT fk_d720a1959a FOREIGN KEY (vulnerability_advisory_id) REFERENCES vulnerability_advisories(id) ON DELETE CASCADE; + ALTER TABLE ONLY metrics_users_starred_dashboards ADD CONSTRAINT fk_d76a2b9a8c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -32797,6 +33089,9 @@ ALTER TABLE ONLY project_group_links ALTER TABLE ONLY project_topics ADD CONSTRAINT fk_db13576296 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY web_hooks + ADD CONSTRAINT fk_db1ea5699b FOREIGN KEY (integration_id) REFERENCES integrations(id) ON DELETE CASCADE; + ALTER TABLE ONLY security_scans ADD CONSTRAINT fk_dbc89265b9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -33664,7 +33959,7 @@ ALTER TABLE ONLY project_custom_attributes ALTER TABLE ONLY ci_pending_builds ADD CONSTRAINT fk_rails_725a2644a3 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE; -ALTER TABLE ONLY security_findings +ALTER TABLE security_findings ADD CONSTRAINT fk_rails_729b763a54 FOREIGN KEY (scanner_id) REFERENCES vulnerability_scanners(id) ON DELETE CASCADE; ALTER TABLE ONLY dast_scanner_profiles @@ -34072,6 +34367,9 @@ ALTER TABLE ONLY issues_prometheus_alert_events ALTER TABLE ONLY merge_trains ADD CONSTRAINT fk_rails_b374b5225d FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; +ALTER TABLE ONLY merge_request_predictions + ADD CONSTRAINT fk_rails_b3b78cbcd0 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; + ALTER TABLE ONLY incident_management_escalation_rules ADD CONSTRAINT fk_rails_b3c9c17bd4 FOREIGN KEY (oncall_schedule_id) REFERENCES incident_management_oncall_schedules(id) ON DELETE CASCADE; @@ -34093,6 +34391,9 @@ ALTER TABLE ONLY approval_project_rules_protected_branches ALTER TABLE ONLY packages_composer_cache_files ADD CONSTRAINT fk_rails_b82cea43a0 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE SET NULL; +ALTER TABLE ONLY dora_configurations + ADD CONSTRAINT fk_rails_b9b8d90ddb FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY merge_trains ADD CONSTRAINT fk_rails_b9d67af01d FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE; @@ -34102,7 +34403,7 @@ ALTER TABLE ONLY approval_project_rules_users ALTER TABLE ONLY lists ADD CONSTRAINT fk_rails_baed5f39b7 FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE CASCADE; -ALTER TABLE ONLY security_findings +ALTER TABLE security_findings ADD CONSTRAINT fk_rails_bb63863cf1 FOREIGN KEY (scan_id) REFERENCES security_scans(id) ON DELETE CASCADE; ALTER TABLE ONLY packages_debian_project_component_files @@ -34273,6 +34574,9 @@ ALTER TABLE ONLY geo_hashed_storage_attachments_events ALTER TABLE ONLY ml_candidate_params ADD CONSTRAINT fk_rails_d4a51d1185 FOREIGN KEY (candidate_id) REFERENCES ml_candidates(id); +ALTER TABLE ONLY packages_rpm_metadata + ADD CONSTRAINT fk_rails_d79f02264b FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE; + ALTER TABLE ONLY merge_request_reviewers ADD CONSTRAINT fk_rails_d9fec24b9d FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; -- cgit v1.2.3