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:
Diffstat (limited to 'db')
-rw-r--r--db/docs/application_setting_terms.yml2
-rw-r--r--db/docs/atlassian_identities.yml2
-rw-r--r--db/docs/authentication_events.yml2
-rw-r--r--db/docs/banned_users.yml2
-rw-r--r--db/docs/bulk_import_batch_trackers.yml11
-rw-r--r--db/docs/bulk_import_export_batches.yml11
-rw-r--r--db/docs/catalog_resources.yml8
-rw-r--r--db/docs/ci_build_needs.yml2
-rw-r--r--db/docs/ci_cost_settings.yml10
-rw-r--r--db/docs/ci_group_variables.yml2
-rw-r--r--db/docs/ci_instance_variables.yml2
-rw-r--r--db/docs/ci_job_variables.yml2
-rw-r--r--db/docs/ci_pipeline_variables.yml2
-rw-r--r--db/docs/ci_secure_file_states.yml2
-rw-r--r--db/docs/ci_secure_files.yml2
-rw-r--r--db/docs/ci_sources_pipelines.yml2
-rw-r--r--db/docs/ci_variables.yml2
-rw-r--r--db/docs/clusters_applications_crossplane.yml2
-rw-r--r--db/docs/clusters_applications_prometheus.yml2
-rw-r--r--db/docs/container_registry_data_repair_details.yml10
-rw-r--r--db/docs/container_repository_states.yml11
-rw-r--r--db/docs/deleted_tables/airflow_dags.yml (renamed from db/docs/airflow_dags.yml)2
-rw-r--r--db/docs/elastic_reindexing_slices.yml2
-rw-r--r--db/docs/elasticsearch_indexed_projects.yml2
-rw-r--r--db/docs/group_group_links.yml2
-rw-r--r--db/docs/identities.yml2
-rw-r--r--db/docs/integrations.yml2
-rw-r--r--db/docs/ip_restrictions.yml2
-rw-r--r--db/docs/keys.yml2
-rw-r--r--db/docs/ldap_group_links.yml2
-rw-r--r--db/docs/namespace_admin_notes.yml2
-rw-r--r--db/docs/namespace_ldap_settings.yml10
-rw-r--r--db/docs/oauth_access_grants.yml2
-rw-r--r--db/docs/oauth_access_tokens.yml2
-rw-r--r--db/docs/oauth_applications.yml2
-rw-r--r--db/docs/oauth_openid_requests.yml2
-rw-r--r--db/docs/p_ci_runner_machine_builds.yml9
-rw-r--r--db/docs/personal_access_tokens.yml2
-rw-r--r--db/docs/postgres_async_foreign_key_validations.yml2
-rw-r--r--db/docs/project_access_tokens.yml2
-rw-r--r--db/docs/project_authorizations.yml2
-rw-r--r--db/docs/project_group_links.yml2
-rw-r--r--db/docs/saml_group_links.yml2
-rw-r--r--db/docs/saml_providers.yml2
-rw-r--r--db/docs/scim_identities.yml2
-rw-r--r--db/docs/scim_oauth_access_tokens.yml2
-rw-r--r--db/docs/serverless_domain_cluster.yml2
-rw-r--r--db/docs/service_desk_custom_email_verifications.yml11
-rw-r--r--db/docs/smartcard_identities.yml2
-rw-r--r--db/docs/term_agreements.yml2
-rw-r--r--db/docs/token_with_ivs.yml2
-rw-r--r--db/docs/u2f_registrations.yml2
-rw-r--r--db/docs/user_canonical_emails.yml2
-rw-r--r--db/docs/user_highest_roles.yml2
-rw-r--r--db/docs/user_permission_export_uploads.yml2
-rw-r--r--db/docs/user_synced_attributes_metadata.yml2
-rw-r--r--db/docs/webauthn_registrations.yml2
-rw-r--r--db/docs/work_item_types.yml1
-rw-r--r--db/docs/work_item_widget_definitions.yml1
-rw-r--r--db/fixtures/development/17_cycle_analytics.rb59
-rw-r--r--db/fixtures/development/36_achievements.rb68
-rw-r--r--db/fixtures/development/heart.pngbin0 -> 22484 bytes
-rw-r--r--db/fixtures/development/rocket.jpgbin0 -> 28042 bytes
-rw-r--r--db/migrate/20230113164245_create_namespace_ldap_settings.rb16
-rw-r--r--db/migrate/20230118135145_add_service_desk_custom_email_verifications.rb24
-rw-r--r--db/migrate/20230127030015_add_deny_all_outgoing_requests_to_application_settings.rb9
-rw-r--r--db/migrate/20230127155217_add_id_column_to_package_metadata_join_table.rb56
-rw-r--r--db/migrate/20230201165656_create_container_repository_states.rb44
-rw-r--r--db/migrate/20230202094723_add_default_syntax_highlighting_theme_to_application_settings.rb7
-rw-r--r--db/migrate/20230210152109_add_bulk_import_export_batches.rb21
-rw-r--r--db/migrate/20230210153420_add_batched_column_to_bulk_import_exports.rb9
-rw-r--r--db/migrate/20230210155715_add_batch_id_to_bulk_import_export_uploads.rb7
-rw-r--r--db/migrate/20230210160037_add_batch_foreign_key_to_bulk_import_export_uploads.rb15
-rw-r--r--db/migrate/20230210160351_add_bulk_import_batch_trackers.rb22
-rw-r--r--db/migrate/20230210161002_add_batched_column_to_bulk_import_trackers.rb7
-rw-r--r--db/migrate/20230210171012_add_batch_id_index_to_bulk_import_export_uploads.rb15
-rw-r--r--db/migrate/20230213213559_add_index_on_project_id_and_scanner_id_and_vulnerability_id_on_vulnerability_reads.rb15
-rw-r--r--db/migrate/20230215074223_add_ci_runner_machine_builds_partitioned_table.rb30
-rw-r--r--db/migrate/20230215124011_add_provisioned_by_group_at_to_user_details.rb9
-rw-r--r--db/migrate/20230215131026_add_has_failures_column_to_bulk_imports.rb7
-rw-r--r--db/migrate/20230215180605_index_sbom_occurrences_on_project_id_and_id.rb15
-rw-r--r--db/migrate/20230216040505_add_status_and_resolved_at_to_abuse_reports.rb8
-rw-r--r--db/migrate/20230216071312_add_status_category_and_id_index_to_abuse_reports.rb15
-rw-r--r--db/migrate/20230216142836_update_vulnerability_reads_trigger_to_set_has_issue.rb185
-rw-r--r--db/migrate/20230216144719_drop_table_airflow_dags.rb22
-rw-r--r--db/migrate/20230216152912_add_has_failures_column_to_bulk_import_entities.rb7
-rw-r--r--db/migrate/20230216171309_create_ci_runner_cost_settings.rb17
-rw-r--r--db/migrate/20230217065736_add_projects_api_rate_limit_unauthenticated_to_application_settings.rb7
-rw-r--r--db/migrate/20230217144421_add_check_type_to_pre_scan_step.rb11
-rw-r--r--db/migrate/20230217232554_add_state_changed_in_to_vulnerability_state_transitions.rb11
-rw-r--r--db/migrate/20230220035034_add_status_and_id_index_to_abuse_reports.rb15
-rw-r--r--db/migrate/20230220163141_create_catalog_resources_table.rb11
-rw-r--r--db/migrate/20230221110256_create_initial_partition_for_ci_runner_machine_builds.rb49
-rw-r--r--db/migrate/20230222153048_add_registry_size_estimated_to_namespace_root_storage_statistics.rb21
-rw-r--r--db/migrate/20230222193845_change_public_projects_minutes_cost_factor_default_to_1.rb17
-rw-r--r--db/migrate/20230224130315_add_constraint_type_to_postgres_async_constraint_validation.rb7
-rw-r--r--db/migrate/20230224161346_add_saml_group_lock_to_application_settings.rb7
-rw-r--r--db/migrate/20230228092612_add_index_next_over_limit_check_at_asc_order_synchronously.rb17
-rw-r--r--db/migrate/20230228133011_add_design_description.rb18
-rw-r--r--db/migrate/20230228135034_add_design_description_limit.rb13
-rw-r--r--db/migrate/20230228142350_add_notifications_work_item_widget.rb57
-rw-r--r--db/migrate/20230228212427_add_index_user_details_on_user_id_for_enterprise_users_without_date.rb19
-rw-r--r--db/migrate/20230228212905_add_index_user_details_on_user_id_for_enterprise_users_with_date.rb19
-rw-r--r--db/migrate/20230303144424_unique_index_on_catalog_resources_project.rb17
-rw-r--r--db/migrate/20230306145230_add_product_analytics_data_collector_host_to_application_settings.rb9
-rw-r--r--db/migrate/20230307091216_add_status_reporter_id_and_id_index_to_abuse_reports.rb15
-rw-r--r--db/migrate/20230307122838_add_text_limit_to_application_settings_product_analytics_data_collector_host.rb13
-rw-r--r--db/migrate/20230307233631_add_public_runner_release_version_fetch_setting.rb14
-rw-r--r--db/migrate/20230308163018_create_container_registry_data_repair_details.rb17
-rw-r--r--db/migrate/20230309000957_add_external_identifiers_to_import_failures.rb9
-rw-r--r--db/migrate/20230313054226_add_status_created_at_and_updated_at_indexes_to_abuse_reports.rb18
-rw-r--r--db/migrate/20230313100920_add_gitlab_dedicated_instance_to_application_settings.rb9
-rw-r--r--db/post_migrate/20230113201308_backfill_namespace_ldap_settings.rb33
-rw-r--r--db/post_migrate/20230118144623_schedule_migration_for_remediation.rb18
-rw-r--r--db/post_migrate/20230125195503_queue_backfill_compliance_violations.rb24
-rw-r--r--db/post_migrate/20230126101907_add_partition_index_to_web_hook_logs.rb21
-rw-r--r--db/post_migrate/20230130182412_schedule_create_vulnerability_links_migration.rb27
-rw-r--r--db/post_migrate/20230131184319_update_billable_users_index_for_service_accounts.rb27
-rw-r--r--db/post_migrate/20230202135758_queue_backfill_prepared_at_data.rb23
-rw-r--r--db/post_migrate/20230202211434_migrate_redis_slot_keys.rb113
-rw-r--r--db/post_migrate/20230208125736_schedule_migration_for_links.rb25
-rw-r--r--db/post_migrate/20230213103019_add_index_for_next_over_limit_check_at.rb17
-rw-r--r--db/post_migrate/20230214181633_finalize_ci_build_needs_big_int_conversion.rb28
-rw-r--r--db/post_migrate/20230215213349_add_sync_index_on_packages_package_file_filename.rb21
-rw-r--r--db/post_migrate/20230216060333_prepare_async_foreign_key_validation_for_ci_build_trace_metadata.rb15
-rw-r--r--db/post_migrate/20230216191507_delete_incorrectly_onboarded_namespaces.rb17
-rw-r--r--db/post_migrate/20230216222956_add_sync_index_on_lfs_objects_file.rb15
-rw-r--r--db/post_migrate/20230216232404_add_sync_index_on_merge_request_diffs_external_diff.rb15
-rw-r--r--db/post_migrate/20230216233937_remove_application_settings_send_user_confirmation_email_column.rb7
-rw-r--r--db/post_migrate/20230218145930_add_index_users_on_updated_at.rb16
-rw-r--r--db/post_migrate/20230218145940_add_index_namespaces_on_updated_at.rb16
-rw-r--r--db/post_migrate/20230218152729_validate_fk_on_ci_job_artifacts_partition_id_and_job_id.rb15
-rw-r--r--db/post_migrate/20230218152730_remove_fk_to_ci_builds_ci_job_artifacts_on_job_id.rb35
-rw-r--r--db/post_migrate/20230219191034_add_pipeline_fk_to_vulnerability_state_transitions.rb15
-rw-r--r--db/post_migrate/20230220102212_swap_columns_ci_build_needs_big_int_conversion.rb57
-rw-r--r--db/post_migrate/20230220112930_replace_uniq_index_on_postgres_async_foreign_key_validations.rb19
-rw-r--r--db/post_migrate/20230220132409_validate_fk_on_ci_build_report_results_partition_id_and_build_id.rb15
-rw-r--r--db/post_migrate/20230220132410_remove_fk_to_ci_builds_ci_build_report_results_on_build_id.rb35
-rw-r--r--db/post_migrate/20230220134145_validate_fk_on_ci_build_needs_partition_id_and_build_id.rb15
-rw-r--r--db/post_migrate/20230220134146_remove_fk_to_ci_builds_ci_build_needs_on_build_id.rb35
-rw-r--r--db/post_migrate/20230220165240_add_index_to_approval_rules_on_scan_result_policy_id.rb19
-rw-r--r--db/post_migrate/20230221010522_prepare_async_foreign_key_validation_for_ci_sources_pipelines.rb15
-rw-r--r--db/post_migrate/20230221011750_prepare_async_foreign_key_validation_for_ci_job_variables.rb15
-rw-r--r--db/post_migrate/20230221093533_add_tmp_partial_index_on_vulnerability_report_types.rb15
-rw-r--r--db/post_migrate/20230221125148_add_fk_to_p_ci_builds_metadata_partitions_on_partition_id_and_build_id.rb41
-rw-r--r--db/post_migrate/20230221162222_raise_ci_variable_limits_on_gitlab_com.rb53
-rw-r--r--db/post_migrate/20230221214519_remove_incorrectly_onboarded_namespaces_from_onboarding_progress.rb29
-rw-r--r--db/post_migrate/20230222035805_prepare_async_index_removal_of_token_for_ci_builds.rb17
-rw-r--r--db/post_migrate/20230222055510_remove_concurrent_index_on_token_encrypted_for_ci_builds.rb18
-rw-r--r--db/post_migrate/20230222101420_remove_fk_to_ci_build_ci_pending_build_on_build_id.rb35
-rw-r--r--db/post_migrate/20230222102421_remove_fk_to_ci_build_ci_running_build_on_build_id.rb35
-rw-r--r--db/post_migrate/20230223014251_validate_not_null_constraint_on_oauth_access_tokens_expires_in.rb13
-rw-r--r--db/post_migrate/20230223065753_finalize_nullify_creator_id_of_orphaned_projects.rb22
-rw-r--r--db/post_migrate/20230223082752_schedule_fk_validation_for_p_ci_builds_metadata_partitions_and_ci_builds.rb17
-rw-r--r--db/post_migrate/20230223093704_add_foreign_key_on_creator_id_on_projects.rb15
-rw-r--r--db/post_migrate/20230224085743_update_issues_internal_id_scope.rb29
-rw-r--r--db/post_migrate/20230224144233_migrate_evidences_from_raw_metadata.rb25
-rw-r--r--db/post_migrate/20230227123949_validate_fk_on_ci_sources_pipelines_source_partition_id_and_source_job_id.rb15
-rw-r--r--db/post_migrate/20230227123950_remove_fk_to_ci_builds_ci_sources_pipelines_on_source_job_id.rb35
-rw-r--r--db/post_migrate/20230227151608_validate_fk_on_ci_build_trace_metadata_partition_id_and_build_id.rb15
-rw-r--r--db/post_migrate/20230227151609_remove_fk_to_ci_builds_ci_build_trace_metadata_on_build_id.rb35
-rw-r--r--db/post_migrate/20230227153231_validate_fk_on_ci_job_variables_partition_id_and_job_id.rb15
-rw-r--r--db/post_migrate/20230227153232_remove_fk_to_ci_builds_ci_job_variables_on_job_id.rb35
-rw-r--r--db/post_migrate/20230228021910_ensure_timelogs_note_id_bigint_backfill_is_finished_for_gitlab_dot_com.rb29
-rw-r--r--db/post_migrate/20230228023014_swap_timelogs_note_id_to_bigint_for_gitlab_dot_com.rb56
-rw-r--r--db/post_migrate/20230301065107_add_index_on_expired_unlocked_non_trace_job_artifacts.rb17
-rw-r--r--db/post_migrate/20230302090155_add_async_index_on_unlocked_non_trace_job_artifacts_expire_at.rb15
-rw-r--r--db/post_migrate/20230302123258_drop_runner_machines_constraint_on_ci_builds_metadata.rb27
-rw-r--r--db/post_migrate/20230302123259_ensure_ci_runner_machines_is_empty.rb17
-rw-r--r--db/post_migrate/20230302123301_add_index_on_runner_machine_id_on_runner_machine_builds.rb17
-rw-r--r--db/post_migrate/20230302163339_add_index_to_oauth_access_grants_application_id.rb15
-rw-r--r--db/post_migrate/20230302185739_queue_fix_vulnerability_reads_has_issues.rb28
-rw-r--r--db/post_migrate/20230303105806_queue_delete_orphaned_packages_dependencies.rb26
-rw-r--r--db/post_migrate/20230303120531_schedule_temporary_partitioning_indexes_removal.rb32
-rw-r--r--db/post_migrate/20230303154314_add_user_type_migration_indexes.rb22
-rw-r--r--db/post_migrate/20230304184416_drop_revokable_from_achievements.rb9
-rw-r--r--db/post_migrate/20230306071456_validate_partitioning_fk_on_p_ci_builds_metadata_partitions.rb20
-rw-r--r--db/post_migrate/20230306072532_add_partitioned_fk_to_p_ci_builds_metadata_on_partition_id_and_build_id.rb36
-rw-r--r--db/post_migrate/20230306082852_remove_fk_to_ci_builds_p_ci_builds_metadata_on_build_id.rb32
-rw-r--r--db/post_migrate/20230306143322_prepare_ci_builds_primary_key_for_partitioning.rb66
-rw-r--r--db/post_migrate/20230306195007_queue_backfill_project_wiki_repositories.rb25
-rw-r--r--db/post_migrate/20230307085644_track_ci_runner_machine_record_changes.rb15
-rw-r--r--db/post_migrate/20230307160251_rename_constraint_fk_rails_f601258b28_on_events_table.rb19
-rw-r--r--db/post_migrate/20230309010000_add_unique_index_mr_user_mentions_note_id_convert_to_bigint.rb31
-rw-r--r--db/post_migrate/20230309010931_add_fk_on_mr_user_mentions_note_id_convert_to_id_bigint.rb43
-rw-r--r--db/post_migrate/20230309020422_validate_fk_on_mr_user_mentions_note_id_convert_to_id_bigint.rb27
-rw-r--r--db/post_migrate/20230309071242_delete_security_policy_bot_users.rb21
-rw-r--r--db/post_migrate/20230309103016_drop_id_partition_id_index_from_p_ci_build_metadata.rb18
-rw-r--r--db/post_migrate/20230310111859_recreate_user_type_migration_indexes.rb24
-rw-r--r--db/post_migrate/20230313133001_ensure_merge_request_metrics_id_bigint_backfill_is_finished_for_gitlab_dot_com.rb30
-rw-r--r--db/post_migrate/20230313143033_swap_merge_request_metrics_id_to_bigint_for_gitlab_dot_com.rb64
-rw-r--r--db/post_migrate/20230313150531_reschedule_migration_for_remediation.rb32
-rw-r--r--db/post_migrate/20230313184306_add_temp_index_for_software_license_cleanup.rb15
-rw-r--r--db/post_migrate/20230313185145_cleanup_orphan_software_licenses.rb27
-rw-r--r--db/post_migrate/20230316014650_remove_index_on_events_action_async.rb12
-rw-r--r--db/schema_migrations/202301131642451
-rw-r--r--db/schema_migrations/202301132013081
-rw-r--r--db/schema_migrations/202301181351451
-rw-r--r--db/schema_migrations/202301181446231
-rw-r--r--db/schema_migrations/202301251955031
-rw-r--r--db/schema_migrations/202301261019071
-rw-r--r--db/schema_migrations/202301270300151
-rw-r--r--db/schema_migrations/202301301824121
-rw-r--r--db/schema_migrations/202301311843191
-rw-r--r--db/schema_migrations/202302011656561
-rw-r--r--db/schema_migrations/202302020947231
-rw-r--r--db/schema_migrations/202302021357581
-rw-r--r--db/schema_migrations/202302022114341
-rw-r--r--db/schema_migrations/202302081257361
-rw-r--r--db/schema_migrations/202302101521091
-rw-r--r--db/schema_migrations/202302101534201
-rw-r--r--db/schema_migrations/202302101557151
-rw-r--r--db/schema_migrations/202302101600371
-rw-r--r--db/schema_migrations/202302101603511
-rw-r--r--db/schema_migrations/202302101610021
-rw-r--r--db/schema_migrations/202302101710121
-rw-r--r--db/schema_migrations/202302131030191
-rw-r--r--db/schema_migrations/202302132135591
-rw-r--r--db/schema_migrations/202302141816331
-rw-r--r--db/schema_migrations/202302150742231
-rw-r--r--db/schema_migrations/202302151240111
-rw-r--r--db/schema_migrations/202302151310261
-rw-r--r--db/schema_migrations/202302151806051
-rw-r--r--db/schema_migrations/202302152133491
-rw-r--r--db/schema_migrations/202302160405051
-rw-r--r--db/schema_migrations/202302160603331
-rw-r--r--db/schema_migrations/202302160713121
-rw-r--r--db/schema_migrations/202302161428361
-rw-r--r--db/schema_migrations/202302161447191
-rw-r--r--db/schema_migrations/202302161529121
-rw-r--r--db/schema_migrations/202302161713091
-rw-r--r--db/schema_migrations/202302161915071
-rw-r--r--db/schema_migrations/202302162229561
-rw-r--r--db/schema_migrations/202302162324041
-rw-r--r--db/schema_migrations/202302162339371
-rw-r--r--db/schema_migrations/202302170657361
-rw-r--r--db/schema_migrations/202302171444211
-rw-r--r--db/schema_migrations/202302172325541
-rw-r--r--db/schema_migrations/202302181459301
-rw-r--r--db/schema_migrations/202302181459401
-rw-r--r--db/schema_migrations/202302181527291
-rw-r--r--db/schema_migrations/202302181527301
-rw-r--r--db/schema_migrations/202302191910341
-rw-r--r--db/schema_migrations/202302200350341
-rw-r--r--db/schema_migrations/202302201022121
-rw-r--r--db/schema_migrations/202302201129301
-rw-r--r--db/schema_migrations/202302201324091
-rw-r--r--db/schema_migrations/202302201324101
-rw-r--r--db/schema_migrations/202302201341451
-rw-r--r--db/schema_migrations/202302201341461
-rw-r--r--db/schema_migrations/202302201631411
-rw-r--r--db/schema_migrations/202302201652401
-rw-r--r--db/schema_migrations/202302210105221
-rw-r--r--db/schema_migrations/202302210117501
-rw-r--r--db/schema_migrations/202302210935331
-rw-r--r--db/schema_migrations/202302211102561
-rw-r--r--db/schema_migrations/202302211251481
-rw-r--r--db/schema_migrations/202302211622221
-rw-r--r--db/schema_migrations/202302212145191
-rw-r--r--db/schema_migrations/202302220358051
-rw-r--r--db/schema_migrations/202302220555101
-rw-r--r--db/schema_migrations/202302221014201
-rw-r--r--db/schema_migrations/202302221024211
-rw-r--r--db/schema_migrations/202302221530481
-rw-r--r--db/schema_migrations/202302221938451
-rw-r--r--db/schema_migrations/202302230142511
-rw-r--r--db/schema_migrations/202302230657531
-rw-r--r--db/schema_migrations/202302230827521
-rw-r--r--db/schema_migrations/202302230937041
-rw-r--r--db/schema_migrations/202302240857431
-rw-r--r--db/schema_migrations/202302241303151
-rw-r--r--db/schema_migrations/202302241442331
-rw-r--r--db/schema_migrations/202302241613461
-rw-r--r--db/schema_migrations/202302271239491
-rw-r--r--db/schema_migrations/202302271239501
-rw-r--r--db/schema_migrations/202302271516081
-rw-r--r--db/schema_migrations/202302271516091
-rw-r--r--db/schema_migrations/202302271532311
-rw-r--r--db/schema_migrations/202302271532321
-rw-r--r--db/schema_migrations/202302280219101
-rw-r--r--db/schema_migrations/202302280230141
-rw-r--r--db/schema_migrations/202302280926121
-rw-r--r--db/schema_migrations/202302281330111
-rw-r--r--db/schema_migrations/202302281350341
-rw-r--r--db/schema_migrations/202302281423501
-rw-r--r--db/schema_migrations/202302282124271
-rw-r--r--db/schema_migrations/202302282129051
-rw-r--r--db/schema_migrations/202303010651071
-rw-r--r--db/schema_migrations/202303020901551
-rw-r--r--db/schema_migrations/202303021232581
-rw-r--r--db/schema_migrations/202303021232591
-rw-r--r--db/schema_migrations/202303021233011
-rw-r--r--db/schema_migrations/202303021633391
-rw-r--r--db/schema_migrations/202303021857391
-rw-r--r--db/schema_migrations/202303031058061
-rw-r--r--db/schema_migrations/202303031205311
-rw-r--r--db/schema_migrations/202303031444241
-rw-r--r--db/schema_migrations/202303031543141
-rw-r--r--db/schema_migrations/202303041844161
-rw-r--r--db/schema_migrations/202303060714561
-rw-r--r--db/schema_migrations/202303060725321
-rw-r--r--db/schema_migrations/202303060828521
-rw-r--r--db/schema_migrations/202303061433221
-rw-r--r--db/schema_migrations/202303061452301
-rw-r--r--db/schema_migrations/202303061950071
-rw-r--r--db/schema_migrations/202303070856441
-rw-r--r--db/schema_migrations/202303070912161
-rw-r--r--db/schema_migrations/202303071228381
-rw-r--r--db/schema_migrations/202303071602511
-rw-r--r--db/schema_migrations/202303072336311
-rw-r--r--db/schema_migrations/202303081630181
-rw-r--r--db/schema_migrations/202303090009571
-rw-r--r--db/schema_migrations/202303090100001
-rw-r--r--db/schema_migrations/202303090109311
-rw-r--r--db/schema_migrations/202303090204221
-rw-r--r--db/schema_migrations/202303090712421
-rw-r--r--db/schema_migrations/202303091030161
-rw-r--r--db/schema_migrations/202303101118591
-rw-r--r--db/schema_migrations/202303130542261
-rw-r--r--db/schema_migrations/202303131009201
-rw-r--r--db/schema_migrations/202303131330011
-rw-r--r--db/schema_migrations/202303131430331
-rw-r--r--db/schema_migrations/202303131505311
-rw-r--r--db/schema_migrations/202303131843061
-rw-r--r--db/schema_migrations/202303131851451
-rw-r--r--db/schema_migrations/202303160146501
-rw-r--r--db/structure.sql437
327 files changed, 3864 insertions, 171 deletions
diff --git a/db/docs/application_setting_terms.yml b/db/docs/application_setting_terms.yml
index 046231b13a4..d58d4d67569 100644
--- a/db/docs/application_setting_terms.yml
+++ b/db/docs/application_setting_terms.yml
@@ -3,7 +3,7 @@ table_name: application_setting_terms
classes:
- ApplicationSetting::Term
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/cf37bef287d7dd5d2dce3e2276489767b8c0671f
milestone: '10.8'
diff --git a/db/docs/atlassian_identities.yml b/db/docs/atlassian_identities.yml
index e43c8018d5c..e24c316c0f6 100644
--- a/db/docs/atlassian_identities.yml
+++ b/db/docs/atlassian_identities.yml
@@ -3,7 +3,7 @@ table_name: atlassian_identities
classes:
- Atlassian::Identity
feature_categories:
-- authentication_and_authorization
+- system_access
description: Stores Atlassian credentials that are used to integrate with Atlassian API
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40176
milestone: '13.4'
diff --git a/db/docs/authentication_events.yml b/db/docs/authentication_events.yml
index eaede3b7cd4..440ca695ad2 100644
--- a/db/docs/authentication_events.yml
+++ b/db/docs/authentication_events.yml
@@ -3,7 +3,7 @@ table_name: authentication_events
classes:
- AuthenticationEvent
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39652
milestone: '13.4'
diff --git a/db/docs/banned_users.yml b/db/docs/banned_users.yml
index d14b6d77234..33c5c9024cd 100644
--- a/db/docs/banned_users.yml
+++ b/db/docs/banned_users.yml
@@ -3,7 +3,7 @@ table_name: banned_users
classes:
- Users::BannedUser
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64728
milestone: '14.2'
diff --git a/db/docs/bulk_import_batch_trackers.yml b/db/docs/bulk_import_batch_trackers.yml
new file mode 100644
index 00000000000..6e6ee123588
--- /dev/null
+++ b/db/docs/bulk_import_batch_trackers.yml
@@ -0,0 +1,11 @@
+---
+table_name: bulk_import_batch_trackers
+classes:
+- BulkImports::BatchTracker
+feature_categories:
+- importers
+description: Used to store and track the import status of a batch of relations for the migration
+ of groups or projects
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111708
+milestone: '15.10'
+gitlab_schema: gitlab_main
diff --git a/db/docs/bulk_import_export_batches.yml b/db/docs/bulk_import_export_batches.yml
new file mode 100644
index 00000000000..8cbd032a23a
--- /dev/null
+++ b/db/docs/bulk_import_export_batches.yml
@@ -0,0 +1,11 @@
+---
+table_name: bulk_import_export_batches
+classes:
+- BulkImports::ExportBatch
+feature_categories:
+- importers
+description: Used to track the generation status of export batch files for groups
+ or projects
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111708
+milestone: '15.10'
+gitlab_schema: gitlab_main
diff --git a/db/docs/catalog_resources.yml b/db/docs/catalog_resources.yml
new file mode 100644
index 00000000000..5bc689c308e
--- /dev/null
+++ b/db/docs/catalog_resources.yml
@@ -0,0 +1,8 @@
+---
+table_name: catalog_resources
+feature_categories:
+- pipeline_composition
+description: Projects containing a catalog resource.
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/112482
+milestone: '15.10'
+gitlab_schema: gitlab_main
diff --git a/db/docs/ci_build_needs.yml b/db/docs/ci_build_needs.yml
index 7253e83601a..0a84efb5598 100644
--- a/db/docs/ci_build_needs.yml
+++ b/db/docs/ci_build_needs.yml
@@ -3,7 +3,7 @@ table_name: ci_build_needs
classes:
- Ci::BuildNeed
feature_categories:
-- pipeline_authoring
+- pipeline_composition
description: Dependencies for a specific CI/CD job.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/31328
milestone: '12.2'
diff --git a/db/docs/ci_cost_settings.yml b/db/docs/ci_cost_settings.yml
new file mode 100644
index 00000000000..3c5fc00cee0
--- /dev/null
+++ b/db/docs/ci_cost_settings.yml
@@ -0,0 +1,10 @@
+---
+table_name: ci_cost_settings
+classes:
+- Ci::Minutes::CostSetting
+feature_categories:
+- continuous_integration
+description: A set of cost factors per runner which are applied to ci job duration based on project type.
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111977
+milestone: '15.10'
+gitlab_schema: gitlab_ci
diff --git a/db/docs/ci_group_variables.yml b/db/docs/ci_group_variables.yml
index c504a601c4c..b98cbe92c83 100644
--- a/db/docs/ci_group_variables.yml
+++ b/db/docs/ci_group_variables.yml
@@ -3,7 +3,7 @@ table_name: ci_group_variables
classes:
- Ci::GroupVariable
feature_categories:
-- pipeline_authoring
+- pipeline_composition
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/5b0954759cc24bdba97be89bb117c5440174f859
milestone: '9.4'
diff --git a/db/docs/ci_instance_variables.yml b/db/docs/ci_instance_variables.yml
index c39fe03b993..297477de562 100644
--- a/db/docs/ci_instance_variables.yml
+++ b/db/docs/ci_instance_variables.yml
@@ -3,7 +3,7 @@ table_name: ci_instance_variables
classes:
- Ci::InstanceVariable
feature_categories:
-- pipeline_authoring
+- pipeline_composition
description: CI/CD variables available to all projects and groups in an instance.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/30156
milestone: '13.0'
diff --git a/db/docs/ci_job_variables.yml b/db/docs/ci_job_variables.yml
index 1cbabb4fcbb..4a933f65479 100644
--- a/db/docs/ci_job_variables.yml
+++ b/db/docs/ci_job_variables.yml
@@ -3,7 +3,7 @@ table_name: ci_job_variables
classes:
- Ci::JobVariable
feature_categories:
-- pipeline_authoring
+- pipeline_composition
description: CI/CD variables set to a job when running it manually.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/14784
milestone: '12.2'
diff --git a/db/docs/ci_pipeline_variables.yml b/db/docs/ci_pipeline_variables.yml
index aaf49b17c99..7e83009b3d8 100644
--- a/db/docs/ci_pipeline_variables.yml
+++ b/db/docs/ci_pipeline_variables.yml
@@ -3,7 +3,7 @@ table_name: ci_pipeline_variables
classes:
- Ci::PipelineVariable
feature_categories:
-- pipeline_authoring
+- pipeline_composition
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/56418e85ac6b667d19495665860092ce4d74f55d
milestone: '9.5'
diff --git a/db/docs/ci_secure_file_states.yml b/db/docs/ci_secure_file_states.yml
index 5734f040f2f..eacbea878e0 100644
--- a/db/docs/ci_secure_file_states.yml
+++ b/db/docs/ci_secure_file_states.yml
@@ -3,7 +3,7 @@ table_name: ci_secure_file_states
classes:
- Geo::CiSecureFileState
feature_categories:
-- pipeline_authoring
+- pipeline_composition
description: Stores verification state for Geo replicated Project-level Secure Files.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90510
milestone: '15.2'
diff --git a/db/docs/ci_secure_files.yml b/db/docs/ci_secure_files.yml
index 6124eeade28..198326a0e25 100644
--- a/db/docs/ci_secure_files.yml
+++ b/db/docs/ci_secure_files.yml
@@ -3,7 +3,7 @@ table_name: ci_secure_files
classes:
- Ci::SecureFile
feature_categories:
-- pipeline_authoring
+- pipeline_composition
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/77886
milestone: '14.7'
diff --git a/db/docs/ci_sources_pipelines.yml b/db/docs/ci_sources_pipelines.yml
index 7e0121ab66e..034c3bd7db7 100644
--- a/db/docs/ci_sources_pipelines.yml
+++ b/db/docs/ci_sources_pipelines.yml
@@ -3,7 +3,7 @@ table_name: ci_sources_pipelines
classes:
- Ci::Sources::Pipeline
feature_categories:
-- pipeline_authoring
+- pipeline_composition
description: It stores parent-child and cross-project pipeline relationships.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/163983e0d7d1dab622846441bd0dd9086c78a69f
milestone: '9.3'
diff --git a/db/docs/ci_variables.yml b/db/docs/ci_variables.yml
index bcb6b3f3753..e083217db13 100644
--- a/db/docs/ci_variables.yml
+++ b/db/docs/ci_variables.yml
@@ -3,7 +3,7 @@ table_name: ci_variables
classes:
- Ci::Variable
feature_categories:
-- pipeline_authoring
+- pipeline_composition
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/046b28312704f3131e72dcd2dbdacc5264d4aa62
milestone: '8.0'
diff --git a/db/docs/clusters_applications_crossplane.yml b/db/docs/clusters_applications_crossplane.yml
index f633f746e70..c440eb2487b 100644
--- a/db/docs/clusters_applications_crossplane.yml
+++ b/db/docs/clusters_applications_crossplane.yml
@@ -1,7 +1,5 @@
---
table_name: clusters_applications_crossplane
-classes:
-- Clusters::Applications::Crossplane
feature_categories:
- kubernetes_management
description: "(Deprecated) A GitLab managed Crossplane installation in a Kubernetes cluster"
diff --git a/db/docs/clusters_applications_prometheus.yml b/db/docs/clusters_applications_prometheus.yml
index 9b99ffba5db..3c36d953726 100644
--- a/db/docs/clusters_applications_prometheus.yml
+++ b/db/docs/clusters_applications_prometheus.yml
@@ -1,7 +1,5 @@
---
table_name: clusters_applications_prometheus
-classes:
-- Clusters::Applications::Prometheus
feature_categories:
- kubernetes_management
description: Information about installed instance of Prometheus in the cluster
diff --git a/db/docs/container_registry_data_repair_details.yml b/db/docs/container_registry_data_repair_details.yml
new file mode 100644
index 00000000000..c258fff4832
--- /dev/null
+++ b/db/docs/container_registry_data_repair_details.yml
@@ -0,0 +1,10 @@
+---
+table_name: container_registry_data_repair_details
+classes:
+- ContainerRegistry::DataRepairDetail
+feature_categories:
+- container_registry
+description: Contains details for the container registry data repair
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/113029
+milestone: '15.10'
+gitlab_schema: gitlab_main
diff --git a/db/docs/container_repository_states.yml b/db/docs/container_repository_states.yml
new file mode 100644
index 00000000000..300bf7bdd41
--- /dev/null
+++ b/db/docs/container_repository_states.yml
@@ -0,0 +1,11 @@
+---
+table_name: container_repository_states
+description: Checksum states of container repositories for Geo verification
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111077
+milestone: 15.10
+classes:
+- Geo::ContainerRepositoryState
+feature_categories:
+- geo_replication
+gitlab_schema: gitlab_main
+
diff --git a/db/docs/airflow_dags.yml b/db/docs/deleted_tables/airflow_dags.yml
index 6ed6c9753a8..4942e71d3bf 100644
--- a/db/docs/airflow_dags.yml
+++ b/db/docs/deleted_tables/airflow_dags.yml
@@ -8,3 +8,5 @@ description: An Airflow DAG is a record of the current status of a DAG from an A
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/108900
milestone: '15.9'
gitlab_schema: gitlab_main
+removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/112192
+removed_in_milestone: '15.10'
diff --git a/db/docs/elastic_reindexing_slices.yml b/db/docs/elastic_reindexing_slices.yml
index 84e42b16d57..9b8cc69e73b 100644
--- a/db/docs/elastic_reindexing_slices.yml
+++ b/db/docs/elastic_reindexing_slices.yml
@@ -3,7 +3,7 @@ table_name: elastic_reindexing_slices
classes:
- Elastic::ReindexingSlice
feature_categories:
-- application_performance
+- global_search
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55681
milestone: '13.12'
diff --git a/db/docs/elasticsearch_indexed_projects.yml b/db/docs/elasticsearch_indexed_projects.yml
index 17e2e116fdd..17fc5d0f779 100644
--- a/db/docs/elasticsearch_indexed_projects.yml
+++ b/db/docs/elasticsearch_indexed_projects.yml
@@ -3,7 +3,7 @@ table_name: elasticsearch_indexed_projects
classes:
- ElasticsearchIndexedProject
feature_categories:
-- application_performance
+- global_search
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/9861
milestone: '11.10'
diff --git a/db/docs/group_group_links.yml b/db/docs/group_group_links.yml
index f1541871795..1fa70ec02a6 100644
--- a/db/docs/group_group_links.yml
+++ b/db/docs/group_group_links.yml
@@ -3,7 +3,7 @@ table_name: group_group_links
classes:
- GroupGroupLink
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/17117
milestone: '12.5'
diff --git a/db/docs/identities.yml b/db/docs/identities.yml
index 149907a419e..f2790c53466 100644
--- a/db/docs/identities.yml
+++ b/db/docs/identities.yml
@@ -3,7 +3,7 @@ table_name: identities
classes:
- Identity
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/1a80d13a3990937580c97e2b0ba8fb98f69bc055
milestone: '7.6'
diff --git a/db/docs/integrations.yml b/db/docs/integrations.yml
index 5bb4f448541..91675f8de35 100644
--- a/db/docs/integrations.yml
+++ b/db/docs/integrations.yml
@@ -26,6 +26,7 @@ classes:
- Integrations::ExternalWiki
- Integrations::Github
- Integrations::GitlabSlackApplication
+- Integrations::GooglePlay
- Integrations::HangoutsChat
- Integrations::Harbor
- Integrations::Irker
@@ -46,6 +47,7 @@ classes:
- Integrations::Shimo
- Integrations::Slack
- Integrations::SlackSlashCommands
+- Integrations::SquashTm
- Integrations::Teamcity
- Integrations::UnifyCircuit
- Integrations::WebexTeams
diff --git a/db/docs/ip_restrictions.yml b/db/docs/ip_restrictions.yml
index 93f0da0505a..fbf90135d0a 100644
--- a/db/docs/ip_restrictions.yml
+++ b/db/docs/ip_restrictions.yml
@@ -3,7 +3,7 @@ table_name: ip_restrictions
classes:
- IpRestriction
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/12669
milestone: '12.0'
diff --git a/db/docs/keys.yml b/db/docs/keys.yml
index 4e626b1465c..41f6786a6cc 100644
--- a/db/docs/keys.yml
+++ b/db/docs/keys.yml
@@ -5,7 +5,7 @@ classes:
- Key
- LDAPKey
feature_categories:
-- authentication_and_authorization
+- system_access
- continuous_delivery
description: SSH keys used by users or for deployments.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/9ba1224867665844b117fa037e1465bb706b3685
diff --git a/db/docs/ldap_group_links.yml b/db/docs/ldap_group_links.yml
index d9a1b0acca5..74cc1a13d69 100644
--- a/db/docs/ldap_group_links.yml
+++ b/db/docs/ldap_group_links.yml
@@ -3,7 +3,7 @@ table_name: ldap_group_links
classes:
- LdapGroupLink
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/b017947ac91655f8ae6593fb63c3423cd1b439f4
milestone: '7.3'
diff --git a/db/docs/namespace_admin_notes.yml b/db/docs/namespace_admin_notes.yml
index 6d6710f7ee4..50ca72b270c 100644
--- a/db/docs/namespace_admin_notes.yml
+++ b/db/docs/namespace_admin_notes.yml
@@ -3,7 +3,7 @@ table_name: namespace_admin_notes
classes:
- Namespace::AdminNote
feature_categories:
-- authentication_and_authorization
+- system_access
- subgroups
description: Contains notes about groups that are visible to server administrators.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47825
diff --git a/db/docs/namespace_ldap_settings.yml b/db/docs/namespace_ldap_settings.yml
new file mode 100644
index 00000000000..e2ebbf54fde
--- /dev/null
+++ b/db/docs/namespace_ldap_settings.yml
@@ -0,0 +1,10 @@
+---
+table_name: namespace_ldap_settings
+classes:
+ - Namespaces::LdapSetting
+feature_categories:
+ - system_access
+description: Used to store LDAP settings for namespaces
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/108908
+milestone: '15.10'
+gitlab_schema: gitlab_main
diff --git a/db/docs/oauth_access_grants.yml b/db/docs/oauth_access_grants.yml
index 197d4fc59bd..8339863cca7 100644
--- a/db/docs/oauth_access_grants.yml
+++ b/db/docs/oauth_access_grants.yml
@@ -4,7 +4,7 @@ classes:
- Doorkeeper::AccessGrant
- OauthAccessGrant
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/e41dadcb33fda44ee274daa673bd933e13aa90eb
milestone: '7.7'
diff --git a/db/docs/oauth_access_tokens.yml b/db/docs/oauth_access_tokens.yml
index f409762f483..4f68fe5b6c6 100644
--- a/db/docs/oauth_access_tokens.yml
+++ b/db/docs/oauth_access_tokens.yml
@@ -4,7 +4,7 @@ classes:
- Doorkeeper::AccessToken
- OauthAccessToken
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/e41dadcb33fda44ee274daa673bd933e13aa90eb
milestone: '7.7'
diff --git a/db/docs/oauth_applications.yml b/db/docs/oauth_applications.yml
index ac13ab3319a..e24578c3272 100644
--- a/db/docs/oauth_applications.yml
+++ b/db/docs/oauth_applications.yml
@@ -3,7 +3,7 @@ table_name: oauth_applications
classes:
- Doorkeeper::Application
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/e41dadcb33fda44ee274daa673bd933e13aa90eb
milestone: '7.7'
diff --git a/db/docs/oauth_openid_requests.yml b/db/docs/oauth_openid_requests.yml
index 011b91a758a..59de50597c3 100644
--- a/db/docs/oauth_openid_requests.yml
+++ b/db/docs/oauth_openid_requests.yml
@@ -3,7 +3,7 @@ table_name: oauth_openid_requests
classes:
- Doorkeeper::OpenidConnect::Request
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/c4982890489d254da2fe998aab30bf257767ed5e
milestone: '9.0'
diff --git a/db/docs/p_ci_runner_machine_builds.yml b/db/docs/p_ci_runner_machine_builds.yml
new file mode 100644
index 00000000000..8ffac67fb94
--- /dev/null
+++ b/db/docs/p_ci_runner_machine_builds.yml
@@ -0,0 +1,9 @@
+table_name: p_ci_runner_machine_builds
+classes:
+- Ci::RunnerMachineBuild
+feature_categories:
+- runner_fleet
+description: Relationships between builds and runner machines
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111476
+milestone: '15.9'
+gitlab_schema: gitlab_ci
diff --git a/db/docs/personal_access_tokens.yml b/db/docs/personal_access_tokens.yml
index 8241f4234d8..2739db8371f 100644
--- a/db/docs/personal_access_tokens.yml
+++ b/db/docs/personal_access_tokens.yml
@@ -3,7 +3,7 @@ table_name: personal_access_tokens
classes:
- PersonalAccessToken
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/3a609038748055a27c7e01cf4b55d8249709c9cc
milestone: '8.9'
diff --git a/db/docs/postgres_async_foreign_key_validations.yml b/db/docs/postgres_async_foreign_key_validations.yml
index 0b9608a3ace..587dd7d69a2 100644
--- a/db/docs/postgres_async_foreign_key_validations.yml
+++ b/db/docs/postgres_async_foreign_key_validations.yml
@@ -1,7 +1,7 @@
---
table_name: postgres_async_foreign_key_validations
classes:
-- Gitlab::Database::AsyncForeignKeys::PostgresAsyncForeignKeyValidation
+- Gitlab::Database::AsyncConstraints::PostgresAsyncConstraintValidation
feature_categories:
- database
description: >-
diff --git a/db/docs/project_access_tokens.yml b/db/docs/project_access_tokens.yml
index ddaca744571..3c19e4dc19f 100644
--- a/db/docs/project_access_tokens.yml
+++ b/db/docs/project_access_tokens.yml
@@ -2,7 +2,7 @@
table_name: project_access_tokens
classes: []
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/33272
milestone: '13.1'
diff --git a/db/docs/project_authorizations.yml b/db/docs/project_authorizations.yml
index b37634047f0..b81235d4aac 100644
--- a/db/docs/project_authorizations.yml
+++ b/db/docs/project_authorizations.yml
@@ -4,7 +4,7 @@ classes:
- ProjectAuthorization
feature_categories:
- projects
-- authentication_and_authorization
+- system_access
description: Stores maximal access to the project per user
introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/6839
milestone: '8.14'
diff --git a/db/docs/project_group_links.yml b/db/docs/project_group_links.yml
index c03141058b6..aa981adb745 100644
--- a/db/docs/project_group_links.yml
+++ b/db/docs/project_group_links.yml
@@ -3,7 +3,7 @@ table_name: project_group_links
classes:
- ProjectGroupLink
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/3ac5a759e93e632539438d4564582c645a9f6799
milestone: "<6.0"
diff --git a/db/docs/saml_group_links.yml b/db/docs/saml_group_links.yml
index 5fd2372a22d..4dfb33e37a5 100644
--- a/db/docs/saml_group_links.yml
+++ b/db/docs/saml_group_links.yml
@@ -3,7 +3,7 @@ table_name: saml_group_links
classes:
- SamlGroupLink
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45061
milestone: '13.5'
diff --git a/db/docs/saml_providers.yml b/db/docs/saml_providers.yml
index 6fcc0e0e370..21ef2ed3a26 100644
--- a/db/docs/saml_providers.yml
+++ b/db/docs/saml_providers.yml
@@ -3,7 +3,7 @@ table_name: saml_providers
classes:
- SamlProvider
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/4549
milestone: '10.7'
diff --git a/db/docs/scim_identities.yml b/db/docs/scim_identities.yml
index 6ad69d9b4cc..16fec8da041 100644
--- a/db/docs/scim_identities.yml
+++ b/db/docs/scim_identities.yml
@@ -3,7 +3,7 @@ table_name: scim_identities
classes:
- ScimIdentity
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/26124
milestone: '12.9'
diff --git a/db/docs/scim_oauth_access_tokens.yml b/db/docs/scim_oauth_access_tokens.yml
index e26cd94f4cd..addd4c49ed5 100644
--- a/db/docs/scim_oauth_access_tokens.yml
+++ b/db/docs/scim_oauth_access_tokens.yml
@@ -3,7 +3,7 @@ table_name: scim_oauth_access_tokens
classes:
- ScimOauthAccessToken
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/e9b2253fe3538234d1c4d173c4549a955233d836
milestone: '11.10'
diff --git a/db/docs/serverless_domain_cluster.yml b/db/docs/serverless_domain_cluster.yml
index 23c77b2c043..72b231171ba 100644
--- a/db/docs/serverless_domain_cluster.yml
+++ b/db/docs/serverless_domain_cluster.yml
@@ -1,7 +1,5 @@
---
table_name: serverless_domain_cluster
-classes:
-- Serverless::DomainCluster
feature_categories:
- kubernetes_management
description: "(Deprecated) A custom domain for a GitLab managed Knative installation"
diff --git a/db/docs/service_desk_custom_email_verifications.yml b/db/docs/service_desk_custom_email_verifications.yml
new file mode 100644
index 00000000000..cec5db374d9
--- /dev/null
+++ b/db/docs/service_desk_custom_email_verifications.yml
@@ -0,0 +1,11 @@
+---
+table_name: service_desk_custom_email_verifications
+classes:
+- ServiceDesk::CustomEmailVerification
+feature_categories:
+- service_desk
+description: Holds the verification state and additional information for custom email
+ addresses for Service Desk
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/112938
+milestone: '15.10'
+gitlab_schema: gitlab_main
diff --git a/db/docs/smartcard_identities.yml b/db/docs/smartcard_identities.yml
index 76b8d1a1368..905811768c1 100644
--- a/db/docs/smartcard_identities.yml
+++ b/db/docs/smartcard_identities.yml
@@ -3,7 +3,7 @@ table_name: smartcard_identities
classes:
- SmartcardIdentity
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/b6316689fdc2d142af85b17d511d39e50712b420
milestone: '11.6'
diff --git a/db/docs/term_agreements.yml b/db/docs/term_agreements.yml
index 502adad8ac0..bc2abea809e 100644
--- a/db/docs/term_agreements.yml
+++ b/db/docs/term_agreements.yml
@@ -3,7 +3,7 @@ table_name: term_agreements
classes:
- TermAgreement
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/82eeb72c8c03727540b902d40e7e657d0a5ecb4c
milestone: '10.8'
diff --git a/db/docs/token_with_ivs.yml b/db/docs/token_with_ivs.yml
index 2acdff0dad1..521e26baac0 100644
--- a/db/docs/token_with_ivs.yml
+++ b/db/docs/token_with_ivs.yml
@@ -3,7 +3,7 @@ table_name: token_with_ivs
classes:
- TokenWithIv
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/37b80b4048190c2e1a35ec399e4aeb35d511090e
milestone: '13.9'
diff --git a/db/docs/u2f_registrations.yml b/db/docs/u2f_registrations.yml
index 27b0ca3f2f5..b1aaa8148bd 100644
--- a/db/docs/u2f_registrations.yml
+++ b/db/docs/u2f_registrations.yml
@@ -3,7 +3,7 @@ table_name: u2f_registrations
classes:
- U2fRegistration
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/791cc9138be6ea1783e3c3853370cf0290f4d41e
milestone: '8.9'
diff --git a/db/docs/user_canonical_emails.yml b/db/docs/user_canonical_emails.yml
index aeb1c3d830f..df3240b52fa 100644
--- a/db/docs/user_canonical_emails.yml
+++ b/db/docs/user_canonical_emails.yml
@@ -3,7 +3,7 @@ table_name: user_canonical_emails
classes:
- UserCanonicalEmail
feature_categories:
-- authentication_and_authorization
+- system_access
description: stores the canonical version of user's primary email address
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27722
milestone: '13.0'
diff --git a/db/docs/user_highest_roles.yml b/db/docs/user_highest_roles.yml
index cc12e3080ff..cfe4c2e5ce0 100644
--- a/db/docs/user_highest_roles.yml
+++ b/db/docs/user_highest_roles.yml
@@ -3,7 +3,7 @@ table_name: user_highest_roles
classes:
- UserHighestRole
feature_categories:
-- authentication_and_authorization
+- system_access
description: Stores highest role per User they have in a Group or a Project. If a User has an open invite or pending access request or no membership the highest role will be set to nil.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/26987
milestone: '12.9'
diff --git a/db/docs/user_permission_export_uploads.yml b/db/docs/user_permission_export_uploads.yml
index 217ede5bad2..fe76f1fa618 100644
--- a/db/docs/user_permission_export_uploads.yml
+++ b/db/docs/user_permission_export_uploads.yml
@@ -3,7 +3,7 @@ table_name: user_permission_export_uploads
classes:
- UserPermissionExportUpload
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47846
milestone: '13.7'
diff --git a/db/docs/user_synced_attributes_metadata.yml b/db/docs/user_synced_attributes_metadata.yml
index efc0ad1ec95..a2162c071c9 100644
--- a/db/docs/user_synced_attributes_metadata.yml
+++ b/db/docs/user_synced_attributes_metadata.yml
@@ -3,7 +3,7 @@ table_name: user_synced_attributes_metadata
classes:
- UserSyncedAttributesMetadata
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/4df54f260751a832ebf0b8c18524020d6604994b
milestone: '10.0'
diff --git a/db/docs/webauthn_registrations.yml b/db/docs/webauthn_registrations.yml
index fc983ea60ca..1ec27e1bb3b 100644
--- a/db/docs/webauthn_registrations.yml
+++ b/db/docs/webauthn_registrations.yml
@@ -3,7 +3,7 @@ table_name: webauthn_registrations
classes:
- WebauthnRegistration
feature_categories:
-- authentication_and_authorization
+- system_access
description: TODO
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/35797
milestone: '13.2'
diff --git a/db/docs/work_item_types.yml b/db/docs/work_item_types.yml
index 37d2c47de25..9c3da6a1b9d 100644
--- a/db/docs/work_item_types.yml
+++ b/db/docs/work_item_types.yml
@@ -1,6 +1,7 @@
---
table_name: work_item_types
classes:
+- AddNotificationsWorkItemWidget::WorkItemType
- AddWidgetsForWorkItemTypes::WorkItemType
- WorkItems::Type
feature_categories:
diff --git a/db/docs/work_item_widget_definitions.yml b/db/docs/work_item_widget_definitions.yml
index 59cbca14908..a11fbfd34ae 100644
--- a/db/docs/work_item_widget_definitions.yml
+++ b/db/docs/work_item_widget_definitions.yml
@@ -1,6 +1,7 @@
---
table_name: work_item_widget_definitions
classes:
+- AddNotificationsWorkItemWidget::WidgetDefinition
- AddWidgetsForWorkItemTypes::WidgetDefinition
- WorkItems::WidgetDefinition
feature_categories:
diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb
index fa890531861..50155668dca 100644
--- a/db/fixtures/development/17_cycle_analytics.rb
+++ b/db/fixtures/development/17_cycle_analytics.rb
@@ -18,7 +18,8 @@ require 'active_support/testing/time_helpers'
#
# VSA_SEED_PROJECT_ID=10 FILTER=cycle_analytics SEED_VSA=1 bundle exec rake db:seed_fu
-class Gitlab::Seeder::CycleAnalytics
+# rubocop:disable Rails/Output
+class Gitlab::Seeder::CycleAnalytics # rubocop:disable Style/ClassAndModuleChildren
include ActiveSupport::Testing::TimeHelpers
attr_reader :project, :issues, :merge_requests, :developers
@@ -26,18 +27,21 @@ class Gitlab::Seeder::CycleAnalytics
FLAG = 'SEED_VSA'
PERF_TEST = 'VSA_PERF_TEST'
- ISSUE_STAGE_MAX_DURATION_IN_HOURS = 72
- PLAN_STAGE_MAX_DURATION_IN_HOURS = 48
- CODE_STAGE_MAX_DURATION_IN_HOURS = 72
- TEST_STAGE_MAX_DURATION_IN_HOURS = 5
- REVIEW_STAGE_MAX_DURATION_IN_HOURS = 72
- DEPLOYMENT_MAX_DURATION_IN_HOURS = 48
+ MAX_DURATIONS = { # in hours
+ issue: 72,
+ plan: 48,
+ code: 72,
+ test: 5,
+ review: 72,
+ deployment: 48,
+ lead_time: 32
+ }.freeze
def self.seeder_based_on_env(project)
if ENV[FLAG]
- self.new(project: project)
+ new(project: project)
elsif ENV[PERF_TEST]
- self.new(project: project, perf: true)
+ new(project: project, perf: true)
end
end
@@ -54,8 +58,10 @@ class Gitlab::Seeder::CycleAnalytics
puts
puts 'WARNING'
puts '======='
- puts "Seeding #{self.class} is not possible because the given project (#{project.full_path}) doesn't have a repository."
- puts 'Try specifying a project with working repository or omit the VSA_SEED_PROJECT_ID parameter so the seed script will automatically create one.'
+ puts "Seeding #{self.class} is not possible because the given project " \
+ "(#{project.full_path}) doesn't have a repository."
+ puts 'Try specifying a project with working repository or omit the VSA_SEED_PROJECT_ID parameter ' \
+ 'so the seed script will automatically create one.'
puts
return
@@ -64,6 +70,7 @@ class Gitlab::Seeder::CycleAnalytics
create_developers!
create_issues!
+ seed_lead_time!
seed_issue_stage!
seed_plan_stage!
seed_code_stage!
@@ -79,7 +86,7 @@ class Gitlab::Seeder::CycleAnalytics
def seed_issue_stage!
issues.each do |issue|
- time = within_end_time(issue.created_at + rand(ISSUE_STAGE_MAX_DURATION_IN_HOURS).hours)
+ time = within_end_time(issue.created_at + rand(MAX_DURATIONS[:issue]).hours)
if issue.id.even?
issue.metrics.update!(first_associated_with_milestone_at: time)
@@ -93,7 +100,7 @@ class Gitlab::Seeder::CycleAnalytics
issues.each do |issue|
plan_stage_start = issue.metrics.first_associated_with_milestone_at || issue.metrics.first_added_to_board_at
- first_mentioned_in_commit_at = within_end_time(plan_stage_start + rand(PLAN_STAGE_MAX_DURATION_IN_HOURS).hours)
+ first_mentioned_in_commit_at = within_end_time(plan_stage_start + rand(MAX_DURATIONS[:plan]).hours)
issue.metrics.update!(first_mentioned_in_commit_at: first_mentioned_in_commit_at)
end
end
@@ -107,7 +114,7 @@ class Gitlab::Seeder::CycleAnalytics
source_branch: "#{issue.iid}-feature-branch",
target_branch: 'master',
author: developers.sample,
- created_at: within_end_time(issue.metrics.first_mentioned_in_commit_at + rand(CODE_STAGE_MAX_DURATION_IN_HOURS).hours)
+ created_at: within_end_time(issue.metrics.first_mentioned_in_commit_at + rand(MAX_DURATIONS[:code]).hours)
)
@merge_requests << merge_request
@@ -118,16 +125,17 @@ class Gitlab::Seeder::CycleAnalytics
def seed_test_stage!
merge_requests.each do |merge_request|
- pipeline = FactoryBot.create(:ci_pipeline, :success, project: project, partition_id: Ci::Pipeline.current_partition_value)
+ 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
# created in an `after_commit` hook.
- merge_request.ensure_metrics
+ merge_request.ensure_metrics!
merge_request.metrics.update!(
latest_build_started_at: merge_request.created_at,
- latest_build_finished_at: within_end_time(merge_request.created_at + TEST_STAGE_MAX_DURATION_IN_HOURS.hours),
+ latest_build_finished_at: within_end_time(merge_request.created_at + MAX_DURATIONS[:test].hours),
pipeline_id: build.commit_id
)
end
@@ -135,13 +143,25 @@ class Gitlab::Seeder::CycleAnalytics
def seed_review_stage!
merge_requests.each do |merge_request|
- merge_request.metrics.update!(merged_at: within_end_time(merge_request.created_at + REVIEW_STAGE_MAX_DURATION_IN_HOURS.hours))
+ merge_request.metrics.update!(
+ merged_at: within_end_time(merge_request.created_at + MAX_DURATIONS[:review].hours)
+ )
end
end
def seed_staging_stage!
merge_requests.each do |merge_request|
- merge_request.metrics.update!(first_deployed_to_production_at: within_end_time(merge_request.metrics.merged_at + DEPLOYMENT_MAX_DURATION_IN_HOURS.hours))
+ first_deployed_to_production_at = merge_request.metrics.merged_at + MAX_DURATIONS[:deployment].hours
+ merge_request.metrics.update!(
+ first_deployed_to_production_at: within_end_time(first_deployed_to_production_at)
+ )
+ end
+ end
+
+ def seed_lead_time!
+ issues.each do |issue|
+ created_at = issue.created_at - MAX_DURATIONS[:lead_time].hours
+ issue.update!(created_at: created_at, closed_at: Time.now)
end
end
@@ -224,3 +244,4 @@ Gitlab::Seeder.quiet do
puts "Skipped. Use the `#{Gitlab::Seeder::CycleAnalytics::FLAG}` environment variable to enable."
end
end
+# rubocop:enable Rails/Output
diff --git a/db/fixtures/development/36_achievements.rb b/db/fixtures/development/36_achievements.rb
new file mode 100644
index 00000000000..9bb485afe38
--- /dev/null
+++ b/db/fixtures/development/36_achievements.rb
@@ -0,0 +1,68 @@
+# frozen_string_literal: true
+
+class Gitlab::Seeder::Achievements
+ attr_reader :group, :user_ids, :maintainer_ids
+
+ def initialize(group, user_ids)
+ @group = group
+ @maintainer_ids = group.members.maintainers.pluck(:user_id)
+ @maintainer_ids << User.admins.first.id
+ @user_ids = user_ids
+ end
+
+ def seed!
+ achievement_ids = Achievements::Achievement.pluck(:id)
+ achievement_ids = seed_achievements if achievement_ids.empty?
+
+ user_ids.reverse.each_with_index do |user_id, user_index|
+ (user_index + 1).times do |achievement_index|
+ ::Achievements::UserAchievement.create!(
+ user_id: user_id,
+ achievement_id: achievement_ids[achievement_index],
+ awarded_by_user_id: maintainer_ids.sample,
+ revoked_by_user_id: achievement_index == 0 ? maintainer_ids.sample : nil,
+ revoked_at: achievement_index == 0 ? DateTime.current : nil
+ )
+
+ print '.'
+ end
+ end
+ end
+
+ def seed_achievements
+ achievement_ids = []
+
+
+ ['revoked', 'first mr', 'hero', 'legend'].each do |achievement_name|
+ achievement_ids << ::Achievements::Achievement.create!(
+ namespace_id: group.id,
+ name: achievement_name,
+ description: achievement_name == 'hero' ? 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry''s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.' : nil,
+ avatar: seed_avatar(achievement_name)
+ ).id
+
+ print '.'
+ end
+
+ achievement_ids
+ end
+
+ def seed_avatar(achievement_name)
+ case achievement_name
+ when 'first mr'
+ File.new(Rails.root.join('db', 'fixtures', 'development', 'rocket.jpg'), 'r')
+ when 'hero'
+ File.new(Rails.root.join('db', 'fixtures', 'development', 'heart.png'), 'r')
+ end
+ end
+end
+
+Gitlab::Seeder.quiet do
+ puts "\nGenerating ahievements"
+
+ group = Group.first
+ users = User.first(4).pluck(:id)
+ Gitlab::Seeder::Achievements.new(group, users).seed!
+rescue => e
+ warn "\nError seeding achievements: #{e}"
+end
diff --git a/db/fixtures/development/heart.png b/db/fixtures/development/heart.png
new file mode 100644
index 00000000000..23ad1c76ffa
--- /dev/null
+++ b/db/fixtures/development/heart.png
Binary files differ
diff --git a/db/fixtures/development/rocket.jpg b/db/fixtures/development/rocket.jpg
new file mode 100644
index 00000000000..ab843fe057c
--- /dev/null
+++ b/db/fixtures/development/rocket.jpg
Binary files differ
diff --git a/db/migrate/20230113164245_create_namespace_ldap_settings.rb b/db/migrate/20230113164245_create_namespace_ldap_settings.rb
new file mode 100644
index 00000000000..5ad72c00b47
--- /dev/null
+++ b/db/migrate/20230113164245_create_namespace_ldap_settings.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class CreateNamespaceLdapSettings < Gitlab::Database::Migration[2.1]
+ def change
+ create_table :namespace_ldap_settings, if_not_exists: true, id: false do |t|
+ t.references :namespace, primary_key: true, default: nil,
+ type: :bigint, index: false, foreign_key: { on_delete: :cascade }
+ t.timestamps_with_timezone null: false
+ t.column :sync_last_start_at, :datetime_with_timezone
+ t.column :sync_last_update_at, :datetime_with_timezone
+ t.column :sync_last_successful_at, :datetime_with_timezone
+ t.integer :sync_status, null: false, default: 0, limit: 2
+ t.text :sync_error, limit: 255
+ end
+ end
+end
diff --git a/db/migrate/20230118135145_add_service_desk_custom_email_verifications.rb b/db/migrate/20230118135145_add_service_desk_custom_email_verifications.rb
new file mode 100644
index 00000000000..32f7f3392e6
--- /dev/null
+++ b/db/migrate/20230118135145_add_service_desk_custom_email_verifications.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddServiceDeskCustomEmailVerifications < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def up
+ create_table(:service_desk_custom_email_verifications, id: false, primary_key: :project_id) do |t|
+ t.references :project, index: false, foreign_key: { on_delete: :cascade }, null: false
+ t.references :triggerer, index: true, foreign_key: { to_table: :users, on_delete: :nullify }
+ t.timestamps_with_timezone
+ t.datetime_with_timezone :triggered_at
+ t.integer :state, limit: 2, null: false, default: 0
+ t.integer :error, limit: 2
+ t.binary :encrypted_token
+ t.binary :encrypted_token_iv
+ end
+
+ execute "ALTER TABLE service_desk_custom_email_verifications ADD PRIMARY KEY (project_id);"
+ end
+
+ def down
+ drop_table :service_desk_custom_email_verifications
+ end
+end
diff --git a/db/migrate/20230127030015_add_deny_all_outgoing_requests_to_application_settings.rb b/db/migrate/20230127030015_add_deny_all_outgoing_requests_to_application_settings.rb
new file mode 100644
index 00000000000..b12176a5541
--- /dev/null
+++ b/db/migrate/20230127030015_add_deny_all_outgoing_requests_to_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddDenyAllOutgoingRequestsToApplicationSettings < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ add_column :application_settings, :deny_all_requests_except_allowed, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20230127155217_add_id_column_to_package_metadata_join_table.rb b/db/migrate/20230127155217_add_id_column_to_package_metadata_join_table.rb
index 960421ae38e..4ce3643208e 100644
--- a/db/migrate/20230127155217_add_id_column_to_package_metadata_join_table.rb
+++ b/db/migrate/20230127155217_add_id_column_to_package_metadata_join_table.rb
@@ -6,6 +6,10 @@ class AddIdColumnToPackageMetadataJoinTable < Gitlab::Database::Migration[2.1]
COMPOSITE_UNIQUE_INDEX = :i_pm_package_version_licenses_join_ids
def up
+ if Gitlab::Database::PostgresPartitionedTable.where(name: 'pm_package_version_licenses').exists?
+ recreate_unpartitioned_tables
+ end
+
drop_constraint(:pm_package_version_licenses, :pm_package_version_licenses_pkey, cascade: true)
add_column(:pm_package_version_licenses, :id, :primary_key)
add_concurrent_index(:pm_package_version_licenses, [:pm_package_version_id, :pm_license_id], unique: true,
@@ -13,8 +17,60 @@ class AddIdColumnToPackageMetadataJoinTable < Gitlab::Database::Migration[2.1]
end
def down
+ return if Gitlab::Database::PostgresPartitionedTable.where(name: 'pm_package_version_licenses').exists?
+
remove_column(:pm_package_version_licenses, :id)
add_primary_key_using_index(:pm_package_version_licenses, :pm_package_version_licenses_pkey, COMPOSITE_UNIQUE_INDEX)
remove_concurrent_index_by_name(:pm_package_version_licenses, COMPOSITE_UNIQUE_INDEX)
end
+
+ private
+
+ def recreate_unpartitioned_tables
+ drop_table(:pm_package_version_licenses, force: :cascade) # rubocop:disable Migration/DropTable
+ drop_table(:pm_package_versions, force: :cascade) # rubocop:disable Migration/DropTable
+ drop_table(:pm_packages, force: :cascade) # rubocop:disable Migration/DropTable
+
+ create_table :pm_packages do |t|
+ t.integer :purl_type, limit: 2, null: false
+ t.text :name, null: false, limit: 255
+ t.timestamps_with_timezone null: false
+ t.index [:purl_type, :name], name: 'i_pm_packages_purl_type_and_name', unique: true
+ end
+
+ create_table :pm_package_versions do |t|
+ t.references :pm_package,
+ index: false,
+ null: false,
+ foreign_key: {
+ to_table: :pm_packages,
+ column: :pm_package_id,
+ name: 'fk_rails_cf94c3e601',
+ on_delete: :cascade
+ }
+ t.text :version, null: false, limit: 255
+ t.timestamps_with_timezone null: false
+ t.index [:pm_package_id, :version], name: 'i_pm_package_versions_on_package_id_and_version', unique: true
+ t.index :pm_package_id, name: 'index_pm_package_versions_on_pm_package_id'
+ end
+
+ create_table :pm_package_version_licenses, primary_key: [:pm_package_version_id, :pm_license_id] do |t|
+ t.references :pm_package_version,
+ index: false,
+ null: false,
+ foreign_key: {
+ to_table: :pm_package_versions,
+ column: :pm_package_version_id,
+ name: 'fk_rails_30ddb7f837',
+ on_delete: :cascade
+ }
+ t.references :pm_license,
+ index: false,
+ null: false,
+ foreign_key: { name: 'fk_rails_7520ea026d', on_delete: :cascade }
+ t.timestamps_with_timezone null: false
+ t.index :pm_license_id, name: 'index_pm_package_version_licenses_on_pm_license_id'
+ t.index :pm_package_version_id, name: 'index_pm_package_version_licenses_on_pm_package_version_id'
+ end
+ end
end
diff --git a/db/migrate/20230201165656_create_container_repository_states.rb b/db/migrate/20230201165656_create_container_repository_states.rb
new file mode 100644
index 00000000000..0e84faf11ee
--- /dev/null
+++ b/db/migrate/20230201165656_create_container_repository_states.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+class CreateContainerRepositoryStates < Gitlab::Database::Migration[2.1]
+ VERIFICATION_STATE_INDEX_NAME = "index_container_repository_states_on_verification_state"
+ PENDING_VERIFICATION_INDEX_NAME = "index_container_repository_states_pending_verification"
+ FAILED_VERIFICATION_INDEX_NAME = "index_container_repository_states_failed_verification"
+ NEEDS_VERIFICATION_INDEX_NAME = "index_container_repository_states_needs_verification"
+
+ disable_ddl_transaction!
+
+ def up
+ create_table :container_repository_states, id: false do |t|
+ t.datetime_with_timezone :verification_started_at
+ t.datetime_with_timezone :verification_retry_at
+ t.datetime_with_timezone :verified_at
+ t.references :container_repository,
+ primary_key: true,
+ default: nil,
+ index: false,
+ 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 :container_repository_states
+ end
+end
diff --git a/db/migrate/20230202094723_add_default_syntax_highlighting_theme_to_application_settings.rb b/db/migrate/20230202094723_add_default_syntax_highlighting_theme_to_application_settings.rb
new file mode 100644
index 00000000000..048afb51f26
--- /dev/null
+++ b/db/migrate/20230202094723_add_default_syntax_highlighting_theme_to_application_settings.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddDefaultSyntaxHighlightingThemeToApplicationSettings < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :application_settings, :default_syntax_highlighting_theme, :integer, default: 1, null: false
+ end
+end
diff --git a/db/migrate/20230210152109_add_bulk_import_export_batches.rb b/db/migrate/20230210152109_add_bulk_import_export_batches.rb
new file mode 100644
index 00000000000..380f8a43aae
--- /dev/null
+++ b/db/migrate/20230210152109_add_bulk_import_export_batches.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddBulkImportExportBatches < Gitlab::Database::Migration[2.1]
+ def up
+ create_table :bulk_import_export_batches do |t|
+ t.references :export, index: true, null: false, foreign_key: {
+ to_table: :bulk_import_exports, on_delete: :cascade
+ }
+ t.timestamps_with_timezone null: false
+ t.integer :status, limit: 2, null: false, default: 0
+ t.integer :batch_number, null: false, default: 0
+ t.integer :objects_count, null: false, default: 0
+ t.text :error, limit: 255
+ t.index [:export_id, :batch_number], unique: true, name: 'i_bulk_import_export_batches_id_batch_number'
+ end
+ end
+
+ def down
+ drop_table :bulk_import_export_batches
+ end
+end
diff --git a/db/migrate/20230210153420_add_batched_column_to_bulk_import_exports.rb b/db/migrate/20230210153420_add_batched_column_to_bulk_import_exports.rb
new file mode 100644
index 00000000000..cfe4a2059bb
--- /dev/null
+++ b/db/migrate/20230210153420_add_batched_column_to_bulk_import_exports.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddBatchedColumnToBulkImportExports < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :bulk_import_exports, :batched, :boolean, null: false, default: false
+ add_column :bulk_import_exports, :batches_count, :integer, null: false, default: 0
+ add_column :bulk_import_exports, :total_objects_count, :integer, null: false, default: 0
+ end
+end
diff --git a/db/migrate/20230210155715_add_batch_id_to_bulk_import_export_uploads.rb b/db/migrate/20230210155715_add_batch_id_to_bulk_import_export_uploads.rb
new file mode 100644
index 00000000000..986d31a5839
--- /dev/null
+++ b/db/migrate/20230210155715_add_batch_id_to_bulk_import_export_uploads.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddBatchIdToBulkImportExportUploads < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :bulk_import_export_uploads, :batch_id, :bigint
+ end
+end
diff --git a/db/migrate/20230210160037_add_batch_foreign_key_to_bulk_import_export_uploads.rb b/db/migrate/20230210160037_add_batch_foreign_key_to_bulk_import_export_uploads.rb
new file mode 100644
index 00000000000..de0286f27ed
--- /dev/null
+++ b/db/migrate/20230210160037_add_batch_foreign_key_to_bulk_import_export_uploads.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddBatchForeignKeyToBulkImportExportUploads < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :bulk_import_export_uploads, :bulk_import_export_batches, column: :batch_id
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :bulk_import_export_uploads, column: :batch_id
+ end
+ end
+end
diff --git a/db/migrate/20230210160351_add_bulk_import_batch_trackers.rb b/db/migrate/20230210160351_add_bulk_import_batch_trackers.rb
new file mode 100644
index 00000000000..40f6341680f
--- /dev/null
+++ b/db/migrate/20230210160351_add_bulk_import_batch_trackers.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddBulkImportBatchTrackers < Gitlab::Database::Migration[2.1]
+ def up
+ create_table :bulk_import_batch_trackers do |t|
+ t.references :tracker, index: true, null: false, foreign_key: {
+ to_table: :bulk_import_trackers, on_delete: :cascade
+ }
+ t.timestamps_with_timezone null: false
+ t.integer :status, limit: 2, null: false, default: 0
+ t.integer :batch_number, null: false, default: 0
+ t.integer :fetched_objects_count, null: false, default: 0
+ t.integer :imported_objects_count, null: false, default: 0
+ t.text :error, limit: 255
+ t.index [:tracker_id, :batch_number], unique: true, name: 'i_bulk_import_trackers_id_batch_number'
+ end
+ end
+
+ def down
+ drop_table :bulk_import_batch_trackers
+ end
+end
diff --git a/db/migrate/20230210161002_add_batched_column_to_bulk_import_trackers.rb b/db/migrate/20230210161002_add_batched_column_to_bulk_import_trackers.rb
new file mode 100644
index 00000000000..5640164a117
--- /dev/null
+++ b/db/migrate/20230210161002_add_batched_column_to_bulk_import_trackers.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddBatchedColumnToBulkImportTrackers < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :bulk_import_trackers, :batched, :boolean, default: false
+ end
+end
diff --git a/db/migrate/20230210171012_add_batch_id_index_to_bulk_import_export_uploads.rb b/db/migrate/20230210171012_add_batch_id_index_to_bulk_import_export_uploads.rb
new file mode 100644
index 00000000000..c2fd4198762
--- /dev/null
+++ b/db/migrate/20230210171012_add_batch_id_index_to_bulk_import_export_uploads.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddBatchIdIndexToBulkImportExportUploads < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'bulk_import_export_uploads_batch_id'
+
+ def up
+ add_concurrent_index :bulk_import_export_uploads, :batch_id, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :bulk_import_export_uploads, :batch_id, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230213213559_add_index_on_project_id_and_scanner_id_and_vulnerability_id_on_vulnerability_reads.rb b/db/migrate/20230213213559_add_index_on_project_id_and_scanner_id_and_vulnerability_id_on_vulnerability_reads.rb
new file mode 100644
index 00000000000..ee9e15d2484
--- /dev/null
+++ b/db/migrate/20230213213559_add_index_on_project_id_and_scanner_id_and_vulnerability_id_on_vulnerability_reads.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddIndexOnProjectIdAndScannerIdAndVulnerabilityIdOnVulnerabilityReads < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = "idx_vulnerability_reads_project_id_scanner_id_vulnerability_id"
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :vulnerability_reads, [:project_id, :scanner_id, :vulnerability_id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230215074223_add_ci_runner_machine_builds_partitioned_table.rb b/db/migrate/20230215074223_add_ci_runner_machine_builds_partitioned_table.rb
new file mode 100644
index 00000000000..4e47d35d804
--- /dev/null
+++ b/db/migrate/20230215074223_add_ci_runner_machine_builds_partitioned_table.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class AddCiRunnerMachineBuildsPartitionedTable < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers
+
+ enable_lock_retries!
+
+ TABLE_NAME = :ci_runner_machine_builds
+ PARENT_TABLE_NAME = :p_ci_runner_machine_builds
+ FIRST_PARTITION = 100
+
+ def up
+ execute(<<~SQL)
+ CREATE TABLE #{PARENT_TABLE_NAME} (
+ partition_id bigint NOT NULL,
+ build_id bigint NOT NULL,
+ runner_machine_id bigint NOT NULL,
+ PRIMARY KEY (partition_id, build_id),
+ CONSTRAINT fk_bb490f12fe_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE
+ )
+ PARTITION BY LIST (partition_id);
+
+ CREATE INDEX index_ci_runner_machine_builds_on_runner_machine_id ON #{PARENT_TABLE_NAME} USING btree (runner_machine_id);
+ SQL
+ end
+
+ def down
+ drop_table PARENT_TABLE_NAME
+ end
+end
diff --git a/db/migrate/20230215124011_add_provisioned_by_group_at_to_user_details.rb b/db/migrate/20230215124011_add_provisioned_by_group_at_to_user_details.rb
new file mode 100644
index 00000000000..3ff1cf6c6d4
--- /dev/null
+++ b/db/migrate/20230215124011_add_provisioned_by_group_at_to_user_details.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddProvisionedByGroupAtToUserDetails < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ add_column :user_details, :provisioned_by_group_at, :datetime_with_timezone
+ end
+end
diff --git a/db/migrate/20230215131026_add_has_failures_column_to_bulk_imports.rb b/db/migrate/20230215131026_add_has_failures_column_to_bulk_imports.rb
new file mode 100644
index 00000000000..52517244f3e
--- /dev/null
+++ b/db/migrate/20230215131026_add_has_failures_column_to_bulk_imports.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddHasFailuresColumnToBulkImports < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :bulk_imports, :has_failures, :boolean, default: false
+ end
+end
diff --git a/db/migrate/20230215180605_index_sbom_occurrences_on_project_id_and_id.rb b/db/migrate/20230215180605_index_sbom_occurrences_on_project_id_and_id.rb
new file mode 100644
index 00000000000..34538a1a7ff
--- /dev/null
+++ b/db/migrate/20230215180605_index_sbom_occurrences_on_project_id_and_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class IndexSbomOccurrencesOnProjectIdAndId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_sbom_occurrences_on_project_id_and_id'
+
+ def up
+ add_concurrent_index :sbom_occurrences, [:project_id, :id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :sbom_occurrences, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230216040505_add_status_and_resolved_at_to_abuse_reports.rb b/db/migrate/20230216040505_add_status_and_resolved_at_to_abuse_reports.rb
new file mode 100644
index 00000000000..3cfd082b465
--- /dev/null
+++ b/db/migrate/20230216040505_add_status_and_resolved_at_to_abuse_reports.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+class AddStatusAndResolvedAtToAbuseReports < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :abuse_reports, :status, :integer, limit: 2, default: 1, null: false
+ add_timestamps_with_timezone(:abuse_reports, columns: [:resolved_at], null: true)
+ end
+end
diff --git a/db/migrate/20230216071312_add_status_category_and_id_index_to_abuse_reports.rb b/db/migrate/20230216071312_add_status_category_and_id_index_to_abuse_reports.rb
new file mode 100644
index 00000000000..0c529f15b1b
--- /dev/null
+++ b/db/migrate/20230216071312_add_status_category_and_id_index_to_abuse_reports.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddStatusCategoryAndIdIndexToAbuseReports < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'index_abuse_reports_on_status_category_and_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :abuse_reports, [:status, :category, :id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :abuse_reports, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230216142836_update_vulnerability_reads_trigger_to_set_has_issue.rb b/db/migrate/20230216142836_update_vulnerability_reads_trigger_to_set_has_issue.rb
new file mode 100644
index 00000000000..73afa176b97
--- /dev/null
+++ b/db/migrate/20230216142836_update_vulnerability_reads_trigger_to_set_has_issue.rb
@@ -0,0 +1,185 @@
+# frozen_string_literal: true
+
+class UpdateVulnerabilityReadsTriggerToSetHasIssue < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def up
+ execute(<<~SQL)
+ CREATE OR REPLACE FUNCTION insert_or_update_vulnerability_reads()
+ RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+ DECLARE
+ severity smallint;
+ state smallint;
+ report_type smallint;
+ resolved_on_default_branch boolean;
+ present_on_default_branch boolean;
+ namespace_id bigint;
+ has_issues boolean;
+ BEGIN
+ IF (NEW.vulnerability_id IS NULL AND (TG_OP = 'INSERT' OR TG_OP = 'UPDATE')) THEN
+ RETURN NULL;
+ END IF;
+
+ IF (TG_OP = 'UPDATE' AND OLD.vulnerability_id IS NOT NULL AND NEW.vulnerability_id IS NOT NULL) THEN
+ RETURN NULL;
+ END IF;
+
+ SELECT
+ vulnerabilities.severity, vulnerabilities.state, vulnerabilities.report_type, vulnerabilities.resolved_on_default_branch, vulnerabilities.present_on_default_branch
+ INTO
+ severity, state, report_type, resolved_on_default_branch, present_on_default_branch
+ FROM
+ vulnerabilities
+ WHERE
+ vulnerabilities.id = NEW.vulnerability_id;
+
+ IF present_on_default_branch IS NOT true THEN
+ RETURN NULL;
+ END IF;
+
+ SELECT
+ projects.namespace_id
+ INTO
+ namespace_id
+ FROM
+ projects
+ WHERE
+ projects.id = NEW.project_id;
+
+ SELECT
+ EXISTS (SELECT 1 FROM vulnerability_issue_links WHERE vulnerability_issue_links.vulnerability_id = NEW.vulnerability_id)
+ INTO
+ has_issues;
+
+ INSERT INTO vulnerability_reads (vulnerability_id, namespace_id, project_id, scanner_id, report_type, severity, state, resolved_on_default_branch, uuid, location_image, cluster_agent_id, casted_cluster_agent_id, has_issues)
+ VALUES (NEW.vulnerability_id, namespace_id, NEW.project_id, NEW.scanner_id, report_type, severity, state, resolved_on_default_branch, NEW.uuid::uuid, NEW.location->>'image', NEW.location->'kubernetes_resource'->>'agent_id', CAST(NEW.location->'kubernetes_resource'->>'agent_id' AS bigint), has_issues)
+ ON CONFLICT(vulnerability_id) DO NOTHING;
+ RETURN NULL;
+ END
+ $$
+ SQL
+
+ execute(<<~SQL)
+ CREATE OR REPLACE FUNCTION insert_vulnerability_reads_from_vulnerability()
+ RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+ DECLARE
+ scanner_id bigint;
+ uuid uuid;
+ location_image text;
+ cluster_agent_id text;
+ casted_cluster_agent_id bigint;
+ namespace_id bigint;
+ has_issues boolean;
+ BEGIN
+ SELECT
+ v_o.scanner_id, v_o.uuid, v_o.location->>'image', v_o.location->'kubernetes_resource'->>'agent_id', CAST(v_o.location->'kubernetes_resource'->>'agent_id' AS bigint), projects.namespace_id
+ INTO
+ scanner_id, uuid, location_image, cluster_agent_id, casted_cluster_agent_id, namespace_id
+ FROM
+ vulnerability_occurrences v_o
+ INNER JOIN projects ON projects.id = v_o.project_id
+ WHERE
+ v_o.vulnerability_id = NEW.id
+ LIMIT 1;
+
+ SELECT
+ EXISTS (SELECT 1 FROM vulnerability_issue_links WHERE vulnerability_issue_links.vulnerability_id = NEW.id)
+ INTO
+ has_issues;
+
+ INSERT INTO vulnerability_reads (vulnerability_id, namespace_id, project_id, scanner_id, report_type, severity, state, resolved_on_default_branch, uuid, location_image, cluster_agent_id, casted_cluster_agent_id, has_issues)
+ VALUES (NEW.id, namespace_id, NEW.project_id, scanner_id, NEW.report_type, NEW.severity, NEW.state, NEW.resolved_on_default_branch, uuid::uuid, location_image, cluster_agent_id, casted_cluster_agent_id, has_issues)
+ ON CONFLICT(vulnerability_id) DO NOTHING;
+ RETURN NULL;
+ END
+ $$
+ SQL
+ end
+
+ def down
+ execute(<<~SQL)
+ CREATE OR REPLACE FUNCTION insert_or_update_vulnerability_reads() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+ DECLARE
+ severity smallint;
+ state smallint;
+ report_type smallint;
+ resolved_on_default_branch boolean;
+ present_on_default_branch boolean;
+ namespace_id bigint;
+ BEGIN
+ IF (NEW.vulnerability_id IS NULL AND (TG_OP = 'INSERT' OR TG_OP = 'UPDATE')) THEN
+ RETURN NULL;
+ END IF;
+
+ IF (TG_OP = 'UPDATE' AND OLD.vulnerability_id IS NOT NULL AND NEW.vulnerability_id IS NOT NULL) THEN
+ RETURN NULL;
+ END IF;
+
+ SELECT
+ vulnerabilities.severity, vulnerabilities.state, vulnerabilities.report_type, vulnerabilities.resolved_on_default_branch, vulnerabilities.present_on_default_branch
+ INTO
+ severity, state, report_type, resolved_on_default_branch, present_on_default_branch
+ FROM
+ vulnerabilities
+ WHERE
+ vulnerabilities.id = NEW.vulnerability_id;
+
+ IF present_on_default_branch IS NOT true THEN
+ RETURN NULL;
+ END IF;
+
+ SELECT
+ projects.namespace_id
+ INTO
+ namespace_id
+ FROM
+ projects
+ WHERE
+ projects.id = NEW.project_id;
+
+ INSERT INTO vulnerability_reads (vulnerability_id, namespace_id, project_id, scanner_id, report_type, severity, state, resolved_on_default_branch, uuid, location_image, cluster_agent_id, casted_cluster_agent_id)
+ VALUES (NEW.vulnerability_id, namespace_id, NEW.project_id, NEW.scanner_id, report_type, severity, state, resolved_on_default_branch, NEW.uuid::uuid, NEW.location->>'image', NEW.location->'kubernetes_resource'->>'agent_id', CAST(NEW.location->'kubernetes_resource'->>'agent_id' AS bigint))
+ ON CONFLICT(vulnerability_id) DO NOTHING;
+ RETURN NULL;
+ END
+ $$;
+ SQL
+
+ execute(<<~SQL)
+ CREATE OR REPLACE FUNCTION insert_vulnerability_reads_from_vulnerability() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+ DECLARE
+ scanner_id bigint;
+ uuid uuid;
+ location_image text;
+ cluster_agent_id text;
+ casted_cluster_agent_id bigint;
+ namespace_id bigint;
+ BEGIN
+ SELECT
+ v_o.scanner_id, v_o.uuid, v_o.location->>'image', v_o.location->'kubernetes_resource'->>'agent_id', CAST(v_o.location->'kubernetes_resource'->>'agent_id' AS bigint), projects.namespace_id
+ INTO
+ scanner_id, uuid, location_image, cluster_agent_id, casted_cluster_agent_id, namespace_id
+ FROM
+ vulnerability_occurrences v_o
+ INNER JOIN projects ON projects.id = v_o.project_id
+ WHERE
+ v_o.vulnerability_id = NEW.id
+ LIMIT 1;
+
+ INSERT INTO vulnerability_reads (vulnerability_id, namespace_id, project_id, scanner_id, report_type, severity, state, resolved_on_default_branch, uuid, location_image, cluster_agent_id, casted_cluster_agent_id)
+ VALUES (NEW.id, namespace_id, NEW.project_id, scanner_id, NEW.report_type, NEW.severity, NEW.state, NEW.resolved_on_default_branch, uuid::uuid, location_image, cluster_agent_id, casted_cluster_agent_id)
+ ON CONFLICT(vulnerability_id) DO NOTHING;
+ RETURN NULL;
+ END
+ $$;
+ SQL
+ end
+end
diff --git a/db/migrate/20230216144719_drop_table_airflow_dags.rb b/db/migrate/20230216144719_drop_table_airflow_dags.rb
new file mode 100644
index 00000000000..ed80ca16703
--- /dev/null
+++ b/db/migrate/20230216144719_drop_table_airflow_dags.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class DropTableAirflowDags < Gitlab::Database::Migration[2.1]
+ def up
+ # the table is not in use
+ drop_table :airflow_dags, if_exists: true # rubocop: disable Migration/DropTable
+ end
+
+ def down
+ create_table :airflow_dags do |t|
+ t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: false
+ t.timestamps_with_timezone null: false
+ t.datetime_with_timezone :next_run
+ t.boolean :has_import_errors
+ t.boolean :is_active
+ t.boolean :is_paused
+ t.text :dag_name, null: false, limit: 255
+ t.text :schedule, limit: 255
+ t.text :fileloc, limit: 255
+ end
+ end
+end
diff --git a/db/migrate/20230216152912_add_has_failures_column_to_bulk_import_entities.rb b/db/migrate/20230216152912_add_has_failures_column_to_bulk_import_entities.rb
new file mode 100644
index 00000000000..4c48acd9dce
--- /dev/null
+++ b/db/migrate/20230216152912_add_has_failures_column_to_bulk_import_entities.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddHasFailuresColumnToBulkImportEntities < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :bulk_import_entities, :has_failures, :boolean, default: false
+ end
+end
diff --git a/db/migrate/20230216171309_create_ci_runner_cost_settings.rb b/db/migrate/20230216171309_create_ci_runner_cost_settings.rb
new file mode 100644
index 00000000000..5bc624c635a
--- /dev/null
+++ b/db/migrate/20230216171309_create_ci_runner_cost_settings.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class CreateCiRunnerCostSettings < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ create_table :ci_cost_settings, id: false do |t|
+ t.timestamps_with_timezone null: false
+ t.references :runner, null: false, primary_key: true, index: false,
+ foreign_key: { to_table: :ci_runners, on_delete: :cascade },
+ type: :bigint, default: nil
+ t.float :standard_factor, null: false, default: 1.00
+ t.float :os_contribution_factor, null: false, default: 0.008
+ t.float :os_plan_factor, null: false, default: 0.5
+ end
+ end
+end
diff --git a/db/migrate/20230217065736_add_projects_api_rate_limit_unauthenticated_to_application_settings.rb b/db/migrate/20230217065736_add_projects_api_rate_limit_unauthenticated_to_application_settings.rb
new file mode 100644
index 00000000000..f11560c33e9
--- /dev/null
+++ b/db/migrate/20230217065736_add_projects_api_rate_limit_unauthenticated_to_application_settings.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddProjectsApiRateLimitUnauthenticatedToApplicationSettings < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :application_settings, :projects_api_rate_limit_unauthenticated, :integer, default: 400, null: false
+ end
+end
diff --git a/db/migrate/20230217144421_add_check_type_to_pre_scan_step.rb b/db/migrate/20230217144421_add_check_type_to_pre_scan_step.rb
new file mode 100644
index 00000000000..e4b59c28d73
--- /dev/null
+++ b/db/migrate/20230217144421_add_check_type_to_pre_scan_step.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddCheckTypeToPreScanStep < Gitlab::Database::Migration[2.1]
+ def up
+ add_column :dast_pre_scan_verification_steps, :check_type, :integer, limit: 2, default: 0, null: false
+ end
+
+ def down
+ remove_column :dast_pre_scan_verification_steps, :check_type
+ end
+end
diff --git a/db/migrate/20230217232554_add_state_changed_in_to_vulnerability_state_transitions.rb b/db/migrate/20230217232554_add_state_changed_in_to_vulnerability_state_transitions.rb
new file mode 100644
index 00000000000..6a8b3b87e21
--- /dev/null
+++ b/db/migrate/20230217232554_add_state_changed_in_to_vulnerability_state_transitions.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddStateChangedInToVulnerabilityStateTransitions < Gitlab::Database::Migration[2.1]
+ def up
+ add_column :vulnerability_state_transitions, :state_changed_at_pipeline_id, :bigint
+ end
+
+ def down
+ remove_column :vulnerability_state_transitions, :state_changed_at_pipeline_id
+ end
+end
diff --git a/db/migrate/20230220035034_add_status_and_id_index_to_abuse_reports.rb b/db/migrate/20230220035034_add_status_and_id_index_to_abuse_reports.rb
new file mode 100644
index 00000000000..cea01572e37
--- /dev/null
+++ b/db/migrate/20230220035034_add_status_and_id_index_to_abuse_reports.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddStatusAndIdIndexToAbuseReports < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'index_abuse_reports_on_status_and_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :abuse_reports, [:status, :id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :abuse_reports, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230220163141_create_catalog_resources_table.rb b/db/migrate/20230220163141_create_catalog_resources_table.rb
new file mode 100644
index 00000000000..9a60a68415a
--- /dev/null
+++ b/db/migrate/20230220163141_create_catalog_resources_table.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class CreateCatalogResourcesTable < Gitlab::Database::Migration[2.1]
+ def change
+ create_table :catalog_resources do |t|
+ t.references :project, index: true, null: false, foreign_key: { on_delete: :cascade }
+
+ t.datetime_with_timezone :created_at, null: false
+ end
+ end
+end
diff --git a/db/migrate/20230221110256_create_initial_partition_for_ci_runner_machine_builds.rb b/db/migrate/20230221110256_create_initial_partition_for_ci_runner_machine_builds.rb
new file mode 100644
index 00000000000..9aa7049dde1
--- /dev/null
+++ b/db/migrate/20230221110256_create_initial_partition_for_ci_runner_machine_builds.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+class CreateInitialPartitionForCiRunnerMachineBuilds < Gitlab::Database::Migration[2.1]
+ PARTITION_NAME = 'gitlab_partitions_dynamic.ci_runner_machine_builds_100'
+ TABLE_NAME = 'p_ci_runner_machine_builds'
+ FIRST_PARTITION = 100
+ BUILDS_TABLE = 'ci_builds'
+
+ disable_ddl_transaction!
+
+ def up
+ 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 (#{FIRST_PARTITION});
+ SQL
+ end
+ end
+
+ def down
+ # no-op
+ #
+ # The migration should not remove the partition table since it might
+ # have been created by 20230215074223_add_ci_runner_machine_builds_partitioned_table.rb.
+ # In that case, the rollback would result in a different state.
+ 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/migrate/20230222153048_add_registry_size_estimated_to_namespace_root_storage_statistics.rb b/db/migrate/20230222153048_add_registry_size_estimated_to_namespace_root_storage_statistics.rb
new file mode 100644
index 00000000000..50fcf6fd113
--- /dev/null
+++ b/db/migrate/20230222153048_add_registry_size_estimated_to_namespace_root_storage_statistics.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddRegistrySizeEstimatedToNamespaceRootStorageStatistics < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'index_ns_root_stor_stats_on_registry_size_estimated'
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ add_column :namespace_root_storage_statistics, :registry_size_estimated, :boolean, default: false, null: false
+ end
+
+ add_concurrent_index :namespace_root_storage_statistics, :registry_size_estimated, name: INDEX_NAME
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :namespace_root_storage_statistics, :registry_size_estimated
+ end
+ end
+end
diff --git a/db/migrate/20230222193845_change_public_projects_minutes_cost_factor_default_to_1.rb b/db/migrate/20230222193845_change_public_projects_minutes_cost_factor_default_to_1.rb
new file mode 100644
index 00000000000..c86c16f692a
--- /dev/null
+++ b/db/migrate/20230222193845_change_public_projects_minutes_cost_factor_default_to_1.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class ChangePublicProjectsMinutesCostFactorDefaultTo1 < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ change_column_default :ci_runners, :public_projects_minutes_cost_factor, from: 0.0, to: 1.0
+ end
+ end
+
+ def down
+ with_lock_retries do
+ change_column_default :ci_runners, :public_projects_minutes_cost_factor, from: 1.0, to: 0.0
+ end
+ end
+end
diff --git a/db/migrate/20230224130315_add_constraint_type_to_postgres_async_constraint_validation.rb b/db/migrate/20230224130315_add_constraint_type_to_postgres_async_constraint_validation.rb
new file mode 100644
index 00000000000..dee5810d0d1
--- /dev/null
+++ b/db/migrate/20230224130315_add_constraint_type_to_postgres_async_constraint_validation.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddConstraintTypeToPostgresAsyncConstraintValidation < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :postgres_async_foreign_key_validations, :constraint_type, :integer, null: false, default: 0, limit: 2
+ end
+end
diff --git a/db/migrate/20230224161346_add_saml_group_lock_to_application_settings.rb b/db/migrate/20230224161346_add_saml_group_lock_to_application_settings.rb
new file mode 100644
index 00000000000..003dd5c5b61
--- /dev/null
+++ b/db/migrate/20230224161346_add_saml_group_lock_to_application_settings.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddSamlGroupLockToApplicationSettings < Gitlab::Database::Migration[2.1]
+ def change
+ add_column :application_settings, :lock_memberships_to_saml, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20230228092612_add_index_next_over_limit_check_at_asc_order_synchronously.rb b/db/migrate/20230228092612_add_index_next_over_limit_check_at_asc_order_synchronously.rb
new file mode 100644
index 00000000000..a811b67bb43
--- /dev/null
+++ b/db/migrate/20230228092612_add_index_next_over_limit_check_at_asc_order_synchronously.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexNextOverLimitCheckAtAscOrderSynchronously < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'namespace_details'
+ INDEX_NAME = 'index_next_over_limit_check_at_asc_order'
+ COLUMN = 'next_over_limit_check_at'
+
+ def up
+ add_concurrent_index TABLE_NAME, COLUMN, name: INDEX_NAME, order: { next_over_limit_check_at: 'ASC NULLS FIRST' }
+ end
+
+ def down
+ remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230228133011_add_design_description.rb b/db/migrate/20230228133011_add_design_description.rb
new file mode 100644
index 00000000000..bff9a25f2ac
--- /dev/null
+++ b/db/migrate/20230228133011_add_design_description.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddDesignDescription < Gitlab::Database::Migration[2.1]
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # text limit is added in a separate migration
+ def up
+ add_column :design_management_designs, :cached_markdown_version, :integer
+ add_column :design_management_designs, :description, :text
+ add_column :design_management_designs, :description_html, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+
+ def down
+ remove_column :design_management_designs, :cached_markdown_version
+ remove_column :design_management_designs, :description
+ remove_column :design_management_designs, :description_html
+ end
+end
diff --git a/db/migrate/20230228135034_add_design_description_limit.rb b/db/migrate/20230228135034_add_design_description_limit.rb
new file mode 100644
index 00000000000..47c5f8c6ab1
--- /dev/null
+++ b/db/migrate/20230228135034_add_design_description_limit.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddDesignDescriptionLimit < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :design_management_designs, :description, 1_000_000
+ end
+
+ def down
+ remove_text_limit :design_management_designs, :description
+ end
+end
diff --git a/db/migrate/20230228142350_add_notifications_work_item_widget.rb b/db/migrate/20230228142350_add_notifications_work_item_widget.rb
new file mode 100644
index 00000000000..1bc89a6875c
--- /dev/null
+++ b/db/migrate/20230228142350_add_notifications_work_item_widget.rb
@@ -0,0 +1,57 @@
+# frozen_string_literal: true
+
+class AddNotificationsWorkItemWidget < Gitlab::Database::Migration[2.1]
+ class WorkItemType < MigrationRecord
+ self.table_name = 'work_item_types'
+ end
+
+ class WidgetDefinition < MigrationRecord
+ self.table_name = 'work_item_widget_definitions'
+ end
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+ disable_ddl_transaction!
+
+ WIDGET_NAME = 'Notifications'
+ WIDGET_ENUM_VALUE = 14
+ WORK_ITEM_TYPES = [
+ 'Issue',
+ 'Incident',
+ 'Test Case',
+ 'Requirement',
+ 'Task',
+ 'Objective',
+ 'Key Result'
+ ].freeze
+
+ def up
+ widgets = []
+
+ WORK_ITEM_TYPES.each do |type_name|
+ type = WorkItemType.find_by_name_and_namespace_id(type_name, nil)
+
+ unless type
+ Gitlab::AppLogger.warn("type #{type_name} is missing, not adding widget")
+
+ next
+ end
+
+ widgets << {
+ work_item_type_id: type.id,
+ name: WIDGET_NAME,
+ widget_type: WIDGET_ENUM_VALUE
+ }
+ end
+
+ return if widgets.empty?
+
+ WidgetDefinition.upsert_all(
+ widgets,
+ unique_by: :index_work_item_widget_definitions_on_default_witype_and_name
+ )
+ end
+
+ def down
+ WidgetDefinition.where(name: WIDGET_NAME).delete_all
+ end
+end
diff --git a/db/migrate/20230228212427_add_index_user_details_on_user_id_for_enterprise_users_without_date.rb b/db/migrate/20230228212427_add_index_user_details_on_user_id_for_enterprise_users_without_date.rb
new file mode 100644
index 00000000000..198aee2201c
--- /dev/null
+++ b/db/migrate/20230228212427_add_index_user_details_on_user_id_for_enterprise_users_without_date.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexUserDetailsOnUserIdForEnterpriseUsersWithoutDate < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'index_user_details_on_user_id_for_enterprise_users_without_date'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(
+ :user_details, :user_id,
+ where: 'provisioned_by_group_id IS NOT NULL AND provisioned_by_group_at IS NULL',
+ name: INDEX_NAME
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name :user_details, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230228212905_add_index_user_details_on_user_id_for_enterprise_users_with_date.rb b/db/migrate/20230228212905_add_index_user_details_on_user_id_for_enterprise_users_with_date.rb
new file mode 100644
index 00000000000..e57d4fc4261
--- /dev/null
+++ b/db/migrate/20230228212905_add_index_user_details_on_user_id_for_enterprise_users_with_date.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexUserDetailsOnUserIdForEnterpriseUsersWithDate < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'index_user_details_on_user_id_for_enterprise_users_with_date'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(
+ :user_details, :user_id,
+ where: 'provisioned_by_group_id IS NOT NULL AND provisioned_by_group_at IS NOT NULL',
+ name: INDEX_NAME
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name :user_details, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230303144424_unique_index_on_catalog_resources_project.rb b/db/migrate/20230303144424_unique_index_on_catalog_resources_project.rb
new file mode 100644
index 00000000000..6ac2e72616a
--- /dev/null
+++ b/db/migrate/20230303144424_unique_index_on_catalog_resources_project.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class UniqueIndexOnCatalogResourcesProject < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_catalog_resources_on_project_id'
+
+ def up
+ remove_concurrent_index :catalog_resources, :project_id, name: INDEX_NAME
+ add_concurrent_index :catalog_resources, :project_id, unique: true, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :catalog_resources, :project_id, name: INDEX_NAME
+ add_concurrent_index :catalog_resources, :project_id, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230306145230_add_product_analytics_data_collector_host_to_application_settings.rb b/db/migrate/20230306145230_add_product_analytics_data_collector_host_to_application_settings.rb
new file mode 100644
index 00000000000..4ae2479b1e6
--- /dev/null
+++ b/db/migrate/20230306145230_add_product_analytics_data_collector_host_to_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddProductAnalyticsDataCollectorHostToApplicationSettings < Gitlab::Database::Migration[2.1]
+ # rubocop:disable Migration/AddLimitToTextColumns
+ def change
+ add_column :application_settings, :product_analytics_data_collector_host, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20230307091216_add_status_reporter_id_and_id_index_to_abuse_reports.rb b/db/migrate/20230307091216_add_status_reporter_id_and_id_index_to_abuse_reports.rb
new file mode 100644
index 00000000000..cfd077368c8
--- /dev/null
+++ b/db/migrate/20230307091216_add_status_reporter_id_and_id_index_to_abuse_reports.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddStatusReporterIdAndIdIndexToAbuseReports < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'index_abuse_reports_on_status_reporter_id_and_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :abuse_reports, [:status, :reporter_id, :id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :abuse_reports, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20230307122838_add_text_limit_to_application_settings_product_analytics_data_collector_host.rb b/db/migrate/20230307122838_add_text_limit_to_application_settings_product_analytics_data_collector_host.rb
new file mode 100644
index 00000000000..4f87cc9aee0
--- /dev/null
+++ b/db/migrate/20230307122838_add_text_limit_to_application_settings_product_analytics_data_collector_host.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddTextLimitToApplicationSettingsProductAnalyticsDataCollectorHost < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :application_settings, :product_analytics_data_collector_host, 255
+ end
+
+ def down
+ remove_text_limit :application_settings, :product_analytics_data_collector_host
+ end
+end
diff --git a/db/migrate/20230307233631_add_public_runner_release_version_fetch_setting.rb b/db/migrate/20230307233631_add_public_runner_release_version_fetch_setting.rb
new file mode 100644
index 00000000000..584774d58ad
--- /dev/null
+++ b/db/migrate/20230307233631_add_public_runner_release_version_fetch_setting.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class AddPublicRunnerReleaseVersionFetchSetting < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ add_column :application_settings, :update_runner_versions_enabled, :boolean,
+ default: true, null: false, if_not_exists: true
+ end
+
+ def down
+ remove_column :application_settings, :update_runner_versions_enabled, if_exists: true
+ end
+end
diff --git a/db/migrate/20230308163018_create_container_registry_data_repair_details.rb b/db/migrate/20230308163018_create_container_registry_data_repair_details.rb
new file mode 100644
index 00000000000..b682eb6ee7e
--- /dev/null
+++ b/db/migrate/20230308163018_create_container_registry_data_repair_details.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class CreateContainerRegistryDataRepairDetails < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ create_table :container_registry_data_repair_details, id: false do |t|
+ t.integer :missing_count, default: 0
+ t.references :project,
+ primary_key: true,
+ default: nil,
+ index: false,
+ foreign_key: { to_table: :projects, on_delete: :cascade }
+ t.timestamps_with_timezone null: false
+ end
+ end
+end
diff --git a/db/migrate/20230309000957_add_external_identifiers_to_import_failures.rb b/db/migrate/20230309000957_add_external_identifiers_to_import_failures.rb
new file mode 100644
index 00000000000..f95cf0035d4
--- /dev/null
+++ b/db/migrate/20230309000957_add_external_identifiers_to_import_failures.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddExternalIdentifiersToImportFailures < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ add_column :import_failures, :external_identifiers, :jsonb, default: {}, null: false
+ end
+end
diff --git a/db/migrate/20230313054226_add_status_created_at_and_updated_at_indexes_to_abuse_reports.rb b/db/migrate/20230313054226_add_status_created_at_and_updated_at_indexes_to_abuse_reports.rb
new file mode 100644
index 00000000000..b619d6b8732
--- /dev/null
+++ b/db/migrate/20230313054226_add_status_created_at_and_updated_at_indexes_to_abuse_reports.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddStatusCreatedAtAndUpdatedAtIndexesToAbuseReports < Gitlab::Database::Migration[2.1]
+ STATUS_AND_CREATED_AT_INDEX = 'index_abuse_reports_on_status_and_created_at'
+ STATUS_AND_UPDATED_AT_INDEX = 'index_abuse_reports_on_status_and_updated_at'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :abuse_reports, [:status, :created_at], name: STATUS_AND_CREATED_AT_INDEX
+ add_concurrent_index :abuse_reports, [:status, :updated_at], name: STATUS_AND_UPDATED_AT_INDEX
+ end
+
+ def down
+ remove_concurrent_index_by_name :abuse_reports, STATUS_AND_CREATED_AT_INDEX
+ remove_concurrent_index_by_name :abuse_reports, STATUS_AND_UPDATED_AT_INDEX
+ end
+end
diff --git a/db/migrate/20230313100920_add_gitlab_dedicated_instance_to_application_settings.rb b/db/migrate/20230313100920_add_gitlab_dedicated_instance_to_application_settings.rb
new file mode 100644
index 00000000000..ce83c022661
--- /dev/null
+++ b/db/migrate/20230313100920_add_gitlab_dedicated_instance_to_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddGitlabDedicatedInstanceToApplicationSettings < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ add_column :application_settings, :gitlab_dedicated_instance, :boolean, default: false, null: false
+ end
+end
diff --git a/db/post_migrate/20230113201308_backfill_namespace_ldap_settings.rb b/db/post_migrate/20230113201308_backfill_namespace_ldap_settings.rb
new file mode 100644
index 00000000000..19020fecad5
--- /dev/null
+++ b/db/post_migrate/20230113201308_backfill_namespace_ldap_settings.rb
@@ -0,0 +1,33 @@
+# 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 BackfillNamespaceLdapSettings < Gitlab::Database::Migration[2.1]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+ disable_ddl_transaction!
+
+ DOWNTIME = false
+ MIGRATION = 'BackfillNamespaceLdapSettings'
+ TABLE_NAME = 'namespaces'
+ PRIMARY_KEY = :id
+ INTERVAL = 2.minutes
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ TABLE_NAME,
+ PRIMARY_KEY,
+ job_interval: INTERVAL
+ )
+ end
+
+ def down
+ delete_batched_background_migration(
+ MIGRATION,
+ TABLE_NAME,
+ PRIMARY_KEY,
+ []
+ )
+ end
+end
diff --git a/db/post_migrate/20230118144623_schedule_migration_for_remediation.rb b/db/post_migrate/20230118144623_schedule_migration_for_remediation.rb
new file mode 100644
index 00000000000..ed95ecfaad3
--- /dev/null
+++ b/db/post_migrate/20230118144623_schedule_migration_for_remediation.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class ScheduleMigrationForRemediation < Gitlab::Database::Migration[2.1]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ MIGRATION = 'MigrateRemediationsForVulnerabilityFindings'
+ DELAY_INTERVAL = 2.minutes
+ SUB_BATCH_SIZE = 500
+ BATCH_SIZE = 5000
+
+ def up
+ # no-op as described in https://docs.gitlab.com/ee/development/database/batched_background_migrations.html
+ end
+
+ def down
+ # no-op as described in https://docs.gitlab.com/ee/development/database/batched_background_migrations.html
+ end
+end
diff --git a/db/post_migrate/20230125195503_queue_backfill_compliance_violations.rb b/db/post_migrate/20230125195503_queue_backfill_compliance_violations.rb
new file mode 100644
index 00000000000..5f797421bd5
--- /dev/null
+++ b/db/post_migrate/20230125195503_queue_backfill_compliance_violations.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class QueueBackfillComplianceViolations < Gitlab::Database::Migration[2.1]
+ MIGRATION = 'BackfillComplianceViolations'
+ INTERVAL = 2.minutes
+ BATCH_SIZE = 10_000
+
+ disable_ddl_transaction!
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :merge_requests_compliance_violations,
+ :id,
+ job_interval: INTERVAL,
+ batch_size: BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :merge_requests_compliance_violations, :id, [])
+ end
+end
diff --git a/db/post_migrate/20230126101907_add_partition_index_to_web_hook_logs.rb b/db/post_migrate/20230126101907_add_partition_index_to_web_hook_logs.rb
new file mode 100644
index 00000000000..4196767033c
--- /dev/null
+++ b/db/post_migrate/20230126101907_add_partition_index_to_web_hook_logs.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddPartitionIndexToWebHookLogs < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_web_hook_logs_on_web_hook_id_and_created_at'
+
+ def up
+ add_concurrent_partitioned_index(
+ :web_hook_logs,
+ [:web_hook_id, :created_at],
+ name: INDEX_NAME
+ )
+ end
+
+ def down
+ remove_concurrent_partitioned_index_by_name :web_hook_logs, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230130182412_schedule_create_vulnerability_links_migration.rb b/db/post_migrate/20230130182412_schedule_create_vulnerability_links_migration.rb
new file mode 100644
index 00000000000..a1162ce98d5
--- /dev/null
+++ b/db/post_migrate/20230130182412_schedule_create_vulnerability_links_migration.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class ScheduleCreateVulnerabilityLinksMigration < Gitlab::Database::Migration[2.1]
+ MIGRATION = 'CreateVulnerabilityLinks'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 250
+ SUB_BATCH_SIZE = 5
+
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :vulnerability_feedback,
+ :id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :vulnerability_feedback, :id, [])
+ end
+end
diff --git a/db/post_migrate/20230131184319_update_billable_users_index_for_service_accounts.rb b/db/post_migrate/20230131184319_update_billable_users_index_for_service_accounts.rb
new file mode 100644
index 00000000000..e86a2476156
--- /dev/null
+++ b/db/post_migrate/20230131184319_update_billable_users_index_for_service_accounts.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class UpdateBillableUsersIndexForServiceAccounts < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ OLD_INDEX = 'index_users_for_billable_users'
+ NEW_INDEX = 'index_users_for_active_billable_users'
+
+ OLD_INDEX_CONDITION = <<~QUERY
+ ((state)::text = 'active'::text) AND ((user_type IS NULL)
+ OR (user_type = ANY (ARRAY[6, 4]))) AND
+ ((user_type IS NULL) OR (user_type = ANY (ARRAY[4, 5])))
+ QUERY
+ NEW_INDEX_CONDITION = <<~QUERY
+ state = 'active' AND (user_type IS NULL OR user_type IN (6, 4, 13)) AND (user_type IS NULL OR user_type IN (4, 5))
+ QUERY
+
+ def up
+ add_concurrent_index(:users, :id, where: NEW_INDEX_CONDITION, name: NEW_INDEX)
+ remove_concurrent_index_by_name(:users, OLD_INDEX)
+ end
+
+ def down
+ add_concurrent_index(:users, :id, where: OLD_INDEX_CONDITION, name: OLD_INDEX)
+ remove_concurrent_index_by_name(:users, NEW_INDEX)
+ end
+end
diff --git a/db/post_migrate/20230202135758_queue_backfill_prepared_at_data.rb b/db/post_migrate/20230202135758_queue_backfill_prepared_at_data.rb
new file mode 100644
index 00000000000..227b469b625
--- /dev/null
+++ b/db/post_migrate/20230202135758_queue_backfill_prepared_at_data.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class QueueBackfillPreparedAtData < Gitlab::Database::Migration[2.1]
+ MIGRATION = 'BackfillPreparedAtMergeRequests'
+ DELAY_INTERVAL = 2.minutes
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :merge_requests,
+ :id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: 5000,
+ sub_batch_size: 250
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :merge_requests, :id, [])
+ end
+end
diff --git a/db/post_migrate/20230202211434_migrate_redis_slot_keys.rb b/db/post_migrate/20230202211434_migrate_redis_slot_keys.rb
new file mode 100644
index 00000000000..e1d3787cbb3
--- /dev/null
+++ b/db/post_migrate/20230202211434_migrate_redis_slot_keys.rb
@@ -0,0 +1,113 @@
+# frozen_string_literal: true
+
+class MigrateRedisSlotKeys < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ BackupHLLRedisCounter.known_events.each do |event|
+ if event[:aggregation].to_sym == :daily
+ migrate_daily_aggregated(event)
+ else
+ migrate_weekly_aggregated(event)
+ end
+ end
+ end
+
+ def down
+ # no-op
+ end
+
+ private
+
+ def migrate_daily_aggregated(event)
+ days_back = BackupHLLRedisCounter::DEFAULT_DAILY_KEY_EXPIRY_LENGTH
+ start_date = Date.today - days_back - 1.day
+ end_date = Date.today + 1.day
+
+ (start_date..end_date).each do |date|
+ rename_key(event, date)
+ end
+ end
+
+ def migrate_weekly_aggregated(event)
+ weeks_back = BackupHLLRedisCounter::DEFAULT_WEEKLY_KEY_EXPIRY_LENGTH
+ start_date = (Date.today - weeks_back).beginning_of_week - 1.day
+ end_date = Date.today.end_of_week + 1.day
+
+ (start_date..end_date).each { |date| rename_key(event, date) }
+ end
+
+ def rename_key(event, date)
+ old_key = old_redis_key(event, date)
+ new_key = BackupHLLRedisCounter.redis_key(event, date)
+
+ # cannot simply rename due to different slots
+ Gitlab::Redis::SharedState.with do |r|
+ break unless r.exists?(old_key)
+
+ Gitlab::Redis::HLL.add(
+ key: new_key,
+ value: r.pfcount(old_key),
+ expiry: r.ttl(old_key)
+ )
+ end
+ end
+
+ def old_redis_key(event, time)
+ name_with_slot = if event[:redis_slot].present?
+ event[:name].to_s.gsub(event[:redis_slot], "{#{event[:redis_slot]}}")
+ else
+ "{#{event[:name]}}"
+ end
+
+ BackupHLLRedisCounter.apply_time_aggregation(name_with_slot, time, event)
+ end
+
+ # :nocov: Existing backed up class # rubocop:disable Gitlab/NoCodeCoverageComment
+ module BackupHLLRedisCounter
+ DEFAULT_WEEKLY_KEY_EXPIRY_LENGTH = 6.weeks
+ DEFAULT_DAILY_KEY_EXPIRY_LENGTH = 29.days
+ REDIS_SLOT = 'hll_counters'
+
+ KNOWN_EVENTS_PATH = File.expand_path('known_events/*.yml', __dir__)
+ ALLOWED_AGGREGATIONS = %i[daily weekly].freeze
+
+ class << self
+ def known_events
+ @known_events ||= load_events(KNOWN_EVENTS_PATH)
+ end
+
+ def load_events(wildcard)
+ Dir[wildcard].each_with_object([]) do |path, events|
+ events.push(*load_yaml_from_path(path))
+ end
+ end
+
+ def load_yaml_from_path(path)
+ YAML.safe_load(File.read(path))&.map(&:with_indifferent_access)
+ end
+
+ def known_events_names
+ known_events.map { |event| event[:name] } # rubocop:disable Rails/Pluck
+ end
+
+ def redis_key(event, time, context = '')
+ key = "{#{REDIS_SLOT}}_#{event[:name]}"
+ key = apply_time_aggregation(key, time, event)
+ key = "#{context}_#{key}" if context.present?
+ key
+ end
+
+ def apply_time_aggregation(key, time, event)
+ if event[:aggregation].to_sym == :daily
+ year_day = time.strftime('%G-%j')
+ "#{year_day}-#{key}"
+ else
+ year_week = time.strftime('%G-%V')
+ "#{key}-#{year_week}"
+ end
+ end
+ end
+ end
+ # :nocov: # rubocop:disable Gitlab/NoCodeCoverageComment
+end
diff --git a/db/post_migrate/20230208125736_schedule_migration_for_links.rb b/db/post_migrate/20230208125736_schedule_migration_for_links.rb
new file mode 100644
index 00000000000..c1bd1bbbe51
--- /dev/null
+++ b/db/post_migrate/20230208125736_schedule_migration_for_links.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class ScheduleMigrationForLinks < Gitlab::Database::Migration[2.1]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ MIGRATION = 'MigrateLinksForVulnerabilityFindings'
+ DELAY_INTERVAL = 2.minutes
+ SUB_BATCH_SIZE = 500
+ BATCH_SIZE = 10000
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :vulnerability_occurrences,
+ :id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :vulnerability_occurrences, :id, [])
+ end
+end
diff --git a/db/post_migrate/20230213103019_add_index_for_next_over_limit_check_at.rb b/db/post_migrate/20230213103019_add_index_for_next_over_limit_check_at.rb
new file mode 100644
index 00000000000..29c59cea3ff
--- /dev/null
+++ b/db/post_migrate/20230213103019_add_index_for_next_over_limit_check_at.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexForNextOverLimitCheckAt < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = 'namespace_details'
+ INDEX_NAME = 'index_next_over_limit_check_at_asc_order'
+
+ def up
+ prepare_async_index TABLE_NAME,
+ :next_over_limit_check_at,
+ order: { next_over_limit_check_at: 'ASC NULLS FIRST' },
+ name: INDEX_NAME
+ end
+
+ def down
+ unprepare_async_index TABLE_NAME, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230214181633_finalize_ci_build_needs_big_int_conversion.rb b/db/post_migrate/20230214181633_finalize_ci_build_needs_big_int_conversion.rb
new file mode 100644
index 00000000000..63b6148df6b
--- /dev/null
+++ b/db/post_migrate/20230214181633_finalize_ci_build_needs_big_int_conversion.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class FinalizeCiBuildNeedsBigIntConversion < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_ci
+
+ TABLE_NAME = 'ci_build_needs'
+
+ def up
+ return unless should_run?
+
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
+ table_name: TABLE_NAME,
+ column_name: 'id',
+ job_arguments: [['id'], ['id_convert_to_bigint']]
+ )
+ end
+
+ def down; end
+
+ private
+
+ def should_run?
+ !Gitlab.jh? && (Gitlab.com? || Gitlab.dev_or_test_env?)
+ end
+end
diff --git a/db/post_migrate/20230215213349_add_sync_index_on_packages_package_file_filename.rb b/db/post_migrate/20230215213349_add_sync_index_on_packages_package_file_filename.rb
new file mode 100644
index 00000000000..9a2e7abbbc1
--- /dev/null
+++ b/db/post_migrate/20230215213349_add_sync_index_on_packages_package_file_filename.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddSyncIndexOnPackagesPackageFileFilename < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'index_packages_package_files_on_file_name'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(
+ :packages_package_files,
+ :file_name,
+ name: INDEX_NAME,
+ using: :gin,
+ opclass: { description: :gin_trgm_ops }
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name :packages_package_files, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230216060333_prepare_async_foreign_key_validation_for_ci_build_trace_metadata.rb b/db/post_migrate/20230216060333_prepare_async_foreign_key_validation_for_ci_build_trace_metadata.rb
new file mode 100644
index 00000000000..1d5999acc61
--- /dev/null
+++ b/db/post_migrate/20230216060333_prepare_async_foreign_key_validation_for_ci_build_trace_metadata.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class PrepareAsyncForeignKeyValidationForCiBuildTraceMetadata < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = :ci_build_trace_metadata
+ COLUMN_NAMES = [:partition_id, :build_id]
+ FOREIGN_KEY_NAME = :fk_rails_aebc78111f_p
+
+ def up
+ prepare_async_foreign_key_validation(TABLE_NAME, COLUMN_NAMES, name: FOREIGN_KEY_NAME)
+ end
+
+ def down
+ unprepare_async_foreign_key_validation(TABLE_NAME, COLUMN_NAMES, name: FOREIGN_KEY_NAME)
+ end
+end
diff --git a/db/post_migrate/20230216191507_delete_incorrectly_onboarded_namespaces.rb b/db/post_migrate/20230216191507_delete_incorrectly_onboarded_namespaces.rb
new file mode 100644
index 00000000000..5da485fd442
--- /dev/null
+++ b/db/post_migrate/20230216191507_delete_incorrectly_onboarded_namespaces.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class DeleteIncorrectlyOnboardedNamespaces < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ # Changed to a no-op, this migration was reverted after
+ # an incident during a deploy to production on gitlab.com
+ # https://gitlab.com/gitlab-com/gl-infra/production/-/issues/8436
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20230216222956_add_sync_index_on_lfs_objects_file.rb b/db/post_migrate/20230216222956_add_sync_index_on_lfs_objects_file.rb
new file mode 100644
index 00000000000..8eda3345713
--- /dev/null
+++ b/db/post_migrate/20230216222956_add_sync_index_on_lfs_objects_file.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddSyncIndexOnLfsObjectsFile < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'index_lfs_objects_on_file'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :lfs_objects, :file, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :lfs_objects, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230216232404_add_sync_index_on_merge_request_diffs_external_diff.rb b/db/post_migrate/20230216232404_add_sync_index_on_merge_request_diffs_external_diff.rb
new file mode 100644
index 00000000000..2f9b12f89c1
--- /dev/null
+++ b/db/post_migrate/20230216232404_add_sync_index_on_merge_request_diffs_external_diff.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddSyncIndexOnMergeRequestDiffsExternalDiff < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'index_merge_request_diffs_on_external_diff'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :merge_request_diffs, :external_diff, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :merge_request_diffs, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230216233937_remove_application_settings_send_user_confirmation_email_column.rb b/db/post_migrate/20230216233937_remove_application_settings_send_user_confirmation_email_column.rb
new file mode 100644
index 00000000000..d7720ebccbd
--- /dev/null
+++ b/db/post_migrate/20230216233937_remove_application_settings_send_user_confirmation_email_column.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class RemoveApplicationSettingsSendUserConfirmationEmailColumn < Gitlab::Database::Migration[2.1]
+ def change
+ remove_column :application_settings, :send_user_confirmation_email, :boolean, default: false
+ end
+end
diff --git a/db/post_migrate/20230218145930_add_index_users_on_updated_at.rb b/db/post_migrate/20230218145930_add_index_users_on_updated_at.rb
new file mode 100644
index 00000000000..229c3e1babd
--- /dev/null
+++ b/db/post_migrate/20230218145930_add_index_users_on_updated_at.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class AddIndexUsersOnUpdatedAt < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = 'users'
+ INDEX_NAME = 'index_users_on_updated_at'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index TABLE_NAME, :updated_at, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230218145940_add_index_namespaces_on_updated_at.rb b/db/post_migrate/20230218145940_add_index_namespaces_on_updated_at.rb
new file mode 100644
index 00000000000..cbad26fb142
--- /dev/null
+++ b/db/post_migrate/20230218145940_add_index_namespaces_on_updated_at.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class AddIndexNamespacesOnUpdatedAt < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = 'namespaces'
+ INDEX_NAME = 'index_namespaces_on_updated_at'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index TABLE_NAME, :updated_at, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230218152729_validate_fk_on_ci_job_artifacts_partition_id_and_job_id.rb b/db/post_migrate/20230218152729_validate_fk_on_ci_job_artifacts_partition_id_and_job_id.rb
new file mode 100644
index 00000000000..9a9cb0d9487
--- /dev/null
+++ b/db/post_migrate/20230218152729_validate_fk_on_ci_job_artifacts_partition_id_and_job_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class ValidateFkOnCiJobArtifactsPartitionIdAndJobId < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = :ci_job_artifacts
+ FK_NAME = :fk_rails_c5137cb2c1_p
+ COLUMNS = [:partition_id, :job_id]
+
+ def up
+ validate_foreign_key(TABLE_NAME, COLUMNS, name: FK_NAME)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20230218152730_remove_fk_to_ci_builds_ci_job_artifacts_on_job_id.rb b/db/post_migrate/20230218152730_remove_fk_to_ci_builds_ci_job_artifacts_on_job_id.rb
new file mode 100644
index 00000000000..02747d57eab
--- /dev/null
+++ b/db/post_migrate/20230218152730_remove_fk_to_ci_builds_ci_job_artifacts_on_job_id.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class RemoveFkToCiBuildsCiJobArtifactsOnJobId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = :ci_job_artifacts
+ TARGET_TABLE_NAME = :ci_builds
+ COLUMN = :job_id
+ TARGET_COLUMN = :id
+ FK_NAME = :fk_rails_c5137cb2c1
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ name: FK_NAME,
+ reverse_lock_order: true
+ )
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ column: COLUMN,
+ target_column: TARGET_COLUMN,
+ validate: true,
+ reverse_lock_order: true,
+ on_delete: :cascade,
+ name: FK_NAME
+ )
+ end
+end
diff --git a/db/post_migrate/20230219191034_add_pipeline_fk_to_vulnerability_state_transitions.rb b/db/post_migrate/20230219191034_add_pipeline_fk_to_vulnerability_state_transitions.rb
new file mode 100644
index 00000000000..5c09c75861a
--- /dev/null
+++ b/db/post_migrate/20230219191034_add_pipeline_fk_to_vulnerability_state_transitions.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddPipelineFkToVulnerabilityStateTransitions < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_vulnerability_state_transitions_on_pipeline_id'
+
+ def up
+ add_concurrent_index :vulnerability_state_transitions, :state_changed_at_pipeline_id, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :vulnerability_state_transitions, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230220102212_swap_columns_ci_build_needs_big_int_conversion.rb b/db/post_migrate/20230220102212_swap_columns_ci_build_needs_big_int_conversion.rb
new file mode 100644
index 00000000000..de98847fad4
--- /dev/null
+++ b/db/post_migrate/20230220102212_swap_columns_ci_build_needs_big_int_conversion.rb
@@ -0,0 +1,57 @@
+# frozen_string_literal: true
+
+class SwapColumnsCiBuildNeedsBigIntConversion < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'ci_build_needs'
+
+ def up
+ return unless should_run?
+
+ swap
+ end
+
+ def down
+ return unless should_run?
+
+ swap
+ end
+
+ private
+
+ def should_run?
+ !Gitlab.jh? && (Gitlab.com? || Gitlab.dev_or_test_env?)
+ end
+
+ def swap
+ add_concurrent_index TABLE_NAME, :id_convert_to_bigint, unique: true, name:
+ 'index_ci_build_needs_on_id_convert_to_bigint'
+
+ with_lock_retries(raise_on_exhaustion: true) do
+ execute "LOCK TABLE #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE"
+
+ id_name = quote_column_name(:id)
+ temp_name = quote_column_name('id_tmp')
+ id_convert_to_bigint_name = quote_column_name(:id_convert_to_bigint)
+
+ execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN #{id_name} TO #{temp_name}"
+ execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN #{id_convert_to_bigint_name} TO #{id_name}"
+ execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN #{temp_name} TO #{id_convert_to_bigint_name}"
+
+ function_name = Gitlab::Database::UnidirectionalCopyTrigger.on_table(
+ TABLE_NAME, connection: Ci::ApplicationRecord.connection
+ ).name(
+ :id, :id_convert_to_bigint
+ )
+ execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL"
+
+ execute "ALTER SEQUENCE ci_build_needs_id_seq OWNED BY #{TABLE_NAME}.id"
+ change_column_default TABLE_NAME, :id, -> { "nextval('ci_build_needs_id_seq'::regclass)" }
+ change_column_default TABLE_NAME, :id_convert_to_bigint, 0
+
+ execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT ci_build_needs_pkey CASCADE"
+ rename_index TABLE_NAME, 'index_ci_build_needs_on_id_convert_to_bigint', 'ci_build_needs_pkey'
+ execute "ALTER TABLE #{TABLE_NAME} ADD CONSTRAINT ci_build_needs_pkey PRIMARY KEY USING INDEX ci_build_needs_pkey"
+ end
+ end
+end
diff --git a/db/post_migrate/20230220112930_replace_uniq_index_on_postgres_async_foreign_key_validations.rb b/db/post_migrate/20230220112930_replace_uniq_index_on_postgres_async_foreign_key_validations.rb
new file mode 100644
index 00000000000..1adc275e1e9
--- /dev/null
+++ b/db/post_migrate/20230220112930_replace_uniq_index_on_postgres_async_foreign_key_validations.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class ReplaceUniqIndexOnPostgresAsyncForeignKeyValidations < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ NEW_INDEX_NAME = 'unique_postgres_async_fk_validations_name_and_table_name'
+ OLD_INDEX_NAME = 'index_postgres_async_foreign_key_validations_on_name'
+ TABLE_NAME = 'postgres_async_foreign_key_validations'
+
+ def up
+ add_concurrent_index TABLE_NAME, [:name, :table_name], unique: true, name: NEW_INDEX_NAME
+ remove_concurrent_index_by_name TABLE_NAME, OLD_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index TABLE_NAME, :name, unique: true, name: OLD_INDEX_NAME
+ remove_concurrent_index_by_name TABLE_NAME, NEW_INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230220132409_validate_fk_on_ci_build_report_results_partition_id_and_build_id.rb b/db/post_migrate/20230220132409_validate_fk_on_ci_build_report_results_partition_id_and_build_id.rb
new file mode 100644
index 00000000000..5186f5f397e
--- /dev/null
+++ b/db/post_migrate/20230220132409_validate_fk_on_ci_build_report_results_partition_id_and_build_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class ValidateFkOnCiBuildReportResultsPartitionIdAndBuildId < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = :ci_build_report_results
+ FK_NAME = :fk_rails_16cb1ff064_p
+ COLUMNS = [:partition_id, :build_id]
+
+ def up
+ validate_foreign_key(TABLE_NAME, COLUMNS, name: FK_NAME)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20230220132410_remove_fk_to_ci_builds_ci_build_report_results_on_build_id.rb b/db/post_migrate/20230220132410_remove_fk_to_ci_builds_ci_build_report_results_on_build_id.rb
new file mode 100644
index 00000000000..8cbcdf27374
--- /dev/null
+++ b/db/post_migrate/20230220132410_remove_fk_to_ci_builds_ci_build_report_results_on_build_id.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class RemoveFkToCiBuildsCiBuildReportResultsOnBuildId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = :ci_build_report_results
+ TARGET_TABLE_NAME = :ci_builds
+ COLUMN = :build_id
+ TARGET_COLUMN = :id
+ FK_NAME = :fk_rails_16cb1ff064
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ name: FK_NAME,
+ reverse_lock_order: true
+ )
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ column: COLUMN,
+ target_column: TARGET_COLUMN,
+ validate: true,
+ reverse_lock_order: true,
+ on_delete: :cascade,
+ name: FK_NAME
+ )
+ end
+end
diff --git a/db/post_migrate/20230220134145_validate_fk_on_ci_build_needs_partition_id_and_build_id.rb b/db/post_migrate/20230220134145_validate_fk_on_ci_build_needs_partition_id_and_build_id.rb
new file mode 100644
index 00000000000..eec60a51834
--- /dev/null
+++ b/db/post_migrate/20230220134145_validate_fk_on_ci_build_needs_partition_id_and_build_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class ValidateFkOnCiBuildNeedsPartitionIdAndBuildId < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = :ci_build_needs
+ FK_NAME = :fk_rails_3cf221d4ed_p
+ COLUMNS = [:partition_id, :build_id]
+
+ def up
+ validate_foreign_key(TABLE_NAME, COLUMNS, name: FK_NAME)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20230220134146_remove_fk_to_ci_builds_ci_build_needs_on_build_id.rb b/db/post_migrate/20230220134146_remove_fk_to_ci_builds_ci_build_needs_on_build_id.rb
new file mode 100644
index 00000000000..04e7ec11ee6
--- /dev/null
+++ b/db/post_migrate/20230220134146_remove_fk_to_ci_builds_ci_build_needs_on_build_id.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class RemoveFkToCiBuildsCiBuildNeedsOnBuildId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = :ci_build_needs
+ TARGET_TABLE_NAME = :ci_builds
+ COLUMN = :build_id
+ TARGET_COLUMN = :id
+ FK_NAME = :fk_rails_3cf221d4ed
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ name: FK_NAME,
+ reverse_lock_order: true
+ )
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ column: COLUMN,
+ target_column: TARGET_COLUMN,
+ validate: true,
+ reverse_lock_order: true,
+ on_delete: :cascade,
+ name: FK_NAME
+ )
+ end
+end
diff --git a/db/post_migrate/20230220165240_add_index_to_approval_rules_on_scan_result_policy_id.rb b/db/post_migrate/20230220165240_add_index_to_approval_rules_on_scan_result_policy_id.rb
new file mode 100644
index 00000000000..b510fdb0f86
--- /dev/null
+++ b/db/post_migrate/20230220165240_add_index_to_approval_rules_on_scan_result_policy_id.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexToApprovalRulesOnScanResultPolicyId < Gitlab::Database::Migration[2.1]
+ PROJECT_INDEX_NAME = 'idx_approval_project_rules_on_scan_result_policy_id'
+ MERGE_REQUEST_INDEX_NAME = 'idx_approval_merge_request_rules_on_scan_result_policy_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :approval_project_rules, :scan_result_policy_id, name: PROJECT_INDEX_NAME
+ add_concurrent_index :approval_merge_request_rules, :scan_result_policy_id, name: MERGE_REQUEST_INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :approval_project_rules, :scan_result_policy_id, name: PROJECT_INDEX_NAME
+ remove_concurrent_index_by_name :approval_merge_request_rules, :scan_result_policy_id,
+ name: MERGE_REQUEST_INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230221010522_prepare_async_foreign_key_validation_for_ci_sources_pipelines.rb b/db/post_migrate/20230221010522_prepare_async_foreign_key_validation_for_ci_sources_pipelines.rb
new file mode 100644
index 00000000000..e25bbca5c80
--- /dev/null
+++ b/db/post_migrate/20230221010522_prepare_async_foreign_key_validation_for_ci_sources_pipelines.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class PrepareAsyncForeignKeyValidationForCiSourcesPipelines < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = :ci_sources_pipelines
+ COLUMN_NAMES = [:source_partition_id, :source_job_id]
+ FOREIGN_KEY_NAME = :fk_be5624bf37_p
+
+ def up
+ prepare_async_foreign_key_validation(TABLE_NAME, COLUMN_NAMES, name: FOREIGN_KEY_NAME)
+ end
+
+ def down
+ unprepare_async_foreign_key_validation(TABLE_NAME, COLUMN_NAMES, name: FOREIGN_KEY_NAME)
+ end
+end
diff --git a/db/post_migrate/20230221011750_prepare_async_foreign_key_validation_for_ci_job_variables.rb b/db/post_migrate/20230221011750_prepare_async_foreign_key_validation_for_ci_job_variables.rb
new file mode 100644
index 00000000000..973c4c7316d
--- /dev/null
+++ b/db/post_migrate/20230221011750_prepare_async_foreign_key_validation_for_ci_job_variables.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class PrepareAsyncForeignKeyValidationForCiJobVariables < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = :ci_job_variables
+ COLUMN_NAMES = [:partition_id, :job_id]
+ FOREIGN_KEY_NAME = :fk_rails_fbf3b34792_p
+
+ def up
+ prepare_async_foreign_key_validation(TABLE_NAME, COLUMN_NAMES, name: FOREIGN_KEY_NAME)
+ end
+
+ def down
+ unprepare_async_foreign_key_validation(TABLE_NAME, COLUMN_NAMES, name: FOREIGN_KEY_NAME)
+ end
+end
diff --git a/db/post_migrate/20230221093533_add_tmp_partial_index_on_vulnerability_report_types.rb b/db/post_migrate/20230221093533_add_tmp_partial_index_on_vulnerability_report_types.rb
new file mode 100644
index 00000000000..4800ce5ed4c
--- /dev/null
+++ b/db/post_migrate/20230221093533_add_tmp_partial_index_on_vulnerability_report_types.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddTmpPartialIndexOnVulnerabilityReportTypes < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'tmp_idx_vulnerability_occurrences_on_id_where_report_type_7_99'
+ CLAUSE = 'report_type IN (7, 99)'
+
+ def up
+ # Temporary index to be removed in 15.11 https://gitlab.com/gitlab-org/gitlab/-/issues/393052
+ prepare_async_index :vulnerability_occurrences, :id, where: CLAUSE, name: INDEX_NAME
+ end
+
+ def down
+ unprepare_async_index :vulnerability_occurrences, :id, name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230221125148_add_fk_to_p_ci_builds_metadata_partitions_on_partition_id_and_build_id.rb b/db/post_migrate/20230221125148_add_fk_to_p_ci_builds_metadata_partitions_on_partition_id_and_build_id.rb
new file mode 100644
index 00000000000..9df03f03d2b
--- /dev/null
+++ b/db/post_migrate/20230221125148_add_fk_to_p_ci_builds_metadata_partitions_on_partition_id_and_build_id.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+class AddFkToPCiBuildsMetadataPartitionsOnPartitionIdAndBuildId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = :p_ci_builds_metadata
+ TARGET_TABLE_NAME = :ci_builds
+ COLUMN = :build_id
+ TARGET_COLUMN = :id
+ FK_NAME = :fk_e20479742e_p
+ PARTITION_COLUMN = :partition_id
+
+ def up
+ Gitlab::Database::PostgresPartitionedTable.each_partition(SOURCE_TABLE_NAME) do |partition|
+ add_concurrent_foreign_key(
+ partition.identifier,
+ TARGET_TABLE_NAME,
+ column: [PARTITION_COLUMN, COLUMN],
+ target_column: [PARTITION_COLUMN, TARGET_COLUMN],
+ validate: false,
+ reverse_lock_order: true,
+ on_update: :cascade,
+ on_delete: :cascade,
+ name: FK_NAME
+ )
+ end
+ end
+
+ def down
+ Gitlab::Database::PostgresPartitionedTable.each_partition(SOURCE_TABLE_NAME) do |partition|
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ partition.identifier,
+ TARGET_TABLE_NAME,
+ name: FK_NAME,
+ reverse_lock_order: true
+ )
+ end
+ end
+ end
+end
diff --git a/db/post_migrate/20230221162222_raise_ci_variable_limits_on_gitlab_com.rb b/db/post_migrate/20230221162222_raise_ci_variable_limits_on_gitlab_com.rb
new file mode 100644
index 00000000000..084f89b2a5d
--- /dev/null
+++ b/db/post_migrate/20230221162222_raise_ci_variable_limits_on_gitlab_com.rb
@@ -0,0 +1,53 @@
+# frozen_string_literal: true
+
+class RaiseCiVariableLimitsOnGitlabCom < Gitlab::Database::Migration[2.1]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ create_or_update_plan_limit('project_ci_variables', 'free', 8000)
+ create_or_update_plan_limit('project_ci_variables', 'bronze', 8000)
+ create_or_update_plan_limit('project_ci_variables', 'silver', 8000)
+ create_or_update_plan_limit('project_ci_variables', 'premium', 8000)
+ create_or_update_plan_limit('project_ci_variables', 'premium_trial', 8000)
+ create_or_update_plan_limit('project_ci_variables', 'gold', 8000)
+ create_or_update_plan_limit('project_ci_variables', 'ultimate', 8000)
+ create_or_update_plan_limit('project_ci_variables', 'ultimate_trial', 8000)
+ create_or_update_plan_limit('project_ci_variables', 'early_adopter', 8000)
+ create_or_update_plan_limit('project_ci_variables', 'opensource', 8000)
+
+ create_or_update_plan_limit('group_ci_variables', 'free', 30000)
+ create_or_update_plan_limit('group_ci_variables', 'bronze', 30000)
+ create_or_update_plan_limit('group_ci_variables', 'silver', 30000)
+ create_or_update_plan_limit('group_ci_variables', 'premium', 30000)
+ create_or_update_plan_limit('group_ci_variables', 'premium_trial', 30000)
+ create_or_update_plan_limit('group_ci_variables', 'gold', 30000)
+ create_or_update_plan_limit('group_ci_variables', 'ultimate', 30000)
+ create_or_update_plan_limit('group_ci_variables', 'ultimate_trial', 30000)
+ create_or_update_plan_limit('group_ci_variables', 'early_adopter', 30000)
+ create_or_update_plan_limit('group_ci_variables', 'opensource', 30000)
+ end
+
+ def down
+ create_or_update_plan_limit('project_ci_variables', 'free', 200)
+ create_or_update_plan_limit('project_ci_variables', 'bronze', 200)
+ create_or_update_plan_limit('project_ci_variables', 'silver', 200)
+ create_or_update_plan_limit('project_ci_variables', 'premium', 200)
+ create_or_update_plan_limit('project_ci_variables', 'premium_trial', 200)
+ create_or_update_plan_limit('project_ci_variables', 'gold', 200)
+ create_or_update_plan_limit('project_ci_variables', 'ultimate', 200)
+ create_or_update_plan_limit('project_ci_variables', 'ultimate_trial', 200)
+ create_or_update_plan_limit('project_ci_variables', 'early_adopter', 200)
+ create_or_update_plan_limit('project_ci_variables', 'opensource', 200)
+
+ create_or_update_plan_limit('group_ci_variables', 'free', 200)
+ create_or_update_plan_limit('group_ci_variables', 'bronze', 200)
+ create_or_update_plan_limit('group_ci_variables', 'silver', 200)
+ create_or_update_plan_limit('group_ci_variables', 'premium', 200)
+ create_or_update_plan_limit('group_ci_variables', 'premium_trial', 200)
+ create_or_update_plan_limit('group_ci_variables', 'gold', 200)
+ create_or_update_plan_limit('group_ci_variables', 'ultimate', 200)
+ create_or_update_plan_limit('group_ci_variables', 'ultimate_trial', 200)
+ create_or_update_plan_limit('group_ci_variables', 'early_adopter', 200)
+ create_or_update_plan_limit('group_ci_variables', 'opensource', 200)
+ end
+end
diff --git a/db/post_migrate/20230221214519_remove_incorrectly_onboarded_namespaces_from_onboarding_progress.rb b/db/post_migrate/20230221214519_remove_incorrectly_onboarded_namespaces_from_onboarding_progress.rb
new file mode 100644
index 00000000000..5672fc42851
--- /dev/null
+++ b/db/post_migrate/20230221214519_remove_incorrectly_onboarded_namespaces_from_onboarding_progress.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class RemoveIncorrectlyOnboardedNamespacesFromOnboardingProgress < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ class OnboardingProgress < MigrationRecord
+ include EachBatch
+
+ self.table_name = 'onboarding_progresses'
+ end
+
+ class Project < MigrationRecord
+ self.table_name = 'projects'
+ end
+
+ def up
+ names = ['Learn GitLab', 'Learn GitLab - Ultimate trial']
+
+ OnboardingProgress.each_batch(of: 500) do |batch|
+ namespaces_to_keep = Project.where(name: names, namespace_id: batch.select(:namespace_id)).select(:namespace_id)
+ batch.where.not(namespace_id: namespaces_to_keep).delete_all
+ end
+ end
+
+ def down
+ # no op
+ end
+end
diff --git a/db/post_migrate/20230222035805_prepare_async_index_removal_of_token_for_ci_builds.rb b/db/post_migrate/20230222035805_prepare_async_index_removal_of_token_for_ci_builds.rb
new file mode 100644
index 00000000000..6fd5bb18856
--- /dev/null
+++ b/db/post_migrate/20230222035805_prepare_async_index_removal_of_token_for_ci_builds.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class PrepareAsyncIndexRemovalOfTokenForCiBuilds < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ TABLE_NAME = :ci_builds
+ COLUMN_NAME = :token_encrypted
+ INDEX_NAME = :index_ci_builds_on_token_encrypted
+
+ def up
+ prepare_async_index_removal(TABLE_NAME, COLUMN_NAME, name: INDEX_NAME)
+ end
+
+ def down
+ unprepare_async_index(TABLE_NAME, COLUMN_NAME, name: INDEX_NAME)
+ end
+end
diff --git a/db/post_migrate/20230222055510_remove_concurrent_index_on_token_encrypted_for_ci_builds.rb b/db/post_migrate/20230222055510_remove_concurrent_index_on_token_encrypted_for_ci_builds.rb
new file mode 100644
index 00000000000..d3ed5a8fa2c
--- /dev/null
+++ b/db/post_migrate/20230222055510_remove_concurrent_index_on_token_encrypted_for_ci_builds.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveConcurrentIndexOnTokenEncryptedForCiBuilds < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ TABLE_NAME = :ci_builds
+ COLUMN_NAME = :token_encrypted
+ INDEX_NAME = :index_ci_builds_on_token_encrypted
+ WHERE_STATEMENT = 'token_encrypted IS NOT NULL'
+
+ def up
+ remove_concurrent_index_by_name TABLE_NAME, name: INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index TABLE_NAME, COLUMN_NAME, name: INDEX_NAME, where: WHERE_STATEMENT, unique: true
+ end
+end
diff --git a/db/post_migrate/20230222101420_remove_fk_to_ci_build_ci_pending_build_on_build_id.rb b/db/post_migrate/20230222101420_remove_fk_to_ci_build_ci_pending_build_on_build_id.rb
new file mode 100644
index 00000000000..36e2f0f34f3
--- /dev/null
+++ b/db/post_migrate/20230222101420_remove_fk_to_ci_build_ci_pending_build_on_build_id.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class RemoveFkToCiBuildCiPendingBuildOnBuildId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = :ci_pending_builds
+ TARGET_TABLE_NAME = :ci_builds
+ COLUMN = :build_id
+ TARGET_COLUMN = :id
+ FK_NAME = :fk_rails_725a2644a3
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ name: FK_NAME,
+ reverse_lock_order: true
+ )
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ column: COLUMN,
+ target_column: TARGET_COLUMN,
+ validate: true,
+ reverse_lock_order: true,
+ on_delete: :cascade,
+ name: FK_NAME
+ )
+ end
+end
diff --git a/db/post_migrate/20230222102421_remove_fk_to_ci_build_ci_running_build_on_build_id.rb b/db/post_migrate/20230222102421_remove_fk_to_ci_build_ci_running_build_on_build_id.rb
new file mode 100644
index 00000000000..d3cbfa649c3
--- /dev/null
+++ b/db/post_migrate/20230222102421_remove_fk_to_ci_build_ci_running_build_on_build_id.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class RemoveFkToCiBuildCiRunningBuildOnBuildId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = :ci_running_builds
+ TARGET_TABLE_NAME = :ci_builds
+ COLUMN = :build_id
+ TARGET_COLUMN = :id
+ FK_NAME = :fk_rails_da45cfa165
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ name: FK_NAME,
+ reverse_lock_order: true
+ )
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ column: COLUMN,
+ target_column: TARGET_COLUMN,
+ validate: true,
+ reverse_lock_order: true,
+ on_delete: :cascade,
+ name: FK_NAME
+ )
+ end
+end
diff --git a/db/post_migrate/20230223014251_validate_not_null_constraint_on_oauth_access_tokens_expires_in.rb b/db/post_migrate/20230223014251_validate_not_null_constraint_on_oauth_access_tokens_expires_in.rb
new file mode 100644
index 00000000000..b5085d24ab1
--- /dev/null
+++ b/db/post_migrate/20230223014251_validate_not_null_constraint_on_oauth_access_tokens_expires_in.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class ValidateNotNullConstraintOnOauthAccessTokensExpiresIn < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ validate_not_null_constraint :oauth_access_tokens, :expires_in
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20230223065753_finalize_nullify_creator_id_of_orphaned_projects.rb b/db/post_migrate/20230223065753_finalize_nullify_creator_id_of_orphaned_projects.rb
new file mode 100644
index 00000000000..aa3ed4837e7
--- /dev/null
+++ b/db/post_migrate/20230223065753_finalize_nullify_creator_id_of_orphaned_projects.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class FinalizeNullifyCreatorIdOfOrphanedProjects < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ MIGRATION = 'NullifyCreatorIdColumnOfOrphanedProjects'
+
+ def up
+ ensure_batched_background_migration_is_finished(
+ job_class_name: MIGRATION,
+ table_name: :projects,
+ column_name: :id,
+ job_arguments: []
+ )
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20230223082752_schedule_fk_validation_for_p_ci_builds_metadata_partitions_and_ci_builds.rb b/db/post_migrate/20230223082752_schedule_fk_validation_for_p_ci_builds_metadata_partitions_and_ci_builds.rb
new file mode 100644
index 00000000000..bcb1147605e
--- /dev/null
+++ b/db/post_migrate/20230223082752_schedule_fk_validation_for_p_ci_builds_metadata_partitions_and_ci_builds.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class ScheduleFkValidationForPCiBuildsMetadataPartitionsAndCiBuilds < Gitlab::Database::Migration[2.1]
+ # This migration was used to validate the foreign keys on partitions introduced by
+ # db/post_migrate/20230221125148_add_fk_to_p_ci_builds_metadata_partitions_on_partition_id_and_build_id.rb
+ # but executing the rollback of
+ # db/post_migrate/20230306072532_add_partitioned_fk_to_p_ci_builds_metadata_on_partition_id_and_build_id.rb
+ # would also remove the FKs on partitions and this would errors out.
+
+ def up
+ # No-op
+ end
+
+ def down
+ # No-op
+ end
+end
diff --git a/db/post_migrate/20230223093704_add_foreign_key_on_creator_id_on_projects.rb b/db/post_migrate/20230223093704_add_foreign_key_on_creator_id_on_projects.rb
new file mode 100644
index 00000000000..68fd6de3f23
--- /dev/null
+++ b/db/post_migrate/20230223093704_add_foreign_key_on_creator_id_on_projects.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddForeignKeyOnCreatorIdOnProjects < Gitlab::Database::Migration[2.1]
+ 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/post_migrate/20230224085743_update_issues_internal_id_scope.rb b/db/post_migrate/20230224085743_update_issues_internal_id_scope.rb
new file mode 100644
index 00000000000..71d16ccf2a6
--- /dev/null
+++ b/db/post_migrate/20230224085743_update_issues_internal_id_scope.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class UpdateIssuesInternalIdScope < Gitlab::Database::Migration[2.1]
+ MIGRATION = 'IssuesInternalIdScopeUpdater'
+ INTERVAL = 2.minutes
+ BATCH_SIZE = 5_000
+ MAX_BATCH_SIZE = 20_000
+ SUB_BATCH_SIZE = 100
+
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :internal_ids,
+ :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, :internal_ids, :id, [])
+ end
+end
diff --git a/db/post_migrate/20230224144233_migrate_evidences_from_raw_metadata.rb b/db/post_migrate/20230224144233_migrate_evidences_from_raw_metadata.rb
new file mode 100644
index 00000000000..5d72a46f3c4
--- /dev/null
+++ b/db/post_migrate/20230224144233_migrate_evidences_from_raw_metadata.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class MigrateEvidencesFromRawMetadata < Gitlab::Database::Migration[2.1]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ MIGRATION = 'MigrateEvidencesForVulnerabilityFindings'
+ DELAY_INTERVAL = 2.minutes
+ SUB_BATCH_SIZE = 500
+ BATCH_SIZE = 10000
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :vulnerability_occurrences,
+ :id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :vulnerability_occurrences, :id, [])
+ end
+end
diff --git a/db/post_migrate/20230227123949_validate_fk_on_ci_sources_pipelines_source_partition_id_and_source_job_id.rb b/db/post_migrate/20230227123949_validate_fk_on_ci_sources_pipelines_source_partition_id_and_source_job_id.rb
new file mode 100644
index 00000000000..630483ee1f8
--- /dev/null
+++ b/db/post_migrate/20230227123949_validate_fk_on_ci_sources_pipelines_source_partition_id_and_source_job_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class ValidateFkOnCiSourcesPipelinesSourcePartitionIdAndSourceJobId < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = :ci_sources_pipelines
+ FK_NAME = :fk_be5624bf37_p
+ COLUMNS = [:source_partition_id, :source_job_id]
+
+ def up
+ validate_foreign_key(TABLE_NAME, COLUMNS, name: FK_NAME)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20230227123950_remove_fk_to_ci_builds_ci_sources_pipelines_on_source_job_id.rb b/db/post_migrate/20230227123950_remove_fk_to_ci_builds_ci_sources_pipelines_on_source_job_id.rb
new file mode 100644
index 00000000000..17ae2ad1325
--- /dev/null
+++ b/db/post_migrate/20230227123950_remove_fk_to_ci_builds_ci_sources_pipelines_on_source_job_id.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class RemoveFkToCiBuildsCiSourcesPipelinesOnSourceJobId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = :ci_sources_pipelines
+ TARGET_TABLE_NAME = :ci_builds
+ COLUMN = :source_job_id
+ TARGET_COLUMN = :id
+ FK_NAME = :fk_be5624bf37
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ name: FK_NAME,
+ reverse_lock_order: true
+ )
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ column: COLUMN,
+ target_column: TARGET_COLUMN,
+ validate: true,
+ reverse_lock_order: true,
+ on_delete: :cascade,
+ name: FK_NAME
+ )
+ end
+end
diff --git a/db/post_migrate/20230227151608_validate_fk_on_ci_build_trace_metadata_partition_id_and_build_id.rb b/db/post_migrate/20230227151608_validate_fk_on_ci_build_trace_metadata_partition_id_and_build_id.rb
new file mode 100644
index 00000000000..b95c416c128
--- /dev/null
+++ b/db/post_migrate/20230227151608_validate_fk_on_ci_build_trace_metadata_partition_id_and_build_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class ValidateFkOnCiBuildTraceMetadataPartitionIdAndBuildId < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = :ci_build_trace_metadata
+ FK_NAME = :fk_rails_aebc78111f_p
+ COLUMNS = [:partition_id, :build_id]
+
+ def up
+ validate_foreign_key(TABLE_NAME, COLUMNS, name: FK_NAME)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20230227151609_remove_fk_to_ci_builds_ci_build_trace_metadata_on_build_id.rb b/db/post_migrate/20230227151609_remove_fk_to_ci_builds_ci_build_trace_metadata_on_build_id.rb
new file mode 100644
index 00000000000..16e24d7ed4c
--- /dev/null
+++ b/db/post_migrate/20230227151609_remove_fk_to_ci_builds_ci_build_trace_metadata_on_build_id.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class RemoveFkToCiBuildsCiBuildTraceMetadataOnBuildId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = :ci_build_trace_metadata
+ TARGET_TABLE_NAME = :ci_builds
+ COLUMN = :build_id
+ TARGET_COLUMN = :id
+ FK_NAME = :fk_rails_aebc78111f
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ name: FK_NAME,
+ reverse_lock_order: true
+ )
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ column: COLUMN,
+ target_column: TARGET_COLUMN,
+ validate: true,
+ reverse_lock_order: true,
+ on_delete: :cascade,
+ name: FK_NAME
+ )
+ end
+end
diff --git a/db/post_migrate/20230227153231_validate_fk_on_ci_job_variables_partition_id_and_job_id.rb b/db/post_migrate/20230227153231_validate_fk_on_ci_job_variables_partition_id_and_job_id.rb
new file mode 100644
index 00000000000..035d26dbe94
--- /dev/null
+++ b/db/post_migrate/20230227153231_validate_fk_on_ci_job_variables_partition_id_and_job_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class ValidateFkOnCiJobVariablesPartitionIdAndJobId < Gitlab::Database::Migration[2.1]
+ TABLE_NAME = :ci_job_variables
+ FK_NAME = :fk_rails_fbf3b34792_p
+ COLUMNS = [:partition_id, :job_id]
+
+ def up
+ validate_foreign_key(TABLE_NAME, COLUMNS, name: FK_NAME)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20230227153232_remove_fk_to_ci_builds_ci_job_variables_on_job_id.rb b/db/post_migrate/20230227153232_remove_fk_to_ci_builds_ci_job_variables_on_job_id.rb
new file mode 100644
index 00000000000..f5dae8b57e0
--- /dev/null
+++ b/db/post_migrate/20230227153232_remove_fk_to_ci_builds_ci_job_variables_on_job_id.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class RemoveFkToCiBuildsCiJobVariablesOnJobId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = :ci_job_variables
+ TARGET_TABLE_NAME = :ci_builds
+ COLUMN = :job_id
+ TARGET_COLUMN = :id
+ FK_NAME = :fk_rails_fbf3b34792
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ name: FK_NAME,
+ reverse_lock_order: true
+ )
+ end
+ end
+
+ def down
+ add_concurrent_foreign_key(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ column: COLUMN,
+ target_column: TARGET_COLUMN,
+ validate: true,
+ reverse_lock_order: true,
+ on_delete: :cascade,
+ name: FK_NAME
+ )
+ end
+end
diff --git a/db/post_migrate/20230228021910_ensure_timelogs_note_id_bigint_backfill_is_finished_for_gitlab_dot_com.rb b/db/post_migrate/20230228021910_ensure_timelogs_note_id_bigint_backfill_is_finished_for_gitlab_dot_com.rb
new file mode 100644
index 00000000000..238c7fd0bec
--- /dev/null
+++ b/db/post_migrate/20230228021910_ensure_timelogs_note_id_bigint_backfill_is_finished_for_gitlab_dot_com.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class EnsureTimelogsNoteIdBigintBackfillIsFinishedForGitlabDotCom < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::MigrationHelpers::ConvertToBigint
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+ disable_ddl_transaction!
+
+ def up
+ return unless should_run?
+
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
+ table_name: 'timelogs',
+ column_name: 'id',
+ job_arguments: [['note_id'], ['note_id_convert_to_bigint']]
+ )
+ end
+
+ def down
+ # no-op
+ end
+
+ private
+
+ def should_run?
+ com_or_dev_or_test_but_not_jh?
+ end
+end
diff --git a/db/post_migrate/20230228023014_swap_timelogs_note_id_to_bigint_for_gitlab_dot_com.rb b/db/post_migrate/20230228023014_swap_timelogs_note_id_to_bigint_for_gitlab_dot_com.rb
new file mode 100644
index 00000000000..722a71863b0
--- /dev/null
+++ b/db/post_migrate/20230228023014_swap_timelogs_note_id_to_bigint_for_gitlab_dot_com.rb
@@ -0,0 +1,56 @@
+# frozen_string_literal: true
+
+class SwapTimelogsNoteIdToBigintForGitlabDotCom < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::MigrationHelpers::ConvertToBigint
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'timelogs'
+
+ def up
+ return unless should_run?
+
+ swap
+ end
+
+ def down
+ return unless should_run?
+
+ swap
+ end
+
+ def swap
+ # This will replace the existing index_timelogs_on_note_id
+ add_concurrent_index TABLE_NAME, :note_id_convert_to_bigint, name: 'index_timelogs_on_note_id_convert_to_bigint'
+
+ # This will replace the existing fk_timelogs_note_id
+ add_concurrent_foreign_key :timelogs, :notes, column: :note_id_convert_to_bigint,
+ name: 'fk_timelogs_note_id_convert_to_bigint',
+ on_delete: :nullify
+
+ with_lock_retries(raise_on_exhaustion: true) do
+ execute "LOCK TABLE notes, #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE"
+
+ execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id TO note_id_tmp"
+ execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_convert_to_bigint TO note_id"
+ execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN note_id_tmp TO note_id_convert_to_bigint"
+
+ function_name = Gitlab::Database::UnidirectionalCopyTrigger
+ .on_table(TABLE_NAME, connection: connection)
+ .name(:note_id, :note_id_convert_to_bigint)
+ execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL"
+
+ execute "DROP INDEX IF EXISTS index_timelogs_on_note_id"
+ rename_index TABLE_NAME, 'index_timelogs_on_note_id_convert_to_bigint', 'index_timelogs_on_note_id'
+
+ execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT IF EXISTS fk_timelogs_note_id"
+ rename_constraint(TABLE_NAME, 'fk_timelogs_note_id_convert_to_bigint', 'fk_timelogs_note_id')
+ end
+ end
+
+ private
+
+ def should_run?
+ com_or_dev_or_test_but_not_jh?
+ end
+end
diff --git a/db/post_migrate/20230301065107_add_index_on_expired_unlocked_non_trace_job_artifacts.rb b/db/post_migrate/20230301065107_add_index_on_expired_unlocked_non_trace_job_artifacts.rb
new file mode 100644
index 00000000000..feda6971a85
--- /dev/null
+++ b/db/post_migrate/20230301065107_add_index_on_expired_unlocked_non_trace_job_artifacts.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexOnExpiredUnlockedNonTraceJobArtifacts < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_ci_job_artifacts_expire_at_unlocked_non_trace'
+
+ def up
+ add_concurrent_index :ci_job_artifacts, :expire_at,
+ name: INDEX_NAME,
+ where: 'locked = 0 AND file_type != 3 AND expire_at IS NOT NULL'
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230302090155_add_async_index_on_unlocked_non_trace_job_artifacts_expire_at.rb b/db/post_migrate/20230302090155_add_async_index_on_unlocked_non_trace_job_artifacts_expire_at.rb
new file mode 100644
index 00000000000..9f89b6916bd
--- /dev/null
+++ b/db/post_migrate/20230302090155_add_async_index_on_unlocked_non_trace_job_artifacts_expire_at.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddAsyncIndexOnUnlockedNonTraceJobArtifactsExpireAt < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'index_ci_job_artifacts_expire_at_unlocked_non_trace'
+
+ def up
+ prepare_async_index :ci_job_artifacts, :expire_at,
+ name: INDEX_NAME,
+ where: 'locked = 0 AND file_type != 3 AND expire_at IS NOT NULL'
+ end
+
+ def down
+ unprepare_async_index :ci_job_artifacts, :expire_at, name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230302123258_drop_runner_machines_constraint_on_ci_builds_metadata.rb b/db/post_migrate/20230302123258_drop_runner_machines_constraint_on_ci_builds_metadata.rb
new file mode 100644
index 00000000000..c8f1b3be9bd
--- /dev/null
+++ b/db/post_migrate/20230302123258_drop_runner_machines_constraint_on_ci_builds_metadata.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class DropRunnerMachinesConstraintOnCiBuildsMetadata < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = 'p_ci_builds_metadata'
+ TARGET_TABLE_NAME = 'ci_runner_machines'
+ CONSTRAINT_NAME = 'fk_rails_fae01b2700'
+
+ def up
+ with_lock_retries(raise_on_exhaustion: true) do
+ remove_foreign_key_if_exists(SOURCE_TABLE_NAME, TARGET_TABLE_NAME, name: CONSTRAINT_NAME)
+ end
+ end
+
+ def down
+ with_lock_retries(raise_on_exhaustion: true) do
+ next if check_constraint_exists?(SOURCE_TABLE_NAME, CONSTRAINT_NAME)
+
+ execute(<<~SQL)
+ ALTER TABLE #{SOURCE_TABLE_NAME}
+ ADD CONSTRAINT #{CONSTRAINT_NAME} FOREIGN KEY (runner_machine_id)
+ REFERENCES #{TARGET_TABLE_NAME}(id) ON DELETE SET NULL
+ SQL
+ end
+ end
+end
diff --git a/db/post_migrate/20230302123259_ensure_ci_runner_machines_is_empty.rb b/db/post_migrate/20230302123259_ensure_ci_runner_machines_is_empty.rb
new file mode 100644
index 00000000000..9f7233f43f5
--- /dev/null
+++ b/db/post_migrate/20230302123259_ensure_ci_runner_machines_is_empty.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class EnsureCiRunnerMachinesIsEmpty < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ def up
+ return unless Gitlab::Database.gitlab_schemas_for_connection(connection).include?(:gitlab_ci)
+
+ # Ensure that the ci_runner_machines table is empty to ensure that new builds
+ # don't try to create new join records until we add the missing FK.
+ execute('TRUNCATE TABLE ci_runner_machines, p_ci_runner_machine_builds')
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20230302123301_add_index_on_runner_machine_id_on_runner_machine_builds.rb b/db/post_migrate/20230302123301_add_index_on_runner_machine_id_on_runner_machine_builds.rb
new file mode 100644
index 00000000000..035223382bd
--- /dev/null
+++ b/db/post_migrate/20230302123301_add_index_on_runner_machine_id_on_runner_machine_builds.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexOnRunnerMachineIdOnRunnerMachineBuilds < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_p_ci_runner_machine_builds_on_runner_machine_id'
+
+ def up
+ add_concurrent_partitioned_index :p_ci_runner_machine_builds, :runner_machine_id, unique: false, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_partitioned_index_by_name :p_ci_runner_machine_builds, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230302163339_add_index_to_oauth_access_grants_application_id.rb b/db/post_migrate/20230302163339_add_index_to_oauth_access_grants_application_id.rb
new file mode 100644
index 00000000000..0db6190e17d
--- /dev/null
+++ b/db/post_migrate/20230302163339_add_index_to_oauth_access_grants_application_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddIndexToOauthAccessGrantsApplicationId < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_oauth_access_grants_on_application_id'
+
+ def up
+ add_concurrent_index :oauth_access_grants, :application_id, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :oauth_access_grants, name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230302185739_queue_fix_vulnerability_reads_has_issues.rb b/db/post_migrate/20230302185739_queue_fix_vulnerability_reads_has_issues.rb
new file mode 100644
index 00000000000..09a5f6e9478
--- /dev/null
+++ b/db/post_migrate/20230302185739_queue_fix_vulnerability_reads_has_issues.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class QueueFixVulnerabilityReadsHasIssues < Gitlab::Database::Migration[2.1]
+ MIGRATION = "FixVulnerabilityReadsHasIssues"
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 1000
+ 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,
+ :vulnerability_issue_links,
+ :vulnerability_id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE,
+ max_batch_size: MAX_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :vulnerability_issue_links, :vulnerability_id, [])
+ end
+end
diff --git a/db/post_migrate/20230303105806_queue_delete_orphaned_packages_dependencies.rb b/db/post_migrate/20230303105806_queue_delete_orphaned_packages_dependencies.rb
new file mode 100644
index 00000000000..8c741cf9868
--- /dev/null
+++ b/db/post_migrate/20230303105806_queue_delete_orphaned_packages_dependencies.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class QueueDeleteOrphanedPackagesDependencies < Gitlab::Database::Migration[2.1]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ MIGRATION = 'DeleteOrphanedPackagesDependencies'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 6000
+ SUB_BATCH_SIZE = 100
+
+ disable_ddl_transaction!
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :packages_dependencies,
+ :id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :packages_dependencies, :id, [])
+ end
+end
diff --git a/db/post_migrate/20230303120531_schedule_temporary_partitioning_indexes_removal.rb b/db/post_migrate/20230303120531_schedule_temporary_partitioning_indexes_removal.rb
new file mode 100644
index 00000000000..73334be4214
--- /dev/null
+++ b/db/post_migrate/20230303120531_schedule_temporary_partitioning_indexes_removal.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class ScheduleTemporaryPartitioningIndexesRemoval < Gitlab::Database::Migration[2.1]
+ INDEXES = [
+ [:ci_pipelines, :tmp_index_ci_pipelines_on_partition_id_and_id],
+ [:ci_stages, :tmp_index_ci_stages_on_partition_id_and_id],
+ [:ci_builds, :tmp_index_ci_builds_on_partition_id_and_id],
+ [:ci_build_needs, :tmp_index_ci_build_needs_on_partition_id_and_id],
+ [:ci_build_report_results, :tmp_index_ci_build_report_results_on_partition_id_and_build_id],
+ [:ci_build_trace_metadata, :tmp_index_ci_build_trace_metadata_on_partition_id_and_id],
+ [:ci_job_artifacts, :tmp_index_ci_job_artifacts_on_partition_id_and_id],
+ [:ci_pipeline_variables, :tmp_index_ci_pipeline_variables_on_partition_id_and_id],
+ [:ci_job_variables, :tmp_index_ci_job_variables_on_partition_id_and_id],
+ [:ci_sources_pipelines, :tmp_index_ci_sources_pipelines_on_partition_id_and_id],
+ [:ci_sources_pipelines, :tmp_index_ci_sources_pipelines_on_source_partition_id_and_id],
+ [:ci_running_builds, :tmp_index_ci_running_builds_on_partition_id_and_id],
+ [:ci_pending_builds, :tmp_index_ci_pending_builds_on_partition_id_and_id],
+ [:ci_builds_runner_session, :tmp_index_ci_builds_runner_session_on_partition_id_and_id]
+ ]
+
+ def up
+ INDEXES.each do |table_name, index_name|
+ prepare_async_index_removal table_name, nil, name: index_name
+ end
+ end
+
+ def down
+ INDEXES.each do |table_name, index_name|
+ unprepare_async_index table_name, nil, name: index_name
+ end
+ end
+end
diff --git a/db/post_migrate/20230303154314_add_user_type_migration_indexes.rb b/db/post_migrate/20230303154314_add_user_type_migration_indexes.rb
new file mode 100644
index 00000000000..8f9e193f0eb
--- /dev/null
+++ b/db/post_migrate/20230303154314_add_user_type_migration_indexes.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddUserTypeMigrationIndexes < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ BILLABLE_INDEX = 'index_users_for_active_billable_users_migration'
+ LAST_ACTIVITY_INDEX = 'i_users_on_last_activity_for_active_human_service_migration'
+
+ def up
+ # Temporary indexes to migrate human user_type. See https://gitlab.com/gitlab-org/gitlab/-/issues/386474
+ add_concurrent_index :users, :id, name: BILLABLE_INDEX,
+ where: "state = 'active' AND ((user_type IS NULL OR user_type = 0) OR (user_type = ANY (ARRAY[6, 4, 13]))) " \
+ "AND ((user_type IS NULL OR user_type = 0) OR (user_type = ANY (ARRAY[4, 5])))"
+ add_concurrent_index :users, [:id, :last_activity_on], name: LAST_ACTIVITY_INDEX,
+ where: "((state)::text = 'active'::text) AND ((user_type IS NULL OR user_type = 0) OR (user_type = 4))"
+ end
+
+ def down
+ remove_concurrent_index_by_name :users, BILLABLE_INDEX
+ remove_concurrent_index_by_name :users, LAST_ACTIVITY_INDEX
+ end
+end
diff --git a/db/post_migrate/20230304184416_drop_revokable_from_achievements.rb b/db/post_migrate/20230304184416_drop_revokable_from_achievements.rb
new file mode 100644
index 00000000000..bb6c8d65c57
--- /dev/null
+++ b/db/post_migrate/20230304184416_drop_revokable_from_achievements.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class DropRevokableFromAchievements < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ def change
+ remove_column :achievements, :revokeable, :boolean, default: false, null: false
+ end
+end
diff --git a/db/post_migrate/20230306071456_validate_partitioning_fk_on_p_ci_builds_metadata_partitions.rb b/db/post_migrate/20230306071456_validate_partitioning_fk_on_p_ci_builds_metadata_partitions.rb
new file mode 100644
index 00000000000..f07175e82f9
--- /dev/null
+++ b/db/post_migrate/20230306071456_validate_partitioning_fk_on_p_ci_builds_metadata_partitions.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class ValidatePartitioningFkOnPCiBuildsMetadataPartitions < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = :p_ci_builds_metadata
+ FK_NAME = :fk_e20479742e_p
+
+ def up
+ Gitlab::Database::PostgresPartitionedTable.each_partition(SOURCE_TABLE_NAME) do |partition|
+ next unless foreign_key_exists?(partition.identifier, name: FK_NAME)
+
+ validate_foreign_key(partition.identifier, nil, name: FK_NAME)
+ end
+ end
+
+ def down
+ # No-op
+ end
+end
diff --git a/db/post_migrate/20230306072532_add_partitioned_fk_to_p_ci_builds_metadata_on_partition_id_and_build_id.rb b/db/post_migrate/20230306072532_add_partitioned_fk_to_p_ci_builds_metadata_on_partition_id_and_build_id.rb
new file mode 100644
index 00000000000..d66950378d2
--- /dev/null
+++ b/db/post_migrate/20230306072532_add_partitioned_fk_to_p_ci_builds_metadata_on_partition_id_and_build_id.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+class AddPartitionedFkToPCiBuildsMetadataOnPartitionIdAndBuildId < Gitlab::Database::Migration[2.1]
+ SOURCE_TABLE_NAME = :p_ci_builds_metadata
+ TARGET_TABLE_NAME = :ci_builds
+ FK_NAME = :fk_e20479742e_p
+
+ disable_ddl_transaction!
+
+ def up
+ return if foreign_key_exists?(SOURCE_TABLE_NAME, TARGET_TABLE_NAME, name: FK_NAME)
+
+ with_lock_retries do
+ execute("LOCK TABLE #{TARGET_TABLE_NAME}, #{SOURCE_TABLE_NAME} IN ACCESS EXCLUSIVE MODE")
+
+ execute(<<~SQL.squish)
+ ALTER TABLE #{SOURCE_TABLE_NAME}
+ ADD CONSTRAINT #{FK_NAME}
+ FOREIGN KEY (partition_id, build_id)
+ REFERENCES #{TARGET_TABLE_NAME} (partition_id, id)
+ ON UPDATE CASCADE ON DELETE CASCADE;
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ name: FK_NAME,
+ reverse_lock_order: true
+ )
+ end
+ end
+end
diff --git a/db/post_migrate/20230306082852_remove_fk_to_ci_builds_p_ci_builds_metadata_on_build_id.rb b/db/post_migrate/20230306082852_remove_fk_to_ci_builds_p_ci_builds_metadata_on_build_id.rb
new file mode 100644
index 00000000000..108a92aec3b
--- /dev/null
+++ b/db/post_migrate/20230306082852_remove_fk_to_ci_builds_p_ci_builds_metadata_on_build_id.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class RemoveFkToCiBuildsPCiBuildsMetadataOnBuildId < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = :p_ci_builds_metadata
+ TARGET_TABLE_NAME = :ci_builds
+ FK_NAME = :fk_e20479742e
+
+ def up
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ name: FK_NAME,
+ reverse_lock_order: true
+ )
+ end
+ end
+
+ def down
+ add_concurrent_partitioned_foreign_key(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ column: :build_id,
+ on_delete: :cascade,
+ name: FK_NAME
+ )
+ end
+end
diff --git a/db/post_migrate/20230306143322_prepare_ci_builds_primary_key_for_partitioning.rb b/db/post_migrate/20230306143322_prepare_ci_builds_primary_key_for_partitioning.rb
new file mode 100644
index 00000000000..99b52e4c443
--- /dev/null
+++ b/db/post_migrate/20230306143322_prepare_ci_builds_primary_key_for_partitioning.rb
@@ -0,0 +1,66 @@
+# frozen_string_literal: true
+
+class PrepareCiBuildsPrimaryKeyForPartitioning < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = :ci_builds
+ PRIMARY_KEY = :ci_builds_pkey
+ NEW_INDEX_NAME = :index_ci_builds_on_id_partition_id_unique
+ OLD_INDEX_NAME = :index_ci_builds_on_id_unique
+
+ def up
+ swap_primary_key(TABLE_NAME, PRIMARY_KEY, NEW_INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(TABLE_NAME, :id, unique: true, name: OLD_INDEX_NAME)
+ add_concurrent_index(TABLE_NAME, [:id, :partition_id], unique: true, name: NEW_INDEX_NAME)
+
+ unswap_primary_key(TABLE_NAME, PRIMARY_KEY, OLD_INDEX_NAME)
+
+ recreate_partitioned_foreign_keys
+ end
+
+ private
+
+ def recreate_partitioned_foreign_keys
+ add_partitioned_fk(:ci_job_variables, :fk_rails_fbf3b34792_p, column: :job_id)
+ add_partitioned_fk(:ci_job_artifacts, :fk_rails_c5137cb2c1_p, column: :job_id)
+ add_partitioned_fk(:ci_running_builds, :fk_rails_da45cfa165_p)
+ add_partitioned_fk(:ci_build_pending_states, :fk_861cd17da3_p)
+ add_partitioned_fk(:ci_build_trace_chunks, :fk_89e29fa5ee_p)
+ add_partitioned_fk(:ci_unit_test_failures, :fk_9e0fc58930_p)
+ add_partitioned_fk(:ci_build_trace_metadata, :fk_rails_aebc78111f_p)
+ add_partitioned_fk(:ci_pending_builds, :fk_rails_725a2644a3_p)
+ add_partitioned_fk(:ci_builds_runner_session, :fk_rails_70707857d3_p)
+ add_partitioned_fk(:ci_build_needs, :fk_rails_3cf221d4ed_p)
+ add_partitioned_fk(:ci_build_report_results, :fk_rails_16cb1ff064_p)
+ add_partitioned_fk(:ci_resources, :fk_e169a8e3d5_p, delete: :nullify)
+ add_partitioned_fk(:ci_sources_pipelines, :fk_be5624bf37_p, columns: %i[source_partition_id source_job_id])
+
+ add_routing_table_fk(:p_ci_builds_metadata, :fk_e20479742e_p)
+ add_routing_table_fk(:p_ci_runner_machine_builds, :fk_bb490f12fe_p)
+ end
+
+ def add_partitioned_fk(source_table, name, column: :build_id, columns: nil, delete: :cascade)
+ add_concurrent_foreign_key(source_table, :ci_builds,
+ column: columns || [:partition_id, column],
+ target_column: [:partition_id, :id],
+ reverse_lock_order: true,
+ on_update: :cascade,
+ on_delete: delete,
+ name: name)
+ end
+
+ def add_routing_table_fk(source_table, name)
+ add_concurrent_partitioned_foreign_key(source_table, :ci_builds,
+ column: [:partition_id, :build_id],
+ target_column: [:partition_id, :id],
+ reverse_lock_order: true,
+ on_update: :cascade,
+ on_delete: :cascade,
+ name: name)
+ end
+end
diff --git a/db/post_migrate/20230306195007_queue_backfill_project_wiki_repositories.rb b/db/post_migrate/20230306195007_queue_backfill_project_wiki_repositories.rb
new file mode 100644
index 00000000000..fd2dc0d16da
--- /dev/null
+++ b/db/post_migrate/20230306195007_queue_backfill_project_wiki_repositories.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class QueueBackfillProjectWikiRepositories < Gitlab::Database::Migration[2.1]
+ MIGRATION = "BackfillProjectWikiRepositories"
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 1000
+ SUB_BATCH_SIZE = 100
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :projects,
+ :id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: 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/20230307085644_track_ci_runner_machine_record_changes.rb b/db/post_migrate/20230307085644_track_ci_runner_machine_record_changes.rb
new file mode 100644
index 00000000000..deae1a57968
--- /dev/null
+++ b/db/post_migrate/20230307085644_track_ci_runner_machine_record_changes.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class TrackCiRunnerMachineRecordChanges < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::MigrationHelpers::LooseForeignKeyHelpers
+
+ enable_lock_retries!
+
+ def up
+ track_record_deletions(:ci_runner_machines)
+ end
+
+ def down
+ untrack_record_deletions(:ci_runner_machines)
+ end
+end
diff --git a/db/post_migrate/20230307160251_rename_constraint_fk_rails_f601258b28_on_events_table.rb b/db/post_migrate/20230307160251_rename_constraint_fk_rails_f601258b28_on_events_table.rb
new file mode 100644
index 00000000000..6b5ba4c3825
--- /dev/null
+++ b/db/post_migrate/20230307160251_rename_constraint_fk_rails_f601258b28_on_events_table.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class RenameConstraintFkRailsF601258b28OnEventsTable < Gitlab::Database::Migration[2.1]
+ enable_lock_retries!
+
+ TABLE_NAME = :events
+ FK_OLD_NAME = :fk_rails_f601258b28
+ FK_NEW_NAME = :fk_rails_0434b48643
+
+ def up
+ return unless foreign_key_exists?(TABLE_NAME, name: FK_OLD_NAME)
+
+ rename_constraint(TABLE_NAME, FK_OLD_NAME, FK_NEW_NAME)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20230309010000_add_unique_index_mr_user_mentions_note_id_convert_to_bigint.rb b/db/post_migrate/20230309010000_add_unique_index_mr_user_mentions_note_id_convert_to_bigint.rb
new file mode 100644
index 00000000000..9927bfb995a
--- /dev/null
+++ b/db/post_migrate/20230309010000_add_unique_index_mr_user_mentions_note_id_convert_to_bigint.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class AddUniqueIndexMrUserMentionsNoteIdConvertToBigint < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::MigrationHelpers::ConvertToBigint
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = :merge_request_user_mentions
+ INDEX_NAME = :index_merge_request_user_mentions_note_id_convert_to_bigint
+
+ def up
+ return unless should_run?
+
+ # This will replace the existing index_merge_request_user_mentions_on_note_id
+ add_concurrent_index TABLE_NAME, :note_id_convert_to_bigint, unique: true,
+ name: INDEX_NAME,
+ where: 'note_id_convert_to_bigint IS NOT NULL'
+ end
+
+ def down
+ return unless should_run?
+
+ remove_concurrent_index_by_name(TABLE_NAME, INDEX_NAME)
+ end
+
+ private
+
+ def should_run?
+ com_or_dev_or_test_but_not_jh?
+ end
+end
diff --git a/db/post_migrate/20230309010931_add_fk_on_mr_user_mentions_note_id_convert_to_id_bigint.rb b/db/post_migrate/20230309010931_add_fk_on_mr_user_mentions_note_id_convert_to_id_bigint.rb
new file mode 100644
index 00000000000..022e38460ae
--- /dev/null
+++ b/db/post_migrate/20230309010931_add_fk_on_mr_user_mentions_note_id_convert_to_id_bigint.rb
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+class AddFkOnMrUserMentionsNoteIdConvertToIdBigint < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::MigrationHelpers::ConvertToBigint
+
+ disable_ddl_transaction!
+
+ SOURCE_TABLE_NAME = :merge_request_user_mentions
+ TARGET_TABLE_NAME = :notes
+ FK_NAME = :fk_merge_request_user_mentions_note_id_convert_to_bigint
+
+ def up
+ return unless should_run?
+
+ # This will replace the existing fk_rails_c440b9ea31
+ # when we swap the integer and bigint columns
+ add_concurrent_foreign_key SOURCE_TABLE_NAME, TARGET_TABLE_NAME,
+ column: :note_id_convert_to_bigint,
+ name: FK_NAME,
+ on_delete: :cascade,
+ reverse_lock_order: true,
+ validate: false
+ end
+
+ def down
+ return unless should_run?
+
+ with_lock_retries do
+ remove_foreign_key_if_exists(
+ SOURCE_TABLE_NAME,
+ TARGET_TABLE_NAME,
+ name: FK_NAME,
+ reverse_lock_order: true
+ )
+ end
+ end
+
+ private
+
+ def should_run?
+ com_or_dev_or_test_but_not_jh?
+ end
+end
diff --git a/db/post_migrate/20230309020422_validate_fk_on_mr_user_mentions_note_id_convert_to_id_bigint.rb b/db/post_migrate/20230309020422_validate_fk_on_mr_user_mentions_note_id_convert_to_id_bigint.rb
new file mode 100644
index 00000000000..104fb7edb7e
--- /dev/null
+++ b/db/post_migrate/20230309020422_validate_fk_on_mr_user_mentions_note_id_convert_to_id_bigint.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class ValidateFkOnMrUserMentionsNoteIdConvertToIdBigint < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::MigrationHelpers::ConvertToBigint
+
+ TABLE_NAME = :merge_request_user_mentions
+ COLUMN = :note_id_convert_to_bigint
+ FK_NAME = :fk_merge_request_user_mentions_note_id_convert_to_bigint
+
+ def up
+ return unless should_run?
+
+ prepare_async_foreign_key_validation TABLE_NAME, COLUMN, name: FK_NAME
+ end
+
+ def down
+ return unless should_run?
+
+ unprepare_async_foreign_key_validation TABLE_NAME, COLUMN, name: FK_NAME
+ end
+
+ private
+
+ def should_run?
+ com_or_dev_or_test_but_not_jh?
+ end
+end
diff --git a/db/post_migrate/20230309071242_delete_security_policy_bot_users.rb b/db/post_migrate/20230309071242_delete_security_policy_bot_users.rb
new file mode 100644
index 00000000000..0a9ace2574c
--- /dev/null
+++ b/db/post_migrate/20230309071242_delete_security_policy_bot_users.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class DeleteSecurityPolicyBotUsers < Gitlab::Database::Migration[2.1]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ class User < MigrationRecord
+ self.table_name = 'users'
+
+ enum user_type: { security_policy_bot: 10 }
+ end
+
+ def up
+ User.where(user_type: :security_policy_bot).delete_all
+ end
+
+ def down
+ # no-op
+
+ # Deleted records can't be restored
+ end
+end
diff --git a/db/post_migrate/20230309103016_drop_id_partition_id_index_from_p_ci_build_metadata.rb b/db/post_migrate/20230309103016_drop_id_partition_id_index_from_p_ci_build_metadata.rb
new file mode 100644
index 00000000000..6e8866c0552
--- /dev/null
+++ b/db/post_migrate/20230309103016_drop_id_partition_id_index_from_p_ci_build_metadata.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class DropIdPartitionIdIndexFromPCiBuildMetadata < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = :p_ci_builds_metadata
+ INDEX_NAME = :p_ci_builds_metadata_id_partition_id_idx
+
+ def up
+ remove_concurrent_partitioned_index_by_name(TABLE_NAME, INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_partitioned_index(TABLE_NAME, %i[id partition_id], unique: true, name: INDEX_NAME)
+ end
+end
diff --git a/db/post_migrate/20230310111859_recreate_user_type_migration_indexes.rb b/db/post_migrate/20230310111859_recreate_user_type_migration_indexes.rb
new file mode 100644
index 00000000000..539ce99a319
--- /dev/null
+++ b/db/post_migrate/20230310111859_recreate_user_type_migration_indexes.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class RecreateUserTypeMigrationIndexes < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INCORRECT_BILLABLE_INDEX = 'index_users_for_active_billable_users_migration'
+ BILLABLE_INDEX = 'migrate_index_users_for_active_billable_users'
+
+ def up
+ # Temporary index to migrate human user_type. See https://gitlab.com/gitlab-org/gitlab/-/issues/386474
+ add_concurrent_index :users, :id, name: BILLABLE_INDEX,
+ where: "state = 'active' AND ((user_type IS NULL OR user_type = 0) OR (user_type = ANY (ARRAY[0, 6, 4, 13]))) " \
+ "AND ((user_type IS NULL OR user_type = 0) OR (user_type = ANY (ARRAY[0, 4, 5])))"
+
+ remove_concurrent_index_by_name :users, INCORRECT_BILLABLE_INDEX
+ end
+
+ def down
+ add_concurrent_index :users, :id, name: INCORRECT_BILLABLE_INDEX,
+ where: "state = 'active' AND ((user_type IS NULL OR user_type = 0) OR (user_type = ANY (ARRAY[6, 4, 13]))) " \
+ "AND ((user_type IS NULL OR user_type = 0) OR (user_type = ANY (ARRAY[4, 5])))"
+ remove_concurrent_index_by_name :users, BILLABLE_INDEX
+ end
+end
diff --git a/db/post_migrate/20230313133001_ensure_merge_request_metrics_id_bigint_backfill_is_finished_for_gitlab_dot_com.rb b/db/post_migrate/20230313133001_ensure_merge_request_metrics_id_bigint_backfill_is_finished_for_gitlab_dot_com.rb
new file mode 100644
index 00000000000..ffda926c49e
--- /dev/null
+++ b/db/post_migrate/20230313133001_ensure_merge_request_metrics_id_bigint_backfill_is_finished_for_gitlab_dot_com.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class EnsureMergeRequestMetricsIdBigintBackfillIsFinishedForGitlabDotCom < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::MigrationHelpers::ConvertToBigint
+
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ return unless should_run?
+
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
+ table_name: 'merge_request_metrics',
+ column_name: 'id',
+ job_arguments: [['id'], ['id_convert_to_bigint']]
+ )
+ end
+
+ def down
+ # no-op
+ end
+
+ private
+
+ def should_run?
+ com_or_dev_or_test_but_not_jh?
+ end
+end
diff --git a/db/post_migrate/20230313143033_swap_merge_request_metrics_id_to_bigint_for_gitlab_dot_com.rb b/db/post_migrate/20230313143033_swap_merge_request_metrics_id_to_bigint_for_gitlab_dot_com.rb
new file mode 100644
index 00000000000..089dd621033
--- /dev/null
+++ b/db/post_migrate/20230313143033_swap_merge_request_metrics_id_to_bigint_for_gitlab_dot_com.rb
@@ -0,0 +1,64 @@
+# frozen_string_literal: true
+
+class SwapMergeRequestMetricsIdToBigintForGitlabDotCom < Gitlab::Database::Migration[2.1]
+ include Gitlab::Database::MigrationHelpers::ConvertToBigint
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'merge_request_metrics'
+ TMP_INDEX_NAME = 'tmp_index_mr_metrics_on_target_project_id_merged_at_nulls_last'
+ INDEX_NAME = 'index_mr_metrics_on_target_project_id_merged_at_nulls_last'
+ CONSTRAINT_NAME = 'merge_request_metrics_pkey'
+
+ def up
+ return unless should_run?
+
+ swap
+ end
+
+ def down
+ return unless should_run?
+
+ swap
+ end
+
+ private
+
+ def swap
+ add_concurrent_index TABLE_NAME, :id_convert_to_bigint, unique: true,
+ name: 'index_merge_request_metrics_on_id_convert_to_bigint'
+ add_concurrent_index TABLE_NAME, 'target_project_id, merged_at DESC NULLS LAST, id_convert_to_bigint DESC',
+ name: TMP_INDEX_NAME
+
+ with_lock_retries(raise_on_exhaustion: true) do
+ execute "LOCK TABLE #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE"
+
+ execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN id TO id_tmp"
+ execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN id_convert_to_bigint TO id"
+ execute "ALTER TABLE #{TABLE_NAME} RENAME COLUMN id_tmp TO id_convert_to_bigint"
+
+ function_name = Gitlab::Database::UnidirectionalCopyTrigger
+ .on_table(TABLE_NAME, connection: connection)
+ .name(:id, :id_convert_to_bigint)
+ execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL"
+
+ # Swap defaults of the columns, and change ownership of the sequence to the new id
+ execute "ALTER SEQUENCE merge_request_metrics_id_seq OWNED BY #{TABLE_NAME}.id"
+ change_column_default TABLE_NAME, :id, -> { "nextval('merge_request_metrics_id_seq'::regclass)" }
+ change_column_default TABLE_NAME, :id_convert_to_bigint, 0
+
+ # Swap PK constraint
+ execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT IF EXISTS #{CONSTRAINT_NAME}"
+ rename_index TABLE_NAME, 'index_merge_request_metrics_on_id_convert_to_bigint', CONSTRAINT_NAME
+ execute "ALTER TABLE #{TABLE_NAME} ADD CONSTRAINT #{CONSTRAINT_NAME} PRIMARY KEY USING INDEX #{CONSTRAINT_NAME}"
+
+ # Rename the rest of the indexes (we already hold an exclusive lock, so no need to use DROP INDEX CONCURRENTLY)
+ execute "DROP INDEX IF EXISTS #{INDEX_NAME}"
+ rename_index TABLE_NAME, TMP_INDEX_NAME, INDEX_NAME
+ end
+ end
+
+ def should_run?
+ com_or_dev_or_test_but_not_jh?
+ end
+end
diff --git a/db/post_migrate/20230313150531_reschedule_migration_for_remediation.rb b/db/post_migrate/20230313150531_reschedule_migration_for_remediation.rb
new file mode 100644
index 00000000000..ebb6e53341f
--- /dev/null
+++ b/db/post_migrate/20230313150531_reschedule_migration_for_remediation.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+# rubocop: disable BackgroundMigration/MissingDictionaryFile
+
+class RescheduleMigrationForRemediation < Gitlab::Database::Migration[2.1]
+ MIGRATION = 'MigrateRemediationsForVulnerabilityFindings'
+ DELAY_INTERVAL = 2.minutes
+ SUB_BATCH_SIZE = 500
+ BATCH_SIZE = 5000
+
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ delete_batched_background_migration(MIGRATION, :vulnerability_occurrences, :id, [])
+
+ queue_batched_background_migration(
+ MIGRATION,
+ :vulnerability_occurrences,
+ :id,
+ job_interval: DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ sub_batch_size: SUB_BATCH_SIZE
+ )
+ end
+
+ def down
+ delete_batched_background_migration(MIGRATION, :vulnerability_occurrences, :id, [])
+ end
+end
+# rubocop: enable BackgroundMigration/MissingDictionaryFile
diff --git a/db/post_migrate/20230313184306_add_temp_index_for_software_license_cleanup.rb b/db/post_migrate/20230313184306_add_temp_index_for_software_license_cleanup.rb
new file mode 100644
index 00000000000..d2e35a0fa9e
--- /dev/null
+++ b/db/post_migrate/20230313184306_add_temp_index_for_software_license_cleanup.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddTempIndexForSoftwareLicenseCleanup < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'tmp_index_for_software_licenses_spdx_identifier_cleanup'
+
+ def up
+ add_concurrent_index :software_licenses, :spdx_identifier, where: 'spdx_identifier IS NULL', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :software_licenses, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230313185145_cleanup_orphan_software_licenses.rb b/db/post_migrate/20230313185145_cleanup_orphan_software_licenses.rb
new file mode 100644
index 00000000000..af971f692d6
--- /dev/null
+++ b/db/post_migrate/20230313185145_cleanup_orphan_software_licenses.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class CleanupOrphanSoftwareLicenses < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ class SoftwareLicense < MigrationRecord
+ self.table_name = 'software_licenses'
+ end
+
+ class SoftwareLicensePolicy < MigrationRecord
+ self.table_name = 'software_license_policies'
+ end
+
+ def up
+ SoftwareLicense
+ .where(spdx_identifier: nil)
+ .where.not(
+ id: SoftwareLicensePolicy.select(:software_license_id)
+ ).delete_all
+ end
+
+ def down
+ # NO-OP
+ end
+end
diff --git a/db/post_migrate/20230316014650_remove_index_on_events_action_async.rb b/db/post_migrate/20230316014650_remove_index_on_events_action_async.rb
new file mode 100644
index 00000000000..bc4bc4f941d
--- /dev/null
+++ b/db/post_migrate/20230316014650_remove_index_on_events_action_async.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class RemoveIndexOnEventsActionAsync < Gitlab::Database::Migration[2.1]
+ # TODO: Index to be destroyed synchronously in https://gitlab.com/gitlab-org/gitlab/-/issues/396830
+ def up
+ prepare_async_index_removal :events, :action, name: 'index_events_on_action'
+ end
+
+ def down
+ unprepare_async_index :events, :action, name: 'index_events_on_action'
+ end
+end
diff --git a/db/schema_migrations/20230113164245 b/db/schema_migrations/20230113164245
new file mode 100644
index 00000000000..2c8b04d4387
--- /dev/null
+++ b/db/schema_migrations/20230113164245
@@ -0,0 +1 @@
+eb2dfc21c5645e1f8aec9118a380c270525ce261a86ce13f89de891a8c4fa3a9 \ No newline at end of file
diff --git a/db/schema_migrations/20230113201308 b/db/schema_migrations/20230113201308
new file mode 100644
index 00000000000..df391813488
--- /dev/null
+++ b/db/schema_migrations/20230113201308
@@ -0,0 +1 @@
+775842b84022cf30d685060ea956c1e52722587f2be517d44ae44ca57f954538 \ No newline at end of file
diff --git a/db/schema_migrations/20230118135145 b/db/schema_migrations/20230118135145
new file mode 100644
index 00000000000..15c566a4058
--- /dev/null
+++ b/db/schema_migrations/20230118135145
@@ -0,0 +1 @@
+d6fdfc530a49b230aa041d4629a0484462abacb824f6bbf23d9740068e3ca781 \ No newline at end of file
diff --git a/db/schema_migrations/20230118144623 b/db/schema_migrations/20230118144623
new file mode 100644
index 00000000000..82c15116c45
--- /dev/null
+++ b/db/schema_migrations/20230118144623
@@ -0,0 +1 @@
+3ceeeeabb4ebae0f38e446c044fe6e6d929661b8689b461bed87660afd2e223b \ No newline at end of file
diff --git a/db/schema_migrations/20230125195503 b/db/schema_migrations/20230125195503
new file mode 100644
index 00000000000..ee8f7d47e16
--- /dev/null
+++ b/db/schema_migrations/20230125195503
@@ -0,0 +1 @@
+6321659d8f71127368dffd0bec122d4c32835da364a32cd6f276c641a70d10ff \ No newline at end of file
diff --git a/db/schema_migrations/20230126101907 b/db/schema_migrations/20230126101907
new file mode 100644
index 00000000000..e7006b46b1a
--- /dev/null
+++ b/db/schema_migrations/20230126101907
@@ -0,0 +1 @@
+f6fccc22b53fdc590d5af1b5924275b43334820b66d4f488b3ef6f6d70b4e415 \ No newline at end of file
diff --git a/db/schema_migrations/20230127030015 b/db/schema_migrations/20230127030015
new file mode 100644
index 00000000000..411b65dcf17
--- /dev/null
+++ b/db/schema_migrations/20230127030015
@@ -0,0 +1 @@
+c957902ecdc96e1ae22d514f932c22bc04e07fd3e11dfd1bdbd45b077b6ee017 \ No newline at end of file
diff --git a/db/schema_migrations/20230130182412 b/db/schema_migrations/20230130182412
new file mode 100644
index 00000000000..5d053b89d5e
--- /dev/null
+++ b/db/schema_migrations/20230130182412
@@ -0,0 +1 @@
+a5deb047ed3e0611ef10ce35d8f745f6d93d064a989488801c22d838d92ef780 \ No newline at end of file
diff --git a/db/schema_migrations/20230131184319 b/db/schema_migrations/20230131184319
new file mode 100644
index 00000000000..3028f92b316
--- /dev/null
+++ b/db/schema_migrations/20230131184319
@@ -0,0 +1 @@
+06a6005ecc7de9b6db9912b246aa27c30b308f47f23f1258043b7a7c636962b6 \ No newline at end of file
diff --git a/db/schema_migrations/20230201165656 b/db/schema_migrations/20230201165656
new file mode 100644
index 00000000000..8e401067403
--- /dev/null
+++ b/db/schema_migrations/20230201165656
@@ -0,0 +1 @@
+1f4e6f2b9e4461bb7dc663acedd08b2618f70e62ee8ae0a89bd9ccf11813f3b5 \ No newline at end of file
diff --git a/db/schema_migrations/20230202094723 b/db/schema_migrations/20230202094723
new file mode 100644
index 00000000000..6d18a0b1cf9
--- /dev/null
+++ b/db/schema_migrations/20230202094723
@@ -0,0 +1 @@
+54e3ad80c034d87621c266befc0a6d77b56927bb9afc71375767dcb647bb1aa9 \ No newline at end of file
diff --git a/db/schema_migrations/20230202135758 b/db/schema_migrations/20230202135758
new file mode 100644
index 00000000000..2afb3886ade
--- /dev/null
+++ b/db/schema_migrations/20230202135758
@@ -0,0 +1 @@
+877ea1462505cfc9986353e5fb5f8cfc68a7557140bdc162bcfbd7a68c266f97 \ No newline at end of file
diff --git a/db/schema_migrations/20230202211434 b/db/schema_migrations/20230202211434
new file mode 100644
index 00000000000..8389c248548
--- /dev/null
+++ b/db/schema_migrations/20230202211434
@@ -0,0 +1 @@
+be43b7dd3fffd70b9d1ee5a7c1950c938674f2bf1dfb23d0a709a46be2005b8c \ No newline at end of file
diff --git a/db/schema_migrations/20230208125736 b/db/schema_migrations/20230208125736
new file mode 100644
index 00000000000..bad75a7ffbe
--- /dev/null
+++ b/db/schema_migrations/20230208125736
@@ -0,0 +1 @@
+ce2100af8a397f9d2acfcdb9d8e4fefd82c42cecc78b1e762812738622bf76a9 \ No newline at end of file
diff --git a/db/schema_migrations/20230210152109 b/db/schema_migrations/20230210152109
new file mode 100644
index 00000000000..cc158d38529
--- /dev/null
+++ b/db/schema_migrations/20230210152109
@@ -0,0 +1 @@
+ed74efe6b6c5428f5d1be55d1ea4d11dfb23623d092483d0d474e82312379335 \ No newline at end of file
diff --git a/db/schema_migrations/20230210153420 b/db/schema_migrations/20230210153420
new file mode 100644
index 00000000000..8ace16a1e67
--- /dev/null
+++ b/db/schema_migrations/20230210153420
@@ -0,0 +1 @@
+07d3ef18df7faefc3b86d14b37b7254ab3301392053bbe322622be8a74a56f94 \ No newline at end of file
diff --git a/db/schema_migrations/20230210155715 b/db/schema_migrations/20230210155715
new file mode 100644
index 00000000000..68ff0072b83
--- /dev/null
+++ b/db/schema_migrations/20230210155715
@@ -0,0 +1 @@
+7d0b2686ec505eb7b08df119cbb8a3c1cf033d708050de474d627df68e72c3b4 \ No newline at end of file
diff --git a/db/schema_migrations/20230210160037 b/db/schema_migrations/20230210160037
new file mode 100644
index 00000000000..f9a1697411b
--- /dev/null
+++ b/db/schema_migrations/20230210160037
@@ -0,0 +1 @@
+db0d359d329b7578c676ee137380b53d84c77c5699adb76243eb25eceda7e7e5 \ No newline at end of file
diff --git a/db/schema_migrations/20230210160351 b/db/schema_migrations/20230210160351
new file mode 100644
index 00000000000..534b07f4371
--- /dev/null
+++ b/db/schema_migrations/20230210160351
@@ -0,0 +1 @@
+0504365806c9692fff3e9aa32e371a3ddacaf8a26549929e45e271dac60992ac \ No newline at end of file
diff --git a/db/schema_migrations/20230210161002 b/db/schema_migrations/20230210161002
new file mode 100644
index 00000000000..4ba016dc519
--- /dev/null
+++ b/db/schema_migrations/20230210161002
@@ -0,0 +1 @@
+9d300a27b9c5f3e1b157d5b741c605d9a8d80a886a0a574a5946addfc0ef4998 \ No newline at end of file
diff --git a/db/schema_migrations/20230210171012 b/db/schema_migrations/20230210171012
new file mode 100644
index 00000000000..e026a7fffa9
--- /dev/null
+++ b/db/schema_migrations/20230210171012
@@ -0,0 +1 @@
+f769362c0836821687c46f824e13b30ef7c8686eebf62da8f3e8a7d3c66c0f01 \ No newline at end of file
diff --git a/db/schema_migrations/20230213103019 b/db/schema_migrations/20230213103019
new file mode 100644
index 00000000000..e28052b7f58
--- /dev/null
+++ b/db/schema_migrations/20230213103019
@@ -0,0 +1 @@
+23979065610c4f361a639cdcf81e7ce491d111ed3752bd11081f9645b31e21f6 \ No newline at end of file
diff --git a/db/schema_migrations/20230213213559 b/db/schema_migrations/20230213213559
new file mode 100644
index 00000000000..cfe68dc78e4
--- /dev/null
+++ b/db/schema_migrations/20230213213559
@@ -0,0 +1 @@
+bd11c9514186437d2929b32f034256ee2442cf839b0bc6e64490ecff9978d017 \ No newline at end of file
diff --git a/db/schema_migrations/20230214181633 b/db/schema_migrations/20230214181633
new file mode 100644
index 00000000000..76d4cf10b5c
--- /dev/null
+++ b/db/schema_migrations/20230214181633
@@ -0,0 +1 @@
+a8c815d1d85a6690755623b53e15e5fb73f7e6be6a24ead3532f21d21c1de20f \ No newline at end of file
diff --git a/db/schema_migrations/20230215074223 b/db/schema_migrations/20230215074223
new file mode 100644
index 00000000000..db68438eaae
--- /dev/null
+++ b/db/schema_migrations/20230215074223
@@ -0,0 +1 @@
+c63c7e4cdb985d4607f442c9728a5b2699d6112054c03571cc47684af435c249 \ No newline at end of file
diff --git a/db/schema_migrations/20230215124011 b/db/schema_migrations/20230215124011
new file mode 100644
index 00000000000..88911b9faaf
--- /dev/null
+++ b/db/schema_migrations/20230215124011
@@ -0,0 +1 @@
+e8449ee3c54eb3ec1c4f2e302e7fceda950a16eb2bf57b0cd77ed955ad314eee \ No newline at end of file
diff --git a/db/schema_migrations/20230215131026 b/db/schema_migrations/20230215131026
new file mode 100644
index 00000000000..3bec8e04f4f
--- /dev/null
+++ b/db/schema_migrations/20230215131026
@@ -0,0 +1 @@
+095cc516f50dcb11e01ccda962a9776fddcec439520cef795f6c8715b5941aba \ No newline at end of file
diff --git a/db/schema_migrations/20230215180605 b/db/schema_migrations/20230215180605
new file mode 100644
index 00000000000..a3b222de10f
--- /dev/null
+++ b/db/schema_migrations/20230215180605
@@ -0,0 +1 @@
+879bee488f4089527de02ebfd6c9d6f6de7ab24d87361e29f998d86b62ca7461 \ No newline at end of file
diff --git a/db/schema_migrations/20230215213349 b/db/schema_migrations/20230215213349
new file mode 100644
index 00000000000..0512fd3c7ea
--- /dev/null
+++ b/db/schema_migrations/20230215213349
@@ -0,0 +1 @@
+9b8521de286e8c363497c7854c530c7fcaf5aecb193a89addf7e15704ae271f9 \ No newline at end of file
diff --git a/db/schema_migrations/20230216040505 b/db/schema_migrations/20230216040505
new file mode 100644
index 00000000000..d3cc858827f
--- /dev/null
+++ b/db/schema_migrations/20230216040505
@@ -0,0 +1 @@
+c6a905e29792b88f87810d267a4472886e0a1a22fe9531e3d7998abbd1035552 \ No newline at end of file
diff --git a/db/schema_migrations/20230216060333 b/db/schema_migrations/20230216060333
new file mode 100644
index 00000000000..5f9fa26b1f0
--- /dev/null
+++ b/db/schema_migrations/20230216060333
@@ -0,0 +1 @@
+c06d80c04bd661805f066412d750a651a0ead053cfff0e3314c03b3846a3f36d \ No newline at end of file
diff --git a/db/schema_migrations/20230216071312 b/db/schema_migrations/20230216071312
new file mode 100644
index 00000000000..2e92ecc19e6
--- /dev/null
+++ b/db/schema_migrations/20230216071312
@@ -0,0 +1 @@
+204503fcf9e5da7255677a9a82f11e860410048efc1ed75cc7ba97b3cdd273c3 \ No newline at end of file
diff --git a/db/schema_migrations/20230216142836 b/db/schema_migrations/20230216142836
new file mode 100644
index 00000000000..7f7d8230327
--- /dev/null
+++ b/db/schema_migrations/20230216142836
@@ -0,0 +1 @@
+8b8b1a55b2f82b4dc0dcbb2b618dbc4dabdcb21d091cd98f19c68cc6fb4fa493 \ No newline at end of file
diff --git a/db/schema_migrations/20230216144719 b/db/schema_migrations/20230216144719
new file mode 100644
index 00000000000..01ad731d72f
--- /dev/null
+++ b/db/schema_migrations/20230216144719
@@ -0,0 +1 @@
+cc74cddc9851a56cc98df1947ea1ea539358e9959b5c8f79aa1cea44979760b2 \ No newline at end of file
diff --git a/db/schema_migrations/20230216152912 b/db/schema_migrations/20230216152912
new file mode 100644
index 00000000000..e9f1dfb9db3
--- /dev/null
+++ b/db/schema_migrations/20230216152912
@@ -0,0 +1 @@
+66b74e0442763b2a05ec411344d8ca97b7d3d2e8cef9d2e04baba246b1c025a2 \ No newline at end of file
diff --git a/db/schema_migrations/20230216171309 b/db/schema_migrations/20230216171309
new file mode 100644
index 00000000000..1e25ca0d3b1
--- /dev/null
+++ b/db/schema_migrations/20230216171309
@@ -0,0 +1 @@
+ee00d6aba8a310c236dd16749228a42589657d060bbf1785c4358bf886fd59cc \ No newline at end of file
diff --git a/db/schema_migrations/20230216191507 b/db/schema_migrations/20230216191507
new file mode 100644
index 00000000000..7bc18f2fe42
--- /dev/null
+++ b/db/schema_migrations/20230216191507
@@ -0,0 +1 @@
+71a2a98341e2ee32e0ee9706854378e2b6bbda8af1ac7f325b770cf5ff67738f \ No newline at end of file
diff --git a/db/schema_migrations/20230216222956 b/db/schema_migrations/20230216222956
new file mode 100644
index 00000000000..a93e0602cd6
--- /dev/null
+++ b/db/schema_migrations/20230216222956
@@ -0,0 +1 @@
+6ebeadf8259911352813166646645320c3a238a68c1e8a4a97baa51b2bd182dd \ No newline at end of file
diff --git a/db/schema_migrations/20230216232404 b/db/schema_migrations/20230216232404
new file mode 100644
index 00000000000..e2fd3d7ae1f
--- /dev/null
+++ b/db/schema_migrations/20230216232404
@@ -0,0 +1 @@
+df059ad89887390a792f292b7062a2f04d901a049c2acea7b8ddaff677b8c9d5 \ No newline at end of file
diff --git a/db/schema_migrations/20230216233937 b/db/schema_migrations/20230216233937
new file mode 100644
index 00000000000..d3c85c7c981
--- /dev/null
+++ b/db/schema_migrations/20230216233937
@@ -0,0 +1 @@
+5088eccec1327f61cb80c5fca4f7e7710534179c2d6bf820f7021dfd079d51a5 \ No newline at end of file
diff --git a/db/schema_migrations/20230217065736 b/db/schema_migrations/20230217065736
new file mode 100644
index 00000000000..a355b107c40
--- /dev/null
+++ b/db/schema_migrations/20230217065736
@@ -0,0 +1 @@
+c772f3d2b46d48bfae68f2b420d38851ecea3105029e5154a58bed29359393f2 \ No newline at end of file
diff --git a/db/schema_migrations/20230217144421 b/db/schema_migrations/20230217144421
new file mode 100644
index 00000000000..1ab17fcfa99
--- /dev/null
+++ b/db/schema_migrations/20230217144421
@@ -0,0 +1 @@
+9a2ecdf9c37b13ebe5666ebadf2f27d4f52a0615337faaef221ff4fc6ae08cc4 \ No newline at end of file
diff --git a/db/schema_migrations/20230217232554 b/db/schema_migrations/20230217232554
new file mode 100644
index 00000000000..501e10db401
--- /dev/null
+++ b/db/schema_migrations/20230217232554
@@ -0,0 +1 @@
+56880a7008d06e9a30337cca7affbe4cdb796b8ef1ccc8b3fc8503af172281cb \ No newline at end of file
diff --git a/db/schema_migrations/20230218145930 b/db/schema_migrations/20230218145930
new file mode 100644
index 00000000000..17e1cb01703
--- /dev/null
+++ b/db/schema_migrations/20230218145930
@@ -0,0 +1 @@
+63c47c7a879d54b4773f672ce8b771b3d416d44740b4a56c2cc05d4486daffab \ No newline at end of file
diff --git a/db/schema_migrations/20230218145940 b/db/schema_migrations/20230218145940
new file mode 100644
index 00000000000..0017b48bd5c
--- /dev/null
+++ b/db/schema_migrations/20230218145940
@@ -0,0 +1 @@
+3e3fcc5b0f186e722dbd2fe7b89cd1d32c59830bc66e7efb3fe1513f9fa2ba03 \ No newline at end of file
diff --git a/db/schema_migrations/20230218152729 b/db/schema_migrations/20230218152729
new file mode 100644
index 00000000000..f78be055435
--- /dev/null
+++ b/db/schema_migrations/20230218152729
@@ -0,0 +1 @@
+ac404c1dd1b2a38b8d02563b4b9306076f35120448d78b130c0421364c11822c \ No newline at end of file
diff --git a/db/schema_migrations/20230218152730 b/db/schema_migrations/20230218152730
new file mode 100644
index 00000000000..55fb6069403
--- /dev/null
+++ b/db/schema_migrations/20230218152730
@@ -0,0 +1 @@
+f85595c6176426369f8558ba3dadf6ee2a5efa17f2d304dc8397862fc7d52545 \ No newline at end of file
diff --git a/db/schema_migrations/20230219191034 b/db/schema_migrations/20230219191034
new file mode 100644
index 00000000000..911869229b3
--- /dev/null
+++ b/db/schema_migrations/20230219191034
@@ -0,0 +1 @@
+f3be6612c3669066d9a805bf56cae7b3f9a1b6bdaee1bdb3e3f9a596ed3cecef \ No newline at end of file
diff --git a/db/schema_migrations/20230220035034 b/db/schema_migrations/20230220035034
new file mode 100644
index 00000000000..4cb8be66d8f
--- /dev/null
+++ b/db/schema_migrations/20230220035034
@@ -0,0 +1 @@
+f5636e464b16bfc201a3f3a21269c6d8686d2bc829aa80491bea120fd10e138a \ No newline at end of file
diff --git a/db/schema_migrations/20230220102212 b/db/schema_migrations/20230220102212
new file mode 100644
index 00000000000..a4432c7b517
--- /dev/null
+++ b/db/schema_migrations/20230220102212
@@ -0,0 +1 @@
+7df50689f7e9311ee8e5bd2513f4361be0fceef3962344d2d16bf511132c7a33 \ No newline at end of file
diff --git a/db/schema_migrations/20230220112930 b/db/schema_migrations/20230220112930
new file mode 100644
index 00000000000..0852b3fe5f7
--- /dev/null
+++ b/db/schema_migrations/20230220112930
@@ -0,0 +1 @@
+b58d0cf5df91d7abc4ba7ef4a1257f03aa6e9849624d43728ca0e008c5710e7c \ No newline at end of file
diff --git a/db/schema_migrations/20230220132409 b/db/schema_migrations/20230220132409
new file mode 100644
index 00000000000..417675aaf27
--- /dev/null
+++ b/db/schema_migrations/20230220132409
@@ -0,0 +1 @@
+b2aee06140d97dd9cd5d694b5d8538db92279aeba9e0e64375052ff455246647 \ No newline at end of file
diff --git a/db/schema_migrations/20230220132410 b/db/schema_migrations/20230220132410
new file mode 100644
index 00000000000..39ee3040802
--- /dev/null
+++ b/db/schema_migrations/20230220132410
@@ -0,0 +1 @@
+42814e8ab1b2ebb197f877736f8c9dddf5b9416c22f9c800c7a9d33cde164dd6 \ No newline at end of file
diff --git a/db/schema_migrations/20230220134145 b/db/schema_migrations/20230220134145
new file mode 100644
index 00000000000..91238639d78
--- /dev/null
+++ b/db/schema_migrations/20230220134145
@@ -0,0 +1 @@
+d20d4bd35b5e4132515c731e7df802c0fd6f3e88d4bee2d3b9fe42af4307977c \ No newline at end of file
diff --git a/db/schema_migrations/20230220134146 b/db/schema_migrations/20230220134146
new file mode 100644
index 00000000000..3d0745d3f22
--- /dev/null
+++ b/db/schema_migrations/20230220134146
@@ -0,0 +1 @@
+7fe8e5e2e9019ccb29f29df161f7b7c45aa2576188b326e60f758dd2d5f56a47 \ No newline at end of file
diff --git a/db/schema_migrations/20230220163141 b/db/schema_migrations/20230220163141
new file mode 100644
index 00000000000..ac2e348448d
--- /dev/null
+++ b/db/schema_migrations/20230220163141
@@ -0,0 +1 @@
+5f0c9945aaf1f34cb9c79b6c3634f4fd44ac538469b3f97147be67a6f16c0c75 \ No newline at end of file
diff --git a/db/schema_migrations/20230220165240 b/db/schema_migrations/20230220165240
new file mode 100644
index 00000000000..14cd3554464
--- /dev/null
+++ b/db/schema_migrations/20230220165240
@@ -0,0 +1 @@
+754b55e9465719edb5058c97cacf1f369347e15c7e6d7fa30dcbe5abd8addcae \ No newline at end of file
diff --git a/db/schema_migrations/20230221010522 b/db/schema_migrations/20230221010522
new file mode 100644
index 00000000000..57727695f5e
--- /dev/null
+++ b/db/schema_migrations/20230221010522
@@ -0,0 +1 @@
+474f2b46179134270dc65c2b32ef9acfb01edb976f5efefe9ab49352d3fc390f \ No newline at end of file
diff --git a/db/schema_migrations/20230221011750 b/db/schema_migrations/20230221011750
new file mode 100644
index 00000000000..9f43d53a1b2
--- /dev/null
+++ b/db/schema_migrations/20230221011750
@@ -0,0 +1 @@
+cca7c1c232fa56e85bb0fc120a5920f3cb75d0fea2657ed2e81a4fe69349134a \ No newline at end of file
diff --git a/db/schema_migrations/20230221093533 b/db/schema_migrations/20230221093533
new file mode 100644
index 00000000000..1d9ac2c72b4
--- /dev/null
+++ b/db/schema_migrations/20230221093533
@@ -0,0 +1 @@
+6a3453275435ebad3269b81f10bc75bf3aeb92f8c9a6769743acf2af78a1dc69 \ No newline at end of file
diff --git a/db/schema_migrations/20230221110256 b/db/schema_migrations/20230221110256
new file mode 100644
index 00000000000..2448c317588
--- /dev/null
+++ b/db/schema_migrations/20230221110256
@@ -0,0 +1 @@
+661fdc00029ab9bae8b4da6a8d92f172db89087aecc13f3ad65b2b3e8ad501d3 \ No newline at end of file
diff --git a/db/schema_migrations/20230221125148 b/db/schema_migrations/20230221125148
new file mode 100644
index 00000000000..35ec9b066bc
--- /dev/null
+++ b/db/schema_migrations/20230221125148
@@ -0,0 +1 @@
+f64a3cb1963dde07eaaae9d331ebf1e5e52050435b38f9b6727a53f04808b723 \ No newline at end of file
diff --git a/db/schema_migrations/20230221162222 b/db/schema_migrations/20230221162222
new file mode 100644
index 00000000000..be6d9c407b1
--- /dev/null
+++ b/db/schema_migrations/20230221162222
@@ -0,0 +1 @@
+f0fd872c7999879be5d433881e20855cc8e2418625374fc095cc74172b9f08c5 \ No newline at end of file
diff --git a/db/schema_migrations/20230221214519 b/db/schema_migrations/20230221214519
new file mode 100644
index 00000000000..aa630e64644
--- /dev/null
+++ b/db/schema_migrations/20230221214519
@@ -0,0 +1 @@
+b8eccb700af0593b94e26e0fbe8b4c680b9bae47ced111422dc400159a3f6b12 \ No newline at end of file
diff --git a/db/schema_migrations/20230222035805 b/db/schema_migrations/20230222035805
new file mode 100644
index 00000000000..a0dadf5c43a
--- /dev/null
+++ b/db/schema_migrations/20230222035805
@@ -0,0 +1 @@
+ffc433ce994ab67af36dfeddd19a29d8c35379f30c9a95c8bb2d0f3c7774e612 \ No newline at end of file
diff --git a/db/schema_migrations/20230222055510 b/db/schema_migrations/20230222055510
new file mode 100644
index 00000000000..5abc44779d9
--- /dev/null
+++ b/db/schema_migrations/20230222055510
@@ -0,0 +1 @@
+ff8b8d5448460302449025fc79cec95d0d3ae2eb335e9f786031d39caacf631a \ No newline at end of file
diff --git a/db/schema_migrations/20230222101420 b/db/schema_migrations/20230222101420
new file mode 100644
index 00000000000..f0cd65454ac
--- /dev/null
+++ b/db/schema_migrations/20230222101420
@@ -0,0 +1 @@
+74413d13062dd7a48d07f9839b4a22db3f7358cffda403a036dfa1686fb693c8 \ No newline at end of file
diff --git a/db/schema_migrations/20230222102421 b/db/schema_migrations/20230222102421
new file mode 100644
index 00000000000..2b186e0e34a
--- /dev/null
+++ b/db/schema_migrations/20230222102421
@@ -0,0 +1 @@
+52ca4df8ee309791bb7fc4078a1298555b962137f1d07585e361b008d591164c \ No newline at end of file
diff --git a/db/schema_migrations/20230222153048 b/db/schema_migrations/20230222153048
new file mode 100644
index 00000000000..66347d3252f
--- /dev/null
+++ b/db/schema_migrations/20230222153048
@@ -0,0 +1 @@
+ff11462b7e827b0ae66f54b131fa0d4099a6e7cc768fc9b400ee36346d1773fa \ No newline at end of file
diff --git a/db/schema_migrations/20230222193845 b/db/schema_migrations/20230222193845
new file mode 100644
index 00000000000..eaf26ae70f1
--- /dev/null
+++ b/db/schema_migrations/20230222193845
@@ -0,0 +1 @@
+b70150d44ca3f029fe987831a880017be9e8cd8f7833e6d4d3bb68929130b614 \ No newline at end of file
diff --git a/db/schema_migrations/20230223014251 b/db/schema_migrations/20230223014251
new file mode 100644
index 00000000000..7613e540112
--- /dev/null
+++ b/db/schema_migrations/20230223014251
@@ -0,0 +1 @@
+1d43fc6bfb88caf86d02b83c944c143bc87142a49f3fe1ec4c54e29c960060c5 \ No newline at end of file
diff --git a/db/schema_migrations/20230223065753 b/db/schema_migrations/20230223065753
new file mode 100644
index 00000000000..c1b7927515f
--- /dev/null
+++ b/db/schema_migrations/20230223065753
@@ -0,0 +1 @@
+789d72eef2573834bef2a2d20070000b580eba069c45f97fdec18a4d5af99605 \ No newline at end of file
diff --git a/db/schema_migrations/20230223082752 b/db/schema_migrations/20230223082752
new file mode 100644
index 00000000000..83789c7ffe8
--- /dev/null
+++ b/db/schema_migrations/20230223082752
@@ -0,0 +1 @@
+53f1003eeb8f961b37d90c73a71f75683077b9bcd0e495395033998530a363bd \ No newline at end of file
diff --git a/db/schema_migrations/20230223093704 b/db/schema_migrations/20230223093704
new file mode 100644
index 00000000000..bd35f5c493e
--- /dev/null
+++ b/db/schema_migrations/20230223093704
@@ -0,0 +1 @@
+39a17836884a6c07ff3f9df6e7328473f1dc2ac2d407f615821d29958f9b1808 \ No newline at end of file
diff --git a/db/schema_migrations/20230224085743 b/db/schema_migrations/20230224085743
new file mode 100644
index 00000000000..bda82e5e10c
--- /dev/null
+++ b/db/schema_migrations/20230224085743
@@ -0,0 +1 @@
+e6deb8645468ab4e90487211b14d5432b26fb4c06635b333776c1ac175187444 \ No newline at end of file
diff --git a/db/schema_migrations/20230224130315 b/db/schema_migrations/20230224130315
new file mode 100644
index 00000000000..44960762a62
--- /dev/null
+++ b/db/schema_migrations/20230224130315
@@ -0,0 +1 @@
+e54ddd26174440b453482d4c3d2dd8aa8cacbb2697162d9f976ed52a0d55f1a0 \ No newline at end of file
diff --git a/db/schema_migrations/20230224144233 b/db/schema_migrations/20230224144233
new file mode 100644
index 00000000000..ce588827227
--- /dev/null
+++ b/db/schema_migrations/20230224144233
@@ -0,0 +1 @@
+ec6c176dc707bcaa39747fb23add886c711e075b22823174bc9f0ebee2ec224e \ No newline at end of file
diff --git a/db/schema_migrations/20230224161346 b/db/schema_migrations/20230224161346
new file mode 100644
index 00000000000..1c939bdafaf
--- /dev/null
+++ b/db/schema_migrations/20230224161346
@@ -0,0 +1 @@
+191d7be803e9e3a2a5292bbcd562c34a67c07b73da2c429ac2f115b28d04f00c \ No newline at end of file
diff --git a/db/schema_migrations/20230227123949 b/db/schema_migrations/20230227123949
new file mode 100644
index 00000000000..ab216ad946c
--- /dev/null
+++ b/db/schema_migrations/20230227123949
@@ -0,0 +1 @@
+cf72b9c6cd86bf0fbb0599f16bfcfd360567a8cdf30275ba59c1aeaba8317f2a \ No newline at end of file
diff --git a/db/schema_migrations/20230227123950 b/db/schema_migrations/20230227123950
new file mode 100644
index 00000000000..e2b8672fb3f
--- /dev/null
+++ b/db/schema_migrations/20230227123950
@@ -0,0 +1 @@
+d7f195e2cb4ab9f7f4637ba7667605eea02e66ea417b4ae496a1acae9931be84 \ No newline at end of file
diff --git a/db/schema_migrations/20230227151608 b/db/schema_migrations/20230227151608
new file mode 100644
index 00000000000..333d71b1789
--- /dev/null
+++ b/db/schema_migrations/20230227151608
@@ -0,0 +1 @@
+b43ebf61392e2857bd38f783f1ae46c4adce76a94dd8e7aa64fc02f234991229 \ No newline at end of file
diff --git a/db/schema_migrations/20230227151609 b/db/schema_migrations/20230227151609
new file mode 100644
index 00000000000..ec320e3c256
--- /dev/null
+++ b/db/schema_migrations/20230227151609
@@ -0,0 +1 @@
+c2ac227a2e1a51423b043db9e992a519c096af8a309d3c1074fbd8bd744b4e3b \ No newline at end of file
diff --git a/db/schema_migrations/20230227153231 b/db/schema_migrations/20230227153231
new file mode 100644
index 00000000000..18e685b52b0
--- /dev/null
+++ b/db/schema_migrations/20230227153231
@@ -0,0 +1 @@
+a4ae1dd4a14b977302c61d0731e9d350fbdc089a909ca3151fb4b9699b0efbb8 \ No newline at end of file
diff --git a/db/schema_migrations/20230227153232 b/db/schema_migrations/20230227153232
new file mode 100644
index 00000000000..c605a0f5754
--- /dev/null
+++ b/db/schema_migrations/20230227153232
@@ -0,0 +1 @@
+a9082aa6b8cb86be9534fe41db5790b6cca876e6fcc284daf8e5b3163b92bd06 \ No newline at end of file
diff --git a/db/schema_migrations/20230228021910 b/db/schema_migrations/20230228021910
new file mode 100644
index 00000000000..813f8efc809
--- /dev/null
+++ b/db/schema_migrations/20230228021910
@@ -0,0 +1 @@
+2be11b13b0776de4185232030374e16f0e6fdb5e21cfb6e546f2b8e5c6126547 \ No newline at end of file
diff --git a/db/schema_migrations/20230228023014 b/db/schema_migrations/20230228023014
new file mode 100644
index 00000000000..39348c9471f
--- /dev/null
+++ b/db/schema_migrations/20230228023014
@@ -0,0 +1 @@
+68de7109072a6c6769d59100e5d17f2c35027cedfa365e8506951d985283f36b \ No newline at end of file
diff --git a/db/schema_migrations/20230228092612 b/db/schema_migrations/20230228092612
new file mode 100644
index 00000000000..ad52eedb797
--- /dev/null
+++ b/db/schema_migrations/20230228092612
@@ -0,0 +1 @@
+79c17f4dfb9a208057562c8a9898fda4c1fa8819a3b7a1e594037fd8263aba6f \ No newline at end of file
diff --git a/db/schema_migrations/20230228133011 b/db/schema_migrations/20230228133011
new file mode 100644
index 00000000000..cd0c683fbcf
--- /dev/null
+++ b/db/schema_migrations/20230228133011
@@ -0,0 +1 @@
+ab33a8ef7080890c31a51c6f2455399ccb17a43595c305d15b2b884b28803860 \ No newline at end of file
diff --git a/db/schema_migrations/20230228135034 b/db/schema_migrations/20230228135034
new file mode 100644
index 00000000000..13f007f7989
--- /dev/null
+++ b/db/schema_migrations/20230228135034
@@ -0,0 +1 @@
+3a704331dd2b45c202a42e188ee3ef9a0721b5798d218f5d3300fc18632201b6 \ No newline at end of file
diff --git a/db/schema_migrations/20230228142350 b/db/schema_migrations/20230228142350
new file mode 100644
index 00000000000..cd783d44b2a
--- /dev/null
+++ b/db/schema_migrations/20230228142350
@@ -0,0 +1 @@
+ae4c6d6d477f073981f9f4e431bcb93289cfb54569a3dc982434a2e805c7801b \ No newline at end of file
diff --git a/db/schema_migrations/20230228212427 b/db/schema_migrations/20230228212427
new file mode 100644
index 00000000000..1bad198ce7c
--- /dev/null
+++ b/db/schema_migrations/20230228212427
@@ -0,0 +1 @@
+78b4d88f861f65ece401f6207a12e4edd16e686ca15180eb9526014bf575084e \ No newline at end of file
diff --git a/db/schema_migrations/20230228212905 b/db/schema_migrations/20230228212905
new file mode 100644
index 00000000000..2465e5ce9a9
--- /dev/null
+++ b/db/schema_migrations/20230228212905
@@ -0,0 +1 @@
+63e7999f522a2fc4f220062b5424d711e985a3b78fc2aee3d7afcfe2f3514d73 \ No newline at end of file
diff --git a/db/schema_migrations/20230301065107 b/db/schema_migrations/20230301065107
new file mode 100644
index 00000000000..495cefad9d2
--- /dev/null
+++ b/db/schema_migrations/20230301065107
@@ -0,0 +1 @@
+7e464616bdef6e225fdd31db84c4c32e223dffb81e13f1d6a5c85c2cd0a16144 \ No newline at end of file
diff --git a/db/schema_migrations/20230302090155 b/db/schema_migrations/20230302090155
new file mode 100644
index 00000000000..af86ce4635d
--- /dev/null
+++ b/db/schema_migrations/20230302090155
@@ -0,0 +1 @@
+52b9428336c506a0bf698ea03215dd2b279b9e7d2ca56936df094aaad7934f96 \ No newline at end of file
diff --git a/db/schema_migrations/20230302123258 b/db/schema_migrations/20230302123258
new file mode 100644
index 00000000000..b4fe3ae9f34
--- /dev/null
+++ b/db/schema_migrations/20230302123258
@@ -0,0 +1 @@
+ecb6f601d4f47e7c4974e097c0e87ff37f96fad93b2ab02439bfa44a7eb481cd \ No newline at end of file
diff --git a/db/schema_migrations/20230302123259 b/db/schema_migrations/20230302123259
new file mode 100644
index 00000000000..6ef93fc8c73
--- /dev/null
+++ b/db/schema_migrations/20230302123259
@@ -0,0 +1 @@
+671fe2bcc6b45d7f312144d6c1ceb7c5e085dbc1ab1069c5a340849a08437d72 \ No newline at end of file
diff --git a/db/schema_migrations/20230302123301 b/db/schema_migrations/20230302123301
new file mode 100644
index 00000000000..d9af7fe9b69
--- /dev/null
+++ b/db/schema_migrations/20230302123301
@@ -0,0 +1 @@
+ca0e0d645cfd5f672d286e8977fc94d4c92579801cb4a781c495465cbc581a33 \ No newline at end of file
diff --git a/db/schema_migrations/20230302163339 b/db/schema_migrations/20230302163339
new file mode 100644
index 00000000000..25c611e57a6
--- /dev/null
+++ b/db/schema_migrations/20230302163339
@@ -0,0 +1 @@
+5cb36884c6422f9cf2db27c7922a8835b1db6d15e629066ca825c93df7437afa \ No newline at end of file
diff --git a/db/schema_migrations/20230302185739 b/db/schema_migrations/20230302185739
new file mode 100644
index 00000000000..a9f2426e7d9
--- /dev/null
+++ b/db/schema_migrations/20230302185739
@@ -0,0 +1 @@
+92b302a4fec802bb418f8a844f70c678af70cc9607331533392ce4b6e830e8d7 \ No newline at end of file
diff --git a/db/schema_migrations/20230303105806 b/db/schema_migrations/20230303105806
new file mode 100644
index 00000000000..46bf8fb2b2b
--- /dev/null
+++ b/db/schema_migrations/20230303105806
@@ -0,0 +1 @@
+5f2176abfc462e65c9ef2b9b28c9feb60cac868aa491d4d4207a8904deb60f18 \ No newline at end of file
diff --git a/db/schema_migrations/20230303120531 b/db/schema_migrations/20230303120531
new file mode 100644
index 00000000000..5c042677e67
--- /dev/null
+++ b/db/schema_migrations/20230303120531
@@ -0,0 +1 @@
+6af890fe88f25be54d18cf3b3caa14830a3d627e7ff256d7a4ae03f9f1c7170c \ No newline at end of file
diff --git a/db/schema_migrations/20230303144424 b/db/schema_migrations/20230303144424
new file mode 100644
index 00000000000..f0684710508
--- /dev/null
+++ b/db/schema_migrations/20230303144424
@@ -0,0 +1 @@
+c8ea35db8903fb627b3ed68b9d9a1e78c34ab40a5aed6fe19e329d13e371f652 \ No newline at end of file
diff --git a/db/schema_migrations/20230303154314 b/db/schema_migrations/20230303154314
new file mode 100644
index 00000000000..30a33a6efba
--- /dev/null
+++ b/db/schema_migrations/20230303154314
@@ -0,0 +1 @@
+c18a674b6df4baf6d81177df2eb4497dc73979ff71142a9ecda71ec515a588b4 \ No newline at end of file
diff --git a/db/schema_migrations/20230304184416 b/db/schema_migrations/20230304184416
new file mode 100644
index 00000000000..908fcd3bbc7
--- /dev/null
+++ b/db/schema_migrations/20230304184416
@@ -0,0 +1 @@
+c6c361ae0fea1ac200e0b4a6683bc9ff853ffb1f890f0555fe921ce72d2453f5 \ No newline at end of file
diff --git a/db/schema_migrations/20230306071456 b/db/schema_migrations/20230306071456
new file mode 100644
index 00000000000..b4ac086f125
--- /dev/null
+++ b/db/schema_migrations/20230306071456
@@ -0,0 +1 @@
+7f431d6dd4f9dc237623c18465995fa59c9902187f433375baa03194f7a6b88f \ No newline at end of file
diff --git a/db/schema_migrations/20230306072532 b/db/schema_migrations/20230306072532
new file mode 100644
index 00000000000..f1604aa84a7
--- /dev/null
+++ b/db/schema_migrations/20230306072532
@@ -0,0 +1 @@
+f6613d1fd3b99fa0e8ea059c6d53e8d226ce3fd8c07e44a024b065d8d110876f \ No newline at end of file
diff --git a/db/schema_migrations/20230306082852 b/db/schema_migrations/20230306082852
new file mode 100644
index 00000000000..bbbe7cb27ef
--- /dev/null
+++ b/db/schema_migrations/20230306082852
@@ -0,0 +1 @@
+580efa96f235c47de1bcea172544e51e8207dd0a81bd888567b30ce02e453f7d \ No newline at end of file
diff --git a/db/schema_migrations/20230306143322 b/db/schema_migrations/20230306143322
new file mode 100644
index 00000000000..d1b5080398c
--- /dev/null
+++ b/db/schema_migrations/20230306143322
@@ -0,0 +1 @@
+0f6c5bfbad3779c6d20984fb29e5494cf4c46d7992e1fa3f8a705913aa0f3b92 \ No newline at end of file
diff --git a/db/schema_migrations/20230306145230 b/db/schema_migrations/20230306145230
new file mode 100644
index 00000000000..d0fa5e5634b
--- /dev/null
+++ b/db/schema_migrations/20230306145230
@@ -0,0 +1 @@
+ca28b1355e5cc8c1e77c85a4d5e6a40b66767a8588068eb7e1528ba0e575f5da \ No newline at end of file
diff --git a/db/schema_migrations/20230306195007 b/db/schema_migrations/20230306195007
new file mode 100644
index 00000000000..bb28fbc5586
--- /dev/null
+++ b/db/schema_migrations/20230306195007
@@ -0,0 +1 @@
+f799b921663f3de04e0b8f5017305e186c4e418392256adf33f2408ea6d8d2ca \ No newline at end of file
diff --git a/db/schema_migrations/20230307085644 b/db/schema_migrations/20230307085644
new file mode 100644
index 00000000000..7176a19a788
--- /dev/null
+++ b/db/schema_migrations/20230307085644
@@ -0,0 +1 @@
+2b918f516a004d3b3f1b310ad9421a29a9675a7670f6a653ba73209f8e7f0f41 \ No newline at end of file
diff --git a/db/schema_migrations/20230307091216 b/db/schema_migrations/20230307091216
new file mode 100644
index 00000000000..4727747daa7
--- /dev/null
+++ b/db/schema_migrations/20230307091216
@@ -0,0 +1 @@
+0c13f0053959e1c3e66f0c87d55d4a9190b36d61f67bb1b3ec32f73fa699c961 \ No newline at end of file
diff --git a/db/schema_migrations/20230307122838 b/db/schema_migrations/20230307122838
new file mode 100644
index 00000000000..adf5d84a474
--- /dev/null
+++ b/db/schema_migrations/20230307122838
@@ -0,0 +1 @@
+5b147e92d42b7ec317106d905a3af4d1aee983bce8538c26a619ad32ad06c42e \ No newline at end of file
diff --git a/db/schema_migrations/20230307160251 b/db/schema_migrations/20230307160251
new file mode 100644
index 00000000000..7265c801b46
--- /dev/null
+++ b/db/schema_migrations/20230307160251
@@ -0,0 +1 @@
+a7cf83ea7e94cc3d6a581cd89aab8274e86f5c195f1537395d72b275b96bd31c \ No newline at end of file
diff --git a/db/schema_migrations/20230307233631 b/db/schema_migrations/20230307233631
new file mode 100644
index 00000000000..c05d21f2113
--- /dev/null
+++ b/db/schema_migrations/20230307233631
@@ -0,0 +1 @@
+be9ce74f455171c265135ffc105d5c69a660cdad7f71656615b3d8caf5831b32 \ No newline at end of file
diff --git a/db/schema_migrations/20230308163018 b/db/schema_migrations/20230308163018
new file mode 100644
index 00000000000..19815455ef3
--- /dev/null
+++ b/db/schema_migrations/20230308163018
@@ -0,0 +1 @@
+f9132e8d1d39307fc4f9ef17c6e044bab636d17ae7a7e5207f26ab3e38441638 \ No newline at end of file
diff --git a/db/schema_migrations/20230309000957 b/db/schema_migrations/20230309000957
new file mode 100644
index 00000000000..679d37f153b
--- /dev/null
+++ b/db/schema_migrations/20230309000957
@@ -0,0 +1 @@
+902e921099ed27cc1c8fd36eac192879ff6c68e4aa7ef4a0764381c0a01fd76e \ No newline at end of file
diff --git a/db/schema_migrations/20230309010000 b/db/schema_migrations/20230309010000
new file mode 100644
index 00000000000..9415a4b9f11
--- /dev/null
+++ b/db/schema_migrations/20230309010000
@@ -0,0 +1 @@
+de7622f865cc6216902d1f9964a645d74777e60072efa399683cd6a9c347d27b \ No newline at end of file
diff --git a/db/schema_migrations/20230309010931 b/db/schema_migrations/20230309010931
new file mode 100644
index 00000000000..c7ac631a427
--- /dev/null
+++ b/db/schema_migrations/20230309010931
@@ -0,0 +1 @@
+1976ef23f13343f1ae85b9c9c612dc43e4f4696c9cfad1f36a54e9368ded4f20 \ No newline at end of file
diff --git a/db/schema_migrations/20230309020422 b/db/schema_migrations/20230309020422
new file mode 100644
index 00000000000..b43cc93836f
--- /dev/null
+++ b/db/schema_migrations/20230309020422
@@ -0,0 +1 @@
+51ff7181e6ae2ed88e2d2d91d3f29a53c0342c3461ea55be1bf202a85709f6c6 \ No newline at end of file
diff --git a/db/schema_migrations/20230309071242 b/db/schema_migrations/20230309071242
new file mode 100644
index 00000000000..dd29a8006b1
--- /dev/null
+++ b/db/schema_migrations/20230309071242
@@ -0,0 +1 @@
+094eb5044e841050288c7362cc58c1b63ce4a349fe49a4c5ebee6b83a05feb56 \ No newline at end of file
diff --git a/db/schema_migrations/20230309103016 b/db/schema_migrations/20230309103016
new file mode 100644
index 00000000000..fae5bcc5a72
--- /dev/null
+++ b/db/schema_migrations/20230309103016
@@ -0,0 +1 @@
+e02ad3e7cfb386560e2e4d71332f1ced4a1827941b78012d974d9abcfea368d9 \ No newline at end of file
diff --git a/db/schema_migrations/20230310111859 b/db/schema_migrations/20230310111859
new file mode 100644
index 00000000000..0bc9268a311
--- /dev/null
+++ b/db/schema_migrations/20230310111859
@@ -0,0 +1 @@
+d1accdc2bbe9aa5266df98a893176fba94148f9754d2c0b2de04e9d8d66d8eba \ No newline at end of file
diff --git a/db/schema_migrations/20230313054226 b/db/schema_migrations/20230313054226
new file mode 100644
index 00000000000..7b174fe3570
--- /dev/null
+++ b/db/schema_migrations/20230313054226
@@ -0,0 +1 @@
+15c56632eafda4ab511368001a7bbfdf9f346049ab19a9df3ad2c96adc12f1a0 \ No newline at end of file
diff --git a/db/schema_migrations/20230313100920 b/db/schema_migrations/20230313100920
new file mode 100644
index 00000000000..bb04d2a9f72
--- /dev/null
+++ b/db/schema_migrations/20230313100920
@@ -0,0 +1 @@
+e2940977e8dfc2873751ae2c4b971b2d12cf79eb644c563b901f20d2e0c51649 \ No newline at end of file
diff --git a/db/schema_migrations/20230313133001 b/db/schema_migrations/20230313133001
new file mode 100644
index 00000000000..724003e3448
--- /dev/null
+++ b/db/schema_migrations/20230313133001
@@ -0,0 +1 @@
+96220e0bd8ebc4ed6ad5478d1bc8e08760e8d301667fad3cdbd9dce689a32d87 \ No newline at end of file
diff --git a/db/schema_migrations/20230313143033 b/db/schema_migrations/20230313143033
new file mode 100644
index 00000000000..81e9dd384b9
--- /dev/null
+++ b/db/schema_migrations/20230313143033
@@ -0,0 +1 @@
+6a2ae2db3b61652bdf29a1e851d4120fb31eb21edaa2ffa6ef44415dfea928c5 \ No newline at end of file
diff --git a/db/schema_migrations/20230313150531 b/db/schema_migrations/20230313150531
new file mode 100644
index 00000000000..94625561f6b
--- /dev/null
+++ b/db/schema_migrations/20230313150531
@@ -0,0 +1 @@
+e2f19bbc322127e439fffc4c1e2718288538aa6cb2d50a5248f12470b1c9491e \ No newline at end of file
diff --git a/db/schema_migrations/20230313184306 b/db/schema_migrations/20230313184306
new file mode 100644
index 00000000000..733217f705c
--- /dev/null
+++ b/db/schema_migrations/20230313184306
@@ -0,0 +1 @@
+457c9325bb8af653b179cb04a3332746b1caf0854b555f71fe8ceb4e323e8b20 \ No newline at end of file
diff --git a/db/schema_migrations/20230313185145 b/db/schema_migrations/20230313185145
new file mode 100644
index 00000000000..6eb3908d1da
--- /dev/null
+++ b/db/schema_migrations/20230313185145
@@ -0,0 +1 @@
+a5a630c2dbd94af837bff0056ee472360646306ca1c00e66fc3f68669006cf50 \ No newline at end of file
diff --git a/db/schema_migrations/20230316014650 b/db/schema_migrations/20230316014650
new file mode 100644
index 00000000000..590de1b6748
--- /dev/null
+++ b/db/schema_migrations/20230316014650
@@ -0,0 +1 @@
+f2263525d0e7569eb2ca639b83a7fa5704aba32268570191aee0fd421010d122 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index c277291e823..d0edfc515f9 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -68,6 +68,7 @@ DECLARE
resolved_on_default_branch boolean;
present_on_default_branch boolean;
namespace_id bigint;
+ has_issues boolean;
BEGIN
IF (NEW.vulnerability_id IS NULL AND (TG_OP = 'INSERT' OR TG_OP = 'UPDATE')) THEN
RETURN NULL;
@@ -82,7 +83,7 @@ BEGIN
INTO
severity, state, report_type, resolved_on_default_branch, present_on_default_branch
FROM
- vulnerabilities
+ vulnerabilities
WHERE
vulnerabilities.id = NEW.vulnerability_id;
@@ -99,8 +100,13 @@ BEGIN
WHERE
projects.id = NEW.project_id;
- INSERT INTO vulnerability_reads (vulnerability_id, namespace_id, project_id, scanner_id, report_type, severity, state, resolved_on_default_branch, uuid, location_image, cluster_agent_id, casted_cluster_agent_id)
- VALUES (NEW.vulnerability_id, namespace_id, NEW.project_id, NEW.scanner_id, report_type, severity, state, resolved_on_default_branch, NEW.uuid::uuid, NEW.location->>'image', NEW.location->'kubernetes_resource'->>'agent_id', CAST(NEW.location->'kubernetes_resource'->>'agent_id' AS bigint))
+ SELECT
+ EXISTS (SELECT 1 FROM vulnerability_issue_links WHERE vulnerability_issue_links.vulnerability_id = NEW.vulnerability_id)
+ INTO
+ has_issues;
+
+ INSERT INTO vulnerability_reads (vulnerability_id, namespace_id, project_id, scanner_id, report_type, severity, state, resolved_on_default_branch, uuid, location_image, cluster_agent_id, casted_cluster_agent_id, has_issues)
+ VALUES (NEW.vulnerability_id, namespace_id, NEW.project_id, NEW.scanner_id, report_type, severity, state, resolved_on_default_branch, NEW.uuid::uuid, NEW.location->>'image', NEW.location->'kubernetes_resource'->>'agent_id', CAST(NEW.location->'kubernetes_resource'->>'agent_id' AS bigint), has_issues)
ON CONFLICT(vulnerability_id) DO NOTHING;
RETURN NULL;
END
@@ -127,6 +133,7 @@ DECLARE
cluster_agent_id text;
casted_cluster_agent_id bigint;
namespace_id bigint;
+ has_issues boolean;
BEGIN
SELECT
v_o.scanner_id, v_o.uuid, v_o.location->>'image', v_o.location->'kubernetes_resource'->>'agent_id', CAST(v_o.location->'kubernetes_resource'->>'agent_id' AS bigint), projects.namespace_id
@@ -139,8 +146,13 @@ BEGIN
v_o.vulnerability_id = NEW.id
LIMIT 1;
- INSERT INTO vulnerability_reads (vulnerability_id, namespace_id, project_id, scanner_id, report_type, severity, state, resolved_on_default_branch, uuid, location_image, cluster_agent_id, casted_cluster_agent_id)
- VALUES (NEW.id, namespace_id, NEW.project_id, scanner_id, NEW.report_type, NEW.severity, NEW.state, NEW.resolved_on_default_branch, uuid::uuid, location_image, cluster_agent_id, casted_cluster_agent_id)
+ SELECT
+ EXISTS (SELECT 1 FROM vulnerability_issue_links WHERE vulnerability_issue_links.vulnerability_id = NEW.id)
+ INTO
+ has_issues;
+
+ INSERT INTO vulnerability_reads (vulnerability_id, namespace_id, project_id, scanner_id, report_type, severity, state, resolved_on_default_branch, uuid, location_image, cluster_agent_id, casted_cluster_agent_id, has_issues)
+ VALUES (NEW.id, namespace_id, NEW.project_id, scanner_id, NEW.report_type, NEW.severity, NEW.state, NEW.resolved_on_default_branch, uuid::uuid, location_image, cluster_agent_id, casted_cluster_agent_id, has_issues)
ON CONFLICT(vulnerability_id) DO NOTHING;
RETURN NULL;
END
@@ -543,6 +555,13 @@ CREATE TABLE batched_background_migration_job_transition_logs (
)
PARTITION BY RANGE (created_at);
+CREATE TABLE p_ci_runner_machine_builds (
+ partition_id bigint NOT NULL,
+ build_id bigint NOT NULL,
+ runner_machine_id bigint NOT NULL
+)
+PARTITION BY LIST (partition_id);
+
CREATE TABLE incident_management_pending_alert_escalations (
id bigint NOT NULL,
rule_id bigint NOT NULL,
@@ -10733,6 +10752,8 @@ CREATE TABLE abuse_reports (
category smallint DEFAULT 1 NOT NULL,
reported_from_url text DEFAULT ''::text NOT NULL,
links_to_spam text[] DEFAULT '{}'::text[] NOT NULL,
+ status smallint DEFAULT 1 NOT NULL,
+ resolved_at timestamp with time zone,
CONSTRAINT abuse_reports_links_to_spam_length_check CHECK ((cardinality(links_to_spam) <= 20)),
CONSTRAINT check_ab1260fa6c CHECK ((char_length(reported_from_url) <= 512))
);
@@ -10754,7 +10775,6 @@ CREATE TABLE achievements (
name text NOT NULL,
avatar text,
description text,
- revokeable boolean DEFAULT false NOT NULL,
CONSTRAINT check_5171b03f22 CHECK ((char_length(name) <= 255)),
CONSTRAINT check_a7a7b84a80 CHECK ((char_length(description) <= 1024)),
CONSTRAINT check_e174e93a9e CHECK ((char_length(avatar) <= 255))
@@ -10825,32 +10845,6 @@ CREATE SEQUENCE agent_project_authorizations_id_seq
ALTER SEQUENCE agent_project_authorizations_id_seq OWNED BY agent_project_authorizations.id;
-CREATE TABLE airflow_dags (
- 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,
- next_run timestamp with time zone,
- has_import_errors boolean,
- is_active boolean,
- is_paused boolean,
- dag_name text NOT NULL,
- schedule text,
- fileloc text,
- CONSTRAINT check_6999a61016 CHECK ((char_length(schedule) <= 255)),
- CONSTRAINT check_6f52bee3a1 CHECK ((char_length(fileloc) <= 255)),
- CONSTRAINT check_e10ac15d52 CHECK ((char_length(dag_name) <= 255))
-);
-
-CREATE SEQUENCE airflow_dags_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-ALTER SEQUENCE airflow_dags_id_seq OWNED BY airflow_dags.id;
-
CREATE TABLE alert_management_alert_assignees (
id bigint NOT NULL,
user_id bigint NOT NULL,
@@ -11317,7 +11311,6 @@ CREATE TABLE application_settings (
metrics_packet_size integer DEFAULT 1,
disabled_oauth_sign_in_sources text,
health_check_access_token character varying,
- send_user_confirmation_email boolean DEFAULT false,
container_registry_token_expire_delay integer DEFAULT 5,
after_sign_up_text text,
user_default_external boolean DEFAULT false NOT NULL,
@@ -11741,6 +11734,7 @@ CREATE TABLE application_settings (
allow_runner_registration_token boolean DEFAULT true NOT NULL,
user_defaults_to_private_profile boolean DEFAULT false NOT NULL,
allow_possible_spam boolean DEFAULT false NOT NULL,
+ default_syntax_highlighting_theme integer DEFAULT 1 NOT NULL,
encrypted_product_analytics_clickhouse_connection_string bytea,
encrypted_product_analytics_clickhouse_connection_string_iv bytea,
search_max_shard_size_gb integer DEFAULT 50 NOT NULL,
@@ -11751,6 +11745,12 @@ CREATE TABLE application_settings (
git_rate_limit_users_alertlist integer[] DEFAULT '{}'::integer[] NOT NULL,
allow_deploy_tokens_and_keys_with_external_authn boolean DEFAULT false NOT NULL,
security_policy_global_group_approvers_enabled boolean DEFAULT true NOT NULL,
+ projects_api_rate_limit_unauthenticated integer DEFAULT 400 NOT NULL,
+ deny_all_requests_except_allowed boolean DEFAULT false NOT NULL,
+ product_analytics_data_collector_host text,
+ lock_memberships_to_saml boolean DEFAULT false NOT NULL,
+ gitlab_dedicated_instance boolean DEFAULT false NOT NULL,
+ update_runner_versions_enabled boolean DEFAULT true NOT NULL,
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)),
@@ -11781,6 +11781,7 @@ CREATE TABLE application_settings (
CONSTRAINT check_5bcba483c4 CHECK ((char_length(sentry_environment) <= 255)),
CONSTRAINT check_718b4458ae CHECK ((char_length(personal_access_token_prefix) <= 20)),
CONSTRAINT check_7227fad848 CHECK ((char_length(rate_limiting_response_text) <= 255)),
+ CONSTRAINT check_72c984b2a5 CHECK ((char_length(product_analytics_data_collector_host) <= 255)),
CONSTRAINT check_734cc9407a CHECK ((char_length(globally_allowed_ips) <= 255)),
CONSTRAINT check_7ccfe2764a CHECK ((char_length(arkose_labs_namespace) <= 255)),
CONSTRAINT check_85a39b68ff CHECK ((char_length(encrypted_ci_jwt_signing_key_iv) <= 255)),
@@ -12626,6 +12627,28 @@ CREATE SEQUENCE broadcast_messages_id_seq
ALTER SEQUENCE broadcast_messages_id_seq OWNED BY broadcast_messages.id;
+CREATE TABLE bulk_import_batch_trackers (
+ id bigint NOT NULL,
+ tracker_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ status smallint DEFAULT 0 NOT NULL,
+ batch_number integer DEFAULT 0 NOT NULL,
+ fetched_objects_count integer DEFAULT 0 NOT NULL,
+ imported_objects_count integer DEFAULT 0 NOT NULL,
+ error text,
+ CONSTRAINT check_3d6963a51f CHECK ((char_length(error) <= 255))
+);
+
+CREATE SEQUENCE bulk_import_batch_trackers_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE bulk_import_batch_trackers_id_seq OWNED BY bulk_import_batch_trackers.id;
+
CREATE TABLE bulk_import_configurations (
id bigint NOT NULL,
bulk_import_id integer NOT NULL,
@@ -12662,6 +12685,7 @@ CREATE TABLE bulk_import_entities (
updated_at timestamp with time zone NOT NULL,
source_xid integer,
migrate_projects boolean DEFAULT true NOT NULL,
+ has_failures boolean DEFAULT false,
CONSTRAINT check_13f279f7da CHECK ((char_length(source_full_path) <= 255)),
CONSTRAINT check_715d725ea2 CHECK ((char_length(destination_name) <= 255)),
CONSTRAINT check_796a4d9cc6 CHECK ((char_length(jid) <= 255)),
@@ -12677,11 +12701,33 @@ CREATE SEQUENCE bulk_import_entities_id_seq
ALTER SEQUENCE bulk_import_entities_id_seq OWNED BY bulk_import_entities.id;
+CREATE TABLE bulk_import_export_batches (
+ id bigint NOT NULL,
+ export_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ status smallint DEFAULT 0 NOT NULL,
+ batch_number integer DEFAULT 0 NOT NULL,
+ objects_count integer DEFAULT 0 NOT NULL,
+ error text,
+ CONSTRAINT check_046dc60dfe CHECK ((char_length(error) <= 255))
+);
+
+CREATE SEQUENCE bulk_import_export_batches_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE bulk_import_export_batches_id_seq OWNED BY bulk_import_export_batches.id;
+
CREATE TABLE bulk_import_export_uploads (
id bigint NOT NULL,
export_id bigint NOT NULL,
updated_at timestamp with time zone NOT NULL,
export_file text,
+ batch_id bigint,
CONSTRAINT check_5add76239d CHECK ((char_length(export_file) <= 255))
);
@@ -12704,6 +12750,9 @@ CREATE TABLE bulk_import_exports (
relation text NOT NULL,
jid text,
error text,
+ batched boolean DEFAULT false NOT NULL,
+ batches_count integer DEFAULT 0 NOT NULL,
+ total_objects_count integer DEFAULT 0 NOT NULL,
CONSTRAINT check_24cb010672 CHECK ((char_length(relation) <= 255)),
CONSTRAINT check_8f0f357334 CHECK ((char_length(error) <= 255)),
CONSTRAINT check_9ee6d14d33 CHECK ((char_length(jid) <= 255))
@@ -12754,6 +12803,7 @@ CREATE TABLE bulk_import_trackers (
status smallint DEFAULT 0 NOT NULL,
created_at timestamp with time zone,
updated_at timestamp with time zone,
+ batched boolean DEFAULT false,
CONSTRAINT check_2d45cae629 CHECK ((char_length(relation) <= 255)),
CONSTRAINT check_40aeaa600b CHECK ((char_length(next_page) <= 255)),
CONSTRAINT check_603f91cb06 CHECK ((char_length(jid) <= 255)),
@@ -12778,6 +12828,7 @@ CREATE TABLE bulk_imports (
updated_at timestamp with time zone NOT NULL,
source_version text,
source_enterprise boolean DEFAULT true NOT NULL,
+ has_failures boolean DEFAULT false,
CONSTRAINT check_ea4e58775a CHECK ((char_length(source_version) <= 63))
);
@@ -12790,6 +12841,21 @@ CREATE SEQUENCE bulk_imports_id_seq
ALTER SEQUENCE bulk_imports_id_seq OWNED BY bulk_imports.id;
+CREATE TABLE catalog_resources (
+ id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE catalog_resources_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE catalog_resources_id_seq OWNED BY catalog_resources.id;
+
CREATE TABLE chat_names (
id integer NOT NULL,
user_id integer NOT NULL,
@@ -12831,13 +12897,13 @@ CREATE SEQUENCE chat_teams_id_seq
ALTER SEQUENCE chat_teams_id_seq OWNED BY chat_teams.id;
CREATE TABLE ci_build_needs (
- id integer NOT NULL,
+ id_convert_to_bigint integer DEFAULT 0 NOT NULL,
name text NOT NULL,
artifacts boolean DEFAULT true NOT NULL,
optional boolean DEFAULT false NOT NULL,
build_id bigint NOT NULL,
partition_id bigint DEFAULT 100 NOT NULL,
- id_convert_to_bigint bigint DEFAULT 0 NOT NULL
+ id bigint NOT NULL
);
CREATE SEQUENCE ci_build_needs_id_seq
@@ -13034,6 +13100,15 @@ CREATE SEQUENCE ci_builds_runner_session_id_seq
ALTER SEQUENCE ci_builds_runner_session_id_seq OWNED BY ci_builds_runner_session.id;
+CREATE TABLE ci_cost_settings (
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ runner_id bigint NOT NULL,
+ standard_factor double precision DEFAULT 1.0 NOT NULL,
+ os_contribution_factor double precision DEFAULT 0.008 NOT NULL,
+ os_plan_factor double precision DEFAULT 0.5 NOT NULL
+);
+
CREATE TABLE ci_daily_build_group_report_results (
id bigint NOT NULL,
date date NOT NULL,
@@ -13701,7 +13776,7 @@ CREATE TABLE ci_runners (
maximum_timeout integer,
runner_type smallint NOT NULL,
token_encrypted character varying,
- public_projects_minutes_cost_factor double precision DEFAULT 0.0 NOT NULL,
+ public_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,
private_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,
config jsonb DEFAULT '{}'::jsonb NOT NULL,
executor_type smallint,
@@ -14450,6 +14525,13 @@ CREATE TABLE container_expiration_policies (
CONSTRAINT container_expiration_policies_name_regex_keep CHECK ((char_length(name_regex_keep) <= 255))
);
+CREATE TABLE container_registry_data_repair_details (
+ missing_count integer DEFAULT 0,
+ project_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL
+);
+
CREATE TABLE container_repositories (
id integer NOT NULL,
project_id integer NOT NULL,
@@ -14488,6 +14570,18 @@ CREATE SEQUENCE container_repositories_id_seq
ALTER SEQUENCE container_repositories_id_seq OWNED BY container_repositories.id;
+CREATE TABLE container_repository_states (
+ verification_started_at timestamp with time zone,
+ verification_retry_at timestamp with time zone,
+ verified_at timestamp with time zone,
+ container_repository_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_c96417dbc5 CHECK ((char_length(verification_failure) <= 255))
+);
+
CREATE TABLE content_blocked_states (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -14671,6 +14765,7 @@ CREATE TABLE dast_pre_scan_verification_steps (
updated_at timestamp with time zone NOT NULL,
name text,
verification_errors text[] DEFAULT '{}'::text[] NOT NULL,
+ check_type smallint DEFAULT 0 NOT NULL,
CONSTRAINT check_cd216b95e4 CHECK ((char_length(name) <= 255))
);
@@ -15218,7 +15313,11 @@ CREATE TABLE design_management_designs (
filename character varying NOT NULL,
relative_position integer,
iid integer,
+ cached_markdown_version integer,
+ description text,
+ description_html text,
CONSTRAINT check_07155e2715 CHECK ((char_length((filename)::text) <= 255)),
+ CONSTRAINT check_aaf9fa6ae5 CHECK ((char_length(description) <= 1000000)),
CONSTRAINT check_cfb92df01a CHECK ((iid IS NOT NULL))
);
@@ -16663,7 +16762,8 @@ CREATE TABLE import_failures (
exception_message character varying(255),
retry_count integer,
group_id integer,
- source character varying(128)
+ source character varying(128),
+ external_identifiers jsonb DEFAULT '{}'::jsonb NOT NULL
);
CREATE SEQUENCE import_failures_id_seq
@@ -17948,7 +18048,7 @@ CREATE SEQUENCE merge_request_diffs_id_seq
ALTER SEQUENCE merge_request_diffs_id_seq OWNED BY merge_request_diffs.id;
CREATE TABLE merge_request_metrics (
- id integer NOT NULL,
+ id_convert_to_bigint integer DEFAULT 0 NOT NULL,
merge_request_id integer NOT NULL,
latest_build_started_at timestamp without time zone,
latest_build_finished_at timestamp without time zone,
@@ -17971,7 +18071,7 @@ CREATE TABLE merge_request_metrics (
added_lines integer,
removed_lines integer,
target_project_id integer,
- id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
+ id bigint NOT NULL,
CONSTRAINT check_e03d0900bf CHECK ((target_project_id IS NOT NULL))
);
@@ -18426,6 +18526,18 @@ CREATE TABLE namespace_details (
next_over_limit_check_at timestamp with time zone
);
+CREATE TABLE namespace_ldap_settings (
+ namespace_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ sync_last_start_at timestamp with time zone,
+ sync_last_update_at timestamp with time zone,
+ sync_last_successful_at timestamp with time zone,
+ sync_status smallint DEFAULT 0 NOT NULL,
+ sync_error text,
+ CONSTRAINT check_51a03d26b6 CHECK ((char_length(sync_error) <= 255))
+);
+
CREATE TABLE namespace_limits (
additional_purchased_storage_size bigint DEFAULT 0 NOT NULL,
additional_purchased_storage_ends_on date,
@@ -18463,7 +18575,8 @@ CREATE TABLE namespace_root_storage_statistics (
uploads_size bigint DEFAULT 0 NOT NULL,
dependency_proxy_size bigint DEFAULT 0 NOT NULL,
notification_level smallint DEFAULT 100 NOT NULL,
- container_registry_size bigint DEFAULT 0 NOT NULL
+ container_registry_size bigint DEFAULT 0 NOT NULL,
+ registry_size_estimated boolean DEFAULT false NOT NULL
);
CREATE TABLE namespace_settings (
@@ -18753,7 +18866,8 @@ CREATE TABLE oauth_access_tokens (
expires_in integer DEFAULT 7200,
revoked_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
- scopes character varying
+ scopes character varying,
+ CONSTRAINT check_70f294ef54 CHECK ((expires_in IS NOT NULL))
);
CREATE SEQUENCE oauth_access_tokens_id_seq
@@ -19992,6 +20106,7 @@ CREATE TABLE postgres_async_foreign_key_validations (
table_name text NOT NULL,
last_error text,
attempts integer DEFAULT 0 NOT NULL,
+ constraint_type smallint DEFAULT 0 NOT NULL,
CONSTRAINT check_536a40afbf CHECK ((char_length(last_error) <= 10000)),
CONSTRAINT check_74fb7c8e57 CHECK ((char_length(name) <= 63)),
CONSTRAINT check_cd435d6301 CHECK ((char_length(table_name) <= 63))
@@ -22076,6 +22191,18 @@ CREATE TABLE serverless_domain_cluster (
certificate text
);
+CREATE TABLE service_desk_custom_email_verifications (
+ project_id bigint NOT NULL,
+ triggerer_id bigint,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ triggered_at timestamp with time zone,
+ state smallint DEFAULT 0 NOT NULL,
+ error smallint,
+ encrypted_token bytea,
+ encrypted_token_iv bytea
+);
+
CREATE TABLE service_desk_settings (
project_id bigint NOT NULL,
issue_template_key character varying(255),
@@ -22639,10 +22766,10 @@ CREATE TABLE timelogs (
issue_id integer,
merge_request_id integer,
spent_at timestamp without time zone DEFAULT now(),
- note_id integer,
+ note_id_convert_to_bigint integer,
project_id integer,
summary text,
- note_id_convert_to_bigint bigint,
+ note_id bigint,
CONSTRAINT check_271d321699 CHECK ((char_length(summary) <= 255))
);
@@ -22944,6 +23071,7 @@ CREATE TABLE user_details (
password_last_changed_at timestamp with time zone DEFAULT now() NOT NULL,
onboarding_step_url text,
discord text DEFAULT ''::text NOT NULL,
+ provisioned_by_group_at timestamp with time zone,
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)),
@@ -23799,6 +23927,7 @@ CREATE TABLE vulnerability_state_transitions (
author_id bigint,
comment text,
dismissal_reason smallint,
+ state_changed_at_pipeline_id bigint,
CONSTRAINT check_d1ca8ec043 CHECK ((from_state <> to_state)),
CONSTRAINT check_fe2eb6a0f3 CHECK ((char_length(comment) <= 50000))
);
@@ -24223,8 +24352,6 @@ ALTER TABLE ONLY agent_group_authorizations ALTER COLUMN id SET DEFAULT nextval(
ALTER TABLE ONLY agent_project_authorizations ALTER COLUMN id SET DEFAULT nextval('agent_project_authorizations_id_seq'::regclass);
-ALTER TABLE ONLY airflow_dags ALTER COLUMN id SET DEFAULT nextval('airflow_dags_id_seq'::regclass);
-
ALTER TABLE ONLY alert_management_alert_assignees ALTER COLUMN id SET DEFAULT nextval('alert_management_alert_assignees_id_seq'::regclass);
ALTER TABLE ONLY alert_management_alert_metric_images ALTER COLUMN id SET DEFAULT nextval('alert_management_alert_metric_images_id_seq'::regclass);
@@ -24337,10 +24464,14 @@ ALTER TABLE ONLY boards_epic_user_preferences ALTER COLUMN id SET DEFAULT nextva
ALTER TABLE ONLY broadcast_messages ALTER COLUMN id SET DEFAULT nextval('broadcast_messages_id_seq'::regclass);
+ALTER TABLE ONLY bulk_import_batch_trackers ALTER COLUMN id SET DEFAULT nextval('bulk_import_batch_trackers_id_seq'::regclass);
+
ALTER TABLE ONLY bulk_import_configurations ALTER COLUMN id SET DEFAULT nextval('bulk_import_configurations_id_seq'::regclass);
ALTER TABLE ONLY bulk_import_entities ALTER COLUMN id SET DEFAULT nextval('bulk_import_entities_id_seq'::regclass);
+ALTER TABLE ONLY bulk_import_export_batches ALTER COLUMN id SET DEFAULT nextval('bulk_import_export_batches_id_seq'::regclass);
+
ALTER TABLE ONLY bulk_import_export_uploads ALTER COLUMN id SET DEFAULT nextval('bulk_import_export_uploads_id_seq'::regclass);
ALTER TABLE ONLY bulk_import_exports ALTER COLUMN id SET DEFAULT nextval('bulk_import_exports_id_seq'::regclass);
@@ -24351,6 +24482,8 @@ ALTER TABLE ONLY bulk_import_trackers ALTER COLUMN id SET DEFAULT nextval('bulk_
ALTER TABLE ONLY bulk_imports ALTER COLUMN id SET DEFAULT nextval('bulk_imports_id_seq'::regclass);
+ALTER TABLE ONLY catalog_resources ALTER COLUMN id SET DEFAULT nextval('catalog_resources_id_seq'::regclass);
+
ALTER TABLE ONLY chat_names ALTER COLUMN id SET DEFAULT nextval('chat_names_id_seq'::regclass);
ALTER TABLE ONLY chat_teams ALTER COLUMN id SET DEFAULT nextval('chat_teams_id_seq'::regclass);
@@ -25904,9 +26037,6 @@ ALTER TABLE ONLY agent_group_authorizations
ALTER TABLE ONLY agent_project_authorizations
ADD CONSTRAINT agent_project_authorizations_pkey PRIMARY KEY (id);
-ALTER TABLE ONLY airflow_dags
- ADD CONSTRAINT airflow_dags_pkey PRIMARY KEY (id);
-
ALTER TABLE ONLY alert_management_alert_assignees
ADD CONSTRAINT alert_management_alert_assignees_pkey PRIMARY KEY (id);
@@ -26093,12 +26223,18 @@ ALTER TABLE ONLY boards
ALTER TABLE ONLY broadcast_messages
ADD CONSTRAINT broadcast_messages_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY bulk_import_batch_trackers
+ ADD CONSTRAINT bulk_import_batch_trackers_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY bulk_import_configurations
ADD CONSTRAINT bulk_import_configurations_pkey PRIMARY KEY (id);
ALTER TABLE ONLY bulk_import_entities
ADD CONSTRAINT bulk_import_entities_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY bulk_import_export_batches
+ ADD CONSTRAINT bulk_import_export_batches_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY bulk_import_export_uploads
ADD CONSTRAINT bulk_import_export_uploads_pkey PRIMARY KEY (id);
@@ -26114,6 +26250,9 @@ ALTER TABLE ONLY bulk_import_trackers
ALTER TABLE ONLY bulk_imports
ADD CONSTRAINT bulk_imports_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY catalog_resources
+ ADD CONSTRAINT catalog_resources_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY chat_names
ADD CONSTRAINT chat_names_pkey PRIMARY KEY (id);
@@ -26123,9 +26262,6 @@ ALTER TABLE ONLY chat_teams
ALTER TABLE vulnerability_scanners
ADD CONSTRAINT check_37608c9db5 CHECK ((char_length(vendor) <= 255)) NOT VALID;
-ALTER TABLE oauth_access_tokens
- ADD CONSTRAINT check_70f294ef54 CHECK ((expires_in IS NOT NULL)) NOT VALID;
-
ALTER TABLE sprints
ADD CONSTRAINT check_ccd8a1eae0 CHECK ((start_date IS NOT NULL)) NOT VALID;
@@ -26163,11 +26299,14 @@ ALTER TABLE ONLY ci_builds_metadata
ADD CONSTRAINT ci_builds_metadata_pkey PRIMARY KEY (id, partition_id);
ALTER TABLE ONLY ci_builds
- ADD CONSTRAINT ci_builds_pkey PRIMARY KEY (id);
+ ADD CONSTRAINT ci_builds_pkey PRIMARY KEY (id, partition_id);
ALTER TABLE ONLY ci_builds_runner_session
ADD CONSTRAINT ci_builds_runner_session_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY ci_cost_settings
+ ADD CONSTRAINT ci_cost_settings_pkey PRIMARY KEY (runner_id);
+
ALTER TABLE ONLY ci_daily_build_group_report_results
ADD CONSTRAINT ci_daily_build_group_report_results_pkey PRIMARY KEY (id);
@@ -26375,9 +26514,15 @@ ALTER TABLE ONLY compliance_management_frameworks
ALTER TABLE ONLY container_expiration_policies
ADD CONSTRAINT container_expiration_policies_pkey PRIMARY KEY (project_id);
+ALTER TABLE ONLY container_registry_data_repair_details
+ ADD CONSTRAINT container_registry_data_repair_details_pkey PRIMARY KEY (project_id);
+
ALTER TABLE ONLY container_repositories
ADD CONSTRAINT container_repositories_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY container_repository_states
+ ADD CONSTRAINT container_repository_states_pkey PRIMARY KEY (container_repository_id);
+
ALTER TABLE ONLY content_blocked_states
ADD CONSTRAINT content_blocked_states_pkey PRIMARY KEY (id);
@@ -26981,6 +27126,9 @@ ALTER TABLE ONLY namespace_commit_emails
ALTER TABLE ONLY namespace_details
ADD CONSTRAINT namespace_details_pkey PRIMARY KEY (namespace_id);
+ALTER TABLE ONLY namespace_ldap_settings
+ ADD CONSTRAINT namespace_ldap_settings_pkey PRIMARY KEY (namespace_id);
+
ALTER TABLE ONLY namespace_limits
ADD CONSTRAINT namespace_limits_pkey PRIMARY KEY (namespace_id);
@@ -27053,6 +27201,9 @@ ALTER TABLE ONLY operations_strategies_user_lists
ALTER TABLE ONLY operations_user_lists
ADD CONSTRAINT operations_user_lists_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY p_ci_runner_machine_builds
+ ADD CONSTRAINT p_ci_runner_machine_builds_pkey PRIMARY KEY (partition_id, build_id);
+
ALTER TABLE ONLY packages_build_infos
ADD CONSTRAINT packages_build_infos_pkey PRIMARY KEY (id);
@@ -27485,6 +27636,9 @@ ALTER TABLE ONLY sprints
ALTER TABLE ONLY serverless_domain_cluster
ADD CONSTRAINT serverless_domain_cluster_pkey PRIMARY KEY (uuid);
+ALTER TABLE ONLY service_desk_custom_email_verifications
+ ADD CONSTRAINT service_desk_custom_email_verifications_pkey PRIMARY KEY (project_id);
+
ALTER TABLE ONLY service_desk_settings
ADD CONSTRAINT service_desk_settings_pkey PRIMARY KEY (project_id);
@@ -28721,6 +28875,8 @@ CREATE UNIQUE INDEX any_approver_project_rule_type_unique_index ON approval_proj
CREATE INDEX approval_mr_rule_index_merge_request_id ON approval_merge_request_rules USING btree (merge_request_id);
+CREATE INDEX bulk_import_export_uploads_batch_id ON bulk_import_export_uploads USING btree (batch_id);
+
CREATE UNIQUE INDEX bulk_import_trackers_uniq_relation_by_entity ON bulk_import_trackers USING btree (bulk_import_entity_id, relation);
CREATE INDEX ca_aggregations_last_consistency_check_updated_at ON analytics_cycle_analytics_aggregations USING btree (last_consistency_check_updated_at NULLS FIRST) WHERE (enabled IS TRUE);
@@ -28765,6 +28921,10 @@ CREATE INDEX finding_links_on_vulnerability_occurrence_id ON vulnerability_findi
CREATE INDEX i_batched_background_migration_job_transition_logs_on_job_id ON ONLY batched_background_migration_job_transition_logs USING btree (batched_background_migration_job_id);
+CREATE UNIQUE INDEX i_bulk_import_export_batches_id_batch_number ON bulk_import_export_batches USING btree (export_id, batch_number);
+
+CREATE UNIQUE INDEX i_bulk_import_trackers_id_batch_number ON bulk_import_batch_trackers USING btree (tracker_id, batch_number);
+
CREATE INDEX i_compliance_frameworks_on_id_and_created_at ON compliance_management_frameworks USING btree (id, created_at, pipeline_configuration_full_path);
CREATE INDEX i_dast_pre_scan_verification_steps_on_pre_scan_verification_id ON dast_pre_scan_verification_steps USING btree (dast_pre_scan_verification_id);
@@ -28781,12 +28941,18 @@ CREATE UNIQUE INDEX i_pm_package_versions_on_package_id_and_version ON pm_packag
CREATE UNIQUE INDEX i_pm_packages_purl_type_and_name ON pm_packages USING btree (purl_type, name);
+CREATE INDEX i_users_on_last_activity_for_active_human_service_migration ON users USING btree (id, last_activity_on) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = 0) OR (user_type = 4)));
+
CREATE INDEX idx_analytics_devops_adoption_segments_on_namespace_id ON analytics_devops_adoption_segments USING btree (namespace_id);
CREATE INDEX idx_analytics_devops_adoption_snapshots_finalized ON analytics_devops_adoption_snapshots USING btree (namespace_id, end_time) WHERE (recorded_at >= end_time);
+CREATE INDEX idx_approval_merge_request_rules_on_scan_result_policy_id ON approval_merge_request_rules USING btree (scan_result_policy_id);
+
CREATE INDEX idx_approval_merge_request_rules_on_sec_orchestration_config_id ON approval_merge_request_rules USING btree (security_orchestration_policy_configuration_id);
+CREATE INDEX idx_approval_project_rules_on_scan_result_policy_id ON approval_project_rules USING btree (scan_result_policy_id);
+
CREATE INDEX idx_approval_project_rules_on_sec_orchestration_config_id ON approval_project_rules USING btree (security_orchestration_policy_configuration_id);
CREATE INDEX idx_audit_events_part_on_entity_id_desc_author_id_created_at ON ONLY audit_events USING btree (entity_id, entity_type, id DESC, author_id, created_at);
@@ -28977,8 +29143,20 @@ CREATE UNIQUE INDEX idx_vulnerability_issue_links_on_vulnerability_id_and_issue_
CREATE UNIQUE INDEX idx_vulnerability_issue_links_on_vulnerability_id_and_link_type ON vulnerability_issue_links USING btree (vulnerability_id, link_type) WHERE (link_type = 2);
+CREATE INDEX idx_vulnerability_reads_project_id_scanner_id_vulnerability_id ON vulnerability_reads USING btree (project_id, scanner_id, vulnerability_id);
+
CREATE UNIQUE INDEX idx_work_item_types_on_namespace_id_and_name_null_namespace ON work_item_types USING btree (btrim(lower(name)), ((namespace_id IS NULL))) WHERE (namespace_id IS NULL);
+CREATE INDEX index_abuse_reports_on_status_and_created_at ON abuse_reports USING btree (status, created_at);
+
+CREATE INDEX index_abuse_reports_on_status_and_id ON abuse_reports USING btree (status, id);
+
+CREATE INDEX index_abuse_reports_on_status_and_updated_at ON abuse_reports USING btree (status, updated_at);
+
+CREATE INDEX index_abuse_reports_on_status_category_and_id ON abuse_reports USING btree (status, category, id);
+
+CREATE INDEX index_abuse_reports_on_status_reporter_id_and_id ON abuse_reports USING btree (status, reporter_id, id);
+
CREATE INDEX index_abuse_reports_on_user_id ON abuse_reports USING btree (user_id);
CREATE UNIQUE INDEX "index_achievements_on_namespace_id_LOWER_name" ON achievements USING btree (namespace_id, lower(name));
@@ -29001,8 +29179,6 @@ CREATE UNIQUE INDEX index_agent_project_authorizations_on_agent_id_and_project_i
CREATE INDEX index_agent_project_authorizations_on_project_id ON agent_project_authorizations USING btree (project_id);
-CREATE INDEX index_airflow_dags_on_project_id ON airflow_dags USING btree (project_id);
-
CREATE INDEX index_alert_assignees_on_alert_id ON alert_management_alert_assignees USING btree (alert_id);
CREATE UNIQUE INDEX index_alert_assignees_on_user_id_and_alert_id ON alert_management_alert_assignees USING btree (user_id, alert_id);
@@ -29253,6 +29429,8 @@ CREATE INDEX index_broadcast_messages_on_namespace_id ON broadcast_messages USIN
CREATE INDEX index_btree_namespaces_traversal_ids ON namespaces USING btree (traversal_ids);
+CREATE INDEX index_bulk_import_batch_trackers_on_tracker_id ON bulk_import_batch_trackers USING btree (tracker_id);
+
CREATE INDEX index_bulk_import_configurations_on_bulk_import_id ON bulk_import_configurations USING btree (bulk_import_id);
CREATE INDEX index_bulk_import_entities_on_bulk_import_id_and_status ON bulk_import_entities USING btree (bulk_import_id, status);
@@ -29263,6 +29441,8 @@ CREATE INDEX index_bulk_import_entities_on_parent_id ON bulk_import_entities USI
CREATE INDEX index_bulk_import_entities_on_project_id ON bulk_import_entities USING btree (project_id);
+CREATE INDEX index_bulk_import_export_batches_on_export_id ON bulk_import_export_batches USING btree (export_id);
+
CREATE INDEX index_bulk_import_export_uploads_on_export_id ON bulk_import_export_uploads USING btree (export_id);
CREATE INDEX index_bulk_import_failures_on_bulk_import_entity_id ON bulk_import_failures USING btree (bulk_import_entity_id);
@@ -29271,6 +29451,8 @@ CREATE INDEX index_bulk_import_failures_on_correlation_id_value ON bulk_import_f
CREATE INDEX index_bulk_imports_on_user_id ON bulk_imports USING btree (user_id);
+CREATE UNIQUE INDEX index_catalog_resources_on_project_id ON catalog_resources USING btree (project_id);
+
CREATE INDEX index_chat_names_on_team_id_and_chat_id ON chat_names USING btree (team_id, chat_id);
CREATE INDEX index_chat_names_on_user_id ON chat_names USING btree (user_id);
@@ -29307,10 +29489,6 @@ CREATE UNIQUE INDEX p_ci_builds_metadata_build_id_partition_id_idx ON ONLY p_ci_
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);
@@ -29327,8 +29505,6 @@ CREATE INDEX index_ci_builds_on_commit_id_and_type_and_ref ON ci_builds USING bt
CREATE INDEX index_ci_builds_on_commit_id_artifacts_expired_at_and_id ON ci_builds USING btree (commit_id, artifacts_expire_at, id) WHERE (((type)::text = 'Ci::Build'::text) AND ((retried = false) OR (retried IS NULL)) AND ((name)::text = ANY (ARRAY[('sast'::character varying)::text, ('secret_detection'::character varying)::text, ('dependency_scanning'::character varying)::text, ('container_scanning'::character varying)::text, ('dast'::character varying)::text])));
-CREATE UNIQUE INDEX index_ci_builds_on_id_partition_id_unique ON ci_builds USING btree (id, partition_id);
-
CREATE INDEX index_ci_builds_on_project_id_and_id ON ci_builds USING btree (project_id, id);
CREATE INDEX index_ci_builds_on_project_id_and_name_and_ref ON ci_builds USING btree (project_id, name, ref) WHERE (((type)::text = 'Ci::Build'::text) AND ((status)::text = 'success'::text) AND ((retried = false) OR (retried IS NULL)));
@@ -29341,8 +29517,6 @@ CREATE INDEX index_ci_builds_on_stage_id ON ci_builds USING btree (stage_id);
CREATE INDEX index_ci_builds_on_status_and_type_and_runner_id ON ci_builds USING btree (status, type, runner_id);
-CREATE UNIQUE INDEX index_ci_builds_on_token_encrypted ON ci_builds USING btree (token_encrypted) WHERE (token_encrypted IS NOT NULL);
-
CREATE INDEX index_ci_builds_on_updated_at ON ci_builds USING btree (updated_at);
CREATE INDEX index_ci_builds_on_upstream_pipeline_id ON ci_builds USING btree (upstream_pipeline_id) WHERE (upstream_pipeline_id IS NOT NULL);
@@ -29375,6 +29549,8 @@ CREATE UNIQUE INDEX index_ci_instance_variables_on_key ON ci_instance_variables
CREATE INDEX index_ci_job_artifact_states_on_job_artifact_id ON ci_job_artifact_states USING btree (job_artifact_id);
+CREATE INDEX index_ci_job_artifacts_expire_at_unlocked_non_trace ON ci_job_artifacts USING btree (expire_at) WHERE ((locked = 0) AND (file_type <> 3) AND (expire_at IS NOT NULL));
+
CREATE INDEX index_ci_job_artifacts_for_terraform_reports ON ci_job_artifacts USING btree (project_id, id) WHERE (file_type = 18);
CREATE INDEX index_ci_job_artifacts_id_for_terraform_reports ON ci_job_artifacts USING btree (id) WHERE (file_type = 18);
@@ -29529,6 +29705,8 @@ CREATE INDEX index_ci_resources_on_partition_id_build_id ON ci_resources USING b
CREATE UNIQUE INDEX index_ci_resources_on_resource_group_id_and_build_id ON ci_resources USING btree (resource_group_id, build_id);
+CREATE INDEX index_ci_runner_machine_builds_on_runner_machine_id ON ONLY p_ci_runner_machine_builds USING btree (runner_machine_id);
+
CREATE INDEX index_ci_runner_machines_on_contacted_at_desc_and_id_desc ON ci_runner_machines USING btree (contacted_at DESC, id DESC);
CREATE INDEX index_ci_runner_machines_on_created_at_and_id_desc ON ci_runner_machines USING btree (created_at, id DESC);
@@ -29739,6 +29917,14 @@ CREATE INDEX index_container_repositories_on_status_and_id ON container_reposito
CREATE INDEX index_container_repository_on_name_trigram ON container_repositories USING gin (name gin_trgm_ops);
+CREATE INDEX index_container_repository_states_failed_verification ON container_repository_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);
+
+CREATE INDEX index_container_repository_states_needs_verification ON container_repository_states USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));
+
+CREATE INDEX index_container_repository_states_on_verification_state ON container_repository_states USING btree (verification_state);
+
+CREATE INDEX index_container_repository_states_pending_verification ON container_repository_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);
+
CREATE UNIQUE INDEX index_content_blocked_states_on_container_id_commit_sha_path ON content_blocked_states USING btree (container_identifier, commit_sha, path);
CREATE UNIQUE INDEX index_coverage_fuzzing_corpuses_on_package_id ON coverage_fuzzing_corpuses USING btree (package_id);
@@ -30537,6 +30723,8 @@ CREATE INDEX index_lfs_object_states_on_verification_state ON lfs_object_states
CREATE INDEX index_lfs_object_states_pending_verification ON lfs_object_states USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);
+CREATE INDEX index_lfs_objects_on_file ON lfs_objects USING btree (file);
+
CREATE INDEX index_lfs_objects_on_file_store ON lfs_objects USING btree (file_store);
CREATE UNIQUE INDEX index_lfs_objects_on_oid ON lfs_objects USING btree (oid);
@@ -30635,6 +30823,8 @@ CREATE INDEX index_merge_request_diff_details_pending_verification ON merge_requ
CREATE INDEX index_merge_request_diffs_by_id_partial ON merge_request_diffs USING btree (id) WHERE ((files_count > 0) AND ((NOT stored_externally) OR (stored_externally IS NULL)));
+CREATE INDEX index_merge_request_diffs_on_external_diff ON merge_request_diffs USING btree (external_diff);
+
CREATE INDEX index_merge_request_diffs_on_external_diff_store ON merge_request_diffs USING btree (external_diff_store);
CREATE INDEX index_merge_request_diffs_on_merge_request_id_and_id ON merge_request_diffs USING btree (merge_request_id, id);
@@ -30661,6 +30851,8 @@ CREATE UNIQUE INDEX index_merge_request_reviewers_on_merge_request_id_and_user_i
CREATE INDEX index_merge_request_reviewers_on_user_id ON merge_request_reviewers USING btree (user_id);
+CREATE UNIQUE INDEX index_merge_request_user_mentions_note_id_convert_to_bigint ON merge_request_user_mentions USING btree (note_id_convert_to_bigint) WHERE (note_id_convert_to_bigint IS NOT NULL);
+
CREATE UNIQUE INDEX index_merge_request_user_mentions_on_note_id ON merge_request_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL);
CREATE INDEX index_merge_requests_closing_issues_on_issue_id ON merge_requests_closing_issues USING btree (issue_id);
@@ -30853,12 +31045,16 @@ CREATE INDEX index_namespaces_on_type_and_id ON namespaces USING btree (type, id
CREATE INDEX index_namespaces_on_type_and_visibility_and_parent_id ON namespaces USING btree (id) WHERE (((type)::text = 'Group'::text) AND (parent_id IS NULL) AND (visibility_level <> 20));
+CREATE INDEX index_namespaces_on_updated_at ON namespaces USING btree (updated_at);
+
CREATE INDEX index_namespaces_public_groups_name_id ON namespaces USING btree (name, id) WHERE (((type)::text = 'Group'::text) AND (visibility_level = 20));
CREATE INDEX index_namespaces_storage_limit_exclusions_on_namespace_id ON namespaces_storage_limit_exclusions USING btree (namespace_id);
CREATE INDEX index_namespaces_sync_events_on_namespace_id ON namespaces_sync_events USING btree (namespace_id);
+CREATE INDEX index_next_over_limit_check_at_asc_order ON namespace_details USING btree (next_over_limit_check_at NULLS FIRST);
+
CREATE INDEX index_non_requested_project_members_on_source_id_and_type ON members USING btree (source_id, source_type) WHERE ((requested_at IS NULL) AND ((type)::text = 'ProjectMember'::text));
CREATE UNIQUE INDEX index_note_diff_files_on_diff_note_id ON note_diff_files USING btree (diff_note_id);
@@ -30891,8 +31087,12 @@ CREATE INDEX index_notification_settings_on_source_and_level_and_user ON notific
CREATE UNIQUE INDEX index_notifications_on_user_id_and_source_id_and_source_type ON notification_settings USING btree (user_id, source_id, source_type);
+CREATE INDEX index_ns_root_stor_stats_on_registry_size_estimated ON namespace_root_storage_statistics USING btree (registry_size_estimated);
+
CREATE UNIQUE INDEX index_ns_user_callouts_feature ON user_namespace_callouts USING btree (user_id, feature_name, namespace_id);
+CREATE INDEX index_oauth_access_grants_on_application_id ON oauth_access_grants USING btree (application_id);
+
CREATE INDEX index_oauth_access_grants_on_resource_owner_id ON oauth_access_grants USING btree (resource_owner_id, application_id, created_at);
CREATE UNIQUE INDEX index_oauth_access_grants_on_token ON oauth_access_grants USING btree (token);
@@ -30995,6 +31195,8 @@ CREATE UNIQUE INDEX index_ops_strategies_user_lists_on_strategy_id_and_user_list
CREATE UNIQUE INDEX index_organizations_on_unique_name_per_group ON customer_relations_organizations USING btree (group_id, lower(name), id);
+CREATE INDEX index_p_ci_runner_machine_builds_on_runner_machine_id ON ONLY p_ci_runner_machine_builds USING btree (runner_machine_id);
+
CREATE INDEX index_packages_build_infos_on_pipeline_id ON packages_build_infos USING btree (pipeline_id);
CREATE INDEX index_packages_build_infos_package_id_pipeline_id_id ON packages_build_infos USING btree (package_id, pipeline_id, id);
@@ -31045,6 +31247,8 @@ CREATE INDEX index_packages_package_file_build_infos_on_package_file_id ON packa
CREATE INDEX index_packages_package_file_build_infos_on_pipeline_id ON packages_package_file_build_infos USING btree (pipeline_id);
+CREATE INDEX index_packages_package_files_on_file_name ON packages_package_files USING gin (file_name gin_trgm_ops);
+
CREATE INDEX index_packages_package_files_on_file_store ON packages_package_files USING btree (file_store);
CREATE INDEX index_packages_package_files_on_id_for_cleanup ON packages_package_files USING btree (id) WHERE (status = 1);
@@ -31165,8 +31369,6 @@ CREATE INDEX index_pool_repositories_on_shard_id ON pool_repositories USING btre
CREATE UNIQUE INDEX index_pool_repositories_on_source_project_id_and_shard_id ON pool_repositories USING btree (source_project_id, shard_id);
-CREATE UNIQUE INDEX index_postgres_async_foreign_key_validations_on_name ON postgres_async_foreign_key_validations USING btree (name);
-
CREATE UNIQUE INDEX index_postgres_async_indexes_on_name ON postgres_async_indexes USING btree (name);
CREATE INDEX index_postgres_reindex_actions_on_index_identifier ON postgres_reindex_actions USING btree (index_identifier);
@@ -31611,6 +31813,8 @@ CREATE INDEX index_sbom_occurrences_on_pipeline_id ON sbom_occurrences USING btr
CREATE INDEX index_sbom_occurrences_on_project_id ON sbom_occurrences USING btree (project_id);
+CREATE INDEX index_sbom_occurrences_on_project_id_and_id ON sbom_occurrences USING btree (project_id, id);
+
CREATE INDEX index_sbom_occurrences_on_source_id ON sbom_occurrences USING btree (source_id);
CREATE UNIQUE INDEX index_sbom_occurrences_on_uuid ON sbom_occurrences USING btree (uuid);
@@ -31667,6 +31871,8 @@ CREATE INDEX index_serverless_domain_cluster_on_creator_id ON serverless_domain_
CREATE INDEX index_serverless_domain_cluster_on_pages_domain_id ON serverless_domain_cluster USING btree (pages_domain_id);
+CREATE INDEX index_service_desk_custom_email_verifications_on_triggerer_id ON service_desk_custom_email_verifications USING btree (triggerer_id);
+
CREATE INDEX index_service_desk_enabled_projects_on_id_creator_id_created_at ON projects USING btree (id, creator_id, created_at) WHERE (service_desk_enabled = true);
CREATE INDEX index_service_desk_settings_on_file_template_project_id ON service_desk_settings USING btree (file_template_project_id);
@@ -31955,6 +32161,10 @@ COMMENT ON INDEX index_user_details_on_phone IS 'JiHu-specific index';
CREATE UNIQUE INDEX index_user_details_on_user_id ON user_details USING btree (user_id);
+CREATE INDEX index_user_details_on_user_id_for_enterprise_users_with_date ON user_details USING btree (user_id) WHERE ((provisioned_by_group_id IS NOT NULL) AND (provisioned_by_group_at IS NOT NULL));
+
+CREATE INDEX index_user_details_on_user_id_for_enterprise_users_without_date ON user_details USING btree (user_id) WHERE ((provisioned_by_group_id IS NOT NULL) AND (provisioned_by_group_at IS NULL));
+
CREATE INDEX index_user_group_callouts_on_group_id ON user_group_callouts USING btree (group_id);
CREATE INDEX index_user_highest_roles_on_user_id_and_highest_access_level ON user_highest_roles USING btree (user_id, highest_access_level);
@@ -31979,7 +32189,7 @@ CREATE INDEX index_user_statuses_on_user_id ON user_statuses USING btree (user_i
CREATE UNIQUE INDEX index_user_synced_attributes_metadata_on_user_id ON user_synced_attributes_metadata USING btree (user_id);
-CREATE INDEX index_users_for_billable_users ON users USING btree (id) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[6, 4]))) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[4, 5]))));
+CREATE INDEX index_users_for_active_billable_users ON users USING btree (id) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[6, 4, 13]))) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[4, 5]))));
CREATE INDEX index_users_on_accepted_term_id ON users USING btree (accepted_term_id);
@@ -32023,6 +32233,8 @@ CREATE INDEX index_users_on_unconfirmed_email ON users USING btree (unconfirmed_
CREATE UNIQUE INDEX index_users_on_unlock_token ON users USING btree (unlock_token);
+CREATE INDEX index_users_on_updated_at ON users USING btree (updated_at);
+
CREATE INDEX index_users_on_user_type_and_id ON users USING btree (user_type, id);
CREATE INDEX index_users_on_username ON users USING btree (username);
@@ -32187,6 +32399,8 @@ CREATE INDEX index_vulnerability_state_transitions_id_and_vulnerability_id ON vu
CREATE INDEX index_vulnerability_state_transitions_on_author_id ON vulnerability_state_transitions USING btree (author_id);
+CREATE INDEX index_vulnerability_state_transitions_on_pipeline_id ON vulnerability_state_transitions USING btree (state_changed_at_pipeline_id);
+
CREATE INDEX index_vulnerability_statistics_on_latest_pipeline_id ON vulnerability_statistics USING btree (latest_pipeline_id);
CREATE INDEX index_vulnerability_statistics_on_letter_grade ON vulnerability_statistics USING btree (letter_grade);
@@ -32203,6 +32417,8 @@ CREATE UNIQUE INDEX index_vulns_user_mentions_on_vulnerability_id ON vulnerabili
CREATE UNIQUE INDEX index_vulns_user_mentions_on_vulnerability_id_and_note_id ON vulnerability_user_mentions USING btree (vulnerability_id, note_id);
+CREATE INDEX index_web_hook_logs_on_web_hook_id_and_created_at ON ONLY web_hook_logs USING btree (web_hook_id, created_at);
+
CREATE INDEX index_web_hook_logs_part_on_created_at_and_web_hook_id ON ONLY web_hook_logs USING btree (created_at, web_hook_id);
CREATE INDEX index_web_hook_logs_part_on_web_hook_id ON ONLY web_hook_logs USING btree (web_hook_id);
@@ -32303,6 +32519,8 @@ CREATE UNIQUE INDEX merge_request_user_mentions_on_mr_id_index ON merge_request_
CREATE INDEX merge_requests_state_id_temp_index ON merge_requests USING btree (id) WHERE (state_id = ANY (ARRAY[2, 3]));
+CREATE INDEX migrate_index_users_for_active_billable_users ON users USING btree (id) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = 0) OR (user_type = ANY (ARRAY[0, 6, 4, 13]))) AND ((user_type IS NULL) OR (user_type = 0) OR (user_type = ANY (ARRAY[0, 4, 5]))));
+
CREATE INDEX note_mentions_temp_index ON notes USING btree (id, noteable_type) WHERE (note ~~ '%@%'::text);
CREATE UNIQUE INDEX one_canonical_wiki_page_slug_per_metadata ON wiki_page_slugs USING btree (wiki_page_meta_id) WHERE (canonical = true);
@@ -32385,6 +32603,8 @@ CREATE INDEX tmp_index_for_null_member_namespace_id ON members USING btree (memb
CREATE INDEX tmp_index_for_project_namespace_id_migration_on_routes ON routes USING btree (id) WHERE ((namespace_id IS NULL) AND ((source_type)::text = 'Project'::text));
+CREATE INDEX tmp_index_for_software_licenses_spdx_identifier_cleanup ON software_licenses USING btree (spdx_identifier) WHERE (spdx_identifier 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));
@@ -32421,6 +32641,8 @@ CREATE UNIQUE INDEX unique_index_for_project_pages_unique_domain ON project_sett
CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id);
+CREATE UNIQUE INDEX unique_postgres_async_fk_validations_name_and_table_name ON postgres_async_foreign_key_validations USING btree (name, table_name);
+
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);
@@ -33725,8 +33947,6 @@ ALTER INDEX p_ci_builds_metadata_build_id_id_idx ATTACH PARTITION index_ci_build
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();
@@ -33735,6 +33955,8 @@ CREATE TRIGGER ci_builds_loose_fk_trigger AFTER DELETE ON ci_builds REFERENCING
CREATE TRIGGER ci_pipelines_loose_fk_trigger AFTER DELETE ON ci_pipelines REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();
+CREATE TRIGGER ci_runner_machines_loose_fk_trigger AFTER DELETE ON ci_runner_machines REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();
+
CREATE TRIGGER ci_runners_loose_fk_trigger AFTER DELETE ON ci_runners REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();
CREATE TRIGGER clusters_loose_fk_trigger AFTER DELETE ON clusters REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();
@@ -33843,6 +34065,9 @@ ALTER TABLE ONLY service_desk_settings
ALTER TABLE ONLY design_management_designs_versions
ADD CONSTRAINT fk_03c671965c FOREIGN KEY (design_id) REFERENCES design_management_designs(id) ON DELETE CASCADE;
+ALTER TABLE ONLY projects
+ ADD CONSTRAINT fk_03ec10b0d3 FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL NOT VALID;
+
ALTER TABLE ONLY analytics_dashboards_pointers
ADD CONSTRAINT fk_05d96922bd FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -34062,6 +34287,9 @@ ALTER TABLE ONLY zoekt_indexed_namespaces
ALTER TABLE ONLY epics
ADD CONSTRAINT fk_3c1fd1cccc FOREIGN KEY (due_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL;
+ALTER TABLE ONLY bulk_import_export_uploads
+ ADD CONSTRAINT fk_3cbf0b9a2e FOREIGN KEY (batch_id) REFERENCES bulk_import_export_batches(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY ci_pipelines
ADD CONSTRAINT fk_3d34ab2e06 FOREIGN KEY (pipeline_schedule_id) REFERENCES ci_pipeline_schedules(id) ON DELETE SET NULL;
@@ -34503,6 +34731,9 @@ ALTER TABLE ONLY deployments
ALTER TABLE ONLY routes
ADD CONSTRAINT fk_bb2e5b8968 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+ALTER TABLE p_ci_runner_machine_builds
+ ADD CONSTRAINT fk_bb490f12fe_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
+
ALTER TABLE ONLY namespace_bans
ADD CONSTRAINT fk_bcc024eef2 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -34519,10 +34750,7 @@ ALTER TABLE ONLY snippets
ADD CONSTRAINT fk_be41fd4bb7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_sources_pipelines
- ADD CONSTRAINT fk_be5624bf37 FOREIGN KEY (source_job_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
-
-ALTER TABLE ONLY ci_sources_pipelines
- ADD CONSTRAINT fk_be5624bf37_p FOREIGN KEY (source_partition_id, source_job_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
+ ADD CONSTRAINT fk_be5624bf37_p FOREIGN KEY (source_partition_id, source_job_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY packages_maven_metadata
ADD CONSTRAINT fk_be88aed360 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;
@@ -34678,7 +34906,7 @@ ALTER TABLE ONLY ci_sources_pipelines
ADD CONSTRAINT fk_e1bad85861 FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
ALTER TABLE p_ci_builds_metadata
- ADD CONSTRAINT fk_e20479742e FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
+ ADD CONSTRAINT fk_e20479742e_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY gitlab_subscriptions
ADD CONSTRAINT fk_e2595d00a1 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -34788,6 +35016,9 @@ ALTER TABLE ONLY issues
ALTER TABLE ONLY geo_event_log
ADD CONSTRAINT fk_geo_event_log_on_geo_event_id FOREIGN KEY (geo_event_id) REFERENCES geo_events(id) ON DELETE CASCADE;
+ALTER TABLE ONLY merge_request_user_mentions
+ ADD CONSTRAINT fk_merge_request_user_mentions_note_id_convert_to_bigint FOREIGN KEY (note_id_convert_to_bigint) REFERENCES notes(id) ON DELETE CASCADE NOT VALID;
+
ALTER TABLE ONLY path_locks
ADD CONSTRAINT fk_path_locks_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
@@ -34920,6 +35151,9 @@ ALTER TABLE ONLY diff_note_positions
ALTER TABLE ONLY analytics_cycle_analytics_aggregations
ADD CONSTRAINT fk_rails_13c8374c7a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+ALTER TABLE ONLY service_desk_custom_email_verifications
+ ADD CONSTRAINT fk_rails_14dcaf4c92 FOREIGN KEY (triggerer_id) REFERENCES users(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY namespaces_storage_limit_exclusions
ADD CONSTRAINT fk_rails_14e8f7b0e0 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -34927,10 +35161,10 @@ ALTER TABLE ONLY users_security_dashboard_projects
ADD CONSTRAINT fk_rails_150cd5682c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_build_report_results
- ADD CONSTRAINT fk_rails_16cb1ff064 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
+ ADD CONSTRAINT fk_rails_16cb1ff064_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
-ALTER TABLE ONLY ci_build_report_results
- ADD CONSTRAINT fk_rails_16cb1ff064_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
+ALTER TABLE ONLY catalog_resources
+ ADD CONSTRAINT fk_rails_16f09e5c44 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY project_deploy_tokens
ADD CONSTRAINT fk_rails_170e03cbaf FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -35115,6 +35349,9 @@ ALTER TABLE ONLY issuable_severities
ALTER TABLE ONLY saml_providers
ADD CONSTRAINT fk_rails_306d459be7 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+ALTER TABLE ONLY bulk_import_batch_trackers
+ ADD CONSTRAINT fk_rails_307efb9f32 FOREIGN KEY (tracker_id) REFERENCES bulk_import_trackers(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY pm_package_version_licenses
ADD CONSTRAINT fk_rails_30ddb7f837 FOREIGN KEY (pm_package_version_id) REFERENCES pm_package_versions(id) ON DELETE CASCADE;
@@ -35194,10 +35431,7 @@ ALTER TABLE ONLY chat_teams
ADD CONSTRAINT fk_rails_3b543909cb FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_build_needs
- ADD CONSTRAINT fk_rails_3cf221d4ed FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
-
-ALTER TABLE ONLY ci_build_needs
- ADD CONSTRAINT fk_rails_3cf221d4ed_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
+ ADD CONSTRAINT fk_rails_3cf221d4ed_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY cluster_groups
ADD CONSTRAINT fk_rails_3d28377556 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -35454,6 +35688,9 @@ ALTER TABLE ONLY sbom_component_versions
ALTER TABLE ONLY status_page_published_incidents
ADD CONSTRAINT fk_rails_61e5493940 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
+ALTER TABLE ONLY container_repository_states
+ ADD CONSTRAINT fk_rails_63436c99ce FOREIGN KEY (container_repository_id) REFERENCES container_repositories(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY deployment_clusters
ADD CONSTRAINT fk_rails_6359a164df FOREIGN KEY (deployment_id) REFERENCES deployments(id) ON DELETE CASCADE;
@@ -35523,6 +35760,9 @@ ALTER TABLE ONLY geo_hashed_storage_migrated_events
ALTER TABLE ONLY plan_limits
ADD CONSTRAINT fk_rails_69f8b6184f FOREIGN KEY (plan_id) REFERENCES plans(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_cost_settings
+ ADD CONSTRAINT fk_rails_6a70651f75 FOREIGN KEY (runner_id) REFERENCES ci_runners(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY operations_feature_flags_issues
ADD CONSTRAINT fk_rails_6a8856ca4f FOREIGN KEY (feature_flag_id) REFERENCES operations_feature_flags(id) ON DELETE CASCADE;
@@ -35560,9 +35800,6 @@ ALTER TABLE ONLY project_custom_attributes
ADD CONSTRAINT fk_rails_719c3dccc5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_pending_builds
- ADD CONSTRAINT fk_rails_725a2644a3 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
-
-ALTER TABLE ONLY ci_pending_builds
ADD CONSTRAINT fk_rails_725a2644a3_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE security_findings
@@ -35661,6 +35898,9 @@ ALTER TABLE ONLY approval_merge_request_rules_users
ALTER TABLE ONLY required_code_owners_sections
ADD CONSTRAINT fk_rails_817708cf2d FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;
+ALTER TABLE ONLY namespace_ldap_settings
+ ADD CONSTRAINT fk_rails_82cd0ad4bb FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY cluster_enabled_grants
ADD CONSTRAINT fk_rails_8336ce35af FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -35965,10 +36205,7 @@ ALTER TABLE ONLY metrics_dashboard_annotations
ADD CONSTRAINT fk_rails_aeb11a7643 FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_build_trace_metadata
- ADD CONSTRAINT fk_rails_aebc78111f FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
-
-ALTER TABLE ONLY ci_build_trace_metadata
- ADD CONSTRAINT fk_rails_aebc78111f_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
+ ADD CONSTRAINT fk_rails_aebc78111f_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY bulk_import_trackers
ADD CONSTRAINT fk_rails_aed566d3f3 FOREIGN KEY (bulk_import_entity_id) REFERENCES bulk_import_entities(id) ON DELETE CASCADE;
@@ -36015,6 +36252,9 @@ ALTER TABLE ONLY packages_debian_project_component_files
ALTER TABLE ONLY namespace_aggregation_schedules
ADD CONSTRAINT fk_rails_b565c8d16c FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+ALTER TABLE ONLY container_registry_data_repair_details
+ ADD CONSTRAINT fk_rails_b70d8111d9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE batched_background_migration_job_transition_logs
ADD CONSTRAINT fk_rails_b7523a175b FOREIGN KEY (batched_background_migration_job_id) REFERENCES batched_background_migration_jobs(id) ON DELETE CASCADE;
@@ -36057,6 +36297,9 @@ ALTER TABLE ONLY elasticsearch_indexed_namespaces
ALTER TABLE ONLY vulnerability_occurrence_identifiers
ADD CONSTRAINT fk_rails_be2e49e1d0 FOREIGN KEY (identifier_id) REFERENCES vulnerability_identifiers(id) ON DELETE CASCADE;
+ALTER TABLE ONLY bulk_import_export_batches
+ ADD CONSTRAINT fk_rails_be479792f6 FOREIGN KEY (export_id) REFERENCES bulk_import_exports(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY alert_management_http_integrations
ADD CONSTRAINT fk_rails_bec49f52cc FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -36118,10 +36361,7 @@ ALTER TABLE ONLY boards_epic_board_recent_visits
ADD CONSTRAINT fk_rails_c4dcba4a3e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_job_artifacts
- ADD CONSTRAINT fk_rails_c5137cb2c1 FOREIGN KEY (job_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
-
-ALTER TABLE ONLY ci_job_artifacts
- ADD CONSTRAINT fk_rails_c5137cb2c1_p FOREIGN KEY (partition_id, job_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
+ ADD CONSTRAINT fk_rails_c5137cb2c1_p FOREIGN KEY (partition_id, job_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY packages_events
ADD CONSTRAINT fk_rails_c6c20d0094 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE SET NULL;
@@ -36156,9 +36396,6 @@ ALTER TABLE ONLY gpg_signatures
ALTER TABLE ONLY board_group_recent_visits
ADD CONSTRAINT fk_rails_ca04c38720 FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE;
-ALTER TABLE ONLY airflow_dags
- ADD CONSTRAINT fk_rails_ca3ac0d68c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY boards_epic_board_positions
ADD CONSTRAINT fk_rails_cb4563dd6e FOREIGN KEY (epic_board_id) REFERENCES boards_epic_boards(id) ON DELETE CASCADE;
@@ -36235,9 +36472,6 @@ ALTER TABLE ONLY merge_request_reviewers
ADD CONSTRAINT fk_rails_d9fec24b9d FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_running_builds
- ADD CONSTRAINT fk_rails_da45cfa165 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
-
-ALTER TABLE ONLY ci_running_builds
ADD CONSTRAINT fk_rails_da45cfa165_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY jira_imports
@@ -36276,6 +36510,9 @@ ALTER TABLE ONLY dast_scanner_profiles_tags
ALTER TABLE ONLY vulnerability_feedback
ADD CONSTRAINT fk_rails_debd54e456 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY service_desk_custom_email_verifications
+ ADD CONSTRAINT fk_rails_debe4c4acc FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY packages_debian_project_distributions
ADD CONSTRAINT fk_rails_df44271a30 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE RESTRICT;
@@ -36474,9 +36711,6 @@ ALTER TABLE ONLY merge_requests_closing_issues
ALTER TABLE ONLY banned_users
ADD CONSTRAINT fk_rails_fa5bb598e5 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
-ALTER TABLE p_ci_builds_metadata
- ADD CONSTRAINT fk_rails_fae01b2700 FOREIGN KEY (runner_machine_id) REFERENCES ci_runner_machines(id) ON DELETE SET NULL;
-
ALTER TABLE ONLY operations_feature_flags_issues
ADD CONSTRAINT fk_rails_fb4d2a7cb1 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
@@ -36487,10 +36721,7 @@ ALTER TABLE ONLY serverless_domain_cluster
ADD CONSTRAINT fk_rails_fbdba67eb1 FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL;
ALTER TABLE ONLY ci_job_variables
- ADD CONSTRAINT fk_rails_fbf3b34792 FOREIGN KEY (job_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
-
-ALTER TABLE ONLY ci_job_variables
- ADD CONSTRAINT fk_rails_fbf3b34792_p FOREIGN KEY (partition_id, job_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
+ ADD CONSTRAINT fk_rails_fbf3b34792_p FOREIGN KEY (partition_id, job_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY packages_nuget_metadata
ADD CONSTRAINT fk_rails_fc0c19f5b4 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;