Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-17 14:33:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-17 14:33:21 +0300
commit7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch)
tree5bdc2229f5198d516781f8d24eace62fc7e589e9 /db
parent185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff)
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'db')
-rw-r--r--db/docs/approval_merge_request_rule_sources.yml2
-rw-r--r--db/docs/approval_merge_request_rules.yml2
-rw-r--r--db/docs/approval_merge_request_rules_groups.yml2
-rw-r--r--db/docs/approval_merge_request_rules_users.yml2
-rw-r--r--db/docs/approval_project_rules.yml2
-rw-r--r--db/docs/approval_project_rules_groups.yml2
-rw-r--r--db/docs/approval_project_rules_protected_branches.yml2
-rw-r--r--db/docs/approval_project_rules_users.yml2
-rw-r--r--db/docs/approvals.yml2
-rw-r--r--db/docs/approver_groups.yml5
-rw-r--r--db/docs/approvers.yml1
-rw-r--r--db/docs/audit_events_streaming_event_type_filters.yml9
-rw-r--r--db/docs/ci_build_report_results.yml2
-rw-r--r--db/docs/ci_daily_build_group_report_results.yml2
-rw-r--r--db/docs/ci_deleted_objects.yml2
-rw-r--r--db/docs/ci_job_artifacts.yml2
-rw-r--r--db/docs/ci_pipeline_artifacts.yml2
-rw-r--r--db/docs/ci_unit_test_failures.yml2
-rw-r--r--db/docs/ci_unit_tests.yml2
-rw-r--r--db/docs/content_blocked_states.yml2
-rw-r--r--db/docs/dependency_proxy_blob_states.yml9
-rw-r--r--db/docs/diff_note_positions.yml2
-rw-r--r--db/docs/experiment_users.yml9
-rw-r--r--db/docs/external_approval_rules_protected_branches.yml4
-rw-r--r--db/docs/external_status_checks.yml4
-rw-r--r--db/docs/external_status_checks_protected_branches.yml4
-rw-r--r--db/docs/fork_network_members.yml4
-rw-r--r--db/docs/gpg_key_subkeys.yml4
-rw-r--r--db/docs/gpg_keys.yml4
-rw-r--r--db/docs/gpg_signatures.yml4
-rw-r--r--db/docs/group_merge_request_approval_settings.yml2
-rw-r--r--db/docs/merge_request_blocks.yml6
-rw-r--r--db/docs/merge_request_context_commit_diff_files.yml4
-rw-r--r--db/docs/namespace_aggregation_schedules.yml6
-rw-r--r--db/docs/namespace_commit_emails.yml9
-rw-r--r--db/docs/p_ci_builds_metadata.yml9
-rw-r--r--db/docs/path_locks.yml2
-rw-r--r--db/docs/project_aliases.yml2
-rw-r--r--db/docs/project_build_artifacts_size_refreshes.yml2
-rw-r--r--db/docs/project_ci_feature_usages.yml2
-rw-r--r--db/docs/project_daily_statistics.yml4
-rw-r--r--db/docs/project_repositories.yml2
-rw-r--r--db/docs/project_repository_states.yml4
-rw-r--r--db/docs/project_repository_storage_moves.yml4
-rw-r--r--db/docs/project_wiki_repositories.yml9
-rw-r--r--db/docs/protected_branch_merge_access_levels.yml2
-rw-r--r--db/docs/protected_branch_push_access_levels.yml2
-rw-r--r--db/docs/protected_branch_unprotect_access_levels.yml2
-rw-r--r--db/docs/protected_branches.yml2
-rw-r--r--db/docs/protected_tag_create_access_levels.yml2
-rw-r--r--db/docs/protected_tags.yml4
-rw-r--r--db/docs/push_event_payloads.yml6
-rw-r--r--db/docs/remote_mirrors.yml4
-rw-r--r--db/docs/repository_languages.yml4
-rw-r--r--db/docs/required_code_owners_sections.yml2
-rw-r--r--db/docs/software_license_policies.yml2
-rw-r--r--db/docs/software_licenses.yml2
-rw-r--r--db/docs/trending_projects.yml4
-rw-r--r--db/docs/x509_certificates.yml2
-rw-r--r--db/docs/x509_commit_signatures.yml2
-rw-r--r--db/docs/x509_issuers.yml2
-rw-r--r--db/fixtures/development/17_cycle_analytics.rb7
-rw-r--r--db/fixtures/development/98_gitlab_instance_administration_project.rb7
-rw-r--r--db/fixtures/production/998_gitlab_instance_administration_project.rb4
-rw-r--r--db/migrate/20210305031822_create_dast_site_profile_variables.rb2
-rw-r--r--db/migrate/20210317035357_create_dast_profiles_pipelines.rb2
-rw-r--r--db/migrate/20210412111213_create_security_orchestration_policy_rule_schedule.rb2
-rw-r--r--db/migrate/20210423054022_create_dast_site_profiles_pipelines.rb2
-rw-r--r--db/migrate/20210604032738_create_dast_site_profiles_builds.rb2
-rw-r--r--db/migrate/20210604051330_create_dast_scanner_profiles_builds.rb2
-rw-r--r--db/migrate/20210713123345_create_dast_profile_schedule.rb2
-rw-r--r--db/migrate/20220613112029_add_namespace_id_to_protected_branches.rb9
-rw-r--r--db/migrate/20220613112030_add_namespace_id_indexes_foreign_key_to_protected_branches.rb19
-rw-r--r--db/migrate/20220613112031_add_group_or_project_constraint_in_protected_branches.rb18
-rw-r--r--db/migrate/20220613112032_change_project_id_null_in_protected_branches.rb13
-rw-r--r--db/migrate/20220721065723_add_issue_branch_template_to_project_settings.rb17
-rw-r--r--db/migrate/20220919062640_add_mirror_branch_regex_to_remote_mirrors.rb15
-rw-r--r--db/migrate/20220920135632_add_jira_connect_proxy_url_setting.rb10
-rw-r--r--db/migrate/20220920135717_add_textlimit_to_jira_connect_proxy_url_setting.rb13
-rw-r--r--db/migrate/20220926023734_add_mirror_branch_regex_to_project_settings.rb12
-rw-r--r--db/migrate/20221003151747_create_audit_events_streaming_event_type_filters.rb18
-rw-r--r--db/migrate/20221010103207_add_product_analytics_enabled_to_application_settings.rb7
-rw-r--r--db/migrate/20221010184839_add_new_amount_used_to_ci_project_monthly_usages.rb24
-rw-r--r--db/migrate/20221010201815_add_purl_type_to_sbom_components.rb7
-rw-r--r--db/migrate/20221010202339_remove_unique_index_on_sbom_components_type_and_name.rb15
-rw-r--r--db/migrate/20221010202408_add_unique_index_on_sbom_components_type_name_and_purl_type.rb15
-rw-r--r--db/migrate/20221013103738_add_disable_admin_oauth_scopes.rb7
-rw-r--r--db/migrate/20221015000511_add_email_confirmation_setting_to_application_settings.rb7
-rw-r--r--db/migrate/20221017084208_rename_ci_pipeline_metadata_title.rb13
-rw-r--r--db/migrate/20221018050323_add_objective_and_keyresult_to_work_item_types.rb56
-rw-r--r--db/migrate/20221018092552_add_file_name_index_to_packages_rpm_repository_files.rb18
-rw-r--r--db/migrate/20221018124029_add_consume_after_to_ghost_user_migrations.rb7
-rw-r--r--db/migrate/20221018124035_add_consume_after_index_to_ghost_user_migrations.rb15
-rw-r--r--db/migrate/20221018202524_create_dependency_proxy_blob_states.rb49
-rw-r--r--db/migrate/20221020124018_add_delete_started_at_to_container_repositories.rb11
-rw-r--r--db/migrate/20221021213216_create_namespace_commit_emails.rb14
-rw-r--r--db/migrate/20221022213505_add_namespace_commit_emails_namespace_fk.rb15
-rw-r--r--db/migrate/20221022213521_add_namespace_commit_emails_email_fk.rb15
-rw-r--r--db/migrate/20221025043930_change_default_value_on_password_last_changed_at_to_user_details.rb13
-rw-r--r--db/migrate/20221025105205_add_status_and_id_index_to_container_repositories.rb15
-rw-r--r--db/migrate/20221025145452_change_vulnerability_feedback_unique_idx.rb25
-rw-r--r--db/migrate/20221025150202_add_index_for_finding_uuid_and_feedback_type_on_feedback.rb15
-rw-r--r--db/migrate/20221027124848_add_text_limit_to_project_settings_mirror_branch_regex.rb13
-rw-r--r--db/migrate/20221028015347_add_commit_committer_name_check_to_push_rules.rb7
-rw-r--r--db/migrate/20221028152422_add_finding_data_column_to_security_findings.rb13
-rw-r--r--db/migrate/20221031102916_add_users_foreign_key_to_projects.rb15
-rw-r--r--db/migrate/20221101032521_add_default_preferred_language_to_application_settings.rb10
-rw-r--r--db/migrate/20221101032600_add_text_limit_to_default_preferred_language_on_application_settings.rb15
-rw-r--r--db/migrate/20221101195903_change_email_confirmation_setting_default.rb7
-rw-r--r--db/migrate/20221101201031_set_email_confirmation_setting_from_send_user_confirmation_email_setting.rb22
-rw-r--r--db/migrate/20221102202130_extend_x509_subject_limit.rb11
-rw-r--r--db/migrate/20221102225800_add_max_seats_used_changed_at_index_to_gitlab_subscriptions.rb15
-rw-r--r--db/migrate/20221103131409_add_partial_index_on_primary_key_of_security_scans.rb15
-rw-r--r--db/migrate/20221104061320_add_disable_download_button_into_application_settings.rb8
-rw-r--r--db/migrate/20221104094042_remove_users_foreign_key_to_projects.rb15
-rw-r--r--db/migrate/20221107115247_change_scim_identity_group_id_remove_null.rb10
-rw-r--r--db/migrate/20221107115413_change_scim_oauth_access_token_group_id_remove_null.rb10
-rw-r--r--db/migrate/20221107183222_create_project_wiki_repositories.rb11
-rw-r--r--db/migrate/20221107184542_add_new_amount_used_to_ci_namespace_monthly_usages.rb24
-rw-r--r--db/migrate/20221108015813_add_telesign_to_application_settings.rb11
-rw-r--r--db/migrate/20221108185442_add_project_wiki_repository_id_to_project_wiki_repository_states.rb35
-rw-r--r--db/migrate/20221110105857_add_index_for_in_product_marketing_email_metrics.rb15
-rw-r--r--db/migrate/20221110150942_add_project_id_lower_name_index_remove_old_index.rb26
-rw-r--r--db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb2
-rw-r--r--db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb2
-rw-r--r--db/post_migrate/20210615234935_fix_batched_migrations_old_format_job_arguments.rb4
-rw-r--r--db/post_migrate/20210818185845_backfill_projects_with_coverage.rb23
-rw-r--r--db/post_migrate/20220802112102_schedule_migrate_shared_vulnerability_scanners.rb24
-rw-r--r--db/post_migrate/20220919080303_delete_migrate_shared_vulnerability_scanners.rb44
-rw-r--r--db/post_migrate/20220919080304_reschedule_migrate_shared_vulnerability_scanners.rb29
-rw-r--r--db/post_migrate/20220927171740_prepare_for_vulnerability_occurrences_uuid_type_transition.rb26
-rw-r--r--db/post_migrate/20221004074910_routing_table_prepare_constraint_for_builds_metadata.rb30
-rw-r--r--db/post_migrate/20221004074914_create_routing_table_for_builds_metadata.rb7
-rw-r--r--db/post_migrate/20221006070927_finalize_invalid_member_cleanup.rb22
-rw-r--r--db/post_migrate/20221006172302_adjust_task_note_rename_background_migration_values.rb2
-rw-r--r--db/post_migrate/20221010141500_add_index_author_id_target_project_id_on_merge_requests.rb15
-rw-r--r--db/post_migrate/20221010162137_add_index_author_id_and_id_on_merge_requests.rb15
-rw-r--r--db/post_migrate/20221011062254_sync_new_amount_used_for_ci_project_monthly_usages.rb19
-rw-r--r--db/post_migrate/20221013215832_cleanup_vulnerability_state_transitions_with_same_from_state_to_state.rb19
-rw-r--r--db/post_migrate/20221017084227_cleanup_rename_ci_pipeline_metadata_title.rb13
-rw-r--r--db/post_migrate/20221018062308_schedule_backfill_project_namespace_details.rb29
-rw-r--r--db/post_migrate/20221018193635_ensure_task_note_renaming_background_migration_finished.rb22
-rw-r--r--db/post_migrate/20221018193827_drop_tmp_index_system_note_metadata_on_id_where_task.rb15
-rw-r--r--db/post_migrate/20221018232820_add_temp_index_for_user_details_fields.rb22
-rw-r--r--db/post_migrate/20221019002459_queue_backfill_user_details_fields.rb16
-rw-r--r--db/post_migrate/20221019102426_remove_tmp_index_approval_merge_request_rules_on_report_type.rb18
-rw-r--r--db/post_migrate/20221019105041_queue_populate_projects_star_count.rb22
-rw-r--r--db/post_migrate/20221019141508_add_index_to_test_reports_issue_id_created_at_and_id.rb16
-rw-r--r--db/post_migrate/20221019194751_disable_fastupdate_on_issues_title_gin_index.rb23
-rw-r--r--db/post_migrate/20221019195754_disable_fastupdate_on_issues_description_gin_index.rb23
-rw-r--r--db/post_migrate/20221019200033_disable_fastupdate_on_merge_requests_title_gin_index.rb23
-rw-r--r--db/post_migrate/20221019200206_disable_fastupdate_on_merge_requests_description_gin_index.rb23
-rw-r--r--db/post_migrate/20221021082255_add_unique_index_on_ci_runners_token.rb20
-rw-r--r--db/post_migrate/20221021082312_add_unique_index_on_ci_runners_token_encrypted.rb20
-rw-r--r--db/post_migrate/20221021082720_drop_index_on_ci_runners_token.rb17
-rw-r--r--db/post_migrate/20221021082734_drop_index_on_ci_runners_token_encrypted.rb17
-rw-r--r--db/post_migrate/20221021145820_create_routing_table_for_builds_metadata_v2.rb41
-rw-r--r--db/post_migrate/20221021160735_add_index_for_common_finder_query_desc_with_namespace_id.rb18
-rw-r--r--db/post_migrate/20221024034228_remove_sprints_project_id_column.rb38
-rw-r--r--db/post_migrate/20221024121500_drop_fingerprint_from_sbom_sources.rb9
-rw-r--r--db/post_migrate/20221025115006_check_vulnerabilities_state_transition_from_state_not_equal_to_state.rb19
-rw-r--r--db/post_migrate/20221025220607_add_index_id_on_scan_finding_approval_merge_request_rules.rb17
-rw-r--r--db/post_migrate/20221027203556_delete_experiment_user_foreign_keys.rb20
-rw-r--r--db/post_migrate/20221027203951_drop_experiment_users_table.rb21
-rw-r--r--db/post_migrate/20221028000041_remove_invalid_partial_trigram_indexes_for_issues.rb15
-rw-r--r--db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb25
-rw-r--r--db/post_migrate/20221028022627_add_index_on_password_last_changed_at_to_user_details.rb15
-rw-r--r--db/post_migrate/20221102090940_create_next_ci_partitions_record.rb29
-rw-r--r--db/post_migrate/20221102090943_create_second_partition_for_builds_metadata.rb62
-rw-r--r--db/post_migrate/20221103073328_change_member_namespace_id_not_null.rb16
-rw-r--r--db/post_migrate/20221103084213_remove_tmp_index_members_on_id_where_namespace_id_null.rb15
-rw-r--r--db/post_migrate/20221103150250_migrate_sidekiq_queued_jobs.rb11
-rw-r--r--db/post_migrate/20221104042137_add_partial_trigram_index_for_issue_title_attempt_2.rb19
-rw-r--r--db/post_migrate/20221104042159_add_partial_trigram_index_for_issue_description_attempt_2.rb19
-rw-r--r--db/post_migrate/20221104074652_add_temp_index_for_project_statistics_upload_size_migration.rb19
-rw-r--r--db/post_migrate/20221104100203_recreate_async_trigram_index_for_vulnerability_reads_container_images.rb21
-rw-r--r--db/post_migrate/20221104170500_add_vulnerability_reads_all_status_index.rb14
-rw-r--r--db/post_migrate/20221104190203_validate_environment_id_on_deployments.rb11
-rw-r--r--db/post_migrate/20221107094359_recount_epic_cache_counts.rb29
-rw-r--r--db/post_migrate/20221107184758_sync_new_amount_used_for_ci_namespace_monthly_usages.rb19
-rw-r--r--db/post_migrate/20221107220420_validate_not_null_constraint_on_member_namespace_id.rb15
-rw-r--r--db/post_migrate/20221107220526_validate_fk_member_namespace_id.rb13
-rw-r--r--db/post_migrate/20221107222213_remove_old_member_namespace_id_fk.rb28
-rw-r--r--db/post_migrate/20221108045019_truncate_timeline_event_tags_table.rb13
-rw-r--r--db/post_migrate/20221108121322_add_supporting_index_for_vulnerabilities_feedback_migration.rb24
-rw-r--r--db/post_migrate/20221108222015_remove_temp_index_on_project_features_where_releases_access_level_gt_repository.rb18
-rw-r--r--db/post_migrate/20221110045406_sanitize_confidential_note_todos.rb31
-rw-r--r--db/post_migrate/20221111070314_prepare_removal_of_issue_trigram_indexes.rb16
-rw-r--r--db/schema_migrations/202206131120291
-rw-r--r--db/schema_migrations/202206131120301
-rw-r--r--db/schema_migrations/202206131120311
-rw-r--r--db/schema_migrations/202206131120321
-rw-r--r--db/schema_migrations/202207210657231
-rw-r--r--db/schema_migrations/202209190626401
-rw-r--r--db/schema_migrations/202209190803031
-rw-r--r--db/schema_migrations/202209190803041
-rw-r--r--db/schema_migrations/202209201356321
-rw-r--r--db/schema_migrations/202209201357171
-rw-r--r--db/schema_migrations/202209260237341
-rw-r--r--db/schema_migrations/202209271717401
-rw-r--r--db/schema_migrations/202210031517471
-rw-r--r--db/schema_migrations/202210040749101
-rw-r--r--db/schema_migrations/202210040749141
-rw-r--r--db/schema_migrations/202210060709271
-rw-r--r--db/schema_migrations/202210101032071
-rw-r--r--db/schema_migrations/202210101415001
-rw-r--r--db/schema_migrations/202210101621371
-rw-r--r--db/schema_migrations/202210101848391
-rw-r--r--db/schema_migrations/202210102018151
-rw-r--r--db/schema_migrations/202210102023391
-rw-r--r--db/schema_migrations/202210102024081
-rw-r--r--db/schema_migrations/202210110622541
-rw-r--r--db/schema_migrations/202210131037381
-rw-r--r--db/schema_migrations/202210132158321
-rw-r--r--db/schema_migrations/202210150005111
-rw-r--r--db/schema_migrations/202210170842081
-rw-r--r--db/schema_migrations/202210170842271
-rw-r--r--db/schema_migrations/202210180503231
-rw-r--r--db/schema_migrations/202210180623081
-rw-r--r--db/schema_migrations/202210180925521
-rw-r--r--db/schema_migrations/202210181240291
-rw-r--r--db/schema_migrations/202210181240351
-rw-r--r--db/schema_migrations/202210181936351
-rw-r--r--db/schema_migrations/202210181938271
-rw-r--r--db/schema_migrations/202210182025241
-rw-r--r--db/schema_migrations/202210182328201
-rw-r--r--db/schema_migrations/202210190024591
-rw-r--r--db/schema_migrations/202210191024261
-rw-r--r--db/schema_migrations/202210191050411
-rw-r--r--db/schema_migrations/202210191415081
-rw-r--r--db/schema_migrations/202210191947511
-rw-r--r--db/schema_migrations/202210191957541
-rw-r--r--db/schema_migrations/202210192000331
-rw-r--r--db/schema_migrations/202210192002061
-rw-r--r--db/schema_migrations/202210201240181
-rw-r--r--db/schema_migrations/202210210822551
-rw-r--r--db/schema_migrations/202210210823121
-rw-r--r--db/schema_migrations/202210210827201
-rw-r--r--db/schema_migrations/202210210827341
-rw-r--r--db/schema_migrations/202210211458201
-rw-r--r--db/schema_migrations/202210211607351
-rw-r--r--db/schema_migrations/202210212132161
-rw-r--r--db/schema_migrations/202210222135051
-rw-r--r--db/schema_migrations/202210222135211
-rw-r--r--db/schema_migrations/202210240342281
-rw-r--r--db/schema_migrations/202210241215001
-rw-r--r--db/schema_migrations/202210250439301
-rw-r--r--db/schema_migrations/202210251052051
-rw-r--r--db/schema_migrations/202210251150061
-rw-r--r--db/schema_migrations/202210251454521
-rw-r--r--db/schema_migrations/202210251502021
-rw-r--r--db/schema_migrations/202210252206071
-rw-r--r--db/schema_migrations/202210271248481
-rw-r--r--db/schema_migrations/202210272035561
-rw-r--r--db/schema_migrations/202210272039511
-rw-r--r--db/schema_migrations/202210280000411
-rw-r--r--db/schema_migrations/202210280006031
-rw-r--r--db/schema_migrations/202210280153471
-rw-r--r--db/schema_migrations/202210280226271
-rw-r--r--db/schema_migrations/202210281524221
-rw-r--r--db/schema_migrations/202210311029161
-rw-r--r--db/schema_migrations/202211010325211
-rw-r--r--db/schema_migrations/202211010326001
-rw-r--r--db/schema_migrations/202211011959031
-rw-r--r--db/schema_migrations/202211012010311
-rw-r--r--db/schema_migrations/202211020909401
-rw-r--r--db/schema_migrations/202211020909431
-rw-r--r--db/schema_migrations/202211022021301
-rw-r--r--db/schema_migrations/202211022258001
-rw-r--r--db/schema_migrations/202211030733281
-rw-r--r--db/schema_migrations/202211030842131
-rw-r--r--db/schema_migrations/202211031314091
-rw-r--r--db/schema_migrations/202211031502501
-rw-r--r--db/schema_migrations/202211040421371
-rw-r--r--db/schema_migrations/202211040421591
-rw-r--r--db/schema_migrations/202211040613201
-rw-r--r--db/schema_migrations/202211040746521
-rw-r--r--db/schema_migrations/202211040940421
-rw-r--r--db/schema_migrations/202211041002031
-rw-r--r--db/schema_migrations/202211041705001
-rw-r--r--db/schema_migrations/202211041902031
-rw-r--r--db/schema_migrations/202211070943591
-rw-r--r--db/schema_migrations/202211071152471
-rw-r--r--db/schema_migrations/202211071154131
-rw-r--r--db/schema_migrations/202211071832221
-rw-r--r--db/schema_migrations/202211071845421
-rw-r--r--db/schema_migrations/202211071847581
-rw-r--r--db/schema_migrations/202211072204201
-rw-r--r--db/schema_migrations/202211072205261
-rw-r--r--db/schema_migrations/202211072222131
-rw-r--r--db/schema_migrations/202211080158131
-rw-r--r--db/schema_migrations/202211080450191
-rw-r--r--db/schema_migrations/202211081213221
-rw-r--r--db/schema_migrations/202211081854421
-rw-r--r--db/schema_migrations/202211082220151
-rw-r--r--db/schema_migrations/202211100454061
-rw-r--r--db/schema_migrations/202211101058571
-rw-r--r--db/schema_migrations/202211101509421
-rw-r--r--db/schema_migrations/202211110703141
-rw-r--r--db/structure.sql403
303 files changed, 2638 insertions, 239 deletions
diff --git a/db/docs/approval_merge_request_rule_sources.yml b/db/docs/approval_merge_request_rule_sources.yml
index c1b4da16a1e..868d694d190 100644
--- a/db/docs/approval_merge_request_rule_sources.yml
+++ b/db/docs/approval_merge_request_rule_sources.yml
@@ -4,6 +4,6 @@ classes:
- ApprovalMergeRequestRuleSource
feature_categories:
- source_code_management
-description: TODO
+description: Keeps connection between merge request and project approval rule
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/8497
milestone: '11.7'
diff --git a/db/docs/approval_merge_request_rules.yml b/db/docs/approval_merge_request_rules.yml
index 2db3de519db..ad8b3411706 100644
--- a/db/docs/approval_merge_request_rules.yml
+++ b/db/docs/approval_merge_request_rules.yml
@@ -4,6 +4,6 @@ classes:
- ApprovalMergeRequestRule
feature_categories:
- source_code_management
-description: TODO
+description: Keeps approval merge request rules
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/8497
milestone: '11.7'
diff --git a/db/docs/approval_merge_request_rules_groups.yml b/db/docs/approval_merge_request_rules_groups.yml
index 86aa93fa179..1acf9882d57 100644
--- a/db/docs/approval_merge_request_rules_groups.yml
+++ b/db/docs/approval_merge_request_rules_groups.yml
@@ -3,6 +3,6 @@ table_name: approval_merge_request_rules_groups
classes: []
feature_categories:
- source_code_management
-description: TODO
+description: Keeps connection between group and a merge request approval rule
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/8497
milestone: '11.7'
diff --git a/db/docs/approval_merge_request_rules_users.yml b/db/docs/approval_merge_request_rules_users.yml
index 710de6cc0c4..750e7ae1f48 100644
--- a/db/docs/approval_merge_request_rules_users.yml
+++ b/db/docs/approval_merge_request_rules_users.yml
@@ -3,6 +3,6 @@ table_name: approval_merge_request_rules_users
classes: []
feature_categories:
- source_code_management
-description: TODO
+description: Keeps connection between user and a merge request approval rule
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/8497
milestone: '11.7'
diff --git a/db/docs/approval_project_rules.yml b/db/docs/approval_project_rules.yml
index a2a9eeb823f..c2aff9d358f 100644
--- a/db/docs/approval_project_rules.yml
+++ b/db/docs/approval_project_rules.yml
@@ -4,6 +4,6 @@ classes:
- ApprovalProjectRule
feature_categories:
- source_code_management
-description: TODO
+description: Keeps approval project rules
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/8497
milestone: '11.7'
diff --git a/db/docs/approval_project_rules_groups.yml b/db/docs/approval_project_rules_groups.yml
index 11ed75a398b..83eeb52099c 100644
--- a/db/docs/approval_project_rules_groups.yml
+++ b/db/docs/approval_project_rules_groups.yml
@@ -3,6 +3,6 @@ table_name: approval_project_rules_groups
classes: []
feature_categories:
- source_code_management
-description: TODO
+description: Keeps connection between group and a project approval rule
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/8497
milestone: '11.7'
diff --git a/db/docs/approval_project_rules_protected_branches.yml b/db/docs/approval_project_rules_protected_branches.yml
index 197644b75db..a41fd741af8 100644
--- a/db/docs/approval_project_rules_protected_branches.yml
+++ b/db/docs/approval_project_rules_protected_branches.yml
@@ -4,6 +4,6 @@ classes:
- ApprovalProjectRulesProtectedBranch
feature_categories:
- source_code_management
-description: TODO
+description: Keeps relation between approval project rules and protected branches.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/22673
milestone: '12.7'
diff --git a/db/docs/approval_project_rules_users.yml b/db/docs/approval_project_rules_users.yml
index 8fe1c5c7f71..a1ff8bf7bff 100644
--- a/db/docs/approval_project_rules_users.yml
+++ b/db/docs/approval_project_rules_users.yml
@@ -3,6 +3,6 @@ table_name: approval_project_rules_users
classes: []
feature_categories:
- source_code_management
-description: TODO
+description: Keeps connection between user and a project approval rule
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/8497
milestone: '11.7'
diff --git a/db/docs/approvals.yml b/db/docs/approvals.yml
index e26a2ca4aa4..82d833b9ba6 100644
--- a/db/docs/approvals.yml
+++ b/db/docs/approvals.yml
@@ -4,6 +4,6 @@ classes:
- Approval
feature_categories:
- source_code_management
-description: TODO
+description: Stores merge request approvals made by users
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/73faf3c7289c4fa4535b752a12247ee74b173976
milestone: '7.12'
diff --git a/db/docs/approver_groups.yml b/db/docs/approver_groups.yml
index 6f0be968f07..e078e20814c 100644
--- a/db/docs/approver_groups.yml
+++ b/db/docs/approver_groups.yml
@@ -3,7 +3,8 @@ table_name: approver_groups
classes:
- ApproverGroup
feature_categories:
+- code_review
- source_code_management
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/21d27185191e6204a6645d776c77ae3855cce3e8
+description: Group approvers of given merge request
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/743
milestone: '8.13'
diff --git a/db/docs/approvers.yml b/db/docs/approvers.yml
index 86fc663be93..f0bfa47761a 100644
--- a/db/docs/approvers.yml
+++ b/db/docs/approvers.yml
@@ -4,6 +4,7 @@ classes:
- Approver
feature_categories:
- code_review
+- source_code_management
description: Approvers of given merge request
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/3cc78d89984d9c9df8372c52b7bba38e6226f9f2
milestone: '7.13'
diff --git a/db/docs/audit_events_streaming_event_type_filters.yml b/db/docs/audit_events_streaming_event_type_filters.yml
new file mode 100644
index 00000000000..7119c84589e
--- /dev/null
+++ b/db/docs/audit_events_streaming_event_type_filters.yml
@@ -0,0 +1,9 @@
+---
+table_name: audit_events_streaming_event_type_filters
+classes:
+ - AuditEvents::Streaming::EventTypeFilter
+feature_categories:
+ - audit_events
+description: Represents a event type filter for audit event streaming
+introduced_by_url:
+milestone: '15.6'
diff --git a/db/docs/ci_build_report_results.yml b/db/docs/ci_build_report_results.yml
index 42d152221f3..b1f112aea3c 100644
--- a/db/docs/ci_build_report_results.yml
+++ b/db/docs/ci_build_report_results.yml
@@ -4,6 +4,6 @@ classes:
- Ci::BuildReportResult
feature_categories:
- code_testing
-description: TODO
+description: Stores data related to the build that finished, including junit test data.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/32991
milestone: '13.1'
diff --git a/db/docs/ci_daily_build_group_report_results.yml b/db/docs/ci_daily_build_group_report_results.yml
index 8f23ac42bd0..3e75950f462 100644
--- a/db/docs/ci_daily_build_group_report_results.yml
+++ b/db/docs/ci_daily_build_group_report_results.yml
@@ -4,6 +4,6 @@ classes:
- Ci::DailyBuildGroupReportResult
feature_categories:
- code_testing
-description: TODO
+description: Stores daily aggregated data related to the build group, including code coverage data.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/30387
milestone: '13.0'
diff --git a/db/docs/ci_deleted_objects.yml b/db/docs/ci_deleted_objects.yml
index 24d19069913..a2e108e6c0a 100644
--- a/db/docs/ci_deleted_objects.yml
+++ b/db/docs/ci_deleted_objects.yml
@@ -4,6 +4,6 @@ classes:
- Ci::DeletedObject
feature_categories:
- build_artifacts
-description: TODO
+description: Allows efficient batch deletion of data in object storage.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/9bf76fe03f8edf4f67023448161af27abb8fb521
milestone: '13.5'
diff --git a/db/docs/ci_job_artifacts.yml b/db/docs/ci_job_artifacts.yml
index 781ba3babf1..492132315b6 100644
--- a/db/docs/ci_job_artifacts.yml
+++ b/db/docs/ci_job_artifacts.yml
@@ -5,6 +5,6 @@ classes:
- Gitlab::Ci::JobArtifact
feature_categories:
- build_artifacts
-description: TODO
+description: Stores artifacts produced by a build.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/61864a5a5bb523953589c9398a431c4369fbfc76
milestone: '10.3'
diff --git a/db/docs/ci_pipeline_artifacts.yml b/db/docs/ci_pipeline_artifacts.yml
index 753a57c74e2..124fe4de90b 100644
--- a/db/docs/ci_pipeline_artifacts.yml
+++ b/db/docs/ci_pipeline_artifacts.yml
@@ -4,6 +4,6 @@ classes:
- Ci::PipelineArtifact
feature_categories:
- build_artifacts
-description: TODO
+description: Stores aggregated artifacts produced by a pipeline.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37969
milestone: '13.3'
diff --git a/db/docs/ci_unit_test_failures.yml b/db/docs/ci_unit_test_failures.yml
index 14f66f5c586..9a1b27e8062 100644
--- a/db/docs/ci_unit_test_failures.yml
+++ b/db/docs/ci_unit_test_failures.yml
@@ -4,6 +4,6 @@ classes:
- Ci::UnitTestFailure
feature_categories:
- code_testing
-description: TODO
+description: Stores unit test failure data produced from builds.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56137
milestone: '13.11'
diff --git a/db/docs/ci_unit_tests.yml b/db/docs/ci_unit_tests.yml
index c22ad567c12..46b405678f0 100644
--- a/db/docs/ci_unit_tests.yml
+++ b/db/docs/ci_unit_tests.yml
@@ -4,6 +4,6 @@ classes:
- Ci::UnitTest
feature_categories:
- code_testing
-description: TODO
+description: Stores unit test data produced from builds.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56137
milestone: '13.11'
diff --git a/db/docs/content_blocked_states.yml b/db/docs/content_blocked_states.yml
index c2c4118b534..0abf239a98b 100644
--- a/db/docs/content_blocked_states.yml
+++ b/db/docs/content_blocked_states.yml
@@ -3,6 +3,6 @@ table_name: content_blocked_states
classes: []
feature_categories:
- source_code_management
-description: TODO
+description: JiHu only. Keeps list of restricted blobs.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/72124
milestone: '14.5'
diff --git a/db/docs/dependency_proxy_blob_states.yml b/db/docs/dependency_proxy_blob_states.yml
new file mode 100644
index 00000000000..ddb9414b5f8
--- /dev/null
+++ b/db/docs/dependency_proxy_blob_states.yml
@@ -0,0 +1,9 @@
+---
+table_name: dependency_proxy_blob_states
+classes:
+ - Geo::DependencyProxyBlobState
+feature_categories:
+ - geo_replication
+description: Separate table for dependency proxy blob verification states
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/101429
+milestone: '15.6'
diff --git a/db/docs/diff_note_positions.yml b/db/docs/diff_note_positions.yml
index 8e8a64861ab..0c4f688b4d4 100644
--- a/db/docs/diff_note_positions.yml
+++ b/db/docs/diff_note_positions.yml
@@ -4,6 +4,6 @@ classes:
- DiffNotePosition
feature_categories:
- source_code_management
-description: TODO
+description: Stores diff notes positions
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/28113
milestone: '13.0'
diff --git a/db/docs/experiment_users.yml b/db/docs/experiment_users.yml
deleted file mode 100644
index 38e6c57a283..00000000000
--- a/db/docs/experiment_users.yml
+++ /dev/null
@@ -1,9 +0,0 @@
----
-table_name: experiment_users
-classes:
-- ExperimentUser
-feature_categories:
-- experimentation_conversion
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38397
-milestone: '13.3'
diff --git a/db/docs/external_approval_rules_protected_branches.yml b/db/docs/external_approval_rules_protected_branches.yml
index ca498fe82ca..de4e1af7214 100644
--- a/db/docs/external_approval_rules_protected_branches.yml
+++ b/db/docs/external_approval_rules_protected_branches.yml
@@ -2,7 +2,7 @@
table_name: external_approval_rules_protected_branches
classes: []
feature_categories:
-- source_code_management
-description: TODO
+- compliance_management
+description: Keeps relation between protected branches and external approval rules
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54002
milestone: '13.10'
diff --git a/db/docs/external_status_checks.yml b/db/docs/external_status_checks.yml
index fd9fe357173..1bb1bc03224 100644
--- a/db/docs/external_status_checks.yml
+++ b/db/docs/external_status_checks.yml
@@ -3,7 +3,7 @@ table_name: external_status_checks
classes:
- MergeRequests::ExternalStatusCheck
feature_categories:
-- source_code_management
-description: TODO
+- compliance_management
+description: Stores project's external status checks
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62186
milestone: '14.0'
diff --git a/db/docs/external_status_checks_protected_branches.yml b/db/docs/external_status_checks_protected_branches.yml
index 34f4edabb5d..bf26689bd0b 100644
--- a/db/docs/external_status_checks_protected_branches.yml
+++ b/db/docs/external_status_checks_protected_branches.yml
@@ -2,7 +2,7 @@
table_name: external_status_checks_protected_branches
classes: []
feature_categories:
-- source_code_management
-description: TODO
+- compliance_management
+description: Keeps relation between protected branches and external status checks
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62186
milestone: '14.0'
diff --git a/db/docs/fork_network_members.yml b/db/docs/fork_network_members.yml
index 47f6150a147..2077977f1b7 100644
--- a/db/docs/fork_network_members.yml
+++ b/db/docs/fork_network_members.yml
@@ -4,6 +4,6 @@ classes:
- ForkNetworkMember
feature_categories:
- source_code_management
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/3098
+description: Keeps track of fork relations between projects.
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62186
milestone: '10.1'
diff --git a/db/docs/gpg_key_subkeys.yml b/db/docs/gpg_key_subkeys.yml
index 828ee6dac70..b3824c36e81 100644
--- a/db/docs/gpg_key_subkeys.yml
+++ b/db/docs/gpg_key_subkeys.yml
@@ -4,6 +4,6 @@ classes:
- GpgKeySubkey
feature_categories:
- source_code_management
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/3098
+description: Stores GPG subkeys
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/14517
milestone: '10.1'
diff --git a/db/docs/gpg_keys.yml b/db/docs/gpg_keys.yml
index d4524e777ee..00b76959fe4 100644
--- a/db/docs/gpg_keys.yml
+++ b/db/docs/gpg_keys.yml
@@ -4,6 +4,6 @@ classes:
- GpgKey
feature_categories:
- source_code_management
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/fbf1fd1a204a24aef2b80473ec64a520ed2a2dfc
+description: Stores GPG keys
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9546
milestone: '9.5'
diff --git a/db/docs/gpg_signatures.yml b/db/docs/gpg_signatures.yml
index a0f79655270..f49a0c03844 100644
--- a/db/docs/gpg_signatures.yml
+++ b/db/docs/gpg_signatures.yml
@@ -4,6 +4,6 @@ classes:
- CommitSignatures::GpgSignature
feature_categories:
- source_code_management
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/8236b12dff3df6d223888664c820ae54b4e0eaf7
+description: Stores GPG signatures
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9546
milestone: '9.5'
diff --git a/db/docs/group_merge_request_approval_settings.yml b/db/docs/group_merge_request_approval_settings.yml
index 70a2ef9311b..33bb2370a86 100644
--- a/db/docs/group_merge_request_approval_settings.yml
+++ b/db/docs/group_merge_request_approval_settings.yml
@@ -4,6 +4,6 @@ classes:
- GroupMergeRequestApprovalSetting
feature_categories:
- source_code_management
-description: TODO
+description: Keeps merge request approval settings per group
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50256
milestone: '13.8'
diff --git a/db/docs/merge_request_blocks.yml b/db/docs/merge_request_blocks.yml
index 992fd88c1e5..1a3452fc66c 100644
--- a/db/docs/merge_request_blocks.yml
+++ b/db/docs/merge_request_blocks.yml
@@ -4,6 +4,6 @@ classes:
- MergeRequestBlock
feature_categories:
- source_code_management
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/df778038981ae49cb7c0fec0a60f89abf801c5f0
-milestone: '12.0'
+description: Keeps relation between blocked and blocking merge requests
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/27323
+milestone: '11.11'
diff --git a/db/docs/merge_request_context_commit_diff_files.yml b/db/docs/merge_request_context_commit_diff_files.yml
index 08311e244a1..08af5c387c4 100644
--- a/db/docs/merge_request_context_commit_diff_files.yml
+++ b/db/docs/merge_request_context_commit_diff_files.yml
@@ -3,7 +3,7 @@ table_name: merge_request_context_commit_diff_files
classes:
- MergeRequestContextCommitDiffFile
feature_categories:
-- source_code_management
-description: TODO
+- code_review
+description: Stores diffs data for merge request context commits
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/23701
milestone: '12.8'
diff --git a/db/docs/namespace_aggregation_schedules.yml b/db/docs/namespace_aggregation_schedules.yml
index 517a65000eb..07c80396302 100644
--- a/db/docs/namespace_aggregation_schedules.yml
+++ b/db/docs/namespace_aggregation_schedules.yml
@@ -3,7 +3,7 @@ table_name: namespace_aggregation_schedules
classes:
- Namespace::AggregationSchedule
feature_categories:
-- source_code_management
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/bde41ee866d0fe0b1bb5ece1130fb6e24d95ad17
+- utilization
+description: Keeps update schedules for namespace_root_storage_statistics
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/29570
milestone: '12.1'
diff --git a/db/docs/namespace_commit_emails.yml b/db/docs/namespace_commit_emails.yml
new file mode 100644
index 00000000000..d7e192f97f4
--- /dev/null
+++ b/db/docs/namespace_commit_emails.yml
@@ -0,0 +1,9 @@
+---
+table_name: namespace_commit_emails
+classes:
+- Users::NamespaceCommitEmail
+feature_categories:
+- source_code_management
+description: User default email for commits from the GitLab UI
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/101832
+milestone: '15.6'
diff --git a/db/docs/p_ci_builds_metadata.yml b/db/docs/p_ci_builds_metadata.yml
new file mode 100644
index 00000000000..676cb3bfb1c
--- /dev/null
+++ b/db/docs/p_ci_builds_metadata.yml
@@ -0,0 +1,9 @@
+---
+table_name: p_ci_builds_metadata
+classes:
+- Ci::BuildMetadata
+feature_categories:
+- continuous_integration
+description: Routing table that holds information for job execution
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/100115
+milestone: '15.5'
diff --git a/db/docs/path_locks.yml b/db/docs/path_locks.yml
index 0a6e3390035..27548f44c39 100644
--- a/db/docs/path_locks.yml
+++ b/db/docs/path_locks.yml
@@ -4,6 +4,6 @@ classes:
- PathLock
feature_categories:
- source_code_management
-description: TODO
+description: Stores paths to repository blobs locked by users
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/684e9d1b5979e11d2edae11a3028a696bfcdedf8
milestone: '8.9'
diff --git a/db/docs/project_aliases.yml b/db/docs/project_aliases.yml
index 66dead7706a..f79c81d2afe 100644
--- a/db/docs/project_aliases.yml
+++ b/db/docs/project_aliases.yml
@@ -4,6 +4,6 @@ classes:
- ProjectAlias
feature_categories:
- source_code_management
-description: TODO
+description: Stores aliases of projects
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/14108
milestone: '12.1'
diff --git a/db/docs/project_build_artifacts_size_refreshes.yml b/db/docs/project_build_artifacts_size_refreshes.yml
index 8f07ab9b3e1..56bad0e4df6 100644
--- a/db/docs/project_build_artifacts_size_refreshes.yml
+++ b/db/docs/project_build_artifacts_size_refreshes.yml
@@ -4,6 +4,6 @@ classes:
- Projects::BuildArtifactsSizeRefresh
feature_categories:
- build_artifacts
-description: TODO
+description: Temporary table to accurately recompute artifacts size.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/81306
milestone: '14.9'
diff --git a/db/docs/project_ci_feature_usages.yml b/db/docs/project_ci_feature_usages.yml
index af9404570df..e7e354c6cc7 100644
--- a/db/docs/project_ci_feature_usages.yml
+++ b/db/docs/project_ci_feature_usages.yml
@@ -4,6 +4,6 @@ classes:
- Projects::CiFeatureUsage
feature_categories:
- code_testing
-description: Project CI feature usage information
+description: Project CI feature usage information used to access CI data from the main database.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68186
milestone: '14.2'
diff --git a/db/docs/project_daily_statistics.yml b/db/docs/project_daily_statistics.yml
index cddde444296..5de94c2845b 100644
--- a/db/docs/project_daily_statistics.yml
+++ b/db/docs/project_daily_statistics.yml
@@ -4,6 +4,6 @@ classes:
- ProjectDailyStatistic
feature_categories:
- source_code_management
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/5ae9a44aa17c8929627cc450f936cd960c143e25
+description: Stores repository fetch statistics per day
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/23596
milestone: '11.9'
diff --git a/db/docs/project_repositories.yml b/db/docs/project_repositories.yml
index cd0d7a6c1d7..ed90a0d1595 100644
--- a/db/docs/project_repositories.yml
+++ b/db/docs/project_repositories.yml
@@ -4,6 +4,6 @@ classes:
- ProjectRepository
feature_categories:
- source_code_management
-description: TODO
+description: Keeps disk path to repositories and link to the shard
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/8614
milestone: '11.6'
diff --git a/db/docs/project_repository_states.yml b/db/docs/project_repository_states.yml
index 343ae980a88..fa762a646f4 100644
--- a/db/docs/project_repository_states.yml
+++ b/db/docs/project_repository_states.yml
@@ -3,7 +3,7 @@ table_name: project_repository_states
classes:
- ProjectRepositoryState
feature_categories:
-- source_code_management
-description: TODO
+- geo_replication
+description: Keeps checksums of repositories
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/4428
milestone: '10.6'
diff --git a/db/docs/project_repository_storage_moves.yml b/db/docs/project_repository_storage_moves.yml
index 12fa9d33f07..4255a0d4a8a 100644
--- a/db/docs/project_repository_storage_moves.yml
+++ b/db/docs/project_repository_storage_moves.yml
@@ -3,7 +3,7 @@ table_name: project_repository_storage_moves
classes:
- Projects::RepositoryStorageMove
feature_categories:
-- source_code_management
-description: TODO
+- gitaly
+description: Stores status of project repository moves
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29095
milestone: '13.0'
diff --git a/db/docs/project_wiki_repositories.yml b/db/docs/project_wiki_repositories.yml
new file mode 100644
index 00000000000..9f01fd2db3f
--- /dev/null
+++ b/db/docs/project_wiki_repositories.yml
@@ -0,0 +1,9 @@
+---
+table_name: project_wiki_repositories
+classes:
+- Projects::WikiRepository
+feature_categories:
+- wiki
+description: Stores information about project wiki repositories.
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/103399
+milestone: '15.6'
diff --git a/db/docs/protected_branch_merge_access_levels.yml b/db/docs/protected_branch_merge_access_levels.yml
index 953d05f8eec..a07303975ad 100644
--- a/db/docs/protected_branch_merge_access_levels.yml
+++ b/db/docs/protected_branch_merge_access_levels.yml
@@ -4,6 +4,6 @@ classes:
- ProtectedBranch::MergeAccessLevel
feature_categories:
- source_code_management
-description: TODO
+description: Stores merge access settings for protected branches
introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/5081
milestone: '8.11'
diff --git a/db/docs/protected_branch_push_access_levels.yml b/db/docs/protected_branch_push_access_levels.yml
index 58010735b0f..fff94bceace 100644
--- a/db/docs/protected_branch_push_access_levels.yml
+++ b/db/docs/protected_branch_push_access_levels.yml
@@ -4,6 +4,6 @@ classes:
- ProtectedBranch::PushAccessLevel
feature_categories:
- source_code_management
-description: TODO
+description: Stores push access settings for protected branches
introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/5081
milestone: '8.11'
diff --git a/db/docs/protected_branch_unprotect_access_levels.yml b/db/docs/protected_branch_unprotect_access_levels.yml
index 635cf646df2..8727d77e8ec 100644
--- a/db/docs/protected_branch_unprotect_access_levels.yml
+++ b/db/docs/protected_branch_unprotect_access_levels.yml
@@ -4,6 +4,6 @@ classes:
- ProtectedBranch::UnprotectAccessLevel
feature_categories:
- source_code_management
-description: TODO
+description: Stores access settings for protected branch unprotection
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/5103
milestone: '10.7'
diff --git a/db/docs/protected_branches.yml b/db/docs/protected_branches.yml
index d1851c7cde6..a94c7d7681c 100644
--- a/db/docs/protected_branches.yml
+++ b/db/docs/protected_branches.yml
@@ -5,6 +5,6 @@ classes:
- ProtectedBranch
feature_categories:
- source_code_management
-description: TODO
+description: Keeps a list of protected branches by project
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/37224dc9c1ee80ba9030b616e2bc87bd96919e09
milestone: "<6.0"
diff --git a/db/docs/protected_tag_create_access_levels.yml b/db/docs/protected_tag_create_access_levels.yml
index 9856b1a0f25..0c1ae808e67 100644
--- a/db/docs/protected_tag_create_access_levels.yml
+++ b/db/docs/protected_tag_create_access_levels.yml
@@ -4,6 +4,6 @@ classes:
- ProtectedTag::CreateAccessLevel
feature_categories:
- source_code_management
-description: TODO
+description: Stores create access settings for protected tags
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/07d7d8e65905a39164b63f55eccdcea8f10f5d14
milestone: '9.1'
diff --git a/db/docs/protected_tags.yml b/db/docs/protected_tags.yml
index 0a18451d592..79b0b51de5f 100644
--- a/db/docs/protected_tags.yml
+++ b/db/docs/protected_tags.yml
@@ -4,6 +4,6 @@ classes:
- ProtectedTag
feature_categories:
- source_code_management
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/1a416a42f1c1b876ecd96687e41696bc915cc2c2
+description: Keeps a list of protected tags by project
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/10356
milestone: '9.1'
diff --git a/db/docs/push_event_payloads.yml b/db/docs/push_event_payloads.yml
index ea40e5270f4..68cd4ae4bb8 100644
--- a/db/docs/push_event_payloads.yml
+++ b/db/docs/push_event_payloads.yml
@@ -3,7 +3,7 @@ table_name: push_event_payloads
classes:
- PushEventPayload
feature_categories:
-- source_code_management
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/0395c47193b3bbf6b4f060f28c9f632580313a35
+- users
+description: Stores log of push events
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/12463
milestone: '9.5'
diff --git a/db/docs/remote_mirrors.yml b/db/docs/remote_mirrors.yml
index 6926e0d2633..5d38c9cc3ec 100644
--- a/db/docs/remote_mirrors.yml
+++ b/db/docs/remote_mirrors.yml
@@ -4,6 +4,6 @@ classes:
- RemoteMirror
feature_categories:
- source_code_management
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/ab83917c25c5d1f7dd29c82c91c699008292bc1d
+description: Stores push mirrors and their update statuses
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/249
milestone: '8.7'
diff --git a/db/docs/repository_languages.yml b/db/docs/repository_languages.yml
index b38afde69a0..ceee8670a68 100644
--- a/db/docs/repository_languages.yml
+++ b/db/docs/repository_languages.yml
@@ -4,6 +4,6 @@ classes:
- RepositoryLanguage
feature_categories:
- source_code_management
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/79a5d76801a45696db629e1f543f2e1d6fa4784f
+description: Keeps relation between projects and repository languages
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/19480
milestone: '11.2'
diff --git a/db/docs/required_code_owners_sections.yml b/db/docs/required_code_owners_sections.yml
index a8018193d30..059078cce27 100644
--- a/db/docs/required_code_owners_sections.yml
+++ b/db/docs/required_code_owners_sections.yml
@@ -4,6 +4,6 @@ classes:
- ProtectedBranch::RequiredCodeOwnersSection
feature_categories:
- source_code_management
-description: TODO
+description: Keeps required code owners sections
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43573
milestone: '13.5'
diff --git a/db/docs/software_license_policies.yml b/db/docs/software_license_policies.yml
index 478c68d8c59..615ae644985 100644
--- a/db/docs/software_license_policies.yml
+++ b/db/docs/software_license_policies.yml
@@ -3,7 +3,7 @@ table_name: software_license_policies
classes:
- SoftwareLicensePolicy
feature_categories:
-- license_compliance
+- security_policy_management
description: Allows user to approve or deny the use certain software licenses in their project.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6246
milestone: '11.2'
diff --git a/db/docs/software_licenses.yml b/db/docs/software_licenses.yml
index 48e78c8ca02..67ebd697fa8 100644
--- a/db/docs/software_licenses.yml
+++ b/db/docs/software_licenses.yml
@@ -3,7 +3,7 @@ table_name: software_licenses
classes:
- SoftwareLicense
feature_categories:
-- license_compliance
+- security_policy_management
description: Normalized software licenses to use in conjunction with License Compliance features (like software license policies)
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6246
milestone: '11.2'
diff --git a/db/docs/trending_projects.yml b/db/docs/trending_projects.yml
index 9dd23857da0..1ee72f2d244 100644
--- a/db/docs/trending_projects.yml
+++ b/db/docs/trending_projects.yml
@@ -4,6 +4,6 @@ classes:
- TrendingProject
feature_categories:
- source_code_management
-description: TODO
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/237c8f66e6608420629503280aaea555ee980022
+description: Stores the list of trending projects
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/6749
milestone: '8.13'
diff --git a/db/docs/x509_certificates.yml b/db/docs/x509_certificates.yml
index 26fc03c743d..bcf976155f4 100644
--- a/db/docs/x509_certificates.yml
+++ b/db/docs/x509_certificates.yml
@@ -4,6 +4,6 @@ classes:
- X509Certificate
feature_categories:
- source_code_management
-description: TODO
+description: Stores data about X.509 certificate
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/17773
milestone: '12.8'
diff --git a/db/docs/x509_commit_signatures.yml b/db/docs/x509_commit_signatures.yml
index 5791f6439d6..170294c8d56 100644
--- a/db/docs/x509_commit_signatures.yml
+++ b/db/docs/x509_commit_signatures.yml
@@ -4,6 +4,6 @@ classes:
- CommitSignatures::X509CommitSignature
feature_categories:
- source_code_management
-description: TODO
+description: Stores X.509 verification status of the commit
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/17773
milestone: '12.8'
diff --git a/db/docs/x509_issuers.yml b/db/docs/x509_issuers.yml
index 0165189f044..30bbe8e4b12 100644
--- a/db/docs/x509_issuers.yml
+++ b/db/docs/x509_issuers.yml
@@ -4,6 +4,6 @@ classes:
- X509Issuer
feature_categories:
- source_code_management
-description: TODO
+description: Stores data about issuer of X.509 certificate
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/17773
milestone: '12.8'
diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb
index 8e9952e9ba1..4f6bfc5c82a 100644
--- a/db/fixtures/development/17_cycle_analytics.rb
+++ b/db/fixtures/development/17_cycle_analytics.rb
@@ -2,6 +2,7 @@
require './spec/support/sidekiq_middleware'
require './spec/support/helpers/test_env'
+require 'active_support/testing/time_helpers'
# Usage:
#
@@ -18,6 +19,8 @@ require './spec/support/helpers/test_env'
# VSA_SEED_PROJECT_ID=10 FILTER=cycle_analytics SEED_VSA=1 bundle exec rake db:seed_fu
class Gitlab::Seeder::CycleAnalytics
+ include ActiveSupport::Testing::TimeHelpers
+
attr_reader :project, :issues, :merge_requests, :developers
FLAG = 'SEED_VSA'
@@ -104,7 +107,7 @@ class Gitlab::Seeder::CycleAnalytics
def seed_test_stage!
merge_requests.each do |merge_request|
- pipeline = FactoryBot.create(:ci_pipeline, :success, project: project)
+ pipeline = FactoryBot.create(:ci_pipeline, :success, project: project, partition_id: Ci::Pipeline.current_partition_value)
build = FactoryBot.create(:ci_build, pipeline: pipeline, project: project, user: developers.sample)
# Required because seeds run in a transaction and these are now
@@ -133,7 +136,7 @@ class Gitlab::Seeder::CycleAnalytics
def create_issues!
@issue_count.times do
- Timecop.travel start_time + rand(5).days do
+ travel_to(start_time + rand(5).days) do
title = "#{FFaker::Product.brand}-#{suffix}"
@issues << Issue.create!(project: project, title: title, author: developers.sample)
end
diff --git a/db/fixtures/development/98_gitlab_instance_administration_project.rb b/db/fixtures/development/98_gitlab_instance_administration_project.rb
index 3338f2bd2fc..35bc3edbd70 100644
--- a/db/fixtures/development/98_gitlab_instance_administration_project.rb
+++ b/db/fixtures/development/98_gitlab_instance_administration_project.rb
@@ -2,14 +2,17 @@
response = Sidekiq::Worker.skipping_transaction_check do
result = ::Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService.new.execute
+
+ next result unless result[:status] == :success
+
AuthorizedProjectUpdate::ProjectRecalculateService.new(result[:project]).execute
result
end
if response[:status] == :success
- puts "Successfully created self monitoring project."
+ puts "Successfully created self-monitoring project."
else
- puts "Could not create self monitoring project due to error: '#{response[:message]}'"
+ puts "Could not create self-monitoring project due to error: '#{response[:message]}'"
puts "Check logs for more details."
end
diff --git a/db/fixtures/production/998_gitlab_instance_administration_project.rb b/db/fixtures/production/998_gitlab_instance_administration_project.rb
index 8be707ffb08..d935832aea6 100644
--- a/db/fixtures/production/998_gitlab_instance_administration_project.rb
+++ b/db/fixtures/production/998_gitlab_instance_administration_project.rb
@@ -3,8 +3,8 @@
response = ::Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService.new.execute
if response[:status] == :success
- puts "Successfully created self monitoring project."
+ puts "Successfully created self-monitoring project."
else
- puts "Could not create self monitoring project due to error: '#{response[:message]}'"
+ puts "Could not create self-monitoring project due to error: '#{response[:message]}'"
puts "Check logs for more details."
end
diff --git a/db/migrate/20210305031822_create_dast_site_profile_variables.rb b/db/migrate/20210305031822_create_dast_site_profile_variables.rb
index f55755aa731..4b8fc982d86 100644
--- a/db/migrate/20210305031822_create_dast_site_profile_variables.rb
+++ b/db/migrate/20210305031822_create_dast_site_profile_variables.rb
@@ -13,7 +13,7 @@ class CreateDastSiteProfileVariables < ActiveRecord::Migration[6.0]
encrypted_value_constraint_name = check_constraint_name(:dast_site_profile_secret_variables, 'encrypted_value', 'max_length')
encrypted_value_iv_constraint_name = check_constraint_name(:dast_site_profile_secret_variables, 'encrypted_value_iv', 'max_length')
- create_table_with_constraints :dast_site_profile_secret_variables, comment: table_comment.to_json do |t|
+ create_table_with_constraints :dast_site_profile_secret_variables, comment: Gitlab::Json.dump(table_comment) do |t|
t.references :dast_site_profile, null: false, foreign_key: { on_delete: :cascade }, index: false
t.timestamps_with_timezone
diff --git a/db/migrate/20210317035357_create_dast_profiles_pipelines.rb b/db/migrate/20210317035357_create_dast_profiles_pipelines.rb
index f7a29958f12..f84e1237643 100644
--- a/db/migrate/20210317035357_create_dast_profiles_pipelines.rb
+++ b/db/migrate/20210317035357_create_dast_profiles_pipelines.rb
@@ -6,7 +6,7 @@ class CreateDastProfilesPipelines < ActiveRecord::Migration[6.0]
def up
table_comment = { owner: 'group::dynamic analysis', description: 'Join table between DAST Profiles and CI Pipelines' }
- create_table :dast_profiles_pipelines, primary_key: [:dast_profile_id, :ci_pipeline_id], comment: table_comment.to_json do |t|
+ create_table :dast_profiles_pipelines, primary_key: [:dast_profile_id, :ci_pipeline_id], comment: Gitlab::Json.dump(table_comment) do |t|
t.bigint :dast_profile_id, null: false
t.bigint :ci_pipeline_id, null: false
diff --git a/db/migrate/20210412111213_create_security_orchestration_policy_rule_schedule.rb b/db/migrate/20210412111213_create_security_orchestration_policy_rule_schedule.rb
index c7035400cba..365fa36f11b 100644
--- a/db/migrate/20210412111213_create_security_orchestration_policy_rule_schedule.rb
+++ b/db/migrate/20210412111213_create_security_orchestration_policy_rule_schedule.rb
@@ -11,7 +11,7 @@ class CreateSecurityOrchestrationPolicyRuleSchedule < ActiveRecord::Migration[6.
def up
table_comment = { owner: 'group::container security', description: 'Schedules used to store relationship between project and security policy repository' }
- create_table_with_constraints :security_orchestration_policy_rule_schedules, comment: table_comment.to_json do |t|
+ create_table_with_constraints :security_orchestration_policy_rule_schedules, comment: Gitlab::Json.dump(table_comment) do |t|
t.timestamps_with_timezone
t.datetime_with_timezone :next_run_at, null: true
diff --git a/db/migrate/20210423054022_create_dast_site_profiles_pipelines.rb b/db/migrate/20210423054022_create_dast_site_profiles_pipelines.rb
index bbdb4f02ab4..80b97ff5afe 100644
--- a/db/migrate/20210423054022_create_dast_site_profiles_pipelines.rb
+++ b/db/migrate/20210423054022_create_dast_site_profiles_pipelines.rb
@@ -4,7 +4,7 @@ class CreateDastSiteProfilesPipelines < ActiveRecord::Migration[6.0]
def up
table_comment = { owner: 'group::dynamic analysis', description: 'Join table between DAST Site Profiles and CI Pipelines' }
- create_table :dast_site_profiles_pipelines, primary_key: [:dast_site_profile_id, :ci_pipeline_id], comment: table_comment.to_json do |t|
+ create_table :dast_site_profiles_pipelines, primary_key: [:dast_site_profile_id, :ci_pipeline_id], comment: Gitlab::Json.dump(table_comment) do |t|
t.bigint :dast_site_profile_id, null: false
t.bigint :ci_pipeline_id, null: false
diff --git a/db/migrate/20210604032738_create_dast_site_profiles_builds.rb b/db/migrate/20210604032738_create_dast_site_profiles_builds.rb
index 2e9eb2c7cb7..6e653b36787 100644
--- a/db/migrate/20210604032738_create_dast_site_profiles_builds.rb
+++ b/db/migrate/20210604032738_create_dast_site_profiles_builds.rb
@@ -4,7 +4,7 @@ class CreateDastSiteProfilesBuilds < ActiveRecord::Migration[6.1]
def up
table_comment = { owner: 'group::dynamic analysis', description: 'Join table between DAST Site Profiles and CI Builds' }
- create_table :dast_site_profiles_builds, primary_key: [:dast_site_profile_id, :ci_build_id], comment: table_comment.to_json do |t|
+ create_table :dast_site_profiles_builds, primary_key: [:dast_site_profile_id, :ci_build_id], comment: Gitlab::Json.dump(table_comment) do |t|
t.bigint :dast_site_profile_id, null: false
t.bigint :ci_build_id, null: false
diff --git a/db/migrate/20210604051330_create_dast_scanner_profiles_builds.rb b/db/migrate/20210604051330_create_dast_scanner_profiles_builds.rb
index f8a5f735f0d..0fe3ada4c0d 100644
--- a/db/migrate/20210604051330_create_dast_scanner_profiles_builds.rb
+++ b/db/migrate/20210604051330_create_dast_scanner_profiles_builds.rb
@@ -4,7 +4,7 @@ class CreateDastScannerProfilesBuilds < ActiveRecord::Migration[6.1]
def up
table_comment = { owner: 'group::dynamic analysis', description: 'Join table between DAST Scanner Profiles and CI Builds' }
- create_table :dast_scanner_profiles_builds, primary_key: [:dast_scanner_profile_id, :ci_build_id], comment: table_comment.to_json do |t|
+ create_table :dast_scanner_profiles_builds, primary_key: [:dast_scanner_profile_id, :ci_build_id], comment: Gitlab::Json.dump(table_comment) do |t|
t.bigint :dast_scanner_profile_id, null: false
t.bigint :ci_build_id, null: false
diff --git a/db/migrate/20210713123345_create_dast_profile_schedule.rb b/db/migrate/20210713123345_create_dast_profile_schedule.rb
index 951aab63579..ea660de572a 100644
--- a/db/migrate/20210713123345_create_dast_profile_schedule.rb
+++ b/db/migrate/20210713123345_create_dast_profile_schedule.rb
@@ -10,7 +10,7 @@ class CreateDastProfileSchedule < ActiveRecord::Migration[6.1]
owner: 'group::dynamic analysis', description: 'Scheduling for scans using DAST Profiles'
}
- create_table_with_constraints :dast_profile_schedules, comment: table_comment.to_json do |t|
+ create_table_with_constraints :dast_profile_schedules, comment: Gitlab::Json.dump(table_comment) do |t|
t.bigint :project_id, null: false
t.bigint :dast_profile_id, null: false
t.bigint :user_id
diff --git a/db/migrate/20220613112029_add_namespace_id_to_protected_branches.rb b/db/migrate/20220613112029_add_namespace_id_to_protected_branches.rb
new file mode 100644
index 00000000000..1620a23d564
--- /dev/null
+++ b/db/migrate/20220613112029_add_namespace_id_to_protected_branches.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddNamespaceIdToProtectedBranches < Gitlab::Database::Migration[2.0]
+ enable_lock_retries!
+
+ def change
+ add_column :protected_branches, :namespace_id, :bigint
+ end
+end
diff --git a/db/migrate/20220613112030_add_namespace_id_indexes_foreign_key_to_protected_branches.rb b/db/migrate/20220613112030_add_namespace_id_indexes_foreign_key_to_protected_branches.rb
new file mode 100644
index 00000000000..18a91743746
--- /dev/null
+++ b/db/migrate/20220613112030_add_namespace_id_indexes_foreign_key_to_protected_branches.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddNamespaceIdIndexesForeignKeyToProtectedBranches < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_protected_branches_namespace_id'
+
+ def up
+ add_concurrent_index :protected_branches, :namespace_id, name: INDEX_NAME, where: 'namespace_id IS NOT NULL'
+ add_concurrent_foreign_key :protected_branches, :namespaces, column: :namespace_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :protected_branches, column: :namespace_id
+ end
+ remove_concurrent_index :protected_branches, :namespace_id, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20220613112031_add_group_or_project_constraint_in_protected_branches.rb b/db/migrate/20220613112031_add_group_or_project_constraint_in_protected_branches.rb
new file mode 100644
index 00000000000..b7f20450480
--- /dev/null
+++ b/db/migrate/20220613112031_add_group_or_project_constraint_in_protected_branches.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddGroupOrProjectConstraintInProtectedBranches < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ CONSTRAINT_NAME = 'protected_branches_project_id_namespace_id_any_not_null'
+
+ def up
+ constraint = <<~CONSTRAINT
+ (project_id IS NULL) <> (namespace_id IS NULL)
+ CONSTRAINT
+ add_check_constraint :protected_branches, constraint, CONSTRAINT_NAME
+ end
+
+ def down
+ remove_check_constraint :protected_branches, CONSTRAINT_NAME
+ end
+end
diff --git a/db/migrate/20220613112032_change_project_id_null_in_protected_branches.rb b/db/migrate/20220613112032_change_project_id_null_in_protected_branches.rb
new file mode 100644
index 00000000000..4bf8437d4fb
--- /dev/null
+++ b/db/migrate/20220613112032_change_project_id_null_in_protected_branches.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class ChangeProjectIdNullInProtectedBranches < Gitlab::Database::Migration[2.0]
+ enable_lock_retries!
+
+ def up
+ change_column_null :protected_branches, :project_id, true
+ end
+
+ def down
+ change_column_null :protected_branches, :project_id, false
+ end
+end
diff --git a/db/migrate/20220721065723_add_issue_branch_template_to_project_settings.rb b/db/migrate/20220721065723_add_issue_branch_template_to_project_settings.rb
new file mode 100644
index 00000000000..d65bd2c21e7
--- /dev/null
+++ b/db/migrate/20220721065723_add_issue_branch_template_to_project_settings.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIssueBranchTemplateToProjectSettings < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ add_column :project_settings, :issue_branch_template, :text, if_not_exists: true
+ end
+
+ add_text_limit :project_settings, :issue_branch_template, 255
+ end
+
+ def down
+ remove_column :project_settings, :issue_branch_template, if_exists: true
+ end
+end
diff --git a/db/migrate/20220919062640_add_mirror_branch_regex_to_remote_mirrors.rb b/db/migrate/20220919062640_add_mirror_branch_regex_to_remote_mirrors.rb
new file mode 100644
index 00000000000..0f27ba9488b
--- /dev/null
+++ b/db/migrate/20220919062640_add_mirror_branch_regex_to_remote_mirrors.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddMirrorBranchRegexToRemoteMirrors < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ add_column :remote_mirrors, :mirror_branch_regex, :text
+ add_text_limit :remote_mirrors, :mirror_branch_regex, 255
+ end
+
+ def down
+ remove_text_limit :remote_mirrors, :mirror_branch_regex
+ remove_column :remote_mirrors, :mirror_branch_regex
+ end
+end
diff --git a/db/migrate/20220920135632_add_jira_connect_proxy_url_setting.rb b/db/migrate/20220920135632_add_jira_connect_proxy_url_setting.rb
new file mode 100644
index 00000000000..c5842b6c787
--- /dev/null
+++ b/db/migrate/20220920135632_add_jira_connect_proxy_url_setting.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddJiraConnectProxyUrlSetting < Gitlab::Database::Migration[2.0]
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in 20220920135717_add_textlimit_to_jira_connect_proxy_url_setting.rb
+ def change
+ add_column :application_settings, :jira_connect_proxy_url, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20220920135717_add_textlimit_to_jira_connect_proxy_url_setting.rb b/db/migrate/20220920135717_add_textlimit_to_jira_connect_proxy_url_setting.rb
new file mode 100644
index 00000000000..3a571580e79
--- /dev/null
+++ b/db/migrate/20220920135717_add_textlimit_to_jira_connect_proxy_url_setting.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddTextlimitToJiraConnectProxyUrlSetting < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :application_settings, :jira_connect_proxy_url, 255
+ end
+
+ def down
+ remove_text_limit :application_settings, :jira_connect_proxy_url
+ end
+end
diff --git a/db/migrate/20220926023734_add_mirror_branch_regex_to_project_settings.rb b/db/migrate/20220926023734_add_mirror_branch_regex_to_project_settings.rb
new file mode 100644
index 00000000000..5032a9ff964
--- /dev/null
+++ b/db/migrate/20220926023734_add_mirror_branch_regex_to_project_settings.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class AddMirrorBranchRegexToProjectSettings < Gitlab::Database::Migration[2.0]
+ enable_lock_retries!
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in 20221027124848_add_text_limit_to_project_settings_mirror_branch_regex.rb
+ def change
+ add_column :project_settings, :mirror_branch_regex, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20221003151747_create_audit_events_streaming_event_type_filters.rb b/db/migrate/20221003151747_create_audit_events_streaming_event_type_filters.rb
new file mode 100644
index 00000000000..c0acbe75d78
--- /dev/null
+++ b/db/migrate/20221003151747_create_audit_events_streaming_event_type_filters.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateAuditEventsStreamingEventTypeFilters < Gitlab::Database::Migration[2.0]
+ UNIQ_INDEX_NAME = 'unique_streaming_event_type_filters_destination_id'
+
+ def change
+ create_table :audit_events_streaming_event_type_filters do |t|
+ t.timestamps_with_timezone null: false
+ t.references :external_audit_event_destination,
+ null: false,
+ index: false,
+ foreign_key: { to_table: 'audit_events_external_audit_event_destinations', on_delete: :cascade }
+ t.text :audit_event_type, null: false, limit: 255
+
+ t.index [:external_audit_event_destination_id, :audit_event_type], unique: true, name: UNIQ_INDEX_NAME
+ end
+ end
+end
diff --git a/db/migrate/20221010103207_add_product_analytics_enabled_to_application_settings.rb b/db/migrate/20221010103207_add_product_analytics_enabled_to_application_settings.rb
new file mode 100644
index 00000000000..24887e7b9fb
--- /dev/null
+++ b/db/migrate/20221010103207_add_product_analytics_enabled_to_application_settings.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddProductAnalyticsEnabledToApplicationSettings < Gitlab::Database::Migration[2.0]
+ def change
+ add_column :application_settings, :product_analytics_enabled, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20221010184839_add_new_amount_used_to_ci_project_monthly_usages.rb b/db/migrate/20221010184839_add_new_amount_used_to_ci_project_monthly_usages.rb
new file mode 100644
index 00000000000..5c77dfe9334
--- /dev/null
+++ b/db/migrate/20221010184839_add_new_amount_used_to_ci_project_monthly_usages.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddNewAmountUsedToCiProjectMonthlyUsages < Gitlab::Database::Migration[2.0]
+ TABLE = :ci_project_monthly_usages
+ OLD_COLUMN = :amount_used
+ NEW_COLUMN = :new_amount_used
+ TRIGGER_NAME = 'sync_projects_amount_used_columns'
+
+ disable_ddl_transaction!
+
+ def up
+ check_trigger_permissions!(TABLE)
+
+ add_column(TABLE, NEW_COLUMN, :decimal, default: 0.0, precision: 18, scale: 4, null: false, if_not_exists: true)
+
+ install_rename_triggers(TABLE, OLD_COLUMN, NEW_COLUMN, trigger_name: TRIGGER_NAME)
+ end
+
+ def down
+ remove_rename_triggers(TABLE, TRIGGER_NAME)
+
+ remove_column(TABLE, NEW_COLUMN)
+ end
+end
diff --git a/db/migrate/20221010201815_add_purl_type_to_sbom_components.rb b/db/migrate/20221010201815_add_purl_type_to_sbom_components.rb
new file mode 100644
index 00000000000..3ab2aa262b1
--- /dev/null
+++ b/db/migrate/20221010201815_add_purl_type_to_sbom_components.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddPurlTypeToSbomComponents < Gitlab::Database::Migration[2.0]
+ def change
+ add_column :sbom_components, :purl_type, :smallint
+ end
+end
diff --git a/db/migrate/20221010202339_remove_unique_index_on_sbom_components_type_and_name.rb b/db/migrate/20221010202339_remove_unique_index_on_sbom_components_type_and_name.rb
new file mode 100644
index 00000000000..fe092232ca6
--- /dev/null
+++ b/db/migrate/20221010202339_remove_unique_index_on_sbom_components_type_and_name.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class RemoveUniqueIndexOnSbomComponentsTypeAndName < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'index_sbom_components_on_component_type_and_name'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :sbom_components, name: INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :sbom_components, [:component_type, :name], unique: true, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221010202408_add_unique_index_on_sbom_components_type_name_and_purl_type.rb b/db/migrate/20221010202408_add_unique_index_on_sbom_components_type_name_and_purl_type.rb
new file mode 100644
index 00000000000..5935db7c2c1
--- /dev/null
+++ b/db/migrate/20221010202408_add_unique_index_on_sbom_components_type_name_and_purl_type.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddUniqueIndexOnSbomComponentsTypeNameAndPurlType < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'index_sbom_components_on_component_type_name_and_purl_type'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :sbom_components, [:name, :purl_type, :component_type], unique: true, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :sbom_components, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221013103738_add_disable_admin_oauth_scopes.rb b/db/migrate/20221013103738_add_disable_admin_oauth_scopes.rb
new file mode 100644
index 00000000000..3406252790d
--- /dev/null
+++ b/db/migrate/20221013103738_add_disable_admin_oauth_scopes.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddDisableAdminOauthScopes < Gitlab::Database::Migration[2.0]
+ def change
+ add_column :application_settings, :disable_admin_oauth_scopes, :boolean, null: false, default: false
+ end
+end
diff --git a/db/migrate/20221015000511_add_email_confirmation_setting_to_application_settings.rb b/db/migrate/20221015000511_add_email_confirmation_setting_to_application_settings.rb
new file mode 100644
index 00000000000..42fa4c1baf5
--- /dev/null
+++ b/db/migrate/20221015000511_add_email_confirmation_setting_to_application_settings.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddEmailConfirmationSettingToApplicationSettings < Gitlab::Database::Migration[2.0]
+ def change
+ add_column :application_settings, :email_confirmation_setting, :integer, limit: 2, default: 2
+ end
+end
diff --git a/db/migrate/20221017084208_rename_ci_pipeline_metadata_title.rb b/db/migrate/20221017084208_rename_ci_pipeline_metadata_title.rb
new file mode 100644
index 00000000000..3c1a3bbd40a
--- /dev/null
+++ b/db/migrate/20221017084208_rename_ci_pipeline_metadata_title.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class RenameCiPipelineMetadataTitle < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ rename_column_concurrently :ci_pipeline_metadata, :title, :name, batch_column_name: :pipeline_id
+ end
+
+ def down
+ undo_rename_column_concurrently :ci_pipeline_metadata, :title, :name
+ end
+end
diff --git a/db/migrate/20221018050323_add_objective_and_keyresult_to_work_item_types.rb b/db/migrate/20221018050323_add_objective_and_keyresult_to_work_item_types.rb
new file mode 100644
index 00000000000..51834a3b19b
--- /dev/null
+++ b/db/migrate/20221018050323_add_objective_and_keyresult_to_work_item_types.rb
@@ -0,0 +1,56 @@
+# frozen_string_literal: true
+
+# See https://docs.gitlab.com/ee/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddObjectiveAndKeyresultToWorkItemTypes < Gitlab::Database::Migration[2.0]
+ # Added the following statements as per https://docs.gitlab.com/ee/development/database/migrations_for_multiple_databases.html
+ disable_ddl_transaction!
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ OBJECTIVE_ENUM_VALUE = 5
+ KEY_RESULT_ENUM_VALUE = 6
+
+ class WorkItemType < MigrationRecord
+ self.inheritance_column = :_type_disabled
+ self.table_name = 'work_item_types'
+ end
+
+ def up
+ # New instances will not run this migration and add this type via fixtures
+ # checking if record exists mostly because migration specs will run all migrations
+ # and that will conflict with the preloaded base work item types
+ objective_work_item = WorkItemType.find_by(base_type: OBJECTIVE_ENUM_VALUE, name: 'Objective', namespace_id: nil)
+ key_result_work_item = WorkItemType.find_by(base_type: KEY_RESULT_ENUM_VALUE, name: 'Key Result', namespace_id: nil)
+
+ if objective_work_item
+ say('Objective item record exist, skipping creation')
+ else
+ execute(
+ <<~SQL
+ INSERT INTO work_item_types (base_type, icon_name, name, created_at, updated_at) VALUES(
+ #{OBJECTIVE_ENUM_VALUE}, 'issue-type-objective', 'Objective', NOW(), NOW()
+ ) ON CONFLICT DO NOTHING;
+ SQL
+ )
+ end
+
+ if key_result_work_item
+ say('Keyresult item record exist, skipping creation')
+ else
+ execute(
+ <<~SQL
+ INSERT INTO work_item_types (base_type, icon_name, name, created_at, updated_at) VALUES(
+ #{KEY_RESULT_ENUM_VALUE}, 'issue-type-keyresult', 'Key Result', NOW(), NOW()
+ ) ON CONFLICT DO NOTHING;
+ SQL
+ )
+ end
+ end
+
+ def down
+ # There's the remote possibility that issues could already be
+ # using this issue type, with a tight foreign constraint.
+ # Therefore we will not attempt to remove any data.
+ end
+end
diff --git a/db/migrate/20221018092552_add_file_name_index_to_packages_rpm_repository_files.rb b/db/migrate/20221018092552_add_file_name_index_to_packages_rpm_repository_files.rb
new file mode 100644
index 00000000000..fcec3a6800d
--- /dev/null
+++ b/db/migrate/20221018092552_add_file_name_index_to_packages_rpm_repository_files.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddFileNameIndexToPackagesRpmRepositoryFiles < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ NEW_INDEX_NAME = 'index_packages_rpm_repository_files_on_project_id_and_file_name'
+ OLD_INDEX_NAME = 'index_packages_rpm_repository_files_on_project_id'
+
+ def up
+ add_concurrent_index :packages_rpm_repository_files, %i[project_id file_name], name: NEW_INDEX_NAME
+ remove_concurrent_index :packages_rpm_repository_files, :project_id, name: OLD_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :packages_rpm_repository_files, :project_id, name: OLD_INDEX_NAME
+ remove_concurrent_index :packages_rpm_repository_files, %i[project_id file_name], name: NEW_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221018124029_add_consume_after_to_ghost_user_migrations.rb b/db/migrate/20221018124029_add_consume_after_to_ghost_user_migrations.rb
new file mode 100644
index 00000000000..148c6516dc9
--- /dev/null
+++ b/db/migrate/20221018124029_add_consume_after_to_ghost_user_migrations.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddConsumeAfterToGhostUserMigrations < Gitlab::Database::Migration[2.0]
+ def change
+ add_column :ghost_user_migrations, :consume_after, :datetime_with_timezone, null: false, default: -> { 'NOW()' }
+ end
+end
diff --git a/db/migrate/20221018124035_add_consume_after_index_to_ghost_user_migrations.rb b/db/migrate/20221018124035_add_consume_after_index_to_ghost_user_migrations.rb
new file mode 100644
index 00000000000..543d91b3f33
--- /dev/null
+++ b/db/migrate/20221018124035_add_consume_after_index_to_ghost_user_migrations.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddConsumeAfterIndexToGhostUserMigrations < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'index_ghost_user_migrations_on_consume_after_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ghost_user_migrations, [:consume_after, :id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ghost_user_migrations, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221018202524_create_dependency_proxy_blob_states.rb b/db/migrate/20221018202524_create_dependency_proxy_blob_states.rb
new file mode 100644
index 00000000000..b042df43f04
--- /dev/null
+++ b/db/migrate/20221018202524_create_dependency_proxy_blob_states.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+class CreateDependencyProxyBlobStates < Gitlab::Database::Migration[2.0]
+ VERIFICATION_STATE_INDEX_NAME = "index_dependency_proxy_blob_states_on_verification_state"
+ PENDING_VERIFICATION_INDEX_NAME = "index_dependency_proxy_blob_states_pending_verification"
+ FAILED_VERIFICATION_INDEX_NAME = "index_dependency_proxy_blob_states_failed_verification"
+ NEEDS_VERIFICATION_INDEX_NAME = "index_dependency_proxy_blob_states_needs_verification"
+
+ enable_lock_retries!
+
+ def up
+ table_comment = {
+ owner: 'group::geo',
+ description: 'Geo-specific table to store the verification state of DependencyProxy::Blob objects'
+ }
+
+ create_table :dependency_proxy_blob_states, id: false, comment: Gitlab::Json.dump(table_comment) do |t|
+ t.datetime_with_timezone :verification_started_at
+ t.datetime_with_timezone :verification_retry_at
+ t.datetime_with_timezone :verified_at
+ t.references :dependency_proxy_blob,
+ primary_key: true,
+ default: nil,
+ index: true,
+ foreign_key: { on_delete: :cascade }
+ t.integer :verification_state, default: 0, limit: 2, null: false
+ t.integer :verification_retry_count, default: 0, limit: 2, null: false
+ t.binary :verification_checksum, using: 'verification_checksum::bytea'
+ t.text :verification_failure, limit: 255
+
+ t.index :verification_state, name: VERIFICATION_STATE_INDEX_NAME
+ t.index :verified_at,
+ where: "(verification_state = 0)",
+ order: { verified_at: 'ASC NULLS FIRST' },
+ name: PENDING_VERIFICATION_INDEX_NAME
+ t.index :verification_retry_at,
+ where: "(verification_state = 3)",
+ order: { verification_retry_at: 'ASC NULLS FIRST' },
+ name: FAILED_VERIFICATION_INDEX_NAME
+ t.index :verification_state,
+ where: "(verification_state = 0 OR verification_state = 3)",
+ name: NEEDS_VERIFICATION_INDEX_NAME
+ end
+ end
+
+ def down
+ drop_table :dependency_proxy_blob_states
+ end
+end
diff --git a/db/migrate/20221020124018_add_delete_started_at_to_container_repositories.rb b/db/migrate/20221020124018_add_delete_started_at_to_container_repositories.rb
new file mode 100644
index 00000000000..c225d9cc343
--- /dev/null
+++ b/db/migrate/20221020124018_add_delete_started_at_to_container_repositories.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddDeleteStartedAtToContainerRepositories < Gitlab::Database::Migration[2.0]
+ def change
+ add_column :container_repositories,
+ :delete_started_at,
+ :datetime_with_timezone,
+ null: true,
+ default: nil
+ end
+end
diff --git a/db/migrate/20221021213216_create_namespace_commit_emails.rb b/db/migrate/20221021213216_create_namespace_commit_emails.rb
new file mode 100644
index 00000000000..07811bf7b75
--- /dev/null
+++ b/db/migrate/20221021213216_create_namespace_commit_emails.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class CreateNamespaceCommitEmails < Gitlab::Database::Migration[2.0]
+ def change
+ create_table :namespace_commit_emails do |t|
+ t.references :user, index: false, null: false, foreign_key: { on_delete: :cascade }
+ t.references :namespace, null: false
+ t.references :email, null: false
+ t.timestamps_with_timezone null: false
+
+ t.index [:user_id, :namespace_id], unique: true
+ end
+ end
+end
diff --git a/db/migrate/20221022213505_add_namespace_commit_emails_namespace_fk.rb b/db/migrate/20221022213505_add_namespace_commit_emails_namespace_fk.rb
new file mode 100644
index 00000000000..0c543b03397
--- /dev/null
+++ b/db/migrate/20221022213505_add_namespace_commit_emails_namespace_fk.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddNamespaceCommitEmailsNamespaceFk < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :namespace_commit_emails, :namespaces, column: :namespace_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :namespace_commit_emails, column: :namespace_id
+ end
+ end
+end
diff --git a/db/migrate/20221022213521_add_namespace_commit_emails_email_fk.rb b/db/migrate/20221022213521_add_namespace_commit_emails_email_fk.rb
new file mode 100644
index 00000000000..9dbde26475c
--- /dev/null
+++ b/db/migrate/20221022213521_add_namespace_commit_emails_email_fk.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddNamespaceCommitEmailsEmailFk < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :namespace_commit_emails, :emails, column: :email_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :namespace_commit_emails, column: :email_id
+ end
+ end
+end
diff --git a/db/migrate/20221025043930_change_default_value_on_password_last_changed_at_to_user_details.rb b/db/migrate/20221025043930_change_default_value_on_password_last_changed_at_to_user_details.rb
new file mode 100644
index 00000000000..49436043a66
--- /dev/null
+++ b/db/migrate/20221025043930_change_default_value_on_password_last_changed_at_to_user_details.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class ChangeDefaultValueOnPasswordLastChangedAtToUserDetails < Gitlab::Database::Migration[2.0]
+ enable_lock_retries!
+
+ # rubocop:disable Migration/RemoveColumn
+ def change
+ remove_column :user_details, :password_last_changed_at, :datetime_with_timezone
+ add_column :user_details, :password_last_changed_at, :datetime_with_timezone,
+ null: false, default: -> { 'NOW()' }, comment: 'JiHu-specific column'
+ end
+ # rubocop:enable Migration/RemoveColumn
+end
diff --git a/db/migrate/20221025105205_add_status_and_id_index_to_container_repositories.rb b/db/migrate/20221025105205_add_status_and_id_index_to_container_repositories.rb
new file mode 100644
index 00000000000..380ffd2e484
--- /dev/null
+++ b/db/migrate/20221025105205_add_status_and_id_index_to_container_repositories.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddStatusAndIdIndexToContainerRepositories < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_container_repositories_on_status_and_id'
+
+ def up
+ add_concurrent_index :container_repositories, [:status, :id], name: INDEX_NAME, where: 'status IS NOT NULL'
+ end
+
+ def down
+ remove_concurrent_index :container_repositories, [:status, :id], name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221025145452_change_vulnerability_feedback_unique_idx.rb b/db/migrate/20221025145452_change_vulnerability_feedback_unique_idx.rb
new file mode 100644
index 00000000000..677245e1f50
--- /dev/null
+++ b/db/migrate/20221025145452_change_vulnerability_feedback_unique_idx.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class ChangeVulnerabilityFeedbackUniqueIdx < Gitlab::Database::Migration[2.0]
+ NEW_INDEX_NAME = :index_vulnerability_feedback_on_common_attributes
+ OLD_INDEX_NAME = :vulnerability_feedback_unique_idx
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :vulnerability_feedback,
+ %i[project_id category feedback_type project_fingerprint],
+ name: NEW_INDEX_NAME
+
+ remove_concurrent_index_by_name :vulnerability_feedback, OLD_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :vulnerability_feedback,
+ %i[project_id category feedback_type project_fingerprint],
+ name: OLD_INDEX_NAME,
+ unique: true
+
+ remove_concurrent_index_by_name :vulnerability_feedback, NEW_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221025150202_add_index_for_finding_uuid_and_feedback_type_on_feedback.rb b/db/migrate/20221025150202_add_index_for_finding_uuid_and_feedback_type_on_feedback.rb
new file mode 100644
index 00000000000..f909573937b
--- /dev/null
+++ b/db/migrate/20221025150202_add_index_for_finding_uuid_and_feedback_type_on_feedback.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddIndexForFindingUuidAndFeedbackTypeOnFeedback < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = :index_vulnerability_feedback_on_feedback_type_and_finding_uuid
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :vulnerability_feedback, %i[feedback_type finding_uuid], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :vulnerability_feedback, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221027124848_add_text_limit_to_project_settings_mirror_branch_regex.rb b/db/migrate/20221027124848_add_text_limit_to_project_settings_mirror_branch_regex.rb
new file mode 100644
index 00000000000..e87eb207204
--- /dev/null
+++ b/db/migrate/20221027124848_add_text_limit_to_project_settings_mirror_branch_regex.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddTextLimitToProjectSettingsMirrorBranchRegex < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :project_settings, :mirror_branch_regex, 255
+ end
+
+ def down
+ remove_text_limit :project_settings, :mirror_branch_regex
+ end
+end
diff --git a/db/migrate/20221028015347_add_commit_committer_name_check_to_push_rules.rb b/db/migrate/20221028015347_add_commit_committer_name_check_to_push_rules.rb
new file mode 100644
index 00000000000..e9a0887f353
--- /dev/null
+++ b/db/migrate/20221028015347_add_commit_committer_name_check_to_push_rules.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddCommitCommitterNameCheckToPushRules < Gitlab::Database::Migration[2.0]
+ def change
+ add_column :push_rules, :commit_committer_name_check, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20221028152422_add_finding_data_column_to_security_findings.rb b/db/migrate/20221028152422_add_finding_data_column_to_security_findings.rb
new file mode 100644
index 00000000000..a5d3929579b
--- /dev/null
+++ b/db/migrate/20221028152422_add_finding_data_column_to_security_findings.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddFindingDataColumnToSecurityFindings < Gitlab::Database::Migration[2.0]
+ enable_lock_retries!
+
+ def up
+ add_column :security_findings, :finding_data, :jsonb, default: {}, null: false
+ end
+
+ def down
+ remove_column :security_findings, :finding_data
+ end
+end
diff --git a/db/migrate/20221031102916_add_users_foreign_key_to_projects.rb b/db/migrate/20221031102916_add_users_foreign_key_to_projects.rb
new file mode 100644
index 00000000000..fb37b3b37c2
--- /dev/null
+++ b/db/migrate/20221031102916_add_users_foreign_key_to_projects.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddUsersForeignKeyToProjects < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :projects, :users, column: :creator_id, on_delete: :nullify, validate: false
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :projects, column: :creator_id
+ end
+ end
+end
diff --git a/db/migrate/20221101032521_add_default_preferred_language_to_application_settings.rb b/db/migrate/20221101032521_add_default_preferred_language_to_application_settings.rb
new file mode 100644
index 00000000000..d6941f95465
--- /dev/null
+++ b/db/migrate/20221101032521_add_default_preferred_language_to_application_settings.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddDefaultPreferredLanguageToApplicationSettings < Gitlab::Database::Migration[2.0]
+ def change
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in 20221101032600_add_text_limit_to_default_preferred_language_on_application_settings.rb
+ add_column :application_settings, :default_preferred_language, :text, default: 'en', null: false
+ # rubocop:enable Migration/AddLimitToTextColumns
+ end
+end
diff --git a/db/migrate/20221101032600_add_text_limit_to_default_preferred_language_on_application_settings.rb b/db/migrate/20221101032600_add_text_limit_to_default_preferred_language_on_application_settings.rb
new file mode 100644
index 00000000000..1f6b9815b93
--- /dev/null
+++ b/db/migrate/20221101032600_add_text_limit_to_default_preferred_language_on_application_settings.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddTextLimitToDefaultPreferredLanguageOnApplicationSettings < Gitlab::Database::Migration[2.0]
+ MAXIMUM_LIMIT = 32
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :application_settings, :default_preferred_language, MAXIMUM_LIMIT
+ end
+
+ def down
+ remove_text_limit :application_settings, :default_preferred_language
+ end
+end
diff --git a/db/migrate/20221101195903_change_email_confirmation_setting_default.rb b/db/migrate/20221101195903_change_email_confirmation_setting_default.rb
new file mode 100644
index 00000000000..86c1896f184
--- /dev/null
+++ b/db/migrate/20221101195903_change_email_confirmation_setting_default.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class ChangeEmailConfirmationSettingDefault < Gitlab::Database::Migration[2.0]
+ def change
+ change_column_default(:application_settings, :email_confirmation_setting, from: 2, to: 0)
+ end
+end
diff --git a/db/migrate/20221101201031_set_email_confirmation_setting_from_send_user_confirmation_email_setting.rb b/db/migrate/20221101201031_set_email_confirmation_setting_from_send_user_confirmation_email_setting.rb
new file mode 100644
index 00000000000..0c0a0dc1a58
--- /dev/null
+++ b/db/migrate/20221101201031_set_email_confirmation_setting_from_send_user_confirmation_email_setting.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class SetEmailConfirmationSettingFromSendUserConfirmationEmailSetting < Gitlab::Database::Migration[2.0]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ class ApplicationSetting < MigrationRecord
+ self.table_name = 'application_settings'
+ end
+
+ def up
+ return unless ApplicationSetting.exists?
+ return unless ApplicationSetting.last.send_user_confirmation_email
+
+ ApplicationSetting.last.update(email_confirmation_setting: 2)
+ end
+
+ def down
+ return unless ApplicationSetting.exists?
+
+ ApplicationSetting.last.update(email_confirmation_setting: 0)
+ end
+end
diff --git a/db/migrate/20221102202130_extend_x509_subject_limit.rb b/db/migrate/20221102202130_extend_x509_subject_limit.rb
new file mode 100644
index 00000000000..3e6bfc7691c
--- /dev/null
+++ b/db/migrate/20221102202130_extend_x509_subject_limit.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class ExtendX509SubjectLimit < Gitlab::Database::Migration[2.0]
+ def up
+ change_column :x509_certificates, :subject, :string, limit: 512
+ end
+
+ def down
+ change_column :x509_certificates, :subject, :string, limit: 255
+ end
+end
diff --git a/db/migrate/20221102225800_add_max_seats_used_changed_at_index_to_gitlab_subscriptions.rb b/db/migrate/20221102225800_add_max_seats_used_changed_at_index_to_gitlab_subscriptions.rb
new file mode 100644
index 00000000000..b5cf8289673
--- /dev/null
+++ b/db/migrate/20221102225800_add_max_seats_used_changed_at_index_to_gitlab_subscriptions.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddMaxSeatsUsedChangedAtIndexToGitlabSubscriptions < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'index_gitlab_subscriptions_on_max_seats_used_changed_at'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :gitlab_subscriptions, [:max_seats_used_changed_at, :namespace_id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :gitlab_subscriptions, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221103131409_add_partial_index_on_primary_key_of_security_scans.rb b/db/migrate/20221103131409_add_partial_index_on_primary_key_of_security_scans.rb
new file mode 100644
index 00000000000..f3defcd38c6
--- /dev/null
+++ b/db/migrate/20221103131409_add_partial_index_on_primary_key_of_security_scans.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddPartialIndexOnPrimaryKeyOfSecurityScans < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = :index_security_scans_on_id_for_non_purged_records
+ PURGED_STATE = 6
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :security_scans, :id, where: "status != #{PURGED_STATE}", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :security_scans, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221104061320_add_disable_download_button_into_application_settings.rb b/db/migrate/20221104061320_add_disable_download_button_into_application_settings.rb
new file mode 100644
index 00000000000..b93085b8617
--- /dev/null
+++ b/db/migrate/20221104061320_add_disable_download_button_into_application_settings.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+class AddDisableDownloadButtonIntoApplicationSettings < Gitlab::Database::Migration[2.0]
+ def change
+ add_column :application_settings, :disable_download_button, :boolean,
+ null: false, default: false, comment: 'JiHu-specific column'
+ end
+end
diff --git a/db/migrate/20221104094042_remove_users_foreign_key_to_projects.rb b/db/migrate/20221104094042_remove_users_foreign_key_to_projects.rb
new file mode 100644
index 00000000000..19497c80b8e
--- /dev/null
+++ b/db/migrate/20221104094042_remove_users_foreign_key_to_projects.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class RemoveUsersForeignKeyToProjects < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists :projects, column: :creator_id
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key :projects, :users, column: :creator_id, on_delete: :nullify, validate: false
+ end
+end
diff --git a/db/migrate/20221107115247_change_scim_identity_group_id_remove_null.rb b/db/migrate/20221107115247_change_scim_identity_group_id_remove_null.rb
new file mode 100644
index 00000000000..f68cab68261
--- /dev/null
+++ b/db/migrate/20221107115247_change_scim_identity_group_id_remove_null.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+class ChangeScimIdentityGroupIdRemoveNull < Gitlab::Database::Migration[2.0]
+ def up
+ change_column_null :scim_identities, :group_id, true
+ end
+
+ def down
+ # There may now be nulls in the table, so we cannot re-add the constraint here.
+ end
+end
diff --git a/db/migrate/20221107115413_change_scim_oauth_access_token_group_id_remove_null.rb b/db/migrate/20221107115413_change_scim_oauth_access_token_group_id_remove_null.rb
new file mode 100644
index 00000000000..c33e67291a4
--- /dev/null
+++ b/db/migrate/20221107115413_change_scim_oauth_access_token_group_id_remove_null.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+class ChangeScimOauthAccessTokenGroupIdRemoveNull < Gitlab::Database::Migration[2.0]
+ def up
+ change_column_null :scim_oauth_access_tokens, :group_id, true
+ end
+
+ def down
+ # There may now be nulls in the table, so we cannot re-add the constraint here.
+ end
+end
diff --git a/db/migrate/20221107183222_create_project_wiki_repositories.rb b/db/migrate/20221107183222_create_project_wiki_repositories.rb
new file mode 100644
index 00000000000..770c62604ff
--- /dev/null
+++ b/db/migrate/20221107183222_create_project_wiki_repositories.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class CreateProjectWikiRepositories < Gitlab::Database::Migration[2.0]
+ def change
+ create_table :project_wiki_repositories do |t|
+ t.references :project, index: { unique: true }, foreign_key: { on_delete: :cascade }, null: false
+
+ t.timestamps_with_timezone null: false
+ end
+ end
+end
diff --git a/db/migrate/20221107184542_add_new_amount_used_to_ci_namespace_monthly_usages.rb b/db/migrate/20221107184542_add_new_amount_used_to_ci_namespace_monthly_usages.rb
new file mode 100644
index 00000000000..23a5a716164
--- /dev/null
+++ b/db/migrate/20221107184542_add_new_amount_used_to_ci_namespace_monthly_usages.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddNewAmountUsedToCiNamespaceMonthlyUsages < Gitlab::Database::Migration[2.0]
+ TABLE = :ci_namespace_monthly_usages
+ OLD_COLUMN = :amount_used
+ NEW_COLUMN = :new_amount_used
+ TRIGGER_NAME = 'sync_namespaces_amount_used_columns'
+
+ disable_ddl_transaction!
+
+ def up
+ check_trigger_permissions!(TABLE)
+
+ add_column(TABLE, NEW_COLUMN, :decimal, default: 0.0, precision: 18, scale: 4, null: false, if_not_exists: true)
+
+ install_rename_triggers(TABLE, OLD_COLUMN, NEW_COLUMN, trigger_name: TRIGGER_NAME)
+ end
+
+ def down
+ remove_rename_triggers(TABLE, TRIGGER_NAME)
+
+ remove_column(TABLE, NEW_COLUMN)
+ end
+end
diff --git a/db/migrate/20221108015813_add_telesign_to_application_settings.rb b/db/migrate/20221108015813_add_telesign_to_application_settings.rb
new file mode 100644
index 00000000000..f8e4fb5340b
--- /dev/null
+++ b/db/migrate/20221108015813_add_telesign_to_application_settings.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddTelesignToApplicationSettings < Gitlab::Database::Migration[2.0]
+ def change
+ add_column :application_settings, :encrypted_telesign_customer_xid, :binary
+ add_column :application_settings, :encrypted_telesign_customer_xid_iv, :binary
+
+ add_column :application_settings, :encrypted_telesign_api_key, :binary
+ add_column :application_settings, :encrypted_telesign_api_key_iv, :binary
+ end
+end
diff --git a/db/migrate/20221108185442_add_project_wiki_repository_id_to_project_wiki_repository_states.rb b/db/migrate/20221108185442_add_project_wiki_repository_id_to_project_wiki_repository_states.rb
new file mode 100644
index 00000000000..317f58dac27
--- /dev/null
+++ b/db/migrate/20221108185442_add_project_wiki_repository_id_to_project_wiki_repository_states.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class AddProjectWikiRepositoryIdToProjectWikiRepositoryStates < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'idx_project_wiki_repository_states_project_wiki_repository_id'
+
+ def up
+ with_lock_retries do
+ unless column_exists?(:project_wiki_repository_states, :project_wiki_repository_id)
+ add_column :project_wiki_repository_states, :project_wiki_repository_id, :bigint
+ end
+ end
+
+ add_concurrent_index :project_wiki_repository_states,
+ :project_wiki_repository_id,
+ name: INDEX_NAME
+
+ add_concurrent_foreign_key :project_wiki_repository_states,
+ :project_wiki_repositories,
+ column: :project_wiki_repository_id,
+ on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ if column_exists?(:project_wiki_repository_states, :project_wiki_repository_id)
+ remove_column :project_wiki_repository_states, :project_wiki_repository_id
+ end
+ end
+
+ remove_foreign_key_if_exists :project_wiki_repository_states, column: :project_wiki_repository_id
+ remove_concurrent_index_by_name :project_wiki_repository_states, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221110105857_add_index_for_in_product_marketing_email_metrics.rb b/db/migrate/20221110105857_add_index_for_in_product_marketing_email_metrics.rb
new file mode 100644
index 00000000000..f1bc07e4197
--- /dev/null
+++ b/db/migrate/20221110105857_add_index_for_in_product_marketing_email_metrics.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddIndexForInProductMarketingEmailMetrics < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_in_product_marketing_emails_on_track_series_id_clicked'
+
+ def up
+ add_concurrent_index :in_product_marketing_emails, %i[track series id cta_clicked_at], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :in_product_marketing_emails, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20221110150942_add_project_id_lower_name_index_remove_old_index.rb b/db/migrate/20221110150942_add_project_id_lower_name_index_remove_old_index.rb
new file mode 100644
index 00000000000..dfff2f89610
--- /dev/null
+++ b/db/migrate/20221110150942_add_project_id_lower_name_index_remove_old_index.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class AddProjectIdLowerNameIndexRemoveOldIndex < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'index_im_timeline_event_tags_name_project_id'
+ NEW_INDEX_NAME = 'index_im_timeline_event_tags_on_lower_name_and_project_id'
+
+ disable_ddl_transaction!
+
+ def up
+ # Add new index
+ add_concurrent_index :incident_management_timeline_event_tags, 'project_id, LOWER(name)',
+ unique: true, name: NEW_INDEX_NAME
+
+ # Remove old index
+ remove_concurrent_index_by_name :incident_management_timeline_event_tags, INDEX_NAME
+ end
+
+ def down
+ # Add old index
+ add_concurrent_index :incident_management_timeline_event_tags, [:project_id, :name],
+ unique: true, name: INDEX_NAME
+
+ # Remove new index
+ remove_concurrent_index_by_name :incident_management_timeline_event_tags, NEW_INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb
index b9427f7cc93..5d31cdb05e6 100644
--- a/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb
+++ b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb
@@ -19,7 +19,7 @@ class BackfillEventsIdForBigintConversion < ActiveRecord::Migration[6.0]
Gitlab::Database::BackgroundMigration::BatchedMigration
.where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob')
.where(table_name: 'events', column_name: 'id')
- .where(job_arguments: %w[id id_convert_to_bigint].to_json)
+ .where(job_arguments: Gitlab::Json.dump(%w[id id_convert_to_bigint]))
.delete_all
end
diff --git a/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb
index 0d610f1dde1..b64282fe0d3 100644
--- a/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb
+++ b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb
@@ -20,7 +20,7 @@ class BackfillPushEventPayloadEventIdForBigintConversion < ActiveRecord::Migrati
Gitlab::Database::BackgroundMigration::BatchedMigration
.where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob')
.where(table_name: 'push_event_payloads', column_name: 'event_id')
- .where(job_arguments: %w[event_id event_id_convert_to_bigint].to_json)
+ .where(job_arguments: Gitlab::Json.dump(%w[event_id event_id_convert_to_bigint]))
.delete_all
end
diff --git a/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb b/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb
index 1ee67cd9dda..8fcaeb3fb04 100644
--- a/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb
+++ b/db/post_migrate/20210415101228_backfill_ci_build_needs_for_bigint_conversion.rb
@@ -20,7 +20,7 @@ class BackfillCiBuildNeedsForBigintConversion < ActiveRecord::Migration[6.0]
Gitlab::Database::BackgroundMigration::BatchedMigration
.where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob')
.where(table_name: 'ci_build_needs', column_name: 'build_id')
- .where(job_arguments: %w[build_id build_id_convert_to_bigint].to_json)
+ .where(job_arguments: Gitlab::Json.dump(%w[build_id build_id_convert_to_bigint]))
.delete_all
end
diff --git a/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb b/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb
index 67076cc647a..0c68834f723 100644
--- a/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb
+++ b/db/post_migrate/20210420121149_backfill_conversion_of_ci_job_artifacts.rb
@@ -19,7 +19,7 @@ class BackfillConversionOfCiJobArtifacts < ActiveRecord::Migration[6.0]
Gitlab::Database::BackgroundMigration::BatchedMigration
.where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob')
.where(table_name: 'ci_job_artifacts', column_name: 'id')
- .where(job_arguments: [%w[id job_id], %w[id_convert_to_bigint job_id_convert_to_bigint]].to_json)
+ .where(job_arguments: Gitlab::Json.dump([%w[id job_id], %w[id_convert_to_bigint job_id_convert_to_bigint]]))
.delete_all
end
diff --git a/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb b/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb
index bde91473ee3..3c6f2385f1d 100644
--- a/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb
+++ b/db/post_migrate/20210422023046_backfill_ci_sources_pipelines_source_job_id_for_bigint_conversion.rb
@@ -18,7 +18,7 @@ class BackfillCiSourcesPipelinesSourceJobIdForBigintConversion < ActiveRecord::M
Gitlab::Database::BackgroundMigration::BatchedMigration
.where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob')
.where(table_name: 'ci_sources_pipelines', column_name: 'id')
- .where(job_arguments: [%w[source_job_id], %w[source_job_id_convert_to_bigint]].to_json)
+ .where(job_arguments: Gitlab::Json.dump([%w[source_job_id], %w[source_job_id_convert_to_bigint]]))
.delete_all
end
diff --git a/db/post_migrate/20210615234935_fix_batched_migrations_old_format_job_arguments.rb b/db/post_migrate/20210615234935_fix_batched_migrations_old_format_job_arguments.rb
index 535f7426938..818aea39762 100644
--- a/db/post_migrate/20210615234935_fix_batched_migrations_old_format_job_arguments.rb
+++ b/db/post_migrate/20210615234935_fix_batched_migrations_old_format_job_arguments.rb
@@ -17,8 +17,8 @@ class FixBatchedMigrationsOldFormatJobArguments < ActiveRecord::Migration[6.1]
# rubocop:disable Rails/WhereEquals
base_scope
- .where('job_arguments = ?', legacy_job_arguments.to_json)
- .where('NOT EXISTS (?)', base_scope.select('1').where('job_arguments = ?', current_job_arguments.to_json))
+ .where('job_arguments = ?', Gitlab::Json.dump(legacy_job_arguments))
+ .where('NOT EXISTS (?)', base_scope.select('1').where('job_arguments = ?', Gitlab::Json.dump(current_job_arguments)))
.update_all(job_arguments: current_job_arguments)
# rubocop:enable Rails/WhereEquals
end
diff --git a/db/post_migrate/20210818185845_backfill_projects_with_coverage.rb b/db/post_migrate/20210818185845_backfill_projects_with_coverage.rb
index 003b7536767..d86d49f4393 100644
--- a/db/post_migrate/20210818185845_backfill_projects_with_coverage.rb
+++ b/db/post_migrate/20210818185845_backfill_projects_with_coverage.rb
@@ -1,29 +1,8 @@
# frozen_string_literal: true
class BackfillProjectsWithCoverage < ActiveRecord::Migration[6.1]
- include Gitlab::Database::MigrationHelpers
-
- MIGRATION = 'BackfillProjectsWithCoverage'
- DELAY_INTERVAL = 2.minutes
- BATCH_SIZE = 10_000
- SUB_BATCH_SIZE = 1_000
-
- disable_ddl_transaction!
-
- class CiDailyBuildGroupReportResult < ActiveRecord::Base
- include EachBatch
-
- self.table_name = 'ci_daily_build_group_report_results'
- end
-
def up
- queue_background_migration_jobs_by_range_at_intervals(
- CiDailyBuildGroupReportResult,
- MIGRATION,
- DELAY_INTERVAL,
- batch_size: BATCH_SIZE,
- other_job_arguments: [SUB_BATCH_SIZE]
- )
+ # noop
end
def down
diff --git a/db/post_migrate/20220802112102_schedule_migrate_shared_vulnerability_scanners.rb b/db/post_migrate/20220802112102_schedule_migrate_shared_vulnerability_scanners.rb
index 92ca0998bae..724bd323169 100644
--- a/db/post_migrate/20220802112102_schedule_migrate_shared_vulnerability_scanners.rb
+++ b/db/post_migrate/20220802112102_schedule_migrate_shared_vulnerability_scanners.rb
@@ -1,34 +1,14 @@
# frozen_string_literal: true
class ScheduleMigrateSharedVulnerabilityScanners < Gitlab::Database::Migration[2.0]
- MIGRATION = "MigrateSharedVulnerabilityScanners"
- TABLE_NAME = :vulnerability_occurrences
- BATCH_COLUMN = :id
- DELAY_INTERVAL = 5.minutes
- BATCH_SIZE = 1000
- SUB_BATCH_SIZE = 100
-
- BATCH_MIN_VALUE = 23658505
- BATCH_MAX_VALUE = 204428752
-
disable_ddl_transaction!
restrict_gitlab_migration gitlab_schema: :gitlab_main
def up
- queue_batched_background_migration(
- MIGRATION,
- TABLE_NAME,
- BATCH_COLUMN,
- job_interval: DELAY_INTERVAL,
- batch_size: BATCH_SIZE,
- max_batch_size: BATCH_SIZE,
- sub_batch_size: SUB_BATCH_SIZE,
- batch_min_value: BATCH_MIN_VALUE,
- batch_max_value: BATCH_MAX_VALUE
- )
+ # no-op
end
def down
- delete_batched_background_migration(MIGRATION, TABLE_NAME, BATCH_COLUMN, [])
+ # no-op
end
end
diff --git a/db/post_migrate/20220919080303_delete_migrate_shared_vulnerability_scanners.rb b/db/post_migrate/20220919080303_delete_migrate_shared_vulnerability_scanners.rb
new file mode 100644
index 00000000000..4aedfcf1699
--- /dev/null
+++ b/db/post_migrate/20220919080303_delete_migrate_shared_vulnerability_scanners.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+class DeleteMigrateSharedVulnerabilityScanners < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ MIGRATION = "MigrateSharedVulnerabilityScanners"
+ TABLE_NAME = :vulnerability_occurrences
+ BATCH_COLUMN = :id
+ BATCH_SIZE = 250
+
+ class BatchedBackgroundMigration < MigrationRecord
+ self.table_name = "batched_background_migrations"
+ end
+
+ class BatchedBackgroundMigrationJob < MigrationRecord
+ include ::EachBatch
+
+ self.table_name = "batched_background_migration_jobs"
+
+ belongs_to :batched_background_migration
+ end
+
+ def up
+ return unless migration_id = BatchedBackgroundMigration.find_by(job_class_name: MIGRATION)&.id
+
+ # rubocop:disable Style/SymbolProc
+ BatchedBackgroundMigrationJob
+ .where(batched_background_migration_id: migration_id)
+ .each_batch(of: BATCH_SIZE) do |relation|
+ relation.delete_all
+ end
+ # rubocop:enable Style/SymbolProc
+
+ delete_batched_background_migration(MIGRATION,
+ TABLE_NAME,
+ BATCH_COLUMN,
+ [])
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20220919080304_reschedule_migrate_shared_vulnerability_scanners.rb b/db/post_migrate/20220919080304_reschedule_migrate_shared_vulnerability_scanners.rb
new file mode 100644
index 00000000000..69757085587
--- /dev/null
+++ b/db/post_migrate/20220919080304_reschedule_migrate_shared_vulnerability_scanners.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class RescheduleMigrateSharedVulnerabilityScanners < Gitlab::Database::Migration[2.0]
+ MIGRATION = "MigrateSharedVulnerabilityScanners"
+ TABLE_NAME = :vulnerability_occurrences
+ BATCH_COLUMN = :id
+ DELAY_INTERVAL = 5.minutes
+ BATCH_SIZE = 1000
+ SUB_BATCH_SIZE = 100
+
+ disable_ddl_transaction!
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ TABLE_NAME,
+ BATCH_COLUMN,
+ job_interval: DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ max_batch_size: BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, TABLE_NAME, BATCH_COLUMN, [])
+ end
+end
diff --git a/db/post_migrate/20220927171740_prepare_for_vulnerability_occurrences_uuid_type_transition.rb b/db/post_migrate/20220927171740_prepare_for_vulnerability_occurrences_uuid_type_transition.rb
new file mode 100644
index 00000000000..e6f3384514d
--- /dev/null
+++ b/db/post_migrate/20220927171740_prepare_for_vulnerability_occurrences_uuid_type_transition.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class PrepareForVulnerabilityOccurrencesUuidTypeTransition < Gitlab::Database::Migration[2.0]
+ enable_lock_retries!
+
+ TABLE = :vulnerability_occurrences
+ MAPPINGS = {
+ uuid: {
+ from_type: :string,
+ to_type: :uuid,
+ default_value: '00000000-0000-0000-0000-000000000000'
+ }
+ }
+
+ def up
+ create_temporary_columns_and_triggers(TABLE, MAPPINGS)
+ end
+
+ def down
+ columns = MAPPINGS.keys
+ temporary_columns = columns.map { |column| convert_to_type_column(column, :string, :uuid) }
+ trigger_name = rename_trigger_name(TABLE, columns, temporary_columns)
+ remove_rename_triggers(TABLE, trigger_name)
+ temporary_columns.each { |column| remove_column(TABLE, column) }
+ end
+end
diff --git a/db/post_migrate/20221004074910_routing_table_prepare_constraint_for_builds_metadata.rb b/db/post_migrate/20221004074910_routing_table_prepare_constraint_for_builds_metadata.rb
new file mode 100644
index 00000000000..013984154ae
--- /dev/null
+++ b/db/post_migrate/20221004074910_routing_table_prepare_constraint_for_builds_metadata.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class RoutingTablePrepareConstraintForBuildsMetadata < Gitlab::Database::Migration[2.0]
+ include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = :ci_builds_metadata
+ PARENT_TABLE_NAME = :p_ci_builds_metadata
+ FIRST_PARTITION = 100
+ PARTITION_COLUMN = :partition_id
+
+ def up
+ prepare_constraint_for_list_partitioning(
+ table_name: TABLE_NAME,
+ partitioning_column: PARTITION_COLUMN,
+ parent_table_name: PARENT_TABLE_NAME,
+ initial_partitioning_value: FIRST_PARTITION
+ )
+ end
+
+ def down
+ revert_preparing_constraint_for_list_partitioning(
+ table_name: TABLE_NAME,
+ partitioning_column: PARTITION_COLUMN,
+ parent_table_name: PARENT_TABLE_NAME,
+ initial_partitioning_value: FIRST_PARTITION
+ )
+ end
+end
diff --git a/db/post_migrate/20221004074914_create_routing_table_for_builds_metadata.rb b/db/post_migrate/20221004074914_create_routing_table_for_builds_metadata.rb
new file mode 100644
index 00000000000..a792fc91d3d
--- /dev/null
+++ b/db/post_migrate/20221004074914_create_routing_table_for_builds_metadata.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class CreateRoutingTableForBuildsMetadata < Gitlab::Database::Migration[2.0]
+ def up; end
+
+ def down; end
+end
diff --git a/db/post_migrate/20221006070927_finalize_invalid_member_cleanup.rb b/db/post_migrate/20221006070927_finalize_invalid_member_cleanup.rb
new file mode 100644
index 00000000000..78786e46f5c
--- /dev/null
+++ b/db/post_migrate/20221006070927_finalize_invalid_member_cleanup.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class FinalizeInvalidMemberCleanup < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ MIGRATION = 'DestroyInvalidMembers'
+
+ def up
+ ensure_batched_background_migration_is_finished(
+ job_class_name: MIGRATION,
+ table_name: :members,
+ column_name: :id,
+ job_arguments: []
+ )
+ end
+
+ def down
+ # noop
+ end
+end
diff --git a/db/post_migrate/20221006172302_adjust_task_note_rename_background_migration_values.rb b/db/post_migrate/20221006172302_adjust_task_note_rename_background_migration_values.rb
index 2af16fb6d3c..b582b163e2d 100644
--- a/db/post_migrate/20221006172302_adjust_task_note_rename_background_migration_values.rb
+++ b/db/post_migrate/20221006172302_adjust_task_note_rename_background_migration_values.rb
@@ -20,7 +20,7 @@ class AdjustTaskNoteRenameBackgroundMigrationValues < Gitlab::Database::Migratio
scope :for_configuration, ->(job_class_name, table_name, column_name, job_arguments) do
where(job_class_name: job_class_name, table_name: table_name, column_name: column_name)
- .where("job_arguments = ?", job_arguments.to_json) # rubocop:disable Rails/WhereEquals
+ .where("job_arguments = ?", Gitlab::Json.dump(job_arguments)) # rubocop:disable Rails/WhereEquals
end
end
diff --git a/db/post_migrate/20221010141500_add_index_author_id_target_project_id_on_merge_requests.rb b/db/post_migrate/20221010141500_add_index_author_id_target_project_id_on_merge_requests.rb
new file mode 100644
index 00000000000..5b9d5be2b3f
--- /dev/null
+++ b/db/post_migrate/20221010141500_add_index_author_id_target_project_id_on_merge_requests.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddIndexAuthorIdTargetProjectIdOnMergeRequests < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'index_merge_requests_on_author_id_and_target_project_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :merge_requests, %i[author_id target_project_id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :merge_requests, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221010162137_add_index_author_id_and_id_on_merge_requests.rb b/db/post_migrate/20221010162137_add_index_author_id_and_id_on_merge_requests.rb
new file mode 100644
index 00000000000..36184b5f573
--- /dev/null
+++ b/db/post_migrate/20221010162137_add_index_author_id_and_id_on_merge_requests.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddIndexAuthorIdAndIdOnMergeRequests < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'index_merge_requests_on_author_id_and_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :merge_requests, %i[author_id id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :merge_requests, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221011062254_sync_new_amount_used_for_ci_project_monthly_usages.rb b/db/post_migrate/20221011062254_sync_new_amount_used_for_ci_project_monthly_usages.rb
new file mode 100644
index 00000000000..32943f10fcf
--- /dev/null
+++ b/db/post_migrate/20221011062254_sync_new_amount_used_for_ci_project_monthly_usages.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class SyncNewAmountUsedForCiProjectMonthlyUsages < Gitlab::Database::Migration[2.0]
+ restrict_gitlab_migration gitlab_schema: :gitlab_ci
+
+ def up
+ project_usages = define_batchable_model('ci_project_monthly_usages')
+
+ project_usages.each_batch(of: 500) do |batch|
+ batch.where('amount_used > 0').update_all('new_amount_used = amount_used')
+ end
+ end
+
+ def down
+ # Non reversible migration.
+ # This data migration keeps `new_amount_used` in sync with the old `amount_used`.
+ # In case of failure or interruption the migration can be retried.
+ end
+end
diff --git a/db/post_migrate/20221013215832_cleanup_vulnerability_state_transitions_with_same_from_state_to_state.rb b/db/post_migrate/20221013215832_cleanup_vulnerability_state_transitions_with_same_from_state_to_state.rb
new file mode 100644
index 00000000000..a81a80deb25
--- /dev/null
+++ b/db/post_migrate/20221013215832_cleanup_vulnerability_state_transitions_with_same_from_state_to_state.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class CleanupVulnerabilityStateTransitionsWithSameFromStateToState < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ class VulnerabilityStateTransition < MigrationRecord
+ self.table_name = 'vulnerability_state_transitions'
+ end
+
+ def up
+ VulnerabilityStateTransition.where('from_state = to_state').delete_all
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20221017084227_cleanup_rename_ci_pipeline_metadata_title.rb b/db/post_migrate/20221017084227_cleanup_rename_ci_pipeline_metadata_title.rb
new file mode 100644
index 00000000000..0829f3d8734
--- /dev/null
+++ b/db/post_migrate/20221017084227_cleanup_rename_ci_pipeline_metadata_title.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class CleanupRenameCiPipelineMetadataTitle < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ cleanup_concurrent_column_rename :ci_pipeline_metadata, :title, :name
+ end
+
+ def down
+ undo_cleanup_concurrent_column_rename :ci_pipeline_metadata, :title, :name, batch_column_name: :pipeline_id
+ end
+end
diff --git a/db/post_migrate/20221018062308_schedule_backfill_project_namespace_details.rb b/db/post_migrate/20221018062308_schedule_backfill_project_namespace_details.rb
new file mode 100644
index 00000000000..74c8ef37ac2
--- /dev/null
+++ b/db/post_migrate/20221018062308_schedule_backfill_project_namespace_details.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class ScheduleBackfillProjectNamespaceDetails < Gitlab::Database::Migration[2.0]
+ MIGRATION = 'BackfillProjectNamespaceDetails'
+ INTERVAL = 2.minutes
+ BATCH_SIZE = 1_000
+ MAX_BATCH_SIZE = 10_000
+ SUB_BATCH_SIZE = 200
+
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ 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
+ delete_batched_background_migration(MIGRATION, :projects, :id, [])
+ end
+end
diff --git a/db/post_migrate/20221018193635_ensure_task_note_renaming_background_migration_finished.rb b/db/post_migrate/20221018193635_ensure_task_note_renaming_background_migration_finished.rb
new file mode 100644
index 00000000000..c6ae0f185d8
--- /dev/null
+++ b/db/post_migrate/20221018193635_ensure_task_note_renaming_background_migration_finished.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class EnsureTaskNoteRenamingBackgroundMigrationFinished < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ MIGRATION = 'RenameTaskSystemNoteToChecklistItem'
+
+ def up
+ ensure_batched_background_migration_is_finished(
+ job_class_name: MIGRATION,
+ table_name: :system_note_metadata,
+ column_name: :id,
+ job_arguments: []
+ )
+ end
+
+ def down
+ # noop
+ end
+end
diff --git a/db/post_migrate/20221018193827_drop_tmp_index_system_note_metadata_on_id_where_task.rb b/db/post_migrate/20221018193827_drop_tmp_index_system_note_metadata_on_id_where_task.rb
new file mode 100644
index 00000000000..5cc70c530c6
--- /dev/null
+++ b/db/post_migrate/20221018193827_drop_tmp_index_system_note_metadata_on_id_where_task.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class DropTmpIndexSystemNoteMetadataOnIdWhereTask < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'tmp_index_system_note_metadata_on_id_where_task'
+
+ def up
+ remove_concurrent_index_by_name :system_note_metadata, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :system_note_metadata, [:id, :action], where: "action = 'task'", name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221018232820_add_temp_index_for_user_details_fields.rb b/db/post_migrate/20221018232820_add_temp_index_for_user_details_fields.rb
new file mode 100644
index 00000000000..b46b316981d
--- /dev/null
+++ b/db/post_migrate/20221018232820_add_temp_index_for_user_details_fields.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddTempIndexForUserDetailsFields < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'tmp_idx_where_user_details_fields_filled'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :users, :id, name: INDEX_NAME, where: <<~QUERY
+ (COALESCE(linkedin, '') IS DISTINCT FROM '')
+ OR (COALESCE(twitter, '') IS DISTINCT FROM '')
+ OR (COALESCE(skype, '') IS DISTINCT FROM '')
+ OR (COALESCE(website_url, '') IS DISTINCT FROM '')
+ OR (COALESCE(location, '') IS DISTINCT FROM '')
+ OR (COALESCE(organization, '') IS DISTINCT FROM '')
+ QUERY
+ end
+
+ def down
+ remove_concurrent_index_by_name :users, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221019002459_queue_backfill_user_details_fields.rb b/db/post_migrate/20221019002459_queue_backfill_user_details_fields.rb
new file mode 100644
index 00000000000..8ed4416a98d
--- /dev/null
+++ b/db/post_migrate/20221019002459_queue_backfill_user_details_fields.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class QueueBackfillUserDetailsFields < Gitlab::Database::Migration[2.0]
+ MIGRATION = 'BackfillUserDetailsFields'
+ INTERVAL = 2.minutes
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(MIGRATION, :users, :id, job_interval: INTERVAL)
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :users, :id, [])
+ end
+end
diff --git a/db/post_migrate/20221019102426_remove_tmp_index_approval_merge_request_rules_on_report_type.rb b/db/post_migrate/20221019102426_remove_tmp_index_approval_merge_request_rules_on_report_type.rb
new file mode 100644
index 00000000000..7203d35de92
--- /dev/null
+++ b/db/post_migrate/20221019102426_remove_tmp_index_approval_merge_request_rules_on_report_type.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveTmpIndexApprovalMergeRequestRulesOnReportType < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'tmp_index_approval_merge_request_rules_on_report_type_equal_one'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :approval_merge_request_rules, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :approval_merge_request_rules,
+ [:id, :report_type],
+ name: INDEX_NAME,
+ where: "report_type = 1"
+ end
+end
diff --git a/db/post_migrate/20221019105041_queue_populate_projects_star_count.rb b/db/post_migrate/20221019105041_queue_populate_projects_star_count.rb
new file mode 100644
index 00000000000..768e0c7826f
--- /dev/null
+++ b/db/post_migrate/20221019105041_queue_populate_projects_star_count.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class QueuePopulateProjectsStarCount < Gitlab::Database::Migration[2.0]
+ MIGRATION = 'PopulateProjectsStarCount'
+ DELAY_INTERVAL = 2.minutes
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :projects,
+ :id,
+ job_interval: DELAY_INTERVAL,
+ sub_batch_size: 50
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :projects, :id, [])
+ end
+end
diff --git a/db/post_migrate/20221019141508_add_index_to_test_reports_issue_id_created_at_and_id.rb b/db/post_migrate/20221019141508_add_index_to_test_reports_issue_id_created_at_and_id.rb
new file mode 100644
index 00000000000..054512adf2e
--- /dev/null
+++ b/db/post_migrate/20221019141508_add_index_to_test_reports_issue_id_created_at_and_id.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class AddIndexToTestReportsIssueIdCreatedAtAndId < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'requirements_management_test_reports'
+ INDEX_NAME = 'idx_test_reports_on_issue_id_created_at_and_id'
+
+ def up
+ add_concurrent_index TABLE_NAME, [:issue_id, :created_at, :id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221019194751_disable_fastupdate_on_issues_title_gin_index.rb b/db/post_migrate/20221019194751_disable_fastupdate_on_issues_title_gin_index.rb
new file mode 100644
index 00000000000..6ad846dda1c
--- /dev/null
+++ b/db/post_migrate/20221019194751_disable_fastupdate_on_issues_title_gin_index.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class DisableFastupdateOnIssuesTitleGinIndex < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_issues_on_title_trigram'
+
+ def up
+ with_lock_retries do
+ execute <<~SQL
+ ALTER INDEX #{INDEX_NAME} SET ( fastupdate = false ) ;
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ execute <<~SQL
+ ALTER INDEX #{INDEX_NAME} RESET ( fastupdate ) ;
+ SQL
+ end
+ end
+end
diff --git a/db/post_migrate/20221019195754_disable_fastupdate_on_issues_description_gin_index.rb b/db/post_migrate/20221019195754_disable_fastupdate_on_issues_description_gin_index.rb
new file mode 100644
index 00000000000..ce09a48833f
--- /dev/null
+++ b/db/post_migrate/20221019195754_disable_fastupdate_on_issues_description_gin_index.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class DisableFastupdateOnIssuesDescriptionGinIndex < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_issues_on_description_trigram'
+
+ def up
+ with_lock_retries do
+ execute <<~SQL
+ ALTER INDEX #{INDEX_NAME} SET ( fastupdate = false ) ;
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ execute <<~SQL
+ ALTER INDEX #{INDEX_NAME} RESET ( fastupdate ) ;
+ SQL
+ end
+ end
+end
diff --git a/db/post_migrate/20221019200033_disable_fastupdate_on_merge_requests_title_gin_index.rb b/db/post_migrate/20221019200033_disable_fastupdate_on_merge_requests_title_gin_index.rb
new file mode 100644
index 00000000000..eb4c413a5a9
--- /dev/null
+++ b/db/post_migrate/20221019200033_disable_fastupdate_on_merge_requests_title_gin_index.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class DisableFastupdateOnMergeRequestsTitleGinIndex < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_merge_requests_on_title_trigram'
+
+ def up
+ with_lock_retries do
+ execute <<~SQL
+ ALTER INDEX #{INDEX_NAME} SET ( fastupdate = false ) ;
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ execute <<~SQL
+ ALTER INDEX #{INDEX_NAME} RESET ( fastupdate ) ;
+ SQL
+ end
+ end
+end
diff --git a/db/post_migrate/20221019200206_disable_fastupdate_on_merge_requests_description_gin_index.rb b/db/post_migrate/20221019200206_disable_fastupdate_on_merge_requests_description_gin_index.rb
new file mode 100644
index 00000000000..2e55937db36
--- /dev/null
+++ b/db/post_migrate/20221019200206_disable_fastupdate_on_merge_requests_description_gin_index.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class DisableFastupdateOnMergeRequestsDescriptionGinIndex < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_merge_requests_on_description_trigram'
+
+ def up
+ with_lock_retries do
+ execute <<~SQL
+ ALTER INDEX #{INDEX_NAME} SET ( fastupdate = false ) ;
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ execute <<~SQL
+ ALTER INDEX #{INDEX_NAME} RESET ( fastupdate ) ;
+ SQL
+ end
+ end
+end
diff --git a/db/post_migrate/20221021082255_add_unique_index_on_ci_runners_token.rb b/db/post_migrate/20221021082255_add_unique_index_on_ci_runners_token.rb
new file mode 100644
index 00000000000..3dfa44f9615
--- /dev/null
+++ b/db/post_migrate/20221021082255_add_unique_index_on_ci_runners_token.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddUniqueIndexOnCiRunnersToken < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_uniq_ci_runners_on_token'
+
+ def up
+ finalize_background_migration 'ResetDuplicateCiRunnersTokenValues'
+
+ add_concurrent_index :ci_runners,
+ :token,
+ name: INDEX_NAME,
+ unique: true
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_runners, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221021082312_add_unique_index_on_ci_runners_token_encrypted.rb b/db/post_migrate/20221021082312_add_unique_index_on_ci_runners_token_encrypted.rb
new file mode 100644
index 00000000000..8728c0ff20e
--- /dev/null
+++ b/db/post_migrate/20221021082312_add_unique_index_on_ci_runners_token_encrypted.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddUniqueIndexOnCiRunnersTokenEncrypted < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_uniq_ci_runners_on_token_encrypted'
+
+ def up
+ finalize_background_migration 'ResetDuplicateCiRunnersTokenEncryptedValues'
+
+ add_concurrent_index :ci_runners,
+ :token_encrypted,
+ name: INDEX_NAME,
+ unique: true
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_runners, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221021082720_drop_index_on_ci_runners_token.rb b/db/post_migrate/20221021082720_drop_index_on_ci_runners_token.rb
new file mode 100644
index 00000000000..9125831fbf3
--- /dev/null
+++ b/db/post_migrate/20221021082720_drop_index_on_ci_runners_token.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class DropIndexOnCiRunnersToken < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_ci_runners_on_token'
+
+ def up
+ remove_concurrent_index_by_name :ci_runners, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :ci_runners,
+ :token,
+ name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221021082734_drop_index_on_ci_runners_token_encrypted.rb b/db/post_migrate/20221021082734_drop_index_on_ci_runners_token_encrypted.rb
new file mode 100644
index 00000000000..39771fb5f85
--- /dev/null
+++ b/db/post_migrate/20221021082734_drop_index_on_ci_runners_token_encrypted.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class DropIndexOnCiRunnersTokenEncrypted < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_ci_runners_on_token_encrypted'
+
+ def up
+ remove_concurrent_index_by_name :ci_runners, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :ci_runners,
+ :token_encrypted,
+ name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221021145820_create_routing_table_for_builds_metadata_v2.rb b/db/post_migrate/20221021145820_create_routing_table_for_builds_metadata_v2.rb
new file mode 100644
index 00000000000..e5f1ba5cb87
--- /dev/null
+++ b/db/post_migrate/20221021145820_create_routing_table_for_builds_metadata_v2.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+class CreateRoutingTableForBuildsMetadataV2 < Gitlab::Database::Migration[2.0]
+ include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = :ci_builds_metadata
+ PARENT_TABLE_NAME = :p_ci_builds_metadata
+ FIRST_PARTITION = 100
+ PARTITION_COLUMN = :partition_id
+
+ def up
+ return if connection.table_exists?(PARENT_TABLE_NAME) && partition_attached?
+
+ convert_table_to_first_list_partition(
+ table_name: TABLE_NAME,
+ partitioning_column: PARTITION_COLUMN,
+ parent_table_name: PARENT_TABLE_NAME,
+ initial_partitioning_value: FIRST_PARTITION,
+ lock_tables: [:ci_builds, :ci_builds_metadata]
+ )
+ end
+
+ def down
+ revert_converting_table_to_first_list_partition(
+ table_name: TABLE_NAME,
+ partitioning_column: PARTITION_COLUMN,
+ parent_table_name: PARENT_TABLE_NAME,
+ initial_partitioning_value: FIRST_PARTITION
+ )
+ end
+
+ private
+
+ def partition_attached?
+ connection.select_value(<<~SQL)
+ SELECT true FROM postgres_partitions WHERE name = '#{TABLE_NAME}';
+ SQL
+ end
+end
diff --git a/db/post_migrate/20221021160735_add_index_for_common_finder_query_desc_with_namespace_id.rb b/db/post_migrate/20221021160735_add_index_for_common_finder_query_desc_with_namespace_id.rb
new file mode 100644
index 00000000000..d7c50010b72
--- /dev/null
+++ b/db/post_migrate/20221021160735_add_index_for_common_finder_query_desc_with_namespace_id.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexForCommonFinderQueryDescWithNamespaceId < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'index_group_vulnerability_reads_common_finder_query_desc'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :vulnerability_reads,
+ [:namespace_id, :state, :report_type, :severity, :vulnerability_id],
+ name: INDEX_NAME,
+ order: { severity: :desc, vulnerability_id: :desc }
+ end
+
+ def down
+ remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221024034228_remove_sprints_project_id_column.rb b/db/post_migrate/20221024034228_remove_sprints_project_id_column.rb
new file mode 100644
index 00000000000..e30d6dce497
--- /dev/null
+++ b/db/post_migrate/20221024034228_remove_sprints_project_id_column.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+class RemoveSprintsProjectIdColumn < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ DATERANGE_CONSTRAINT_NAME = 'iteration_start_and_due_daterange_project_id_constraint'
+
+ def up
+ with_lock_retries do
+ remove_column :sprints, :project_id, :bigint if column_exists?(:sprints, :project_id)
+ end
+ end
+
+ def down
+ with_lock_retries do
+ add_column :sprints, :project_id, :bigint unless column_exists?(:sprints, :project_id)
+ end
+
+ with_lock_retries do
+ next if check_constraint_exists?(:sprints, DATERANGE_CONSTRAINT_NAME)
+
+ execute(<<~SQL)
+ ALTER TABLE sprints
+ ADD CONSTRAINT #{DATERANGE_CONSTRAINT_NAME}
+ EXCLUDE USING gist (project_id WITH =, daterange(start_date, due_date, '[]'::text) WITH &&)
+ WHERE (project_id IS NOT NULL)
+ SQL
+ end
+
+ add_check_constraint(:sprints,
+ 'project_id <> NULL::bigint AND group_id IS NULL OR group_id <> NULL::bigint AND project_id IS NULL',
+ 'sprints_must_belong_to_project_or_group')
+
+ add_concurrent_index :sprints, [:project_id, :iid], unique: true, name: 'index_sprints_on_project_id_and_iid'
+
+ add_concurrent_foreign_key :sprints, :projects, column: :project_id, on_delete: :cascade
+ end
+end
diff --git a/db/post_migrate/20221024121500_drop_fingerprint_from_sbom_sources.rb b/db/post_migrate/20221024121500_drop_fingerprint_from_sbom_sources.rb
new file mode 100644
index 00000000000..83856cbe5dd
--- /dev/null
+++ b/db/post_migrate/20221024121500_drop_fingerprint_from_sbom_sources.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class DropFingerprintFromSbomSources < Gitlab::Database::Migration[2.0]
+ enable_lock_retries!
+
+ def change
+ remove_column :sbom_sources, :fingerprint, :bytea
+ end
+end
diff --git a/db/post_migrate/20221025115006_check_vulnerabilities_state_transition_from_state_not_equal_to_state.rb b/db/post_migrate/20221025115006_check_vulnerabilities_state_transition_from_state_not_equal_to_state.rb
new file mode 100644
index 00000000000..2ab7f8a9c04
--- /dev/null
+++ b/db/post_migrate/20221025115006_check_vulnerabilities_state_transition_from_state_not_equal_to_state.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class CheckVulnerabilitiesStateTransitionFromStateNotEqualToState < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ add_check_constraint(:vulnerability_state_transitions, '(from_state != to_state)', constraint_name)
+ end
+
+ def down
+ remove_check_constraint(:vulnerability_state_transitions, constraint_name)
+ end
+
+ private
+
+ def constraint_name
+ check_constraint_name('vulnerability_state_transitions', 'fully_qualified_table_name', 'state_not_equal')
+ end
+end
diff --git a/db/post_migrate/20221025220607_add_index_id_on_scan_finding_approval_merge_request_rules.rb b/db/post_migrate/20221025220607_add_index_id_on_scan_finding_approval_merge_request_rules.rb
new file mode 100644
index 00000000000..4e72e7f95ec
--- /dev/null
+++ b/db/post_migrate/20221025220607_add_index_id_on_scan_finding_approval_merge_request_rules.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexIdOnScanFindingApprovalMergeRequestRules < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'scan_finding_approval_mr_rule_index_id'
+ SCAN_FINDING_REPORT_TYPE = 4
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :approval_merge_request_rules, :id,
+ where: "report_type = #{SCAN_FINDING_REPORT_TYPE}", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :approval_merge_request_rules, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221027203556_delete_experiment_user_foreign_keys.rb b/db/post_migrate/20221027203556_delete_experiment_user_foreign_keys.rb
new file mode 100644
index 00000000000..564dc3d4899
--- /dev/null
+++ b/db/post_migrate/20221027203556_delete_experiment_user_foreign_keys.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class DeleteExperimentUserForeignKeys < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists :experiment_users, :experiments, name: 'fk_rails_56d4708b4a'
+ end
+
+ with_lock_retries do
+ remove_foreign_key_if_exists :experiment_users, :users, name: 'fk_rails_fd805f771a'
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key :experiment_users, :experiments, column: :experiment_id, name: 'fk_rails_56d4708b4a'
+ add_concurrent_foreign_key :experiment_users, :users, column: :user_id, name: 'fk_rails_fd805f771a'
+ end
+end
diff --git a/db/post_migrate/20221027203951_drop_experiment_users_table.rb b/db/post_migrate/20221027203951_drop_experiment_users_table.rb
new file mode 100644
index 00000000000..95455db98e5
--- /dev/null
+++ b/db/post_migrate/20221027203951_drop_experiment_users_table.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class DropExperimentUsersTable < Gitlab::Database::Migration[2.0]
+ def up
+ drop_table :experiment_users
+ end
+
+ def down
+ create_table :experiment_users do |t| # rubocop:disable Migration/SchemaAdditionMethodsNoPost
+ t.bigint :experiment_id, null: false
+ t.bigint :user_id, null: false
+ t.integer :group_type, limit: 2, null: false, default: 0
+ t.timestamps_with_timezone null: false
+ t.datetime_with_timezone :converted_at
+ t.jsonb :context, null: false, default: {}
+ end
+
+ add_index :experiment_users, :experiment_id
+ add_index :experiment_users, :user_id
+ end
+end
diff --git a/db/post_migrate/20221028000041_remove_invalid_partial_trigram_indexes_for_issues.rb b/db/post_migrate/20221028000041_remove_invalid_partial_trigram_indexes_for_issues.rb
new file mode 100644
index 00000000000..9b46647047a
--- /dev/null
+++ b/db/post_migrate/20221028000041_remove_invalid_partial_trigram_indexes_for_issues.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class RemoveInvalidPartialTrigramIndexesForIssues < 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; end
+end
diff --git a/db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb b/db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb
new file mode 100644
index 00000000000..199a7a22d5b
--- /dev/null
+++ b/db/post_migrate/20221028000603_prepare_partial_trigram_indexes_for_issues_attempt_3.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class PreparePartialTrigramIndexesForIssuesAttempt3 < 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 :issues, :title,
+ name: TITLE_INDEX_NAME,
+ using: :gin, opclass: { description: :gin_trgm_ops },
+ where: "title NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*' " \
+ "OR description NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*'"
+
+ prepare_async_index :issues, :description,
+ name: DESCRIPTION_INDEX_NAME,
+ using: :gin, opclass: { description: :gin_trgm_ops },
+ where: "title NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*' " \
+ "OR description NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*'"
+ 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/20221028022627_add_index_on_password_last_changed_at_to_user_details.rb b/db/post_migrate/20221028022627_add_index_on_password_last_changed_at_to_user_details.rb
new file mode 100644
index 00000000000..8314767ade1
--- /dev/null
+++ b/db/post_migrate/20221028022627_add_index_on_password_last_changed_at_to_user_details.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddIndexOnPasswordLastChangedAtToUserDetails < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'index_user_details_on_password_last_changed_at'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :user_details, :password_last_changed_at, name: INDEX_NAME, comment: 'JiHu-specific index'
+ end
+
+ def down
+ remove_concurrent_index_by_name :user_details, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221102090940_create_next_ci_partitions_record.rb b/db/post_migrate/20221102090940_create_next_ci_partitions_record.rb
new file mode 100644
index 00000000000..4bd89a70daa
--- /dev/null
+++ b/db/post_migrate/20221102090940_create_next_ci_partitions_record.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class CreateNextCiPartitionsRecord < Gitlab::Database::Migration[2.0]
+ NEXT_PARTITION_ID = 101
+
+ disable_ddl_transaction!
+ restrict_gitlab_migration gitlab_schema: :gitlab_ci
+
+ def up
+ return unless Gitlab.com?
+
+ execute(<<~SQL)
+ INSERT INTO "ci_partitions" ("id", "created_at", "updated_at")
+ VALUES (#{NEXT_PARTITION_ID}, now(), now())
+ ON CONFLICT DO NOTHING;
+ SQL
+
+ reset_pk_sequence!('ci_partitions')
+ end
+
+ def down
+ return unless Gitlab.com?
+
+ execute(<<~SQL)
+ DELETE FROM "ci_partitions"
+ WHERE "ci_partitions"."id" = #{NEXT_PARTITION_ID};
+ SQL
+ end
+end
diff --git a/db/post_migrate/20221102090943_create_second_partition_for_builds_metadata.rb b/db/post_migrate/20221102090943_create_second_partition_for_builds_metadata.rb
new file mode 100644
index 00000000000..6923e6f6cba
--- /dev/null
+++ b/db/post_migrate/20221102090943_create_second_partition_for_builds_metadata.rb
@@ -0,0 +1,62 @@
+# frozen_string_literal: true
+
+class CreateSecondPartitionForBuildsMetadata < Gitlab::Database::Migration[2.0]
+ TABLE_NAME = 'p_ci_builds_metadata'
+ BUILDS_TABLE = 'ci_builds'
+ NEXT_PARTITION_ID = 101
+ PARTITION_NAME = 'gitlab_partitions_dynamic.ci_builds_metadata_101'
+
+ disable_ddl_transaction!
+
+ def up
+ return unless Gitlab.com?
+
+ with_lock_retries(**lock_args) do
+ connection.execute(<<~SQL)
+ LOCK TABLE #{BUILDS_TABLE} IN SHARE UPDATE EXCLUSIVE MODE;
+ LOCK TABLE ONLY #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE;
+ SQL
+
+ connection.execute(<<~SQL)
+ CREATE TABLE IF NOT EXISTS #{PARTITION_NAME}
+ PARTITION OF #{TABLE_NAME}
+ FOR VALUES IN (#{NEXT_PARTITION_ID});
+ SQL
+ end
+ end
+
+ def down
+ return unless Gitlab.com?
+ return unless table_exists?(PARTITION_NAME)
+
+ with_lock_retries(**lock_args) do
+ connection.execute(<<~SQL)
+ LOCK TABLE #{BUILDS_TABLE}, #{TABLE_NAME}, #{PARTITION_NAME} IN ACCESS EXCLUSIVE MODE;
+ SQL
+
+ connection.execute(<<~SQL)
+ ALTER TABLE #{TABLE_NAME} DETACH PARTITION #{PARTITION_NAME};
+ SQL
+
+ connection.execute(<<~SQL)
+ DROP TABLE IF EXISTS #{PARTITION_NAME} CASCADE;
+ SQL
+ end
+ end
+
+ private
+
+ def lock_args
+ {
+ raise_on_exhaustion: true,
+ timing_configuration: lock_timing_configuration
+ }
+ end
+
+ def lock_timing_configuration
+ iterations = Gitlab::Database::WithLockRetries::DEFAULT_TIMING_CONFIGURATION
+ aggressive_iterations = Array.new(5) { [10.seconds, 1.minute] }
+
+ iterations + aggressive_iterations
+ end
+end
diff --git a/db/post_migrate/20221103073328_change_member_namespace_id_not_null.rb b/db/post_migrate/20221103073328_change_member_namespace_id_not_null.rb
new file mode 100644
index 00000000000..19f6732d297
--- /dev/null
+++ b/db/post_migrate/20221103073328_change_member_namespace_id_not_null.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+# See https://docs.gitlab.com/ee/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class ChangeMemberNamespaceIdNotNull < 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/post_migrate/20221103084213_remove_tmp_index_members_on_id_where_namespace_id_null.rb b/db/post_migrate/20221103084213_remove_tmp_index_members_on_id_where_namespace_id_null.rb
new file mode 100644
index 00000000000..07908e697f5
--- /dev/null
+++ b/db/post_migrate/20221103084213_remove_tmp_index_members_on_id_where_namespace_id_null.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class RemoveTmpIndexMembersOnIdWhereNamespaceIdNull < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'tmp_index_members_on_id_where_namespace_id_null'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :members, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :members, :id, name: INDEX_NAME, where: 'member_namespace_id IS NULL'
+ end
+end
diff --git a/db/post_migrate/20221103150250_migrate_sidekiq_queued_jobs.rb b/db/post_migrate/20221103150250_migrate_sidekiq_queued_jobs.rb
new file mode 100644
index 00000000000..1934711f9ef
--- /dev/null
+++ b/db/post_migrate/20221103150250_migrate_sidekiq_queued_jobs.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class MigrateSidekiqQueuedJobs < Gitlab::Database::Migration[2.0]
+ def up
+ # no-op because of https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/1991
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20221104042137_add_partial_trigram_index_for_issue_title_attempt_2.rb b/db/post_migrate/20221104042137_add_partial_trigram_index_for_issue_title_attempt_2.rb
new file mode 100644
index 00000000000..24204577959
--- /dev/null
+++ b/db/post_migrate/20221104042137_add_partial_trigram_index_for_issue_title_attempt_2.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddPartialTrigramIndexForIssueTitleAttempt2 < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_issues_on_title_trigram_non_latin'
+
+ def up
+ add_concurrent_index :issues, :title,
+ name: INDEX_NAME,
+ using: :gin, opclass: { description: :gin_trgm_ops },
+ where: "title NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*' " \
+ "OR description NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*'"
+ end
+
+ def down
+ remove_concurrent_index_by_name :issues, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221104042159_add_partial_trigram_index_for_issue_description_attempt_2.rb b/db/post_migrate/20221104042159_add_partial_trigram_index_for_issue_description_attempt_2.rb
new file mode 100644
index 00000000000..36b595d1067
--- /dev/null
+++ b/db/post_migrate/20221104042159_add_partial_trigram_index_for_issue_description_attempt_2.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddPartialTrigramIndexForIssueDescriptionAttempt2 < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_issues_on_description_trigram_non_latin'
+
+ def up
+ add_concurrent_index :issues, :description,
+ name: INDEX_NAME,
+ using: :gin, opclass: { description: :gin_trgm_ops },
+ where: "title NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*' " \
+ "OR description NOT SIMILAR TO '[\\u0000-\\u02FF\\u1E00-\\u1EFF\\u2070-\\u218F]*'"
+ end
+
+ def down
+ remove_concurrent_index_by_name :issues, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221104074652_add_temp_index_for_project_statistics_upload_size_migration.rb b/db/post_migrate/20221104074652_add_temp_index_for_project_statistics_upload_size_migration.rb
new file mode 100644
index 00000000000..b6ee636fa9b
--- /dev/null
+++ b/db/post_migrate/20221104074652_add_temp_index_for_project_statistics_upload_size_migration.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddTempIndexForProjectStatisticsUploadSizeMigration < Gitlab::Database::Migration[2.0]
+ INDEX_PROJECT_STATSISTICS_UPLOADS_SIZE = 'tmp_index_project_statistics_uploads_size'
+
+ disable_ddl_transaction!
+
+ def up
+ # Temporary index is to be used to trigger refresh for all project_statistics with
+ # upload_size <> 0
+ add_concurrent_index :project_statistics, [:project_id],
+ name: INDEX_PROJECT_STATSISTICS_UPLOADS_SIZE,
+ where: "uploads_size <> 0"
+ end
+
+ def down
+ remove_concurrent_index_by_name :project_statistics, INDEX_PROJECT_STATSISTICS_UPLOADS_SIZE
+ end
+end
diff --git a/db/post_migrate/20221104100203_recreate_async_trigram_index_for_vulnerability_reads_container_images.rb b/db/post_migrate/20221104100203_recreate_async_trigram_index_for_vulnerability_reads_container_images.rb
new file mode 100644
index 00000000000..ea2914f4dc4
--- /dev/null
+++ b/db/post_migrate/20221104100203_recreate_async_trigram_index_for_vulnerability_reads_container_images.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class RecreateAsyncTrigramIndexForVulnerabilityReadsContainerImages < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_vulnerability_reads_on_location_image_trigram'
+ REPORT_TYPES = { container_scanning: 2, cluster_image_scanning: 7 }.freeze
+
+ def up
+ remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME
+
+ prepare_async_index :vulnerability_reads, :location_image,
+ name: INDEX_NAME,
+ using: :gin, opclass: { location_image: :gin_trgm_ops },
+ where: "report_type = ANY (ARRAY[#{REPORT_TYPES.values.join(', ')}]) AND location_image IS NOT NULL"
+ end
+
+ def down
+ unprepare_async_index :vulnerability_reads, :location_image, name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221104170500_add_vulnerability_reads_all_status_index.rb b/db/post_migrate/20221104170500_add_vulnerability_reads_all_status_index.rb
new file mode 100644
index 00000000000..1dc1921ebaa
--- /dev/null
+++ b/db/post_migrate/20221104170500_add_vulnerability_reads_all_status_index.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+class AddVulnerabilityReadsAllStatusIndex < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = 'index_vulnerability_reads_on_namespace_type_severity_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :vulnerability_reads, %i[namespace_id report_type severity vulnerability_id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20221104190203_validate_environment_id_on_deployments.rb b/db/post_migrate/20221104190203_validate_environment_id_on_deployments.rb
new file mode 100644
index 00000000000..9546daa3975
--- /dev/null
+++ b/db/post_migrate/20221104190203_validate_environment_id_on_deployments.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class ValidateEnvironmentIdOnDeployments < Gitlab::Database::Migration[2.0]
+ def up
+ validate_foreign_key :deployments, :environment_id
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20221107094359_recount_epic_cache_counts.rb b/db/post_migrate/20221107094359_recount_epic_cache_counts.rb
new file mode 100644
index 00000000000..37ab952edba
--- /dev/null
+++ b/db/post_migrate/20221107094359_recount_epic_cache_counts.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class RecountEpicCacheCounts < Gitlab::Database::Migration[2.0]
+ MIGRATION = 'RecountEpicCacheCounts'
+ DELAY_INTERVAL = 2.minutes.to_i
+ BATCH_SIZE = 200
+ MAX_BATCH_SIZE = 1000
+ SUB_BATCH_SIZE = 20
+
+ disable_ddl_transaction!
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :epics,
+ :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, :epics, :id, [])
+ end
+end
diff --git a/db/post_migrate/20221107184758_sync_new_amount_used_for_ci_namespace_monthly_usages.rb b/db/post_migrate/20221107184758_sync_new_amount_used_for_ci_namespace_monthly_usages.rb
new file mode 100644
index 00000000000..9a6014b5c94
--- /dev/null
+++ b/db/post_migrate/20221107184758_sync_new_amount_used_for_ci_namespace_monthly_usages.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class SyncNewAmountUsedForCiNamespaceMonthlyUsages < Gitlab::Database::Migration[2.0]
+ restrict_gitlab_migration gitlab_schema: :gitlab_ci
+
+ def up
+ namespace_usages = define_batchable_model('ci_namespace_monthly_usages')
+
+ namespace_usages.each_batch(of: 500) do |batch|
+ batch.where('amount_used > 0').update_all('new_amount_used = amount_used')
+ end
+ end
+
+ def down
+ # Non reversible migration.
+ # This data migration keeps `new_amount_used` in sync with the old `amount_used`.
+ # In case of failure or interruption the migration can be retried.
+ end
+end
diff --git a/db/post_migrate/20221107220420_validate_not_null_constraint_on_member_namespace_id.rb b/db/post_migrate/20221107220420_validate_not_null_constraint_on_member_namespace_id.rb
new file mode 100644
index 00000000000..48da0c1fd09
--- /dev/null
+++ b/db/post_migrate/20221107220420_validate_not_null_constraint_on_member_namespace_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class ValidateNotNullConstraintOnMemberNamespaceId < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ CONSTRAINT_NAME = 'check_508774aac0'
+
+ def up
+ validate_not_null_constraint :members, :member_namespace_id, constraint_name: CONSTRAINT_NAME
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20221107220526_validate_fk_member_namespace_id.rb b/db/post_migrate/20221107220526_validate_fk_member_namespace_id.rb
new file mode 100644
index 00000000000..f78dc5a36fd
--- /dev/null
+++ b/db/post_migrate/20221107220526_validate_fk_member_namespace_id.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class ValidateFkMemberNamespaceId < Gitlab::Database::Migration[2.0]
+ CONSTRAINT_NAME = 'fk_2f85abf8f1'
+
+ def up
+ validate_foreign_key :members, :member_namespace_id, name: CONSTRAINT_NAME
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20221107222213_remove_old_member_namespace_id_fk.rb b/db/post_migrate/20221107222213_remove_old_member_namespace_id_fk.rb
new file mode 100644
index 00000000000..d46fa80336e
--- /dev/null
+++ b/db/post_migrate/20221107222213_remove_old_member_namespace_id_fk.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class RemoveOldMemberNamespaceIdFk < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ TARGET_COLUMN = :member_namespace_id
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(:members, column: TARGET_COLUMN, name: fk_name(TARGET_COLUMN))
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(
+ :members,
+ :namespaces,
+ column: TARGET_COLUMN,
+ name: fk_name(TARGET_COLUMN),
+ on_delete: :nullify
+ )
+ end
+
+ def fk_name(column_name)
+ # generate a FK name
+ concurrent_foreign_key_name(:members, column_name)
+ end
+end
diff --git a/db/post_migrate/20221108045019_truncate_timeline_event_tags_table.rb b/db/post_migrate/20221108045019_truncate_timeline_event_tags_table.rb
new file mode 100644
index 00000000000..37e6a21abed
--- /dev/null
+++ b/db/post_migrate/20221108045019_truncate_timeline_event_tags_table.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class TruncateTimelineEventTagsTable < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ def up
+ execute('TRUNCATE TABLE incident_management_timeline_event_tags, incident_management_timeline_event_tag_links')
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20221108121322_add_supporting_index_for_vulnerabilities_feedback_migration.rb b/db/post_migrate/20221108121322_add_supporting_index_for_vulnerabilities_feedback_migration.rb
new file mode 100644
index 00000000000..c77930512d2
--- /dev/null
+++ b/db/post_migrate/20221108121322_add_supporting_index_for_vulnerabilities_feedback_migration.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddSupportingIndexForVulnerabilitiesFeedbackMigration < Gitlab::Database::Migration[2.0]
+ INDEX_NAME = "tmp_idx_for_vulnerability_feedback_migration"
+ WHERE_CLAUSE = "migrated_to_state_transition = false AND feedback_type = 0"
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(
+ :vulnerability_feedback,
+ %i[migrated_to_state_transition feedback_type],
+ where: WHERE_CLAUSE,
+ name: INDEX_NAME
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name(
+ :vulnerability_feedback,
+ INDEX_NAME
+ )
+ end
+end
diff --git a/db/post_migrate/20221108222015_remove_temp_index_on_project_features_where_releases_access_level_gt_repository.rb b/db/post_migrate/20221108222015_remove_temp_index_on_project_features_where_releases_access_level_gt_repository.rb
new file mode 100644
index 00000000000..e7cc6786b4b
--- /dev/null
+++ b/db/post_migrate/20221108222015_remove_temp_index_on_project_features_where_releases_access_level_gt_repository.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveTempIndexOnProjectFeaturesWhereReleasesAccessLevelGtRepository < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'tmp_idx_project_features_on_releases_al_and_repo_al_partial'
+
+ def up
+ remove_concurrent_index_by_name :project_features, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :project_features,
+ [:releases_access_level, :repository_access_level],
+ name: INDEX_NAME,
+ where: 'releases_access_level > repository_access_level'
+ end
+end
diff --git a/db/post_migrate/20221110045406_sanitize_confidential_note_todos.rb b/db/post_migrate/20221110045406_sanitize_confidential_note_todos.rb
new file mode 100644
index 00000000000..f98be3f036f
--- /dev/null
+++ b/db/post_migrate/20221110045406_sanitize_confidential_note_todos.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class SanitizeConfidentialNoteTodos < Gitlab::Database::Migration[2.0]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ MIGRATION = 'SanitizeConfidentialTodos'
+ DELAY_INTERVAL = 2.minutes.to_i
+ BATCH_SIZE = 200
+ MAX_BATCH_SIZE = 1000
+ SUB_BATCH_SIZE = 20
+
+ disable_ddl_transaction!
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :notes,
+ :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, :notes, :id, [])
+ end
+end
diff --git a/db/post_migrate/20221111070314_prepare_removal_of_issue_trigram_indexes.rb b/db/post_migrate/20221111070314_prepare_removal_of_issue_trigram_indexes.rb
new file mode 100644
index 00000000000..c4cae19497e
--- /dev/null
+++ b/db/post_migrate/20221111070314_prepare_removal_of_issue_trigram_indexes.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class PrepareRemovalOfIssueTrigramIndexes < Gitlab::Database::Migration[2.0]
+ TITLE_INDEX_NAME = 'index_issues_on_title_trigram'
+ DESCRIPTION_INDEX_NAME = 'index_issues_on_description_trigram'
+
+ 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/schema_migrations/20220613112029 b/db/schema_migrations/20220613112029
new file mode 100644
index 00000000000..d0bb2de83b5
--- /dev/null
+++ b/db/schema_migrations/20220613112029
@@ -0,0 +1 @@
+04a04a34de63b17f02a6b1333854638ae3b44d284e5ce2fcbee6fb3ec06b7757 \ No newline at end of file
diff --git a/db/schema_migrations/20220613112030 b/db/schema_migrations/20220613112030
new file mode 100644
index 00000000000..3dda586034d
--- /dev/null
+++ b/db/schema_migrations/20220613112030
@@ -0,0 +1 @@
+3d1b1394aa1b5db83867b284f119ec711255d2a01b78720d42c0a1acfe93c94f \ No newline at end of file
diff --git a/db/schema_migrations/20220613112031 b/db/schema_migrations/20220613112031
new file mode 100644
index 00000000000..dc0d913e1eb
--- /dev/null
+++ b/db/schema_migrations/20220613112031
@@ -0,0 +1 @@
+30d48cf8219cb4bcfeac454d7baf70d05f0285bdac519e4a1fb9f1c412267a9d \ No newline at end of file
diff --git a/db/schema_migrations/20220613112032 b/db/schema_migrations/20220613112032
new file mode 100644
index 00000000000..f1c0d9c80e6
--- /dev/null
+++ b/db/schema_migrations/20220613112032
@@ -0,0 +1 @@
+c8c26dad8d11b3715fce07ee9bedc9c4f66d2454646d58994e1568758f240299 \ No newline at end of file
diff --git a/db/schema_migrations/20220721065723 b/db/schema_migrations/20220721065723
new file mode 100644
index 00000000000..78b1fedaff1
--- /dev/null
+++ b/db/schema_migrations/20220721065723
@@ -0,0 +1 @@
+5e3fbb2c033f8512e5fd14b8ce8c6088866c596a2b769e115dcc1feb9ce9d041 \ No newline at end of file
diff --git a/db/schema_migrations/20220919062640 b/db/schema_migrations/20220919062640
new file mode 100644
index 00000000000..0284cadd6d6
--- /dev/null
+++ b/db/schema_migrations/20220919062640
@@ -0,0 +1 @@
+6b4e0ed9d29ace12f6ae1d4b8177ef998f9a5a3915cca80fa546a9f90ccde887 \ No newline at end of file
diff --git a/db/schema_migrations/20220919080303 b/db/schema_migrations/20220919080303
new file mode 100644
index 00000000000..081e25c4ed5
--- /dev/null
+++ b/db/schema_migrations/20220919080303
@@ -0,0 +1 @@
+9a5ba202075e0022defd834184aa59c60980cdccf7f4111834af6a119713b4c2 \ No newline at end of file
diff --git a/db/schema_migrations/20220919080304 b/db/schema_migrations/20220919080304
new file mode 100644
index 00000000000..263128018ca
--- /dev/null
+++ b/db/schema_migrations/20220919080304
@@ -0,0 +1 @@
+d5883d3edad5d8cc130f26feb4cc6fdb63e3b46c513ce463bdf7e45a8d7ffcdf \ No newline at end of file
diff --git a/db/schema_migrations/20220920135632 b/db/schema_migrations/20220920135632
new file mode 100644
index 00000000000..b20c7886bf9
--- /dev/null
+++ b/db/schema_migrations/20220920135632
@@ -0,0 +1 @@
+ec4d492f229e78a8f0efd8691a0a3f04d5f8125d8e1c7d0f93b45faa034108f7 \ No newline at end of file
diff --git a/db/schema_migrations/20220920135717 b/db/schema_migrations/20220920135717
new file mode 100644
index 00000000000..7e64f02956c
--- /dev/null
+++ b/db/schema_migrations/20220920135717
@@ -0,0 +1 @@
+06c73930dcc4ce0edfe5fa57ff721b6799f6458ff68f3c37c0eaf1745c8db1f1 \ No newline at end of file
diff --git a/db/schema_migrations/20220926023734 b/db/schema_migrations/20220926023734
new file mode 100644
index 00000000000..2fd1175b02d
--- /dev/null
+++ b/db/schema_migrations/20220926023734
@@ -0,0 +1 @@
+efa3d1c94b5de9c68ae3d007e95bbbae9582f4354e922b00a02ff5753dbe4d05 \ No newline at end of file
diff --git a/db/schema_migrations/20220927171740 b/db/schema_migrations/20220927171740
new file mode 100644
index 00000000000..e775b211200
--- /dev/null
+++ b/db/schema_migrations/20220927171740
@@ -0,0 +1 @@
+5ba49d525d6238975f990c94972ee4f3587a2446a4873e6e8a7f4791cf015b7e \ No newline at end of file
diff --git a/db/schema_migrations/20221003151747 b/db/schema_migrations/20221003151747
new file mode 100644
index 00000000000..70a8babf308
--- /dev/null
+++ b/db/schema_migrations/20221003151747
@@ -0,0 +1 @@
+84b89419404d26f7d2783a3adf1fa7b7d89417d6533b393ae6e0de40a31e299a \ No newline at end of file
diff --git a/db/schema_migrations/20221004074910 b/db/schema_migrations/20221004074910
new file mode 100644
index 00000000000..e316408ef0f
--- /dev/null
+++ b/db/schema_migrations/20221004074910
@@ -0,0 +1 @@
+df8b2f83f93fecd3450cb7fc2619e7ddbfde014a885d0a414076908bbcbbdf9f \ No newline at end of file
diff --git a/db/schema_migrations/20221004074914 b/db/schema_migrations/20221004074914
new file mode 100644
index 00000000000..a197fe1b9ea
--- /dev/null
+++ b/db/schema_migrations/20221004074914
@@ -0,0 +1 @@
+d6459263b828e6807f473adb7ba534d78055ab1b5137478a8e96cd500297ff54 \ No newline at end of file
diff --git a/db/schema_migrations/20221006070927 b/db/schema_migrations/20221006070927
new file mode 100644
index 00000000000..804f77384e0
--- /dev/null
+++ b/db/schema_migrations/20221006070927
@@ -0,0 +1 @@
+933cb5a869696f2343b0b8dfc32f94a64ed7a5119c3f6b2b64ce30e3ae4e555c \ No newline at end of file
diff --git a/db/schema_migrations/20221010103207 b/db/schema_migrations/20221010103207
new file mode 100644
index 00000000000..24fcfc34c41
--- /dev/null
+++ b/db/schema_migrations/20221010103207
@@ -0,0 +1 @@
+04997da3ff51b8be05fd765c6534f92a15eea0a4ee4a535f1cb84c6da4e1bdd5 \ No newline at end of file
diff --git a/db/schema_migrations/20221010141500 b/db/schema_migrations/20221010141500
new file mode 100644
index 00000000000..8479fb0519c
--- /dev/null
+++ b/db/schema_migrations/20221010141500
@@ -0,0 +1 @@
+250ec3ff701dacd333d669f128762e9f035a626f2f7720c6e7e1dc61499d431d \ No newline at end of file
diff --git a/db/schema_migrations/20221010162137 b/db/schema_migrations/20221010162137
new file mode 100644
index 00000000000..567b788a5c6
--- /dev/null
+++ b/db/schema_migrations/20221010162137
@@ -0,0 +1 @@
+c9f5827072920fdc52efeaf1ab39c67c48896a6288c5720e4be96070340ce6d8 \ No newline at end of file
diff --git a/db/schema_migrations/20221010184839 b/db/schema_migrations/20221010184839
new file mode 100644
index 00000000000..de24fc0a4f0
--- /dev/null
+++ b/db/schema_migrations/20221010184839
@@ -0,0 +1 @@
+062f807c0bf823b00e19cc55323faedd506b19d6492d1f23f09aaa662eaddcfb \ No newline at end of file
diff --git a/db/schema_migrations/20221010201815 b/db/schema_migrations/20221010201815
new file mode 100644
index 00000000000..8c4c06ba4f6
--- /dev/null
+++ b/db/schema_migrations/20221010201815
@@ -0,0 +1 @@
+f1f30c3581e35a92f3ede694e1eb70c6fc4dccfdb9e377b5f9046e18eaca2c54 \ No newline at end of file
diff --git a/db/schema_migrations/20221010202339 b/db/schema_migrations/20221010202339
new file mode 100644
index 00000000000..c536fc8a3dc
--- /dev/null
+++ b/db/schema_migrations/20221010202339
@@ -0,0 +1 @@
+33bbeaa1d94cfa936de422fcc2f0456d235dde13072f6907cd514a12956ef9aa \ No newline at end of file
diff --git a/db/schema_migrations/20221010202408 b/db/schema_migrations/20221010202408
new file mode 100644
index 00000000000..2007c27f7fd
--- /dev/null
+++ b/db/schema_migrations/20221010202408
@@ -0,0 +1 @@
+0e985bac7558768e0b97316c1362cb411fed5605c0a313c3872e86f7242f8d36 \ No newline at end of file
diff --git a/db/schema_migrations/20221011062254 b/db/schema_migrations/20221011062254
new file mode 100644
index 00000000000..a64a2dd4bfe
--- /dev/null
+++ b/db/schema_migrations/20221011062254
@@ -0,0 +1 @@
+ae4f3c26acd69aa0c701651a246a1359c91a0daad0daad64ba8dc186268880a4 \ No newline at end of file
diff --git a/db/schema_migrations/20221013103738 b/db/schema_migrations/20221013103738
new file mode 100644
index 00000000000..8643304c5b1
--- /dev/null
+++ b/db/schema_migrations/20221013103738
@@ -0,0 +1 @@
+704d0973ce5fec01228a28d5551ecc88ccf057e246ee75f8f5b0cc0a08815095 \ No newline at end of file
diff --git a/db/schema_migrations/20221013215832 b/db/schema_migrations/20221013215832
new file mode 100644
index 00000000000..106cb540d6e
--- /dev/null
+++ b/db/schema_migrations/20221013215832
@@ -0,0 +1 @@
+2ab913b0b479fc29d939d03b5df95dc2a8c5a155f1b35a606e300802cb3aa9d3 \ No newline at end of file
diff --git a/db/schema_migrations/20221015000511 b/db/schema_migrations/20221015000511
new file mode 100644
index 00000000000..16845f8859c
--- /dev/null
+++ b/db/schema_migrations/20221015000511
@@ -0,0 +1 @@
+001b43cc0006b8f936310171ff2d12993eece1378f64945e6835728f540815ba \ No newline at end of file
diff --git a/db/schema_migrations/20221017084208 b/db/schema_migrations/20221017084208
new file mode 100644
index 00000000000..3fb09558549
--- /dev/null
+++ b/db/schema_migrations/20221017084208
@@ -0,0 +1 @@
+d28932a3d52279446e3ef84806a6bb6b53dc10c5b9ae81e2c626203da4238a9a \ No newline at end of file
diff --git a/db/schema_migrations/20221017084227 b/db/schema_migrations/20221017084227
new file mode 100644
index 00000000000..9f57ca08267
--- /dev/null
+++ b/db/schema_migrations/20221017084227
@@ -0,0 +1 @@
+dc03ff5c63ada744d41e5e37e276306b1fe3bb2d8f925ebb0087be3a4b51791e \ No newline at end of file
diff --git a/db/schema_migrations/20221018050323 b/db/schema_migrations/20221018050323
new file mode 100644
index 00000000000..3e1d102da64
--- /dev/null
+++ b/db/schema_migrations/20221018050323
@@ -0,0 +1 @@
+05754025966b87f6998a0801e76c811b0cd42b2a77f35e8129a0c47f935e9bc4 \ No newline at end of file
diff --git a/db/schema_migrations/20221018062308 b/db/schema_migrations/20221018062308
new file mode 100644
index 00000000000..1b408ed101a
--- /dev/null
+++ b/db/schema_migrations/20221018062308
@@ -0,0 +1 @@
+58aec3260f2b26d5a49159b95de7c6486b16c8af354f716190d4c48f83324910 \ No newline at end of file
diff --git a/db/schema_migrations/20221018092552 b/db/schema_migrations/20221018092552
new file mode 100644
index 00000000000..8416f7d72a3
--- /dev/null
+++ b/db/schema_migrations/20221018092552
@@ -0,0 +1 @@
+d7ec9ab32c5f58805bec64bea9bd32aedbd80f678d6b8e8c6914aa26523dcc95 \ No newline at end of file
diff --git a/db/schema_migrations/20221018124029 b/db/schema_migrations/20221018124029
new file mode 100644
index 00000000000..6c050ebf248
--- /dev/null
+++ b/db/schema_migrations/20221018124029
@@ -0,0 +1 @@
+c3a38f280c8835e77953b69ba41ef5d58b76fd5f2f39e758a523c493306b0ab2 \ No newline at end of file
diff --git a/db/schema_migrations/20221018124035 b/db/schema_migrations/20221018124035
new file mode 100644
index 00000000000..1d0721c4bfb
--- /dev/null
+++ b/db/schema_migrations/20221018124035
@@ -0,0 +1 @@
+77aca033a7c58af4e981136b96629acf5b82a42701072928532681dd91b05280 \ No newline at end of file
diff --git a/db/schema_migrations/20221018193635 b/db/schema_migrations/20221018193635
new file mode 100644
index 00000000000..e29e4605d5b
--- /dev/null
+++ b/db/schema_migrations/20221018193635
@@ -0,0 +1 @@
+de28d291a4a49dcb1743466ce61d95e47c28bdf293731e446b7b43d370d76e36 \ No newline at end of file
diff --git a/db/schema_migrations/20221018193827 b/db/schema_migrations/20221018193827
new file mode 100644
index 00000000000..26753827185
--- /dev/null
+++ b/db/schema_migrations/20221018193827
@@ -0,0 +1 @@
+fb64884e988fb0f3589fd189780f3ac5358d06b7599243935f1d4c3dd7e794fc \ No newline at end of file
diff --git a/db/schema_migrations/20221018202524 b/db/schema_migrations/20221018202524
new file mode 100644
index 00000000000..ee738f3608c
--- /dev/null
+++ b/db/schema_migrations/20221018202524
@@ -0,0 +1 @@
+a3266078f4760f0f5a4c7a43669cea1170924f29d6867e712620c2234dbf13c6 \ No newline at end of file
diff --git a/db/schema_migrations/20221018232820 b/db/schema_migrations/20221018232820
new file mode 100644
index 00000000000..870de8adb4a
--- /dev/null
+++ b/db/schema_migrations/20221018232820
@@ -0,0 +1 @@
+cdf3e65f07f700617f47435b79743b4b35307f47cf46a9696350e55af1774d42 \ No newline at end of file
diff --git a/db/schema_migrations/20221019002459 b/db/schema_migrations/20221019002459
new file mode 100644
index 00000000000..cab21003736
--- /dev/null
+++ b/db/schema_migrations/20221019002459
@@ -0,0 +1 @@
+6c3fe5bf01ac9e74f142ddb3e093867b62cf430f24ba885f8475ccf7f73899cb \ No newline at end of file
diff --git a/db/schema_migrations/20221019102426 b/db/schema_migrations/20221019102426
new file mode 100644
index 00000000000..482f7ab0980
--- /dev/null
+++ b/db/schema_migrations/20221019102426
@@ -0,0 +1 @@
+6990eb33313f6c0a82409fde69c74a88d0a9db2cd144322bcff4428261bbf1e4 \ No newline at end of file
diff --git a/db/schema_migrations/20221019105041 b/db/schema_migrations/20221019105041
new file mode 100644
index 00000000000..0dff355b300
--- /dev/null
+++ b/db/schema_migrations/20221019105041
@@ -0,0 +1 @@
+186e7df4e7e81913981595a069c5c8b5fbb600ee5dcebf333bfff728c5019ab2 \ No newline at end of file
diff --git a/db/schema_migrations/20221019141508 b/db/schema_migrations/20221019141508
new file mode 100644
index 00000000000..2b4ecc805e4
--- /dev/null
+++ b/db/schema_migrations/20221019141508
@@ -0,0 +1 @@
+527b18e3bd89316c33b099d4e3cd622617b6e8dbb482a0f0ce983386b0210f7e \ No newline at end of file
diff --git a/db/schema_migrations/20221019194751 b/db/schema_migrations/20221019194751
new file mode 100644
index 00000000000..e917d4ac1f6
--- /dev/null
+++ b/db/schema_migrations/20221019194751
@@ -0,0 +1 @@
+785ed2a3c711edf54f1b23bdbd4b333b7a4ee02b86f8581c1f4cc20003e5f832 \ No newline at end of file
diff --git a/db/schema_migrations/20221019195754 b/db/schema_migrations/20221019195754
new file mode 100644
index 00000000000..2be5ca3ce1a
--- /dev/null
+++ b/db/schema_migrations/20221019195754
@@ -0,0 +1 @@
+b09530d7b72d70774624ef44683be6665bd1141be49db551a0dfe303ce67eefa \ No newline at end of file
diff --git a/db/schema_migrations/20221019200033 b/db/schema_migrations/20221019200033
new file mode 100644
index 00000000000..2826a18d7df
--- /dev/null
+++ b/db/schema_migrations/20221019200033
@@ -0,0 +1 @@
+a72855a95f243d2a404d840fde900a99b9f568144dfde47e813c4e9bc81ef8cf \ No newline at end of file
diff --git a/db/schema_migrations/20221019200206 b/db/schema_migrations/20221019200206
new file mode 100644
index 00000000000..73eb8571a5a
--- /dev/null
+++ b/db/schema_migrations/20221019200206
@@ -0,0 +1 @@
+1bd5d356d0a15737178eee70bce65c9883bd5daa2a672a9049ccecb4e73f431b \ No newline at end of file
diff --git a/db/schema_migrations/20221020124018 b/db/schema_migrations/20221020124018
new file mode 100644
index 00000000000..6f6c76eb531
--- /dev/null
+++ b/db/schema_migrations/20221020124018
@@ -0,0 +1 @@
+c4b296345f45b6184e04181708eb2f55a1b3a621f331b75173b33b0036c3176f \ No newline at end of file
diff --git a/db/schema_migrations/20221021082255 b/db/schema_migrations/20221021082255
new file mode 100644
index 00000000000..afb266271d4
--- /dev/null
+++ b/db/schema_migrations/20221021082255
@@ -0,0 +1 @@
+10caa548bccc134775ed14f85eae2b2063e83afe4a932982c353ecf1549a557d \ No newline at end of file
diff --git a/db/schema_migrations/20221021082312 b/db/schema_migrations/20221021082312
new file mode 100644
index 00000000000..26007002f54
--- /dev/null
+++ b/db/schema_migrations/20221021082312
@@ -0,0 +1 @@
+86d979a179c504508fd2e9c1a62e935884297054b13b78a4c1460679d75f5b96 \ No newline at end of file
diff --git a/db/schema_migrations/20221021082720 b/db/schema_migrations/20221021082720
new file mode 100644
index 00000000000..b3591da1021
--- /dev/null
+++ b/db/schema_migrations/20221021082720
@@ -0,0 +1 @@
+a9122e3772587b85a889740ccc54d48b6ead91a3b472d712e1e8bf5946655cf4 \ No newline at end of file
diff --git a/db/schema_migrations/20221021082734 b/db/schema_migrations/20221021082734
new file mode 100644
index 00000000000..6fc0aaa3fca
--- /dev/null
+++ b/db/schema_migrations/20221021082734
@@ -0,0 +1 @@
+d7c109cba935e1f355789dffa1d64b29b787f44ced7b0d3090e19a2dd0b8e266 \ No newline at end of file
diff --git a/db/schema_migrations/20221021145820 b/db/schema_migrations/20221021145820
new file mode 100644
index 00000000000..e3d50c654ba
--- /dev/null
+++ b/db/schema_migrations/20221021145820
@@ -0,0 +1 @@
+e9fd4d60833624e20fcf9b01b883dca15e6c135aa99f1afd1c7a365eebac17fb \ No newline at end of file
diff --git a/db/schema_migrations/20221021160735 b/db/schema_migrations/20221021160735
new file mode 100644
index 00000000000..73c10f7e23d
--- /dev/null
+++ b/db/schema_migrations/20221021160735
@@ -0,0 +1 @@
+0b7727e942f6e3fa2e1b0ed9e22c504a64aceac19adf25f126baba587db4b764 \ No newline at end of file
diff --git a/db/schema_migrations/20221021213216 b/db/schema_migrations/20221021213216
new file mode 100644
index 00000000000..900a4f6701e
--- /dev/null
+++ b/db/schema_migrations/20221021213216
@@ -0,0 +1 @@
+defe6e66c98648ea7fb77d8001392bc707ec022f639d346c42d23fad10958856 \ No newline at end of file
diff --git a/db/schema_migrations/20221022213505 b/db/schema_migrations/20221022213505
new file mode 100644
index 00000000000..4cf0b87eedf
--- /dev/null
+++ b/db/schema_migrations/20221022213505
@@ -0,0 +1 @@
+c48015b2ff6ad4b58bffaf5342247d890f6bd2388c467751654bc705f5eb53ed \ No newline at end of file
diff --git a/db/schema_migrations/20221022213521 b/db/schema_migrations/20221022213521
new file mode 100644
index 00000000000..c3bb483debf
--- /dev/null
+++ b/db/schema_migrations/20221022213521
@@ -0,0 +1 @@
+739952c72f82b804b84d73107264804202ad102b425008d4dcb029c1f02e2118 \ No newline at end of file
diff --git a/db/schema_migrations/20221024034228 b/db/schema_migrations/20221024034228
new file mode 100644
index 00000000000..3df637a8198
--- /dev/null
+++ b/db/schema_migrations/20221024034228
@@ -0,0 +1 @@
+7f83a1d04357f4f2e1e4ed92e0d9b0041f79d1850b28f41cee45d243e25741f0 \ No newline at end of file
diff --git a/db/schema_migrations/20221024121500 b/db/schema_migrations/20221024121500
new file mode 100644
index 00000000000..6db609001ad
--- /dev/null
+++ b/db/schema_migrations/20221024121500
@@ -0,0 +1 @@
+8449de1e73e2fb46698e0e160641c4132b99918792b0b3379d6009bab9eab0b7 \ No newline at end of file
diff --git a/db/schema_migrations/20221025043930 b/db/schema_migrations/20221025043930
new file mode 100644
index 00000000000..37365baea27
--- /dev/null
+++ b/db/schema_migrations/20221025043930
@@ -0,0 +1 @@
+6762034e2dff9d6e6d146f1ce3b281f8886895b056c5ed54767ceb0d6c18bd59 \ No newline at end of file
diff --git a/db/schema_migrations/20221025105205 b/db/schema_migrations/20221025105205
new file mode 100644
index 00000000000..4003f74aa11
--- /dev/null
+++ b/db/schema_migrations/20221025105205
@@ -0,0 +1 @@
+80daa2f50ae9f8c0dee206ed9d45eb04884e14a0331475cb8c9a2d57f4c86ef5 \ No newline at end of file
diff --git a/db/schema_migrations/20221025115006 b/db/schema_migrations/20221025115006
new file mode 100644
index 00000000000..d831d6aeec9
--- /dev/null
+++ b/db/schema_migrations/20221025115006
@@ -0,0 +1 @@
+1529e1b436b65ff7b787f43fc5b8de7515aebe427719d2e4e62e9a7f923e877b \ No newline at end of file
diff --git a/db/schema_migrations/20221025145452 b/db/schema_migrations/20221025145452
new file mode 100644
index 00000000000..df551b8bae6
--- /dev/null
+++ b/db/schema_migrations/20221025145452
@@ -0,0 +1 @@
+951ad9faf483d58778cd831a0ac949473d6eeb753322754eff3f02756d757583 \ No newline at end of file
diff --git a/db/schema_migrations/20221025150202 b/db/schema_migrations/20221025150202
new file mode 100644
index 00000000000..aa6db23de6c
--- /dev/null
+++ b/db/schema_migrations/20221025150202
@@ -0,0 +1 @@
+2185444f733eec25a2741764619516eecb1d2c6e3e4ec3b3ed5b72bfd9c4db46 \ No newline at end of file
diff --git a/db/schema_migrations/20221025220607 b/db/schema_migrations/20221025220607
new file mode 100644
index 00000000000..30322b1ab3f
--- /dev/null
+++ b/db/schema_migrations/20221025220607
@@ -0,0 +1 @@
+d6eb5bb918f12c08f23c228916b7e21432e1e2958832c10be4e46dfa2079103d \ No newline at end of file
diff --git a/db/schema_migrations/20221027124848 b/db/schema_migrations/20221027124848
new file mode 100644
index 00000000000..249e4e4b83f
--- /dev/null
+++ b/db/schema_migrations/20221027124848
@@ -0,0 +1 @@
+108dec45cbed3651aec46636a3009cb18296d0fa0ca720774dc2105123955dfd \ No newline at end of file
diff --git a/db/schema_migrations/20221027203556 b/db/schema_migrations/20221027203556
new file mode 100644
index 00000000000..e386f0e6bbb
--- /dev/null
+++ b/db/schema_migrations/20221027203556
@@ -0,0 +1 @@
+9ea13068b90797013677ec390de4222e00e80076080cf4e5335e9f90e2e59f2d \ No newline at end of file
diff --git a/db/schema_migrations/20221027203951 b/db/schema_migrations/20221027203951
new file mode 100644
index 00000000000..866ccf8c208
--- /dev/null
+++ b/db/schema_migrations/20221027203951
@@ -0,0 +1 @@
+5f4fd4e64d398208e2d32573273a70106c9a4fd5ab350d75fcf7a6f4c824e00a \ No newline at end of file
diff --git a/db/schema_migrations/20221028000041 b/db/schema_migrations/20221028000041
new file mode 100644
index 00000000000..4160c4d26ed
--- /dev/null
+++ b/db/schema_migrations/20221028000041
@@ -0,0 +1 @@
+b2e38680afc264fadd5fbaa7d07c95c7ba6e1fb7a32bdff267e35a7d9bde72c8 \ No newline at end of file
diff --git a/db/schema_migrations/20221028000603 b/db/schema_migrations/20221028000603
new file mode 100644
index 00000000000..0dc60ae68eb
--- /dev/null
+++ b/db/schema_migrations/20221028000603
@@ -0,0 +1 @@
+aee0c708436ae365e2469b2bb5b508dcbf6975326faa90bd1571dd400312eded \ No newline at end of file
diff --git a/db/schema_migrations/20221028015347 b/db/schema_migrations/20221028015347
new file mode 100644
index 00000000000..ab633b763df
--- /dev/null
+++ b/db/schema_migrations/20221028015347
@@ -0,0 +1 @@
+7b86ae0739c4c381b050539261c67dbf3d4716edf0f0bde9b281cbdc5143a4d2 \ No newline at end of file
diff --git a/db/schema_migrations/20221028022627 b/db/schema_migrations/20221028022627
new file mode 100644
index 00000000000..34c365800a6
--- /dev/null
+++ b/db/schema_migrations/20221028022627
@@ -0,0 +1 @@
+0305d0fa4d95b0a1553c9ba7984af2cb74099988dbc9983e1048b54ead39a76e \ No newline at end of file
diff --git a/db/schema_migrations/20221028152422 b/db/schema_migrations/20221028152422
new file mode 100644
index 00000000000..bfe9807b1c6
--- /dev/null
+++ b/db/schema_migrations/20221028152422
@@ -0,0 +1 @@
+c9322bdc7e862bd20ec548fbcd3ec6a9ef4da6abc0a688d503e1792acc262472 \ No newline at end of file
diff --git a/db/schema_migrations/20221031102916 b/db/schema_migrations/20221031102916
new file mode 100644
index 00000000000..53f927cfc32
--- /dev/null
+++ b/db/schema_migrations/20221031102916
@@ -0,0 +1 @@
+e0065beaf2e1dc5e5850353244ba2c76477e855733f3683a1901a340a5826ae1 \ No newline at end of file
diff --git a/db/schema_migrations/20221101032521 b/db/schema_migrations/20221101032521
new file mode 100644
index 00000000000..995b034fa89
--- /dev/null
+++ b/db/schema_migrations/20221101032521
@@ -0,0 +1 @@
+db7e477626aa34154db2d6ff30bcafc7c70a2a9c3a719bfb7e7ac0a8e0d7e579 \ No newline at end of file
diff --git a/db/schema_migrations/20221101032600 b/db/schema_migrations/20221101032600
new file mode 100644
index 00000000000..2b060661657
--- /dev/null
+++ b/db/schema_migrations/20221101032600
@@ -0,0 +1 @@
+49449f2bb02e8dbe0cff73b6ac8dc291c00c7ce9c0d54bf7bb2b5cd9c599d713 \ No newline at end of file
diff --git a/db/schema_migrations/20221101195903 b/db/schema_migrations/20221101195903
new file mode 100644
index 00000000000..9b19cb05b66
--- /dev/null
+++ b/db/schema_migrations/20221101195903
@@ -0,0 +1 @@
+984a2bcc65364293cd110d3a917aecd37253f621150220000f99e8ea215e30ab \ No newline at end of file
diff --git a/db/schema_migrations/20221101201031 b/db/schema_migrations/20221101201031
new file mode 100644
index 00000000000..82544cf461d
--- /dev/null
+++ b/db/schema_migrations/20221101201031
@@ -0,0 +1 @@
+6ed6a3fdd144b118c7f85960d08500f21a7f666abfdaafc9d681e03723ed22e8 \ No newline at end of file
diff --git a/db/schema_migrations/20221102090940 b/db/schema_migrations/20221102090940
new file mode 100644
index 00000000000..c0ef7881688
--- /dev/null
+++ b/db/schema_migrations/20221102090940
@@ -0,0 +1 @@
+3be66e9f4239eb75f14118d1fd795f1a1bcd2d6bc4e34fe58a0c8422e33c893a \ No newline at end of file
diff --git a/db/schema_migrations/20221102090943 b/db/schema_migrations/20221102090943
new file mode 100644
index 00000000000..bc7ff679c6e
--- /dev/null
+++ b/db/schema_migrations/20221102090943
@@ -0,0 +1 @@
+8e907e086c4b23dd08163c4d946ec4a0202288f7da08eff565a159bccdd445f2 \ No newline at end of file
diff --git a/db/schema_migrations/20221102202130 b/db/schema_migrations/20221102202130
new file mode 100644
index 00000000000..82ee1088544
--- /dev/null
+++ b/db/schema_migrations/20221102202130
@@ -0,0 +1 @@
+76c2fe9422491d0bd457584580b383924b895574cec7e90cdfa5de9ed56a3639 \ No newline at end of file
diff --git a/db/schema_migrations/20221102225800 b/db/schema_migrations/20221102225800
new file mode 100644
index 00000000000..fca933ed91b
--- /dev/null
+++ b/db/schema_migrations/20221102225800
@@ -0,0 +1 @@
+2e7e55a23574d45e877712fb67b2c2b50d85905c95fe4ec3990cfd8fe5160122 \ No newline at end of file
diff --git a/db/schema_migrations/20221103073328 b/db/schema_migrations/20221103073328
new file mode 100644
index 00000000000..8a90e224a2f
--- /dev/null
+++ b/db/schema_migrations/20221103073328
@@ -0,0 +1 @@
+6f0ce1b68310b3194aa7b6219d79570e8179d449f49d828800f90f70d9242f38 \ No newline at end of file
diff --git a/db/schema_migrations/20221103084213 b/db/schema_migrations/20221103084213
new file mode 100644
index 00000000000..f9790952cf0
--- /dev/null
+++ b/db/schema_migrations/20221103084213
@@ -0,0 +1 @@
+90794c6a9b8b9e08e8b0898e55bc581b8411fd0e85a17fefa916213d82e98099 \ No newline at end of file
diff --git a/db/schema_migrations/20221103131409 b/db/schema_migrations/20221103131409
new file mode 100644
index 00000000000..88be59197a3
--- /dev/null
+++ b/db/schema_migrations/20221103131409
@@ -0,0 +1 @@
+cb301b88dc9b0f5bffd9d1a4419c5923e8145cb8770e576d88dc7881c1c9e39c \ No newline at end of file
diff --git a/db/schema_migrations/20221103150250 b/db/schema_migrations/20221103150250
new file mode 100644
index 00000000000..cc6b55ba5ea
--- /dev/null
+++ b/db/schema_migrations/20221103150250
@@ -0,0 +1 @@
+662c4df2d65a9259e2eafc11e828ffc15765b92fe3a5291ff869129aaf7bb1c0 \ No newline at end of file
diff --git a/db/schema_migrations/20221104042137 b/db/schema_migrations/20221104042137
new file mode 100644
index 00000000000..4e3a1d27d53
--- /dev/null
+++ b/db/schema_migrations/20221104042137
@@ -0,0 +1 @@
+3192407f3034683ba226d651e247385de200a06e26142e87978fa080eecda110 \ No newline at end of file
diff --git a/db/schema_migrations/20221104042159 b/db/schema_migrations/20221104042159
new file mode 100644
index 00000000000..3454e08597d
--- /dev/null
+++ b/db/schema_migrations/20221104042159
@@ -0,0 +1 @@
+462fd09ac4c59b9fc3f865e984da4c83c4a75d60e557d634631d5eafd67741cc \ No newline at end of file
diff --git a/db/schema_migrations/20221104061320 b/db/schema_migrations/20221104061320
new file mode 100644
index 00000000000..f1cc9a7e277
--- /dev/null
+++ b/db/schema_migrations/20221104061320
@@ -0,0 +1 @@
+c181db849e3542570b4cc55337be8fbda87556773c989ce4e8259cefa1c74922 \ No newline at end of file
diff --git a/db/schema_migrations/20221104074652 b/db/schema_migrations/20221104074652
new file mode 100644
index 00000000000..460f21a3f6e
--- /dev/null
+++ b/db/schema_migrations/20221104074652
@@ -0,0 +1 @@
+167032d562467c3d6be9e6c6c8c072f117e23798db35301f95386130ae115a00 \ No newline at end of file
diff --git a/db/schema_migrations/20221104094042 b/db/schema_migrations/20221104094042
new file mode 100644
index 00000000000..08694063f07
--- /dev/null
+++ b/db/schema_migrations/20221104094042
@@ -0,0 +1 @@
+7ddb85c1acfd3fbeddbe96857d329ad09cd21210e6765ff36d4b9f516a7c10be \ No newline at end of file
diff --git a/db/schema_migrations/20221104100203 b/db/schema_migrations/20221104100203
new file mode 100644
index 00000000000..df7b06eef5d
--- /dev/null
+++ b/db/schema_migrations/20221104100203
@@ -0,0 +1 @@
+1d7912409bb5afc7de82b7507fb2aeb164253c70a58eaf88d502513577bad979 \ No newline at end of file
diff --git a/db/schema_migrations/20221104170500 b/db/schema_migrations/20221104170500
new file mode 100644
index 00000000000..58fd45b5223
--- /dev/null
+++ b/db/schema_migrations/20221104170500
@@ -0,0 +1 @@
+1826209494234355dd2014b3ae7f8ef5c2138a3d22ce143f744ab911e3ebb985 \ No newline at end of file
diff --git a/db/schema_migrations/20221104190203 b/db/schema_migrations/20221104190203
new file mode 100644
index 00000000000..cf604255bc1
--- /dev/null
+++ b/db/schema_migrations/20221104190203
@@ -0,0 +1 @@
+248aecf9fa53146f2c1f7771fd60adf720fa8c0d2bd33d71c6177b185e4248d1 \ No newline at end of file
diff --git a/db/schema_migrations/20221107094359 b/db/schema_migrations/20221107094359
new file mode 100644
index 00000000000..f5cb6814e61
--- /dev/null
+++ b/db/schema_migrations/20221107094359
@@ -0,0 +1 @@
+47d2ac5130583e1a5d0b89d73f32d4af208f8800fc62726bce8ca86e3ce0ed40 \ No newline at end of file
diff --git a/db/schema_migrations/20221107115247 b/db/schema_migrations/20221107115247
new file mode 100644
index 00000000000..e5426ef7be1
--- /dev/null
+++ b/db/schema_migrations/20221107115247
@@ -0,0 +1 @@
+c3616b3184b29fb2dbe83ec18391b8c52a2ab23591803bb949226a7202e49c2b \ No newline at end of file
diff --git a/db/schema_migrations/20221107115413 b/db/schema_migrations/20221107115413
new file mode 100644
index 00000000000..f8889bebe98
--- /dev/null
+++ b/db/schema_migrations/20221107115413
@@ -0,0 +1 @@
+71bacdb2d4c1c3c21fe39d4092cad803a4ebf44b6d621b8425baaa77b15b3891 \ No newline at end of file
diff --git a/db/schema_migrations/20221107183222 b/db/schema_migrations/20221107183222
new file mode 100644
index 00000000000..e7049b0d3a1
--- /dev/null
+++ b/db/schema_migrations/20221107183222
@@ -0,0 +1 @@
+593bf8c98becf8300ccdd38403d805c9f185827a9a131b83d3b0aa571aa6f172 \ No newline at end of file
diff --git a/db/schema_migrations/20221107184542 b/db/schema_migrations/20221107184542
new file mode 100644
index 00000000000..ac7a4c78f66
--- /dev/null
+++ b/db/schema_migrations/20221107184542
@@ -0,0 +1 @@
+876dce84bbc5ee00cd7ee837be6c549c677ec7eb7ec8db39d7711877d57dd7be \ No newline at end of file
diff --git a/db/schema_migrations/20221107184758 b/db/schema_migrations/20221107184758
new file mode 100644
index 00000000000..f327e45183b
--- /dev/null
+++ b/db/schema_migrations/20221107184758
@@ -0,0 +1 @@
+1aa75f334b1b56e46e8e0985febba567b0eb55af0f1ced0e198bfc979e5e262c \ No newline at end of file
diff --git a/db/schema_migrations/20221107220420 b/db/schema_migrations/20221107220420
new file mode 100644
index 00000000000..f56ca1204b1
--- /dev/null
+++ b/db/schema_migrations/20221107220420
@@ -0,0 +1 @@
+499f7b3951c9792d2a8f204b72c474a42e8301b487fa9f68080dd5bb5db0c64c \ No newline at end of file
diff --git a/db/schema_migrations/20221107220526 b/db/schema_migrations/20221107220526
new file mode 100644
index 00000000000..93be68808d7
--- /dev/null
+++ b/db/schema_migrations/20221107220526
@@ -0,0 +1 @@
+b633df04851493d7d4b5d7da79ba3057f6f2c302e507b4f963596edf9cbfcb88 \ No newline at end of file
diff --git a/db/schema_migrations/20221107222213 b/db/schema_migrations/20221107222213
new file mode 100644
index 00000000000..5950f0d5c5a
--- /dev/null
+++ b/db/schema_migrations/20221107222213
@@ -0,0 +1 @@
+f5295b135cd395a59c7afc6a9d999201f9ea1174aab893d31ead398aa8c0f8bb \ No newline at end of file
diff --git a/db/schema_migrations/20221108015813 b/db/schema_migrations/20221108015813
new file mode 100644
index 00000000000..39263419da6
--- /dev/null
+++ b/db/schema_migrations/20221108015813
@@ -0,0 +1 @@
+d6b24d6346bd9b32dd726d61048e7eea791d02016b9b4c3a8cb561b2430e1fdb \ No newline at end of file
diff --git a/db/schema_migrations/20221108045019 b/db/schema_migrations/20221108045019
new file mode 100644
index 00000000000..518b5118173
--- /dev/null
+++ b/db/schema_migrations/20221108045019
@@ -0,0 +1 @@
+b8438bebe77ae835b754431d8d67c306714205bef11826a15d4c84d7b67a3581 \ No newline at end of file
diff --git a/db/schema_migrations/20221108121322 b/db/schema_migrations/20221108121322
new file mode 100644
index 00000000000..d1880c9319a
--- /dev/null
+++ b/db/schema_migrations/20221108121322
@@ -0,0 +1 @@
+4e5deb2f5be081eef7b3dab726b2877bc21a7afad1b6a12aca240f510cada0b3 \ No newline at end of file
diff --git a/db/schema_migrations/20221108185442 b/db/schema_migrations/20221108185442
new file mode 100644
index 00000000000..ec32f966df9
--- /dev/null
+++ b/db/schema_migrations/20221108185442
@@ -0,0 +1 @@
+fc1f31a717e8c5e8539138e612dcba4acafb5b7324534b6ca23220142c43de80 \ No newline at end of file
diff --git a/db/schema_migrations/20221108222015 b/db/schema_migrations/20221108222015
new file mode 100644
index 00000000000..2b9ce458ce9
--- /dev/null
+++ b/db/schema_migrations/20221108222015
@@ -0,0 +1 @@
+555c69896e457b0b41c00926007b422ef34869e45fc0bde89b87ecc2df51de00 \ No newline at end of file
diff --git a/db/schema_migrations/20221110045406 b/db/schema_migrations/20221110045406
new file mode 100644
index 00000000000..264e4f5003b
--- /dev/null
+++ b/db/schema_migrations/20221110045406
@@ -0,0 +1 @@
+d0a14750dfcf3bd7641c9f37fbf5f992d4d7be7be33565ed9dd14eb12a983005 \ No newline at end of file
diff --git a/db/schema_migrations/20221110105857 b/db/schema_migrations/20221110105857
new file mode 100644
index 00000000000..f515180dcdf
--- /dev/null
+++ b/db/schema_migrations/20221110105857
@@ -0,0 +1 @@
+5ef00449d9c5b4a44b99410839d3ba4c4d6d8cb152460822b882c6ac60f771e3 \ No newline at end of file
diff --git a/db/schema_migrations/20221110150942 b/db/schema_migrations/20221110150942
new file mode 100644
index 00000000000..1c627232e78
--- /dev/null
+++ b/db/schema_migrations/20221110150942
@@ -0,0 +1 @@
+fa663262d6d73637e7ffefecd0f06705456bc226024d5023377a527cf3498ac7 \ No newline at end of file
diff --git a/db/schema_migrations/20221111070314 b/db/schema_migrations/20221111070314
new file mode 100644
index 00000000000..754d584f0f2
--- /dev/null
+++ b/db/schema_migrations/20221111070314
@@ -0,0 +1 @@
+4a85ceb76874c618fa21030838900ed1a7219e4ee40b2d88645f4025743034f9 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 2dab5e7abc9..350ac2ad454 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -225,6 +225,33 @@ RETURN NULL;
END
$$;
+CREATE FUNCTION sync_namespaces_amount_used_columns() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ NEW."new_amount_used" := NEW."amount_used";
+ RETURN NEW;
+END;
+$$;
+
+CREATE FUNCTION sync_projects_amount_used_columns() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ NEW."new_amount_used" := NEW."amount_used";
+ RETURN NEW;
+END;
+$$;
+
+CREATE FUNCTION trigger_1a857e8db6cd() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ NEW."uuid_convert_string_to_uuid" := NEW."uuid";
+ RETURN NEW;
+END;
+$$;
+
CREATE FUNCTION unset_has_issues_on_vulnerability_reads() RETURNS trigger
LANGUAGE plpgsql
AS $$
@@ -434,6 +461,7 @@ CREATE TABLE security_findings (
uuid uuid,
overridden_uuid uuid,
partition_number integer DEFAULT 1 NOT NULL,
+ finding_data jsonb DEFAULT '{}'::jsonb NOT NULL,
CONSTRAINT check_6c2851a8c9 CHECK ((uuid IS NOT NULL)),
CONSTRAINT check_b9508c6df8 CHECK ((char_length(project_fingerprint) <= 40))
)
@@ -11488,9 +11516,19 @@ CREATE TABLE application_settings (
lock_maven_package_requests_forwarding boolean DEFAULT false NOT NULL,
lock_pypi_package_requests_forwarding boolean DEFAULT false NOT NULL,
lock_npm_package_requests_forwarding boolean DEFAULT false NOT NULL,
+ jira_connect_proxy_url text,
password_expiration_enabled boolean DEFAULT false NOT NULL,
password_expires_in_days integer DEFAULT 90 NOT NULL,
password_expires_notice_before_days integer DEFAULT 7 NOT NULL,
+ product_analytics_enabled boolean DEFAULT false NOT NULL,
+ email_confirmation_setting smallint DEFAULT 0,
+ disable_admin_oauth_scopes boolean DEFAULT false NOT NULL,
+ default_preferred_language text DEFAULT 'en'::text NOT NULL,
+ disable_download_button boolean DEFAULT false NOT NULL,
+ encrypted_telesign_customer_xid bytea,
+ encrypted_telesign_customer_xid_iv bytea,
+ encrypted_telesign_api_key bytea,
+ encrypted_telesign_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)),
@@ -11509,6 +11547,7 @@ CREATE TABLE application_settings (
CONSTRAINT check_3455368420 CHECK ((char_length(database_grafana_api_url) <= 255)),
CONSTRAINT check_3559645ae5 CHECK ((char_length(container_registry_import_target_plan) <= 255)),
CONSTRAINT check_3def0f1829 CHECK ((char_length(sentry_clientside_dsn) <= 255)),
+ CONSTRAINT check_4847426287 CHECK ((char_length(jira_connect_proxy_url) <= 255)),
CONSTRAINT check_492cc1354d CHECK ((char_length(error_tracking_api_url) <= 255)),
CONSTRAINT check_4f8b811780 CHECK ((char_length(sentry_dsn) <= 255)),
CONSTRAINT check_51700b31b5 CHECK ((char_length(default_branch_name) <= 255)),
@@ -11530,6 +11569,7 @@ CREATE TABLE application_settings (
CONSTRAINT check_d4865d70f3 CHECK ((char_length(clickhouse_connection_string) <= 1024)),
CONSTRAINT check_d820146492 CHECK ((char_length(spam_check_endpoint_url) <= 255)),
CONSTRAINT check_dea8792229 CHECK ((char_length(jitsu_host) <= 255)),
+ CONSTRAINT check_e2692d7523 CHECK ((char_length(default_preferred_language) <= 32)),
CONSTRAINT check_e2dd6e290a CHECK ((char_length(jira_connect_application_key) <= 255)),
CONSTRAINT check_e5024c8801 CHECK ((char_length(elasticsearch_username) <= 255)),
CONSTRAINT check_e5aba18f02 CHECK ((char_length(container_registry_version) <= 255)),
@@ -11579,6 +11619,8 @@ COMMENT ON COLUMN application_settings.password_expires_in_days IS 'JiHu-specifi
COMMENT ON COLUMN application_settings.password_expires_notice_before_days IS 'JiHu-specific column';
+COMMENT ON COLUMN application_settings.disable_download_button IS 'JiHu-specific column';
+
CREATE SEQUENCE application_settings_id_seq
START WITH 1
INCREMENT BY 1
@@ -11854,6 +11896,24 @@ CREATE SEQUENCE audit_events_id_seq
ALTER SEQUENCE audit_events_id_seq OWNED BY audit_events.id;
+CREATE TABLE audit_events_streaming_event_type_filters (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ external_audit_event_destination_id bigint NOT NULL,
+ audit_event_type text NOT NULL,
+ CONSTRAINT check_d20c8e5a51 CHECK ((char_length(audit_event_type) <= 255))
+);
+
+CREATE SEQUENCE audit_events_streaming_event_type_filters_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE audit_events_streaming_event_type_filters_id_seq OWNED BY audit_events_streaming_event_type_filters.id;
+
CREATE TABLE audit_events_streaming_headers (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -12646,7 +12706,7 @@ CREATE SEQUENCE ci_builds_id_seq
ALTER SEQUENCE ci_builds_id_seq OWNED BY ci_builds.id;
-CREATE TABLE ci_builds_metadata (
+CREATE TABLE p_ci_builds_metadata (
project_id integer NOT NULL,
timeout integer,
timeout_source integer DEFAULT 1 NOT NULL,
@@ -12662,7 +12722,8 @@ CREATE TABLE ci_builds_metadata (
runtime_runner_features jsonb DEFAULT '{}'::jsonb NOT NULL,
id_tokens jsonb DEFAULT '{}'::jsonb NOT NULL,
partition_id bigint DEFAULT 100 NOT NULL
-);
+)
+PARTITION BY LIST (partition_id);
CREATE SEQUENCE ci_builds_metadata_id_seq
START WITH 1
@@ -12671,7 +12732,26 @@ CREATE SEQUENCE ci_builds_metadata_id_seq
NO MAXVALUE
CACHE 1;
-ALTER SEQUENCE ci_builds_metadata_id_seq OWNED BY ci_builds_metadata.id;
+ALTER SEQUENCE ci_builds_metadata_id_seq OWNED BY p_ci_builds_metadata.id;
+
+CREATE TABLE ci_builds_metadata (
+ project_id integer NOT NULL,
+ timeout integer,
+ timeout_source integer DEFAULT 1 NOT NULL,
+ interruptible boolean,
+ config_options jsonb,
+ config_variables jsonb,
+ has_exposed_artifacts boolean,
+ environment_auto_stop_in character varying(255),
+ expanded_environment_name character varying(255),
+ secrets jsonb DEFAULT '{}'::jsonb NOT NULL,
+ build_id bigint NOT NULL,
+ id bigint DEFAULT nextval('ci_builds_metadata_id_seq'::regclass) NOT NULL,
+ runtime_runner_features jsonb DEFAULT '{}'::jsonb NOT NULL,
+ id_tokens jsonb DEFAULT '{}'::jsonb NOT NULL,
+ partition_id bigint DEFAULT 100 NOT NULL
+);
+ALTER TABLE ONLY p_ci_builds_metadata ATTACH PARTITION ci_builds_metadata FOR VALUES IN ('100');
CREATE TABLE ci_builds_runner_session (
id bigint NOT NULL,
@@ -12921,6 +13001,7 @@ CREATE TABLE ci_namespace_monthly_usages (
notification_level smallint DEFAULT 100 NOT NULL,
shared_runners_duration integer DEFAULT 0 NOT NULL,
created_at timestamp with time zone,
+ new_amount_used numeric(18,4) DEFAULT 0.0 NOT NULL,
CONSTRAINT ci_namespace_monthly_usages_year_month_constraint CHECK ((date = date_trunc('month'::text, (date)::timestamp with time zone)))
);
@@ -13040,8 +13121,9 @@ ALTER SEQUENCE ci_pipeline_messages_id_seq OWNED BY ci_pipeline_messages.id;
CREATE TABLE ci_pipeline_metadata (
project_id bigint NOT NULL,
pipeline_id bigint NOT NULL,
- title text NOT NULL,
- CONSTRAINT check_e6a636a3f3 CHECK ((char_length(title) <= 255))
+ name text,
+ CONSTRAINT check_25d23931f1 CHECK ((name IS NOT NULL)),
+ CONSTRAINT check_9d3665463c CHECK ((char_length(name) <= 255))
);
CREATE TABLE ci_pipeline_schedule_variables (
@@ -13200,6 +13282,7 @@ CREATE TABLE ci_project_monthly_usages (
amount_used numeric(18,2) DEFAULT 0.0 NOT NULL,
shared_runners_duration integer DEFAULT 0 NOT NULL,
created_at timestamp with time zone,
+ new_amount_used numeric(18,4) DEFAULT 0.0 NOT NULL,
CONSTRAINT ci_project_monthly_usages_year_month_constraint CHECK ((date = date_trunc('month'::text, (date)::timestamp with time zone)))
);
@@ -14084,6 +14167,7 @@ CREATE TABLE container_repositories (
migration_aborted_in_state text,
migration_plan text,
last_cleanup_deleted_tags_count integer,
+ delete_started_at timestamp with time zone,
CONSTRAINT check_05e9012f36 CHECK ((char_length(migration_plan) <= 255)),
CONSTRAINT check_13c58fe73a CHECK ((char_length(migration_state) <= 255)),
CONSTRAINT check_97f0249439 CHECK ((char_length(migration_aborted_in_state) <= 255))
@@ -14506,6 +14590,20 @@ CREATE SEQUENCE dast_sites_id_seq
ALTER SEQUENCE dast_sites_id_seq OWNED BY dast_sites.id;
+CREATE TABLE dependency_proxy_blob_states (
+ verification_started_at timestamp with time zone,
+ verification_retry_at timestamp with time zone,
+ verified_at timestamp with time zone,
+ dependency_proxy_blob_id bigint NOT NULL,
+ verification_state smallint DEFAULT 0 NOT NULL,
+ verification_retry_count smallint DEFAULT 0 NOT NULL,
+ verification_checksum bytea,
+ verification_failure text,
+ CONSTRAINT check_8e4f76fffe CHECK ((char_length(verification_failure) <= 255))
+);
+
+COMMENT ON TABLE dependency_proxy_blob_states IS '{"owner":"group::geo","description":"Geo-specific table to store the verification state of DependencyProxy::Blob objects"}';
+
CREATE TABLE dependency_proxy_blobs (
id integer NOT NULL,
group_id integer NOT NULL,
@@ -15288,26 +15386,6 @@ CREATE SEQUENCE experiment_subjects_id_seq
ALTER SEQUENCE experiment_subjects_id_seq OWNED BY experiment_subjects.id;
-CREATE TABLE experiment_users (
- id bigint NOT NULL,
- experiment_id bigint NOT NULL,
- user_id bigint NOT NULL,
- group_type smallint DEFAULT 0 NOT NULL,
- created_at timestamp with time zone NOT NULL,
- updated_at timestamp with time zone NOT NULL,
- converted_at timestamp with time zone,
- context jsonb DEFAULT '{}'::jsonb NOT NULL
-);
-
-CREATE SEQUENCE experiment_users_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-ALTER SEQUENCE experiment_users_id_seq OWNED BY experiment_users.id;
-
CREATE TABLE experiments (
id bigint NOT NULL,
name text NOT NULL,
@@ -15815,7 +15893,8 @@ CREATE TABLE ghost_user_migrations (
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
+ hard_delete boolean DEFAULT false NOT NULL,
+ consume_after timestamp with time zone DEFAULT now() NOT NULL
);
CREATE SEQUENCE ghost_user_migrations_id_seq
@@ -17296,7 +17375,8 @@ CREATE TABLE members (
state smallint DEFAULT 0,
invite_email_success boolean DEFAULT true NOT NULL,
member_namespace_id bigint,
- member_role_id bigint
+ member_role_id bigint,
+ CONSTRAINT check_508774aac0 CHECK ((member_namespace_id IS NOT NULL))
);
CREATE SEQUENCE members_id_seq
@@ -17894,6 +17974,24 @@ CREATE TABLE namespace_ci_cd_settings (
allow_stale_runner_pruning boolean DEFAULT false NOT NULL
);
+CREATE TABLE namespace_commit_emails (
+ id bigint NOT NULL,
+ user_id bigint NOT NULL,
+ namespace_id bigint NOT NULL,
+ email_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE namespace_commit_emails_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE namespace_commit_emails_id_seq OWNED BY namespace_commit_emails.id;
+
CREATE TABLE namespace_details (
namespace_id bigint NOT NULL,
created_at timestamp with time zone,
@@ -20147,12 +20245,16 @@ 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,
+ issue_branch_template text,
show_diff_preview_in_email boolean DEFAULT true NOT NULL,
jitsu_key text,
suggested_reviewers_enabled boolean DEFAULT false NOT NULL,
only_allow_merge_if_all_status_checks_passed boolean DEFAULT false NOT NULL,
+ mirror_branch_regex text,
CONSTRAINT check_2981f15877 CHECK ((char_length(jitsu_key) <= 100)),
CONSTRAINT check_3a03e7557a CHECK ((char_length(previous_default_branch) <= 4096)),
+ CONSTRAINT check_3ca5cbffe6 CHECK ((char_length(issue_branch_template) <= 255)),
+ CONSTRAINT check_67292e4b99 CHECK ((char_length(mirror_branch_regex) <= 255)),
CONSTRAINT check_b09644994b CHECK ((char_length(squash_commit_template) <= 500)),
CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL)),
CONSTRAINT check_eaf7cfb6a7 CHECK ((char_length(merge_commit_template) <= 500))
@@ -20205,6 +20307,22 @@ CREATE SEQUENCE project_topics_id_seq
ALTER SEQUENCE project_topics_id_seq OWNED BY project_topics.id;
+CREATE TABLE project_wiki_repositories (
+ id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE project_wiki_repositories_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE project_wiki_repositories_id_seq OWNED BY project_wiki_repositories.id;
+
CREATE TABLE project_wiki_repository_states (
verification_started_at timestamp with time zone,
verification_retry_at timestamp with time zone,
@@ -20214,6 +20332,7 @@ CREATE TABLE project_wiki_repository_states (
verification_retry_count smallint,
verification_checksum bytea,
verification_failure text,
+ project_wiki_repository_id bigint,
CONSTRAINT check_119f134b68 CHECK ((char_length(verification_failure) <= 255))
);
@@ -20450,12 +20569,14 @@ ALTER SEQUENCE protected_branch_unprotect_access_levels_id_seq OWNED BY protecte
CREATE TABLE protected_branches (
id integer NOT NULL,
- project_id integer NOT NULL,
+ project_id integer,
name character varying NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
code_owner_approval_required boolean DEFAULT false NOT NULL,
- allow_force_push boolean DEFAULT false NOT NULL
+ allow_force_push boolean DEFAULT false NOT NULL,
+ namespace_id bigint,
+ CONSTRAINT protected_branches_project_id_namespace_id_any_not_null CHECK (((project_id IS NULL) <> (namespace_id IS NULL)))
);
CREATE SEQUENCE protected_branches_id_seq
@@ -20599,7 +20720,8 @@ CREATE TABLE push_rules (
commit_committer_check boolean,
regexp_uses_re2 boolean DEFAULT true,
commit_message_negative_regex character varying,
- reject_non_dco_commits boolean
+ reject_non_dco_commits boolean,
+ commit_committer_name_check boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE push_rules_id_seq
@@ -20728,7 +20850,9 @@ CREATE TABLE remote_mirrors (
only_protected_branches boolean DEFAULT false NOT NULL,
remote_name character varying,
error_notification_sent boolean,
- keep_divergent_refs boolean
+ keep_divergent_refs boolean,
+ mirror_branch_regex text,
+ CONSTRAINT check_aa6b497785 CHECK ((char_length(mirror_branch_regex) <= 255))
);
CREATE SEQUENCE remote_mirrors_id_seq
@@ -21034,6 +21158,7 @@ CREATE TABLE sbom_components (
updated_at timestamp with time zone NOT NULL,
component_type smallint NOT NULL,
name text NOT NULL,
+ purl_type smallint,
CONSTRAINT check_91a8f6ad53 CHECK ((char_length(name) <= 255))
);
@@ -21072,8 +21197,7 @@ CREATE TABLE sbom_sources (
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
source_type smallint NOT NULL,
- source jsonb DEFAULT '{}'::jsonb NOT NULL,
- fingerprint bytea
+ source jsonb DEFAULT '{}'::jsonb NOT NULL
);
CREATE SEQUENCE sbom_sources_id_seq
@@ -21109,7 +21233,7 @@ CREATE TABLE schema_migrations (
CREATE TABLE scim_identities (
id bigint NOT NULL,
- group_id bigint NOT NULL,
+ group_id bigint,
user_id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
@@ -21130,7 +21254,7 @@ CREATE TABLE scim_oauth_access_tokens (
id integer NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
- group_id integer NOT NULL,
+ group_id integer,
token_encrypted character varying NOT NULL
);
@@ -21550,7 +21674,6 @@ CREATE TABLE sprints (
updated_at timestamp with time zone NOT NULL,
start_date date,
due_date date,
- project_id bigint,
group_id bigint,
iid integer NOT NULL,
cached_markdown_version integer,
@@ -21561,7 +21684,6 @@ CREATE TABLE sprints (
state_enum smallint DEFAULT 1 NOT NULL,
iterations_cadence_id integer,
sequence integer,
- CONSTRAINT sprints_must_belong_to_project_or_group CHECK ((((project_id <> NULL::bigint) AND (group_id IS NULL)) OR ((group_id <> NULL::bigint) AND (project_id IS NULL)))),
CONSTRAINT sprints_title CHECK ((char_length(title) <= 255))
);
@@ -22126,13 +22248,13 @@ CREATE TABLE user_details (
registration_objective smallint,
phone text,
requires_credit_card_verification boolean DEFAULT false NOT NULL,
- password_last_changed_at timestamp with time zone,
linkedin text DEFAULT ''::text NOT NULL,
twitter text DEFAULT ''::text NOT NULL,
skype text DEFAULT ''::text NOT NULL,
website_url text DEFAULT ''::text NOT NULL,
location text DEFAULT ''::text NOT NULL,
organization text DEFAULT ''::text NOT NULL,
+ password_last_changed_at timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT check_245664af82 CHECK ((char_length(webauthn_xid) <= 100)),
CONSTRAINT check_444573ee52 CHECK ((char_length(skype) <= 500)),
CONSTRAINT check_466a25be35 CHECK ((char_length(twitter) <= 500)),
@@ -22893,6 +23015,7 @@ CREATE TABLE vulnerability_occurrences (
cve text,
location jsonb,
detection_method smallint DEFAULT 0 NOT NULL,
+ uuid_convert_string_to_uuid uuid DEFAULT '00000000-0000-0000-0000-000000000000'::uuid NOT NULL,
CONSTRAINT check_4a3a60f2ba CHECK ((char_length(solution) <= 7000)),
CONSTRAINT check_ade261da6b CHECK ((char_length(description) <= 15000)),
CONSTRAINT check_df6dd20219 CHECK ((char_length(message) <= 3000)),
@@ -22989,6 +23112,7 @@ CREATE TABLE vulnerability_state_transitions (
author_id bigint,
comment text,
dismissal_reason smallint,
+ CONSTRAINT check_d1ca8ec043 CHECK ((from_state <> to_state)),
CONSTRAINT check_fca4a7ca39 CHECK ((char_length(comment) <= 255))
);
@@ -23205,7 +23329,7 @@ CREATE TABLE x509_certificates (
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
subject_key_identifier character varying(255) NOT NULL,
- subject character varying(255) NOT NULL,
+ subject character varying(512) NOT NULL,
email character varying(255) NOT NULL,
serial_number bytea NOT NULL,
certificate_status smallint DEFAULT 0 NOT NULL,
@@ -23371,6 +23495,8 @@ ALTER TABLE ONLY audit_events ALTER COLUMN id SET DEFAULT nextval('audit_events_
ALTER TABLE ONLY audit_events_external_audit_event_destinations ALTER COLUMN id SET DEFAULT nextval('audit_events_external_audit_event_destinations_id_seq'::regclass);
+ALTER TABLE ONLY audit_events_streaming_event_type_filters ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_event_type_filters_id_seq'::regclass);
+
ALTER TABLE ONLY audit_events_streaming_headers ALTER COLUMN id SET DEFAULT nextval('audit_events_streaming_headers_id_seq'::regclass);
ALTER TABLE ONLY authentication_events ALTER COLUMN id SET DEFAULT nextval('authentication_events_id_seq'::regclass);
@@ -23441,8 +23567,6 @@ ALTER TABLE ONLY ci_build_trace_chunks ALTER COLUMN id SET DEFAULT nextval('ci_b
ALTER TABLE ONLY ci_builds ALTER COLUMN id SET DEFAULT nextval('ci_builds_id_seq'::regclass);
-ALTER TABLE ONLY ci_builds_metadata ALTER COLUMN id SET DEFAULT nextval('ci_builds_metadata_id_seq'::regclass);
-
ALTER TABLE ONLY ci_builds_runner_session ALTER COLUMN id SET DEFAULT nextval('ci_builds_runner_session_id_seq'::regclass);
ALTER TABLE ONLY ci_daily_build_group_report_results ALTER COLUMN id SET DEFAULT nextval('ci_daily_build_group_report_results_id_seq'::regclass);
@@ -23669,8 +23793,6 @@ ALTER TABLE ONLY evidences ALTER COLUMN id SET DEFAULT nextval('evidences_id_seq
ALTER TABLE ONLY experiment_subjects ALTER COLUMN id SET DEFAULT nextval('experiment_subjects_id_seq'::regclass);
-ALTER TABLE ONLY experiment_users ALTER COLUMN id SET DEFAULT nextval('experiment_users_id_seq'::regclass);
-
ALTER TABLE ONLY experiments ALTER COLUMN id SET DEFAULT nextval('experiments_id_seq'::regclass);
ALTER TABLE ONLY external_approval_rules ALTER COLUMN id SET DEFAULT nextval('external_approval_rules_id_seq'::regclass);
@@ -23909,6 +24031,8 @@ ALTER TABLE ONLY namespace_admin_notes ALTER COLUMN id SET DEFAULT nextval('name
ALTER TABLE ONLY namespace_bans ALTER COLUMN id SET DEFAULT nextval('namespace_bans_id_seq'::regclass);
+ALTER TABLE ONLY namespace_commit_emails ALTER COLUMN id SET DEFAULT nextval('namespace_commit_emails_id_seq'::regclass);
+
ALTER TABLE ONLY namespace_statistics ALTER COLUMN id SET DEFAULT nextval('namespace_statistics_id_seq'::regclass);
ALTER TABLE ONLY namespaces ALTER COLUMN id SET DEFAULT nextval('namespaces_id_seq'::regclass);
@@ -23947,6 +24071,8 @@ ALTER TABLE ONLY operations_strategies_user_lists ALTER COLUMN id SET DEFAULT ne
ALTER TABLE ONLY operations_user_lists ALTER COLUMN id SET DEFAULT nextval('operations_user_lists_id_seq'::regclass);
+ALTER TABLE ONLY p_ci_builds_metadata ALTER COLUMN id SET DEFAULT nextval('ci_builds_metadata_id_seq'::regclass);
+
ALTER TABLE ONLY packages_build_infos ALTER COLUMN id SET DEFAULT nextval('packages_build_infos_id_seq'::regclass);
ALTER TABLE ONLY packages_composer_cache_files ALTER COLUMN id SET DEFAULT nextval('packages_composer_cache_files_id_seq'::regclass);
@@ -24069,6 +24195,8 @@ ALTER TABLE ONLY project_statistics ALTER COLUMN id SET DEFAULT nextval('project
ALTER TABLE ONLY project_topics ALTER COLUMN id SET DEFAULT nextval('project_topics_id_seq'::regclass);
+ALTER TABLE ONLY project_wiki_repositories ALTER COLUMN id SET DEFAULT nextval('project_wiki_repositories_id_seq'::regclass);
+
ALTER TABLE ONLY projects ALTER COLUMN id SET DEFAULT nextval('projects_id_seq'::regclass);
ALTER TABLE ONLY projects_sync_events ALTER COLUMN id SET DEFAULT nextval('projects_sync_events_id_seq'::regclass);
@@ -25040,6 +25168,9 @@ ALTER TABLE ONLY audit_events_external_audit_event_destinations
ALTER TABLE ONLY audit_events
ADD CONSTRAINT audit_events_pkey PRIMARY KEY (id, created_at);
+ALTER TABLE ONLY audit_events_streaming_event_type_filters
+ ADD CONSTRAINT audit_events_streaming_event_type_filters_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY audit_events_streaming_headers
ADD CONSTRAINT audit_events_streaming_headers_pkey PRIMARY KEY (id);
@@ -25169,6 +25300,9 @@ ALTER TABLE ONLY ci_build_trace_chunks
ALTER TABLE ONLY ci_build_trace_metadata
ADD CONSTRAINT ci_build_trace_metadata_pkey PRIMARY KEY (build_id);
+ALTER TABLE ONLY p_ci_builds_metadata
+ ADD CONSTRAINT p_ci_builds_metadata_pkey PRIMARY KEY (id, partition_id);
+
ALTER TABLE ONLY ci_builds_metadata
ADD CONSTRAINT ci_builds_metadata_pkey PRIMARY KEY (id, partition_id);
@@ -25442,6 +25576,9 @@ ALTER TABLE ONLY dast_site_validations
ALTER TABLE ONLY dast_sites
ADD CONSTRAINT dast_sites_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY dependency_proxy_blob_states
+ ADD CONSTRAINT dependency_proxy_blob_states_pkey PRIMARY KEY (dependency_proxy_blob_id);
+
ALTER TABLE ONLY dependency_proxy_blobs
ADD CONSTRAINT dependency_proxy_blobs_pkey PRIMARY KEY (id);
@@ -25559,9 +25696,6 @@ ALTER TABLE ONLY evidences
ALTER TABLE ONLY experiment_subjects
ADD CONSTRAINT experiment_subjects_pkey PRIMARY KEY (id);
-ALTER TABLE ONLY experiment_users
- ADD CONSTRAINT experiment_users_pkey PRIMARY KEY (id);
-
ALTER TABLE ONLY experiments
ADD CONSTRAINT experiments_pkey PRIMARY KEY (id);
@@ -25811,9 +25945,6 @@ ALTER TABLE ONLY issues_self_managed_prometheus_alert_events
ALTER TABLE ONLY sprints
ADD CONSTRAINT iteration_start_and_due_date_iterations_cadence_id_constraint EXCLUDE USING gist (iterations_cadence_id WITH =, daterange(start_date, due_date, '[]'::text) WITH &&) WHERE ((group_id IS NOT NULL)) DEFERRABLE INITIALLY DEFERRED;
-ALTER TABLE ONLY sprints
- ADD CONSTRAINT iteration_start_and_due_daterange_project_id_constraint EXCLUDE USING gist (project_id WITH =, daterange(start_date, due_date, '[]'::text) WITH &&) WHERE ((project_id IS NOT NULL));
-
ALTER TABLE ONLY iterations_cadences
ADD CONSTRAINT iterations_cadences_pkey PRIMARY KEY (id);
@@ -25967,6 +26098,9 @@ ALTER TABLE ONLY namespace_bans
ALTER TABLE ONLY namespace_ci_cd_settings
ADD CONSTRAINT namespace_ci_cd_settings_pkey PRIMARY KEY (namespace_id);
+ALTER TABLE ONLY namespace_commit_emails
+ ADD CONSTRAINT namespace_commit_emails_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY namespace_details
ADD CONSTRAINT namespace_details_pkey PRIMARY KEY (namespace_id);
@@ -26273,6 +26407,9 @@ ALTER TABLE ONLY project_statistics
ALTER TABLE ONLY project_topics
ADD CONSTRAINT project_topics_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY project_wiki_repositories
+ ADD CONSTRAINT project_wiki_repositories_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY project_wiki_repository_states
ADD CONSTRAINT project_wiki_repository_states_pkey PRIMARY KEY (project_id);
@@ -27835,6 +27972,8 @@ CREATE UNIQUE INDEX idx_project_id_payload_key_self_managed_prometheus_alert_eve
CREATE INDEX idx_project_repository_check_partial ON projects USING btree (repository_storage, created_at) WHERE (last_repository_check_at IS NULL);
+CREATE INDEX idx_project_wiki_repository_states_project_wiki_repository_id ON project_wiki_repository_states USING btree (project_wiki_repository_id);
+
CREATE INDEX idx_projects_api_created_at_id_for_archived ON projects USING btree (created_at, id) WHERE ((archived = true) AND (pending_delete = false) AND (hidden = false));
CREATE INDEX idx_projects_api_created_at_id_for_archived_vis20 ON projects USING btree (created_at, id) WHERE ((archived = true) AND (visibility_level = 20) AND (pending_delete = false) AND (hidden = false));
@@ -27867,6 +28006,8 @@ CREATE UNIQUE INDEX idx_serverless_domain_cluster_on_clusters_applications_knati
CREATE INDEX idx_streaming_headers_on_external_audit_event_destination_id ON audit_events_streaming_headers USING btree (external_audit_event_destination_id);
+CREATE INDEX idx_test_reports_on_issue_id_created_at_and_id ON requirements_management_test_reports USING btree (issue_id, created_at, id);
+
CREATE INDEX idx_user_details_on_provisioned_by_group_id_user_id ON user_details USING btree (provisioned_by_group_id, user_id);
CREATE UNIQUE INDEX idx_vuln_signatures_on_occurrences_id_and_signature_sha ON vulnerability_finding_signatures USING btree (finding_id, signature_sha);
@@ -28181,14 +28322,24 @@ CREATE UNIQUE INDEX index_ci_build_trace_chunks_on_build_id_and_chunk_index ON c
CREATE INDEX index_ci_build_trace_metadata_on_trace_artifact_id ON ci_build_trace_metadata USING btree (trace_artifact_id);
+CREATE INDEX p_ci_builds_metadata_build_id_idx ON ONLY p_ci_builds_metadata USING btree (build_id) WHERE (has_exposed_artifacts IS TRUE);
+
CREATE INDEX index_ci_builds_metadata_on_build_id_and_has_exposed_artifacts ON ci_builds_metadata USING btree (build_id) WHERE (has_exposed_artifacts IS TRUE);
+CREATE INDEX p_ci_builds_metadata_build_id_id_idx ON ONLY p_ci_builds_metadata USING btree (build_id) INCLUDE (id) WHERE (interruptible = true);
+
CREATE INDEX index_ci_builds_metadata_on_build_id_and_id_and_interruptible ON ci_builds_metadata USING btree (build_id) INCLUDE (id) WHERE (interruptible = true);
+CREATE UNIQUE INDEX p_ci_builds_metadata_build_id_partition_id_idx ON ONLY p_ci_builds_metadata USING btree (build_id, partition_id);
+
CREATE UNIQUE INDEX index_ci_builds_metadata_on_build_id_partition_id_unique ON ci_builds_metadata USING btree (build_id, partition_id);
+CREATE UNIQUE INDEX p_ci_builds_metadata_id_partition_id_idx ON ONLY p_ci_builds_metadata USING btree (id, partition_id);
+
CREATE UNIQUE INDEX index_ci_builds_metadata_on_id_partition_id_unique ON ci_builds_metadata USING btree (id, partition_id);
+CREATE INDEX p_ci_builds_metadata_project_id_idx ON ONLY p_ci_builds_metadata USING btree (project_id);
+
CREATE INDEX index_ci_builds_metadata_on_project_id ON ci_builds_metadata USING btree (project_id);
CREATE INDEX index_ci_builds_on_auto_canceled_by_id ON ci_builds USING btree (auto_canceled_by_id);
@@ -28319,7 +28470,7 @@ CREATE UNIQUE INDEX index_ci_pipeline_chat_data_on_pipeline_id ON ci_pipeline_ch
CREATE INDEX index_ci_pipeline_messages_on_pipeline_id ON ci_pipeline_messages USING btree (pipeline_id);
-CREATE INDEX index_ci_pipeline_metadata_on_pipeline_id_title ON ci_pipeline_metadata USING btree (pipeline_id, title);
+CREATE INDEX index_ci_pipeline_metadata_on_pipeline_id_name ON ci_pipeline_metadata USING btree (pipeline_id, name);
CREATE INDEX index_ci_pipeline_metadata_on_project_id ON ci_pipeline_metadata USING btree (project_id);
@@ -28421,10 +28572,6 @@ CREATE INDEX index_ci_runners_on_locked ON ci_runners USING btree (locked);
CREATE INDEX index_ci_runners_on_runner_type ON ci_runners USING btree (runner_type);
-CREATE INDEX index_ci_runners_on_token ON ci_runners USING btree (token);
-
-CREATE INDEX index_ci_runners_on_token_encrypted ON ci_runners USING btree (token_encrypted);
-
CREATE INDEX index_ci_runners_on_token_expires_at_and_id_desc ON ci_runners USING btree (token_expires_at, id DESC);
CREATE INDEX index_ci_runners_on_token_expires_at_desc_and_id_desc ON ci_runners USING btree (token_expires_at DESC, id DESC);
@@ -28587,6 +28734,8 @@ CREATE INDEX index_container_repositories_on_project_id_and_id ON container_repo
CREATE UNIQUE INDEX index_container_repositories_on_project_id_and_name ON container_repositories USING btree (project_id, name);
+CREATE INDEX index_container_repositories_on_status_and_id ON container_repositories USING btree (status, id) WHERE (status IS NOT NULL);
+
CREATE INDEX index_container_repository_on_name_trigram ON container_repositories USING gin (name gin_trgm_ops);
CREATE UNIQUE INDEX index_content_blocked_states_on_container_id_commit_sha_path ON content_blocked_states USING btree (container_identifier, commit_sha, path);
@@ -28657,6 +28806,16 @@ CREATE UNIQUE INDEX index_dast_sites_on_project_id_and_url ON dast_sites USING b
CREATE UNIQUE INDEX index_dep_prox_manifests_on_group_id_file_name_and_status ON dependency_proxy_manifests USING btree (group_id, file_name, status);
+CREATE INDEX index_dependency_proxy_blob_states_failed_verification ON dependency_proxy_blob_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);
+
+CREATE INDEX index_dependency_proxy_blob_states_needs_verification ON dependency_proxy_blob_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));
+
+CREATE INDEX index_dependency_proxy_blob_states_on_dependency_proxy_blob_id ON dependency_proxy_blob_states USING btree (dependency_proxy_blob_id);
+
+CREATE INDEX index_dependency_proxy_blob_states_on_verification_state ON dependency_proxy_blob_states USING btree (verification_state);
+
+CREATE INDEX index_dependency_proxy_blob_states_pending_verification ON dependency_proxy_blob_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);
+
CREATE INDEX index_dependency_proxy_blobs_on_group_id_and_file_name ON dependency_proxy_blobs USING btree (group_id, file_name);
CREATE INDEX index_dependency_proxy_blobs_on_group_id_status_read_at_id ON dependency_proxy_blobs USING btree (group_id, status, read_at, id);
@@ -28915,10 +29074,6 @@ CREATE INDEX index_experiment_subjects_on_project_id ON experiment_subjects USIN
CREATE INDEX index_experiment_subjects_on_user_id ON experiment_subjects USING btree (user_id);
-CREATE INDEX index_experiment_users_on_experiment_id ON experiment_users USING btree (experiment_id);
-
-CREATE INDEX index_experiment_users_on_user_id ON experiment_users USING btree (user_id);
-
CREATE UNIQUE INDEX index_experiments_on_name ON experiments USING btree (name);
CREATE INDEX index_expired_and_not_notified_personal_access_tokens ON personal_access_tokens USING btree (id, expires_at) WHERE ((impersonation = false) AND (revoked = false) AND (expire_notification_delivered = false));
@@ -28999,6 +29154,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 INDEX index_ghost_user_migrations_on_consume_after_id ON ghost_user_migrations USING btree (consume_after, 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);
@@ -29011,6 +29168,8 @@ CREATE INDEX index_gitlab_subscriptions_on_end_date_and_namespace_id ON gitlab_s
CREATE INDEX index_gitlab_subscriptions_on_hosted_plan_id ON gitlab_subscriptions USING btree (hosted_plan_id);
+CREATE INDEX index_gitlab_subscriptions_on_max_seats_used_changed_at ON gitlab_subscriptions USING btree (max_seats_used_changed_at, namespace_id);
+
CREATE UNIQUE INDEX index_gitlab_subscriptions_on_namespace_id ON gitlab_subscriptions USING btree (namespace_id);
CREATE UNIQUE INDEX index_gpg_key_subkeys_on_fingerprint ON gpg_key_subkeys USING btree (fingerprint);
@@ -29079,6 +29238,8 @@ CREATE INDEX index_group_stages_on_stage_event_hash_id ON analytics_cycle_analyt
CREATE UNIQUE INDEX index_group_user_callouts_feature ON user_group_callouts USING btree (user_id, feature_name, group_id);
+CREATE INDEX index_group_vulnerability_reads_common_finder_query_desc ON vulnerability_reads USING btree (namespace_id, state, report_type, severity DESC, vulnerability_id DESC);
+
CREATE UNIQUE INDEX index_group_wiki_repositories_on_disk_path ON group_wiki_repositories USING btree (disk_path);
CREATE INDEX index_group_wiki_repositories_on_shard_id ON group_wiki_repositories USING btree (shard_id);
@@ -29099,7 +29260,7 @@ CREATE UNIQUE INDEX index_im_oncall_schedules_on_project_id_and_iid ON incident_
CREATE INDEX index_im_timeline_event_id ON incident_management_timeline_event_tag_links USING btree (timeline_event_id);
-CREATE UNIQUE INDEX index_im_timeline_event_tags_name_project_id ON incident_management_timeline_event_tags USING btree (project_id, name);
+CREATE UNIQUE INDEX index_im_timeline_event_tags_on_lower_name_and_project_id ON incident_management_timeline_event_tags USING btree (project_id, lower(name));
CREATE UNIQUE INDEX index_im_timeline_event_tags_on_tag_id_and_event_id ON incident_management_timeline_event_tag_links USING btree (timeline_event_tag_id, timeline_event_id);
@@ -29131,6 +29292,8 @@ CREATE INDEX index_imported_projects_on_import_type_creator_id_created_at ON pro
CREATE INDEX index_imported_projects_on_import_type_id ON projects USING btree (import_type, id) WHERE (import_type IS NOT NULL);
+CREATE INDEX index_in_product_marketing_emails_on_track_series_id_clicked ON in_product_marketing_emails USING btree (track, series, id, cta_clicked_at);
+
CREATE UNIQUE INDEX index_in_product_marketing_emails_on_user_campaign ON in_product_marketing_emails USING btree (user_id, campaign);
CREATE INDEX index_in_product_marketing_emails_on_user_id ON in_product_marketing_emails USING btree (user_id);
@@ -29235,7 +29398,9 @@ CREATE INDEX index_issues_on_closed_by_id ON issues USING btree (closed_by_id);
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 ON issues USING gin (description gin_trgm_ops) WITH (fastupdate='false');
+
+CREATE INDEX index_issues_on_description_trigram_non_latin ON issues USING gin (description gin_trgm_ops) WHERE (((title)::text !~ similar_escape('[\u0000-\u02FF\u1E00-\u1EFF\u2070-\u218F]*'::text, NULL::text)) OR (description !~ similar_escape('[\u0000-\u02FF\u1E00-\u1EFF\u2070-\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);
@@ -29271,7 +29436,9 @@ CREATE INDEX index_issues_on_promoted_to_epic_id ON issues USING btree (promoted
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 ON issues USING gin (title gin_trgm_ops) WITH (fastupdate='false');
+
+CREATE INDEX index_issues_on_title_trigram_non_latin ON issues USING gin (title gin_trgm_ops) WHERE (((title)::text !~ similar_escape('[\u0000-\u02FF\u1E00-\u1EFF\u2070-\u218F]*'::text, NULL::text)) OR (description !~ similar_escape('[\u0000-\u02FF\u1E00-\u1EFF\u2070-\u218F]*'::text, NULL::text)));
CREATE INDEX index_issues_on_updated_at ON issues USING btree (updated_at);
@@ -29481,9 +29648,13 @@ CREATE INDEX index_merge_requests_on_assignee_id ON merge_requests USING btree (
CREATE INDEX index_merge_requests_on_author_id ON merge_requests USING btree (author_id);
+CREATE INDEX index_merge_requests_on_author_id_and_id ON merge_requests USING btree (author_id, id);
+
+CREATE INDEX index_merge_requests_on_author_id_and_target_project_id ON merge_requests USING btree (author_id, target_project_id);
+
CREATE INDEX index_merge_requests_on_created_at ON merge_requests USING btree (created_at);
-CREATE INDEX index_merge_requests_on_description_trigram ON merge_requests USING gin (description gin_trgm_ops);
+CREATE INDEX index_merge_requests_on_description_trigram ON merge_requests USING gin (description gin_trgm_ops) WITH (fastupdate='false');
CREATE INDEX index_merge_requests_on_head_pipeline_id ON merge_requests USING btree (head_pipeline_id);
@@ -29519,7 +29690,7 @@ CREATE INDEX index_merge_requests_on_target_project_id_and_updated_at_and_id ON
CREATE INDEX index_merge_requests_on_target_project_id_iid_jira_description ON merge_requests USING btree (target_project_id, iid) WHERE (description ~ '[A-Z][A-Z_0-9]+-\d+'::text);
-CREATE INDEX index_merge_requests_on_title_trigram ON merge_requests USING gin (title gin_trgm_ops);
+CREATE INDEX index_merge_requests_on_title_trigram ON merge_requests USING gin (title gin_trgm_ops) WITH (fastupdate='false');
CREATE INDEX index_merge_requests_on_tp_id_and_merge_commit_sha_and_id ON merge_requests USING btree (target_project_id, merge_commit_sha, id);
@@ -29593,6 +29764,12 @@ CREATE UNIQUE INDEX index_namespace_bans_on_namespace_id_and_user_id ON namespac
CREATE INDEX index_namespace_bans_on_user_id ON namespace_bans USING btree (user_id);
+CREATE INDEX index_namespace_commit_emails_on_email_id ON namespace_commit_emails USING btree (email_id);
+
+CREATE INDEX index_namespace_commit_emails_on_namespace_id ON namespace_commit_emails USING btree (namespace_id);
+
+CREATE UNIQUE INDEX index_namespace_commit_emails_on_user_id_and_namespace_id ON namespace_commit_emails USING btree (user_id, namespace_id);
+
CREATE UNIQUE INDEX index_namespace_root_storage_statistics_on_namespace_id ON namespace_root_storage_statistics USING btree (namespace_id);
CREATE UNIQUE INDEX index_namespace_statistics_on_namespace_id ON namespace_statistics USING btree (namespace_id);
@@ -29857,7 +30034,7 @@ CREATE INDEX index_packages_project_id_name_partial_for_nuget ON packages_packag
CREATE INDEX index_packages_rpm_metadata_on_package_id ON packages_rpm_metadata USING btree (package_id);
-CREATE INDEX index_packages_rpm_repository_files_on_project_id ON packages_rpm_repository_files USING btree (project_id);
+CREATE INDEX index_packages_rpm_repository_files_on_project_id_and_file_name ON packages_rpm_repository_files USING btree (project_id, file_name);
CREATE INDEX index_packages_tags_on_package_id ON packages_tags USING btree (package_id);
@@ -30059,6 +30236,8 @@ CREATE INDEX index_project_topics_on_topic_id ON project_topics USING btree (top
CREATE UNIQUE INDEX index_project_user_callouts_feature ON user_project_callouts USING btree (user_id, feature_name, project_id);
+CREATE UNIQUE INDEX index_project_wiki_repositories_on_project_id ON project_wiki_repositories USING btree (project_id);
+
CREATE INDEX index_project_wiki_repository_states_failed_verification ON project_wiki_repository_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);
CREATE INDEX index_project_wiki_repository_states_needs_verification ON project_wiki_repository_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));
@@ -30189,6 +30368,8 @@ CREATE INDEX index_protected_branch_unprotect_access_levels_on_group_id ON prote
CREATE INDEX index_protected_branch_unprotect_access_levels_on_user_id ON protected_branch_unprotect_access_levels USING btree (user_id);
+CREATE INDEX index_protected_branches_namespace_id ON protected_branches USING btree (namespace_id) WHERE (namespace_id IS NOT NULL);
+
CREATE INDEX index_protected_branches_on_project_id ON protected_branches USING btree (project_id);
CREATE INDEX index_protected_environment_approval_rules_on_group_id ON protected_environment_approval_rules USING btree (group_id);
@@ -30359,7 +30540,7 @@ CREATE INDEX index_sbom_component_versions_on_component_id ON sbom_component_ver
CREATE UNIQUE INDEX index_sbom_component_versions_on_component_id_and_version ON sbom_component_versions USING btree (component_id, version);
-CREATE UNIQUE INDEX index_sbom_components_on_component_type_and_name ON sbom_components USING btree (component_type, name);
+CREATE UNIQUE INDEX index_sbom_components_on_component_type_name_and_purl_type ON sbom_components USING btree (name, purl_type, component_type);
CREATE INDEX index_sbom_occurrences_on_component_id ON sbom_occurrences USING btree (component_id);
@@ -30391,6 +30572,8 @@ CREATE INDEX index_security_scans_on_created_at ON security_scans USING btree (c
CREATE INDEX index_security_scans_on_date_created_at_and_id ON security_scans USING btree (date(timezone('UTC'::text, created_at)), id);
+CREATE INDEX index_security_scans_on_id_for_non_purged_records ON security_scans USING btree (id) WHERE (status <> 6);
+
CREATE INDEX index_security_scans_on_length_of_errors ON security_scans USING btree (pipeline_id, jsonb_array_length(COALESCE((info -> 'errors'::text), '[]'::jsonb)));
CREATE INDEX index_security_scans_on_length_of_warnings ON security_scans USING btree (pipeline_id, jsonb_array_length(COALESCE((info -> 'warnings'::text), '[]'::jsonb)));
@@ -30503,8 +30686,6 @@ CREATE INDEX index_sprints_on_due_date ON sprints USING btree (due_date);
CREATE INDEX index_sprints_on_group_id ON sprints USING btree (group_id);
-CREATE UNIQUE INDEX index_sprints_on_project_id_and_iid ON sprints USING btree (project_id, iid);
-
CREATE INDEX index_sprints_on_title ON sprints USING btree (title);
CREATE INDEX index_sprints_on_title_trigram ON sprints USING gin (title gin_trgm_ops);
@@ -30623,6 +30804,10 @@ CREATE INDEX index_u2f_registrations_on_key_handle ON u2f_registrations USING bt
CREATE INDEX index_u2f_registrations_on_user_id ON u2f_registrations USING btree (user_id);
+CREATE UNIQUE INDEX index_uniq_ci_runners_on_token ON ci_runners USING btree (token);
+
+CREATE UNIQUE INDEX index_uniq_ci_runners_on_token_encrypted ON ci_runners USING btree (token_encrypted);
+
CREATE UNIQUE INDEX index_uniq_im_issuable_escalation_statuses_on_issue_id ON incident_management_issuable_escalation_statuses USING btree (issue_id);
CREATE UNIQUE INDEX index_uniq_projects_on_runners_token ON projects USING btree (runners_token);
@@ -30681,6 +30866,10 @@ CREATE INDEX index_user_custom_attributes_on_key_and_value ON user_custom_attrib
CREATE UNIQUE INDEX index_user_custom_attributes_on_user_id_and_key ON user_custom_attributes USING btree (user_id, key);
+CREATE INDEX index_user_details_on_password_last_changed_at ON user_details USING btree (password_last_changed_at);
+
+COMMENT ON INDEX index_user_details_on_password_last_changed_at IS 'JiHu-specific index';
+
CREATE UNIQUE INDEX index_user_details_on_phone ON user_details USING btree (phone) WHERE (phone IS NOT NULL);
COMMENT ON INDEX index_user_details_on_phone IS 'JiHu-specific index';
@@ -30837,6 +31026,10 @@ CREATE INDEX index_vulnerability_feedback_on_author_id ON vulnerability_feedback
CREATE INDEX index_vulnerability_feedback_on_comment_author_id ON vulnerability_feedback USING btree (comment_author_id);
+CREATE INDEX index_vulnerability_feedback_on_common_attributes ON vulnerability_feedback USING btree (project_id, category, feedback_type, project_fingerprint);
+
+CREATE INDEX index_vulnerability_feedback_on_feedback_type_and_finding_uuid ON vulnerability_feedback USING btree (feedback_type, finding_uuid);
+
CREATE INDEX index_vulnerability_feedback_on_issue_id ON vulnerability_feedback USING btree (issue_id);
CREATE INDEX index_vulnerability_feedback_on_issue_id_not_null ON vulnerability_feedback USING btree (id) WHERE (issue_id IS NOT NULL);
@@ -30901,6 +31094,8 @@ CREATE INDEX index_vulnerability_reads_on_location_image ON vulnerability_reads
CREATE INDEX index_vulnerability_reads_on_location_image_partial ON vulnerability_reads USING btree (project_id, location_image) WHERE ((report_type = ANY (ARRAY[2, 7])) AND (location_image IS NOT NULL));
+CREATE INDEX index_vulnerability_reads_on_namespace_type_severity_id ON vulnerability_reads USING btree (namespace_id, report_type, severity, vulnerability_id);
+
CREATE INDEX index_vulnerability_reads_on_scanner_id ON vulnerability_reads USING btree (scanner_id);
CREATE UNIQUE INDEX index_vulnerability_reads_on_uuid ON vulnerability_reads USING btree (uuid);
@@ -31031,6 +31226,8 @@ 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 scan_finding_approval_mr_rule_index_id ON approval_merge_request_rules USING btree (id) WHERE (report_type = 4);
+
CREATE INDEX scan_finding_approval_mr_rule_index_merge_request_id ON approval_merge_request_rules USING btree (merge_request_id) WHERE (report_type = 4);
CREATE INDEX scan_finding_approval_project_rule_index_created_at_project_id ON approval_project_rules USING btree (created_at, project_id) WHERE (report_type = 4);
@@ -31059,11 +31256,11 @@ 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_project_features_on_releases_al_and_repo_al_partial ON project_features USING btree (releases_access_level, repository_access_level) WHERE (releases_access_level > repository_access_level);
+CREATE INDEX tmp_idx_for_vulnerability_feedback_migration ON vulnerability_feedback USING btree (migrated_to_state_transition, feedback_type) WHERE ((migrated_to_state_transition = false) AND (feedback_type = 0));
CREATE INDEX tmp_idx_vulnerabilities_on_id_where_report_type_7_99 ON vulnerabilities USING btree (id) WHERE (report_type = ANY (ARRAY[7, 99]));
-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_idx_where_user_details_fields_filled ON users USING btree (id) WHERE (((COALESCE(linkedin, ''::character varying))::text IS DISTINCT FROM ''::text) OR ((COALESCE(twitter, ''::character varying))::text IS DISTINCT FROM ''::text) OR ((COALESCE(skype, ''::character varying))::text IS DISTINCT FROM ''::text) OR ((COALESCE(website_url, ''::character varying))::text IS DISTINCT FROM ''::text) OR ((COALESCE(location, ''::character varying))::text IS DISTINCT FROM ''::text) OR ((COALESCE(organization, ''::character varying))::text IS DISTINCT FROM ''::text));
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));
@@ -31081,8 +31278,6 @@ CREATE INDEX tmp_index_for_project_namespace_id_migration_on_routes ON routes US
CREATE INDEX tmp_index_issues_on_issue_type_and_id ON issues USING btree (issue_type, id);
-CREATE INDEX tmp_index_members_on_id_where_namespace_id_null ON members USING btree (id) WHERE (member_namespace_id IS NULL);
-
CREATE INDEX tmp_index_members_on_state ON members USING btree (state) 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));
@@ -31093,7 +31288,7 @@ 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_system_note_metadata_on_id_where_task ON system_note_metadata USING btree (id, action) WHERE ((action)::text = 'task'::text);
+CREATE INDEX tmp_index_project_statistics_uploads_size ON project_statistics USING btree (project_id) WHERE (uploads_size <> 0);
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]));
@@ -31117,14 +31312,14 @@ CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_re
CREATE UNIQUE INDEX unique_projects_on_name_namespace_id ON projects USING btree (name, namespace_id);
+CREATE UNIQUE INDEX unique_streaming_event_type_filters_destination_id ON audit_events_streaming_event_type_filters USING btree (external_audit_event_destination_id, audit_event_type);
+
CREATE UNIQUE INDEX unique_vuln_merge_request_link_vuln_id_and_mr_id ON vulnerability_merge_request_links USING btree (vulnerability_id, merge_request_id);
CREATE INDEX user_follow_users_followee_id_idx ON user_follow_users USING btree (followee_id);
CREATE INDEX users_forbidden_state_idx ON users USING btree (id) WHERE ((confirmed_at IS NOT NULL) AND ((state)::text <> ALL (ARRAY['blocked'::text, 'banned'::text, 'ldap_blocked'::text])));
-CREATE UNIQUE INDEX vulnerability_feedback_unique_idx ON vulnerability_feedback USING btree (project_id, category, feedback_type, project_fingerprint);
-
CREATE UNIQUE INDEX vulnerability_occurrence_pipelines_on_unique_keys ON vulnerability_occurrence_pipelines USING btree (occurrence_id, pipeline_id);
CREATE UNIQUE INDEX work_item_types_namespace_id_and_name_unique ON work_item_types USING btree (namespace_id, btrim(lower(name)));
@@ -32409,6 +32604,18 @@ ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_p
ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_partitions_static.product_analytics_events_experimental_63_pkey;
+ALTER INDEX p_ci_builds_metadata_pkey ATTACH PARTITION ci_builds_metadata_pkey;
+
+ALTER INDEX p_ci_builds_metadata_build_id_idx ATTACH PARTITION index_ci_builds_metadata_on_build_id_and_has_exposed_artifacts;
+
+ALTER INDEX p_ci_builds_metadata_build_id_id_idx ATTACH PARTITION index_ci_builds_metadata_on_build_id_and_id_and_interruptible;
+
+ALTER INDEX p_ci_builds_metadata_build_id_partition_id_idx ATTACH PARTITION index_ci_builds_metadata_on_build_id_partition_id_unique;
+
+ALTER INDEX p_ci_builds_metadata_id_partition_id_idx ATTACH PARTITION index_ci_builds_metadata_on_id_partition_id_unique;
+
+ALTER INDEX p_ci_builds_metadata_project_id_idx ATTACH PARTITION index_ci_builds_metadata_on_project_id;
+
CREATE TRIGGER chat_names_loose_fk_trigger AFTER DELETE ON chat_names REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();
CREATE TRIGGER ci_builds_loose_fk_trigger AFTER DELETE ON ci_builds REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();
@@ -32427,6 +32634,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 sync_namespaces_amount_used_columns BEFORE INSERT OR UPDATE ON ci_namespace_monthly_usages FOR EACH ROW EXECUTE FUNCTION sync_namespaces_amount_used_columns();
+
+CREATE TRIGGER sync_projects_amount_used_columns BEFORE INSERT OR UPDATE ON ci_project_monthly_usages FOR EACH ROW EXECUTE FUNCTION sync_projects_amount_used_columns();
+
+CREATE TRIGGER trigger_1a857e8db6cd BEFORE INSERT OR UPDATE ON vulnerability_occurrences FOR EACH ROW EXECUTE FUNCTION trigger_1a857e8db6cd();
+
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();
@@ -32472,7 +32685,7 @@ CREATE TRIGGER trigger_update_vulnerability_reads_on_vulnerability_update AFTER
CREATE TRIGGER users_loose_fk_trigger AFTER DELETE ON users REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();
ALTER TABLE ONLY deployments
- ADD CONSTRAINT fk_009fd21147 FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE NOT VALID;
+ ADD CONSTRAINT fk_009fd21147 FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE;
ALTER TABLE ONLY epics
ADD CONSTRAINT fk_013c9f36ca FOREIGN KEY (due_date_sourcing_epic_id) REFERENCES epics(id) ON DELETE SET NULL;
@@ -32646,7 +32859,7 @@ 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;
+ ADD CONSTRAINT fk_2f85abf8f1 FOREIGN KEY (member_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
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;
@@ -32738,6 +32951,9 @@ ALTER TABLE ONLY user_namespace_callouts
ALTER TABLE ONLY sbom_occurrences
ADD CONSTRAINT fk_4b88e5b255 FOREIGN KEY (component_version_id) REFERENCES sbom_component_versions(id) ON DELETE CASCADE;
+ALTER TABLE ONLY namespace_commit_emails
+ ADD CONSTRAINT fk_4d6ba63ba5 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY vulnerability_reads
ADD CONSTRAINT fk_4f593f6c62 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -32813,6 +33029,9 @@ ALTER TABLE ONLY ci_builds
ALTER TABLE ONLY application_settings
ADD CONSTRAINT fk_693b8795e4 FOREIGN KEY (push_rule_id) REFERENCES push_rules(id) ON DELETE SET NULL;
+ALTER TABLE ONLY project_wiki_repository_states
+ ADD CONSTRAINT fk_6951681c70 FOREIGN KEY (project_wiki_repository_id) REFERENCES project_wiki_repositories(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_6a5165a692 FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE SET NULL;
@@ -33056,9 +33275,6 @@ ALTER TABLE ONLY epics
ALTER TABLE ONLY dast_profiles
ADD CONSTRAINT fk_aa76ef30e9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
-ALTER TABLE ONLY members
- ADD CONSTRAINT fk_aa82dcc1c6 FOREIGN KEY (member_namespace_id) REFERENCES namespaces(id) ON DELETE SET NULL;
-
ALTER TABLE ONLY alert_management_alerts
ADD CONSTRAINT fk_aad61aedca FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE SET NULL;
@@ -33122,6 +33338,9 @@ ALTER TABLE ONLY issue_assignees
ALTER TABLE ONLY agent_project_authorizations
ADD CONSTRAINT fk_b7fe9b4777 FOREIGN KEY (agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;
+ALTER TABLE ONLY namespace_commit_emails
+ ADD CONSTRAINT fk_b8d89d555e FOREIGN KEY (email_id) REFERENCES emails(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY ci_trigger_requests
ADD CONSTRAINT fk_b8ec8b7245 FOREIGN KEY (trigger_id) REFERENCES ci_triggers(id) ON DELETE CASCADE;
@@ -33284,6 +33503,9 @@ ALTER TABLE ONLY security_scans
ALTER TABLE ONLY epics
ADD CONSTRAINT fk_dccd3f98fc FOREIGN KEY (assignee_id) REFERENCES users(id) ON DELETE SET NULL;
+ALTER TABLE ONLY protected_branches
+ ADD CONSTRAINT fk_de9216e774 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY issues
ADD CONSTRAINT fk_df75a7c8b8 FOREIGN KEY (promoted_to_epic_id) REFERENCES epics(id) ON DELETE SET NULL;
@@ -33296,7 +33518,7 @@ ALTER TABLE ONLY ci_resources
ALTER TABLE ONLY ci_sources_pipelines
ADD CONSTRAINT fk_e1bad85861 FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
-ALTER TABLE ONLY ci_builds_metadata
+ALTER TABLE p_ci_builds_metadata
ADD CONSTRAINT fk_e20479742e FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
ALTER TABLE ONLY gitlab_subscriptions
@@ -33320,9 +33542,6 @@ ALTER TABLE ONLY namespaces
ALTER TABLE ONLY fork_networks
ADD CONSTRAINT fk_e7b436b2b5 FOREIGN KEY (root_project_id) REFERENCES projects(id) ON DELETE SET NULL;
-ALTER TABLE ONLY sprints
- ADD CONSTRAINT fk_e8206c9686 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY application_settings
ADD CONSTRAINT fk_e8a145f3a7 FOREIGN KEY (instance_administrators_group_id) REFERENCES namespaces(id) ON DELETE SET NULL;
@@ -33911,6 +34130,9 @@ ALTER TABLE ONLY project_metrics_settings
ALTER TABLE ONLY prometheus_metrics
ADD CONSTRAINT fk_rails_4c8957a707 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY dependency_proxy_blob_states
+ ADD CONSTRAINT fk_rails_4cdbb92cbd FOREIGN KEY (dependency_proxy_blob_id) REFERENCES dependency_proxy_blobs(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY scim_identities
ADD CONSTRAINT fk_rails_4d2056ebd9 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -33965,9 +34187,6 @@ ALTER TABLE ONLY issuable_metric_images
ALTER TABLE ONLY group_deploy_keys
ADD CONSTRAINT fk_rails_5682fc07f8 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE RESTRICT;
-ALTER TABLE ONLY experiment_users
- ADD CONSTRAINT fk_rails_56d4708b4a FOREIGN KEY (experiment_id) REFERENCES experiments(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY issue_user_mentions
ADD CONSTRAINT fk_rails_57581fda73 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
@@ -34670,6 +34889,9 @@ ALTER TABLE ONLY packages_nuget_dependency_link_metadata
ALTER TABLE ONLY group_deploy_keys_groups
ADD CONSTRAINT fk_rails_c3854f19f5 FOREIGN KEY (group_deploy_key_id) REFERENCES group_deploy_keys(id) ON DELETE CASCADE;
+ALTER TABLE ONLY project_wiki_repositories
+ ADD CONSTRAINT fk_rails_c3dd796199 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY merge_request_user_mentions
ADD CONSTRAINT fk_rails_c440b9ea31 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;
@@ -34826,6 +35048,9 @@ ALTER TABLE ONLY packages_debian_project_distributions
ALTER TABLE ONLY incident_management_oncall_shifts
ADD CONSTRAINT fk_rails_df4feb286a FOREIGN KEY (rotation_id) REFERENCES incident_management_oncall_rotations(id) ON DELETE CASCADE;
+ALTER TABLE ONLY namespace_commit_emails
+ ADD CONSTRAINT fk_rails_dfa4c104f5 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY analytics_cycle_analytics_group_stages
ADD CONSTRAINT fk_rails_dfb37c880d FOREIGN KEY (end_event_label_id) REFERENCES labels(id) ON DELETE CASCADE;
@@ -34889,6 +35114,9 @@ ALTER TABLE ONLY dast_site_tokens
ALTER TABLE ONLY group_deploy_keys_groups
ADD CONSTRAINT fk_rails_e87145115d FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+ALTER TABLE ONLY audit_events_streaming_event_type_filters
+ ADD CONSTRAINT fk_rails_e8bd011129 FOREIGN KEY (external_audit_event_destination_id) REFERENCES audit_events_external_audit_event_destinations(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY description_versions
ADD CONSTRAINT fk_rails_e8f4caf9c7 FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE;
@@ -35024,9 +35252,6 @@ ALTER TABLE ONLY customer_relations_contacts
ALTER TABLE ONLY external_approval_rules
ADD CONSTRAINT fk_rails_fd4f9ac573 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
-ALTER TABLE ONLY experiment_users
- ADD CONSTRAINT fk_rails_fd805f771a FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY cluster_groups
ADD CONSTRAINT fk_rails_fdb8648a96 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;