summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
commit0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch)
tree4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /db
parent744144d28e3e7fddc117924fef88de5d9674fe4c (diff)
downloadgitlab-ce-0653e08efd039a5905f3fa4f6e9cef9f5d2f799c.tar.gz
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/001_create_base_work_item_types.rb5
-rw-r--r--db/fixtures/development/31_error_tracking.rb5
-rw-r--r--db/fixtures/production/003_create_base_work_item_types.rb5
-rw-r--r--db/migrate/20201029144444_create_vulnerability_finding_links.rb4
-rw-r--r--db/migrate/20210531053916_rename_instance_statistics_measurements.rb4
-rw-r--r--db/migrate/20210621043337_rename_services_to_integrations.rb5
-rw-r--r--db/migrate/20210707113056_add_tags_array_to_ci_pending_builds.rb17
-rw-r--r--db/migrate/20210707163659_add_vulnerability_events_to_integrations.rb9
-rw-r--r--db/migrate/20210708011425_rename_ci_builds_metadata_foreign_key.rb28
-rw-r--r--db/migrate/20210729081351_create_topics.rb16
-rw-r--r--db/migrate/20210729081739_create_project_topics.rb16
-rw-r--r--db/migrate/20210729125641_add_foreign_key_to_project_on_project_topic.rb17
-rw-r--r--db/migrate/20210729125659_add_foreign_key_to_topic_on_project_topic.rb17
-rw-r--r--db/migrate/20210730194555_create_incident_management_pending_issue_escalations.rb33
-rw-r--r--db/migrate/20210807101446_add_cadence_to_dast_profile_schedules.rb7
-rw-r--r--db/migrate/20210807101621_add_timezone_to_dast_profile_schedules.rb26
-rw-r--r--db/migrate/20210807102004_add_starts_at_to_dast_profile_schedules.rb7
-rw-r--r--db/migrate/20210809014850_create_agent_group_authorizations.rb16
-rw-r--r--db/migrate/20210809014918_add_agent_group_authorizations_foreign_keys.rb22
-rw-r--r--db/migrate/20210811120204_create_customer_relations_contacts.rb31
-rw-r--r--db/migrate/20210813131313_create_foreign_key_on_contacts_group_id.rb22
-rw-r--r--db/migrate/20210816095826_add_unique_index_on_dast_profile_to_dast_profile_schedules.rb38
-rw-r--r--db/migrate/20210816192041_add_invites_email_success_to_member.rb13
-rw-r--r--db/migrate/20210817130415_add_project_id_name_version_id_to_npm_packages.rb17
-rw-r--r--db/migrate/20210817172214_add_yaml_limits_application_setting.rb10
-rw-r--r--db/migrate/20210818061156_remove_project_profile_compound_index_from_dast_profile_schedules.rb30
-rw-r--r--db/migrate/20210818115613_add_index_project_id_on_dast_profile_schedule.rb13
-rw-r--r--db/migrate/20210818175949_update_integrations_trigger_type_new_on_insert.rb79
-rw-r--r--db/migrate/20210818185548_add_tag_ids_index_to_ci_pending_build.rb17
-rw-r--r--db/migrate/20210818193008_add_file_template_project_to_service_desk_settings.rb9
-rw-r--r--db/migrate/20210818200455_add_file_template_project_foreign_key_to_service_desk_settings.rb22
-rw-r--r--db/migrate/20210818220234_add_default_project_approval_rules_vuln_allowed.rb24
-rw-r--r--db/migrate/20210819120243_add_throttle_files_api_columns.rb13
-rw-r--r--db/migrate/20210819152723_remove_tmp_index_approval_project_rules_scanners.rb17
-rw-r--r--db/migrate/20210819153805_set_default_job_token_scope_true.rb17
-rw-r--r--db/migrate/20210819162047_add_columns_to_namespace_settings.rb21
-rw-r--r--db/migrate/20210820171834_add_foreign_keys_for_pending_issue_escalations.rb22
-rw-r--r--db/migrate/20210823172643_create_user_group_callout.rb19
-rw-r--r--db/migrate/20210823213417_create_dependency_proxy_image_ttl_group_policies.rb22
-rw-r--r--db/migrate/20210824055322_add_project_namespace_id_to_project.rb21
-rw-r--r--db/migrate/20210824105038_add_timestamp_columns_to_ci_build_trace_metadata.rb8
-rw-r--r--db/migrate/20210824160459_add_notification_level_to_ci_namespace_monthly_usages.rb7
-rw-r--r--db/migrate/20210825104558_change_description_limit_error_tracking_event.rb17
-rw-r--r--db/migrate/20210825104656_create_analytics_cycle_analytics_merge_request_stage_events.rb28
-rw-r--r--db/migrate/20210825110016_create_analytics_cycle_analytics_issue_stage_events.rb28
-rw-r--r--db/migrate/20210825190458_add_user_deactivation_email_option_to_application_settings.rb10
-rw-r--r--db/migrate/20210825193448_add_iteration_cadence_id_to_issue_boards.rb9
-rw-r--r--db/migrate/20210826120834_add_locked_to_ci_job_artifacts.rb22
-rw-r--r--db/migrate/20210826122748_create_loose_foreign_keys_deleted_records.rb26
-rw-r--r--db/migrate/20210826124311_add_index_to_error_tracking_error.rb23
-rw-r--r--db/migrate/20210826145509_add_function_for_inserting_deleted_records.rb27
-rw-r--r--db/migrate/20210826170902_add_throttle_unauthenticated_api_columns.rb10
-rw-r--r--db/migrate/20210830085837_add_throttle_authenticated_git_lfs_columns.rb23
-rw-r--r--db/migrate/20210830140524_add_state_to_member.rb21
-rw-r--r--db/migrate/20210830154358_add_yaml_limit_constraints.rb25
-rw-r--r--db/migrate/20210831134840_add_package_file_id_channel_idx_to_packages_helm_file_metadata.rb17
-rw-r--r--db/migrate/20210831135249_add_installable_helm_pkgs_idx_to_packages.rb17
-rw-r--r--db/migrate/20210831203408_upsert_base_work_item_types.rb31
-rw-r--r--db/migrate/20210901065504_add_index_on_name_and_id_to_public_groups.rb17
-rw-r--r--db/migrate/20210902171406_add_latest_column_into_the_security_scans_table.rb13
-rw-r--r--db/migrate/20210902171808_set_default_job_token_scope_false.rb17
-rw-r--r--db/migrate/20210902184334_add_expire_access_tokens_to_doorkeeper_application.rb7
-rw-r--r--db/migrate/20210903054158_recreate_stage_issue_events_table_with_bigints.rb45
-rw-r--r--db/migrate/20210906100021_delete_project_namespace_trigger.rb31
-rw-r--r--db/migrate/20210907182337_add_group_id_fkey_for_user_group_callout.rb15
-rw-r--r--db/migrate/20210907182359_add_user_id_fkey_for_user_group_callout.rb15
-rw-r--r--db/migrate/20210908060951_add_dast_schedules_to_plan_limits.rb7
-rw-r--r--db/migrate/20210908061132_insert_dast_profile_schedules_plan_limits.rb27
-rw-r--r--db/migrate/20210908100810_add_jobs_per_stage_page_size_to_application_settings.rb7
-rw-r--r--db/migrate/20210908140437_add_sidekiq_limits_to_application_settings.rb21
-rw-r--r--db/migrate/20210908185736_add_status_to_dependency_proxy_manifests.rb7
-rw-r--r--db/migrate/20210908185754_add_status_to_dependency_proxy_blobs.rb7
-rw-r--r--db/migrate/20210909184349_add_index_package_id_id_on_package_files.rb17
-rw-r--r--db/migrate/20210910141043_change_ci_minutes_additional_pack_text_limit.rb15
-rw-r--r--db/migrate/20210913010411_create_agent_project_authorizations.rb14
-rw-r--r--db/migrate/20210913010432_add_agent_project_authorizations_foreign_keys.rb20
-rw-r--r--db/migrate/20210913122457_add_namespace_traversal_ids_to_ci_pending_builds.rb9
-rw-r--r--db/post_migrate/20201106134950_deduplicate_epic_iids.rb2
-rw-r--r--db/post_migrate/20210622045705_finalize_events_bigint_conversion.rb86
-rw-r--r--db/post_migrate/20210701141346_finalize_ci_builds_stage_id_bigint_conversion.rb65
-rw-r--r--db/post_migrate/20210706112800_remove_cloud_license_enabled_from_application_settings.rb19
-rw-r--r--db/post_migrate/20210708011426_finalize_ci_builds_metadata_bigint_conversion.rb113
-rw-r--r--db/post_migrate/20210721122840_remove_seat_link_enabled_from_application_settings.rb11
-rw-r--r--db/post_migrate/20210730104800_schedule_extract_project_topics_into_separate_table.rb37
-rw-r--r--db/post_migrate/20210731132939_backfill_stage_event_hash.rb115
-rw-r--r--db/post_migrate/20210806131706_finalize_taggins_bigint_conversion.rb88
-rw-r--r--db/post_migrate/20210813151908_replace_external_wiki_triggers.rb66
-rw-r--r--db/post_migrate/20210817024335_prepare_indexes_for_events_bigint_conversion.rb24
-rw-r--r--db/post_migrate/20210818185845_backfill_projects_with_coverage.rb32
-rw-r--r--db/post_migrate/20210819145000_drop_temporary_columns_and_triggers_for_ci_builds_runner_session.rb28
-rw-r--r--db/post_migrate/20210823113259_steal_merge_request_diff_commit_users_migration.rb28
-rw-r--r--db/post_migrate/20210823132600_remove_duplicate_dast_site_tokens.rb33
-rw-r--r--db/post_migrate/20210823142036_drop_temporary_trigger_for_ci_job_artifacts.rb30
-rw-r--r--db/post_migrate/20210823193234_remove_allow_editing_commit_messages_from_project_settings.rb19
-rw-r--r--db/post_migrate/20210824102624_add_project_namespace_index_to_project.rb17
-rw-r--r--db/post_migrate/20210824102750_add_project_namespace_foreign_key_to_project.rb19
-rw-r--r--db/post_migrate/20210824174615_prepare_ci_builds_metadata_and_ci_build_async_indexes.rb55
-rw-r--r--db/post_migrate/20210825150212_cleanup_remaining_orphan_invites.rb27
-rw-r--r--db/post_migrate/20210825182303_remove_duplicate_dast_site_tokens_with_same_token.rb23
-rw-r--r--db/post_migrate/20210825193548_add_fk_to_iteration_cadence_id_on_boards.rb19
-rw-r--r--db/post_migrate/20210825193652_backfill_cadence_id_for_boards_scoped_to_iteration.rb49
-rw-r--r--db/post_migrate/20210826110839_prepare_indexes_for_ci_job_artifacts_expire_at_unlocked.rb16
-rw-r--r--db/post_migrate/20210826171758_initialize_throttle_unauthenticated_api_columns.rb23
-rw-r--r--db/post_migrate/20210826193907_add_unique_index_dast_site_token_project_id_and_url.rb19
-rw-r--r--db/post_migrate/20210830104800_reschedule_extract_project_topics_into_separate_table.rb18
-rw-r--r--db/post_migrate/20210831123008_drop_temporary_trigger_for_ci_sources_pipelines.rb28
-rw-r--r--db/post_migrate/20210901044202_push_event_payloads_bigint_conversion_remove_triggers.rb28
-rw-r--r--db/post_migrate/20210901044237_events_bigint_conversion_remove_triggers.rb26
-rw-r--r--db/post_migrate/20210901153324_slice_merge_request_diff_commit_migrations.rb59
-rw-r--r--db/post_migrate/20210901184511_prepare_async_indexes_for_ci_builds.rb80
-rw-r--r--db/post_migrate/20210902144144_drop_temporary_columns_and_triggers_for_ci_build_needs.rb26
-rw-r--r--db/post_migrate/20210906100316_drop_temporary_columns_and_triggers_for_ci_build_trace_chunks.rb20
-rw-r--r--db/post_migrate/20210907021940_cleanup_bigint_conversion_for_ci_stages.rb19
-rw-r--r--db/post_migrate/20210907033745_cleanup_bigint_conversion_for_deployments.rb19
-rw-r--r--db/post_migrate/20210907041000_cleanup_bigint_conversion_for_geo_job_artifact_deleted_events.rb19
-rw-r--r--db/post_migrate/20210907211557_finalize_ci_builds_bigint_conversion.rb222
-rw-r--r--db/post_migrate/20210908132335_disable_job_token_scope_when_unused.rb52
-rw-r--r--db/post_migrate/20210909104800_reschedule_extract_project_topics_into_separate_table_2.rb16
-rw-r--r--db/post_migrate/20210909152027_remove_container_registry_enabled.rb17
-rw-r--r--db/post_migrate/20210914094840_add_gin_index_on_pending_builds_namespace_traversal_ids.rb15
-rw-r--r--db/post_migrate/20210915202900_prepare_index_resource_group_status_commit_id_for_ci_builds.rb15
-rw-r--r--db/schema_migrations/202106220457051
-rw-r--r--db/schema_migrations/202107011413461
-rw-r--r--db/schema_migrations/202107061128001
-rw-r--r--db/schema_migrations/202107071130561
-rw-r--r--db/schema_migrations/202107071636591
-rw-r--r--db/schema_migrations/202107080114251
-rw-r--r--db/schema_migrations/202107080114261
-rw-r--r--db/schema_migrations/202107211228401
-rw-r--r--db/schema_migrations/202107290813511
-rw-r--r--db/schema_migrations/202107290817391
-rw-r--r--db/schema_migrations/202107291256411
-rw-r--r--db/schema_migrations/202107291256591
-rw-r--r--db/schema_migrations/202107301048001
-rw-r--r--db/schema_migrations/202107301945551
-rw-r--r--db/schema_migrations/202107311329391
-rw-r--r--db/schema_migrations/202108061317061
-rw-r--r--db/schema_migrations/202108071014461
-rw-r--r--db/schema_migrations/202108071016211
-rw-r--r--db/schema_migrations/202108071020041
-rw-r--r--db/schema_migrations/202108090148501
-rw-r--r--db/schema_migrations/202108090149181
-rw-r--r--db/schema_migrations/202108111202041
-rw-r--r--db/schema_migrations/202108131313131
-rw-r--r--db/schema_migrations/202108131519081
-rw-r--r--db/schema_migrations/202108160958261
-rw-r--r--db/schema_migrations/202108161920411
-rw-r--r--db/schema_migrations/202108170243351
-rw-r--r--db/schema_migrations/202108171304151
-rw-r--r--db/schema_migrations/202108171722141
-rw-r--r--db/schema_migrations/202108180611561
-rw-r--r--db/schema_migrations/202108181156131
-rw-r--r--db/schema_migrations/202108181759491
-rw-r--r--db/schema_migrations/202108181855481
-rw-r--r--db/schema_migrations/202108181858451
-rw-r--r--db/schema_migrations/202108181930081
-rw-r--r--db/schema_migrations/202108182004551
-rw-r--r--db/schema_migrations/202108182202341
-rw-r--r--db/schema_migrations/202108191202431
-rw-r--r--db/schema_migrations/202108191450001
-rw-r--r--db/schema_migrations/202108191527231
-rw-r--r--db/schema_migrations/202108191538051
-rw-r--r--db/schema_migrations/202108191620471
-rw-r--r--db/schema_migrations/202108201718341
-rw-r--r--db/schema_migrations/202108231132591
-rw-r--r--db/schema_migrations/202108231326001
-rw-r--r--db/schema_migrations/202108231420361
-rw-r--r--db/schema_migrations/202108231726431
-rw-r--r--db/schema_migrations/202108231932341
-rw-r--r--db/schema_migrations/202108232134171
-rw-r--r--db/schema_migrations/202108240553221
-rw-r--r--db/schema_migrations/202108241026241
-rw-r--r--db/schema_migrations/202108241027501
-rw-r--r--db/schema_migrations/202108241050381
-rw-r--r--db/schema_migrations/202108241604591
-rw-r--r--db/schema_migrations/202108241746151
-rw-r--r--db/schema_migrations/202108251045581
-rw-r--r--db/schema_migrations/202108251046561
-rw-r--r--db/schema_migrations/202108251100161
-rw-r--r--db/schema_migrations/202108251502121
-rw-r--r--db/schema_migrations/202108251823031
-rw-r--r--db/schema_migrations/202108251904581
-rw-r--r--db/schema_migrations/202108251934481
-rw-r--r--db/schema_migrations/202108251935481
-rw-r--r--db/schema_migrations/202108251936521
-rw-r--r--db/schema_migrations/202108261108391
-rw-r--r--db/schema_migrations/202108261208341
-rw-r--r--db/schema_migrations/202108261227481
-rw-r--r--db/schema_migrations/202108261243111
-rw-r--r--db/schema_migrations/202108261455091
-rw-r--r--db/schema_migrations/202108261709021
-rw-r--r--db/schema_migrations/202108261717581
-rw-r--r--db/schema_migrations/202108261939071
-rw-r--r--db/schema_migrations/202108300858371
-rw-r--r--db/schema_migrations/202108301048001
-rw-r--r--db/schema_migrations/202108301405241
-rw-r--r--db/schema_migrations/202108301543581
-rw-r--r--db/schema_migrations/202108311230081
-rw-r--r--db/schema_migrations/202108311348401
-rw-r--r--db/schema_migrations/202108311352491
-rw-r--r--db/schema_migrations/202108312034081
-rw-r--r--db/schema_migrations/202109010442021
-rw-r--r--db/schema_migrations/202109010442371
-rw-r--r--db/schema_migrations/202109010655041
-rw-r--r--db/schema_migrations/202109011533241
-rw-r--r--db/schema_migrations/202109011845111
-rw-r--r--db/schema_migrations/202109021441441
-rw-r--r--db/schema_migrations/202109021714061
-rw-r--r--db/schema_migrations/202109021718081
-rw-r--r--db/schema_migrations/202109021843341
-rw-r--r--db/schema_migrations/202109030541581
-rw-r--r--db/schema_migrations/202109061000211
-rw-r--r--db/schema_migrations/202109061003161
-rw-r--r--db/schema_migrations/202109070219401
-rw-r--r--db/schema_migrations/202109070337451
-rw-r--r--db/schema_migrations/202109070410001
-rw-r--r--db/schema_migrations/202109071823371
-rw-r--r--db/schema_migrations/202109071823591
-rw-r--r--db/schema_migrations/202109072115571
-rw-r--r--db/schema_migrations/202109080609511
-rw-r--r--db/schema_migrations/202109080611321
-rw-r--r--db/schema_migrations/202109081008101
-rw-r--r--db/schema_migrations/202109081323351
-rw-r--r--db/schema_migrations/202109081404371
-rw-r--r--db/schema_migrations/202109081857361
-rw-r--r--db/schema_migrations/202109081857541
-rw-r--r--db/schema_migrations/202109091048001
-rw-r--r--db/schema_migrations/202109091520271
-rw-r--r--db/schema_migrations/202109091843491
-rw-r--r--db/schema_migrations/202109101410431
-rw-r--r--db/schema_migrations/202109130104111
-rw-r--r--db/schema_migrations/202109130104321
-rw-r--r--db/schema_migrations/202109131224571
-rw-r--r--db/schema_migrations/202109140948401
-rw-r--r--db/schema_migrations/202109152029001
-rw-r--r--db/structure.sql1739
236 files changed, 4769 insertions, 222 deletions
diff --git a/db/fixtures/development/001_create_base_work_item_types.rb b/db/fixtures/development/001_create_base_work_item_types.rb
new file mode 100644
index 00000000000..7a541ca20b0
--- /dev/null
+++ b/db/fixtures/development/001_create_base_work_item_types.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+Gitlab::Seeder.quiet do
+ Gitlab::DatabaseImporters::WorkItems::BaseTypeImporter.import
+end
diff --git a/db/fixtures/development/31_error_tracking.rb b/db/fixtures/development/31_error_tracking.rb
index 60e288696f8..d4d59f4046a 100644
--- a/db/fixtures/development/31_error_tracking.rb
+++ b/db/fixtures/development/31_error_tracking.rb
@@ -33,11 +33,6 @@ Gitlab::Seeder.quiet do
Project.not_mass_generated.visible_to_user(admin_user).sample(1).each do |project|
puts "\nActivating integrated error tracking for the '#{project.full_path}' project"
- unless Feature.enabled?(:integrated_error_tracking, project)
- puts '- enabling feature flag'
- Feature.enable(:integrated_error_tracking, project)
- end
-
puts '- enabling in settings'
project.error_tracking_setting || project.create_error_tracking_setting
project.error_tracking_setting.update!(enabled: true, integrated: true)
diff --git a/db/fixtures/production/003_create_base_work_item_types.rb b/db/fixtures/production/003_create_base_work_item_types.rb
new file mode 100644
index 00000000000..7a541ca20b0
--- /dev/null
+++ b/db/fixtures/production/003_create_base_work_item_types.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+Gitlab::Seeder.quiet do
+ Gitlab::DatabaseImporters::WorkItems::BaseTypeImporter.import
+end
diff --git a/db/migrate/20201029144444_create_vulnerability_finding_links.rb b/db/migrate/20201029144444_create_vulnerability_finding_links.rb
index 80f93b9a0af..225a2de6e19 100644
--- a/db/migrate/20201029144444_create_vulnerability_finding_links.rb
+++ b/db/migrate/20201029144444_create_vulnerability_finding_links.rb
@@ -11,8 +11,8 @@ class CreateVulnerabilityFindingLinks < ActiveRecord::Migration[6.0]
create_table :vulnerability_finding_links, if_not_exists: true do |t|
t.timestamps_with_timezone null: false
t.references :vulnerability_occurrence, index: { name: 'finding_links_on_vulnerability_occurrence_id' }, null: false, foreign_key: { on_delete: :cascade }
- t.text :name, limit: 255
- t.text :url, limit: 2048, null: false
+ t.text :name
+ t.text :url, null: false
end
add_text_limit :vulnerability_finding_links, :name, 255
diff --git a/db/migrate/20210531053916_rename_instance_statistics_measurements.rb b/db/migrate/20210531053916_rename_instance_statistics_measurements.rb
index 9fd459b1275..733ca296952 100644
--- a/db/migrate/20210531053916_rename_instance_statistics_measurements.rb
+++ b/db/migrate/20210531053916_rename_instance_statistics_measurements.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
-class RenameInstanceStatisticsMeasurements < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
+class RenameInstanceStatisticsMeasurements < Gitlab::Database::Migration[1.0]
+ enable_lock_retries!
def up
rename_table_safely(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
diff --git a/db/migrate/20210621043337_rename_services_to_integrations.rb b/db/migrate/20210621043337_rename_services_to_integrations.rb
index 17f4b6a2d4d..845c3c01a2a 100644
--- a/db/migrate/20210621043337_rename_services_to_integrations.rb
+++ b/db/migrate/20210621043337_rename_services_to_integrations.rb
@@ -1,9 +1,10 @@
# frozen_string_literal: true
-class RenameServicesToIntegrations < ActiveRecord::Migration[6.1]
- include Gitlab::Database::MigrationHelpers
+class RenameServicesToIntegrations < Gitlab::Database::Migration[1.0]
include Gitlab::Database::SchemaHelpers
+ enable_lock_retries!
+
# Function and trigger names match those migrated in:
# - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49916
# - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51852
diff --git a/db/migrate/20210707113056_add_tags_array_to_ci_pending_builds.rb b/db/migrate/20210707113056_add_tags_array_to_ci_pending_builds.rb
new file mode 100644
index 00000000000..229dc01fb87
--- /dev/null
+++ b/db/migrate/20210707113056_add_tags_array_to_ci_pending_builds.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddTagsArrayToCiPendingBuilds < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ add_column :ci_pending_builds, :tag_ids, :integer, array: true, default: []
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :ci_pending_builds, :tag_ids
+ end
+ end
+end
diff --git a/db/migrate/20210707163659_add_vulnerability_events_to_integrations.rb b/db/migrate/20210707163659_add_vulnerability_events_to_integrations.rb
new file mode 100644
index 00000000000..c138af486c1
--- /dev/null
+++ b/db/migrate/20210707163659_add_vulnerability_events_to_integrations.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddVulnerabilityEventsToIntegrations < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def change
+ add_column :integrations, :vulnerability_events, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20210708011425_rename_ci_builds_metadata_foreign_key.rb b/db/migrate/20210708011425_rename_ci_builds_metadata_foreign_key.rb
new file mode 100644
index 00000000000..70141f4844e
--- /dev/null
+++ b/db/migrate/20210708011425_rename_ci_builds_metadata_foreign_key.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class RenameCiBuildsMetadataForeignKey < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'ci_builds_metadata'
+ OLD_PREFIX = 'fk_rails_'
+
+ def up
+ with_lock_retries(raise_on_exhaustion: true) do
+ rename_constraint(
+ TABLE_NAME,
+ concurrent_foreign_key_name(TABLE_NAME, :build_id, prefix: 'fk_rails_'),
+ concurrent_foreign_key_name(TABLE_NAME, :build_id)
+ )
+ end
+ end
+
+ def down
+ with_lock_retries(raise_on_exhaustion: true) do
+ rename_constraint(
+ TABLE_NAME,
+ concurrent_foreign_key_name(TABLE_NAME, :build_id),
+ concurrent_foreign_key_name(TABLE_NAME, :build_id, prefix: 'fk_rails_')
+ )
+ end
+ end
+end
diff --git a/db/migrate/20210729081351_create_topics.rb b/db/migrate/20210729081351_create_topics.rb
new file mode 100644
index 00000000000..c6fdc6bb98a
--- /dev/null
+++ b/db/migrate/20210729081351_create_topics.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class CreateTopics < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def change
+ create_table_with_constraints :topics do |t|
+ t.text :name, null: false
+ t.text_limit :name, 255
+
+ t.index :name, unique: true
+
+ t.timestamps_with_timezone
+ end
+ end
+end
diff --git a/db/migrate/20210729081739_create_project_topics.rb b/db/migrate/20210729081739_create_project_topics.rb
new file mode 100644
index 00000000000..cbb8842f653
--- /dev/null
+++ b/db/migrate/20210729081739_create_project_topics.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class CreateProjectTopics < ActiveRecord::Migration[6.1]
+ def change
+ create_table :project_topics do |t|
+ t.bigint :project_id, null: false
+ t.bigint :topic_id, null: false
+
+ t.index :project_id
+ t.index :topic_id
+ t.index [:project_id, :topic_id], unique: true
+
+ t.timestamps_with_timezone
+ end
+ end
+end
diff --git a/db/migrate/20210729125641_add_foreign_key_to_project_on_project_topic.rb b/db/migrate/20210729125641_add_foreign_key_to_project_on_project_topic.rb
new file mode 100644
index 00000000000..27cf5c60cf0
--- /dev/null
+++ b/db/migrate/20210729125641_add_foreign_key_to_project_on_project_topic.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToProjectOnProjectTopic < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :project_topics, :projects, column: :project_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :project_topics, column: :project_id
+ end
+ end
+end
diff --git a/db/migrate/20210729125659_add_foreign_key_to_topic_on_project_topic.rb b/db/migrate/20210729125659_add_foreign_key_to_topic_on_project_topic.rb
new file mode 100644
index 00000000000..1ada08dca1a
--- /dev/null
+++ b/db/migrate/20210729125659_add_foreign_key_to_topic_on_project_topic.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToTopicOnProjectTopic < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :project_topics, :topics, column: :topic_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :project_topics, column: :topic_id
+ end
+ end
+end
diff --git a/db/migrate/20210730194555_create_incident_management_pending_issue_escalations.rb b/db/migrate/20210730194555_create_incident_management_pending_issue_escalations.rb
new file mode 100644
index 00000000000..20a6fde96ff
--- /dev/null
+++ b/db/migrate/20210730194555_create_incident_management_pending_issue_escalations.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class CreateIncidentManagementPendingIssueEscalations < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ execute(<<~SQL)
+ CREATE TABLE incident_management_pending_issue_escalations (
+ id bigserial NOT NULL,
+ rule_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ process_at timestamp with time zone NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ PRIMARY KEY (id, process_at)
+ ) PARTITION BY RANGE (process_at);
+
+ CREATE INDEX index_incident_management_pending_issue_escalations_on_issue_id
+ ON incident_management_pending_issue_escalations USING btree (issue_id);
+
+ CREATE INDEX index_incident_management_pending_issue_escalations_on_rule_id
+ ON incident_management_pending_issue_escalations USING btree (rule_id);
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :incident_management_pending_issue_escalations
+ end
+ end
+end
diff --git a/db/migrate/20210807101446_add_cadence_to_dast_profile_schedules.rb b/db/migrate/20210807101446_add_cadence_to_dast_profile_schedules.rb
new file mode 100644
index 00000000000..c9b17e3d5c5
--- /dev/null
+++ b/db/migrate/20210807101446_add_cadence_to_dast_profile_schedules.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddCadenceToDastProfileSchedules < ActiveRecord::Migration[6.1]
+ def change
+ add_column :dast_profile_schedules, :cadence, :jsonb, null: false, default: {}
+ end
+end
diff --git a/db/migrate/20210807101621_add_timezone_to_dast_profile_schedules.rb b/db/migrate/20210807101621_add_timezone_to_dast_profile_schedules.rb
new file mode 100644
index 00000000000..3c3eb507432
--- /dev/null
+++ b/db/migrate/20210807101621_add_timezone_to_dast_profile_schedules.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class AddTimezoneToDastProfileSchedules < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ # We disable these cops here because adding the column is safe. The table does not
+ # have any data in it as it's behind a feature flag.
+ # rubocop: disable Rails/NotNullColumn
+ def up
+ execute('DELETE FROM dast_profile_schedules')
+
+ unless column_exists?(:dast_profile_schedules, :timezone)
+ add_column :dast_profile_schedules, :timezone, :text, null: false
+ end
+
+ add_text_limit :dast_profile_schedules, :timezone, 255
+ end
+
+ def down
+ return unless column_exists?(:dast_profile_schedules, :timezone)
+
+ remove_column :dast_profile_schedules, :timezone
+ end
+end
diff --git a/db/migrate/20210807102004_add_starts_at_to_dast_profile_schedules.rb b/db/migrate/20210807102004_add_starts_at_to_dast_profile_schedules.rb
new file mode 100644
index 00000000000..4eea5fd7e8c
--- /dev/null
+++ b/db/migrate/20210807102004_add_starts_at_to_dast_profile_schedules.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddStartsAtToDastProfileSchedules < ActiveRecord::Migration[6.1]
+ def change
+ add_column :dast_profile_schedules, :starts_at, :datetime_with_timezone, null: false, default: -> { 'NOW()' }
+ end
+end
diff --git a/db/migrate/20210809014850_create_agent_group_authorizations.rb b/db/migrate/20210809014850_create_agent_group_authorizations.rb
new file mode 100644
index 00000000000..43d7e63e0a2
--- /dev/null
+++ b/db/migrate/20210809014850_create_agent_group_authorizations.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class CreateAgentGroupAuthorizations < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def change
+ create_table :agent_group_authorizations do |t|
+ t.bigint :group_id, null: false
+ t.bigint :agent_id, null: false
+ t.jsonb :config, null: false
+
+ t.index :group_id
+ t.index [:agent_id, :group_id], unique: true
+ end
+ end
+end
diff --git a/db/migrate/20210809014918_add_agent_group_authorizations_foreign_keys.rb b/db/migrate/20210809014918_add_agent_group_authorizations_foreign_keys.rb
new file mode 100644
index 00000000000..2a3a51d0ca9
--- /dev/null
+++ b/db/migrate/20210809014918_add_agent_group_authorizations_foreign_keys.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddAgentGroupAuthorizationsForeignKeys < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :agent_group_authorizations, :namespaces, column: :group_id
+ add_concurrent_foreign_key :agent_group_authorizations, :cluster_agents, column: :agent_id
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :agent_group_authorizations, column: :group_id
+ end
+
+ with_lock_retries do
+ remove_foreign_key_if_exists :agent_group_authorizations, column: :agent_id
+ end
+ end
+end
diff --git a/db/migrate/20210811120204_create_customer_relations_contacts.rb b/db/migrate/20210811120204_create_customer_relations_contacts.rb
new file mode 100644
index 00000000000..0c26ee0ef59
--- /dev/null
+++ b/db/migrate/20210811120204_create_customer_relations_contacts.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class CreateCustomerRelationsContacts < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ create_table_with_constraints :customer_relations_contacts do |t|
+ t.bigint :group_id, null: false
+ t.references :organization, index: true, null: true, foreign_key: { to_table: :customer_relations_organizations, on_delete: :cascade }
+ t.timestamps_with_timezone null: false
+ t.integer :state, limit: 1, default: 1, null: false
+ t.text :phone
+ t.text :first_name, null: false
+ t.text :last_name, null: false
+ t.text :email
+ t.text :description
+
+ t.text_limit :phone, 32
+ t.text_limit :first_name, 255
+ t.text_limit :last_name, 255
+ t.text_limit :email, 255
+ t.text_limit :description, 1024
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :customer_relations_contacts
+ end
+ end
+end
diff --git a/db/migrate/20210813131313_create_foreign_key_on_contacts_group_id.rb b/db/migrate/20210813131313_create_foreign_key_on_contacts_group_id.rb
new file mode 100644
index 00000000000..58b2471a96a
--- /dev/null
+++ b/db/migrate/20210813131313_create_foreign_key_on_contacts_group_id.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class CreateForeignKeyOnContactsGroupId < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_customer_relations_contacts_on_group_id'
+
+ def up
+ add_concurrent_index :customer_relations_contacts, :group_id, name: INDEX_NAME
+ add_concurrent_foreign_key :customer_relations_contacts, :namespaces, column: :group_id
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :customer_relations_contacts, column: :group_id
+ end
+
+ remove_concurrent_index_by_name :customer_relations_contacts, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210816095826_add_unique_index_on_dast_profile_to_dast_profile_schedules.rb b/db/migrate/20210816095826_add_unique_index_on_dast_profile_to_dast_profile_schedules.rb
new file mode 100644
index 00000000000..b7ea8545df1
--- /dev/null
+++ b/db/migrate/20210816095826_add_unique_index_on_dast_profile_to_dast_profile_schedules.rb
@@ -0,0 +1,38 @@
+# 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 AddUniqueIndexOnDastProfileToDastProfileSchedules < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'index_dast_profile_schedules_on_dast_profile_id'
+ TABLE = :dast_profile_schedules
+ # We disable these cops here because changing this index is safe. The table does not
+ # have any data in it as it's behind a feature flag.
+ # rubocop: disable Migration/AddIndex
+ # rubocop: disable Migration/RemoveIndex
+ def up
+ execute('DELETE FROM dast_profile_schedules')
+
+ if index_exists_by_name?(TABLE, INDEX_NAME)
+ remove_index TABLE, :dast_profile_id, name: INDEX_NAME
+ end
+
+ unless index_exists_by_name?(TABLE, INDEX_NAME)
+ add_index TABLE, :dast_profile_id, unique: true, name: INDEX_NAME
+ end
+ end
+
+ def down
+ execute('DELETE FROM dast_profile_schedules')
+
+ if index_exists_by_name?(TABLE, INDEX_NAME)
+ remove_index TABLE, :dast_profile_id, name: INDEX_NAME
+ end
+
+ unless index_exists_by_name?(TABLE, INDEX_NAME)
+ add_index TABLE, :dast_profile_id
+ end
+ end
+end
diff --git a/db/migrate/20210816192041_add_invites_email_success_to_member.rb b/db/migrate/20210816192041_add_invites_email_success_to_member.rb
new file mode 100644
index 00000000000..89f475b056c
--- /dev/null
+++ b/db/migrate/20210816192041_add_invites_email_success_to_member.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddInvitesEmailSuccessToMember < ActiveRecord::Migration[6.1]
+ def up
+ unless column_exists?(:members, :invite_email_success)
+ add_column :members, :invite_email_success, :boolean, null: false, default: true
+ end
+ end
+
+ def down
+ remove_column :members, :invite_email_success
+ end
+end
diff --git a/db/migrate/20210817130415_add_project_id_name_version_id_to_npm_packages.rb b/db/migrate/20210817130415_add_project_id_name_version_id_to_npm_packages.rb
new file mode 100644
index 00000000000..e4b681d66fb
--- /dev/null
+++ b/db/migrate/20210817130415_add_project_id_name_version_id_to_npm_packages.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddProjectIdNameVersionIdToNpmPackages < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'idx_installable_npm_pkgs_on_project_id_name_version_id'
+
+ def up
+ add_concurrent_index :packages_packages, [:project_id, :name, :version, :id], where: 'package_type = 2 AND status = 0', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :packages_packages, [:project_id, :name, :version, :id], where: 'package_type = 2 AND status = 0', name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210817172214_add_yaml_limits_application_setting.rb b/db/migrate/20210817172214_add_yaml_limits_application_setting.rb
new file mode 100644
index 00000000000..f502ef9825b
--- /dev/null
+++ b/db/migrate/20210817172214_add_yaml_limits_application_setting.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddYamlLimitsApplicationSetting < ActiveRecord::Migration[6.1]
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :max_yaml_size_bytes, :bigint, default: 1.megabyte, null: false
+ add_column :application_settings, :max_yaml_depth, :integer, default: 100, null: false
+ end
+end
diff --git a/db/migrate/20210818061156_remove_project_profile_compound_index_from_dast_profile_schedules.rb b/db/migrate/20210818061156_remove_project_profile_compound_index_from_dast_profile_schedules.rb
new file mode 100644
index 00000000000..b50947a0a99
--- /dev/null
+++ b/db/migrate/20210818061156_remove_project_profile_compound_index_from_dast_profile_schedules.rb
@@ -0,0 +1,30 @@
+# 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 RemoveProjectProfileCompoundIndexFromDastProfileSchedules < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE = :dast_profile_schedules
+ INDEX_NAME = 'index_dast_profile_schedules_on_project_id_and_dast_profile_id'
+ # We disable these cops here because changing this index is safe. The table does not
+ # have any data in it as it's behind a feature flag.
+ # rubocop: disable Migration/AddIndex
+ # rubocop: disable Migration/RemoveIndex
+ def up
+ execute('DELETE FROM dast_profile_schedules')
+
+ if index_exists_by_name?(TABLE, INDEX_NAME)
+ remove_index TABLE, %i[project_id dast_profile_id], name: INDEX_NAME
+ end
+ end
+
+ def down
+ execute('DELETE FROM dast_profile_schedules')
+
+ unless index_exists_by_name?(TABLE, INDEX_NAME)
+ add_index TABLE, %i[project_id dast_profile_id], unique: true, name: INDEX_NAME
+ end
+ end
+end
diff --git a/db/migrate/20210818115613_add_index_project_id_on_dast_profile_schedule.rb b/db/migrate/20210818115613_add_index_project_id_on_dast_profile_schedule.rb
new file mode 100644
index 00000000000..392b335ab45
--- /dev/null
+++ b/db/migrate/20210818115613_add_index_project_id_on_dast_profile_schedule.rb
@@ -0,0 +1,13 @@
+# 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 AddIndexProjectIdOnDastProfileSchedule < ActiveRecord::Migration[6.1]
+ # We disable these cops here because changing this index is safe. The table does not
+ # have any data in it as it's behind a feature flag.
+ # rubocop: disable Migration/AddIndex
+ def change
+ add_index :dast_profile_schedules, :project_id
+ end
+end
diff --git a/db/migrate/20210818175949_update_integrations_trigger_type_new_on_insert.rb b/db/migrate/20210818175949_update_integrations_trigger_type_new_on_insert.rb
new file mode 100644
index 00000000000..2999a6fd4f6
--- /dev/null
+++ b/db/migrate/20210818175949_update_integrations_trigger_type_new_on_insert.rb
@@ -0,0 +1,79 @@
+# frozen_string_literal: true
+
+class UpdateIntegrationsTriggerTypeNewOnInsert < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::SchemaHelpers
+
+ FUNCTION_NAME = 'integrations_set_type_new'
+
+ def up
+ # Update `type_new` dynamically based on `type`.
+ #
+ # The old class names are in the format `AbcService`, and the new ones `Integrations::Abc`.
+ create_trigger_function(FUNCTION_NAME, replace: true) do
+ <<~SQL
+ UPDATE integrations SET type_new = regexp_replace(NEW.type, '\\A(.+)Service\\Z', 'Integrations::\\1')
+ WHERE integrations.id = NEW.id;
+ RETURN NULL;
+ SQL
+ end
+ end
+
+ def down
+ # We initially went with this static mapping since we assumed that new integrations could
+ # just use the correct class name directly in `type`, but this will complicate the data migration
+ # since we plan to drop `type` at some point and replace it with `type_new`, so we still need
+ # to keep this column filled for all records.
+ create_trigger_function(FUNCTION_NAME, replace: true) do
+ <<~SQL
+ WITH mapping(old_type, new_type) AS (VALUES
+ ('AsanaService', 'Integrations::Asana'),
+ ('AssemblaService', 'Integrations::Assembla'),
+ ('BambooService', 'Integrations::Bamboo'),
+ ('BugzillaService', 'Integrations::Bugzilla'),
+ ('BuildkiteService', 'Integrations::Buildkite'),
+ ('CampfireService', 'Integrations::Campfire'),
+ ('ConfluenceService', 'Integrations::Confluence'),
+ ('CustomIssueTrackerService', 'Integrations::CustomIssueTracker'),
+ ('DatadogService', 'Integrations::Datadog'),
+ ('DiscordService', 'Integrations::Discord'),
+ ('DroneCiService', 'Integrations::DroneCi'),
+ ('EmailsOnPushService', 'Integrations::EmailsOnPush'),
+ ('EwmService', 'Integrations::Ewm'),
+ ('ExternalWikiService', 'Integrations::ExternalWiki'),
+ ('FlowdockService', 'Integrations::Flowdock'),
+ ('HangoutsChatService', 'Integrations::HangoutsChat'),
+ ('IrkerService', 'Integrations::Irker'),
+ ('JenkinsService', 'Integrations::Jenkins'),
+ ('JiraService', 'Integrations::Jira'),
+ ('MattermostService', 'Integrations::Mattermost'),
+ ('MattermostSlashCommandsService', 'Integrations::MattermostSlashCommands'),
+ ('MicrosoftTeamsService', 'Integrations::MicrosoftTeams'),
+ ('MockCiService', 'Integrations::MockCi'),
+ ('MockMonitoringService', 'Integrations::MockMonitoring'),
+ ('PackagistService', 'Integrations::Packagist'),
+ ('PipelinesEmailService', 'Integrations::PipelinesEmail'),
+ ('PivotaltrackerService', 'Integrations::Pivotaltracker'),
+ ('PrometheusService', 'Integrations::Prometheus'),
+ ('PushoverService', 'Integrations::Pushover'),
+ ('RedmineService', 'Integrations::Redmine'),
+ ('SlackService', 'Integrations::Slack'),
+ ('SlackSlashCommandsService', 'Integrations::SlackSlashCommands'),
+ ('TeamcityService', 'Integrations::Teamcity'),
+ ('UnifyCircuitService', 'Integrations::UnifyCircuit'),
+ ('YoutrackService', 'Integrations::Youtrack'),
+ ('WebexTeamsService', 'Integrations::WebexTeams'),
+
+ -- EE-only integrations
+ ('GithubService', 'Integrations::Github'),
+ ('GitlabSlackApplicationService', 'Integrations::GitlabSlackApplication')
+ )
+
+ UPDATE integrations SET type_new = mapping.new_type
+ FROM mapping
+ WHERE integrations.id = NEW.id
+ AND mapping.old_type = NEW.type;
+ RETURN NULL;
+ SQL
+ end
+ end
+end
diff --git a/db/migrate/20210818185548_add_tag_ids_index_to_ci_pending_build.rb b/db/migrate/20210818185548_add_tag_ids_index_to_ci_pending_build.rb
new file mode 100644
index 00000000000..b8e00ed9db0
--- /dev/null
+++ b/db/migrate/20210818185548_add_tag_ids_index_to_ci_pending_build.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddTagIdsIndexToCiPendingBuild < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_ci_pending_builds_on_tag_ids'
+
+ def up
+ add_concurrent_index(:ci_pending_builds, :tag_ids, name: INDEX_NAME, where: 'cardinality(tag_ids) > 0')
+ end
+
+ def down
+ remove_concurrent_index_by_name(:ci_pending_builds, name: INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210818193008_add_file_template_project_to_service_desk_settings.rb b/db/migrate/20210818193008_add_file_template_project_to_service_desk_settings.rb
new file mode 100644
index 00000000000..4cfd54ac348
--- /dev/null
+++ b/db/migrate/20210818193008_add_file_template_project_to_service_desk_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddFileTemplateProjectToServiceDeskSettings < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def change
+ add_column :service_desk_settings, :file_template_project_id, :bigint, null: true
+ end
+end
diff --git a/db/migrate/20210818200455_add_file_template_project_foreign_key_to_service_desk_settings.rb b/db/migrate/20210818200455_add_file_template_project_foreign_key_to_service_desk_settings.rb
new file mode 100644
index 00000000000..cc8aeecd2b5
--- /dev/null
+++ b/db/migrate/20210818200455_add_file_template_project_foreign_key_to_service_desk_settings.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddFileTemplateProjectForeignKeyToServiceDeskSettings < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_service_desk_settings_on_file_template_project_id'
+
+ def up
+ add_concurrent_index :service_desk_settings, :file_template_project_id, name: INDEX_NAME
+ add_concurrent_foreign_key :service_desk_settings, :projects, column: :file_template_project_id, on_delete: :nullify
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :service_desk_settings, column: :file_template_project_id
+ end
+
+ remove_concurrent_index_by_name :service_desk_settings, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210818220234_add_default_project_approval_rules_vuln_allowed.rb b/db/migrate/20210818220234_add_default_project_approval_rules_vuln_allowed.rb
new file mode 100644
index 00000000000..72d2755effa
--- /dev/null
+++ b/db/migrate/20210818220234_add_default_project_approval_rules_vuln_allowed.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddDefaultProjectApprovalRulesVulnAllowed < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ DEFAULT_VALUE = 0
+
+ def up
+ change_column_default :approval_project_rules, :vulnerabilities_allowed, DEFAULT_VALUE
+
+ update_column_in_batches(:approval_project_rules, :vulnerabilities_allowed, DEFAULT_VALUE) do |table, query|
+ query.where(table[:vulnerabilities_allowed].eq(nil))
+ end
+
+ change_column_null :approval_project_rules, :vulnerabilities_allowed, false
+ end
+
+ def down
+ change_column_default :approval_project_rules, :vulnerabilities_allowed, nil
+ change_column_null :approval_project_rules, :vulnerabilities_allowed, true
+ end
+end
diff --git a/db/migrate/20210819120243_add_throttle_files_api_columns.rb b/db/migrate/20210819120243_add_throttle_files_api_columns.rb
new file mode 100644
index 00000000000..ace093c7b0c
--- /dev/null
+++ b/db/migrate/20210819120243_add_throttle_files_api_columns.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddThrottleFilesApiColumns < ActiveRecord::Migration[6.1]
+ def change
+ add_column :application_settings, :throttle_unauthenticated_files_api_requests_per_period, :integer, default: 125, null: false
+ add_column :application_settings, :throttle_unauthenticated_files_api_period_in_seconds, :integer, default: 15, null: false
+ add_column :application_settings, :throttle_authenticated_files_api_requests_per_period, :integer, default: 500, null: false
+ add_column :application_settings, :throttle_authenticated_files_api_period_in_seconds, :integer, default: 15, null: false
+
+ add_column :application_settings, :throttle_unauthenticated_files_api_enabled, :boolean, default: false, null: false
+ add_column :application_settings, :throttle_authenticated_files_api_enabled, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20210819152723_remove_tmp_index_approval_project_rules_scanners.rb b/db/migrate/20210819152723_remove_tmp_index_approval_project_rules_scanners.rb
new file mode 100644
index 00000000000..a60141991a6
--- /dev/null
+++ b/db/migrate/20210819152723_remove_tmp_index_approval_project_rules_scanners.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class RemoveTmpIndexApprovalProjectRulesScanners < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'tmp_index_approval_project_rules_scanners'
+
+ def up
+ remove_concurrent_index_by_name :approval_project_rules, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :approval_project_rules, :scanners, name: INDEX_NAME, using: :gin, where: "scanners @> '{cluster_image_scanning}'"
+ end
+end
diff --git a/db/migrate/20210819153805_set_default_job_token_scope_true.rb b/db/migrate/20210819153805_set_default_job_token_scope_true.rb
new file mode 100644
index 00000000000..4536f664950
--- /dev/null
+++ b/db/migrate/20210819153805_set_default_job_token_scope_true.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class SetDefaultJobTokenScopeTrue < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ change_column_default :project_ci_cd_settings, :job_token_scope_enabled, from: false, to: true
+ end
+ end
+
+ def down
+ with_lock_retries do
+ change_column_default :project_ci_cd_settings, :job_token_scope_enabled, from: true, to: false
+ end
+ end
+end
diff --git a/db/migrate/20210819162047_add_columns_to_namespace_settings.rb b/db/migrate/20210819162047_add_columns_to_namespace_settings.rb
new file mode 100644
index 00000000000..f617990582a
--- /dev/null
+++ b/db/migrate/20210819162047_add_columns_to_namespace_settings.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddColumnsToNamespaceSettings < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ add_column :namespace_settings, :setup_for_company, :boolean
+ add_column :namespace_settings, :jobs_to_be_done, :smallint
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :namespace_settings, :setup_for_company
+ remove_column :namespace_settings, :jobs_to_be_done
+ end
+ end
+end
diff --git a/db/migrate/20210820171834_add_foreign_keys_for_pending_issue_escalations.rb b/db/migrate/20210820171834_add_foreign_keys_for_pending_issue_escalations.rb
new file mode 100644
index 00000000000..9d5322de498
--- /dev/null
+++ b/db/migrate/20210820171834_add_foreign_keys_for_pending_issue_escalations.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddForeignKeysForPendingIssueEscalations < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_partitioned_foreign_key :incident_management_pending_issue_escalations,
+ :incident_management_escalation_rules,
+ column: :rule_id
+
+ add_concurrent_partitioned_foreign_key :incident_management_pending_issue_escalations,
+ :issues,
+ column: :issue_id
+ end
+
+ def down
+ remove_foreign_key_if_exists :incident_management_pending_issue_escalations, :incident_management_escalation_rules, column: :rule_id
+ remove_foreign_key_if_exists :incident_management_pending_issue_escalations, :issues, column: :issue_id
+ end
+end
diff --git a/db/migrate/20210823172643_create_user_group_callout.rb b/db/migrate/20210823172643_create_user_group_callout.rb
new file mode 100644
index 00000000000..72341c0b275
--- /dev/null
+++ b/db/migrate/20210823172643_create_user_group_callout.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class CreateUserGroupCallout < ActiveRecord::Migration[6.1]
+ def up
+ create_table :user_group_callouts do |t|
+ t.bigint :user_id, null: false
+ t.bigint :group_id, null: false
+ t.integer :feature_name, limit: 2, null: false
+ t.datetime_with_timezone :dismissed_at
+
+ t.index :group_id
+ t.index [:user_id, :feature_name, :group_id], unique: true, name: 'index_group_user_callouts_feature'
+ end
+ end
+
+ def down
+ drop_table :user_group_callouts
+ end
+end
diff --git a/db/migrate/20210823213417_create_dependency_proxy_image_ttl_group_policies.rb b/db/migrate/20210823213417_create_dependency_proxy_image_ttl_group_policies.rb
new file mode 100644
index 00000000000..3bbd9c1259e
--- /dev/null
+++ b/db/migrate/20210823213417_create_dependency_proxy_image_ttl_group_policies.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class CreateDependencyProxyImageTtlGroupPolicies < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ create_table :dependency_proxy_image_ttl_group_policies, id: false do |t|
+ t.timestamps_with_timezone null: false
+ t.references :group, primary_key: true, default: nil, index: false, foreign_key: { to_table: :namespaces, on_delete: :cascade }
+ t.integer :ttl, default: 90
+ t.boolean :enabled, null: false, default: false
+ end
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :dependency_proxy_image_ttl_group_policies
+ end
+ end
+end
diff --git a/db/migrate/20210824055322_add_project_namespace_id_to_project.rb b/db/migrate/20210824055322_add_project_namespace_id_to_project.rb
new file mode 100644
index 00000000000..9397ad4aab2
--- /dev/null
+++ b/db/migrate/20210824055322_add_project_namespace_id_to_project.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddProjectNamespaceIdToProject < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ # This is being added to Projects as a replacement for Namespace
+ # See https://gitlab.com/gitlab-org/gitlab/-/issues/337099
+ add_column :projects, :project_namespace_id, :bigint # rubocop: disable Migration/AddColumnsToWideTables
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :projects, :project_namespace_id
+ end
+ end
+end
diff --git a/db/migrate/20210824105038_add_timestamp_columns_to_ci_build_trace_metadata.rb b/db/migrate/20210824105038_add_timestamp_columns_to_ci_build_trace_metadata.rb
new file mode 100644
index 00000000000..5c2391f68ed
--- /dev/null
+++ b/db/migrate/20210824105038_add_timestamp_columns_to_ci_build_trace_metadata.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+class AddTimestampColumnsToCiBuildTraceMetadata < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :ci_build_trace_metadata, :last_archival_attempt_at, :datetime_with_timezone
+ add_column :ci_build_trace_metadata, :archived_at, :datetime_with_timezone
+ end
+end
diff --git a/db/migrate/20210824160459_add_notification_level_to_ci_namespace_monthly_usages.rb b/db/migrate/20210824160459_add_notification_level_to_ci_namespace_monthly_usages.rb
new file mode 100644
index 00000000000..15b580af737
--- /dev/null
+++ b/db/migrate/20210824160459_add_notification_level_to_ci_namespace_monthly_usages.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddNotificationLevelToCiNamespaceMonthlyUsages < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :ci_namespace_monthly_usages, :notification_level, :integer, limit: 2, default: 100, null: false
+ end
+end
diff --git a/db/migrate/20210825104558_change_description_limit_error_tracking_event.rb b/db/migrate/20210825104558_change_description_limit_error_tracking_event.rb
new file mode 100644
index 00000000000..4663cc513da
--- /dev/null
+++ b/db/migrate/20210825104558_change_description_limit_error_tracking_event.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class ChangeDescriptionLimitErrorTrackingEvent < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ remove_text_limit :error_tracking_error_events, :description
+ add_text_limit :error_tracking_error_events, :description, 1024
+ end
+
+ def down
+ remove_text_limit :error_tracking_error_events, :description
+ add_text_limit :error_tracking_error_events, :description, 255
+ end
+end
diff --git a/db/migrate/20210825104656_create_analytics_cycle_analytics_merge_request_stage_events.rb b/db/migrate/20210825104656_create_analytics_cycle_analytics_merge_request_stage_events.rb
new file mode 100644
index 00000000000..2e89dfeacbf
--- /dev/null
+++ b/db/migrate/20210825104656_create_analytics_cycle_analytics_merge_request_stage_events.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class CreateAnalyticsCycleAnalyticsMergeRequestStageEvents < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ execute <<~SQL
+ CREATE TABLE analytics_cycle_analytics_merge_request_stage_events (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone,
+ PRIMARY KEY (stage_event_hash_id, merge_request_id)
+ ) PARTITION BY HASH (stage_event_hash_id)
+ SQL
+
+ create_hash_partitions :analytics_cycle_analytics_merge_request_stage_events, 32
+ end
+
+ def down
+ drop_table :analytics_cycle_analytics_merge_request_stage_events
+ end
+end
diff --git a/db/migrate/20210825110016_create_analytics_cycle_analytics_issue_stage_events.rb b/db/migrate/20210825110016_create_analytics_cycle_analytics_issue_stage_events.rb
new file mode 100644
index 00000000000..acc1d96bd23
--- /dev/null
+++ b/db/migrate/20210825110016_create_analytics_cycle_analytics_issue_stage_events.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class CreateAnalyticsCycleAnalyticsIssueStageEvents < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ execute <<~SQL
+ CREATE TABLE analytics_cycle_analytics_issue_stage_events (
+ stage_event_hash_id integer NOT NULL,
+ issue_id integer NOT NULL,
+ group_id integer NOT NULL,
+ project_id integer NOT NULL,
+ milestone_id integer,
+ author_id integer,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone,
+ PRIMARY KEY (stage_event_hash_id, issue_id)
+ ) PARTITION BY HASH (stage_event_hash_id)
+ SQL
+
+ create_hash_partitions :analytics_cycle_analytics_issue_stage_events, 32
+ end
+
+ def down
+ drop_table :analytics_cycle_analytics_issue_stage_events
+ end
+end
diff --git a/db/migrate/20210825190458_add_user_deactivation_email_option_to_application_settings.rb b/db/migrate/20210825190458_add_user_deactivation_email_option_to_application_settings.rb
new file mode 100644
index 00000000000..dc3270dc5a7
--- /dev/null
+++ b/db/migrate/20210825190458_add_user_deactivation_email_option_to_application_settings.rb
@@ -0,0 +1,10 @@
+# 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 AddUserDeactivationEmailOptionToApplicationSettings < ActiveRecord::Migration[6.1]
+ def change
+ add_column :application_settings, :user_deactivation_emails_enabled, :boolean, default: true, null: false
+ end
+end
diff --git a/db/migrate/20210825193448_add_iteration_cadence_id_to_issue_boards.rb b/db/migrate/20210825193448_add_iteration_cadence_id_to_issue_boards.rb
new file mode 100644
index 00000000000..cbe7d08894e
--- /dev/null
+++ b/db/migrate/20210825193448_add_iteration_cadence_id_to_issue_boards.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddIterationCadenceIdToIssueBoards < Gitlab::Database::Migration[1.0]
+ enable_lock_retries!
+
+ def change
+ add_column :boards, :iteration_cadence_id, :bigint
+ end
+end
diff --git a/db/migrate/20210826120834_add_locked_to_ci_job_artifacts.rb b/db/migrate/20210826120834_add_locked_to_ci_job_artifacts.rb
new file mode 100644
index 00000000000..2149265b4e7
--- /dev/null
+++ b/db/migrate/20210826120834_add_locked_to_ci_job_artifacts.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddLockedToCiJobArtifacts < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'ci_job_artifacts'
+ COLUMN_NAME = 'locked'
+
+ def up
+ with_lock_retries do
+ add_column TABLE_NAME, COLUMN_NAME, :smallint, default: 2
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column TABLE_NAME, COLUMN_NAME
+ end
+ end
+end
diff --git a/db/migrate/20210826122748_create_loose_foreign_keys_deleted_records.rb b/db/migrate/20210826122748_create_loose_foreign_keys_deleted_records.rb
new file mode 100644
index 00000000000..5abea4393b4
--- /dev/null
+++ b/db/migrate/20210826122748_create_loose_foreign_keys_deleted_records.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class CreateLooseForeignKeysDeletedRecords < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers
+
+ def up
+ constraint_name = check_constraint_name('loose_foreign_keys_deleted_records', 'deleted_table_name', 'max_length')
+ execute(<<~SQL)
+ CREATE TABLE loose_foreign_keys_deleted_records (
+ created_at timestamp with time zone NOT NULL DEFAULT NOW(),
+ deleted_table_name text NOT NULL,
+ deleted_table_primary_key_value bigint NOT NULL,
+ PRIMARY KEY (created_at, deleted_table_name, deleted_table_primary_key_value),
+ CONSTRAINT #{constraint_name} CHECK ((char_length(deleted_table_name) <= 63))
+ ) PARTITION BY RANGE (created_at);
+ SQL
+
+ min_date = Date.today - 1.month
+ max_date = Date.today + 3.months
+ create_daterange_partitions('loose_foreign_keys_deleted_records', 'created_at', min_date, max_date)
+ end
+
+ def down
+ drop_table :loose_foreign_keys_deleted_records
+ end
+end
diff --git a/db/migrate/20210826124311_add_index_to_error_tracking_error.rb b/db/migrate/20210826124311_add_index_to_error_tracking_error.rb
new file mode 100644
index 00000000000..5973331e487
--- /dev/null
+++ b/db/migrate/20210826124311_add_index_to_error_tracking_error.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class AddIndexToErrorTrackingError < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :error_tracking_errors, [:project_id, :status, :last_seen_at], name: 'index_et_errors_on_project_id_and_status_and_last_seen_at'
+ add_concurrent_index :error_tracking_errors, [:project_id, :status, :first_seen_at], name: 'index_et_errors_on_project_id_and_status_and_first_seen_at'
+ add_concurrent_index :error_tracking_errors, [:project_id, :status, :events_count], name: 'index_et_errors_on_project_id_and_status_and_events_count'
+ add_concurrent_index :error_tracking_errors, [:project_id, :status, :id], name: 'index_et_errors_on_project_id_and_status_and_id'
+ end
+
+ def down
+ remove_concurrent_index :error_tracking_errors, [:project_id, :status, :last_seen_at], name: 'index_et_errors_on_project_id_and_status_and_last_seen_at'
+ remove_concurrent_index :error_tracking_errors, [:project_id, :status, :first_seen_at], name: 'index_et_errors_on_project_id_and_status_and_first_seen_at'
+ remove_concurrent_index :error_tracking_errors, [:project_id, :status, :events_count], name: 'index_et_errors_on_project_id_and_status_and_events_count'
+ remove_concurrent_index :error_tracking_errors, [:project_id, :status, :id], name: 'index_et_errors_on_project_id_and_status_and_id'
+ end
+end
diff --git a/db/migrate/20210826145509_add_function_for_inserting_deleted_records.rb b/db/migrate/20210826145509_add_function_for_inserting_deleted_records.rb
new file mode 100644
index 00000000000..ef688cdfd8c
--- /dev/null
+++ b/db/migrate/20210826145509_add_function_for_inserting_deleted_records.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class AddFunctionForInsertingDeletedRecords < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+ include Gitlab::Database::MigrationHelpers::LooseForeignKeyHelpers
+
+ def up
+ execute(<<~SQL)
+ CREATE FUNCTION #{DELETED_RECORDS_INSERT_FUNCTION_NAME}()
+ RETURNS TRIGGER AS
+ $$
+ BEGIN
+ INSERT INTO loose_foreign_keys_deleted_records
+ (deleted_table_name, deleted_table_primary_key_value)
+ SELECT TG_TABLE_NAME, old_table.id FROM old_table
+ ON CONFLICT DO NOTHING;
+
+ RETURN NULL;
+ END
+ $$ LANGUAGE PLPGSQL
+ SQL
+ end
+
+ def down
+ drop_function(DELETED_RECORDS_INSERT_FUNCTION_NAME)
+ end
+end
diff --git a/db/migrate/20210826170902_add_throttle_unauthenticated_api_columns.rb b/db/migrate/20210826170902_add_throttle_unauthenticated_api_columns.rb
new file mode 100644
index 00000000000..675da2ea41c
--- /dev/null
+++ b/db/migrate/20210826170902_add_throttle_unauthenticated_api_columns.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddThrottleUnauthenticatedApiColumns < ActiveRecord::Migration[6.1]
+ def change
+ # The defaults match those from the current `throttle_unauthenticated_*` columns
+ add_column :application_settings, :throttle_unauthenticated_api_enabled, :boolean, default: false, null: false
+ add_column :application_settings, :throttle_unauthenticated_api_requests_per_period, :integer, default: 3600, null: false
+ add_column :application_settings, :throttle_unauthenticated_api_period_in_seconds, :integer, default: 3600, null: false
+ end
+end
diff --git a/db/migrate/20210830085837_add_throttle_authenticated_git_lfs_columns.rb b/db/migrate/20210830085837_add_throttle_authenticated_git_lfs_columns.rb
new file mode 100644
index 00000000000..bc515bc061c
--- /dev/null
+++ b/db/migrate/20210830085837_add_throttle_authenticated_git_lfs_columns.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class AddThrottleAuthenticatedGitLfsColumns < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ add_column :application_settings, :throttle_authenticated_git_lfs_requests_per_period, :integer, default: 1000, null: false
+ add_column :application_settings, :throttle_authenticated_git_lfs_period_in_seconds, :integer, default: 60, null: false
+ add_column :application_settings, :throttle_authenticated_git_lfs_enabled, :boolean, default: false, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :application_settings, :throttle_authenticated_git_lfs_requests_per_period
+ remove_column :application_settings, :throttle_authenticated_git_lfs_period_in_seconds
+ remove_column :application_settings, :throttle_authenticated_git_lfs_enabled, :boolean
+ end
+ end
+end
diff --git a/db/migrate/20210830140524_add_state_to_member.rb b/db/migrate/20210830140524_add_state_to_member.rb
new file mode 100644
index 00000000000..6009376badb
--- /dev/null
+++ b/db/migrate/20210830140524_add_state_to_member.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddStateToMember < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ unless column_exists?(:members, :state)
+ with_lock_retries do
+ add_column :members, :state, :integer, limit: 2, default: 0
+ end
+ end
+ end
+
+ def down
+ if column_exists?(:members, :state)
+ with_lock_retries do
+ remove_column :members, :state
+ end
+ end
+ end
+end
diff --git a/db/migrate/20210830154358_add_yaml_limit_constraints.rb b/db/migrate/20210830154358_add_yaml_limit_constraints.rb
new file mode 100644
index 00000000000..74236993fff
--- /dev/null
+++ b/db/migrate/20210830154358_add_yaml_limit_constraints.rb
@@ -0,0 +1,25 @@
+# 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 AddYamlLimitConstraints < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ SIZE_CONSTRAINT_NAME = 'app_settings_yaml_max_size_positive'
+ DEPTH_CONSTRAINT_NAME = 'app_settings_yaml_max_depth_positive'
+
+ disable_ddl_transaction!
+
+ def up
+ add_check_constraint :application_settings, 'max_yaml_size_bytes > 0', SIZE_CONSTRAINT_NAME
+ add_check_constraint :application_settings, 'max_yaml_depth > 0', DEPTH_CONSTRAINT_NAME
+ end
+
+ def down
+ remove_check_constraint :application_settings, SIZE_CONSTRAINT_NAME
+ remove_check_constraint :application_settings, DEPTH_CONSTRAINT_NAME
+ end
+end
diff --git a/db/migrate/20210831134840_add_package_file_id_channel_idx_to_packages_helm_file_metadata.rb b/db/migrate/20210831134840_add_package_file_id_channel_idx_to_packages_helm_file_metadata.rb
new file mode 100644
index 00000000000..a3366bd9ddb
--- /dev/null
+++ b/db/migrate/20210831134840_add_package_file_id_channel_idx_to_packages_helm_file_metadata.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddPackageFileIdChannelIdxToPackagesHelmFileMetadata < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_packages_helm_file_metadata_on_pf_id_and_channel'
+
+ def up
+ add_concurrent_index :packages_helm_file_metadata, [:package_file_id, :channel], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :packages_helm_file_metadata, [:package_file_id, :channel], name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210831135249_add_installable_helm_pkgs_idx_to_packages.rb b/db/migrate/20210831135249_add_installable_helm_pkgs_idx_to_packages.rb
new file mode 100644
index 00000000000..5e65b5c0fe1
--- /dev/null
+++ b/db/migrate/20210831135249_add_installable_helm_pkgs_idx_to_packages.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddInstallableHelmPkgsIdxToPackages < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'idx_installable_helm_pkgs_on_project_id_id'
+
+ def up
+ add_concurrent_index :packages_packages, [:project_id, :id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :packages_packages, [:project_id, :id], name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210831203408_upsert_base_work_item_types.rb b/db/migrate/20210831203408_upsert_base_work_item_types.rb
new file mode 100644
index 00000000000..314412d8d3d
--- /dev/null
+++ b/db/migrate/20210831203408_upsert_base_work_item_types.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class UpsertBaseWorkItemTypes < ActiveRecord::Migration[6.1]
+ module WorkItem
+ class Type < ActiveRecord::Base
+ self.table_name = 'work_item_types'
+
+ enum base_type: {
+ issue: 0,
+ incident: 1,
+ test_case: 2,
+ requirement: 3
+ }
+ end
+ end
+
+ def up
+ # upsert default types
+ WorkItem::Type.find_or_create_by(name: 'Issue', namespace_id: nil, base_type: :issue, icon_name: 'issue-type-issue')
+ WorkItem::Type.find_or_create_by(name: 'Incident', namespace_id: nil, base_type: :incident, icon_name: 'issue-type-incident')
+ WorkItem::Type.find_or_create_by(name: 'Test Case', namespace_id: nil, base_type: :test_case, icon_name: 'issue-type-test-case')
+ WorkItem::Type.find_or_create_by(name: 'Requirement', namespace_id: nil, base_type: :requirement, icon_name: 'issue-type-requirements')
+ end
+
+ def down
+ # We expect this table to be empty at the point of the up migration,
+ # however there is a remote possibility that issues could already be
+ # using one of these types, with a tight foreign constraint.
+ # Therefore we will not attempt to remove any data.
+ end
+end
diff --git a/db/migrate/20210901065504_add_index_on_name_and_id_to_public_groups.rb b/db/migrate/20210901065504_add_index_on_name_and_id_to_public_groups.rb
new file mode 100644
index 00000000000..77b9e5297a7
--- /dev/null
+++ b/db/migrate/20210901065504_add_index_on_name_and_id_to_public_groups.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexOnNameAndIdToPublicGroups < Gitlab::Database::Migration[1.0]
+ INDEX_NAME = 'index_namespaces_public_groups_name_id'
+ PUBLIC_VISIBILITY_LEVEL = 20
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :namespaces, [:name, :id], name: INDEX_NAME,
+ where: "type = 'Group' AND visibility_level = #{PUBLIC_VISIBILITY_LEVEL}"
+ end
+
+ def down
+ remove_concurrent_index_by_name :namespaces, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210902171406_add_latest_column_into_the_security_scans_table.rb b/db/migrate/20210902171406_add_latest_column_into_the_security_scans_table.rb
new file mode 100644
index 00000000000..3c022cbaf5e
--- /dev/null
+++ b/db/migrate/20210902171406_add_latest_column_into_the_security_scans_table.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddLatestColumnIntoTheSecurityScansTable < Gitlab::Database::Migration[1.0]
+ enable_lock_retries!
+
+ def up
+ add_column :security_scans, :latest, :boolean, default: true, null: false
+ end
+
+ def down
+ remove_column :security_scans, :latest
+ end
+end
diff --git a/db/migrate/20210902171808_set_default_job_token_scope_false.rb b/db/migrate/20210902171808_set_default_job_token_scope_false.rb
new file mode 100644
index 00000000000..0680382094f
--- /dev/null
+++ b/db/migrate/20210902171808_set_default_job_token_scope_false.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class SetDefaultJobTokenScopeFalse < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ change_column_default :project_ci_cd_settings, :job_token_scope_enabled, from: true, to: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ change_column_default :project_ci_cd_settings, :job_token_scope_enabled, from: false, to: true
+ end
+ end
+end
diff --git a/db/migrate/20210902184334_add_expire_access_tokens_to_doorkeeper_application.rb b/db/migrate/20210902184334_add_expire_access_tokens_to_doorkeeper_application.rb
new file mode 100644
index 00000000000..4638637331d
--- /dev/null
+++ b/db/migrate/20210902184334_add_expire_access_tokens_to_doorkeeper_application.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddExpireAccessTokensToDoorkeeperApplication < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :oauth_applications, :expire_access_tokens, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20210903054158_recreate_stage_issue_events_table_with_bigints.rb b/db/migrate/20210903054158_recreate_stage_issue_events_table_with_bigints.rb
new file mode 100644
index 00000000000..6c5d23d8703
--- /dev/null
+++ b/db/migrate/20210903054158_recreate_stage_issue_events_table_with_bigints.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+
+class RecreateStageIssueEventsTableWithBigints < Gitlab::Database::Migration[1.0]
+ include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers
+
+ def up
+ drop_table :analytics_cycle_analytics_issue_stage_events # rubocop:disable Migration/DropTable
+
+ execute <<~SQL
+ CREATE TABLE analytics_cycle_analytics_issue_stage_events (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone,
+ PRIMARY KEY (stage_event_hash_id, issue_id)
+ ) PARTITION BY HASH (stage_event_hash_id)
+ SQL
+
+ create_hash_partitions :analytics_cycle_analytics_issue_stage_events, 32
+ end
+
+ def down
+ drop_table :analytics_cycle_analytics_issue_stage_events
+
+ execute <<~SQL
+ CREATE TABLE analytics_cycle_analytics_issue_stage_events (
+ stage_event_hash_id integer NOT NULL,
+ issue_id integer NOT NULL,
+ group_id integer NOT NULL,
+ project_id integer NOT NULL,
+ milestone_id integer,
+ author_id integer,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone,
+ PRIMARY KEY (stage_event_hash_id, issue_id)
+ ) PARTITION BY HASH (stage_event_hash_id)
+ SQL
+
+ create_hash_partitions :analytics_cycle_analytics_issue_stage_events, 32
+ end
+end
diff --git a/db/migrate/20210906100021_delete_project_namespace_trigger.rb b/db/migrate/20210906100021_delete_project_namespace_trigger.rb
new file mode 100644
index 00000000000..ce68cf7d6d4
--- /dev/null
+++ b/db/migrate/20210906100021_delete_project_namespace_trigger.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class DeleteProjectNamespaceTrigger < Gitlab::Database::Migration[1.0]
+ include Gitlab::Database::SchemaHelpers
+
+ TRIGGER_NAME = "trigger_delete_project_namespace_on_project_delete"
+ FUNCTION_NAME = 'delete_associated_project_namespace'
+
+ def up
+ create_trigger_function(FUNCTION_NAME, replace: true) do
+ <<~SQL
+ DELETE FROM namespaces
+ WHERE namespaces.id = OLD.project_namespace_id AND
+ namespaces.type = 'Project';
+ RETURN NULL;
+ SQL
+ end
+
+ execute(<<~SQL.squish)
+ CREATE TRIGGER #{TRIGGER_NAME}
+ AFTER DELETE ON projects FOR EACH ROW
+ WHEN (OLD.project_namespace_id IS NOT NULL)
+ EXECUTE FUNCTION #{FUNCTION_NAME}();
+ SQL
+ end
+
+ def down
+ drop_trigger(:projects, TRIGGER_NAME)
+ drop_function(FUNCTION_NAME)
+ end
+end
diff --git a/db/migrate/20210907182337_add_group_id_fkey_for_user_group_callout.rb b/db/migrate/20210907182337_add_group_id_fkey_for_user_group_callout.rb
new file mode 100644
index 00000000000..540344bd761
--- /dev/null
+++ b/db/migrate/20210907182337_add_group_id_fkey_for_user_group_callout.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddGroupIdFkeyForUserGroupCallout < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :user_group_callouts, :namespaces, column: :group_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :user_group_callouts, column: :group_id
+ end
+ end
+end
diff --git a/db/migrate/20210907182359_add_user_id_fkey_for_user_group_callout.rb b/db/migrate/20210907182359_add_user_id_fkey_for_user_group_callout.rb
new file mode 100644
index 00000000000..37b73335933
--- /dev/null
+++ b/db/migrate/20210907182359_add_user_id_fkey_for_user_group_callout.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddUserIdFkeyForUserGroupCallout < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :user_group_callouts, :users, column: :user_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :user_group_callouts, column: :user_id
+ end
+ end
+end
diff --git a/db/migrate/20210908060951_add_dast_schedules_to_plan_limits.rb b/db/migrate/20210908060951_add_dast_schedules_to_plan_limits.rb
new file mode 100644
index 00000000000..85c7522d006
--- /dev/null
+++ b/db/migrate/20210908060951_add_dast_schedules_to_plan_limits.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddDastSchedulesToPlanLimits < Gitlab::Database::Migration[1.0]
+ def change
+ add_column(:plan_limits, :dast_profile_schedules, :integer, default: 1, null: false)
+ end
+end
diff --git a/db/migrate/20210908061132_insert_dast_profile_schedules_plan_limits.rb b/db/migrate/20210908061132_insert_dast_profile_schedules_plan_limits.rb
new file mode 100644
index 00000000000..b9980f65c98
--- /dev/null
+++ b/db/migrate/20210908061132_insert_dast_profile_schedules_plan_limits.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class InsertDastProfileSchedulesPlanLimits < Gitlab::Database::Migration[1.0]
+ def up
+ create_or_update_plan_limit('dast_profile_schedules', 'default', 0)
+ create_or_update_plan_limit('dast_profile_schedules', 'free', 1)
+ create_or_update_plan_limit('dast_profile_schedules', 'bronze', 1)
+ create_or_update_plan_limit('dast_profile_schedules', 'silver', 1)
+ create_or_update_plan_limit('dast_profile_schedules', 'premium', 1)
+ create_or_update_plan_limit('dast_profile_schedules', 'premium_trial', 1)
+ create_or_update_plan_limit('dast_profile_schedules', 'gold', 20)
+ create_or_update_plan_limit('dast_profile_schedules', 'ultimate', 20)
+ create_or_update_plan_limit('dast_profile_schedules', 'ultimate_trial', 20)
+ end
+
+ def down
+ create_or_update_plan_limit('dast_profile_schedules', 'default', 0)
+ create_or_update_plan_limit('dast_profile_schedules', 'free', 0)
+ create_or_update_plan_limit('dast_profile_schedules', 'bronze', 0)
+ create_or_update_plan_limit('dast_profile_schedules', 'silver', 0)
+ create_or_update_plan_limit('dast_profile_schedules', 'premium', 0)
+ create_or_update_plan_limit('dast_profile_schedules', 'premium_trial', 0)
+ create_or_update_plan_limit('dast_profile_schedules', 'gold', 0)
+ create_or_update_plan_limit('dast_profile_schedules', 'ultimate', 0)
+ create_or_update_plan_limit('dast_profile_schedules', 'ultimate_trial', 0)
+ end
+end
diff --git a/db/migrate/20210908100810_add_jobs_per_stage_page_size_to_application_settings.rb b/db/migrate/20210908100810_add_jobs_per_stage_page_size_to_application_settings.rb
new file mode 100644
index 00000000000..81a76ecb10a
--- /dev/null
+++ b/db/migrate/20210908100810_add_jobs_per_stage_page_size_to_application_settings.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddJobsPerStagePageSizeToApplicationSettings < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :application_settings, :jobs_per_stage_page_size, :integer, default: 200, null: false
+ end
+end
diff --git a/db/migrate/20210908140437_add_sidekiq_limits_to_application_settings.rb b/db/migrate/20210908140437_add_sidekiq_limits_to_application_settings.rb
new file mode 100644
index 00000000000..dd0796a1c86
--- /dev/null
+++ b/db/migrate/20210908140437_add_sidekiq_limits_to_application_settings.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddSidekiqLimitsToApplicationSettings < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction! # needed for now to avoid subtransactions
+
+ def up
+ with_lock_retries do
+ add_column :application_settings, :sidekiq_job_limiter_mode, :smallint, default: 1, null: false
+ add_column :application_settings, :sidekiq_job_limiter_compression_threshold_bytes, :integer, default: 100_000, null: false
+ add_column :application_settings, :sidekiq_job_limiter_limit_bytes, :integer, default: 0, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :application_settings, :sidekiq_job_limiter_mode
+ remove_column :application_settings, :sidekiq_job_limiter_compression_threshold_bytes
+ remove_column :application_settings, :sidekiq_job_limiter_limit_bytes
+ end
+ end
+end
diff --git a/db/migrate/20210908185736_add_status_to_dependency_proxy_manifests.rb b/db/migrate/20210908185736_add_status_to_dependency_proxy_manifests.rb
new file mode 100644
index 00000000000..b8e7c7af144
--- /dev/null
+++ b/db/migrate/20210908185736_add_status_to_dependency_proxy_manifests.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddStatusToDependencyProxyManifests < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :dependency_proxy_manifests, :status, :smallint, default: 0, null: false
+ end
+end
diff --git a/db/migrate/20210908185754_add_status_to_dependency_proxy_blobs.rb b/db/migrate/20210908185754_add_status_to_dependency_proxy_blobs.rb
new file mode 100644
index 00000000000..4fbdcad33cd
--- /dev/null
+++ b/db/migrate/20210908185754_add_status_to_dependency_proxy_blobs.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddStatusToDependencyProxyBlobs < Gitlab::Database::Migration[1.0]
+ def change
+ add_column :dependency_proxy_blobs, :status, :smallint, default: 0, null: false
+ end
+end
diff --git a/db/migrate/20210909184349_add_index_package_id_id_on_package_files.rb b/db/migrate/20210909184349_add_index_package_id_id_on_package_files.rb
new file mode 100644
index 00000000000..38d9c4b5dd9
--- /dev/null
+++ b/db/migrate/20210909184349_add_index_package_id_id_on_package_files.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexPackageIdIdOnPackageFiles < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_packages_package_files_on_package_id_id'
+
+ def up
+ disable_statement_timeout do
+ execute "CREATE INDEX CONCURRENTLY #{INDEX_NAME} ON packages_package_files (package_id, id)" unless index_exists_by_name?(:package_package_files, INDEX_NAME)
+ end
+ end
+
+ def down
+ remove_concurrent_index_by_name :packages_package_files, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210910141043_change_ci_minutes_additional_pack_text_limit.rb b/db/migrate/20210910141043_change_ci_minutes_additional_pack_text_limit.rb
new file mode 100644
index 00000000000..ebb0de53d6a
--- /dev/null
+++ b/db/migrate/20210910141043_change_ci_minutes_additional_pack_text_limit.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class ChangeCiMinutesAdditionalPackTextLimit < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ remove_text_limit :ci_minutes_additional_packs, :purchase_xid
+ add_text_limit :ci_minutes_additional_packs, :purchase_xid, 50
+ end
+
+ def down
+ remove_text_limit :ci_minutes_additional_packs, :purchase_xid
+ add_text_limit :ci_minutes_additional_packs, :purchase_xid, 32, validate: false
+ end
+end
diff --git a/db/migrate/20210913010411_create_agent_project_authorizations.rb b/db/migrate/20210913010411_create_agent_project_authorizations.rb
new file mode 100644
index 00000000000..02b6ac677e0
--- /dev/null
+++ b/db/migrate/20210913010411_create_agent_project_authorizations.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class CreateAgentProjectAuthorizations < Gitlab::Database::Migration[1.0]
+ def change
+ create_table :agent_project_authorizations do |t|
+ t.bigint :project_id, null: false
+ t.bigint :agent_id, null: false
+ t.jsonb :config, null: false
+
+ t.index :project_id
+ t.index [:agent_id, :project_id], unique: true
+ end
+ end
+end
diff --git a/db/migrate/20210913010432_add_agent_project_authorizations_foreign_keys.rb b/db/migrate/20210913010432_add_agent_project_authorizations_foreign_keys.rb
new file mode 100644
index 00000000000..545fc125950
--- /dev/null
+++ b/db/migrate/20210913010432_add_agent_project_authorizations_foreign_keys.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddAgentProjectAuthorizationsForeignKeys < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :agent_project_authorizations, :projects, column: :project_id
+ add_concurrent_foreign_key :agent_project_authorizations, :cluster_agents, column: :agent_id
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :agent_project_authorizations, column: :project_id
+ end
+
+ with_lock_retries do
+ remove_foreign_key_if_exists :agent_project_authorizations, column: :agent_id
+ end
+ end
+end
diff --git a/db/migrate/20210913122457_add_namespace_traversal_ids_to_ci_pending_builds.rb b/db/migrate/20210913122457_add_namespace_traversal_ids_to_ci_pending_builds.rb
new file mode 100644
index 00000000000..9dd420604f4
--- /dev/null
+++ b/db/migrate/20210913122457_add_namespace_traversal_ids_to_ci_pending_builds.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddNamespaceTraversalIdsToCiPendingBuilds < Gitlab::Database::Migration[1.0]
+ enable_lock_retries!
+
+ def change
+ add_column :ci_pending_builds, :namespace_traversal_ids, :integer, array: true, default: []
+ end
+end
diff --git a/db/post_migrate/20201106134950_deduplicate_epic_iids.rb b/db/post_migrate/20201106134950_deduplicate_epic_iids.rb
index bc7daf9329d..8fddc81057b 100644
--- a/db/post_migrate/20201106134950_deduplicate_epic_iids.rb
+++ b/db/post_migrate/20201106134950_deduplicate_epic_iids.rb
@@ -85,7 +85,7 @@ class DeduplicateEpicIids < ActiveRecord::Migration[6.0]
instance = subject.is_a?(::Class) ? nil : subject
- subject.transaction(requires_new: true) do
+ subject.transaction(requires_new: true) do # rubocop:disable Performance/ActiveRecordSubtransactions
InternalId.create!(
**scope,
usage: usage_value,
diff --git a/db/post_migrate/20210622045705_finalize_events_bigint_conversion.rb b/db/post_migrate/20210622045705_finalize_events_bigint_conversion.rb
new file mode 100644
index 00000000000..b99a61e8e63
--- /dev/null
+++ b/db/post_migrate/20210622045705_finalize_events_bigint_conversion.rb
@@ -0,0 +1,86 @@
+# frozen_string_literal: true
+
+class FinalizeEventsBigintConversion < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'events'
+
+ def up
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
+ table_name: TABLE_NAME,
+ column_name: 'id',
+ job_arguments: [["id"], ["id_convert_to_bigint"]]
+ )
+
+ swap
+ end
+
+ def down
+ swap
+ end
+
+ private
+
+ def swap
+ # This is to replace the existing "events_pkey" PRIMARY KEY, btree (id)
+ add_concurrent_index TABLE_NAME, :id_convert_to_bigint, unique: true, name: 'index_events_on_id_convert_to_bigint'
+ # This is to replace the existing "index_events_on_project_id_and_id" btree (project_id, id)
+ add_concurrent_index TABLE_NAME, [:project_id, :id_convert_to_bigint], name: 'index_events_on_project_id_and_id_convert_to_bigint'
+ # This is to replace the existing "index_events_on_project_id_and_id_desc_on_merged_action" btree (project_id, id DESC) WHERE action = 7
+ add_concurrent_index TABLE_NAME, [:project_id, :id_convert_to_bigint], order: { id_convert_to_bigint: :desc },
+ where: "action = 7", name: 'index_events_on_project_id_and_id_bigint_desc_on_merged_action'
+
+ # Add a FK on `push_event_payloads(event_id)` to `id_convert_to_bigint`, the old FK (fk_36c74129da)
+ # will be removed when events_pkey constraint is droppped.
+ fk_event_id = concurrent_foreign_key_name(:push_event_payloads, :event_id)
+ fk_event_id_tmp = "#{fk_event_id}_tmp"
+ add_concurrent_foreign_key :push_event_payloads, TABLE_NAME,
+ column: :event_id, target_column: :id_convert_to_bigint,
+ name: fk_event_id_tmp, on_delete: :cascade, reverse_lock_order: true
+
+ with_lock_retries(raise_on_exhaustion: true) do
+ # We'll need ACCESS EXCLUSIVE lock on the related tables,
+ # lets make sure it can be acquired from the start.
+ # Lock order should be
+ # 1. events
+ # 2. push_event_payloads
+ # in order to match the order in EventCreateService#create_push_event,
+ # and avoid deadlocks.
+ execute "LOCK TABLE #{TABLE_NAME}, push_event_payloads IN ACCESS EXCLUSIVE MODE"
+
+ # Swap column names
+ temp_name = 'id_tmp'
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(:id)} TO #{quote_column_name(temp_name)}"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(:id_convert_to_bigint)} TO #{quote_column_name(:id)}"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(temp_name)} TO #{quote_column_name(:id_convert_to_bigint)}"
+
+ # We need to update the trigger function in order to make PostgreSQL to
+ # regenerate the execution plan for it. This is to avoid type mismatch errors like
+ # "type of parameter 15 (bigint) does not match that when preparing the plan (integer)"
+ function_name = Gitlab::Database::UnidirectionalCopyTrigger.on_table(TABLE_NAME).name(:id, :id_convert_to_bigint)
+ execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL"
+
+ # Swap defaults
+ execute "ALTER SEQUENCE events_id_seq OWNED BY #{TABLE_NAME}.id"
+ change_column_default TABLE_NAME, :id, -> { "nextval('events_id_seq'::regclass)" }
+ change_column_default TABLE_NAME, :id_convert_to_bigint, 0
+
+ # Swap PK constraint
+ execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT events_pkey CASCADE" # this will drop fk_36c74129da
+ rename_index TABLE_NAME, 'index_events_on_id_convert_to_bigint', 'events_pkey'
+ execute "ALTER TABLE #{TABLE_NAME} ADD CONSTRAINT events_pkey PRIMARY KEY USING INDEX events_pkey"
+
+ # Rename the rest of the indexes (we already hold an exclusive lock, so no need to use DROP INDEX CONCURRENTLY here
+ execute 'DROP INDEX index_events_on_project_id_and_id'
+ rename_index TABLE_NAME, 'index_events_on_project_id_and_id_convert_to_bigint', 'index_events_on_project_id_and_id'
+ execute 'DROP INDEX index_events_on_project_id_and_id_desc_on_merged_action'
+ rename_index TABLE_NAME, 'index_events_on_project_id_and_id_bigint_desc_on_merged_action', 'index_events_on_project_id_and_id_desc_on_merged_action'
+
+ # Change the name of the temporary FK
+ rename_constraint(:push_event_payloads, fk_event_id_tmp, fk_event_id)
+ end
+ end
+end
diff --git a/db/post_migrate/20210701141346_finalize_ci_builds_stage_id_bigint_conversion.rb b/db/post_migrate/20210701141346_finalize_ci_builds_stage_id_bigint_conversion.rb
new file mode 100644
index 00000000000..a8a9fe037ec
--- /dev/null
+++ b/db/post_migrate/20210701141346_finalize_ci_builds_stage_id_bigint_conversion.rb
@@ -0,0 +1,65 @@
+# frozen_string_literal: true
+
+class FinalizeCiBuildsStageIdBigintConversion < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'ci_builds'
+
+ def up
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
+ table_name: TABLE_NAME,
+ column_name: 'id',
+ job_arguments: [%w[id stage_id], %w[id_convert_to_bigint stage_id_convert_to_bigint]]
+ )
+
+ swap_columns
+ end
+
+ def down
+ swap_columns
+ end
+
+ private
+
+ def swap_columns
+ # Create a copy of the original column's index on the new column
+ add_concurrent_index TABLE_NAME, :stage_id_convert_to_bigint, name: :index_ci_builds_on_converted_stage_id # rubocop:disable Migration/PreventIndexCreation
+
+ # Create a copy of the original column's FK on the new column
+ add_concurrent_foreign_key TABLE_NAME, :ci_stages, column: :stage_id_convert_to_bigint, on_delete: :cascade,
+ reverse_lock_order: true
+
+ with_lock_retries(raise_on_exhaustion: true) do
+ quoted_table_name = quote_table_name(TABLE_NAME)
+ quoted_referenced_table_name = quote_table_name(:ci_stages)
+
+ # Acquire locks up-front, not just to the build table but the FK's referenced table
+ execute "LOCK TABLE #{quoted_referenced_table_name}, #{quoted_table_name} IN ACCESS EXCLUSIVE MODE"
+
+ # Swap the column names of the two columns
+ temporary_name = 'stage_id_tmp'
+ execute "ALTER TABLE #{quoted_table_name} RENAME COLUMN #{quote_column_name(:stage_id)} TO #{quote_column_name(temporary_name)}"
+ execute "ALTER TABLE #{quoted_table_name} RENAME COLUMN #{quote_column_name(:stage_id_convert_to_bigint)} TO #{quote_column_name(:stage_id)}"
+ execute "ALTER TABLE #{quoted_table_name} RENAME COLUMN #{quote_column_name(temporary_name)} TO #{quote_column_name(:stage_id_convert_to_bigint)}"
+
+ # Reset the function so PG drops the plan cache for the incorrect integer type
+ function_name = Gitlab::Database::UnidirectionalCopyTrigger.on_table(TABLE_NAME)
+ .name([:id, :stage_id], [:id_convert_to_bigint, :stage_id_convert_to_bigint])
+ execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL"
+
+ # Remove the original column index, and rename the new column index to the original name
+ execute 'DROP INDEX index_ci_builds_on_stage_id'
+ rename_index TABLE_NAME, :index_ci_builds_on_converted_stage_id, :index_ci_builds_on_stage_id
+
+ # Remove the original column foreign key, and rename the new column foreign key to the original name
+ remove_foreign_key TABLE_NAME, name: concurrent_foreign_key_name(TABLE_NAME, :stage_id)
+ rename_constraint(
+ TABLE_NAME,
+ concurrent_foreign_key_name(TABLE_NAME, :stage_id_convert_to_bigint),
+ concurrent_foreign_key_name(TABLE_NAME, :stage_id))
+ end
+ end
+end
diff --git a/db/post_migrate/20210706112800_remove_cloud_license_enabled_from_application_settings.rb b/db/post_migrate/20210706112800_remove_cloud_license_enabled_from_application_settings.rb
new file mode 100644
index 00000000000..7224e84c1b3
--- /dev/null
+++ b/db/post_migrate/20210706112800_remove_cloud_license_enabled_from_application_settings.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class RemoveCloudLicenseEnabledFromApplicationSettings < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_column :application_settings, :cloud_license_enabled
+ end
+ end
+
+ def down
+ with_lock_retries do
+ add_column :application_settings, :cloud_license_enabled, :boolean, null: false, default: false
+ end
+ end
+end
diff --git a/db/post_migrate/20210708011426_finalize_ci_builds_metadata_bigint_conversion.rb b/db/post_migrate/20210708011426_finalize_ci_builds_metadata_bigint_conversion.rb
new file mode 100644
index 00000000000..f75df04ba48
--- /dev/null
+++ b/db/post_migrate/20210708011426_finalize_ci_builds_metadata_bigint_conversion.rb
@@ -0,0 +1,113 @@
+# frozen_string_literal: true
+
+class FinalizeCiBuildsMetadataBigintConversion < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'ci_builds_metadata'
+
+ def up
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
+ table_name: TABLE_NAME,
+ column_name: 'id',
+ job_arguments: [["id"], ["id_convert_to_bigint"]]
+ )
+
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
+ table_name: TABLE_NAME,
+ column_name: 'id',
+ job_arguments: [["build_id"], ["build_id_convert_to_bigint"]]
+ )
+
+ swap
+ end
+
+ def down
+ swap
+ end
+
+ private
+
+ def swap
+ # Indexes were pre-created on gitlab.com to avoid slowing down deployments
+ #
+ # rubocop:disable Migration/PreventIndexCreation
+ add_concurrent_index TABLE_NAME, :id_convert_to_bigint, unique: true, name: 'index_ci_builds_metadata_on_id_convert_to_bigint'
+ add_concurrent_index TABLE_NAME, :build_id_convert_to_bigint, where: 'has_exposed_artifacts IS TRUE', name: 'index_ci_builds_metadata_on_build_id_int8_and_exposed_artifacts'
+ create_covering_index TABLE_NAME, 'index_ci_builds_metadata_on_build_id_int8_where_interruptible'
+ add_concurrent_index TABLE_NAME, :build_id_convert_to_bigint, unique: true, name: 'index_ci_builds_metadata_on_build_id_convert_to_bigint'
+ # rubocop:enable Migration/PreventIndexCreation
+
+ add_concurrent_foreign_key TABLE_NAME, :ci_builds, column: :build_id_convert_to_bigint, on_delete: :cascade,
+ reverse_lock_order: true
+
+ with_lock_retries(raise_on_exhaustion: true) do
+ execute "LOCK TABLE ci_builds, #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE"
+
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ swap_column :id
+ swap_column :build_id
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+
+ # We need to update the trigger function in order to make PostgreSQL to
+ # regenerate the execution plan for it. This is to avoid type mismatch errors like
+ # "type of parameter 15 (bigint) does not match that when preparing the plan (integer)"
+ execute "ALTER FUNCTION #{quote_table_name(Gitlab::Database::UnidirectionalCopyTrigger.on_table(TABLE_NAME).name(:id, :id_convert_to_bigint))} RESET ALL"
+ execute "ALTER FUNCTION #{quote_table_name(Gitlab::Database::UnidirectionalCopyTrigger.on_table(TABLE_NAME).name(:build_id, :build_id_convert_to_bigint))} RESET ALL"
+
+ # Swap defaults for PK
+ execute "ALTER SEQUENCE ci_builds_metadata_id_seq OWNED BY #{TABLE_NAME}.id"
+ change_column_default TABLE_NAME, :id, -> { "nextval('ci_builds_metadata_id_seq'::regclass)" }
+ change_column_default TABLE_NAME, :id_convert_to_bigint, 0
+
+ # Swap defaults for FK
+ change_column_default TABLE_NAME, :build_id, nil
+ change_column_default TABLE_NAME, :build_id_convert_to_bigint, 0
+
+ # Swap PK constraint
+ execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT ci_builds_metadata_pkey CASCADE"
+ rename_index TABLE_NAME, 'index_ci_builds_metadata_on_id_convert_to_bigint', 'ci_builds_metadata_pkey'
+ execute "ALTER TABLE #{TABLE_NAME} ADD CONSTRAINT ci_builds_metadata_pkey PRIMARY KEY USING INDEX ci_builds_metadata_pkey"
+
+ # Rename the rest of the indexes (we already hold an exclusive lock, so no need to use DROP INDEX CONCURRENTLY here)
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ swap_index 'index_ci_builds_metadata_on_build_id', 'index_ci_builds_metadata_on_build_id_convert_to_bigint'
+ swap_index 'index_ci_builds_metadata_on_build_id_and_has_exposed_artifacts', 'index_ci_builds_metadata_on_build_id_int8_and_exposed_artifacts'
+ swap_index 'index_ci_builds_metadata_on_build_id_and_id_and_interruptible', 'index_ci_builds_metadata_on_build_id_int8_where_interruptible'
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+
+ # Swap FK constraint
+ remove_foreign_key TABLE_NAME, name: concurrent_foreign_key_name(TABLE_NAME, :build_id)
+ rename_constraint(
+ TABLE_NAME,
+ concurrent_foreign_key_name(TABLE_NAME, :build_id_convert_to_bigint),
+ concurrent_foreign_key_name(TABLE_NAME, :build_id)
+ )
+ end
+ end
+
+ def swap_index(old, new)
+ execute "DROP INDEX #{old}"
+ rename_index TABLE_NAME, new, old
+ end
+
+ def swap_column(name)
+ temp_name = "#{name}_tmp"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(name)} TO #{quote_column_name(temp_name)}"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(:"#{name}_convert_to_bigint")} TO #{quote_column_name(name)}"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(temp_name)} TO #{quote_column_name(:"#{name}_convert_to_bigint")}"
+ end
+
+ def create_covering_index(table, name)
+ return if index_exists_by_name?(table, name)
+
+ disable_statement_timeout do
+ execute <<~SQL
+ CREATE INDEX CONCURRENTLY #{name}
+ ON #{table} (build_id_convert_to_bigint) INCLUDE (id_convert_to_bigint)
+ WHERE interruptible = true
+ SQL
+ end
+ end
+end
diff --git a/db/post_migrate/20210721122840_remove_seat_link_enabled_from_application_settings.rb b/db/post_migrate/20210721122840_remove_seat_link_enabled_from_application_settings.rb
new file mode 100644
index 00000000000..20118dbbac8
--- /dev/null
+++ b/db/post_migrate/20210721122840_remove_seat_link_enabled_from_application_settings.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class RemoveSeatLinkEnabledFromApplicationSettings < ActiveRecord::Migration[6.1]
+ def up
+ remove_column :application_settings, :seat_link_enabled
+ end
+
+ def down
+ add_column :application_settings, :seat_link_enabled, :boolean, null: false, default: true
+ end
+end
diff --git a/db/post_migrate/20210730104800_schedule_extract_project_topics_into_separate_table.rb b/db/post_migrate/20210730104800_schedule_extract_project_topics_into_separate_table.rb
new file mode 100644
index 00000000000..3102561a129
--- /dev/null
+++ b/db/post_migrate/20210730104800_schedule_extract_project_topics_into_separate_table.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class ScheduleExtractProjectTopicsIntoSeparateTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ BATCH_SIZE = 1_000
+ DELAY_INTERVAL = 2.minutes
+ MIGRATION = 'ExtractProjectTopicsIntoSeparateTable'
+ INDEX_NAME = 'tmp_index_taggings_on_id_where_taggable_type_project'
+ INDEX_CONDITION = "taggable_type = 'Project'"
+
+ disable_ddl_transaction!
+
+ class Tagging < ActiveRecord::Base
+ include ::EachBatch
+
+ self.table_name = 'taggings'
+ end
+
+ def up
+ # this index is used in 20210730104800_schedule_extract_project_topics_into_separate_table
+ add_concurrent_index :taggings, :id, where: INDEX_CONDITION, name: INDEX_NAME # rubocop:disable Migration/PreventIndexCreation
+
+ queue_background_migration_jobs_by_range_at_intervals(
+ Tagging.where(taggable_type: 'Project'),
+ MIGRATION,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ track_jobs: true
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name :taggings, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210731132939_backfill_stage_event_hash.rb b/db/post_migrate/20210731132939_backfill_stage_event_hash.rb
new file mode 100644
index 00000000000..2c4dc904387
--- /dev/null
+++ b/db/post_migrate/20210731132939_backfill_stage_event_hash.rb
@@ -0,0 +1,115 @@
+# frozen_string_literal: true
+
+class BackfillStageEventHash < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ BATCH_SIZE = 100
+ EVENT_ID_IDENTIFIER_MAPPING = {
+ 1 => :issue_created,
+ 2 => :issue_first_mentioned_in_commit,
+ 3 => :issue_closed,
+ 4 => :issue_first_added_to_board,
+ 5 => :issue_first_associated_with_milestone,
+ 7 => :issue_last_edited,
+ 8 => :issue_label_added,
+ 9 => :issue_label_removed,
+ 10 => :issue_deployed_to_production,
+ 100 => :merge_request_created,
+ 101 => :merge_request_first_deployed_to_production,
+ 102 => :merge_request_last_build_finished,
+ 103 => :merge_request_last_build_started,
+ 104 => :merge_request_merged,
+ 105 => :merge_request_closed,
+ 106 => :merge_request_last_edited,
+ 107 => :merge_request_label_added,
+ 108 => :merge_request_label_removed,
+ 109 => :merge_request_first_commit_at,
+ 1000 => :code_stage_start,
+ 1001 => :issue_stage_end,
+ 1002 => :plan_stage_start
+ }.freeze
+
+ LABEL_BASED_EVENTS = Set.new([8, 9, 107, 108]).freeze
+
+ class GroupStage < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'analytics_cycle_analytics_group_stages'
+ end
+
+ class ProjectStage < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'analytics_cycle_analytics_project_stages'
+ end
+
+ class StageEventHash < ActiveRecord::Base
+ self.table_name = 'analytics_cycle_analytics_stage_event_hashes'
+ end
+
+ def up
+ GroupStage.reset_column_information
+ ProjectStage.reset_column_information
+ StageEventHash.reset_column_information
+
+ update_stage_table(GroupStage)
+ update_stage_table(ProjectStage)
+
+ add_not_null_constraint :analytics_cycle_analytics_group_stages, :stage_event_hash_id
+ add_not_null_constraint :analytics_cycle_analytics_project_stages, :stage_event_hash_id
+ end
+
+ def down
+ remove_not_null_constraint :analytics_cycle_analytics_group_stages, :stage_event_hash_id
+ remove_not_null_constraint :analytics_cycle_analytics_project_stages, :stage_event_hash_id
+ end
+
+ private
+
+ def update_stage_table(klass)
+ klass.each_batch(of: BATCH_SIZE) do |relation|
+ klass.transaction do
+ records = relation.where(stage_event_hash_id: nil).lock!.to_a # prevent concurrent modification (unlikely to happen)
+ records = delete_invalid_records(records)
+ next if records.empty?
+
+ hashes_by_stage = records.to_h { |stage| [stage, calculate_stage_events_hash(stage)] }
+ hashes = hashes_by_stage.values.uniq
+
+ StageEventHash.insert_all(hashes.map { |hash| { hash_sha256: hash } })
+
+ stage_event_hashes_by_hash = StageEventHash.where(hash_sha256: hashes).index_by(&:hash_sha256)
+ records.each do |stage|
+ stage.update!(stage_event_hash_id: stage_event_hashes_by_hash[hashes_by_stage[stage]].id)
+ end
+ end
+ end
+ end
+
+ def calculate_stage_events_hash(stage)
+ start_event_hash = calculate_event_hash(stage.start_event_identifier, stage.start_event_label_id)
+ end_event_hash = calculate_event_hash(stage.end_event_identifier, stage.end_event_label_id)
+
+ Digest::SHA256.hexdigest("#{start_event_hash}-#{end_event_hash}")
+ end
+
+ def calculate_event_hash(event_identifier, label_id = nil)
+ str = EVENT_ID_IDENTIFIER_MAPPING.fetch(event_identifier).to_s
+ str << "-#{label_id}" if LABEL_BASED_EVENTS.include?(event_identifier)
+
+ Digest::SHA256.hexdigest(str)
+ end
+
+ # Invalid records are safe to delete, since they are not working properly anyway
+ def delete_invalid_records(records)
+ to_be_deleted = records.select do |record|
+ EVENT_ID_IDENTIFIER_MAPPING[record.start_event_identifier].nil? ||
+ EVENT_ID_IDENTIFIER_MAPPING[record.end_event_identifier].nil?
+ end
+
+ to_be_deleted.each(&:delete)
+ records - to_be_deleted
+ end
+end
diff --git a/db/post_migrate/20210806131706_finalize_taggins_bigint_conversion.rb b/db/post_migrate/20210806131706_finalize_taggins_bigint_conversion.rb
new file mode 100644
index 00000000000..beb15e77878
--- /dev/null
+++ b/db/post_migrate/20210806131706_finalize_taggins_bigint_conversion.rb
@@ -0,0 +1,88 @@
+# frozen_string_literal: true
+
+class FinalizeTagginsBigintConversion < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'taggings'
+
+ def up
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
+ table_name: TABLE_NAME,
+ column_name: 'id',
+ job_arguments: [%w[id taggable_id], %w[id_convert_to_bigint taggable_id_convert_to_bigint]]
+ )
+
+ swap
+ end
+
+ def down
+ swap
+ end
+
+ private
+
+ def swap
+ # rubocop:disable Migration/PreventIndexCreation
+ add_concurrent_index TABLE_NAME, :id_convert_to_bigint, unique: true, name: 'index_taggings_on_id_convert_to_bigint'
+
+ # This is to replace the existing "index_taggings_on_taggable_id_and_taggable_type" btree (taggable_id, taggable_type)
+ add_concurrent_index TABLE_NAME, [:taggable_id_convert_to_bigint, :taggable_type], name: 'i_taggings_on_taggable_id_convert_to_bigint_and_taggable_type'
+
+ # This is to replace the existing "index_taggings_on_taggable_id_and_taggable_type_and_context" btree (taggable_id, taggable_type, context)
+ add_concurrent_index TABLE_NAME, [:taggable_id_convert_to_bigint, :taggable_type, :context], name: 'i_taggings_on_taggable_bigint_and_taggable_type_and_context'
+
+ # This is to replace the existing "taggings_idx" btree (tag_id, taggable_id, taggable_type, context, tagger_id, tagger_type)
+ add_concurrent_index TABLE_NAME, [:tag_id, :taggable_id_convert_to_bigint, :taggable_type, :context, :tagger_id, :tagger_type], unique: true, name: 'taggings_idx_tmp'
+
+ # This is to replace the existing "tmp_index_taggings_on_id_where_taggable_type_project" btree (id) WHERE taggable_type::text = 'Project'::text
+ add_concurrent_index TABLE_NAME, :id_convert_to_bigint, where: "taggable_type = 'Project'", name: 'tmp_index_taggings_on_id_bigint_where_taggable_type_project'
+ # rubocop:enable Migration/PreventIndexCreation
+
+ with_lock_retries(raise_on_exhaustion: true) do
+ # We'll need ACCESS EXCLUSIVE lock on the related tables,
+ # lets make sure it can be acquired from the start
+ execute "LOCK TABLE #{TABLE_NAME} IN ACCESS EXCLUSIVE MODE"
+
+ # Swap column names
+ temp_name = 'taggable_id_tmp'
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(:taggable_id)} TO #{quote_column_name(temp_name)}"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(:taggable_id_convert_to_bigint)} TO #{quote_column_name(:taggable_id)}"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(temp_name)} TO #{quote_column_name(:taggable_id_convert_to_bigint)}"
+
+ temp_name = 'id_tmp'
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(:id)} TO #{quote_column_name(temp_name)}"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(:id_convert_to_bigint)} TO #{quote_column_name(:id)}"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(temp_name)} TO #{quote_column_name(:id_convert_to_bigint)}"
+
+ # We need to update the trigger function in order to make PostgreSQL to
+ # regenerate the execution plan for it. This is to avoid type mismatch errors like
+ # "type of parameter 15 (bigint) does not match that when preparing the plan (integer)"
+ function_name = Gitlab::Database::UnidirectionalCopyTrigger.on_table(TABLE_NAME).name([:id, :taggable_id], [:id_convert_to_bigint, :taggable_id_convert_to_bigint])
+ execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL"
+
+ # Swap defaults
+ execute "ALTER SEQUENCE taggings_id_seq OWNED BY #{TABLE_NAME}.id"
+ change_column_default TABLE_NAME, :id, -> { "nextval('taggings_id_seq'::regclass)" }
+ change_column_default TABLE_NAME, :id_convert_to_bigint, 0
+
+ # Swap PK constraint
+ execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT taggings_pkey CASCADE"
+ rename_index TABLE_NAME, 'index_taggings_on_id_convert_to_bigint', 'taggings_pkey'
+ execute "ALTER TABLE #{TABLE_NAME} ADD CONSTRAINT taggings_pkey PRIMARY KEY USING INDEX taggings_pkey"
+
+ # Rename the index on the `bigint` column to match the new column name
+ # (we already hold an exclusive lock, so no need to use DROP INDEX CONCURRENTLY here)
+ execute 'DROP INDEX index_taggings_on_taggable_id_and_taggable_type'
+ rename_index TABLE_NAME, 'i_taggings_on_taggable_id_convert_to_bigint_and_taggable_type', 'index_taggings_on_taggable_id_and_taggable_type'
+ execute 'DROP INDEX index_taggings_on_taggable_id_and_taggable_type_and_context'
+ rename_index TABLE_NAME, 'i_taggings_on_taggable_bigint_and_taggable_type_and_context', 'index_taggings_on_taggable_id_and_taggable_type_and_context'
+ execute 'DROP INDEX taggings_idx'
+ rename_index TABLE_NAME, 'taggings_idx_tmp', 'taggings_idx'
+ execute 'DROP INDEX tmp_index_taggings_on_id_where_taggable_type_project'
+ rename_index TABLE_NAME, 'tmp_index_taggings_on_id_bigint_where_taggable_type_project', 'tmp_index_taggings_on_id_where_taggable_type_project'
+ end
+ end
+end
diff --git a/db/post_migrate/20210813151908_replace_external_wiki_triggers.rb b/db/post_migrate/20210813151908_replace_external_wiki_triggers.rb
new file mode 100644
index 00000000000..d11baae42e2
--- /dev/null
+++ b/db/post_migrate/20210813151908_replace_external_wiki_triggers.rb
@@ -0,0 +1,66 @@
+# frozen_string_literal: true
+
+class ReplaceExternalWikiTriggers < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::SchemaHelpers
+
+ def up
+ replace_triggers('type_new', 'Integrations::ExternalWiki')
+
+ # we need an extra trigger to handle when type_new is updated by the
+ # `integrations_set_type_new` trigger.
+ # This can be removed when this trigger has been removed.
+ execute(<<~SQL.squish)
+ CREATE TRIGGER #{trigger_name(:type_new_updated)}
+ AFTER UPDATE OF type_new ON integrations FOR EACH ROW
+ WHEN ((new.type_new)::text = 'Integrations::ExternalWiki'::text AND new.project_id IS NOT NULL)
+ EXECUTE FUNCTION set_has_external_wiki();
+ SQL
+ end
+
+ def down
+ execute("DROP TRIGGER IF EXISTS #{trigger_name(:type_new_updated)} ON integrations;")
+ replace_triggers('type', 'ExternalWikiService')
+ end
+
+ private
+
+ def replace_triggers(column_name, value)
+ triggers(column_name, value).each do |event, condition|
+ trigger = trigger_name(event)
+
+ # create duplicate trigger, using the defined condition
+ execute(<<~SQL.squish)
+ CREATE TRIGGER #{trigger}_new AFTER #{event.upcase} ON integrations FOR EACH ROW
+ WHEN (#{condition})
+ EXECUTE FUNCTION set_has_external_wiki();
+ SQL
+
+ # Swap the triggers in place, so that the new trigger has the canonical name
+ execute("ALTER TRIGGER #{trigger} ON integrations RENAME TO #{trigger}_old;")
+ execute("ALTER TRIGGER #{trigger}_new ON integrations RENAME TO #{trigger};")
+
+ # remove the old, now redundant trigger
+ execute("DROP TRIGGER IF EXISTS #{trigger}_old ON integrations;")
+ end
+ end
+
+ def trigger_name(event)
+ "trigger_has_external_wiki_on_#{event}"
+ end
+
+ def triggers(column_name, value)
+ {
+ delete: "#{matches_value('old', column_name, value)} AND #{project_not_null('old')}",
+ insert: "(new.active = true) AND #{matches_value('new', column_name, value)} AND #{project_not_null('new')}",
+ update: "#{matches_value('new', column_name, value)} AND (old.active <> new.active) AND #{project_not_null('new')}"
+ }
+ end
+
+ def project_not_null(row)
+ "(#{row}.project_id IS NOT NULL)"
+ end
+
+ def matches_value(row, column_name, value)
+ "((#{row}.#{column_name})::text = '#{value}'::text)"
+ end
+end
diff --git a/db/post_migrate/20210817024335_prepare_indexes_for_events_bigint_conversion.rb b/db/post_migrate/20210817024335_prepare_indexes_for_events_bigint_conversion.rb
new file mode 100644
index 00000000000..1d102d6216c
--- /dev/null
+++ b/db/post_migrate/20210817024335_prepare_indexes_for_events_bigint_conversion.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class PrepareIndexesForEventsBigintConversion < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE_NAME = 'events'
+
+ def up
+ prepare_async_index TABLE_NAME, :id_convert_to_bigint, unique: true,
+ name: :index_events_on_id_convert_to_bigint
+
+ prepare_async_index TABLE_NAME, [:project_id, :id_convert_to_bigint],
+ name: :index_events_on_project_id_and_id_convert_to_bigint
+
+ prepare_async_index TABLE_NAME, [:project_id, :id_convert_to_bigint], order: { id_convert_to_bigint: :desc },
+ where: 'action = 7', name: :index_events_on_project_id_and_id_bigint_desc_on_merged_action
+ end
+
+ def down
+ unprepare_async_index_by_name TABLE_NAME, :index_events_on_id_convert_to_bigint
+ unprepare_async_index_by_name TABLE_NAME, :index_events_on_project_id_and_id_convert_to_bigint
+ unprepare_async_index_by_name TABLE_NAME, :index_events_on_project_id_and_id_bigint_desc_on_merged_action
+ end
+end
diff --git a/db/post_migrate/20210818185845_backfill_projects_with_coverage.rb b/db/post_migrate/20210818185845_backfill_projects_with_coverage.rb
new file mode 100644
index 00000000000..003b7536767
--- /dev/null
+++ b/db/post_migrate/20210818185845_backfill_projects_with_coverage.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class BackfillProjectsWithCoverage < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ MIGRATION = 'BackfillProjectsWithCoverage'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 10_000
+ SUB_BATCH_SIZE = 1_000
+
+ disable_ddl_transaction!
+
+ class CiDailyBuildGroupReportResult < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'ci_daily_build_group_report_results'
+ end
+
+ def up
+ queue_background_migration_jobs_by_range_at_intervals(
+ CiDailyBuildGroupReportResult,
+ MIGRATION,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ other_job_arguments: [SUB_BATCH_SIZE]
+ )
+ end
+
+ def down
+ # noop
+ end
+end
diff --git a/db/post_migrate/20210819145000_drop_temporary_columns_and_triggers_for_ci_builds_runner_session.rb b/db/post_migrate/20210819145000_drop_temporary_columns_and_triggers_for_ci_builds_runner_session.rb
new file mode 100644
index 00000000000..bbcee556020
--- /dev/null
+++ b/db/post_migrate/20210819145000_drop_temporary_columns_and_triggers_for_ci_builds_runner_session.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class DropTemporaryColumnsAndTriggersForCiBuildsRunnerSession < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ TABLE = 'ci_builds_runner_session'
+ TEMPORARY_COLUMN = 'build_id_convert_to_bigint'
+ MAIN_COLUMN = 'build_id'
+
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ def up
+ with_lock_retries do
+ cleanup_conversion_of_integer_to_bigint(TABLE, MAIN_COLUMN)
+ end
+ end
+
+ def down
+ check_trigger_permissions!(TABLE)
+
+ with_lock_retries do
+ add_column(TABLE, TEMPORARY_COLUMN, :int, default: 0, null: false)
+ install_rename_triggers(TABLE, MAIN_COLUMN, TEMPORARY_COLUMN)
+ end
+ end
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+end
diff --git a/db/post_migrate/20210823113259_steal_merge_request_diff_commit_users_migration.rb b/db/post_migrate/20210823113259_steal_merge_request_diff_commit_users_migration.rb
new file mode 100644
index 00000000000..7e893d62c28
--- /dev/null
+++ b/db/post_migrate/20210823113259_steal_merge_request_diff_commit_users_migration.rb
@@ -0,0 +1,28 @@
+# 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 StealMergeRequestDiffCommitUsersMigration < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ job = Gitlab::Database::BackgroundMigrationJob
+ .for_migration_class('MigrateMergeRequestDiffCommitUsers')
+ .pending
+ .last
+
+ return unless job
+
+ # We schedule in one hour so we don't end up running the migrations while a
+ # deployment is still wrapping up. Not that that really matters, but it
+ # prevents from too much happening during a deployment window.
+ migrate_in(1.hour, 'StealMigrateMergeRequestDiffCommitUsers', job.arguments)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210823132600_remove_duplicate_dast_site_tokens.rb b/db/post_migrate/20210823132600_remove_duplicate_dast_site_tokens.rb
new file mode 100644
index 00000000000..35cf3b55200
--- /dev/null
+++ b/db/post_migrate/20210823132600_remove_duplicate_dast_site_tokens.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class RemoveDuplicateDastSiteTokens < ActiveRecord::Migration[6.1]
+ disable_ddl_transaction!
+
+ class DastSiteToken < ApplicationRecord
+ self.table_name = 'dast_site_tokens'
+ self.inheritance_column = :_type_disabled
+
+ scope :duplicates, -> do
+ all_duplicates = select(:project_id, :url)
+ .distinct
+ .group(:project_id, :url)
+ .having('count(*) > 1')
+ .pluck('array_agg(id) as ids')
+
+ duplicate_ids = extract_duplicate_ids(all_duplicates)
+
+ where(id: duplicate_ids)
+ end
+
+ def self.extract_duplicate_ids(duplicates)
+ duplicates.flat_map { |ids| ids.first(ids.size - 1) }
+ end
+ end
+
+ def up
+ DastSiteToken.duplicates.delete_all
+ end
+
+ def down
+ end
+end
diff --git a/db/post_migrate/20210823142036_drop_temporary_trigger_for_ci_job_artifacts.rb b/db/post_migrate/20210823142036_drop_temporary_trigger_for_ci_job_artifacts.rb
new file mode 100644
index 00000000000..42b25a192d5
--- /dev/null
+++ b/db/post_migrate/20210823142036_drop_temporary_trigger_for_ci_job_artifacts.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class DropTemporaryTriggerForCiJobArtifacts < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ TABLE = 'ci_job_artifacts'
+ TEMPORARY_COLUMNS = %w(id_convert_to_bigint job_id_convert_to_bigint)
+ MAIN_COLUMNS = %w(id job_id)
+ TRIGGER = 'trigger_be1804f21693'
+
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ def up
+ check_trigger_permissions!(TABLE)
+
+ with_lock_retries do
+ remove_rename_triggers(TABLE, TRIGGER)
+ end
+ end
+
+ def down
+ check_trigger_permissions!(TABLE)
+
+ with_lock_retries do
+ install_rename_triggers(TABLE, MAIN_COLUMNS, TEMPORARY_COLUMNS, trigger_name: TRIGGER)
+ end
+ end
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+end
diff --git a/db/post_migrate/20210823193234_remove_allow_editing_commit_messages_from_project_settings.rb b/db/post_migrate/20210823193234_remove_allow_editing_commit_messages_from_project_settings.rb
new file mode 100644
index 00000000000..638361d0e83
--- /dev/null
+++ b/db/post_migrate/20210823193234_remove_allow_editing_commit_messages_from_project_settings.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class RemoveAllowEditingCommitMessagesFromProjectSettings < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ return unless column_exists?(:project_settings, :allow_editing_commit_messages)
+
+ with_lock_retries do
+ remove_column :project_settings, :allow_editing_commit_messages
+ end
+ end
+
+ def down
+ with_lock_retries do
+ add_column :project_settings, :allow_editing_commit_messages, :boolean, default: false, null: false
+ end
+ end
+end
diff --git a/db/post_migrate/20210824102624_add_project_namespace_index_to_project.rb b/db/post_migrate/20210824102624_add_project_namespace_index_to_project.rb
new file mode 100644
index 00000000000..d88a31fca7d
--- /dev/null
+++ b/db/post_migrate/20210824102624_add_project_namespace_index_to_project.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddProjectNamespaceIndexToProject < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_projects_on_project_namespace_id'
+
+ def up
+ add_concurrent_index :projects, :project_namespace_id, name: INDEX_NAME, unique: true
+ end
+
+ def down
+ remove_concurrent_index_by_name :projects, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210824102750_add_project_namespace_foreign_key_to_project.rb b/db/post_migrate/20210824102750_add_project_namespace_foreign_key_to_project.rb
new file mode 100644
index 00000000000..5cb42fd61a7
--- /dev/null
+++ b/db/post_migrate/20210824102750_add_project_namespace_foreign_key_to_project.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddProjectNamespaceForeignKeyToProject < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ TARGET_COLUMN = :project_namespace_id
+
+ def up
+ add_concurrent_foreign_key :projects, :namespaces, column: TARGET_COLUMN, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists(:projects, column: TARGET_COLUMN)
+ end
+ end
+end
diff --git a/db/post_migrate/20210824174615_prepare_ci_builds_metadata_and_ci_build_async_indexes.rb b/db/post_migrate/20210824174615_prepare_ci_builds_metadata_and_ci_build_async_indexes.rb
new file mode 100644
index 00000000000..0a0fda7e870
--- /dev/null
+++ b/db/post_migrate/20210824174615_prepare_ci_builds_metadata_and_ci_build_async_indexes.rb
@@ -0,0 +1,55 @@
+# frozen_string_literal: true
+
+class PrepareCiBuildsMetadataAndCiBuildAsyncIndexes < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ prepare_async_index :ci_builds_metadata, :id_convert_to_bigint, unique: true,
+ name: :index_ci_builds_metadata_on_id_convert_to_bigint
+
+ prepare_async_index :ci_builds_metadata, :build_id_convert_to_bigint, unique: true,
+ name: :index_ci_builds_metadata_on_build_id_convert_to_bigint
+
+ prepare_async_index :ci_builds_metadata, :build_id_convert_to_bigint, where: 'has_exposed_artifacts IS TRUE',
+ name: :index_ci_builds_metadata_on_build_id_int8_and_exposed_artifacts
+
+ prepare_async_index_from_sql(:ci_builds_metadata, :index_ci_builds_metadata_on_build_id_int8_where_interruptible, <<~SQL.squish)
+ CREATE INDEX CONCURRENTLY "index_ci_builds_metadata_on_build_id_int8_where_interruptible"
+ ON "ci_builds_metadata" ("build_id_convert_to_bigint") INCLUDE ("id_convert_to_bigint")
+ WHERE interruptible = true
+ SQL
+
+ prepare_async_index :ci_builds, :id_convert_to_bigint, unique: true,
+ name: :index_ci_builds_on_converted_id
+ end
+
+ def down
+ unprepare_async_index_by_name :ci_builds, :index_ci_builds_on_converted_id
+
+ unprepare_async_index_by_name :ci_builds_metadata, :index_ci_builds_metadata_on_build_id_int8_where_interruptible
+
+ unprepare_async_index_by_name :ci_builds_metadata, :index_ci_builds_metadata_on_build_id_int8_and_exposed_artifacts
+
+ unprepare_async_index_by_name :ci_builds_metadata, :index_ci_builds_metadata_on_build_id_convert_to_bigint
+
+ unprepare_async_index_by_name :ci_builds_metadata, :index_ci_builds_metadata_on_id_convert_to_bigint
+ end
+
+ private
+
+ def prepare_async_index_from_sql(table_name, index_name, definition)
+ return unless async_index_creation_available?
+
+ return if index_name_exists?(table_name, index_name)
+
+ async_index = Gitlab::Database::AsyncIndexes::PostgresAsyncIndex.safe_find_or_create_by!(name: index_name) do |rec|
+ rec.table_name = table_name
+ rec.definition = definition
+ end
+
+ Gitlab::AppLogger.info(
+ message: 'Prepared index for async creation',
+ table_name: async_index.table_name,
+ index_name: async_index.name)
+ end
+end
diff --git a/db/post_migrate/20210825150212_cleanup_remaining_orphan_invites.rb b/db/post_migrate/20210825150212_cleanup_remaining_orphan_invites.rb
new file mode 100644
index 00000000000..d892e6897af
--- /dev/null
+++ b/db/post_migrate/20210825150212_cleanup_remaining_orphan_invites.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class CleanupRemainingOrphanInvites < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ TMP_INDEX_NAME = 'tmp_idx_members_with_orphaned_invites'
+
+ QUERY_CONDITION = "invite_token IS NOT NULL AND user_id IS NOT NULL"
+
+ def up
+ membership = define_batchable_model('members')
+
+ add_concurrent_index :members, :id, where: QUERY_CONDITION, name: TMP_INDEX_NAME
+
+ membership.where(QUERY_CONDITION).pluck(:id).each_slice(10) do |group|
+ membership.where(id: group).where(QUERY_CONDITION).update_all(invite_token: nil)
+ end
+
+ remove_concurrent_index_by_name :members, TMP_INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :members, TMP_INDEX_NAME if index_exists_by_name?(:members, TMP_INDEX_NAME)
+ end
+end
diff --git a/db/post_migrate/20210825182303_remove_duplicate_dast_site_tokens_with_same_token.rb b/db/post_migrate/20210825182303_remove_duplicate_dast_site_tokens_with_same_token.rb
new file mode 100644
index 00000000000..4d8e18ba8ed
--- /dev/null
+++ b/db/post_migrate/20210825182303_remove_duplicate_dast_site_tokens_with_same_token.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class RemoveDuplicateDastSiteTokensWithSameToken < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'index_dast_site_token_on_token'
+
+ # rubocop: disable Migration/AddIndex
+ def up
+ execute("WITH duplicate_tokens AS(
+ SELECT id, rank() OVER (PARTITION BY token ORDER BY id) r FROM dast_site_tokens
+ )
+ DELETE FROM dast_site_tokens c USING duplicate_tokens t
+ WHERE c.id = t.id AND t.r > 1;")
+
+ add_index :dast_site_tokens, :token, name: INDEX_NAME, unique: true
+ end
+
+ # rubocop: disable Migration/RemoveIndex
+ def down
+ remove_index :dast_site_tokens, :token, name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210825193548_add_fk_to_iteration_cadence_id_on_boards.rb b/db/post_migrate/20210825193548_add_fk_to_iteration_cadence_id_on_boards.rb
new file mode 100644
index 00000000000..eb879d9bc7a
--- /dev/null
+++ b/db/post_migrate/20210825193548_add_fk_to_iteration_cadence_id_on_boards.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddFkToIterationCadenceIdOnBoards < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_boards_on_iteration_cadence_id'
+
+ def up
+ add_concurrent_index :boards, :iteration_cadence_id, name: INDEX_NAME
+ add_concurrent_foreign_key :boards, :iterations_cadences, column: :iteration_cadence_id
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :boards, column: :iteration_cadence_id
+ end
+ remove_concurrent_index_by_name :boards, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210825193652_backfill_cadence_id_for_boards_scoped_to_iteration.rb b/db/post_migrate/20210825193652_backfill_cadence_id_for_boards_scoped_to_iteration.rb
new file mode 100644
index 00000000000..f350fbe3d12
--- /dev/null
+++ b/db/post_migrate/20210825193652_backfill_cadence_id_for_boards_scoped_to_iteration.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+class BackfillCadenceIdForBoardsScopedToIteration < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ BATCH_SIZE = 1000
+ DELAY = 2.minutes.to_i
+ MIGRATION = 'BackfillIterationCadenceIdForBoards'
+
+ class MigrationBoard < ApplicationRecord
+ include EachBatch
+
+ self.table_name = 'boards'
+ end
+
+ def up
+ schedule_backfill_group_boards
+ schedule_backfill_project_boards
+ end
+
+ def down
+ MigrationBoard.where.not(iteration_cadence_id: nil).each_batch(of: BATCH_SIZE) do |batch, index|
+ range = batch.pluck(Arel.sql('MIN(id)'), Arel.sql('MAX(id)')).first
+ delay = index * DELAY
+
+ migrate_in(delay, MIGRATION, ['none', 'down', *range])
+ end
+ end
+
+ private
+
+ def schedule_backfill_project_boards
+ MigrationBoard.where(iteration_id: -4).where.not(project_id: nil).where(iteration_cadence_id: nil).each_batch(of: BATCH_SIZE) do |batch, index|
+ range = batch.pluck(Arel.sql('MIN(id)'), Arel.sql('MAX(id)')).first
+ delay = index * DELAY
+
+ migrate_in(delay, MIGRATION, ['project', 'up', *range])
+ end
+ end
+
+ def schedule_backfill_group_boards
+ MigrationBoard.where(iteration_id: -4).where.not(group_id: nil).where(iteration_cadence_id: nil).each_batch(of: BATCH_SIZE) do |batch, index|
+ range = batch.pluck(Arel.sql('MIN(id)'), Arel.sql('MAX(id)')).first
+ delay = index * DELAY
+
+ migrate_in(delay, MIGRATION, ['group', 'up', *range])
+ end
+ end
+end
diff --git a/db/post_migrate/20210826110839_prepare_indexes_for_ci_job_artifacts_expire_at_unlocked.rb b/db/post_migrate/20210826110839_prepare_indexes_for_ci_job_artifacts_expire_at_unlocked.rb
new file mode 100644
index 00000000000..e11bb25d83c
--- /dev/null
+++ b/db/post_migrate/20210826110839_prepare_indexes_for_ci_job_artifacts_expire_at_unlocked.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class PrepareIndexesForCiJobArtifactsExpireAtUnlocked < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE_NAME = 'ci_job_artifacts'
+ INDEX_NAME = 'ci_job_artifacts_expire_at_unlocked_idx'
+
+ def up
+ prepare_async_index TABLE_NAME, [:expire_at], where: 'locked = 0', name: INDEX_NAME
+ end
+
+ def down
+ unprepare_async_index_by_name TABLE_NAME, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210826171758_initialize_throttle_unauthenticated_api_columns.rb b/db/post_migrate/20210826171758_initialize_throttle_unauthenticated_api_columns.rb
new file mode 100644
index 00000000000..7615931464b
--- /dev/null
+++ b/db/post_migrate/20210826171758_initialize_throttle_unauthenticated_api_columns.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+# Initialize the new `throttle_unauthenticated_api_*` columns with the current values
+# from the `throttle_unauthenticated_*` columns, which will now only apply to web requests.
+#
+# The columns for the unauthenticated web rate limit will be renamed later
+# in https://gitlab.com/gitlab-org/gitlab/-/issues/340031.
+class InitializeThrottleUnauthenticatedApiColumns < ActiveRecord::Migration[6.1]
+ class ApplicationSetting < ActiveRecord::Base
+ self.table_name = :application_settings
+ end
+
+ def up
+ ApplicationSetting.update_all(%q{
+ throttle_unauthenticated_api_enabled = throttle_unauthenticated_enabled,
+ throttle_unauthenticated_api_requests_per_period = throttle_unauthenticated_requests_per_period,
+ throttle_unauthenticated_api_period_in_seconds = throttle_unauthenticated_period_in_seconds
+ })
+ end
+
+ def down
+ end
+end
diff --git a/db/post_migrate/20210826193907_add_unique_index_dast_site_token_project_id_and_url.rb b/db/post_migrate/20210826193907_add_unique_index_dast_site_token_project_id_and_url.rb
new file mode 100644
index 00000000000..1e65d5647e4
--- /dev/null
+++ b/db/post_migrate/20210826193907_add_unique_index_dast_site_token_project_id_and_url.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddUniqueIndexDastSiteTokenProjectIdAndUrl < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_dast_site_token_on_project_id_and_url'
+
+ def up
+ add_concurrent_index :dast_site_tokens, [:project_id, :url], name: INDEX_NAME, unique: true
+ end
+
+ def down
+ remove_concurrent_index_by_name :dast_site_tokens, name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210830104800_reschedule_extract_project_topics_into_separate_table.rb b/db/post_migrate/20210830104800_reschedule_extract_project_topics_into_separate_table.rb
new file mode 100644
index 00000000000..d6b2db7790f
--- /dev/null
+++ b/db/post_migrate/20210830104800_reschedule_extract_project_topics_into_separate_table.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RescheduleExtractProjectTopicsIntoSeparateTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ MIGRATION = 'ExtractProjectTopicsIntoSeparateTable'
+ DELAY_INTERVAL = 4.minutes
+
+ disable_ddl_transaction!
+
+ def up
+ requeue_background_migration_jobs_by_range_at_intervals(MIGRATION, DELAY_INTERVAL)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210831123008_drop_temporary_trigger_for_ci_sources_pipelines.rb b/db/post_migrate/20210831123008_drop_temporary_trigger_for_ci_sources_pipelines.rb
new file mode 100644
index 00000000000..a3fe0e6bd7a
--- /dev/null
+++ b/db/post_migrate/20210831123008_drop_temporary_trigger_for_ci_sources_pipelines.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class DropTemporaryTriggerForCiSourcesPipelines < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ TABLE = 'ci_sources_pipelines'
+ TEMPORARY_COLUMN = 'source_job_id_convert_to_bigint'
+ MAIN_COLUMN = 'source_job_id'
+ TRIGGER = 'trigger_8485e97c00e3'
+
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ def up
+ check_trigger_permissions!(TABLE)
+
+ with_lock_retries do
+ remove_rename_triggers(TABLE, TRIGGER)
+ end
+ end
+
+ def down
+ check_trigger_permissions!(TABLE)
+
+ with_lock_retries do
+ install_rename_triggers(TABLE, MAIN_COLUMN, TEMPORARY_COLUMN, trigger_name: TRIGGER)
+ end
+ end
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+end
diff --git a/db/post_migrate/20210901044202_push_event_payloads_bigint_conversion_remove_triggers.rb b/db/post_migrate/20210901044202_push_event_payloads_bigint_conversion_remove_triggers.rb
new file mode 100644
index 00000000000..e11f0d46563
--- /dev/null
+++ b/db/post_migrate/20210901044202_push_event_payloads_bigint_conversion_remove_triggers.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class PushEventPayloadsBigintConversionRemoveTriggers < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = :push_event_payloads
+ TRIGGER_NAME = 'trigger_07c94931164e'
+
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ def up
+ check_trigger_permissions!(TABLE_NAME)
+
+ with_lock_retries do
+ remove_rename_triggers(TABLE_NAME, TRIGGER_NAME)
+ end
+ end
+
+ def down
+ check_trigger_permissions!(TABLE_NAME)
+
+ with_lock_retries do
+ install_rename_triggers(TABLE_NAME, :event_id, :event_id_convert_to_bigint, trigger_name: TRIGGER_NAME)
+ end
+ end
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+end
diff --git a/db/post_migrate/20210901044237_events_bigint_conversion_remove_triggers.rb b/db/post_migrate/20210901044237_events_bigint_conversion_remove_triggers.rb
new file mode 100644
index 00000000000..bfe3af2efa8
--- /dev/null
+++ b/db/post_migrate/20210901044237_events_bigint_conversion_remove_triggers.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class EventsBigintConversionRemoveTriggers < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ TABLE_NAME = :events
+ TRIGGER_NAME = :trigger_69523443cc10
+
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ def up
+ check_trigger_permissions!(TABLE_NAME)
+
+ with_lock_retries do
+ remove_rename_triggers(TABLE_NAME, TRIGGER_NAME)
+ end
+ end
+
+ def down
+ check_trigger_permissions!(TABLE_NAME)
+
+ with_lock_retries do
+ install_rename_triggers(TABLE_NAME, :id, :id_convert_to_bigint, trigger_name: TRIGGER_NAME)
+ end
+ end
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+end
diff --git a/db/post_migrate/20210901153324_slice_merge_request_diff_commit_migrations.rb b/db/post_migrate/20210901153324_slice_merge_request_diff_commit_migrations.rb
new file mode 100644
index 00000000000..8ee7feae1a6
--- /dev/null
+++ b/db/post_migrate/20210901153324_slice_merge_request_diff_commit_migrations.rb
@@ -0,0 +1,59 @@
+# frozen_string_literal: true
+
+class SliceMergeRequestDiffCommitMigrations < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ BATCH_SIZE = 5_000
+ MIGRATION_CLASS = 'MigrateMergeRequestDiffCommitUsers'
+ STEAL_MIGRATION_CLASS = 'StealMigrateMergeRequestDiffCommitUsers'
+
+ def up
+ old_jobs = Gitlab::Database::BackgroundMigrationJob
+ .for_migration_class(MIGRATION_CLASS)
+ .pending
+ .to_a
+
+ return if old_jobs.empty?
+
+ transaction do
+ # This ensures we stop processing the old ranges, as the background
+ # migrations skip already processed jobs.
+ Gitlab::Database::BackgroundMigrationJob
+ .for_migration_class(MIGRATION_CLASS)
+ .pending
+ .update_all(status: :succeeded)
+
+ rows = []
+
+ old_jobs.each do |job|
+ min, max = job.arguments
+
+ while min < max
+ rows << {
+ class_name: MIGRATION_CLASS,
+ arguments: [min, min + BATCH_SIZE],
+ created_at: Time.now.utc,
+ updated_at: Time.now.utc
+ }
+
+ min += BATCH_SIZE
+ end
+ end
+
+ Gitlab::Database::BackgroundMigrationJob.insert_all!(rows)
+ end
+
+ job = Gitlab::Database::BackgroundMigrationJob
+ .for_migration_class(MIGRATION_CLASS)
+ .pending
+ .first
+
+ migrate_in(1.hour, STEAL_MIGRATION_CLASS, job.arguments)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210901184511_prepare_async_indexes_for_ci_builds.rb b/db/post_migrate/20210901184511_prepare_async_indexes_for_ci_builds.rb
new file mode 100644
index 00000000000..47795c5d646
--- /dev/null
+++ b/db/post_migrate/20210901184511_prepare_async_indexes_for_ci_builds.rb
@@ -0,0 +1,80 @@
+# frozen_string_literal: true
+
+class PrepareAsyncIndexesForCiBuilds < Gitlab::Database::Migration[1.0]
+ def up
+ prepare_async_index :ci_builds, :stage_id_convert_to_bigint, name: :index_ci_builds_on_converted_stage_id
+
+ prepare_async_index :ci_builds, [:commit_id, :artifacts_expire_at, :id_convert_to_bigint],
+ 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]))",
+ name: :index_ci_builds_on_commit_id_expire_at_and_converted_id
+
+ prepare_async_index :ci_builds, [:project_id, :id_convert_to_bigint],
+ name: :index_ci_builds_on_project_and_converted_id
+
+ prepare_async_index :ci_builds, [:runner_id, :id_convert_to_bigint],
+ order: { id_convert_to_bigint: :desc },
+ name: :index_ci_builds_on_runner_id_and_converted_id_desc
+
+ prepare_async_index :ci_builds, [:resource_group_id, :id_convert_to_bigint],
+ where: 'resource_group_id IS NOT NULL',
+ name: :index_ci_builds_on_resource_group_and_converted_id
+
+ prepare_async_index :ci_builds, [:name, :id_convert_to_bigint],
+ where: "(name::text = ANY (ARRAY['container_scanning'::character varying::text,
+ 'dast'::character varying::text,
+ 'dependency_scanning'::character varying::text,
+ 'license_management'::character varying::text,
+ 'sast'::character varying::text,
+ 'secret_detection'::character varying::text,
+ 'coverage_fuzzing'::character varying::text,
+ 'license_scanning'::character varying::text])
+ ) AND type::text = 'Ci::Build'::text",
+ name: :index_security_ci_builds_on_name_and_converted_id_parser
+
+ prepare_async_index_from_sql(:ci_builds, :index_ci_builds_runner_id_and_converted_id_pending_covering, <<~SQL.squish)
+ CREATE INDEX CONCURRENTLY index_ci_builds_runner_id_and_converted_id_pending_covering
+ ON ci_builds (runner_id, id_convert_to_bigint) INCLUDE (project_id)
+ WHERE status::text = 'pending'::text AND type::text = 'Ci::Build'::text
+ SQL
+ end
+
+ def down
+ unprepare_async_index_by_name :ci_builds, :index_ci_builds_runner_id_and_converted_id_pending_covering
+
+ unprepare_async_index_by_name :ci_builds, :index_security_ci_builds_on_name_and_converted_id_parser
+
+ unprepare_async_index_by_name :ci_builds, :index_ci_builds_on_resource_group_and_converted_id
+
+ unprepare_async_index_by_name :ci_builds, :index_ci_builds_on_runner_id_and_converted_id_desc
+
+ unprepare_async_index_by_name :ci_builds, :index_ci_builds_on_project_and_converted_id
+
+ unprepare_async_index_by_name :ci_builds, :index_ci_builds_on_commit_id_expire_at_and_converted_id
+
+ unprepare_async_index_by_name :ci_builds, :index_ci_builds_on_converted_stage_id
+ end
+
+ private
+
+ def prepare_async_index_from_sql(table_name, index_name, definition)
+ return unless async_index_creation_available?
+
+ return if index_name_exists?(table_name, index_name)
+
+ async_index = Gitlab::Database::AsyncIndexes::PostgresAsyncIndex.find_or_create_by!(name: index_name) do |rec|
+ rec.table_name = table_name
+ rec.definition = definition
+ end
+
+ Gitlab::AppLogger.info(
+ message: 'Prepared index for async creation',
+ table_name: async_index.table_name,
+ index_name: async_index.name)
+ end
+end
diff --git a/db/post_migrate/20210902144144_drop_temporary_columns_and_triggers_for_ci_build_needs.rb b/db/post_migrate/20210902144144_drop_temporary_columns_and_triggers_for_ci_build_needs.rb
new file mode 100644
index 00000000000..f04c5cd6561
--- /dev/null
+++ b/db/post_migrate/20210902144144_drop_temporary_columns_and_triggers_for_ci_build_needs.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class DropTemporaryColumnsAndTriggersForCiBuildNeeds < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ TABLE = 'ci_build_needs'
+ TEMPORARY_COLUMN = 'build_id_convert_to_bigint'
+ MAIN_COLUMN = 'build_id'
+
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ def up
+ with_lock_retries do
+ cleanup_conversion_of_integer_to_bigint(TABLE, MAIN_COLUMN)
+ end
+ end
+
+ def down
+ check_trigger_permissions!(TABLE)
+
+ with_lock_retries do
+ add_column(TABLE, TEMPORARY_COLUMN, :int, default: 0, null: false)
+ install_rename_triggers(TABLE, MAIN_COLUMN, TEMPORARY_COLUMN)
+ end
+ end
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+end
diff --git a/db/post_migrate/20210906100316_drop_temporary_columns_and_triggers_for_ci_build_trace_chunks.rb b/db/post_migrate/20210906100316_drop_temporary_columns_and_triggers_for_ci_build_trace_chunks.rb
new file mode 100644
index 00000000000..44bec402cae
--- /dev/null
+++ b/db/post_migrate/20210906100316_drop_temporary_columns_and_triggers_for_ci_build_trace_chunks.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class DropTemporaryColumnsAndTriggersForCiBuildTraceChunks < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ TABLE = 'ci_build_trace_chunks'
+ COLUMN = 'build_id'
+
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ def up
+ with_lock_retries do
+ cleanup_conversion_of_integer_to_bigint(TABLE, COLUMN)
+ end
+ end
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+
+ def down
+ restore_conversion_of_integer_to_bigint(TABLE, COLUMN)
+ end
+end
diff --git a/db/post_migrate/20210907021940_cleanup_bigint_conversion_for_ci_stages.rb b/db/post_migrate/20210907021940_cleanup_bigint_conversion_for_ci_stages.rb
new file mode 100644
index 00000000000..096b5b3bf42
--- /dev/null
+++ b/db/post_migrate/20210907021940_cleanup_bigint_conversion_for_ci_stages.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class CleanupBigintConversionForCiStages < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ TABLE = :ci_stages
+
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ def up
+ with_lock_retries do
+ cleanup_conversion_of_integer_to_bigint(TABLE, :id)
+ end
+ end
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+
+ def down
+ restore_conversion_of_integer_to_bigint(TABLE, :id)
+ end
+end
diff --git a/db/post_migrate/20210907033745_cleanup_bigint_conversion_for_deployments.rb b/db/post_migrate/20210907033745_cleanup_bigint_conversion_for_deployments.rb
new file mode 100644
index 00000000000..2d71c11cfa8
--- /dev/null
+++ b/db/post_migrate/20210907033745_cleanup_bigint_conversion_for_deployments.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class CleanupBigintConversionForDeployments < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ TABLE = :deployments
+
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ def up
+ with_lock_retries do
+ cleanup_conversion_of_integer_to_bigint(TABLE, :deployable_id)
+ end
+ end
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+
+ def down
+ restore_conversion_of_integer_to_bigint(TABLE, :deployable_id)
+ end
+end
diff --git a/db/post_migrate/20210907041000_cleanup_bigint_conversion_for_geo_job_artifact_deleted_events.rb b/db/post_migrate/20210907041000_cleanup_bigint_conversion_for_geo_job_artifact_deleted_events.rb
new file mode 100644
index 00000000000..26f00454029
--- /dev/null
+++ b/db/post_migrate/20210907041000_cleanup_bigint_conversion_for_geo_job_artifact_deleted_events.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class CleanupBigintConversionForGeoJobArtifactDeletedEvents < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ TABLE = :geo_job_artifact_deleted_events
+
+ # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ def up
+ with_lock_retries do
+ cleanup_conversion_of_integer_to_bigint(TABLE, :job_artifact_id)
+ end
+ end
+ # rubocop:enable Migration/WithLockRetriesDisallowedMethod
+
+ def down
+ restore_conversion_of_integer_to_bigint(TABLE, :job_artifact_id)
+ end
+end
diff --git a/db/post_migrate/20210907211557_finalize_ci_builds_bigint_conversion.rb b/db/post_migrate/20210907211557_finalize_ci_builds_bigint_conversion.rb
new file mode 100644
index 00000000000..872eef5fd31
--- /dev/null
+++ b/db/post_migrate/20210907211557_finalize_ci_builds_bigint_conversion.rb
@@ -0,0 +1,222 @@
+# frozen_string_literal: true
+
+class FinalizeCiBuildsBigintConversion < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'ci_builds'
+ PK_INDEX_NAME = 'index_ci_builds_on_converted_id'
+
+ SECONDARY_INDEXES = [
+ {
+ original_name: :index_ci_builds_on_commit_id_artifacts_expired_at_and_id,
+ temporary_name: :index_ci_builds_on_commit_id_expire_at_and_converted_id,
+ columns: [:commit_id, :artifacts_expire_at, :id_convert_to_bigint],
+ options: {
+ 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]))"
+ }
+ },
+ {
+ original_name: :index_ci_builds_on_project_id_and_id,
+ temporary_name: :index_ci_builds_on_project_and_converted_id,
+ columns: [:project_id, :id_convert_to_bigint],
+ options: {}
+ },
+ {
+ original_name: :index_ci_builds_on_runner_id_and_id_desc,
+ temporary_name: :index_ci_builds_on_runner_id_and_converted_id_desc,
+ columns: [:runner_id, :id_convert_to_bigint],
+ options: { order: { id_convert_to_bigint: :desc } }
+ },
+ {
+ original_name: :index_for_resource_group,
+ temporary_name: :index_ci_builds_on_resource_group_and_converted_id,
+ columns: [:resource_group_id, :id_convert_to_bigint],
+ options: { where: 'resource_group_id IS NOT NULL' }
+ },
+ {
+ original_name: :index_security_ci_builds_on_name_and_id_parser_features,
+ temporary_name: :index_security_ci_builds_on_name_and_converted_id_parser,
+ columns: [:name, :id_convert_to_bigint],
+ options: {
+ where: "(name::text = ANY (ARRAY['container_scanning'::character varying::text,
+ 'dast'::character varying::text,
+ 'dependency_scanning'::character varying::text,
+ 'license_management'::character varying::text,
+ 'sast'::character varying::text,
+ 'secret_detection'::character varying::text,
+ 'coverage_fuzzing'::character varying::text,
+ 'license_scanning'::character varying::text])
+ ) AND type::text = 'Ci::Build'::text"
+ }
+ }
+ ].freeze
+
+ MANUAL_INDEX_NAMES = {
+ original_name: :index_ci_builds_runner_id_pending_covering,
+ temporary_name: :index_ci_builds_runner_id_and_converted_id_pending_covering
+ }.freeze
+
+ REFERENCING_FOREIGN_KEYS = [
+ [:ci_build_needs, :build_id, :cascade, 'fk_rails_'],
+ [:ci_build_pending_states, :build_id, :cascade, 'fk_rails_'],
+ [:ci_build_report_results, :build_id, :cascade, 'fk_rails_'],
+ [:ci_build_trace_chunks, :build_id, :cascade, 'fk_rails_'],
+ [:ci_build_trace_metadata, :build_id, :cascade, 'fk_rails_'],
+ [:ci_builds_runner_session, :build_id, :cascade, 'fk_rails_'],
+ [:ci_builds_metadata, :build_id, :cascade, 'fk_'],
+ [:ci_job_artifacts, :job_id, :cascade, 'fk_rails_'],
+ [:ci_job_variables, :job_id, :cascade, 'fk_rails_'],
+ [:ci_pending_builds, :build_id, :cascade, 'fk_rails_'],
+ [:ci_resources, :build_id, :nullify, 'fk_'],
+ [:ci_running_builds, :build_id, :cascade, 'fk_rails_'],
+ [:ci_sources_pipelines, :source_job_id, :cascade, 'fk_'],
+ [:ci_unit_test_failures, :build_id, :cascade, 'fk_'],
+ [:dast_scanner_profiles_builds, :ci_build_id, :cascade, 'fk_'],
+ [:dast_site_profiles_builds, :ci_build_id, :cascade, 'fk_'],
+ [:pages_deployments, :ci_build_id, :nullify, 'fk_rails_'],
+ [:requirements_management_test_reports, :build_id, :nullify, 'fk_rails_'],
+ [:security_scans, :build_id, :cascade, 'fk_rails_'],
+ [:terraform_state_versions, :ci_build_id, :nullify, 'fk_']
+ ].freeze
+
+ def up
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
+ table_name: TABLE_NAME,
+ column_name: 'id',
+ job_arguments: [%w[id stage_id], %w[id_convert_to_bigint stage_id_convert_to_bigint]]
+ )
+
+ # Remove this upfront since this table is being dropped, and doesn't need to be migrated
+ if foreign_key_exists?(:dep_ci_build_trace_sections, TABLE_NAME, column: :build_id)
+ remove_foreign_key(:dep_ci_build_trace_sections, TABLE_NAME, column: :build_id)
+ end
+
+ # Remove this unexpected FK if it exists - https://gitlab.com/gitlab-com/gl-infra/production/-/issues/5531#note_676576081
+ if foreign_key_exists?(:ci_resources, TABLE_NAME, column: :build_id, name: 'fk_rails_e169a8e3d5')
+ remove_foreign_key(:ci_resources, TABLE_NAME, column: :build_id, name: 'fk_rails_e169a8e3d5')
+ end
+
+ swap_columns
+ end
+
+ def down
+ swap_columns
+ end
+
+ private
+
+ def swap_columns
+ # Copy existing indexes from the original column to the new column
+ create_indexes
+ # Copy existing FKs from the original column to the new column
+ create_referencing_foreign_keys
+
+ # Remove existing FKs from the referencing tables, so we don't have to lock on them when we drop the existing PK
+ replace_referencing_foreign_keys
+
+ with_lock_retries(raise_on_exhaustion: true) do
+ quoted_table_name = quote_table_name(TABLE_NAME)
+
+ # Swap the original and new column names
+ temporary_name = 'id_tmp'
+ execute "ALTER TABLE #{quoted_table_name} RENAME COLUMN #{quote_column_name(:id)} TO #{quote_column_name(temporary_name)}"
+ execute "ALTER TABLE #{quoted_table_name} RENAME COLUMN #{quote_column_name(:id_convert_to_bigint)} TO #{quote_column_name(:id)}"
+ execute "ALTER TABLE #{quoted_table_name} RENAME COLUMN #{quote_column_name(temporary_name)} TO #{quote_column_name(:id_convert_to_bigint)}"
+
+ # Reset the function so PG drops the plan cache for the incorrect integer type
+ function_name = Gitlab::Database::UnidirectionalCopyTrigger.on_table(TABLE_NAME)
+ .name([:id, :stage_id], [:id_convert_to_bigint, :stage_id_convert_to_bigint])
+ execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL"
+
+ # Swap defaults of the two columns, and change ownership of the sequence to the new id
+ execute "ALTER SEQUENCE ci_builds_id_seq OWNED BY #{TABLE_NAME}.id"
+ change_column_default TABLE_NAME, :id, -> { "nextval('ci_builds_id_seq'::regclass)" }
+ change_column_default TABLE_NAME, :id_convert_to_bigint, 0
+
+ # Swap the PK constraint from the original column to the new column
+ # We deliberately don't CASCADE here because the old FKs should be removed already
+ execute "ALTER TABLE #{quoted_table_name} DROP CONSTRAINT ci_builds_pkey"
+ rename_index TABLE_NAME, PK_INDEX_NAME, 'ci_builds_pkey'
+ execute "ALTER TABLE #{quoted_table_name} ADD CONSTRAINT ci_builds_pkey PRIMARY KEY USING INDEX ci_builds_pkey"
+
+ # Remove old column indexes and change new column indexes to have the original names
+ rename_secondary_indexes # rubocop:disable Migration/WithLockRetriesDisallowedMethod
+ end
+ end
+
+ def create_indexes
+ add_concurrent_index TABLE_NAME, :id_convert_to_bigint, unique: true, name: PK_INDEX_NAME
+
+ SECONDARY_INDEXES.each do |index_definition|
+ options = index_definition[:options]
+ options[:name] = index_definition[:temporary_name]
+
+ add_concurrent_index(TABLE_NAME, index_definition[:columns], options)
+ end
+
+ unless index_name_exists?(TABLE_NAME, MANUAL_INDEX_NAMES[:temporary_name])
+ execute(<<~SQL)
+ CREATE INDEX CONCURRENTLY #{MANUAL_INDEX_NAMES[:temporary_name]}
+ ON ci_builds (runner_id, id_convert_to_bigint) INCLUDE (project_id)
+ WHERE status::text = 'pending'::text AND type::text = 'Ci::Build'::text
+ SQL
+ end
+ end
+
+ def rename_secondary_indexes
+ (SECONDARY_INDEXES + [MANUAL_INDEX_NAMES]).each do |index_definition|
+ remove_index(TABLE_NAME, name: index_definition[:original_name]) # rubocop:disable Migration/RemoveIndex
+ rename_index(TABLE_NAME, index_definition[:temporary_name], index_definition[:original_name])
+ end
+ end
+
+ def create_referencing_foreign_keys
+ REFERENCING_FOREIGN_KEYS.each do |(from_table, column, on_delete, prefix)|
+ # Don't attempt to create the FK if one already exists from the table to the new column
+ # The check in `add_concurrent_foreign_key` already checks for this, but it looks for the foreign key
+ # with the new name only (containing the `_tmp` suffix).
+ #
+ # Since we might partially rename FKs and re-run the migration, we also have to check and see if a FK exists
+ # on those columns that might not match the `_tmp` name.
+ next if foreign_key_exists?(from_table, TABLE_NAME, column: column, primary_key: :id_convert_to_bigint)
+
+ temporary_name = "#{concurrent_foreign_key_name(from_table, column, prefix: prefix)}_tmp"
+
+ add_concurrent_foreign_key(
+ from_table,
+ TABLE_NAME,
+ column: column,
+ target_column: :id_convert_to_bigint,
+ name: temporary_name,
+ on_delete: on_delete,
+ reverse_lock_order: true)
+ end
+ end
+
+ def replace_referencing_foreign_keys
+ REFERENCING_FOREIGN_KEYS.each do |(from_table, column, _, prefix)|
+ existing_name = concurrent_foreign_key_name(from_table, column, prefix: prefix)
+
+ # Don't attempt to replace the FK unless it exists and points at the original column.
+ # This could happen if the migration is re-run due to failing midway.
+ next unless foreign_key_exists?(from_table, TABLE_NAME, column: column, primary_key: :id, name: existing_name)
+
+ with_lock_retries do
+ # Explicitly lock table in order of parent, child to attempt to avoid deadlocks
+ execute "LOCK TABLE #{TABLE_NAME}, #{from_table} IN ACCESS EXCLUSIVE MODE"
+
+ temporary_name = "#{existing_name}_tmp"
+
+ remove_foreign_key(from_table, TABLE_NAME, column: column, primary_key: :id, name: existing_name)
+ rename_constraint(from_table, temporary_name, existing_name)
+ end
+ end
+ end
+end
diff --git a/db/post_migrate/20210908132335_disable_job_token_scope_when_unused.rb b/db/post_migrate/20210908132335_disable_job_token_scope_when_unused.rb
new file mode 100644
index 00000000000..2e6ad12f928
--- /dev/null
+++ b/db/post_migrate/20210908132335_disable_job_token_scope_when_unused.rb
@@ -0,0 +1,52 @@
+# frozen_string_literal: true
+
+class DisableJobTokenScopeWhenUnused < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ class ProjectCiCdSetting < ApplicationRecord
+ include EachBatch
+
+ self.table_name = 'project_ci_cd_settings'
+ end
+
+ module Ci
+ module JobToken
+ class ProjectScopeLink < ApplicationRecord
+ self.table_name = 'ci_job_token_project_scope_links'
+ end
+ end
+ end
+
+ def up
+ # Disabling job token scope after db/migrate/20210902171808_set_default_job_token_scope_false.rb
+ # if users haven't configured it.
+ ProjectCiCdSetting.each_batch(of: 10_000) do |settings|
+ with_enabled_but_unused_scope(settings).each_batch(of: 500) do |settings_to_update|
+ settings_to_update.update_all(job_token_scope_enabled: false)
+ end
+ end
+ end
+
+ def down
+ # irreversible data migration
+
+ # The migration relies on the state of `job_token_scope_enabled` and
+ # updates it based on whether the feature is used or not.
+ #
+ # The inverse migration would be to set `job_token_scope_enabled: true`
+ # for those projects that have the feature disabled and unused. But there
+ # could be also existing cases where the feature is disabled and unused.
+ # For example, old projects.
+ end
+
+ private
+
+ # The presence of ProjectScopeLinks means that the job token scope
+ # is configured and we need to leave it enabled. Unused job token scope
+ # can be disabled since they weren't configured.
+ def with_enabled_but_unused_scope(settings)
+ settings
+ .where(job_token_scope_enabled: true)
+ .where.not(project_id: Ci::JobToken::ProjectScopeLink.select(:source_project_id))
+ end
+end
diff --git a/db/post_migrate/20210909104800_reschedule_extract_project_topics_into_separate_table_2.rb b/db/post_migrate/20210909104800_reschedule_extract_project_topics_into_separate_table_2.rb
new file mode 100644
index 00000000000..ad31a40f324
--- /dev/null
+++ b/db/post_migrate/20210909104800_reschedule_extract_project_topics_into_separate_table_2.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class RescheduleExtractProjectTopicsIntoSeparateTable2 < Gitlab::Database::Migration[1.0]
+ MIGRATION = 'ExtractProjectTopicsIntoSeparateTable'
+ DELAY_INTERVAL = 4.minutes
+
+ disable_ddl_transaction!
+
+ def up
+ requeue_background_migration_jobs_by_range_at_intervals(MIGRATION, DELAY_INTERVAL)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210909152027_remove_container_registry_enabled.rb b/db/post_migrate/20210909152027_remove_container_registry_enabled.rb
new file mode 100644
index 00000000000..d97faaf58d2
--- /dev/null
+++ b/db/post_migrate/20210909152027_remove_container_registry_enabled.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class RemoveContainerRegistryEnabled < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_column :projects, :container_registry_enabled
+ end
+ end
+
+ def down
+ with_lock_retries do
+ add_column :projects, :container_registry_enabled, :boolean # rubocop:disable Migration/AddColumnsToWideTables
+ end
+ end
+end
diff --git a/db/post_migrate/20210914094840_add_gin_index_on_pending_builds_namespace_traversal_ids.rb b/db/post_migrate/20210914094840_add_gin_index_on_pending_builds_namespace_traversal_ids.rb
new file mode 100644
index 00000000000..3584c7136e3
--- /dev/null
+++ b/db/post_migrate/20210914094840_add_gin_index_on_pending_builds_namespace_traversal_ids.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddGinIndexOnPendingBuildsNamespaceTraversalIds < Gitlab::Database::Migration[1.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_gin_ci_pending_builds_on_namespace_traversal_ids'
+
+ def up
+ add_concurrent_index :ci_pending_builds, :namespace_traversal_ids, name: INDEX_NAME, using: :gin
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_pending_builds, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210915202900_prepare_index_resource_group_status_commit_id_for_ci_builds.rb b/db/post_migrate/20210915202900_prepare_index_resource_group_status_commit_id_for_ci_builds.rb
new file mode 100644
index 00000000000..42d21806405
--- /dev/null
+++ b/db/post_migrate/20210915202900_prepare_index_resource_group_status_commit_id_for_ci_builds.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class PrepareIndexResourceGroupStatusCommitIdForCiBuilds < Gitlab::Database::Migration[1.0]
+ INDEX_NAME = 'index_ci_builds_on_resource_group_and_status_and_commit_id'
+
+ def up
+ prepare_async_index :ci_builds, [:resource_group_id, :status, :commit_id],
+ where: 'resource_group_id IS NOT NULL',
+ name: INDEX_NAME
+ end
+
+ def down
+ unprepare_async_index_by_name :ci_builds, INDEX_NAME
+ end
+end
diff --git a/db/schema_migrations/20210622045705 b/db/schema_migrations/20210622045705
new file mode 100644
index 00000000000..edf47a46a9d
--- /dev/null
+++ b/db/schema_migrations/20210622045705
@@ -0,0 +1 @@
+8400d4497656a9f3f692528f9c0118e8898f2d4d5b0ebbaa55ebadea15628041 \ No newline at end of file
diff --git a/db/schema_migrations/20210701141346 b/db/schema_migrations/20210701141346
new file mode 100644
index 00000000000..bbc8116361e
--- /dev/null
+++ b/db/schema_migrations/20210701141346
@@ -0,0 +1 @@
+da16754bf484ba9a585f9de055f242dbee311d7cf7d0ce67c834ebaed61b96d4 \ No newline at end of file
diff --git a/db/schema_migrations/20210706112800 b/db/schema_migrations/20210706112800
new file mode 100644
index 00000000000..f1f00867472
--- /dev/null
+++ b/db/schema_migrations/20210706112800
@@ -0,0 +1 @@
+5dd1596d0d6e6f5aa39cbf8a65be294650bead7a099cf50917b438cf75529257 \ No newline at end of file
diff --git a/db/schema_migrations/20210707113056 b/db/schema_migrations/20210707113056
new file mode 100644
index 00000000000..3526caf8109
--- /dev/null
+++ b/db/schema_migrations/20210707113056
@@ -0,0 +1 @@
+837b9a56114c63064379cf276a3c7e2bbe845af9022a542c4fcec94a25062017 \ No newline at end of file
diff --git a/db/schema_migrations/20210707163659 b/db/schema_migrations/20210707163659
new file mode 100644
index 00000000000..e0c33c79a85
--- /dev/null
+++ b/db/schema_migrations/20210707163659
@@ -0,0 +1 @@
+ac14aa49830a3af9a1445c0c7680f5660247a8104c8e4c1ae542c4b368f7c9bf \ No newline at end of file
diff --git a/db/schema_migrations/20210708011425 b/db/schema_migrations/20210708011425
new file mode 100644
index 00000000000..33e28f436ce
--- /dev/null
+++ b/db/schema_migrations/20210708011425
@@ -0,0 +1 @@
+e3f4424daaba173f607dbae7c84b4f6070126d262e7e9808c6a90e64648e10ed \ No newline at end of file
diff --git a/db/schema_migrations/20210708011426 b/db/schema_migrations/20210708011426
new file mode 100644
index 00000000000..abb2743928c
--- /dev/null
+++ b/db/schema_migrations/20210708011426
@@ -0,0 +1 @@
+b48556968cbff2e3aff65236b313ed8a626af4a08b1cad06723b74a99b678895 \ No newline at end of file
diff --git a/db/schema_migrations/20210721122840 b/db/schema_migrations/20210721122840
new file mode 100644
index 00000000000..375a03adc3d
--- /dev/null
+++ b/db/schema_migrations/20210721122840
@@ -0,0 +1 @@
+483ef6f8ef379f39ecff32853c777c12c59d2858f061879c375ff6d429396167 \ No newline at end of file
diff --git a/db/schema_migrations/20210729081351 b/db/schema_migrations/20210729081351
new file mode 100644
index 00000000000..1f397457443
--- /dev/null
+++ b/db/schema_migrations/20210729081351
@@ -0,0 +1 @@
+17463867a8c14981386256dc90169fb879e1921d65eccca53eae576d49fba49d \ No newline at end of file
diff --git a/db/schema_migrations/20210729081739 b/db/schema_migrations/20210729081739
new file mode 100644
index 00000000000..2215c7d7e66
--- /dev/null
+++ b/db/schema_migrations/20210729081739
@@ -0,0 +1 @@
+af7963d27bda6ef85fb5b5a06ecf1de14f21829eecdaf13e763aa9a6ffc2e83c \ No newline at end of file
diff --git a/db/schema_migrations/20210729125641 b/db/schema_migrations/20210729125641
new file mode 100644
index 00000000000..e5ee4127656
--- /dev/null
+++ b/db/schema_migrations/20210729125641
@@ -0,0 +1 @@
+b7bc495d010e0640b1145ca55f47696047fd4360d2dfc9a3da7941ab62840132 \ No newline at end of file
diff --git a/db/schema_migrations/20210729125659 b/db/schema_migrations/20210729125659
new file mode 100644
index 00000000000..64c8cd0aeef
--- /dev/null
+++ b/db/schema_migrations/20210729125659
@@ -0,0 +1 @@
+5826e87b2ce13d4951e9b8e774c87c29c6e0a0954a85d60ec68155f2c5cf3ccc \ No newline at end of file
diff --git a/db/schema_migrations/20210730104800 b/db/schema_migrations/20210730104800
new file mode 100644
index 00000000000..d8e2986e946
--- /dev/null
+++ b/db/schema_migrations/20210730104800
@@ -0,0 +1 @@
+7764c058665015707aff6e25ccbf60d4a329c67c16106b2ef523862ef82298b7 \ No newline at end of file
diff --git a/db/schema_migrations/20210730194555 b/db/schema_migrations/20210730194555
new file mode 100644
index 00000000000..5b2a142779d
--- /dev/null
+++ b/db/schema_migrations/20210730194555
@@ -0,0 +1 @@
+2d0399beca58815197487d310318ed1cb3d8e85671d55581a6256ceac7667b43 \ No newline at end of file
diff --git a/db/schema_migrations/20210731132939 b/db/schema_migrations/20210731132939
new file mode 100644
index 00000000000..f032b0fadad
--- /dev/null
+++ b/db/schema_migrations/20210731132939
@@ -0,0 +1 @@
+97d968bba0eb2bf6faa19de8a3e4fe93dc03a623b623dc802ab0fe0a4afb0370 \ No newline at end of file
diff --git a/db/schema_migrations/20210806131706 b/db/schema_migrations/20210806131706
new file mode 100644
index 00000000000..78be9905398
--- /dev/null
+++ b/db/schema_migrations/20210806131706
@@ -0,0 +1 @@
+2539e3e09682f1d7a0902b495a140151a5debef40623348d3cc552d4ba00722f \ No newline at end of file
diff --git a/db/schema_migrations/20210807101446 b/db/schema_migrations/20210807101446
new file mode 100644
index 00000000000..0b6d526429f
--- /dev/null
+++ b/db/schema_migrations/20210807101446
@@ -0,0 +1 @@
+30e1463616c60b92afb28bbb76e3c55830a385af6df0e60e16ed96d9e75943b9 \ No newline at end of file
diff --git a/db/schema_migrations/20210807101621 b/db/schema_migrations/20210807101621
new file mode 100644
index 00000000000..ab053cf4cbc
--- /dev/null
+++ b/db/schema_migrations/20210807101621
@@ -0,0 +1 @@
+7e9b39914ade766357751953a4981225dbae7e5d371d4824af61b01af70f46ae \ No newline at end of file
diff --git a/db/schema_migrations/20210807102004 b/db/schema_migrations/20210807102004
new file mode 100644
index 00000000000..e63485435f8
--- /dev/null
+++ b/db/schema_migrations/20210807102004
@@ -0,0 +1 @@
+a2454f9fca3b1cedf7a0f2288b69abe799fe1f9ff4e2fe26d2cadfdddea73a83 \ No newline at end of file
diff --git a/db/schema_migrations/20210809014850 b/db/schema_migrations/20210809014850
new file mode 100644
index 00000000000..541d397d169
--- /dev/null
+++ b/db/schema_migrations/20210809014850
@@ -0,0 +1 @@
+6f67e2bba5f42d48a9b21f8ab4d9abf4495ef7e0226ea903d51e77eed85ad0cb \ No newline at end of file
diff --git a/db/schema_migrations/20210809014918 b/db/schema_migrations/20210809014918
new file mode 100644
index 00000000000..099f032c76a
--- /dev/null
+++ b/db/schema_migrations/20210809014918
@@ -0,0 +1 @@
+d282a027d03920a53d49444f54745ab7d2c8bcccc485ac9407ff9dbbef77981f \ No newline at end of file
diff --git a/db/schema_migrations/20210811120204 b/db/schema_migrations/20210811120204
new file mode 100644
index 00000000000..1802d357900
--- /dev/null
+++ b/db/schema_migrations/20210811120204
@@ -0,0 +1 @@
+77d80801402f18e69d17a9f120445fe14d05cec3a93a08341abf89ae81cda5b9 \ No newline at end of file
diff --git a/db/schema_migrations/20210813131313 b/db/schema_migrations/20210813131313
new file mode 100644
index 00000000000..abb03783efe
--- /dev/null
+++ b/db/schema_migrations/20210813131313
@@ -0,0 +1 @@
+5ab51c1fb5bde22123f2d55f6422de0d8d0a84b7a98ce3146cbf491475c97b66 \ No newline at end of file
diff --git a/db/schema_migrations/20210813151908 b/db/schema_migrations/20210813151908
new file mode 100644
index 00000000000..b2d1602658b
--- /dev/null
+++ b/db/schema_migrations/20210813151908
@@ -0,0 +1 @@
+fdb6dd20c1cd5feaf0efd8eb94a4d61fc4812f1142572433ae397cd5f27bf603 \ No newline at end of file
diff --git a/db/schema_migrations/20210816095826 b/db/schema_migrations/20210816095826
new file mode 100644
index 00000000000..079a83fae8f
--- /dev/null
+++ b/db/schema_migrations/20210816095826
@@ -0,0 +1 @@
+d1ad234656f49861d2ca7694d23116e930bba597fca32b1015db698cc23bdc1c \ No newline at end of file
diff --git a/db/schema_migrations/20210816192041 b/db/schema_migrations/20210816192041
new file mode 100644
index 00000000000..d60da5dda39
--- /dev/null
+++ b/db/schema_migrations/20210816192041
@@ -0,0 +1 @@
+7d069706b4379685cfe85a5c65444d139f6f93578ff6ff66759e0a694e119bb4 \ No newline at end of file
diff --git a/db/schema_migrations/20210817024335 b/db/schema_migrations/20210817024335
new file mode 100644
index 00000000000..019ec0a26b7
--- /dev/null
+++ b/db/schema_migrations/20210817024335
@@ -0,0 +1 @@
+360bb1c16c93d7a6564ed70fa2dea4212e1fd00d101cfdc9017b54f67eae797d \ No newline at end of file
diff --git a/db/schema_migrations/20210817130415 b/db/schema_migrations/20210817130415
new file mode 100644
index 00000000000..e8481cb4019
--- /dev/null
+++ b/db/schema_migrations/20210817130415
@@ -0,0 +1 @@
+8c1ec0dfc043861377786bd7731a1a1f994d6f03833f4dcc2ba94ab1ddc83acf \ No newline at end of file
diff --git a/db/schema_migrations/20210817172214 b/db/schema_migrations/20210817172214
new file mode 100644
index 00000000000..5e334c7d690
--- /dev/null
+++ b/db/schema_migrations/20210817172214
@@ -0,0 +1 @@
+d6dd6ce802beeea380e0eb1c564f6a5cbc6d30cb3488a3cb91935e1302a4c387 \ No newline at end of file
diff --git a/db/schema_migrations/20210818061156 b/db/schema_migrations/20210818061156
new file mode 100644
index 00000000000..fba5486b2a8
--- /dev/null
+++ b/db/schema_migrations/20210818061156
@@ -0,0 +1 @@
+23becdc9ad558882f4ce42e76391cdc2f760322a09c998082465fcb6d29dfeb5 \ No newline at end of file
diff --git a/db/schema_migrations/20210818115613 b/db/schema_migrations/20210818115613
new file mode 100644
index 00000000000..efe76d3a46a
--- /dev/null
+++ b/db/schema_migrations/20210818115613
@@ -0,0 +1 @@
+9c5114dac05e90c15567bb3274f20f03a82f9e4d73d5c72d89c26bc9d742cc35 \ No newline at end of file
diff --git a/db/schema_migrations/20210818175949 b/db/schema_migrations/20210818175949
new file mode 100644
index 00000000000..8e316d2dd9c
--- /dev/null
+++ b/db/schema_migrations/20210818175949
@@ -0,0 +1 @@
+0d04487e59b783f0aa88ddd4f79716ae570ba87528b15bd07400aa4b1cef92c1 \ No newline at end of file
diff --git a/db/schema_migrations/20210818185548 b/db/schema_migrations/20210818185548
new file mode 100644
index 00000000000..42826826512
--- /dev/null
+++ b/db/schema_migrations/20210818185548
@@ -0,0 +1 @@
+88ca485c8513df96b1f1aec1585c385223dc53889e547db42b509b0cd1bea9b7 \ No newline at end of file
diff --git a/db/schema_migrations/20210818185845 b/db/schema_migrations/20210818185845
new file mode 100644
index 00000000000..7ed2204aeb6
--- /dev/null
+++ b/db/schema_migrations/20210818185845
@@ -0,0 +1 @@
+dc8ca347fb0c87e1a66389fd9f37fa9702f8bd53237ada40192bb0a875dbe940 \ No newline at end of file
diff --git a/db/schema_migrations/20210818193008 b/db/schema_migrations/20210818193008
new file mode 100644
index 00000000000..aef60a5ab5b
--- /dev/null
+++ b/db/schema_migrations/20210818193008
@@ -0,0 +1 @@
+d24d10134d661728dbe688da2b90da55c584627ca764a6cc4604631f8a5fa334 \ No newline at end of file
diff --git a/db/schema_migrations/20210818200455 b/db/schema_migrations/20210818200455
new file mode 100644
index 00000000000..c476ef5b488
--- /dev/null
+++ b/db/schema_migrations/20210818200455
@@ -0,0 +1 @@
+25eb43de74e7eb158718b19d8cea5da2540507e96fcbe47d4829fa806e773308 \ No newline at end of file
diff --git a/db/schema_migrations/20210818220234 b/db/schema_migrations/20210818220234
new file mode 100644
index 00000000000..e32f27029cf
--- /dev/null
+++ b/db/schema_migrations/20210818220234
@@ -0,0 +1 @@
+8d247218468ad383d1a8a2dc67d5e7e67ddad2a33a38203a41e49c4c018adc7e \ No newline at end of file
diff --git a/db/schema_migrations/20210819120243 b/db/schema_migrations/20210819120243
new file mode 100644
index 00000000000..e31d0ca6414
--- /dev/null
+++ b/db/schema_migrations/20210819120243
@@ -0,0 +1 @@
+5c74d34171ed9129ffbb3efe5417da1ba857cd729837544e58074debd5afca88 \ No newline at end of file
diff --git a/db/schema_migrations/20210819145000 b/db/schema_migrations/20210819145000
new file mode 100644
index 00000000000..56301031459
--- /dev/null
+++ b/db/schema_migrations/20210819145000
@@ -0,0 +1 @@
+a73a33d30af332c8c01cd9d55618a1b84bc9074ffe4d06fd72c8eb37cd264954 \ No newline at end of file
diff --git a/db/schema_migrations/20210819152723 b/db/schema_migrations/20210819152723
new file mode 100644
index 00000000000..b5f4d2795f7
--- /dev/null
+++ b/db/schema_migrations/20210819152723
@@ -0,0 +1 @@
+b311fdb0a6e0e10ca3c67b9b2c3d920f8e735f0fd8398fdaa25853e14f88ae97 \ No newline at end of file
diff --git a/db/schema_migrations/20210819153805 b/db/schema_migrations/20210819153805
new file mode 100644
index 00000000000..fe0d1dcfd69
--- /dev/null
+++ b/db/schema_migrations/20210819153805
@@ -0,0 +1 @@
+195d2444bf9d5113ee589b1accdbf04efbc7fb84c2ead4deed3985b254345e07 \ No newline at end of file
diff --git a/db/schema_migrations/20210819162047 b/db/schema_migrations/20210819162047
new file mode 100644
index 00000000000..c50e07543da
--- /dev/null
+++ b/db/schema_migrations/20210819162047
@@ -0,0 +1 @@
+5a02c5a24bb4c7cb63da2e5cc53ff89461f328d0092bb4bb6589223dc4bdae8c \ No newline at end of file
diff --git a/db/schema_migrations/20210820171834 b/db/schema_migrations/20210820171834
new file mode 100644
index 00000000000..be62c2b9a63
--- /dev/null
+++ b/db/schema_migrations/20210820171834
@@ -0,0 +1 @@
+892a71a3f6fdeb20cb2837a426d6d0931c756f8bf3d647e520a72a0bb6f78309 \ No newline at end of file
diff --git a/db/schema_migrations/20210823113259 b/db/schema_migrations/20210823113259
new file mode 100644
index 00000000000..79f416332d8
--- /dev/null
+++ b/db/schema_migrations/20210823113259
@@ -0,0 +1 @@
+06b44a856fc970f52b19ad8eeb38f885182003eff50ef1524ecf30887f4664d9 \ No newline at end of file
diff --git a/db/schema_migrations/20210823132600 b/db/schema_migrations/20210823132600
new file mode 100644
index 00000000000..85ab3b55ee4
--- /dev/null
+++ b/db/schema_migrations/20210823132600
@@ -0,0 +1 @@
+7324c3803c910338261556c65cae5d0827e78b77890386e402e056d480c3486b \ No newline at end of file
diff --git a/db/schema_migrations/20210823142036 b/db/schema_migrations/20210823142036
new file mode 100644
index 00000000000..ec24927dfcf
--- /dev/null
+++ b/db/schema_migrations/20210823142036
@@ -0,0 +1 @@
+874ed71410406d10ade9c834d1374b039effd9e88514d327d04275e11e837ffb \ No newline at end of file
diff --git a/db/schema_migrations/20210823172643 b/db/schema_migrations/20210823172643
new file mode 100644
index 00000000000..e89e11bb544
--- /dev/null
+++ b/db/schema_migrations/20210823172643
@@ -0,0 +1 @@
+e6570f8ee366431b17b34051b9d0dcf2aff6216f8d65b3b6eec5be5666fed229 \ No newline at end of file
diff --git a/db/schema_migrations/20210823193234 b/db/schema_migrations/20210823193234
new file mode 100644
index 00000000000..d47f1ec567a
--- /dev/null
+++ b/db/schema_migrations/20210823193234
@@ -0,0 +1 @@
+b85ef326056bb152d527e34b49caa3c40ee8685c3b14654992246c6adf082f8c \ No newline at end of file
diff --git a/db/schema_migrations/20210823213417 b/db/schema_migrations/20210823213417
new file mode 100644
index 00000000000..bcd41f479e6
--- /dev/null
+++ b/db/schema_migrations/20210823213417
@@ -0,0 +1 @@
+62496310640493bf9b7f0e1cbe91b170542da3250a1cf482f5e0237d0e8847b1 \ No newline at end of file
diff --git a/db/schema_migrations/20210824055322 b/db/schema_migrations/20210824055322
new file mode 100644
index 00000000000..ed3925f8ac5
--- /dev/null
+++ b/db/schema_migrations/20210824055322
@@ -0,0 +1 @@
+abd298ec9e6d9016c05032504d9ff0de7af9c6a031e0eacb041f29e59e82f289 \ No newline at end of file
diff --git a/db/schema_migrations/20210824102624 b/db/schema_migrations/20210824102624
new file mode 100644
index 00000000000..c736c84f8f8
--- /dev/null
+++ b/db/schema_migrations/20210824102624
@@ -0,0 +1 @@
+f1fc9e062f5100db6a549fffa2fcd78d8eb6854cea388a6ac7addf4f6f232920 \ No newline at end of file
diff --git a/db/schema_migrations/20210824102750 b/db/schema_migrations/20210824102750
new file mode 100644
index 00000000000..520c8365d41
--- /dev/null
+++ b/db/schema_migrations/20210824102750
@@ -0,0 +1 @@
+cc99eb2b40ee88d4d6df07253f599deb26be2fca7b941c5cecb2f8fb7ff3641d \ No newline at end of file
diff --git a/db/schema_migrations/20210824105038 b/db/schema_migrations/20210824105038
new file mode 100644
index 00000000000..24772827b3b
--- /dev/null
+++ b/db/schema_migrations/20210824105038
@@ -0,0 +1 @@
+9fe4e2a3d5c50507220ac8363a9f7975ca1fc87575ee0c2ba8948c6d9bcd7019 \ No newline at end of file
diff --git a/db/schema_migrations/20210824160459 b/db/schema_migrations/20210824160459
new file mode 100644
index 00000000000..afab14f962c
--- /dev/null
+++ b/db/schema_migrations/20210824160459
@@ -0,0 +1 @@
+39924743a04ba01cb85eed5ef88762a6a3e29c56f397a59632ba43e0ccec40b3 \ No newline at end of file
diff --git a/db/schema_migrations/20210824174615 b/db/schema_migrations/20210824174615
new file mode 100644
index 00000000000..56160c801f1
--- /dev/null
+++ b/db/schema_migrations/20210824174615
@@ -0,0 +1 @@
+830cf08352b0d1f0c7f08ea67107466ea1d6a478c6f47d5e19f0ffa6c57f5641 \ No newline at end of file
diff --git a/db/schema_migrations/20210825104558 b/db/schema_migrations/20210825104558
new file mode 100644
index 00000000000..3457bbf1ace
--- /dev/null
+++ b/db/schema_migrations/20210825104558
@@ -0,0 +1 @@
+ab678fb5e8ddf7e6dc84f36248440e94953d7c85ee6a50f4e5c06f32c6ee66ec \ No newline at end of file
diff --git a/db/schema_migrations/20210825104656 b/db/schema_migrations/20210825104656
new file mode 100644
index 00000000000..9f91a3c364f
--- /dev/null
+++ b/db/schema_migrations/20210825104656
@@ -0,0 +1 @@
+c15d736eb441503d321e1bf377edd204aa1b5822ed697cce2934ff87eca441a9 \ No newline at end of file
diff --git a/db/schema_migrations/20210825110016 b/db/schema_migrations/20210825110016
new file mode 100644
index 00000000000..8c1b11653f1
--- /dev/null
+++ b/db/schema_migrations/20210825110016
@@ -0,0 +1 @@
+e9e8444056a114d471f60156ec1e5a96082c7922604f1926c0256eb17986c484 \ No newline at end of file
diff --git a/db/schema_migrations/20210825150212 b/db/schema_migrations/20210825150212
new file mode 100644
index 00000000000..bdd83542199
--- /dev/null
+++ b/db/schema_migrations/20210825150212
@@ -0,0 +1 @@
+5dc6a4f9ecbd705bf8361c65b29931cde94968084e8ae7945a27acdcbd6475c8 \ No newline at end of file
diff --git a/db/schema_migrations/20210825182303 b/db/schema_migrations/20210825182303
new file mode 100644
index 00000000000..af9dc177a72
--- /dev/null
+++ b/db/schema_migrations/20210825182303
@@ -0,0 +1 @@
+a7f4911fcb9ab939a6e5e9a6e5e927fd6828ff062324d8483d78c8f8a4ded4e6 \ No newline at end of file
diff --git a/db/schema_migrations/20210825190458 b/db/schema_migrations/20210825190458
new file mode 100644
index 00000000000..e03c12e4284
--- /dev/null
+++ b/db/schema_migrations/20210825190458
@@ -0,0 +1 @@
+43d152f4235a07111a401be7b52a527571be04861c71381c311d6a48c8574dc9 \ No newline at end of file
diff --git a/db/schema_migrations/20210825193448 b/db/schema_migrations/20210825193448
new file mode 100644
index 00000000000..b62b45b61ae
--- /dev/null
+++ b/db/schema_migrations/20210825193448
@@ -0,0 +1 @@
+d9c7cc7721b28cbd442bf40255ecfbd20d0abf4cd31631c150ebdc05c76062be \ No newline at end of file
diff --git a/db/schema_migrations/20210825193548 b/db/schema_migrations/20210825193548
new file mode 100644
index 00000000000..0255e6719ef
--- /dev/null
+++ b/db/schema_migrations/20210825193548
@@ -0,0 +1 @@
+b97b77aef61db2e51106ac090f5511a67fa85be8f3741f618fe03c8c03ecd88c \ No newline at end of file
diff --git a/db/schema_migrations/20210825193652 b/db/schema_migrations/20210825193652
new file mode 100644
index 00000000000..0ecca0962dc
--- /dev/null
+++ b/db/schema_migrations/20210825193652
@@ -0,0 +1 @@
+fd7aef11635bc4c5d6b9346dbed90f6c114da7b7a33744083e8610f3850e4736 \ No newline at end of file
diff --git a/db/schema_migrations/20210826110839 b/db/schema_migrations/20210826110839
new file mode 100644
index 00000000000..165141ef852
--- /dev/null
+++ b/db/schema_migrations/20210826110839
@@ -0,0 +1 @@
+72b64ddbaf86eb296fe49fd38bea759d5247414142fe1cd11aee7e1d6171e142 \ No newline at end of file
diff --git a/db/schema_migrations/20210826120834 b/db/schema_migrations/20210826120834
new file mode 100644
index 00000000000..ebbdb86049c
--- /dev/null
+++ b/db/schema_migrations/20210826120834
@@ -0,0 +1 @@
+a8cd5165815a2f1e6b825ea3ee2a9bde88c1790f6ebe92296bee6a9a892b83f2 \ No newline at end of file
diff --git a/db/schema_migrations/20210826122748 b/db/schema_migrations/20210826122748
new file mode 100644
index 00000000000..e6d87674da3
--- /dev/null
+++ b/db/schema_migrations/20210826122748
@@ -0,0 +1 @@
+a1290cc671c487a7c24bfdb02c564d656a6606258e680e65ed108e3a28de10ca \ No newline at end of file
diff --git a/db/schema_migrations/20210826124311 b/db/schema_migrations/20210826124311
new file mode 100644
index 00000000000..c63d85f13b7
--- /dev/null
+++ b/db/schema_migrations/20210826124311
@@ -0,0 +1 @@
+2cad14b3b7cb4f958a26cb6d4e76380338b745cc90c2e31c521614ea277c4ee9 \ No newline at end of file
diff --git a/db/schema_migrations/20210826145509 b/db/schema_migrations/20210826145509
new file mode 100644
index 00000000000..9f93b675b12
--- /dev/null
+++ b/db/schema_migrations/20210826145509
@@ -0,0 +1 @@
+661b2f03f2387f0d49cbb11c333ad29c6af5caed1f43e860fa0f263f8e7371c2 \ No newline at end of file
diff --git a/db/schema_migrations/20210826170902 b/db/schema_migrations/20210826170902
new file mode 100644
index 00000000000..f20877de3a5
--- /dev/null
+++ b/db/schema_migrations/20210826170902
@@ -0,0 +1 @@
+97536098a2d3b127c6e6b9c079d10d272552dc9064f6b23fb92482baffaac7db \ No newline at end of file
diff --git a/db/schema_migrations/20210826171758 b/db/schema_migrations/20210826171758
new file mode 100644
index 00000000000..a0bb0f5cfc6
--- /dev/null
+++ b/db/schema_migrations/20210826171758
@@ -0,0 +1 @@
+96a8a87cc075b7a2bf3919d0c891fdfedb2a9b7bab6460b82bfb43a3f8abe3cf \ No newline at end of file
diff --git a/db/schema_migrations/20210826193907 b/db/schema_migrations/20210826193907
new file mode 100644
index 00000000000..417333d7212
--- /dev/null
+++ b/db/schema_migrations/20210826193907
@@ -0,0 +1 @@
+b7916e025131f11da97ab89a01b32d1dbacf94bb96dc84877ba18404c8b0b2ba \ No newline at end of file
diff --git a/db/schema_migrations/20210830085837 b/db/schema_migrations/20210830085837
new file mode 100644
index 00000000000..590ff1fe13b
--- /dev/null
+++ b/db/schema_migrations/20210830085837
@@ -0,0 +1 @@
+cf1a51194961500cb63d848afb1d5ebbf2ef77f54d60957e92c9dd6a667913ea \ No newline at end of file
diff --git a/db/schema_migrations/20210830104800 b/db/schema_migrations/20210830104800
new file mode 100644
index 00000000000..ca1aa9180e2
--- /dev/null
+++ b/db/schema_migrations/20210830104800
@@ -0,0 +1 @@
+84a68304f95ae04b85625c214b28a251014582fb142390ff3df8ea6d6f0947e1 \ No newline at end of file
diff --git a/db/schema_migrations/20210830140524 b/db/schema_migrations/20210830140524
new file mode 100644
index 00000000000..ed07d932278
--- /dev/null
+++ b/db/schema_migrations/20210830140524
@@ -0,0 +1 @@
+54f7c66eed745b62d0b53a407a96721f90392ab7f800db9c8a2607f22974ef3c \ No newline at end of file
diff --git a/db/schema_migrations/20210830154358 b/db/schema_migrations/20210830154358
new file mode 100644
index 00000000000..7486c54c4c5
--- /dev/null
+++ b/db/schema_migrations/20210830154358
@@ -0,0 +1 @@
+04a44d0e261b26cc7f39b81a4c59ea8e4903d6d7bf73c2004b426204db4491bc \ No newline at end of file
diff --git a/db/schema_migrations/20210831123008 b/db/schema_migrations/20210831123008
new file mode 100644
index 00000000000..35a14b2b10b
--- /dev/null
+++ b/db/schema_migrations/20210831123008
@@ -0,0 +1 @@
+36572ad3a4a8a7511512ff45e2a68252950ce852af1b5a28c6b4e4491f97be07 \ No newline at end of file
diff --git a/db/schema_migrations/20210831134840 b/db/schema_migrations/20210831134840
new file mode 100644
index 00000000000..d05a375f8fd
--- /dev/null
+++ b/db/schema_migrations/20210831134840
@@ -0,0 +1 @@
+6cad93bd4c086a60164c3cb5c42737194c4b7b20c1ea9f4c6d998b7c3a8918b5 \ No newline at end of file
diff --git a/db/schema_migrations/20210831135249 b/db/schema_migrations/20210831135249
new file mode 100644
index 00000000000..a08cfa6d8d9
--- /dev/null
+++ b/db/schema_migrations/20210831135249
@@ -0,0 +1 @@
+78b14e92c91e7ccb11b7b37e89e8e55749cf109b0fa5ce06e4e396a2ac743f1c \ No newline at end of file
diff --git a/db/schema_migrations/20210831203408 b/db/schema_migrations/20210831203408
new file mode 100644
index 00000000000..6ab3f810e57
--- /dev/null
+++ b/db/schema_migrations/20210831203408
@@ -0,0 +1 @@
+50a06a2a57ed26c25af53d3d7f6f5ef73efde8a23a36c5f825af56b4d0c4c3f6 \ No newline at end of file
diff --git a/db/schema_migrations/20210901044202 b/db/schema_migrations/20210901044202
new file mode 100644
index 00000000000..8601b0d20a2
--- /dev/null
+++ b/db/schema_migrations/20210901044202
@@ -0,0 +1 @@
+1f070444e77eb56ba612f60ed4a0d90b8a44c4af419a09c873f3bf663c78af72 \ No newline at end of file
diff --git a/db/schema_migrations/20210901044237 b/db/schema_migrations/20210901044237
new file mode 100644
index 00000000000..25418c94441
--- /dev/null
+++ b/db/schema_migrations/20210901044237
@@ -0,0 +1 @@
+0d8caaa078914ed2bd43b383ee2efe50093947d65862c2f4dd8dc960cad0a43e \ No newline at end of file
diff --git a/db/schema_migrations/20210901065504 b/db/schema_migrations/20210901065504
new file mode 100644
index 00000000000..f62e6ce1272
--- /dev/null
+++ b/db/schema_migrations/20210901065504
@@ -0,0 +1 @@
+9724a5fc1703418f9b1ea1d5375fc3b01834b30e5ff16c60537db5cb00bc210a \ No newline at end of file
diff --git a/db/schema_migrations/20210901153324 b/db/schema_migrations/20210901153324
new file mode 100644
index 00000000000..a08982bad39
--- /dev/null
+++ b/db/schema_migrations/20210901153324
@@ -0,0 +1 @@
+34287b86616026b94374856991c793ad869c52badddc09be923984002c6214bd \ No newline at end of file
diff --git a/db/schema_migrations/20210901184511 b/db/schema_migrations/20210901184511
new file mode 100644
index 00000000000..45a3b3b8c18
--- /dev/null
+++ b/db/schema_migrations/20210901184511
@@ -0,0 +1 @@
+40780a28f881d4e80bdb6b023f22804c4da735223323c8cf03cfcdcaf5337fe6 \ No newline at end of file
diff --git a/db/schema_migrations/20210902144144 b/db/schema_migrations/20210902144144
new file mode 100644
index 00000000000..330569f1beb
--- /dev/null
+++ b/db/schema_migrations/20210902144144
@@ -0,0 +1 @@
+c99df310082dd6f5faff3cfd90dfca88af26d840889910ebac0e73ba483a09b2 \ No newline at end of file
diff --git a/db/schema_migrations/20210902171406 b/db/schema_migrations/20210902171406
new file mode 100644
index 00000000000..89635e256ea
--- /dev/null
+++ b/db/schema_migrations/20210902171406
@@ -0,0 +1 @@
+d7be9a34d626e507add67f407a6fa0b45f16b244e8ebeeb071debc538fa25b49 \ No newline at end of file
diff --git a/db/schema_migrations/20210902171808 b/db/schema_migrations/20210902171808
new file mode 100644
index 00000000000..1398c2db4b6
--- /dev/null
+++ b/db/schema_migrations/20210902171808
@@ -0,0 +1 @@
+09b482e4716a2b0808ad83770222baed8e863a8f94f85f77ed2d557eaa348df4 \ No newline at end of file
diff --git a/db/schema_migrations/20210902184334 b/db/schema_migrations/20210902184334
new file mode 100644
index 00000000000..f35699b357e
--- /dev/null
+++ b/db/schema_migrations/20210902184334
@@ -0,0 +1 @@
+508b8d4608d28b2a12cf429262c3dd336e130013a41e51ff6c95027ece1540e5 \ No newline at end of file
diff --git a/db/schema_migrations/20210903054158 b/db/schema_migrations/20210903054158
new file mode 100644
index 00000000000..8810481ab85
--- /dev/null
+++ b/db/schema_migrations/20210903054158
@@ -0,0 +1 @@
+113d6bb813a89646d48c8ba6a86fc8e73f741d5c345f603bfe33939fb90f9428 \ No newline at end of file
diff --git a/db/schema_migrations/20210906100021 b/db/schema_migrations/20210906100021
new file mode 100644
index 00000000000..9ae19276eab
--- /dev/null
+++ b/db/schema_migrations/20210906100021
@@ -0,0 +1 @@
+74f6800c968f80e18aa000df42fd23086404fdd7a863237e453541b7eeb4eb7f \ No newline at end of file
diff --git a/db/schema_migrations/20210906100316 b/db/schema_migrations/20210906100316
new file mode 100644
index 00000000000..4ce17059b07
--- /dev/null
+++ b/db/schema_migrations/20210906100316
@@ -0,0 +1 @@
+b7329d4ff7ee651b56cb86c7091e0d933c4f43a77125323fb6c283eedcb737c2 \ No newline at end of file
diff --git a/db/schema_migrations/20210907021940 b/db/schema_migrations/20210907021940
new file mode 100644
index 00000000000..c6392fca8de
--- /dev/null
+++ b/db/schema_migrations/20210907021940
@@ -0,0 +1 @@
+53d1dee0bbe106eeaad3eda6e8012475cf4b59d30f78020c8d2ecf3499ff7e0f \ No newline at end of file
diff --git a/db/schema_migrations/20210907033745 b/db/schema_migrations/20210907033745
new file mode 100644
index 00000000000..23d1c138824
--- /dev/null
+++ b/db/schema_migrations/20210907033745
@@ -0,0 +1 @@
+d02cc8e136f1d761a34c7c585a3fe2b8c3bc3bca67e0e45f950248a5fad36a24 \ No newline at end of file
diff --git a/db/schema_migrations/20210907041000 b/db/schema_migrations/20210907041000
new file mode 100644
index 00000000000..9b7b3d4b14c
--- /dev/null
+++ b/db/schema_migrations/20210907041000
@@ -0,0 +1 @@
+23d4d2d037cd70c5b810824a837b45f016a3be5d112938123c1da08416f667cd \ No newline at end of file
diff --git a/db/schema_migrations/20210907182337 b/db/schema_migrations/20210907182337
new file mode 100644
index 00000000000..cc3d32067c2
--- /dev/null
+++ b/db/schema_migrations/20210907182337
@@ -0,0 +1 @@
+ad564a1fda815473b09f1eda469e67cdd8f532b9b481f7e8ae3ddb8f2df6ee40 \ No newline at end of file
diff --git a/db/schema_migrations/20210907182359 b/db/schema_migrations/20210907182359
new file mode 100644
index 00000000000..41e72e9dfec
--- /dev/null
+++ b/db/schema_migrations/20210907182359
@@ -0,0 +1 @@
+da57784c8c7f8bcb3c8c61089b5a695efdb31b209cb1616af68240380c734669 \ No newline at end of file
diff --git a/db/schema_migrations/20210907211557 b/db/schema_migrations/20210907211557
new file mode 100644
index 00000000000..e89552729ba
--- /dev/null
+++ b/db/schema_migrations/20210907211557
@@ -0,0 +1 @@
+387dcbda7c3b32050298d8a679361a17916a66d0ab686211f0d1a0dc708c4a74 \ No newline at end of file
diff --git a/db/schema_migrations/20210908060951 b/db/schema_migrations/20210908060951
new file mode 100644
index 00000000000..cd4ed794cc5
--- /dev/null
+++ b/db/schema_migrations/20210908060951
@@ -0,0 +1 @@
+716fad7f9005a40d0c6a3acb8e348c7e9459a6a619fc0bf085f231f328f19fd1 \ No newline at end of file
diff --git a/db/schema_migrations/20210908061132 b/db/schema_migrations/20210908061132
new file mode 100644
index 00000000000..a5b7e482228
--- /dev/null
+++ b/db/schema_migrations/20210908061132
@@ -0,0 +1 @@
+f9e14410f22c94d0500102bb0fd0a3a6bd27343b74810b852ceb1349a04be72d \ No newline at end of file
diff --git a/db/schema_migrations/20210908100810 b/db/schema_migrations/20210908100810
new file mode 100644
index 00000000000..a8c9023a1cc
--- /dev/null
+++ b/db/schema_migrations/20210908100810
@@ -0,0 +1 @@
+06e45cf159cf1182b34e83f893bcff65e4722dded2bf4cbcf61fafd652158823 \ No newline at end of file
diff --git a/db/schema_migrations/20210908132335 b/db/schema_migrations/20210908132335
new file mode 100644
index 00000000000..864d6ccc942
--- /dev/null
+++ b/db/schema_migrations/20210908132335
@@ -0,0 +1 @@
+399e35197111c257786a2bdf5dac990a26f48d2cc8493de642dcfa47ddececd2 \ No newline at end of file
diff --git a/db/schema_migrations/20210908140437 b/db/schema_migrations/20210908140437
new file mode 100644
index 00000000000..fec99dfe6fd
--- /dev/null
+++ b/db/schema_migrations/20210908140437
@@ -0,0 +1 @@
+a8dc6d1fecf7b26182dd89f4dae088fb315774ff4720c282f608bd0c45c75a41 \ No newline at end of file
diff --git a/db/schema_migrations/20210908185736 b/db/schema_migrations/20210908185736
new file mode 100644
index 00000000000..826ec2b44e8
--- /dev/null
+++ b/db/schema_migrations/20210908185736
@@ -0,0 +1 @@
+4e9a585d33caed70c3e003e4f0127158ab9c98c790f8131012f052c2bd9cd1f0 \ No newline at end of file
diff --git a/db/schema_migrations/20210908185754 b/db/schema_migrations/20210908185754
new file mode 100644
index 00000000000..53b9efc22d4
--- /dev/null
+++ b/db/schema_migrations/20210908185754
@@ -0,0 +1 @@
+fc70f26e1d691773728e8e2251b23fe39247fc233996c2161143c660a92fe141 \ No newline at end of file
diff --git a/db/schema_migrations/20210909104800 b/db/schema_migrations/20210909104800
new file mode 100644
index 00000000000..70ad28d72b8
--- /dev/null
+++ b/db/schema_migrations/20210909104800
@@ -0,0 +1 @@
+834825de758314db01a3daa2d2b943c11751553705c4dd078f2087b9ec6ff7f7 \ No newline at end of file
diff --git a/db/schema_migrations/20210909152027 b/db/schema_migrations/20210909152027
new file mode 100644
index 00000000000..39db0c43aa6
--- /dev/null
+++ b/db/schema_migrations/20210909152027
@@ -0,0 +1 @@
+abed3f9a6c188890d3dcd21f73a09347f8ccec0f6cc448220fadba5cbda17281 \ No newline at end of file
diff --git a/db/schema_migrations/20210909184349 b/db/schema_migrations/20210909184349
new file mode 100644
index 00000000000..5997ddc46cf
--- /dev/null
+++ b/db/schema_migrations/20210909184349
@@ -0,0 +1 @@
+6be3a6f8f748d8f02e2d42cd1a5103ec8bd5c17097d9e440b152685fc8d6ff83 \ No newline at end of file
diff --git a/db/schema_migrations/20210910141043 b/db/schema_migrations/20210910141043
new file mode 100644
index 00000000000..ccb687b8bda
--- /dev/null
+++ b/db/schema_migrations/20210910141043
@@ -0,0 +1 @@
+3885d2fca4166e71610cd957f1c5a703118cbb5ba47a8d494eb4e017fe499a7d \ No newline at end of file
diff --git a/db/schema_migrations/20210913010411 b/db/schema_migrations/20210913010411
new file mode 100644
index 00000000000..8ae59414604
--- /dev/null
+++ b/db/schema_migrations/20210913010411
@@ -0,0 +1 @@
+71d51d1ac74f5c559bf41b23e5677af7228ba824da835afbe0f2299695912c19 \ No newline at end of file
diff --git a/db/schema_migrations/20210913010432 b/db/schema_migrations/20210913010432
new file mode 100644
index 00000000000..db2f53a8d06
--- /dev/null
+++ b/db/schema_migrations/20210913010432
@@ -0,0 +1 @@
+172e77890657dd82c6ce770c286894731f6ef7fbcffb4b4fc97e0a41d132b8e8 \ No newline at end of file
diff --git a/db/schema_migrations/20210913122457 b/db/schema_migrations/20210913122457
new file mode 100644
index 00000000000..e8f322c64c8
--- /dev/null
+++ b/db/schema_migrations/20210913122457
@@ -0,0 +1 @@
+031fb794e4fa3d54098596defd9de6fb1e507e01bd8f02462c0079e7e59c3416 \ No newline at end of file
diff --git a/db/schema_migrations/20210914094840 b/db/schema_migrations/20210914094840
new file mode 100644
index 00000000000..51d46c05ae6
--- /dev/null
+++ b/db/schema_migrations/20210914094840
@@ -0,0 +1 @@
+994de4d18202a420a7184cabe787f6e3f872900147df0cd848731483e6d87566 \ No newline at end of file
diff --git a/db/schema_migrations/20210915202900 b/db/schema_migrations/20210915202900
new file mode 100644
index 00000000000..bbe7f918f7a
--- /dev/null
+++ b/db/schema_migrations/20210915202900
@@ -0,0 +1 @@
+cc8f1bea8c722dfa06fc23a3dbaaacd7f1b7c5f7b529ebfab34b7c7c38e5db79 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index eee73636eb1..d7e00112d73 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -10,57 +10,37 @@ CREATE EXTENSION IF NOT EXISTS btree_gist;
CREATE EXTENSION IF NOT EXISTS pg_trgm;
-CREATE FUNCTION integrations_set_type_new() RETURNS trigger
+CREATE FUNCTION delete_associated_project_namespace() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
-WITH mapping(old_type, new_type) AS (VALUES
- ('AsanaService', 'Integrations::Asana'),
- ('AssemblaService', 'Integrations::Assembla'),
- ('BambooService', 'Integrations::Bamboo'),
- ('BugzillaService', 'Integrations::Bugzilla'),
- ('BuildkiteService', 'Integrations::Buildkite'),
- ('CampfireService', 'Integrations::Campfire'),
- ('ConfluenceService', 'Integrations::Confluence'),
- ('CustomIssueTrackerService', 'Integrations::CustomIssueTracker'),
- ('DatadogService', 'Integrations::Datadog'),
- ('DiscordService', 'Integrations::Discord'),
- ('DroneCiService', 'Integrations::DroneCi'),
- ('EmailsOnPushService', 'Integrations::EmailsOnPush'),
- ('EwmService', 'Integrations::Ewm'),
- ('ExternalWikiService', 'Integrations::ExternalWiki'),
- ('FlowdockService', 'Integrations::Flowdock'),
- ('HangoutsChatService', 'Integrations::HangoutsChat'),
- ('IrkerService', 'Integrations::Irker'),
- ('JenkinsService', 'Integrations::Jenkins'),
- ('JiraService', 'Integrations::Jira'),
- ('MattermostService', 'Integrations::Mattermost'),
- ('MattermostSlashCommandsService', 'Integrations::MattermostSlashCommands'),
- ('MicrosoftTeamsService', 'Integrations::MicrosoftTeams'),
- ('MockCiService', 'Integrations::MockCi'),
- ('MockMonitoringService', 'Integrations::MockMonitoring'),
- ('PackagistService', 'Integrations::Packagist'),
- ('PipelinesEmailService', 'Integrations::PipelinesEmail'),
- ('PivotaltrackerService', 'Integrations::Pivotaltracker'),
- ('PrometheusService', 'Integrations::Prometheus'),
- ('PushoverService', 'Integrations::Pushover'),
- ('RedmineService', 'Integrations::Redmine'),
- ('SlackService', 'Integrations::Slack'),
- ('SlackSlashCommandsService', 'Integrations::SlackSlashCommands'),
- ('TeamcityService', 'Integrations::Teamcity'),
- ('UnifyCircuitService', 'Integrations::UnifyCircuit'),
- ('YoutrackService', 'Integrations::Youtrack'),
- ('WebexTeamsService', 'Integrations::WebexTeams'),
-
- -- EE-only integrations
- ('GithubService', 'Integrations::Github'),
- ('GitlabSlackApplicationService', 'Integrations::GitlabSlackApplication')
-)
+DELETE FROM namespaces
+WHERE namespaces.id = OLD.project_namespace_id AND
+namespaces.type = 'Project';
+RETURN NULL;
+
+END
+$$;
-UPDATE integrations SET type_new = mapping.new_type
-FROM mapping
-WHERE integrations.id = NEW.id
- AND mapping.old_type = NEW.type;
+CREATE FUNCTION insert_into_loose_foreign_keys_deleted_records() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ INSERT INTO loose_foreign_keys_deleted_records
+ (deleted_table_name, deleted_table_primary_key_value)
+ SELECT TG_TABLE_NAME, old_table.id FROM old_table
+ ON CONFLICT DO NOTHING;
+
+ RETURN NULL;
+END
+$$;
+
+CREATE FUNCTION integrations_set_type_new() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+UPDATE integrations SET type_new = regexp_replace(NEW.type, '\A(.+)Service\Z', 'Integrations::\1')
+WHERE integrations.id = NEW.id;
RETURN NULL;
END
@@ -97,24 +77,6 @@ RETURN NULL;
END
$$;
-CREATE FUNCTION trigger_07c94931164e() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
-BEGIN
- NEW."event_id_convert_to_bigint" := NEW."event_id";
- RETURN NEW;
-END;
-$$;
-
-CREATE FUNCTION trigger_21e7a2602957() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
-BEGIN
- NEW."build_id_convert_to_bigint" := NEW."build_id";
- RETURN NEW;
-END;
-$$;
-
CREATE FUNCTION trigger_3f6129be01d2() RETURNS trigger
LANGUAGE plpgsql
AS $$
@@ -125,24 +87,6 @@ BEGIN
END;
$$;
-CREATE FUNCTION trigger_490d204c00b3() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
-BEGIN
- NEW."id_convert_to_bigint" := NEW."id";
- RETURN NEW;
-END;
-$$;
-
-CREATE FUNCTION trigger_51ab7cef8934() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
-BEGIN
- NEW."build_id_convert_to_bigint" := NEW."build_id";
- RETURN NEW;
-END;
-$$;
-
CREATE FUNCTION trigger_542d6c2ad72e() RETURNS trigger
LANGUAGE plpgsql
AS $$
@@ -152,33 +96,6 @@ BEGIN
END;
$$;
-CREATE FUNCTION trigger_69523443cc10() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
-BEGIN
- NEW."id_convert_to_bigint" := NEW."id";
- RETURN NEW;
-END;
-$$;
-
-CREATE FUNCTION trigger_77f5e1d20482() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
-BEGIN
- NEW."deployable_id_convert_to_bigint" := NEW."deployable_id";
- RETURN NEW;
-END;
-$$;
-
-CREATE FUNCTION trigger_8485e97c00e3() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
-BEGIN
- NEW."source_job_id_convert_to_bigint" := NEW."source_job_id";
- RETURN NEW;
-END;
-$$;
-
CREATE FUNCTION trigger_8487d4de3e7b() RETURNS trigger
LANGUAGE plpgsql
AS $$
@@ -207,34 +124,6 @@ BEGIN
END;
$$;
-CREATE FUNCTION trigger_be1804f21693() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
-BEGIN
- NEW."id_convert_to_bigint" := NEW."id";
- NEW."job_id_convert_to_bigint" := NEW."job_id";
- RETURN NEW;
-END;
-$$;
-
-CREATE FUNCTION trigger_cf2f9e35f002() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
-BEGIN
- NEW."build_id_convert_to_bigint" := NEW."build_id";
- RETURN NEW;
-END;
-$$;
-
-CREATE FUNCTION trigger_f1ca8ec18d78() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
-BEGIN
- NEW."job_artifact_id_convert_to_bigint" := NEW."job_artifact_id";
- RETURN NEW;
-END;
-$$;
-
CREATE TABLE audit_events (
id bigint NOT NULL,
author_id integer NOT NULL,
@@ -267,6 +156,24 @@ CREATE TABLE incident_management_pending_alert_escalations (
)
PARTITION BY RANGE (process_at);
+CREATE TABLE incident_management_pending_issue_escalations (
+ id bigint NOT NULL,
+ rule_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ process_at timestamp with time zone NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL
+)
+PARTITION BY RANGE (process_at);
+
+CREATE TABLE loose_foreign_keys_deleted_records (
+ created_at timestamp with time zone DEFAULT now() NOT NULL,
+ deleted_table_name text NOT NULL,
+ deleted_table_primary_key_value bigint NOT NULL,
+ CONSTRAINT check_7229f9527e CHECK ((char_length(deleted_table_name) <= 63))
+)
+PARTITION BY RANGE (created_at);
+
CREATE TABLE web_hook_logs (
id bigint NOT NULL,
web_hook_id integer NOT NULL,
@@ -284,6 +191,798 @@ CREATE TABLE web_hook_logs (
)
PARTITION BY RANGE (created_at);
+CREATE TABLE analytics_cycle_analytics_issue_stage_events (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+)
+PARTITION BY HASH (stage_event_hash_id);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00 FOR VALUES WITH (modulus 32, remainder 0);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01 FOR VALUES WITH (modulus 32, remainder 1);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02 FOR VALUES WITH (modulus 32, remainder 2);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03 FOR VALUES WITH (modulus 32, remainder 3);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_04 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_04 FOR VALUES WITH (modulus 32, remainder 4);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05 FOR VALUES WITH (modulus 32, remainder 5);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06 FOR VALUES WITH (modulus 32, remainder 6);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07 FOR VALUES WITH (modulus 32, remainder 7);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08 FOR VALUES WITH (modulus 32, remainder 8);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09 FOR VALUES WITH (modulus 32, remainder 9);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10 FOR VALUES WITH (modulus 32, remainder 10);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11 FOR VALUES WITH (modulus 32, remainder 11);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12 FOR VALUES WITH (modulus 32, remainder 12);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13 FOR VALUES WITH (modulus 32, remainder 13);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14 FOR VALUES WITH (modulus 32, remainder 14);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15 FOR VALUES WITH (modulus 32, remainder 15);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16 FOR VALUES WITH (modulus 32, remainder 16);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17 FOR VALUES WITH (modulus 32, remainder 17);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18 FOR VALUES WITH (modulus 32, remainder 18);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19 FOR VALUES WITH (modulus 32, remainder 19);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20 FOR VALUES WITH (modulus 32, remainder 20);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21 FOR VALUES WITH (modulus 32, remainder 21);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22 FOR VALUES WITH (modulus 32, remainder 22);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23 FOR VALUES WITH (modulus 32, remainder 23);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24 FOR VALUES WITH (modulus 32, remainder 24);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25 FOR VALUES WITH (modulus 32, remainder 25);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26 FOR VALUES WITH (modulus 32, remainder 26);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27 FOR VALUES WITH (modulus 32, remainder 27);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28 FOR VALUES WITH (modulus 32, remainder 28);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29 FOR VALUES WITH (modulus 32, remainder 29);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30 FOR VALUES WITH (modulus 32, remainder 30);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31 (
+ stage_event_hash_id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31 FOR VALUES WITH (modulus 32, remainder 31);
+
+CREATE TABLE analytics_cycle_analytics_merge_request_stage_events (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+)
+PARTITION BY HASH (stage_event_hash_id);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_00 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_00 FOR VALUES WITH (modulus 32, remainder 0);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01 FOR VALUES WITH (modulus 32, remainder 1);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02 FOR VALUES WITH (modulus 32, remainder 2);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03 FOR VALUES WITH (modulus 32, remainder 3);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04 FOR VALUES WITH (modulus 32, remainder 4);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05 FOR VALUES WITH (modulus 32, remainder 5);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06 FOR VALUES WITH (modulus 32, remainder 6);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07 FOR VALUES WITH (modulus 32, remainder 7);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08 FOR VALUES WITH (modulus 32, remainder 8);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09 FOR VALUES WITH (modulus 32, remainder 9);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10 FOR VALUES WITH (modulus 32, remainder 10);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11 FOR VALUES WITH (modulus 32, remainder 11);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12 FOR VALUES WITH (modulus 32, remainder 12);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13 FOR VALUES WITH (modulus 32, remainder 13);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14 FOR VALUES WITH (modulus 32, remainder 14);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15 FOR VALUES WITH (modulus 32, remainder 15);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_16 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_16 FOR VALUES WITH (modulus 32, remainder 16);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17 FOR VALUES WITH (modulus 32, remainder 17);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18 FOR VALUES WITH (modulus 32, remainder 18);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19 FOR VALUES WITH (modulus 32, remainder 19);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20 FOR VALUES WITH (modulus 32, remainder 20);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21 FOR VALUES WITH (modulus 32, remainder 21);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22 FOR VALUES WITH (modulus 32, remainder 22);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23 FOR VALUES WITH (modulus 32, remainder 23);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24 FOR VALUES WITH (modulus 32, remainder 24);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25 FOR VALUES WITH (modulus 32, remainder 25);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26 FOR VALUES WITH (modulus 32, remainder 26);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27 FOR VALUES WITH (modulus 32, remainder 27);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28 FOR VALUES WITH (modulus 32, remainder 28);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29 FOR VALUES WITH (modulus 32, remainder 29);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30 FOR VALUES WITH (modulus 32, remainder 30);
+
+CREATE TABLE gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31 (
+ stage_event_hash_id bigint NOT NULL,
+ merge_request_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ milestone_id bigint,
+ author_id bigint,
+ start_event_timestamp timestamp with time zone NOT NULL,
+ end_event_timestamp timestamp with time zone
+);
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31 FOR VALUES WITH (modulus 32, remainder 31);
+
CREATE TABLE product_analytics_events_experimental (
id bigint NOT NULL,
project_id integer NOT NULL,
@@ -8958,6 +9657,38 @@ CREATE SEQUENCE abuse_reports_id_seq
ALTER SEQUENCE abuse_reports_id_seq OWNED BY abuse_reports.id;
+CREATE TABLE agent_group_authorizations (
+ id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ agent_id bigint NOT NULL,
+ config jsonb NOT NULL
+);
+
+CREATE SEQUENCE agent_group_authorizations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE agent_group_authorizations_id_seq OWNED BY agent_group_authorizations.id;
+
+CREATE TABLE agent_project_authorizations (
+ id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ agent_id bigint NOT NULL,
+ config jsonb NOT NULL
+);
+
+CREATE SEQUENCE agent_project_authorizations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE agent_project_authorizations_id_seq OWNED BY agent_project_authorizations.id;
+
CREATE TABLE alert_management_alert_assignees (
id bigint NOT NULL,
user_id bigint NOT NULL,
@@ -9086,7 +9817,8 @@ CREATE TABLE analytics_cycle_analytics_group_stages (
custom boolean DEFAULT true NOT NULL,
name character varying(255) NOT NULL,
group_value_stream_id bigint NOT NULL,
- stage_event_hash_id bigint
+ stage_event_hash_id bigint,
+ CONSTRAINT check_e6bd4271b5 CHECK ((stage_event_hash_id IS NOT NULL))
);
CREATE SEQUENCE analytics_cycle_analytics_group_stages_id_seq
@@ -9130,7 +9862,8 @@ CREATE TABLE analytics_cycle_analytics_project_stages (
custom boolean DEFAULT true NOT NULL,
name character varying(255) NOT NULL,
project_value_stream_id bigint NOT NULL,
- stage_event_hash_id bigint
+ stage_event_hash_id bigint,
+ CONSTRAINT check_8f6019de1e CHECK ((stage_event_hash_id IS NOT NULL))
);
CREATE SEQUENCE analytics_cycle_analytics_project_stages_id_seq
@@ -9524,7 +10257,6 @@ CREATE TABLE application_settings (
email_restrictions_enabled boolean DEFAULT false NOT NULL,
email_restrictions text,
npm_package_requests_forwarding boolean DEFAULT true NOT NULL,
- seat_link_enabled boolean DEFAULT true NOT NULL,
container_expiration_policies_enable_historic_entries boolean DEFAULT false NOT NULL,
issues_create_limit integer DEFAULT 0 NOT NULL,
push_rule_id bigint,
@@ -9580,7 +10312,6 @@ CREATE TABLE application_settings (
encrypted_cloud_license_auth_token text,
encrypted_cloud_license_auth_token_iv text,
secret_detection_revocation_token_types_url text,
- cloud_license_enabled boolean DEFAULT false NOT NULL,
disable_feed_token boolean DEFAULT false NOT NULL,
personal_access_token_prefix text,
rate_limiting_response_text text,
@@ -9625,9 +10356,30 @@ CREATE TABLE application_settings (
encrypted_customers_dot_jwt_signing_key bytea,
encrypted_customers_dot_jwt_signing_key_iv bytea,
pypi_package_requests_forwarding boolean DEFAULT true NOT NULL,
+ throttle_unauthenticated_files_api_requests_per_period integer DEFAULT 125 NOT NULL,
+ throttle_unauthenticated_files_api_period_in_seconds integer DEFAULT 15 NOT NULL,
+ throttle_authenticated_files_api_requests_per_period integer DEFAULT 500 NOT NULL,
+ throttle_authenticated_files_api_period_in_seconds integer DEFAULT 15 NOT NULL,
+ throttle_unauthenticated_files_api_enabled boolean DEFAULT false NOT NULL,
+ throttle_authenticated_files_api_enabled boolean DEFAULT false NOT NULL,
+ max_yaml_size_bytes bigint DEFAULT 1048576 NOT NULL,
+ max_yaml_depth integer DEFAULT 100 NOT NULL,
+ throttle_authenticated_git_lfs_requests_per_period integer DEFAULT 1000 NOT NULL,
+ throttle_authenticated_git_lfs_period_in_seconds integer DEFAULT 60 NOT NULL,
+ throttle_authenticated_git_lfs_enabled boolean DEFAULT false NOT NULL,
+ user_deactivation_emails_enabled boolean DEFAULT true NOT NULL,
+ throttle_unauthenticated_api_enabled boolean DEFAULT false NOT NULL,
+ throttle_unauthenticated_api_requests_per_period integer DEFAULT 3600 NOT NULL,
+ throttle_unauthenticated_api_period_in_seconds integer DEFAULT 3600 NOT NULL,
+ jobs_per_stage_page_size integer DEFAULT 200 NOT NULL,
+ sidekiq_job_limiter_mode smallint DEFAULT 1 NOT NULL,
+ sidekiq_job_limiter_compression_threshold_bytes integer DEFAULT 100000 NOT NULL,
+ sidekiq_job_limiter_limit_bytes integer DEFAULT 0 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_ext_pipeline_validation_service_url_text_limit CHECK ((char_length(external_pipeline_validation_service_url) <= 255)),
CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)),
+ CONSTRAINT app_settings_yaml_max_depth_positive CHECK ((max_yaml_depth > 0)),
+ CONSTRAINT app_settings_yaml_max_size_positive CHECK ((max_yaml_size_bytes > 0)),
CONSTRAINT check_17d9558205 CHECK ((char_length((kroki_url)::text) <= 1024)),
CONSTRAINT check_2dba05b802 CHECK ((char_length(gitpod_url) <= 255)),
CONSTRAINT check_51700b31b5 CHECK ((char_length(default_branch_name) <= 255)),
@@ -9746,7 +10498,7 @@ CREATE TABLE approval_project_rules (
name character varying NOT NULL,
rule_type smallint DEFAULT 0 NOT NULL,
scanners text[],
- vulnerabilities_allowed smallint,
+ vulnerabilities_allowed smallint DEFAULT 0 NOT NULL,
severity_levels text[] DEFAULT '{}'::text[] NOT NULL
);
@@ -10142,7 +10894,8 @@ CREATE TABLE boards (
weight integer,
hide_backlog_list boolean DEFAULT false NOT NULL,
hide_closed_list boolean DEFAULT false NOT NULL,
- iteration_id bigint
+ iteration_id bigint,
+ iteration_cadence_id bigint
);
CREATE TABLE boards_epic_board_labels (
@@ -10504,7 +11257,6 @@ ALTER SEQUENCE chat_teams_id_seq OWNED BY chat_teams.id;
CREATE TABLE ci_build_needs (
id integer NOT NULL,
- build_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,
@@ -10557,7 +11309,6 @@ ALTER SEQUENCE ci_build_report_results_build_id_seq OWNED BY ci_build_report_res
CREATE TABLE ci_build_trace_chunks (
id bigint NOT NULL,
- build_id_convert_to_bigint integer DEFAULT 0 NOT NULL,
chunk_index integer NOT NULL,
data_store integer NOT NULL,
raw_data bytea,
@@ -10580,11 +11331,13 @@ CREATE TABLE ci_build_trace_metadata (
trace_artifact_id bigint,
archival_attempts smallint DEFAULT 0 NOT NULL,
checksum bytea,
- remote_checksum bytea
+ remote_checksum bytea,
+ last_archival_attempt_at timestamp with time zone,
+ archived_at timestamp with time zone
);
CREATE TABLE ci_builds (
- id integer NOT NULL,
+ id_convert_to_bigint integer DEFAULT 0 NOT NULL,
status character varying,
finished_at timestamp without time zone,
trace text,
@@ -10619,7 +11372,7 @@ CREATE TABLE ci_builds (
coverage_regex character varying,
auto_canceled_by_id integer,
retried boolean,
- stage_id integer,
+ stage_id_convert_to_bigint integer,
protected boolean,
failure_reason integer,
scheduled_at timestamp with time zone,
@@ -10629,8 +11382,8 @@ CREATE TABLE ci_builds (
waiting_for_resource_at timestamp with time zone,
processed boolean,
scheduling_type smallint,
- id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
- stage_id_convert_to_bigint bigint,
+ id bigint NOT NULL,
+ stage_id bigint,
CONSTRAINT check_1e2fbd1b39 CHECK ((lock_version IS NOT NULL))
);
@@ -10644,8 +11397,8 @@ CREATE SEQUENCE ci_builds_id_seq
ALTER SEQUENCE ci_builds_id_seq OWNED BY ci_builds.id;
CREATE TABLE ci_builds_metadata (
- id integer NOT NULL,
- build_id integer NOT NULL,
+ id_convert_to_bigint integer DEFAULT 0 NOT NULL,
+ build_id_convert_to_bigint integer DEFAULT 0 NOT NULL,
project_id integer NOT NULL,
timeout integer,
timeout_source integer DEFAULT 1 NOT NULL,
@@ -10656,8 +11409,8 @@ CREATE TABLE ci_builds_metadata (
environment_auto_stop_in character varying(255),
expanded_environment_name character varying(255),
secrets jsonb DEFAULT '{}'::jsonb NOT NULL,
- build_id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
- id_convert_to_bigint bigint DEFAULT 0 NOT NULL
+ build_id bigint NOT NULL,
+ id bigint NOT NULL
);
CREATE SEQUENCE ci_builds_metadata_id_seq
@@ -10671,7 +11424,6 @@ ALTER SEQUENCE ci_builds_metadata_id_seq OWNED BY ci_builds_metadata.id;
CREATE TABLE ci_builds_runner_session (
id bigint NOT NULL,
- build_id_convert_to_bigint integer DEFAULT 0 NOT NULL,
url character varying NOT NULL,
certificate character varying,
"authorization" character varying,
@@ -10809,6 +11561,7 @@ CREATE TABLE ci_job_artifacts (
file_location smallint,
id bigint NOT NULL,
job_id bigint NOT NULL,
+ locked smallint DEFAULT 2,
CONSTRAINT check_27f0f6dbab CHECK ((file_store IS NOT NULL))
);
@@ -10865,7 +11618,7 @@ CREATE TABLE ci_minutes_additional_packs (
expires_at date,
number_of_minutes integer NOT NULL,
purchase_xid text,
- CONSTRAINT check_d7ef254af0 CHECK ((char_length(purchase_xid) <= 32))
+ CONSTRAINT check_d7ef254af0 CHECK ((char_length(purchase_xid) <= 50))
);
CREATE SEQUENCE ci_minutes_additional_packs_id_seq
@@ -10883,6 +11636,7 @@ CREATE TABLE ci_namespace_monthly_usages (
date date NOT NULL,
additional_amount_available integer DEFAULT 0 NOT NULL,
amount_used numeric(18,2) DEFAULT 0.0 NOT NULL,
+ notification_level smallint DEFAULT 100 NOT NULL,
CONSTRAINT ci_namespace_monthly_usages_year_month_constraint CHECK ((date = date_trunc('month'::text, (date)::timestamp with time zone)))
);
@@ -10903,7 +11657,9 @@ CREATE TABLE ci_pending_builds (
protected boolean DEFAULT false NOT NULL,
instance_runners_enabled boolean DEFAULT false NOT NULL,
namespace_id bigint,
- minutes_exceeded boolean DEFAULT false NOT NULL
+ minutes_exceeded boolean DEFAULT false NOT NULL,
+ tag_ids integer[] DEFAULT '{}'::integer[],
+ namespace_traversal_ids integer[] DEFAULT '{}'::integer[]
);
CREATE SEQUENCE ci_pending_builds_id_seq
@@ -11307,7 +12063,6 @@ CREATE SEQUENCE ci_sources_projects_id_seq
ALTER SEQUENCE ci_sources_projects_id_seq OWNED BY ci_sources_projects.id;
CREATE TABLE ci_stages (
- id_convert_to_bigint integer DEFAULT 0 NOT NULL,
project_id integer,
pipeline_id integer,
created_at timestamp without time zone,
@@ -12041,6 +12796,34 @@ CREATE SEQUENCE custom_emoji_id_seq
ALTER SEQUENCE custom_emoji_id_seq OWNED BY custom_emoji.id;
+CREATE TABLE customer_relations_contacts (
+ id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ organization_id bigint,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ state smallint DEFAULT 1 NOT NULL,
+ phone text,
+ first_name text NOT NULL,
+ last_name text NOT NULL,
+ email text,
+ description text,
+ CONSTRAINT check_1195f4c929 CHECK ((char_length(first_name) <= 255)),
+ CONSTRAINT check_40c70da037 CHECK ((char_length(description) <= 1024)),
+ CONSTRAINT check_cd2d67c484 CHECK ((char_length(last_name) <= 255)),
+ CONSTRAINT check_f4b7f78c89 CHECK ((char_length(phone) <= 32)),
+ CONSTRAINT check_fc0adabf60 CHECK ((char_length(email) <= 255))
+);
+
+CREATE SEQUENCE customer_relations_contacts_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE customer_relations_contacts_id_seq OWNED BY customer_relations_contacts.id;
+
CREATE TABLE customer_relations_organizations (
id bigint NOT NULL,
group_id bigint NOT NULL,
@@ -12073,7 +12856,11 @@ CREATE TABLE dast_profile_schedules (
updated_at timestamp with time zone NOT NULL,
active boolean DEFAULT true NOT NULL,
cron text NOT NULL,
- CONSTRAINT check_86531ea73f CHECK ((char_length(cron) <= 255))
+ cadence jsonb DEFAULT '{}'::jsonb NOT NULL,
+ timezone text NOT NULL,
+ starts_at timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT check_86531ea73f CHECK ((char_length(cron) <= 255)),
+ CONSTRAINT check_be4d1c3af1 CHECK ((char_length(timezone) <= 255))
);
COMMENT ON TABLE dast_profile_schedules IS '{"owner":"group::dynamic analysis","description":"Scheduling for scans using DAST Profiles"}';
@@ -12321,7 +13108,8 @@ CREATE TABLE dependency_proxy_blobs (
size bigint,
file_store integer,
file_name character varying NOT NULL,
- file text NOT NULL
+ file text NOT NULL,
+ status smallint DEFAULT 0 NOT NULL
);
CREATE SEQUENCE dependency_proxy_blobs_id_seq
@@ -12350,6 +13138,14 @@ CREATE SEQUENCE dependency_proxy_group_settings_id_seq
ALTER SEQUENCE dependency_proxy_group_settings_id_seq OWNED BY dependency_proxy_group_settings.id;
+CREATE TABLE dependency_proxy_image_ttl_group_policies (
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ group_id bigint NOT NULL,
+ ttl integer DEFAULT 90,
+ enabled boolean DEFAULT false NOT NULL
+);
+
CREATE TABLE dependency_proxy_manifests (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -12361,6 +13157,7 @@ CREATE TABLE dependency_proxy_manifests (
file text NOT NULL,
digest text NOT NULL,
content_type text,
+ status smallint DEFAULT 0 NOT NULL,
CONSTRAINT check_079b293a7b CHECK ((char_length(file) <= 255)),
CONSTRAINT check_167a9a8a91 CHECK ((char_length(content_type) <= 255)),
CONSTRAINT check_c579e3f586 CHECK ((char_length(file_name) <= 255)),
@@ -12441,7 +13238,6 @@ CREATE TABLE deployments (
tag boolean NOT NULL,
sha character varying NOT NULL,
user_id integer,
- deployable_id_convert_to_bigint integer,
deployable_type character varying,
created_at timestamp without time zone,
updated_at timestamp without time zone,
@@ -12905,7 +13701,7 @@ CREATE TABLE error_tracking_error_events (
payload jsonb DEFAULT '{}'::jsonb NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
- CONSTRAINT check_92ecc3077b CHECK ((char_length(description) <= 255)),
+ CONSTRAINT check_92ecc3077b CHECK ((char_length(description) <= 1024)),
CONSTRAINT check_c67d5b8007 CHECK ((char_length(level) <= 255)),
CONSTRAINT check_f4b52474ad CHECK ((char_length(environment) <= 255))
);
@@ -12948,7 +13744,7 @@ CREATE SEQUENCE error_tracking_errors_id_seq
ALTER SEQUENCE error_tracking_errors_id_seq OWNED BY error_tracking_errors.id;
CREATE TABLE events (
- id integer NOT NULL,
+ id_convert_to_bigint integer DEFAULT 0 NOT NULL,
project_id integer,
author_id integer NOT NULL,
target_id integer,
@@ -12958,7 +13754,7 @@ CREATE TABLE events (
target_type character varying,
group_id bigint,
fingerprint bytea,
- id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
+ id bigint NOT NULL,
CONSTRAINT check_97e06e05ad CHECK ((octet_length(fingerprint) <= 128))
);
@@ -13320,7 +14116,6 @@ ALTER SEQUENCE geo_hashed_storage_migrated_events_id_seq OWNED BY geo_hashed_sto
CREATE TABLE geo_job_artifact_deleted_events (
id bigint NOT NULL,
- job_artifact_id_convert_to_bigint integer DEFAULT 0 NOT NULL,
file_path character varying NOT NULL,
job_artifact_id bigint NOT NULL
);
@@ -14139,6 +14934,15 @@ CREATE SEQUENCE incident_management_pending_alert_escalations_id_seq
ALTER SEQUENCE incident_management_pending_alert_escalations_id_seq OWNED BY incident_management_pending_alert_escalations.id;
+CREATE SEQUENCE incident_management_pending_issue_escalations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE incident_management_pending_issue_escalations_id_seq OWNED BY incident_management_pending_issue_escalations.id;
+
CREATE TABLE index_statuses (
id integer NOT NULL,
project_id integer NOT NULL,
@@ -14204,6 +15008,7 @@ CREATE TABLE integrations (
alert_events boolean,
group_id bigint,
type_new text,
+ vulnerability_events boolean DEFAULT false NOT NULL,
CONSTRAINT check_a948a0aa7e CHECK ((char_length(type_new) <= 255))
);
@@ -14829,7 +15634,9 @@ CREATE TABLE members (
requested_at timestamp without time zone,
expires_at date,
ldap boolean DEFAULT false NOT NULL,
- override boolean DEFAULT false NOT NULL
+ override boolean DEFAULT false NOT NULL,
+ state smallint DEFAULT 0,
+ invite_email_success boolean DEFAULT true NOT NULL
);
CREATE SEQUENCE members_id_seq
@@ -15336,6 +16143,8 @@ CREATE TABLE namespace_settings (
lock_delayed_project_removal boolean DEFAULT false NOT NULL,
prevent_sharing_groups_outside_hierarchy boolean DEFAULT false NOT NULL,
new_user_signups_cap integer,
+ setup_for_company boolean,
+ jobs_to_be_done smallint,
CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255))
);
@@ -15577,7 +16386,8 @@ CREATE TABLE oauth_applications (
owner_id integer,
owner_type character varying,
trusted boolean DEFAULT false NOT NULL,
- confidential boolean DEFAULT true NOT NULL
+ confidential boolean DEFAULT true NOT NULL,
+ expire_access_tokens boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE oauth_applications_id_seq
@@ -16596,7 +17406,8 @@ CREATE TABLE plan_limits (
ci_max_artifact_size_running_container_scanning integer DEFAULT 0 NOT NULL,
ci_max_artifact_size_cluster_image_scanning integer DEFAULT 0 NOT NULL,
ci_jobs_trace_size_limit integer DEFAULT 100 NOT NULL,
- pages_file_entries integer DEFAULT 200000 NOT NULL
+ pages_file_entries integer DEFAULT 200000 NOT NULL,
+ dast_profile_schedules integer DEFAULT 1 NOT NULL
);
CREATE SEQUENCE plan_limits_id_seq
@@ -17297,7 +18108,6 @@ CREATE TABLE project_settings (
squash_option smallint DEFAULT 3,
has_confluence boolean DEFAULT false NOT NULL,
has_vulnerabilities boolean DEFAULT false NOT NULL,
- allow_editing_commit_messages boolean DEFAULT false NOT NULL,
prevent_merge_without_jira_issue boolean DEFAULT false NOT NULL,
cve_id_request_enabled boolean DEFAULT true NOT NULL,
mr_default_target_self boolean DEFAULT false NOT NULL,
@@ -17333,6 +18143,23 @@ CREATE SEQUENCE project_statistics_id_seq
ALTER SEQUENCE project_statistics_id_seq OWNED BY project_statistics.id;
+CREATE TABLE project_topics (
+ id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ topic_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE project_topics_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE project_topics_id_seq OWNED BY project_topics.id;
+
CREATE TABLE project_tracing_settings (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -17387,7 +18214,6 @@ CREATE TABLE projects (
public_builds boolean DEFAULT true NOT NULL,
last_repository_check_failed boolean,
last_repository_check_at timestamp without time zone,
- container_registry_enabled boolean,
only_allow_merge_if_pipeline_succeeds boolean DEFAULT false NOT NULL,
has_external_issue_tracker boolean,
repository_storage character varying DEFAULT 'default'::character varying NOT NULL,
@@ -17432,7 +18258,8 @@ CREATE TABLE projects (
marked_for_deletion_at date,
marked_for_deletion_by_user_id integer,
autoclose_referenced_issues boolean,
- suggestion_commit_message character varying(255)
+ suggestion_commit_message character varying(255),
+ project_namespace_id bigint
);
CREATE SEQUENCE projects_id_seq
@@ -18180,7 +19007,8 @@ CREATE TABLE security_scans (
scan_type smallint NOT NULL,
info jsonb DEFAULT '{}'::jsonb NOT NULL,
project_id bigint,
- pipeline_id bigint
+ pipeline_id bigint,
+ latest boolean DEFAULT true NOT NULL
);
CREATE SEQUENCE security_scans_id_seq
@@ -18267,7 +19095,8 @@ CREATE TABLE service_desk_settings (
project_id bigint NOT NULL,
issue_template_key character varying(255),
outgoing_name character varying(255),
- project_key character varying(255)
+ project_key character varying(255),
+ file_template_project_id bigint
);
CREATE TABLE shards (
@@ -18615,16 +19444,16 @@ CREATE SEQUENCE system_note_metadata_id_seq
ALTER SEQUENCE system_note_metadata_id_seq OWNED BY system_note_metadata.id;
CREATE TABLE taggings (
- id integer NOT NULL,
+ id_convert_to_bigint integer DEFAULT 0 NOT NULL,
tag_id integer,
- taggable_id integer,
+ taggable_id_convert_to_bigint integer,
taggable_type character varying,
tagger_id integer,
tagger_type character varying,
context character varying,
created_at timestamp without time zone,
- id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
- taggable_id_convert_to_bigint bigint
+ id bigint NOT NULL,
+ taggable_id bigint
);
CREATE SEQUENCE taggings_id_seq
@@ -18789,6 +19618,23 @@ CREATE SEQUENCE token_with_ivs_id_seq
ALTER SEQUENCE token_with_ivs_id_seq OWNED BY token_with_ivs.id;
+CREATE TABLE topics (
+ id bigint NOT NULL,
+ name text NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ CONSTRAINT check_7a90d4c757 CHECK ((char_length(name) <= 255))
+);
+
+CREATE SEQUENCE topics_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE topics_id_seq OWNED BY topics.id;
+
CREATE TABLE trending_projects (
id integer NOT NULL,
project_id integer NOT NULL
@@ -18973,6 +19819,23 @@ CREATE TABLE user_follow_users (
followee_id integer NOT NULL
);
+CREATE TABLE user_group_callouts (
+ id bigint NOT NULL,
+ user_id bigint NOT NULL,
+ group_id bigint NOT NULL,
+ feature_name smallint NOT NULL,
+ dismissed_at timestamp with time zone
+);
+
+CREATE SEQUENCE user_group_callouts_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE user_group_callouts_id_seq OWNED BY user_group_callouts.id;
+
CREATE TABLE user_highest_roles (
user_id bigint NOT NULL,
updated_at timestamp with time zone NOT NULL,
@@ -20037,6 +20900,10 @@ ALTER SEQUENCE zoom_meetings_id_seq OWNED BY zoom_meetings.id;
ALTER TABLE ONLY abuse_reports ALTER COLUMN id SET DEFAULT nextval('abuse_reports_id_seq'::regclass);
+ALTER TABLE ONLY agent_group_authorizations ALTER COLUMN id SET DEFAULT nextval('agent_group_authorizations_id_seq'::regclass);
+
+ALTER TABLE ONLY agent_project_authorizations ALTER COLUMN id SET DEFAULT nextval('agent_project_authorizations_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_user_mentions ALTER COLUMN id SET DEFAULT nextval('alert_management_alert_user_mentions_id_seq'::regclass);
@@ -20291,6 +21158,8 @@ ALTER TABLE ONLY csv_issue_imports ALTER COLUMN id SET DEFAULT nextval('csv_issu
ALTER TABLE ONLY custom_emoji ALTER COLUMN id SET DEFAULT nextval('custom_emoji_id_seq'::regclass);
+ALTER TABLE ONLY customer_relations_contacts ALTER COLUMN id SET DEFAULT nextval('customer_relations_contacts_id_seq'::regclass);
+
ALTER TABLE ONLY customer_relations_organizations ALTER COLUMN id SET DEFAULT nextval('customer_relations_organizations_id_seq'::regclass);
ALTER TABLE ONLY dast_profile_schedules ALTER COLUMN id SET DEFAULT nextval('dast_profile_schedules_id_seq'::regclass);
@@ -20483,6 +21352,8 @@ ALTER TABLE ONLY incident_management_oncall_shifts ALTER COLUMN id SET DEFAULT n
ALTER TABLE ONLY incident_management_pending_alert_escalations ALTER COLUMN id SET DEFAULT nextval('incident_management_pending_alert_escalations_id_seq'::regclass);
+ALTER TABLE ONLY incident_management_pending_issue_escalations ALTER COLUMN id SET DEFAULT nextval('incident_management_pending_issue_escalations_id_seq'::regclass);
+
ALTER TABLE ONLY index_statuses ALTER COLUMN id SET DEFAULT nextval('index_statuses_id_seq'::regclass);
ALTER TABLE ONLY insights ALTER COLUMN id SET DEFAULT nextval('insights_id_seq'::regclass);
@@ -20727,6 +21598,8 @@ ALTER TABLE ONLY project_security_settings ALTER COLUMN project_id SET DEFAULT n
ALTER TABLE ONLY project_statistics ALTER COLUMN id SET DEFAULT nextval('project_statistics_id_seq'::regclass);
+ALTER TABLE ONLY project_topics ALTER COLUMN id SET DEFAULT nextval('project_topics_id_seq'::regclass);
+
ALTER TABLE ONLY project_tracing_settings ALTER COLUMN id SET DEFAULT nextval('project_tracing_settings_id_seq'::regclass);
ALTER TABLE ONLY projects ALTER COLUMN id SET DEFAULT nextval('projects_id_seq'::regclass);
@@ -20855,6 +21728,8 @@ ALTER TABLE ONLY todos ALTER COLUMN id SET DEFAULT nextval('todos_id_seq'::regcl
ALTER TABLE ONLY token_with_ivs ALTER COLUMN id SET DEFAULT nextval('token_with_ivs_id_seq'::regclass);
+ALTER TABLE ONLY topics ALTER COLUMN id SET DEFAULT nextval('topics_id_seq'::regclass);
+
ALTER TABLE ONLY trending_projects ALTER COLUMN id SET DEFAULT nextval('trending_projects_id_seq'::regclass);
ALTER TABLE ONLY u2f_registrations ALTER COLUMN id SET DEFAULT nextval('u2f_registrations_id_seq'::regclass);
@@ -20873,6 +21748,8 @@ ALTER TABLE ONLY user_custom_attributes ALTER COLUMN id SET DEFAULT nextval('use
ALTER TABLE ONLY user_details ALTER COLUMN user_id SET DEFAULT nextval('user_details_user_id_seq'::regclass);
+ALTER TABLE ONLY user_group_callouts ALTER COLUMN id SET DEFAULT nextval('user_group_callouts_id_seq'::regclass);
+
ALTER TABLE ONLY user_permission_export_uploads ALTER COLUMN id SET DEFAULT nextval('user_permission_export_uploads_id_seq'::regclass);
ALTER TABLE ONLY user_preferences ALTER COLUMN id SET DEFAULT nextval('user_preferences_id_seq'::regclass);
@@ -20961,6 +21838,204 @@ ALTER TABLE ONLY zentao_tracker_data ALTER COLUMN id SET DEFAULT nextval('zentao
ALTER TABLE ONLY zoom_meetings ALTER COLUMN id SET DEFAULT nextval('zoom_meetings_id_seq'::regclass);
+ALTER TABLE ONLY analytics_cycle_analytics_issue_stage_events
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_00_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_01_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_02_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_03_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_04
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_04_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_05_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_06_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_07_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_08_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_09_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_10_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_11_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_12_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_13_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_14_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_15_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_16_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_17_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_18_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_19_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_20_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_21_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_22_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_23_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_24_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_25_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_26_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_27_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_28_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_29_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_30_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31
+ ADD CONSTRAINT analytics_cycle_analytics_issue_stage_events_31_pkey PRIMARY KEY (stage_event_hash_id, issue_id);
+
+ALTER TABLE ONLY analytics_cycle_analytics_merge_request_stage_events
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_00
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_00_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_01_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_02_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_03_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_04_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_05_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_06_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_07_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_08_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_09_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_10_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_11_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_12_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_13_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_14_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_15_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_16
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_16_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_17_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_18_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_19_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_20_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_21_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_22_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_23_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_24_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_25_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_26_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_27_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_28_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_29_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_30_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
+ALTER TABLE ONLY gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31
+ ADD CONSTRAINT analytics_cycle_analytics_merge_request_stage_events_31_pkey PRIMARY KEY (stage_event_hash_id, merge_request_id);
+
ALTER TABLE ONLY product_analytics_events_experimental
ADD CONSTRAINT product_analytics_events_experimental_pkey PRIMARY KEY (id, project_id);
@@ -21159,6 +22234,12 @@ ALTER TABLE ONLY gitlab_partitions_static.product_analytics_events_experimental_
ALTER TABLE ONLY abuse_reports
ADD CONSTRAINT abuse_reports_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY agent_group_authorizations
+ ADD CONSTRAINT agent_group_authorizations_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY agent_project_authorizations
+ ADD CONSTRAINT agent_project_authorizations_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY alert_management_alert_assignees
ADD CONSTRAINT alert_management_alert_assignees_pkey PRIMARY KEY (id);
@@ -21582,6 +22663,9 @@ ALTER TABLE ONLY csv_issue_imports
ALTER TABLE ONLY custom_emoji
ADD CONSTRAINT custom_emoji_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY customer_relations_contacts
+ ADD CONSTRAINT customer_relations_contacts_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY customer_relations_organizations
ADD CONSTRAINT customer_relations_organizations_pkey PRIMARY KEY (id);
@@ -21630,6 +22714,9 @@ ALTER TABLE ONLY dependency_proxy_blobs
ALTER TABLE ONLY dependency_proxy_group_settings
ADD CONSTRAINT dependency_proxy_group_settings_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY dependency_proxy_image_ttl_group_policies
+ ADD CONSTRAINT dependency_proxy_image_ttl_group_policies_pkey PRIMARY KEY (group_id);
+
ALTER TABLE ONLY dependency_proxy_manifests
ADD CONSTRAINT dependency_proxy_manifests_pkey PRIMARY KEY (id);
@@ -21906,6 +22993,9 @@ ALTER TABLE ONLY incident_management_oncall_shifts
ALTER TABLE ONLY incident_management_pending_alert_escalations
ADD CONSTRAINT incident_management_pending_alert_escalations_pkey PRIMARY KEY (id, process_at);
+ALTER TABLE ONLY incident_management_pending_issue_escalations
+ ADD CONSTRAINT incident_management_pending_issue_escalations_pkey PRIMARY KEY (id, process_at);
+
ALTER TABLE ONLY index_statuses
ADD CONSTRAINT index_statuses_pkey PRIMARY KEY (id);
@@ -22011,6 +23101,9 @@ ALTER TABLE ONLY list_user_preferences
ALTER TABLE ONLY lists
ADD CONSTRAINT lists_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY loose_foreign_keys_deleted_records
+ ADD CONSTRAINT loose_foreign_keys_deleted_records_pkey PRIMARY KEY (created_at, deleted_table_name, deleted_table_primary_key_value);
+
ALTER TABLE ONLY members
ADD CONSTRAINT members_pkey PRIMARY KEY (id);
@@ -22356,6 +23449,9 @@ ALTER TABLE ONLY project_settings
ALTER TABLE ONLY project_statistics
ADD CONSTRAINT project_statistics_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY project_topics
+ ADD CONSTRAINT project_topics_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY project_tracing_settings
ADD CONSTRAINT project_tracing_settings_pkey PRIMARY KEY (id);
@@ -22569,6 +23665,9 @@ ALTER TABLE ONLY todos
ALTER TABLE ONLY token_with_ivs
ADD CONSTRAINT token_with_ivs_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY topics
+ ADD CONSTRAINT topics_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY trending_projects
ADD CONSTRAINT trending_projects_pkey PRIMARY KEY (id);
@@ -22602,6 +23701,9 @@ ALTER TABLE ONLY user_details
ALTER TABLE ONLY user_follow_users
ADD CONSTRAINT user_follow_users_pkey PRIMARY KEY (follower_id, followee_id);
+ALTER TABLE ONLY user_group_callouts
+ ADD CONSTRAINT user_group_callouts_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY user_highest_roles
ADD CONSTRAINT user_highest_roles_pkey PRIMARY KEY (user_id);
@@ -22967,6 +24069,10 @@ CREATE UNIQUE INDEX idx_environment_merge_requests_unique_index ON deployment_me
CREATE INDEX idx_geo_con_rep_updated_events_on_container_repository_id ON geo_container_repository_updated_events USING btree (container_repository_id);
+CREATE INDEX idx_installable_helm_pkgs_on_project_id_id ON packages_packages USING btree (project_id, id);
+
+CREATE INDEX idx_installable_npm_pkgs_on_project_id_name_version_id ON packages_packages USING btree (project_id, name, version, id) WHERE ((package_type = 2) AND (status = 0));
+
CREATE INDEX idx_issues_on_health_status_not_null ON issues USING btree (health_status) WHERE (health_status IS NOT NULL);
CREATE INDEX idx_issues_on_project_id_and_created_at_and_id_and_state_id ON issues USING btree (project_id, created_at, id, state_id);
@@ -23079,6 +24185,14 @@ CREATE UNIQUE INDEX idx_vulnerability_issue_links_on_vulnerability_id_and_link_t
CREATE INDEX index_abuse_reports_on_user_id ON abuse_reports USING btree (user_id);
+CREATE UNIQUE INDEX index_agent_group_authorizations_on_agent_id_and_group_id ON agent_group_authorizations USING btree (agent_id, group_id);
+
+CREATE INDEX index_agent_group_authorizations_on_group_id ON agent_group_authorizations USING btree (group_id);
+
+CREATE UNIQUE INDEX index_agent_project_authorizations_on_agent_id_and_project_id ON agent_project_authorizations USING btree (agent_id, project_id);
+
+CREATE INDEX index_agent_project_authorizations_on_project_id ON agent_project_authorizations 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);
@@ -23293,6 +24407,8 @@ CREATE INDEX index_boards_epic_user_preferences_on_user_id ON boards_epic_user_p
CREATE INDEX index_boards_on_group_id ON boards USING btree (group_id);
+CREATE INDEX index_boards_on_iteration_cadence_id ON boards USING btree (iteration_cadence_id);
+
CREATE INDEX index_boards_on_iteration_id ON boards USING btree (iteration_id);
CREATE INDEX index_boards_on_milestone_id ON boards USING btree (milestone_id);
@@ -23439,6 +24555,8 @@ CREATE INDEX index_ci_pending_builds_on_namespace_id ON ci_pending_builds USING
CREATE INDEX index_ci_pending_builds_on_project_id ON ci_pending_builds USING btree (project_id);
+CREATE INDEX index_ci_pending_builds_on_tag_ids ON ci_pending_builds USING btree (tag_ids) WHERE (cardinality(tag_ids) > 0);
+
CREATE INDEX index_ci_pipeline_artifacts_failed_verification ON ci_pipeline_artifacts USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);
CREATE INDEX index_ci_pipeline_artifacts_needs_verification ON ci_pipeline_artifacts USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));
@@ -23695,6 +24813,10 @@ CREATE INDEX index_custom_emoji_on_creator_id ON custom_emoji USING btree (creat
CREATE UNIQUE INDEX index_custom_emoji_on_namespace_id_and_name ON custom_emoji USING btree (namespace_id, name);
+CREATE INDEX index_customer_relations_contacts_on_group_id ON customer_relations_contacts USING btree (group_id);
+
+CREATE INDEX index_customer_relations_contacts_on_organization_id ON customer_relations_contacts USING btree (organization_id);
+
CREATE UNIQUE INDEX index_customer_relations_organizations_on_unique_name_per_group ON customer_relations_organizations USING btree (group_id, lower(name));
CREATE UNIQUE INDEX index_cycle_analytics_stage_event_hashes_on_hash_sha_256 ON analytics_cycle_analytics_stage_event_hashes USING btree (hash_sha256);
@@ -23703,9 +24825,9 @@ CREATE UNIQUE INDEX index_daily_build_group_report_results_unique_columns ON ci_
CREATE INDEX index_dast_profile_schedules_active_next_run_at ON dast_profile_schedules USING btree (active, next_run_at);
-CREATE INDEX index_dast_profile_schedules_on_dast_profile_id ON dast_profile_schedules USING btree (dast_profile_id);
+CREATE UNIQUE INDEX index_dast_profile_schedules_on_dast_profile_id ON dast_profile_schedules USING btree (dast_profile_id);
-CREATE UNIQUE INDEX index_dast_profile_schedules_on_project_id_and_dast_profile_id ON dast_profile_schedules USING btree (project_id, dast_profile_id);
+CREATE INDEX index_dast_profile_schedules_on_project_id ON dast_profile_schedules USING btree (project_id);
CREATE INDEX index_dast_profile_schedules_on_user_id ON dast_profile_schedules USING btree (user_id);
@@ -23725,6 +24847,10 @@ CREATE UNIQUE INDEX index_dast_site_profiles_on_project_id_and_name ON dast_site
CREATE UNIQUE INDEX index_dast_site_profiles_pipelines_on_ci_pipeline_id ON dast_site_profiles_pipelines USING btree (ci_pipeline_id);
+CREATE UNIQUE INDEX index_dast_site_token_on_project_id_and_url ON dast_site_tokens USING btree (project_id, url);
+
+CREATE UNIQUE INDEX index_dast_site_token_on_token ON dast_site_tokens USING btree (token);
+
CREATE INDEX index_dast_site_tokens_on_project_id ON dast_site_tokens USING btree (project_id);
CREATE INDEX index_dast_site_validations_on_dast_site_token_id ON dast_site_validations USING btree (dast_site_token_id);
@@ -23935,6 +25061,14 @@ CREATE UNIQUE INDEX index_escalation_rules_on_all_attributes ON incident_managem
CREATE INDEX index_escalation_rules_on_user ON incident_management_escalation_rules USING btree (user_id);
+CREATE INDEX index_et_errors_on_project_id_and_status_and_events_count ON error_tracking_errors USING btree (project_id, status, events_count);
+
+CREATE INDEX index_et_errors_on_project_id_and_status_and_first_seen_at ON error_tracking_errors USING btree (project_id, status, first_seen_at);
+
+CREATE INDEX index_et_errors_on_project_id_and_status_and_id ON error_tracking_errors USING btree (project_id, status, id);
+
+CREATE INDEX index_et_errors_on_project_id_and_status_and_last_seen_at ON error_tracking_errors USING btree (project_id, status, last_seen_at);
+
CREATE INDEX index_events_on_action ON events USING btree (action);
CREATE INDEX index_events_on_author_id_and_created_at ON events USING btree (author_id, created_at);
@@ -24061,6 +25195,8 @@ CREATE INDEX index_geo_reset_checksum_events_on_project_id ON geo_reset_checksum
CREATE INDEX index_geo_upload_deleted_events_on_upload_id ON geo_upload_deleted_events USING btree (upload_id);
+CREATE INDEX index_gin_ci_pending_builds_on_namespace_traversal_ids ON ci_pending_builds USING gin (namespace_traversal_ids);
+
CREATE INDEX index_gitlab_subscription_histories_on_gitlab_subscription_id ON gitlab_subscription_histories USING btree (gitlab_subscription_id);
CREATE INDEX index_gitlab_subscriptions_on_end_date_and_namespace_id ON gitlab_subscriptions USING btree (end_date, namespace_id);
@@ -24131,6 +25267,8 @@ CREATE UNIQUE INDEX index_group_stages_on_group_id_group_value_stream_id_and_nam
CREATE INDEX index_group_stages_on_stage_event_hash_id ON analytics_cycle_analytics_group_stages USING btree (stage_event_hash_id);
+CREATE UNIQUE INDEX index_group_user_callouts_feature ON user_group_callouts USING btree (user_id, feature_name, group_id);
+
CREATE UNIQUE INDEX index_group_wiki_repositories_on_disk_path ON group_wiki_repositories USING btree (disk_path);
CREATE INDEX index_group_wiki_repositories_on_shard_id ON group_wiki_repositories USING btree (shard_id);
@@ -24187,6 +25325,10 @@ CREATE INDEX index_incident_management_pending_alert_escalations_on_rule_id ON O
CREATE INDEX index_incident_management_pending_alert_escalations_on_schedule ON ONLY incident_management_pending_alert_escalations USING btree (schedule_id);
+CREATE INDEX index_incident_management_pending_issue_escalations_on_issue_id ON ONLY incident_management_pending_issue_escalations USING btree (issue_id);
+
+CREATE INDEX index_incident_management_pending_issue_escalations_on_rule_id ON ONLY incident_management_pending_issue_escalations USING btree (rule_id);
+
CREATE UNIQUE INDEX index_index_statuses_on_project_id ON index_statuses USING btree (project_id);
CREATE INDEX index_insights_on_namespace_id ON insights USING btree (namespace_id);
@@ -24595,6 +25737,8 @@ CREATE INDEX index_namespaces_on_traversal_ids ON namespaces USING gin (traversa
CREATE INDEX index_namespaces_on_type_and_id_partial ON namespaces USING btree (type, id) WHERE (type IS NOT NULL);
+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_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);
@@ -24747,6 +25891,8 @@ CREATE INDEX index_packages_events_on_package_id ON packages_events USING btree
CREATE INDEX index_packages_helm_file_metadata_on_channel ON packages_helm_file_metadata USING btree (channel);
+CREATE INDEX index_packages_helm_file_metadata_on_pf_id_and_channel ON packages_helm_file_metadata USING btree (package_file_id, channel);
+
CREATE INDEX index_packages_maven_metadata_on_package_id_and_path ON packages_maven_metadata USING btree (package_id, path);
CREATE INDEX index_packages_maven_metadata_on_path ON packages_maven_metadata USING btree (path);
@@ -24767,6 +25913,8 @@ CREATE INDEX index_packages_package_files_on_file_store ON packages_package_file
CREATE INDEX index_packages_package_files_on_package_id_and_file_name ON packages_package_files USING btree (package_id, file_name);
+CREATE INDEX index_packages_package_files_on_package_id_id ON packages_package_files USING btree (package_id, id);
+
CREATE INDEX index_packages_package_files_on_verification_state ON packages_package_files USING btree (verification_state);
CREATE INDEX index_packages_packages_on_creator_id ON packages_packages USING btree (creator_id);
@@ -24955,6 +26103,12 @@ CREATE INDEX index_project_statistics_on_storage_size_and_project_id ON project_
CREATE INDEX index_project_statistics_on_wiki_size_and_project_id ON project_statistics USING btree (wiki_size, project_id);
+CREATE INDEX index_project_topics_on_project_id ON project_topics USING btree (project_id);
+
+CREATE UNIQUE INDEX index_project_topics_on_project_id_and_topic_id ON project_topics USING btree (project_id, topic_id);
+
+CREATE INDEX index_project_topics_on_topic_id ON project_topics USING btree (topic_id);
+
CREATE UNIQUE INDEX index_project_tracing_settings_on_project_id ON project_tracing_settings USING btree (project_id);
CREATE INDEX index_projects_aimed_for_deletion ON projects USING btree (marked_for_deletion_at) WHERE ((marked_for_deletion_at IS NOT NULL) AND (pending_delete = false));
@@ -25035,6 +26189,8 @@ CREATE INDEX index_projects_on_pending_delete ON projects USING btree (pending_d
CREATE INDEX index_projects_on_pool_repository_id ON projects USING btree (pool_repository_id) WHERE (pool_repository_id IS NOT NULL);
+CREATE UNIQUE INDEX index_projects_on_project_namespace_id ON projects USING btree (project_namespace_id);
+
CREATE INDEX index_projects_on_repository_storage ON projects USING btree (repository_storage);
CREATE INDEX index_projects_on_runners_token ON projects USING btree (runners_token);
@@ -25277,6 +26433,8 @@ CREATE INDEX index_serverless_domain_cluster_on_pages_domain_id ON serverless_do
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);
+
CREATE UNIQUE INDEX index_shards_on_name ON shards USING btree (name);
CREATE UNIQUE INDEX index_site_profile_secret_variables_on_site_profile_id_and_key ON dast_site_profile_secret_variables USING btree (dast_site_profile_id, key);
@@ -25459,6 +26617,8 @@ CREATE UNIQUE INDEX index_token_with_ivs_on_hashed_plaintext_token ON token_with
CREATE UNIQUE INDEX index_token_with_ivs_on_hashed_token ON token_with_ivs USING btree (hashed_token);
+CREATE UNIQUE INDEX index_topics_on_name ON topics USING btree (name);
+
CREATE UNIQUE INDEX index_trending_projects_on_project_id ON trending_projects USING btree (project_id);
CREATE INDEX index_u2f_registrations_on_key_handle ON u2f_registrations USING btree (key_handle);
@@ -25503,6 +26663,8 @@ CREATE INDEX index_user_details_on_provisioned_by_group_id ON user_details USING
CREATE UNIQUE INDEX index_user_details_on_user_id ON user_details USING btree (user_id);
+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);
CREATE INDEX index_user_interacted_projects_on_user_id ON user_interacted_projects USING btree (user_id);
@@ -25785,14 +26947,14 @@ CREATE INDEX tmp_idx_deduplicate_vulnerability_occurrences ON vulnerability_occu
CREATE INDEX tmp_idx_on_namespaces_delayed_project_removal ON namespaces USING btree (id) WHERE (delayed_project_removal = true);
-CREATE INDEX tmp_index_approval_project_rules_scanners ON approval_project_rules USING gin (scanners) WHERE (scanners @> '{cluster_image_scanning}'::text[]);
-
CREATE INDEX tmp_index_namespaces_empty_traversal_ids_with_child_namespaces ON namespaces USING btree (id) WHERE ((parent_id IS NOT NULL) AND (traversal_ids = '{}'::integer[]));
CREATE INDEX tmp_index_namespaces_empty_traversal_ids_with_root_namespaces ON namespaces USING btree (id) WHERE ((parent_id IS NULL) AND (traversal_ids = '{}'::integer[]));
CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING btree (id) WHERE (state <> 2);
+CREATE INDEX tmp_index_taggings_on_id_where_taggable_type_project ON taggings USING btree (id) WHERE ((taggable_type)::text = 'Project'::text);
+
CREATE UNIQUE INDEX uniq_pkgs_deb_grp_architectures_on_distribution_id_and_name ON packages_debian_group_architectures USING btree (distribution_id, name);
CREATE UNIQUE INDEX uniq_pkgs_deb_grp_components_on_distribution_id_and_name ON packages_debian_group_components USING btree (distribution_id, name);
@@ -25819,6 +26981,134 @@ CREATE UNIQUE INDEX vulnerability_occurrence_pipelines_on_unique_keys ON vulnera
CREATE UNIQUE INDEX work_item_types_namespace_id_and_name_unique ON work_item_types USING btree (namespace_id, btrim(lower(name)));
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_00_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_01_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_02_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_03_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_04_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_05_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_06_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_07_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_08_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_09_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_10_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_11_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_12_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_13_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_14_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_15_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_16_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_17_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_18_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_19_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_20_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_21_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_22_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_23_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_24_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_25_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_26_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_27_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_28_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_29_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_30_pkey;
+
+ALTER INDEX analytics_cycle_analytics_issue_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_issue_stage_events_31_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_00_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_01_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_02_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_03_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_04_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_05_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_06_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_07_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_08_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_09_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_10_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_11_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_12_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_13_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_14_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_15_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_16_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_17_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_18_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_19_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_20_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_21_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_22_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_23_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_24_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_25_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_26_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_27_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_28_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_29_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_30_pkey;
+
+ALTER INDEX analytics_cycle_analytics_merge_request_stage_events_pkey ATTACH PARTITION gitlab_partitions_static.analytics_cycle_analytics_merge_request_stage_events_31_pkey;
+
ALTER INDEX index_product_analytics_events_experimental_project_and_time ATTACH PARTITION gitlab_partitions_static.product_analytics_events_expe_project_id_collector_tstamp_idx10;
ALTER INDEX index_product_analytics_events_experimental_project_and_time ATTACH PARTITION gitlab_partitions_static.product_analytics_events_expe_project_id_collector_tstamp_idx11;
@@ -26075,35 +27365,17 @@ ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_p
ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_partitions_static.product_analytics_events_experimental_63_pkey;
-CREATE TRIGGER trigger_07c94931164e BEFORE INSERT OR UPDATE ON push_event_payloads FOR EACH ROW EXECUTE FUNCTION trigger_07c94931164e();
-
-CREATE TRIGGER trigger_21e7a2602957 BEFORE INSERT OR UPDATE ON ci_build_needs FOR EACH ROW EXECUTE FUNCTION trigger_21e7a2602957();
-
CREATE TRIGGER trigger_3f6129be01d2 BEFORE INSERT OR UPDATE ON ci_builds FOR EACH ROW EXECUTE FUNCTION trigger_3f6129be01d2();
-CREATE TRIGGER trigger_490d204c00b3 BEFORE INSERT OR UPDATE ON ci_stages FOR EACH ROW EXECUTE FUNCTION trigger_490d204c00b3();
-
-CREATE TRIGGER trigger_51ab7cef8934 BEFORE INSERT OR UPDATE ON ci_builds_runner_session FOR EACH ROW EXECUTE FUNCTION trigger_51ab7cef8934();
-
CREATE TRIGGER trigger_542d6c2ad72e BEFORE INSERT OR UPDATE ON ci_builds_metadata FOR EACH ROW EXECUTE FUNCTION trigger_542d6c2ad72e();
-CREATE TRIGGER trigger_69523443cc10 BEFORE INSERT OR UPDATE ON events FOR EACH ROW EXECUTE FUNCTION trigger_69523443cc10();
-
-CREATE TRIGGER trigger_77f5e1d20482 BEFORE INSERT OR UPDATE ON deployments FOR EACH ROW EXECUTE FUNCTION trigger_77f5e1d20482();
-
-CREATE TRIGGER trigger_8485e97c00e3 BEFORE INSERT OR UPDATE ON ci_sources_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_8485e97c00e3();
-
CREATE TRIGGER trigger_8487d4de3e7b BEFORE INSERT OR UPDATE ON ci_builds_metadata FOR EACH ROW EXECUTE FUNCTION trigger_8487d4de3e7b();
CREATE TRIGGER trigger_91dc388a5fe6 BEFORE INSERT OR UPDATE ON dep_ci_build_trace_sections FOR EACH ROW EXECUTE FUNCTION trigger_91dc388a5fe6();
CREATE TRIGGER trigger_aebe8b822ad3 BEFORE INSERT OR UPDATE ON taggings FOR EACH ROW EXECUTE FUNCTION trigger_aebe8b822ad3();
-CREATE TRIGGER trigger_be1804f21693 BEFORE INSERT OR UPDATE ON ci_job_artifacts FOR EACH ROW EXECUTE FUNCTION trigger_be1804f21693();
-
-CREATE TRIGGER trigger_cf2f9e35f002 BEFORE INSERT OR UPDATE ON ci_build_trace_chunks FOR EACH ROW EXECUTE FUNCTION trigger_cf2f9e35f002();
-
-CREATE TRIGGER trigger_f1ca8ec18d78 BEFORE INSERT OR UPDATE ON geo_job_artifact_deleted_events FOR EACH ROW EXECUTE FUNCTION trigger_f1ca8ec18d78();
+CREATE TRIGGER trigger_delete_project_namespace_on_project_delete AFTER DELETE ON projects FOR EACH ROW WHEN ((old.project_namespace_id IS NOT NULL)) EXECUTE FUNCTION delete_associated_project_namespace();
CREATE TRIGGER trigger_has_external_issue_tracker_on_delete AFTER DELETE ON integrations FOR EACH ROW WHEN ((((old.category)::text = 'issue_tracker'::text) AND (old.active = true) AND (old.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker();
@@ -26111,11 +27383,13 @@ CREATE TRIGGER trigger_has_external_issue_tracker_on_insert AFTER INSERT ON inte
CREATE TRIGGER trigger_has_external_issue_tracker_on_update AFTER UPDATE ON integrations FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker();
-CREATE TRIGGER trigger_has_external_wiki_on_delete AFTER DELETE ON integrations FOR EACH ROW WHEN ((((old.type)::text = 'ExternalWikiService'::text) AND (old.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();
+CREATE TRIGGER trigger_has_external_wiki_on_delete AFTER DELETE ON integrations FOR EACH ROW WHEN (((old.type_new = 'Integrations::ExternalWiki'::text) AND (old.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();
-CREATE TRIGGER trigger_has_external_wiki_on_insert AFTER INSERT ON integrations FOR EACH ROW WHEN (((new.active = true) AND ((new.type)::text = 'ExternalWikiService'::text) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();
+CREATE TRIGGER trigger_has_external_wiki_on_insert AFTER INSERT ON integrations FOR EACH ROW WHEN (((new.active = true) AND (new.type_new = 'Integrations::ExternalWiki'::text) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();
-CREATE TRIGGER trigger_has_external_wiki_on_update AFTER UPDATE ON integrations FOR EACH ROW WHEN ((((new.type)::text = 'ExternalWikiService'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();
+CREATE TRIGGER trigger_has_external_wiki_on_type_new_updated AFTER UPDATE OF type_new ON integrations FOR EACH ROW WHEN (((new.type_new = 'Integrations::ExternalWiki'::text) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();
+
+CREATE TRIGGER trigger_has_external_wiki_on_update AFTER UPDATE ON integrations FOR EACH ROW WHEN (((new.type_new = 'Integrations::ExternalWiki'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();
CREATE TRIGGER trigger_type_new_on_insert AFTER INSERT ON integrations FOR EACH ROW EXECUTE FUNCTION integrations_set_type_new();
@@ -26134,6 +27408,9 @@ ALTER TABLE ONLY clusters_applications_runners
ALTER TABLE ONLY incident_management_escalation_rules
ADD CONSTRAINT fk_0314ee86eb FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY service_desk_settings
+ ADD CONSTRAINT fk_03afb71f06 FOREIGN KEY (file_template_project_id) REFERENCES projects(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY design_management_designs_versions
ADD CONSTRAINT fk_03c671965c FOREIGN KEY (design_id) REFERENCES design_management_designs(id) ON DELETE CASCADE;
@@ -26200,6 +27477,9 @@ ALTER TABLE ONLY analytics_devops_adoption_segments
ALTER TABLE ONLY user_details
ADD CONSTRAINT fk_190e4fcc88 FOREIGN KEY (provisioned_by_group_id) REFERENCES namespaces(id) ON DELETE SET NULL;
+ALTER TABLE ONLY agent_project_authorizations
+ ADD CONSTRAINT fk_1d30bb4987 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY vulnerabilities
ADD CONSTRAINT fk_1d37cddf91 FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE SET NULL;
@@ -26251,6 +27531,9 @@ ALTER TABLE ONLY geo_event_log
ALTER TABLE ONLY deployments
ADD CONSTRAINT fk_289bba3222 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE SET NULL;
+ALTER TABLE ONLY agent_group_authorizations
+ ADD CONSTRAINT fk_2c9f941965 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY ci_freeze_periods
ADD CONSTRAINT fk_2e02bbd1a6 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -26281,6 +27564,9 @@ ALTER TABLE ONLY ci_group_variables
ALTER TABLE ONLY namespaces
ADD CONSTRAINT fk_3448c97865 FOREIGN KEY (push_rule_id) REFERENCES push_rules(id) ON DELETE SET NULL;
+ALTER TABLE ONLY project_topics
+ ADD CONSTRAINT fk_34af9ab07a FOREIGN KEY (topic_id) REFERENCES topics(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY in_product_marketing_emails
ADD CONSTRAINT fk_35c9101b63 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
@@ -26329,9 +27615,6 @@ ALTER TABLE ONLY releases
ALTER TABLE ONLY geo_event_log
ADD CONSTRAINT fk_4a99ebfd60 FOREIGN KEY (repositories_changed_event_id) REFERENCES geo_repositories_changed_events(id) ON DELETE CASCADE;
-ALTER TABLE ONLY dep_ci_build_trace_sections
- ADD CONSTRAINT fk_4ebe41f502 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY alert_management_alerts
ADD CONSTRAINT fk_51ab4b6089 FOREIGN KEY (prometheus_alert_id) REFERENCES prometheus_alerts(id) ON DELETE CASCADE;
@@ -26410,6 +27693,9 @@ ALTER TABLE ONLY terraform_state_versions
ALTER TABLE ONLY protected_branch_push_access_levels
ADD CONSTRAINT fk_7111b68cdb FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+ALTER TABLE ONLY projects
+ ADD CONSTRAINT fk_71625606ac FOREIGN KEY (project_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY integrations
ADD CONSTRAINT fk_71cce407f9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -26572,6 +27858,9 @@ ALTER TABLE ONLY issues
ALTER TABLE ONLY epics
ADD CONSTRAINT fk_9d480c64b2 FOREIGN KEY (start_date_sourcing_epic_id) REFERENCES epics(id) ON DELETE SET NULL;
+ALTER TABLE ONLY user_group_callouts
+ ADD CONSTRAINT fk_9dc8b9d4b2 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY protected_environments
ADD CONSTRAINT fk_9e112565b7 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -26626,6 +27915,9 @@ ALTER TABLE ONLY alert_management_alerts
ALTER TABLE ONLY identities
ADD CONSTRAINT fk_aade90f0fc FOREIGN KEY (saml_provider_id) REFERENCES saml_providers(id) ON DELETE CASCADE;
+ALTER TABLE ONLY boards
+ ADD CONSTRAINT fk_ab0a250ff6 FOREIGN KEY (iteration_cadence_id) REFERENCES iterations_cadences(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY dep_ci_build_trace_sections
ADD CONSTRAINT fk_ab7c104e26 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -26674,9 +27966,15 @@ ALTER TABLE ONLY external_status_checks_protected_branches
ALTER TABLE ONLY issue_assignees
ADD CONSTRAINT fk_b7d881734a FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
+ALTER TABLE ONLY agent_project_authorizations
+ ADD CONSTRAINT fk_b7fe9b4777 FOREIGN KEY (agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY ci_trigger_requests
ADD CONSTRAINT fk_b8ec8b7245 FOREIGN KEY (trigger_id) REFERENCES ci_triggers(id) ON DELETE CASCADE;
+ALTER TABLE ONLY customer_relations_contacts
+ ADD CONSTRAINT fk_b91ddd9345 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY deployments
ADD CONSTRAINT fk_b9a3851b82 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -26713,6 +28011,9 @@ ALTER TABLE ONLY geo_event_log
ALTER TABLE ONLY analytics_cycle_analytics_project_stages
ADD CONSTRAINT fk_c3339bdfc9 FOREIGN KEY (stage_event_hash_id) REFERENCES analytics_cycle_analytics_stage_event_hashes(id) ON DELETE CASCADE;
+ALTER TABLE ONLY user_group_callouts
+ ADD CONSTRAINT fk_c366e12ec3 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY vulnerability_exports
ADD CONSTRAINT fk_c3d3cb5d0f FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -26797,6 +28098,9 @@ ALTER TABLE ONLY label_links
ALTER TABLE ONLY project_group_links
ADD CONSTRAINT fk_daa8cee94c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY project_topics
+ ADD CONSTRAINT fk_db13576296 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY security_scans
ADD CONSTRAINT fk_dbc89265b9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -26815,6 +28119,9 @@ ALTER TABLE ONLY ci_resources
ALTER TABLE ONLY ci_sources_pipelines
ADD CONSTRAINT fk_e1bad85861 FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_builds_metadata
+ ADD CONSTRAINT fk_e20479742e FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY gitlab_subscriptions
ADD CONSTRAINT fk_e2595d00a1 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -26908,6 +28215,9 @@ ALTER TABLE ONLY dep_ci_build_trace_section_names
ALTER TABLE ONLY ci_stages
ADD CONSTRAINT fk_fb57e6cc56 FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
+ALTER TABLE ONLY agent_group_authorizations
+ ADD CONSTRAINT fk_fb70782616 FOREIGN KEY (agent_id) REFERENCES cluster_agents(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY system_note_metadata
ADD CONSTRAINT fk_fbd87415c9 FOREIGN KEY (description_version_id) REFERENCES description_versions(id) ON DELETE SET NULL;
@@ -26968,6 +28278,9 @@ ALTER TABLE ONLY incident_management_oncall_participants
ALTER TABLE ONLY events
ADD CONSTRAINT fk_rails_0434b48643 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE incident_management_pending_issue_escalations
+ ADD CONSTRAINT fk_rails_0470889ee5 FOREIGN KEY (rule_id) REFERENCES incident_management_escalation_rules(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY ip_restrictions
ADD CONSTRAINT fk_rails_04a93778d5 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -27223,6 +28536,9 @@ ALTER TABLE ONLY reviews
ALTER TABLE ONLY draft_notes
ADD CONSTRAINT fk_rails_2a8dac9901 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY dependency_proxy_image_ttl_group_policies
+ ADD CONSTRAINT fk_rails_2b1896d021 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY group_group_links
ADD CONSTRAINT fk_rails_2b2353ca49 FOREIGN KEY (shared_with_group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -27574,6 +28890,9 @@ ALTER TABLE ONLY status_page_published_incidents
ALTER TABLE ONLY deployment_clusters
ADD CONSTRAINT fk_rails_6359a164df FOREIGN KEY (deployment_id) REFERENCES deployments(id) ON DELETE CASCADE;
+ALTER TABLE incident_management_pending_issue_escalations
+ ADD CONSTRAINT fk_rails_636678b3bd FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY evidences
ADD CONSTRAINT fk_rails_6388b435a6 FOREIGN KEY (release_id) REFERENCES releases(id) ON DELETE CASCADE;
@@ -28336,9 +29655,6 @@ ALTER TABLE ONLY packages_packages
ALTER TABLE ONLY cluster_platforms_kubernetes
ADD CONSTRAINT fk_rails_e1e2cf841a FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;
-ALTER TABLE ONLY ci_builds_metadata
- ADD CONSTRAINT fk_rails_e20479742e FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY vulnerability_finding_evidences
ADD CONSTRAINT fk_rails_e3205a0c65 FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;
@@ -28525,6 +29841,9 @@ ALTER TABLE ONLY packages_nuget_metadata
ALTER TABLE incident_management_pending_alert_escalations
ADD CONSTRAINT fk_rails_fcbfd9338b FOREIGN KEY (schedule_id) REFERENCES incident_management_oncall_schedules(id) ON DELETE CASCADE;
+ALTER TABLE ONLY customer_relations_contacts
+ ADD CONSTRAINT fk_rails_fd3f2e7572 FOREIGN KEY (organization_id) REFERENCES customer_relations_organizations(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY external_approval_rules
ADD CONSTRAINT fk_rails_fd4f9ac573 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;