summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
commit9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch)
tree70467ae3692a0e35e5ea56bcb803eb512a10bedb /db
parent4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff)
downloadgitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200609212701_add_incident_settings_to_all_existing_projects.rb2
-rw-r--r--db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb4
-rw-r--r--db/migrate/20201214032220_add_has_external_wiki_trigger.rb8
-rw-r--r--db/migrate/20201218194311_create_admin_notes.rb21
-rw-r--r--db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb2
-rw-r--r--db/migrate/20210106061254_add_unique_index_for_golang_packages.rb20
-rw-r--r--db/migrate/20210219211845_add_version_usage_data_id_to_raw_usage_data.rb9
-rw-r--r--db/migrate/20210223230600_update_rubygems_metadata_metadata.rb19
-rw-r--r--db/migrate/20210224161552_add_jira_issue_transition_automatic_to_jira_tracker_data.rb9
-rw-r--r--db/migrate/20210302025305_add_excluded_urls_and_request_headers_to_dast_site_profiles.rb17
-rw-r--r--db/migrate/20210305031822_create_dast_site_profile_variables.rb40
-rw-r--r--db/migrate/20210305180331_create_ci_unit_tests.rb31
-rw-r--r--db/migrate/20210305182740_add_projects_fk_to_ci_unit_tests.rb19
-rw-r--r--db/migrate/20210305182855_create_ci_unit_test_failures.rb24
-rw-r--r--db/migrate/20210305183904_add_ci_builds_fk_to_ci_unit_test_failures.rb19
-rw-r--r--db/migrate/20210308175224_change_namespace_settings_delayed_project_removal_null.rb14
-rw-r--r--db/migrate/20210308175225_add_lock_delayed_project_removal_to_namespace_settings.rb9
-rw-r--r--db/migrate/20210308175226_add_delayed_project_removal_to_application_settings.rb9
-rw-r--r--db/migrate/20210308175227_add_lock_delayed_project_removal_to_application_settings.rb9
-rw-r--r--db/migrate/20210309160106_add_admin_mode_to_application_setting.rb9
-rw-r--r--db/migrate/20210311022012_add_text_limits_to_dast_site_profiles.rb24
-rw-r--r--db/migrate/20210311120152_add_metrics_to_batched_background_migration_jobs.rb9
-rw-r--r--db/migrate/20210311120153_initialize_conversion_of_events_id_to_bigint.rb21
-rw-r--r--db/migrate/20210311120154_initialize_conversion_of_push_event_payloads_event_id_to_bigint.rb21
-rw-r--r--db/migrate/20210312140029_add_owner_and_id_index_on_active_ci_pipeline_schedules.rb18
-rw-r--r--db/migrate/20210312174321_add_enforced_git_check_to_saml_provider.rb13
-rw-r--r--db/migrate/20210312193532_add_resource_access_token_creation_allowed_to_namespace_settings.rb19
-rw-r--r--db/migrate/20210313045617_add_verification_state_and_started_at_to_snippet_repositories.rb12
-rw-r--r--db/migrate/20210313045845_add_verification_indexes_to_snippet_repositories.rb27
-rw-r--r--db/migrate/20210316094047_add_trial_extension_type_to_gitlab_subscription_histories.rb9
-rw-r--r--db/migrate/20210316094323_add_trial_extension_type_to_gitlab_subscriptions.rb21
-rw-r--r--db/migrate/20210316152500_add_index_ci_stages_on_pipeline_id_and_id.rb18
-rw-r--r--db/migrate/20210317035357_create_dast_profiles_pipelines.rb20
-rw-r--r--db/migrate/20210317100520_create_elastic_index_settings.rb23
-rw-r--r--db/migrate/20210317104301_create_in_product_marketing_emails.rb33
-rw-r--r--db/migrate/20210317105904_add_user_foreign_key_to_in_product_marketing_emails.rb19
-rw-r--r--db/migrate/20210317192943_add_expiry_notification_delivered_to_keys.rb9
-rw-r--r--db/migrate/20210318134427_delete_security_findings_without_uuid.rb25
-rw-r--r--db/migrate/20210322063407_add_dast_profile_id_fk_to_dast_profiles_pipelines.rb19
-rw-r--r--db/migrate/20210322063450_add_ci_pipeline_id_fk_to_dast_profiles_pipelines.rb19
-rw-r--r--db/migrate/20210322182751_add_index_to_keys_on_expires_at_and_expiry_notification_undelivered.rb19
-rw-r--r--db/migrate/20210323064751_add_namespace_traversal_ids_index.rb18
-rw-r--r--db/migrate/20210323155010_populate_dismissal_information_for_vulnerabilities.rb37
-rw-r--r--db/migrate/20210323182846_add_project_status_date_index_to_merge_requests.rb18
-rw-r--r--db/migrate/20210324112439_add_index_mirror_data_on_retry_next_execution_where_status.rb28
-rw-r--r--db/migrate/20210324131727_migrate_elastic_index_settings.rb31
-rw-r--r--db/migrate/20210325092215_add_not_valid_foreign_key_to_group_hooks.rb19
-rw-r--r--db/migrate/20210325113129_validate_foreign_key_on_service_hooks.rb17
-rw-r--r--db/migrate/20210325150837_add_verification_state_to_ci_pipeline_artifact.rb18
-rw-r--r--db/migrate/20210325151758_add_verification_failure_limit_to_ci_pipeline_artifact.rb19
-rw-r--r--db/migrate/20210325152011_add_verification_indexes_to_ci_pipeline_artifacts.rb27
-rw-r--r--db/migrate/20210326035553_add_index_for_project_deployments_with_environment_id_and_updated_at.rb19
-rw-r--r--db/migrate/20210326190903_create_vulnerability_finding_evidences.rb26
-rw-r--r--db/migrate/20210329095548_add_target_project_and_source_branch_index_to_merge_request.rb18
-rw-r--r--db/migrate/20210329191850_add_finding_signature_table.rb40
-rw-r--r--db/migrate/20210329192716_add_composite_index_to_award_emoji.rb18
-rw-r--r--db/migrate/20210330015805_add_cloud_to_licenses.rb9
-rw-r--r--db/migrate/20210331125111_add_default_target_project.rb17
-rw-r--r--db/migrate/20210331145548_add_index_for_last_deployment.rb18
-rw-r--r--db/migrate/20210331180118_remove_deprecated_index_from_award_emoji.rb19
-rw-r--r--db/migrate/20210401134157_add_index_to_pages_deployments.rb18
-rw-r--r--db/migrate/20210401134455_remove_index_mirror_data_on_next_execution_and_retry_count.rb30
-rw-r--r--db/migrate/20210401175134_add_before_expiry_notification_delivered_to_keys.rb9
-rw-r--r--db/migrate/20210401192808_add_index_to_keys_on_expires_at_and_before_expiry_notification_undelivered.rb19
-rw-r--r--db/migrate/20210406063442_create_namespaces_id_parent_id_partial_index.rb18
-rw-r--r--db/migrate/20210406140057_add_total_tuple_count_to_batched_migrations.rb13
-rw-r--r--db/migrate/20210407002511_add_type_to_dast_site_profile.rb7
-rw-r--r--db/migrate/20210409084242_create_index_on_notes_for_cherry_picked_merge_requests.rb18
-rw-r--r--db/migrate/20210411212813_add_clusters_integrations_prometheus.rb21
-rw-r--r--db/migrate/20210412132736_add_instance_url_to_jira_connect_installations.rb16
-rw-r--r--db/migrate/20210412132824_add_text_limit_to_jira_connect_installations_instance_url.rb17
-rw-r--r--db/migrate/20210412142223_add_user_index_on_spam_logs.rb17
-rw-r--r--db/migrate/20210413121101_add_created_at_web_hook_id_index_to_partitioned_web_hook_log.rb21
-rw-r--r--db/migrate/20210413123832_add_index_on_web_hook_id_to_partitioned_web_hook_log.rb21
-rw-r--r--db/migrate/20210414095944_add_index_services_on_project_and_type_where_inherit_null.rb17
-rw-r--r--db/migrate/20210414131600_add_external_pipeline_validation_to_application_setting.rb19
-rw-r--r--db/migrate/20210415142700_add_url_limit_to_pipeline_validation.rb17
-rw-r--r--db/migrate/20210415144538_remove_index_epics_on_group_id_from_epics.rb17
-rw-r--r--db/post_migrate/20190214112022_schedule_sync_issuables_state_id.rb4
-rw-r--r--db/post_migrate/20191105094625_set_report_type_for_vulnerabilities.rb2
-rw-r--r--db/post_migrate/20191114173624_set_resolved_state_on_vulnerabilities.rb2
-rw-r--r--db/post_migrate/20200305082754_remove_duplicate_labels_from_project.rb6
-rw-r--r--db/post_migrate/20200325162730_schedule_backfill_push_rules_id_in_projects.rb2
-rw-r--r--db/post_migrate/20200406102120_backfill_deployment_clusters_from_deployments.rb2
-rw-r--r--db/post_migrate/20200416111111_migrate_vulnerability_dismissals.rb2
-rw-r--r--db/post_migrate/20200716234259_remove_duplicate_labels_from_group.rb6
-rw-r--r--db/post_migrate/20200809221641_migrate_license_management_artifacts_to_license_scanning.rb2
-rw-r--r--db/post_migrate/20200811130433_create_missing_vulnerabilities_issue_links.rb4
-rw-r--r--db/post_migrate/20200831065705_ensure_target_project_id_is_filled.rb2
-rw-r--r--db/post_migrate/20200930144340_set_job_waiter_ttl.rb2
-rw-r--r--db/post_migrate/20201014142521_schedule_sync_blocking_issues_count.rb2
-rw-r--r--db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb2
-rw-r--r--db/post_migrate/20210105030125_cleanup_projects_with_bad_has_external_wiki_data.rb6
-rw-r--r--db/post_migrate/20210115220610_schedule_artifact_expiry_backfill.rb6
-rw-r--r--db/post_migrate/20210210221006_cleanup_projects_with_bad_has_external_issue_tracker_data.rb6
-rw-r--r--db/post_migrate/20210224150506_reschedule_artifact_expiry_backfill.rb2
-rw-r--r--db/post_migrate/20210226120851_move_container_registry_enabled_to_project_features.rb5
-rw-r--r--db/post_migrate/20210226141517_dedup_issue_metrics.rb71
-rw-r--r--db/post_migrate/20210302150310_schedule_migrate_pages_to_zip_storage.rb36
-rw-r--r--db/post_migrate/20210311045138_set_traversal_ids_for_gitlab_org_group_staging.rb88
-rw-r--r--db/post_migrate/20210311045139_set_traversal_ids_for_gitlab_org_group_com.rb88
-rw-r--r--db/post_migrate/20210311093723_add_partial_index_on_ci_pipelines_by_cancelable_status_and_users.rb30
-rw-r--r--db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb29
-rw-r--r--db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb30
-rw-r--r--db/post_migrate/20210317104032_set_iteration_cadence_automatic_to_false.rb17
-rw-r--r--db/post_migrate/20210317155207_validate_not_null_constraint_on_cluster_token_name.rb16
-rw-r--r--db/post_migrate/20210322115438_validate_not_null_constraint_on_gitlab_subscriptions_namespace_id.rb17
-rw-r--r--db/post_migrate/20210326121537_backfill_cleanup_for_partitioned_web_hook_logs.rb17
-rw-r--r--db/post_migrate/20210328214434_remove_temporary_index_from_vulnerabilities_table.rb18
-rw-r--r--db/post_migrate/20210329102724_add_new_trail_plans.rb41
-rw-r--r--db/post_migrate/20210330091751_remove_records_without_group_from_webhooks_table.rb30
-rw-r--r--db/post_migrate/20210330130420_drop_finding_fingerprint_table.rb40
-rw-r--r--db/post_migrate/20210331105335_drop_non_partitioned_audit_events.rb44
-rw-r--r--db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb27
-rw-r--r--db/post_migrate/20210402005225_add_source_and_level_index_on_notification_settings.rb24
-rw-r--r--db/post_migrate/20210406144743_backfill_total_tuple_count_for_batched_migrations.rb27
-rw-r--r--db/post_migrate/20210407150240_confirm_support_bot_user.rb23
-rw-r--r--db/post_migrate/20210409185501_index_members_on_user_id_source_id_source_type.rb17
-rw-r--r--db/post_migrate/20210409185531_remove_members_index_on_user_id.rb17
-rw-r--r--db/post_migrate/20210413092922_add_index_to_packages_maven_metadata_path.rb17
-rw-r--r--db/post_migrate/20210413130011_add_partitioned_web_hook_log_fk.rb22
-rw-r--r--db/post_migrate/20210413132500_reschedule_artifact_expiry_backfill_again.rb44
-rw-r--r--db/post_migrate/20210415074645_index_members_on_user_id_access_level_requested_at_is_null.rb17
-rw-r--r--db/schema_migrations/202012181943111
-rw-r--r--db/schema_migrations/202101060612541
-rw-r--r--db/schema_migrations/202102192118451
-rw-r--r--db/schema_migrations/202102232306001
-rw-r--r--db/schema_migrations/202102241615521
-rw-r--r--db/schema_migrations/202102261415171
-rw-r--r--db/schema_migrations/202103020253051
-rw-r--r--db/schema_migrations/202103021503101
-rw-r--r--db/schema_migrations/202103050318221
-rw-r--r--db/schema_migrations/202103051803311
-rw-r--r--db/schema_migrations/202103051827401
-rw-r--r--db/schema_migrations/202103051828551
-rw-r--r--db/schema_migrations/202103051839041
-rw-r--r--db/schema_migrations/202103081752241
-rw-r--r--db/schema_migrations/202103081752251
-rw-r--r--db/schema_migrations/202103081752261
-rw-r--r--db/schema_migrations/202103081752271
-rw-r--r--db/schema_migrations/202103091601061
-rw-r--r--db/schema_migrations/202103110220121
-rw-r--r--db/schema_migrations/202103110451381
-rw-r--r--db/schema_migrations/202103110451391
-rw-r--r--db/schema_migrations/202103110937231
-rw-r--r--db/schema_migrations/202103111201521
-rw-r--r--db/schema_migrations/202103111201531
-rw-r--r--db/schema_migrations/202103111201541
-rw-r--r--db/schema_migrations/202103111201551
-rw-r--r--db/schema_migrations/202103111201561
-rw-r--r--db/schema_migrations/202103121400291
-rw-r--r--db/schema_migrations/202103121743211
-rw-r--r--db/schema_migrations/202103121935321
-rw-r--r--db/schema_migrations/202103130456171
-rw-r--r--db/schema_migrations/202103130458451
-rw-r--r--db/schema_migrations/202103160940471
-rw-r--r--db/schema_migrations/202103160943231
-rw-r--r--db/schema_migrations/202103161525001
-rw-r--r--db/schema_migrations/202103170353571
-rw-r--r--db/schema_migrations/202103171005201
-rw-r--r--db/schema_migrations/202103171040321
-rw-r--r--db/schema_migrations/202103171043011
-rw-r--r--db/schema_migrations/202103171059041
-rw-r--r--db/schema_migrations/202103171552071
-rw-r--r--db/schema_migrations/202103171929431
-rw-r--r--db/schema_migrations/202103181344271
-rw-r--r--db/schema_migrations/202103220634071
-rw-r--r--db/schema_migrations/202103220634501
-rw-r--r--db/schema_migrations/202103221154381
-rw-r--r--db/schema_migrations/202103221827511
-rw-r--r--db/schema_migrations/202103230647511
-rw-r--r--db/schema_migrations/202103231550101
-rw-r--r--db/schema_migrations/202103231828461
-rw-r--r--db/schema_migrations/202103241124391
-rw-r--r--db/schema_migrations/202103241317271
-rw-r--r--db/schema_migrations/202103250922151
-rw-r--r--db/schema_migrations/202103251131291
-rw-r--r--db/schema_migrations/202103251508371
-rw-r--r--db/schema_migrations/202103251517581
-rw-r--r--db/schema_migrations/202103251520111
-rw-r--r--db/schema_migrations/202103260355531
-rw-r--r--db/schema_migrations/202103261215371
-rw-r--r--db/schema_migrations/202103261909031
-rw-r--r--db/schema_migrations/202103282144341
-rw-r--r--db/schema_migrations/202103290955481
-rw-r--r--db/schema_migrations/202103291027241
-rw-r--r--db/schema_migrations/202103291918501
-rw-r--r--db/schema_migrations/202103291927161
-rw-r--r--db/schema_migrations/202103300158051
-rw-r--r--db/schema_migrations/202103300917511
-rw-r--r--db/schema_migrations/202103301304201
-rw-r--r--db/schema_migrations/202103311053351
-rw-r--r--db/schema_migrations/202103311251111
-rw-r--r--db/schema_migrations/202103311455481
-rw-r--r--db/schema_migrations/202103311801181
-rw-r--r--db/schema_migrations/202104011319481
-rw-r--r--db/schema_migrations/202104011341571
-rw-r--r--db/schema_migrations/202104011344551
-rw-r--r--db/schema_migrations/202104011751341
-rw-r--r--db/schema_migrations/202104011928081
-rw-r--r--db/schema_migrations/202104020052251
-rw-r--r--db/schema_migrations/202104060634421
-rw-r--r--db/schema_migrations/202104061400571
-rw-r--r--db/schema_migrations/202104061447431
-rw-r--r--db/schema_migrations/202104070025111
-rw-r--r--db/schema_migrations/202104071502401
-rw-r--r--db/schema_migrations/202104090842421
-rw-r--r--db/schema_migrations/202104091855011
-rw-r--r--db/schema_migrations/202104091855311
-rw-r--r--db/schema_migrations/202104112128131
-rw-r--r--db/schema_migrations/202104121327361
-rw-r--r--db/schema_migrations/202104121328241
-rw-r--r--db/schema_migrations/202104121422231
-rw-r--r--db/schema_migrations/202104130929221
-rw-r--r--db/schema_migrations/202104131211011
-rw-r--r--db/schema_migrations/202104131238321
-rw-r--r--db/schema_migrations/202104131300111
-rw-r--r--db/schema_migrations/202104131325001
-rw-r--r--db/schema_migrations/202104140959441
-rw-r--r--db/schema_migrations/202104141316001
-rw-r--r--db/schema_migrations/202104150746451
-rw-r--r--db/schema_migrations/202104151427001
-rw-r--r--db/schema_migrations/202104151445381
-rw-r--r--db/structure.sql525
224 files changed, 2799 insertions, 161 deletions
diff --git a/db/migrate/20200609212701_add_incident_settings_to_all_existing_projects.rb b/db/migrate/20200609212701_add_incident_settings_to_all_existing_projects.rb
index 60286e0dca6..a2931824ef5 100644
--- a/db/migrate/20200609212701_add_incident_settings_to_all_existing_projects.rb
+++ b/db/migrate/20200609212701_add_incident_settings_to_all_existing_projects.rb
@@ -8,7 +8,7 @@ class AddIncidentSettingsToAllExistingProjects < ActiveRecord::Migration[6.0]
# to preserve behavior for existing projects that
# are using the create issue functionality with the default setting of true
query = <<-SQL
- WITH project_ids AS (
+ WITH project_ids AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported}(
SELECT DISTINCT issues.project_id AS id
FROM issues
LEFT OUTER JOIN project_incident_management_settings
diff --git a/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb b/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb
index 0256d580cd6..b5a7bb5e39d 100644
--- a/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb
+++ b/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb
@@ -4,8 +4,8 @@ class RemoveTerraformStateVerificationIndexes < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- CHECKSUM_INDEX_NAME = "terraform_states_verification_checksum_partial".freeze
- FAILURE_INDEX_NAME = "terraform_states_verification_failure_partial".freeze
+ CHECKSUM_INDEX_NAME = "terraform_states_verification_checksum_partial"
+ FAILURE_INDEX_NAME = "terraform_states_verification_failure_partial"
disable_ddl_transaction!
diff --git a/db/migrate/20201214032220_add_has_external_wiki_trigger.rb b/db/migrate/20201214032220_add_has_external_wiki_trigger.rb
index f6e066b75da..c77b887d509 100644
--- a/db/migrate/20201214032220_add_has_external_wiki_trigger.rb
+++ b/db/migrate/20201214032220_add_has_external_wiki_trigger.rb
@@ -4,10 +4,10 @@ class AddHasExternalWikiTrigger < ActiveRecord::Migration[6.0]
include Gitlab::Database::SchemaHelpers
DOWNTIME = false
- FUNCTION_NAME = 'set_has_external_wiki'.freeze
- TRIGGER_ON_INSERT_NAME = 'trigger_has_external_wiki_on_insert'.freeze
- TRIGGER_ON_UPDATE_NAME = 'trigger_has_external_wiki_on_update'.freeze
- TRIGGER_ON_DELETE_NAME = 'trigger_has_external_wiki_on_delete'.freeze
+ FUNCTION_NAME = 'set_has_external_wiki'
+ TRIGGER_ON_INSERT_NAME = 'trigger_has_external_wiki_on_insert'
+ TRIGGER_ON_UPDATE_NAME = 'trigger_has_external_wiki_on_update'
+ TRIGGER_ON_DELETE_NAME = 'trigger_has_external_wiki_on_delete'
def up
create_trigger_function(FUNCTION_NAME, replace: true) do
diff --git a/db/migrate/20201218194311_create_admin_notes.rb b/db/migrate/20201218194311_create_admin_notes.rb
new file mode 100644
index 00000000000..32f5818cdfb
--- /dev/null
+++ b/db/migrate/20201218194311_create_admin_notes.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class CreateAdminNotes < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ create_table_with_constraints :namespace_admin_notes do |t|
+ t.timestamps_with_timezone
+ t.references :namespace, null: false, foreign_key: { on_delete: :cascade }
+ t.text :note
+
+ t.text_limit :note, 1000
+ end
+ end
+
+ def down
+ drop_table :namespace_admin_notes
+ end
+end
diff --git a/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb b/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb
index 0ecf194eb97..9c99414792e 100644
--- a/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb
+++ b/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb
@@ -7,7 +7,7 @@ class DropTemporaryIndexOnCiBuilds < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
- INDEX = 'tmp_build_stage_position_index'.freeze
+ INDEX = 'tmp_build_stage_position_index'
def up
remove_concurrent_index_by_name :ci_builds, INDEX
diff --git a/db/migrate/20210106061254_add_unique_index_for_golang_packages.rb b/db/migrate/20210106061254_add_unique_index_for_golang_packages.rb
new file mode 100644
index 00000000000..44237699fda
--- /dev/null
+++ b/db/migrate/20210106061254_add_unique_index_for_golang_packages.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddUniqueIndexForGolangPackages < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ INDEX_NAME = 'index_packages_on_project_id_name_version_unique_when_golang'
+ PACKAGE_TYPE_GOLANG = 8
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :packages_packages, [:project_id, :name, :version], unique: true, where: "package_type = #{PACKAGE_TYPE_GOLANG}", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name(:packages_packages, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210219211845_add_version_usage_data_id_to_raw_usage_data.rb b/db/migrate/20210219211845_add_version_usage_data_id_to_raw_usage_data.rb
new file mode 100644
index 00000000000..1b49fdd98bd
--- /dev/null
+++ b/db/migrate/20210219211845_add_version_usage_data_id_to_raw_usage_data.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddVersionUsageDataIdToRawUsageData < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :raw_usage_data, :version_usage_data_id_value, :bigint
+ end
+end
diff --git a/db/migrate/20210223230600_update_rubygems_metadata_metadata.rb b/db/migrate/20210223230600_update_rubygems_metadata_metadata.rb
new file mode 100644
index 00000000000..39e79be301e
--- /dev/null
+++ b/db/migrate/20210223230600_update_rubygems_metadata_metadata.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class UpdateRubygemsMetadataMetadata < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ remove_text_limit :packages_rubygems_metadata, :metadata
+ add_text_limit :packages_rubygems_metadata, :metadata, 30000
+ end
+
+ def down
+ remove_text_limit :packages_rubygems_metadata, :metadata
+ add_text_limit :packages_rubygems_metadata, :metadata, 255, validate: false
+ end
+end
diff --git a/db/migrate/20210224161552_add_jira_issue_transition_automatic_to_jira_tracker_data.rb b/db/migrate/20210224161552_add_jira_issue_transition_automatic_to_jira_tracker_data.rb
new file mode 100644
index 00000000000..6c788b9d554
--- /dev/null
+++ b/db/migrate/20210224161552_add_jira_issue_transition_automatic_to_jira_tracker_data.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddJiraIssueTransitionAutomaticToJiraTrackerData < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :jira_tracker_data, :jira_issue_transition_automatic, :boolean, null: false, default: false
+ end
+end
diff --git a/db/migrate/20210302025305_add_excluded_urls_and_request_headers_to_dast_site_profiles.rb b/db/migrate/20210302025305_add_excluded_urls_and_request_headers_to_dast_site_profiles.rb
new file mode 100644
index 00000000000..167b8d2c509
--- /dev/null
+++ b/db/migrate/20210302025305_add_excluded_urls_and_request_headers_to_dast_site_profiles.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddExcludedUrlsAndRequestHeadersToDastSiteProfiles < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in 20210311022012_add_text_limits_to_dast_site_profiles
+ def change
+ add_column :dast_site_profiles, :excluded_urls, :text, array: true, default: [], null: false
+ add_column :dast_site_profiles, :auth_enabled, :boolean, default: false, null: false
+ add_column :dast_site_profiles, :auth_url, :text
+ add_column :dast_site_profiles, :auth_username_field, :text
+ add_column :dast_site_profiles, :auth_password_field, :text
+ add_column :dast_site_profiles, :auth_username, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20210305031822_create_dast_site_profile_variables.rb b/db/migrate/20210305031822_create_dast_site_profile_variables.rb
new file mode 100644
index 00000000000..f55755aa731
--- /dev/null
+++ b/db/migrate/20210305031822_create_dast_site_profile_variables.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+class CreateDastSiteProfileVariables < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ table_comment = { owner: 'group::dynamic analysis', description: 'Secret variables used in DAST on-demand scans' }
+
+ encrypted_value_constraint_name = check_constraint_name(:dast_site_profile_secret_variables, 'encrypted_value', 'max_length')
+ encrypted_value_iv_constraint_name = check_constraint_name(:dast_site_profile_secret_variables, 'encrypted_value_iv', 'max_length')
+
+ create_table_with_constraints :dast_site_profile_secret_variables, comment: table_comment.to_json do |t|
+ t.references :dast_site_profile, null: false, foreign_key: { on_delete: :cascade }, index: false
+
+ t.timestamps_with_timezone
+
+ t.integer :variable_type, null: false, default: 1, limit: 2
+
+ t.text :key, null: false
+ t.binary :encrypted_value, null: false
+ t.binary :encrypted_value_iv, null: false, unique: true
+
+ t.index [:dast_site_profile_id, :key], unique: true, name: :index_site_profile_secret_variables_on_site_profile_id_and_key
+
+ t.text_limit :key, 255
+
+ # This does not currently have first-class support via create_table_with_constraints
+ t.check_constraint encrypted_value_constraint_name, 'length(encrypted_value) <= 13352'
+ t.check_constraint encrypted_value_iv_constraint_name, 'length(encrypted_value_iv) <= 17'
+ end
+ end
+
+ def down
+ drop_table :dast_site_profile_secret_variables
+ end
+end
diff --git a/db/migrate/20210305180331_create_ci_unit_tests.rb b/db/migrate/20210305180331_create_ci_unit_tests.rb
new file mode 100644
index 00000000000..970834a025b
--- /dev/null
+++ b/db/migrate/20210305180331_create_ci_unit_tests.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class CreateCiUnitTests < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:ci_unit_tests)
+ create_table :ci_unit_tests do |t|
+ t.bigint :project_id, null: false
+ t.text :key_hash, null: false
+ t.text :name, null: false
+ t.text :suite_name, null: false
+
+ t.index [:project_id, :key_hash], unique: true
+ # NOTE: FK for projects will be added on a separate migration as per guidelines
+ end
+ end
+
+ add_text_limit :ci_unit_tests, :key_hash, 64
+ add_text_limit :ci_unit_tests, :name, 255
+ add_text_limit :ci_unit_tests, :suite_name, 255
+ end
+
+ def down
+ drop_table :ci_unit_tests
+ end
+end
diff --git a/db/migrate/20210305182740_add_projects_fk_to_ci_unit_tests.rb b/db/migrate/20210305182740_add_projects_fk_to_ci_unit_tests.rb
new file mode 100644
index 00000000000..5e750d78a24
--- /dev/null
+++ b/db/migrate/20210305182740_add_projects_fk_to_ci_unit_tests.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddProjectsFkToCiUnitTests < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :ci_unit_tests, :projects, column: :project_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :ci_unit_tests, column: :project_id
+ end
+ end
+end
diff --git a/db/migrate/20210305182855_create_ci_unit_test_failures.rb b/db/migrate/20210305182855_create_ci_unit_test_failures.rb
new file mode 100644
index 00000000000..b3f68cdba4a
--- /dev/null
+++ b/db/migrate/20210305182855_create_ci_unit_test_failures.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class CreateCiUnitTestFailures < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ create_table :ci_unit_test_failures do |t|
+ t.datetime_with_timezone :failed_at, null: false
+ t.bigint :unit_test_id, null: false
+ t.bigint :build_id, null: false
+
+ t.index [:unit_test_id, :failed_at, :build_id], name: 'index_unit_test_failures_unique_columns', unique: true, order: { failed_at: :desc }
+ t.index :build_id
+ # NOTE: Adding the index for failed_at now for later use when we do scheduled clean up
+ t.index :failed_at, order: { failed_at: :desc }, name: 'index_unit_test_failures_failed_at'
+ t.foreign_key :ci_unit_tests, column: :unit_test_id, on_delete: :cascade
+ # NOTE: FK for ci_builds will be added on a separate migration as per guidelines
+ end
+ end
+
+ def down
+ drop_table :ci_unit_test_failures
+ end
+end
diff --git a/db/migrate/20210305183904_add_ci_builds_fk_to_ci_unit_test_failures.rb b/db/migrate/20210305183904_add_ci_builds_fk_to_ci_unit_test_failures.rb
new file mode 100644
index 00000000000..9cf75ba6059
--- /dev/null
+++ b/db/migrate/20210305183904_add_ci_builds_fk_to_ci_unit_test_failures.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddCiBuildsFkToCiUnitTestFailures < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :ci_unit_test_failures, :ci_builds, column: :build_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :ci_unit_test_failures, column: :build_id
+ end
+ end
+end
diff --git a/db/migrate/20210308175224_change_namespace_settings_delayed_project_removal_null.rb b/db/migrate/20210308175224_change_namespace_settings_delayed_project_removal_null.rb
new file mode 100644
index 00000000000..5b731b78117
--- /dev/null
+++ b/db/migrate/20210308175224_change_namespace_settings_delayed_project_removal_null.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class ChangeNamespaceSettingsDelayedProjectRemovalNull < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ change_column :namespace_settings, :delayed_project_removal, :boolean, null: true, default: nil
+ end
+
+ def down
+ change_column_default :namespace_settings, :delayed_project_removal, false
+ change_column_null :namespace_settings, :delayed_project_removal, false, false
+ end
+end
diff --git a/db/migrate/20210308175225_add_lock_delayed_project_removal_to_namespace_settings.rb b/db/migrate/20210308175225_add_lock_delayed_project_removal_to_namespace_settings.rb
new file mode 100644
index 00000000000..e88f3e7ea0d
--- /dev/null
+++ b/db/migrate/20210308175225_add_lock_delayed_project_removal_to_namespace_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddLockDelayedProjectRemovalToNamespaceSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :namespace_settings, :lock_delayed_project_removal, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20210308175226_add_delayed_project_removal_to_application_settings.rb b/db/migrate/20210308175226_add_delayed_project_removal_to_application_settings.rb
new file mode 100644
index 00000000000..1ccb25878e4
--- /dev/null
+++ b/db/migrate/20210308175226_add_delayed_project_removal_to_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddDelayedProjectRemovalToApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :delayed_project_removal, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20210308175227_add_lock_delayed_project_removal_to_application_settings.rb b/db/migrate/20210308175227_add_lock_delayed_project_removal_to_application_settings.rb
new file mode 100644
index 00000000000..c63175493de
--- /dev/null
+++ b/db/migrate/20210308175227_add_lock_delayed_project_removal_to_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddLockDelayedProjectRemovalToApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :lock_delayed_project_removal, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20210309160106_add_admin_mode_to_application_setting.rb b/db/migrate/20210309160106_add_admin_mode_to_application_setting.rb
new file mode 100644
index 00000000000..a7b634596d2
--- /dev/null
+++ b/db/migrate/20210309160106_add_admin_mode_to_application_setting.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddAdminModeToApplicationSetting < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :admin_mode, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20210311022012_add_text_limits_to_dast_site_profiles.rb b/db/migrate/20210311022012_add_text_limits_to_dast_site_profiles.rb
new file mode 100644
index 00000000000..7858449be14
--- /dev/null
+++ b/db/migrate/20210311022012_add_text_limits_to_dast_site_profiles.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddTextLimitsToDastSiteProfiles < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :dast_site_profiles, :auth_url, 1024
+ add_text_limit :dast_site_profiles, :auth_username_field, 255
+ add_text_limit :dast_site_profiles, :auth_password_field, 255
+ add_text_limit :dast_site_profiles, :auth_username, 255
+ end
+
+ def down
+ remove_text_limit :dast_site_profiles, :auth_username
+ remove_text_limit :dast_site_profiles, :auth_password_field
+ remove_text_limit :dast_site_profiles, :auth_username_field
+ remove_text_limit :dast_site_profiles, :auth_url
+ end
+end
diff --git a/db/migrate/20210311120152_add_metrics_to_batched_background_migration_jobs.rb b/db/migrate/20210311120152_add_metrics_to_batched_background_migration_jobs.rb
new file mode 100644
index 00000000000..523010a4aea
--- /dev/null
+++ b/db/migrate/20210311120152_add_metrics_to_batched_background_migration_jobs.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddMetricsToBatchedBackgroundMigrationJobs < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :batched_background_migration_jobs, :metrics, :jsonb, null: false, default: {}
+ end
+end
diff --git a/db/migrate/20210311120153_initialize_conversion_of_events_id_to_bigint.rb b/db/migrate/20210311120153_initialize_conversion_of_events_id_to_bigint.rb
new file mode 100644
index 00000000000..72536d24fe1
--- /dev/null
+++ b/db/migrate/20210311120153_initialize_conversion_of_events_id_to_bigint.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class InitializeConversionOfEventsIdToBigint < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ # Initialize the conversion of events.id to bigint
+ # Primary Key of the Events table
+ initialize_conversion_of_integer_to_bigint :events, :id
+ end
+
+ def down
+ trigger_name = rename_trigger_name(:events, :id, :id_convert_to_bigint)
+
+ remove_rename_triggers_for_postgresql :events, trigger_name
+
+ remove_column :events, :id_convert_to_bigint
+ end
+end
diff --git a/db/migrate/20210311120154_initialize_conversion_of_push_event_payloads_event_id_to_bigint.rb b/db/migrate/20210311120154_initialize_conversion_of_push_event_payloads_event_id_to_bigint.rb
new file mode 100644
index 00000000000..9ce3b59e2dd
--- /dev/null
+++ b/db/migrate/20210311120154_initialize_conversion_of_push_event_payloads_event_id_to_bigint.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class InitializeConversionOfPushEventPayloadsEventIdToBigint < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ # Foreign key that references events.id
+ # Also Primary key of the push_event_payloads table
+ initialize_conversion_of_integer_to_bigint :push_event_payloads, :event_id, primary_key: :event_id
+ end
+
+ def down
+ trigger_name = rename_trigger_name(:push_event_payloads, :event_id, :event_id_convert_to_bigint)
+
+ remove_rename_triggers_for_postgresql :push_event_payloads, trigger_name
+
+ remove_column :push_event_payloads, :event_id_convert_to_bigint
+ end
+end
diff --git a/db/migrate/20210312140029_add_owner_and_id_index_on_active_ci_pipeline_schedules.rb b/db/migrate/20210312140029_add_owner_and_id_index_on_active_ci_pipeline_schedules.rb
new file mode 100644
index 00000000000..111486a17ab
--- /dev/null
+++ b/db/migrate/20210312140029_add_owner_and_id_index_on_active_ci_pipeline_schedules.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddOwnerAndIdIndexOnActiveCiPipelineSchedules < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_ci_pipeline_schedules_on_owner_id_and_id_and_active'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_pipeline_schedules, [:owner_id, :id], where: "active = TRUE", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_pipeline_schedules, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210312174321_add_enforced_git_check_to_saml_provider.rb b/db/migrate/20210312174321_add_enforced_git_check_to_saml_provider.rb
new file mode 100644
index 00000000000..89553a53084
--- /dev/null
+++ b/db/migrate/20210312174321_add_enforced_git_check_to_saml_provider.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddEnforcedGitCheckToSamlProvider < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ add_column :saml_providers, :git_check_enforced, :boolean, default: false, null: false
+ end
+
+ def down
+ remove_column :saml_providers, :git_check_enforced
+ end
+end
diff --git a/db/migrate/20210312193532_add_resource_access_token_creation_allowed_to_namespace_settings.rb b/db/migrate/20210312193532_add_resource_access_token_creation_allowed_to_namespace_settings.rb
new file mode 100644
index 00000000000..1de9d87cf25
--- /dev/null
+++ b/db/migrate/20210312193532_add_resource_access_token_creation_allowed_to_namespace_settings.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+class AddResourceAccessTokenCreationAllowedToNamespaceSettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ add_column :namespace_settings, :resource_access_token_creation_allowed, :boolean, default: true, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :namespace_settings, :resource_access_token_creation_allowed
+ end
+ end
+end
diff --git a/db/migrate/20210313045617_add_verification_state_and_started_at_to_snippet_repositories.rb b/db/migrate/20210313045617_add_verification_state_and_started_at_to_snippet_repositories.rb
new file mode 100644
index 00000000000..e2d6dff23fa
--- /dev/null
+++ b/db/migrate/20210313045617_add_verification_state_and_started_at_to_snippet_repositories.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class AddVerificationStateAndStartedAtToSnippetRepositories < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ change_table(:snippet_repositories) do |t|
+ t.integer :verification_state, default: 0, limit: 2, null: false
+ t.column :verification_started_at, :datetime_with_timezone
+ end
+ end
+end
diff --git a/db/migrate/20210313045845_add_verification_indexes_to_snippet_repositories.rb b/db/migrate/20210313045845_add_verification_indexes_to_snippet_repositories.rb
new file mode 100644
index 00000000000..ebbc1126aa2
--- /dev/null
+++ b/db/migrate/20210313045845_add_verification_indexes_to_snippet_repositories.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class AddVerificationIndexesToSnippetRepositories < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ VERIFICATION_STATE_INDEX_NAME = "index_snippet_repositories_verification_state"
+ PENDING_VERIFICATION_INDEX_NAME = "index_snippet_repositories_pending_verification"
+ FAILED_VERIFICATION_INDEX_NAME = "index_snippet_repositories_failed_verification"
+ NEEDS_VERIFICATION_INDEX_NAME = "index_snippet_repositories_needs_verification"
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :snippet_repositories, :verification_state, name: VERIFICATION_STATE_INDEX_NAME
+ add_concurrent_index :snippet_repositories, :verified_at, where: "(verification_state = 0)", order: { verified_at: 'ASC NULLS FIRST' }, name: PENDING_VERIFICATION_INDEX_NAME
+ add_concurrent_index :snippet_repositories, :verification_retry_at, where: "(verification_state = 3)", order: { verification_retry_at: 'ASC NULLS FIRST' }, name: FAILED_VERIFICATION_INDEX_NAME
+ add_concurrent_index :snippet_repositories, :verification_state, where: "(verification_state = 0 OR verification_state = 3)", name: NEEDS_VERIFICATION_INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :snippet_repositories, VERIFICATION_STATE_INDEX_NAME
+ remove_concurrent_index_by_name :snippet_repositories, PENDING_VERIFICATION_INDEX_NAME
+ remove_concurrent_index_by_name :snippet_repositories, FAILED_VERIFICATION_INDEX_NAME
+ remove_concurrent_index_by_name :snippet_repositories, NEEDS_VERIFICATION_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210316094047_add_trial_extension_type_to_gitlab_subscription_histories.rb b/db/migrate/20210316094047_add_trial_extension_type_to_gitlab_subscription_histories.rb
new file mode 100644
index 00000000000..3915689e0af
--- /dev/null
+++ b/db/migrate/20210316094047_add_trial_extension_type_to_gitlab_subscription_histories.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddTrialExtensionTypeToGitlabSubscriptionHistories < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :gitlab_subscription_histories, :trial_extension_type, :smallint
+ end
+end
diff --git a/db/migrate/20210316094323_add_trial_extension_type_to_gitlab_subscriptions.rb b/db/migrate/20210316094323_add_trial_extension_type_to_gitlab_subscriptions.rb
new file mode 100644
index 00000000000..fb0ee789277
--- /dev/null
+++ b/db/migrate/20210316094323_add_trial_extension_type_to_gitlab_subscriptions.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddTrialExtensionTypeToGitlabSubscriptions < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ add_column :gitlab_subscriptions, :trial_extension_type, :smallint
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :gitlab_subscriptions, :trial_extension_type
+ end
+ end
+end
diff --git a/db/migrate/20210316152500_add_index_ci_stages_on_pipeline_id_and_id.rb b/db/migrate/20210316152500_add_index_ci_stages_on_pipeline_id_and_id.rb
new file mode 100644
index 00000000000..1128bf586ae
--- /dev/null
+++ b/db/migrate/20210316152500_add_index_ci_stages_on_pipeline_id_and_id.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexCiStagesOnPipelineIdAndId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_ci_stages_on_pipeline_id_and_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_stages, %i[pipeline_id id], where: 'status IN (0, 1, 2, 8, 9, 10)', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_stages, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210317035357_create_dast_profiles_pipelines.rb b/db/migrate/20210317035357_create_dast_profiles_pipelines.rb
new file mode 100644
index 00000000000..f7a29958f12
--- /dev/null
+++ b/db/migrate/20210317035357_create_dast_profiles_pipelines.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class CreateDastProfilesPipelines < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ table_comment = { owner: 'group::dynamic analysis', description: 'Join table between DAST Profiles and CI Pipelines' }
+
+ create_table :dast_profiles_pipelines, primary_key: [:dast_profile_id, :ci_pipeline_id], comment: table_comment.to_json do |t|
+ t.bigint :dast_profile_id, null: false
+ t.bigint :ci_pipeline_id, null: false
+
+ t.index :ci_pipeline_id, unique: true, name: :index_dast_profiles_pipelines_on_ci_pipeline_id
+ end
+ end
+
+ def down
+ drop_table :dast_profiles_pipelines
+ end
+end
diff --git a/db/migrate/20210317100520_create_elastic_index_settings.rb b/db/migrate/20210317100520_create_elastic_index_settings.rb
new file mode 100644
index 00000000000..61c1cbb3518
--- /dev/null
+++ b/db/migrate/20210317100520_create_elastic_index_settings.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class CreateElasticIndexSettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ create_table_with_constraints :elastic_index_settings do |t|
+ t.timestamps_with_timezone null: false
+ t.integer :number_of_replicas, null: false, default: 1, limit: 2
+ t.integer :number_of_shards, null: false, default: 5, limit: 2
+ t.text :alias_name, null: false
+
+ t.text_limit :alias_name, 255
+ t.index :alias_name, unique: true
+ end
+ end
+
+ def down
+ drop_table :elastic_index_settings
+ end
+end
diff --git a/db/migrate/20210317104301_create_in_product_marketing_emails.rb b/db/migrate/20210317104301_create_in_product_marketing_emails.rb
new file mode 100644
index 00000000000..b8c6b952c97
--- /dev/null
+++ b/db/migrate/20210317104301_create_in_product_marketing_emails.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class CreateInProductMarketingEmails < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ UNIQUE_INDEX_NAME = 'index_in_product_marketing_emails_on_user_track_series'
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ create_table :in_product_marketing_emails do |t|
+ t.bigint :user_id, null: false
+ t.datetime_with_timezone :cta_clicked_at
+ t.integer :track, null: false, limit: 2
+ t.integer :series, null: false, limit: 2
+
+ t.timestamps_with_timezone
+ end
+ end
+
+ add_index :in_product_marketing_emails, :user_id
+ add_index :in_product_marketing_emails, [:user_id, :track, :series], unique: true, name: UNIQUE_INDEX_NAME
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :in_product_marketing_emails
+ end
+ end
+end
diff --git a/db/migrate/20210317105904_add_user_foreign_key_to_in_product_marketing_emails.rb b/db/migrate/20210317105904_add_user_foreign_key_to_in_product_marketing_emails.rb
new file mode 100644
index 00000000000..f0b4d97d2cf
--- /dev/null
+++ b/db/migrate/20210317105904_add_user_foreign_key_to_in_product_marketing_emails.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddUserForeignKeyToInProductMarketingEmails < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :in_product_marketing_emails, :users, column: :user_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :in_product_marketing_emails, column: :user_id
+ end
+ end
+end
diff --git a/db/migrate/20210317192943_add_expiry_notification_delivered_to_keys.rb b/db/migrate/20210317192943_add_expiry_notification_delivered_to_keys.rb
new file mode 100644
index 00000000000..15f319b3965
--- /dev/null
+++ b/db/migrate/20210317192943_add_expiry_notification_delivered_to_keys.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddExpiryNotificationDeliveredToKeys < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :keys, :expiry_notification_delivered_at, :datetime_with_timezone
+ end
+end
diff --git a/db/migrate/20210318134427_delete_security_findings_without_uuid.rb b/db/migrate/20210318134427_delete_security_findings_without_uuid.rb
new file mode 100644
index 00000000000..f8e0f0fb32b
--- /dev/null
+++ b/db/migrate/20210318134427_delete_security_findings_without_uuid.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class DeleteSecurityFindingsWithoutUuid < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ class SecurityFinding < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'security_findings'
+
+ scope :without_uuid, -> { where(uuid: nil) }
+ end
+
+ def up
+ SecurityFinding.without_uuid.each_batch(of: 10_000) do |relation|
+ relation.delete_all
+ end
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20210322063407_add_dast_profile_id_fk_to_dast_profiles_pipelines.rb b/db/migrate/20210322063407_add_dast_profile_id_fk_to_dast_profiles_pipelines.rb
new file mode 100644
index 00000000000..4e9b3ddd41c
--- /dev/null
+++ b/db/migrate/20210322063407_add_dast_profile_id_fk_to_dast_profiles_pipelines.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddDastProfileIdFkToDastProfilesPipelines < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :dast_profiles_pipelines, :dast_profiles, column: :dast_profile_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :dast_profiles_pipelines, column: :dast_profile_id
+ end
+ end
+end
diff --git a/db/migrate/20210322063450_add_ci_pipeline_id_fk_to_dast_profiles_pipelines.rb b/db/migrate/20210322063450_add_ci_pipeline_id_fk_to_dast_profiles_pipelines.rb
new file mode 100644
index 00000000000..f1dce7f0cd8
--- /dev/null
+++ b/db/migrate/20210322063450_add_ci_pipeline_id_fk_to_dast_profiles_pipelines.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddCiPipelineIdFkToDastProfilesPipelines < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :dast_profiles_pipelines, :ci_pipelines, column: :ci_pipeline_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :dast_profiles_pipelines, column: :ci_pipeline_id
+ end
+ end
+end
diff --git a/db/migrate/20210322182751_add_index_to_keys_on_expires_at_and_expiry_notification_undelivered.rb b/db/migrate/20210322182751_add_index_to_keys_on_expires_at_and_expiry_notification_undelivered.rb
new file mode 100644
index 00000000000..6387d8a6a43
--- /dev/null
+++ b/db/migrate/20210322182751_add_index_to_keys_on_expires_at_and_expiry_notification_undelivered.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexToKeysOnExpiresAtAndExpiryNotificationUndelivered < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_keys_on_expires_at_and_expiry_notification_undelivered'
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :keys,
+ "date(timezone('UTC', expires_at)), expiry_notification_delivered_at",
+ where: 'expiry_notification_delivered_at IS NULL', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name(:keys, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210323064751_add_namespace_traversal_ids_index.rb b/db/migrate/20210323064751_add_namespace_traversal_ids_index.rb
new file mode 100644
index 00000000000..162173f6629
--- /dev/null
+++ b/db/migrate/20210323064751_add_namespace_traversal_ids_index.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddNamespaceTraversalIdsIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_namespaces_on_traversal_ids'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :namespaces, :traversal_ids, using: :gin, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :namespaces, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210323155010_populate_dismissal_information_for_vulnerabilities.rb b/db/migrate/20210323155010_populate_dismissal_information_for_vulnerabilities.rb
new file mode 100644
index 00000000000..aee6d5484d5
--- /dev/null
+++ b/db/migrate/20210323155010_populate_dismissal_information_for_vulnerabilities.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class PopulateDismissalInformationForVulnerabilities < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+ BATCH_SIZE = 100
+ UPDATE_QUERY = <<~SQL
+ UPDATE
+ vulnerabilities
+ SET
+ dismissed_at = COALESCE(dismissed_at, updated_at),
+ dismissed_by_id = COALESCE(dismissed_by_id, updated_by_id, last_edited_by_id, author_id)
+ WHERE
+ vulnerabilities.id IN (%{ids})
+ SQL
+
+ class Vulnerability < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'vulnerabilities'
+
+ enum state: { detected: 1, confirmed: 4, resolved: 3, dismissed: 2 }
+
+ scope :broken, -> { dismissed.where('dismissed_at IS NULL OR dismissed_by_id IS NULL') }
+ end
+
+ def up
+ Vulnerability.broken.each_batch(of: BATCH_SIZE) do |batch|
+ query = format(UPDATE_QUERY, ids: batch.select(:id).to_sql)
+
+ connection.execute(query)
+ end
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20210323182846_add_project_status_date_index_to_merge_requests.rb b/db/migrate/20210323182846_add_project_status_date_index_to_merge_requests.rb
new file mode 100644
index 00000000000..1ec6bc0bf2e
--- /dev/null
+++ b/db/migrate/20210323182846_add_project_status_date_index_to_merge_requests.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddProjectStatusDateIndexToMergeRequests < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = "idx_mrs_on_target_id_and_created_at_and_state_id"
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :merge_requests, %i[target_project_id state_id created_at id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :merge_requests, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210324112439_add_index_mirror_data_on_retry_next_execution_where_status.rb b/db/migrate/20210324112439_add_index_mirror_data_on_retry_next_execution_where_status.rb
new file mode 100644
index 00000000000..68ce5363b70
--- /dev/null
+++ b/db/migrate/20210324112439_add_index_mirror_data_on_retry_next_execution_where_status.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 AddIndexMirrorDataOnRetryNextExecutionWhereStatus < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ INDEX_NAME = 'index_mirror_data_non_scheduled_or_started'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :project_mirror_data,
+ [:next_execution_timestamp, :retry_count],
+ where: "(status)::text <> ALL ('{scheduled,started}'::text[])",
+ name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :project_mirror_data,
+ [:next_execution_timestamp, :retry_count],
+ where: "(status)::text <> ALL ('{scheduled,started}'::text[])",
+ name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210324131727_migrate_elastic_index_settings.rb b/db/migrate/20210324131727_migrate_elastic_index_settings.rb
new file mode 100644
index 00000000000..4dcfc6cf952
--- /dev/null
+++ b/db/migrate/20210324131727_migrate_elastic_index_settings.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class MigrateElasticIndexSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ ALIAS_NAME = [Rails.application.class.module_parent_name.downcase, Rails.env].join('-')
+
+ class ElasticIndexSetting < ActiveRecord::Base
+ end
+
+ class ApplicationSetting < ActiveRecord::Base
+ end
+
+ def up
+ setting = ApplicationSetting.first
+ number_of_replicas = setting&.elasticsearch_replicas || 1
+ number_of_shards = setting&.elasticsearch_shards || 5
+
+ return if ElasticIndexSetting.exists?(alias_name: ALIAS_NAME)
+
+ ElasticIndexSetting.create!(
+ alias_name: ALIAS_NAME,
+ number_of_replicas: number_of_replicas,
+ number_of_shards: number_of_shards
+ )
+ end
+
+ def down
+ ElasticIndexSetting.where(alias_name: ALIAS_NAME).delete_all
+ end
+end
diff --git a/db/migrate/20210325092215_add_not_valid_foreign_key_to_group_hooks.rb b/db/migrate/20210325092215_add_not_valid_foreign_key_to_group_hooks.rb
new file mode 100644
index 00000000000..2389f90d498
--- /dev/null
+++ b/db/migrate/20210325092215_add_not_valid_foreign_key_to_group_hooks.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddNotValidForeignKeyToGroupHooks < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :web_hooks, :namespaces, column: :group_id, on_delete: :cascade, validate: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :web_hooks, column: :group_id
+ end
+ end
+end
diff --git a/db/migrate/20210325113129_validate_foreign_key_on_service_hooks.rb b/db/migrate/20210325113129_validate_foreign_key_on_service_hooks.rb
new file mode 100644
index 00000000000..17dd4cad6ae
--- /dev/null
+++ b/db/migrate/20210325113129_validate_foreign_key_on_service_hooks.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class ValidateForeignKeyOnServiceHooks < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ CONSTRAINT_NAME = 'fk_d47999a98a'
+
+ def up
+ validate_foreign_key :web_hooks, :service_id, name: CONSTRAINT_NAME
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20210325150837_add_verification_state_to_ci_pipeline_artifact.rb b/db/migrate/20210325150837_add_verification_state_to_ci_pipeline_artifact.rb
new file mode 100644
index 00000000000..f6c506e59b7
--- /dev/null
+++ b/db/migrate/20210325150837_add_verification_state_to_ci_pipeline_artifact.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddVerificationStateToCiPipelineArtifact < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ change_table(:ci_pipeline_artifacts, bulk: true) do |t|
+ t.column :verification_started_at, :datetime_with_timezone
+ t.column :verification_retry_at, :datetime_with_timezone
+ t.column :verified_at, :datetime_with_timezone
+ t.integer :verification_state, default: 0, limit: 2, null: false
+ t.integer :verification_retry_count, limit: 2
+ t.binary :verification_checksum, using: 'verification_checksum::bytea'
+
+ t.text :verification_failure # rubocop:disable Migration/AddLimitToTextColumns
+ end
+ end
+end
diff --git a/db/migrate/20210325151758_add_verification_failure_limit_to_ci_pipeline_artifact.rb b/db/migrate/20210325151758_add_verification_failure_limit_to_ci_pipeline_artifact.rb
new file mode 100644
index 00000000000..bc4dee2181f
--- /dev/null
+++ b/db/migrate/20210325151758_add_verification_failure_limit_to_ci_pipeline_artifact.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddVerificationFailureLimitToCiPipelineArtifact < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ CONSTRAINT_NAME = 'ci_pipeline_artifacts_verification_failure_text_limit'
+
+ def up
+ add_text_limit :ci_pipeline_artifacts, :verification_failure, 255, constraint_name: CONSTRAINT_NAME
+ end
+
+ def down
+ remove_check_constraint(:ci_pipeline_artifacts, CONSTRAINT_NAME)
+ end
+end
diff --git a/db/migrate/20210325152011_add_verification_indexes_to_ci_pipeline_artifacts.rb b/db/migrate/20210325152011_add_verification_indexes_to_ci_pipeline_artifacts.rb
new file mode 100644
index 00000000000..0822aee35a4
--- /dev/null
+++ b/db/migrate/20210325152011_add_verification_indexes_to_ci_pipeline_artifacts.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class AddVerificationIndexesToCiPipelineArtifacts < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ VERIFICATION_STATE_INDEX_NAME = "index_ci_pipeline_artifacts_verification_state"
+ PENDING_VERIFICATION_INDEX_NAME = "index_ci_pipeline_artifacts_pending_verification"
+ FAILED_VERIFICATION_INDEX_NAME = "index_ci_pipeline_artifacts_failed_verification"
+ NEEDS_VERIFICATION_INDEX_NAME = "index_ci_pipeline_artifacts_needs_verification"
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_pipeline_artifacts, :verification_state, name: VERIFICATION_STATE_INDEX_NAME
+ add_concurrent_index :ci_pipeline_artifacts, :verified_at, where: "(verification_state = 0)", order: { verified_at: 'ASC NULLS FIRST' }, name: PENDING_VERIFICATION_INDEX_NAME
+ add_concurrent_index :ci_pipeline_artifacts, :verification_retry_at, where: "(verification_state = 3)", order: { verification_retry_at: 'ASC NULLS FIRST' }, name: FAILED_VERIFICATION_INDEX_NAME
+ add_concurrent_index :ci_pipeline_artifacts, :verification_state, where: "(verification_state = 0 OR verification_state = 3)", name: NEEDS_VERIFICATION_INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_pipeline_artifacts, VERIFICATION_STATE_INDEX_NAME
+ remove_concurrent_index_by_name :ci_pipeline_artifacts, PENDING_VERIFICATION_INDEX_NAME
+ remove_concurrent_index_by_name :ci_pipeline_artifacts, FAILED_VERIFICATION_INDEX_NAME
+ remove_concurrent_index_by_name :ci_pipeline_artifacts, NEEDS_VERIFICATION_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210326035553_add_index_for_project_deployments_with_environment_id_and_updated_at.rb b/db/migrate/20210326035553_add_index_for_project_deployments_with_environment_id_and_updated_at.rb
new file mode 100644
index 00000000000..d10c9401a31
--- /dev/null
+++ b/db/migrate/20210326035553_add_index_for_project_deployments_with_environment_id_and_updated_at.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexForProjectDeploymentsWithEnvironmentIdAndUpdatedAt < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_deployments_on_project_and_environment_and_updated_at'
+
+ def up
+ add_concurrent_index :deployments, [:project_id, :environment_id, :updated_at], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :deployments, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210326190903_create_vulnerability_finding_evidences.rb b/db/migrate/20210326190903_create_vulnerability_finding_evidences.rb
new file mode 100644
index 00000000000..4de02a6762e
--- /dev/null
+++ b/db/migrate/20210326190903_create_vulnerability_finding_evidences.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class CreateVulnerabilityFindingEvidences < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ create_table_with_constraints :vulnerability_finding_evidences do |t|
+ t.timestamps_with_timezone null: false
+
+ t.references :vulnerability_occurrence, index: { name: 'finding_evidences_on_vulnerability_occurrence_id' }, null: false, foreign_key: { on_delete: :cascade }
+ t.text :summary
+
+ t.text_limit :summary, 8_000_000
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :vulnerability_finding_evidences
+ end
+ end
+end
diff --git a/db/migrate/20210329095548_add_target_project_and_source_branch_index_to_merge_request.rb b/db/migrate/20210329095548_add_target_project_and_source_branch_index_to_merge_request.rb
new file mode 100644
index 00000000000..d351de6bd77
--- /dev/null
+++ b/db/migrate/20210329095548_add_target_project_and_source_branch_index_to_merge_request.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddTargetProjectAndSourceBranchIndexToMergeRequest < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_merge_requests_on_target_project_id_and_source_branch'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :merge_requests, [:target_project_id, :source_branch], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :epic_issues, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210329191850_add_finding_signature_table.rb b/db/migrate/20210329191850_add_finding_signature_table.rb
new file mode 100644
index 00000000000..74a12d54a8e
--- /dev/null
+++ b/db/migrate/20210329191850_add_finding_signature_table.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+class AddFindingSignatureTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ SIGNATURE_IDX = :idx_vuln_signatures_on_occurrences_id_and_signature_sha
+ UNIQ_IDX = :idx_vuln_signatures_uniqueness_signature_sha
+
+ def up
+ with_lock_retries do
+ create_table :vulnerability_finding_signatures do |t|
+ t.references :finding,
+ index: true,
+ null: false,
+ foreign_key: { to_table: :vulnerability_occurrences, column: :finding_id, on_delete: :cascade }
+
+ t.timestamps_with_timezone null: false
+
+ t.integer :algorithm_type, null: false, limit: 2
+ t.binary :signature_sha, null: false
+
+ t.index %i[finding_id signature_sha],
+ name: SIGNATURE_IDX,
+ unique: true # only one link should exist between occurrence and the signature
+
+ t.index %i[finding_id algorithm_type signature_sha],
+ name: UNIQ_IDX,
+ unique: true # these should be unique
+ end
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :vulnerability_finding_signatures
+ end
+ end
+end
diff --git a/db/migrate/20210329192716_add_composite_index_to_award_emoji.rb b/db/migrate/20210329192716_add_composite_index_to_award_emoji.rb
new file mode 100644
index 00000000000..ce37afdbc29
--- /dev/null
+++ b/db/migrate/20210329192716_add_composite_index_to_award_emoji.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddCompositeIndexToAwardEmoji < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'idx_award_emoji_on_user_emoji_name_awardable_type_awardable_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :award_emoji, %i[user_id name awardable_type awardable_id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :award_emoji, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210330015805_add_cloud_to_licenses.rb b/db/migrate/20210330015805_add_cloud_to_licenses.rb
new file mode 100644
index 00000000000..d0c7112d0b0
--- /dev/null
+++ b/db/migrate/20210330015805_add_cloud_to_licenses.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddCloudToLicenses < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :licenses, :cloud, :boolean, default: false
+ end
+end
diff --git a/db/migrate/20210331125111_add_default_target_project.rb b/db/migrate/20210331125111_add_default_target_project.rb
new file mode 100644
index 00000000000..1a2c5ccca7d
--- /dev/null
+++ b/db/migrate/20210331125111_add_default_target_project.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddDefaultTargetProject < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ add_column :project_settings, :mr_default_target_self, :boolean, default: false, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :project_settings, :mr_default_target_self
+ end
+ end
+end
diff --git a/db/migrate/20210331145548_add_index_for_last_deployment.rb b/db/migrate/20210331145548_add_index_for_last_deployment.rb
new file mode 100644
index 00000000000..a50d8ea403a
--- /dev/null
+++ b/db/migrate/20210331145548_add_index_for_last_deployment.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexForLastDeployment < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_deployments_on_environment_id_status_and_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :deployments, [:environment_id, :status, :id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :deployments, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210331180118_remove_deprecated_index_from_award_emoji.rb b/db/migrate/20210331180118_remove_deprecated_index_from_award_emoji.rb
new file mode 100644
index 00000000000..b8787eb171c
--- /dev/null
+++ b/db/migrate/20210331180118_remove_deprecated_index_from_award_emoji.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class RemoveDeprecatedIndexFromAwardEmoji < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_award_emoji_on_user_id_and_name'
+
+ disable_ddl_transaction!
+
+ def up
+ # Index deprecated in favor of idx_award_emoji_on_user_emoji_name_awardable_type_awardable_id
+ remove_concurrent_index_by_name(:award_emoji, INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:award_emoji, [:user_id, :name], name: INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210401134157_add_index_to_pages_deployments.rb b/db/migrate/20210401134157_add_index_to_pages_deployments.rb
new file mode 100644
index 00000000000..aef27c7c6f9
--- /dev/null
+++ b/db/migrate/20210401134157_add_index_to_pages_deployments.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexToPagesDeployments < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_pages_deployments_on_file_store_and_id'
+
+ def up
+ add_concurrent_index :pages_deployments, [:file_store, :id], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :pages_deployments, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210401134455_remove_index_mirror_data_on_next_execution_and_retry_count.rb b/db/migrate/20210401134455_remove_index_mirror_data_on_next_execution_and_retry_count.rb
new file mode 100644
index 00000000000..ee59e72e398
--- /dev/null
+++ b/db/migrate/20210401134455_remove_index_mirror_data_on_next_execution_and_retry_count.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 RemoveIndexMirrorDataOnNextExecutionAndRetryCount < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ DOWNTIME = false
+
+ INDEX_NAME = 'index_mirror_data_on_next_execution_and_retry_count'
+
+ def up
+ remove_concurrent_index(
+ :project_mirror_data,
+ %i[next_execution_timestamp retry_count],
+ name: INDEX_NAME
+ )
+ end
+
+ def down
+ add_concurrent_index(
+ :project_mirror_data,
+ %i[next_execution_timestamp retry_count],
+ name: INDEX_NAME
+ )
+ end
+end
diff --git a/db/migrate/20210401175134_add_before_expiry_notification_delivered_to_keys.rb b/db/migrate/20210401175134_add_before_expiry_notification_delivered_to_keys.rb
new file mode 100644
index 00000000000..6a2ea0e738c
--- /dev/null
+++ b/db/migrate/20210401175134_add_before_expiry_notification_delivered_to_keys.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddBeforeExpiryNotificationDeliveredToKeys < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :keys, :before_expiry_notification_delivered_at, :datetime_with_timezone
+ end
+end
diff --git a/db/migrate/20210401192808_add_index_to_keys_on_expires_at_and_before_expiry_notification_undelivered.rb b/db/migrate/20210401192808_add_index_to_keys_on_expires_at_and_before_expiry_notification_undelivered.rb
new file mode 100644
index 00000000000..ff792d2e6e6
--- /dev/null
+++ b/db/migrate/20210401192808_add_index_to_keys_on_expires_at_and_before_expiry_notification_undelivered.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexToKeysOnExpiresAtAndBeforeExpiryNotificationUndelivered < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'idx_keys_expires_at_and_before_expiry_notification_undelivered'
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :keys,
+ "date(timezone('UTC', expires_at)), before_expiry_notification_delivered_at",
+ where: 'before_expiry_notification_delivered_at IS NULL', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name(:keys, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210406063442_create_namespaces_id_parent_id_partial_index.rb b/db/migrate/20210406063442_create_namespaces_id_parent_id_partial_index.rb
new file mode 100644
index 00000000000..073d1ee2bc5
--- /dev/null
+++ b/db/migrate/20210406063442_create_namespaces_id_parent_id_partial_index.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateNamespacesIdParentIdPartialIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ NAME = 'index_namespaces_id_parent_id_is_null'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :namespaces, :id, where: 'parent_id IS NULL', name: NAME
+ end
+
+ def down
+ remove_concurrent_index :namespaces, :id, name: NAME
+ end
+end
diff --git a/db/migrate/20210406140057_add_total_tuple_count_to_batched_migrations.rb b/db/migrate/20210406140057_add_total_tuple_count_to_batched_migrations.rb
new file mode 100644
index 00000000000..32b5f27a577
--- /dev/null
+++ b/db/migrate/20210406140057_add_total_tuple_count_to_batched_migrations.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddTotalTupleCountToBatchedMigrations < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ add_column :batched_background_migrations, :total_tuple_count, :bigint
+ end
+
+ def down
+ remove_column :batched_background_migrations, :total_tuple_count
+ end
+end
diff --git a/db/migrate/20210407002511_add_type_to_dast_site_profile.rb b/db/migrate/20210407002511_add_type_to_dast_site_profile.rb
new file mode 100644
index 00000000000..99d9970a2a8
--- /dev/null
+++ b/db/migrate/20210407002511_add_type_to_dast_site_profile.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddTypeToDastSiteProfile < ActiveRecord::Migration[6.0]
+ def change
+ add_column :dast_site_profiles, :target_type, :integer, limit: 2, default: 0, null: false
+ end
+end
diff --git a/db/migrate/20210409084242_create_index_on_notes_for_cherry_picked_merge_requests.rb b/db/migrate/20210409084242_create_index_on_notes_for_cherry_picked_merge_requests.rb
new file mode 100644
index 00000000000..2bcdf4c8982
--- /dev/null
+++ b/db/migrate/20210409084242_create_index_on_notes_for_cherry_picked_merge_requests.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateIndexOnNotesForCherryPickedMergeRequests < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ NAME = 'index_notes_for_cherry_picked_merge_requests'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :notes, [:project_id, :commit_id], where: "((noteable_type)::text = 'MergeRequest'::text)", name: NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :notes, name: NAME
+ end
+end
diff --git a/db/migrate/20210411212813_add_clusters_integrations_prometheus.rb b/db/migrate/20210411212813_add_clusters_integrations_prometheus.rb
new file mode 100644
index 00000000000..7b7894fdcc8
--- /dev/null
+++ b/db/migrate/20210411212813_add_clusters_integrations_prometheus.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddClustersIntegrationsPrometheus < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ create_table :clusters_integration_prometheus, id: false do |t|
+ t.timestamps_with_timezone null: false
+ t.references :cluster, primary_key: true, default: nil, index: false, foreign_key: { on_delete: :cascade }
+ t.boolean :enabled, null: false, default: false
+ end
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :clusters_integration_prometheus
+ end
+ end
+end
diff --git a/db/migrate/20210412132736_add_instance_url_to_jira_connect_installations.rb b/db/migrate/20210412132736_add_instance_url_to_jira_connect_installations.rb
new file mode 100644
index 00000000000..78b5e7d5d35
--- /dev/null
+++ b/db/migrate/20210412132736_add_instance_url_to_jira_connect_installations.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class AddInstanceUrlToJiraConnectInstallations < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in db/migrate/20210216163811_add_text_limit_to_jira_connect_installations_instance_url.rb
+ def up
+ add_column :jira_connect_installations, :instance_url, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+
+ def down
+ remove_column :jira_connect_installations, :instance_url
+ end
+end
diff --git a/db/migrate/20210412132824_add_text_limit_to_jira_connect_installations_instance_url.rb b/db/migrate/20210412132824_add_text_limit_to_jira_connect_installations_instance_url.rb
new file mode 100644
index 00000000000..22c82ccd223
--- /dev/null
+++ b/db/migrate/20210412132824_add_text_limit_to_jira_connect_installations_instance_url.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddTextLimitToJiraConnectInstallationsInstanceUrl < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :jira_connect_installations, :instance_url, 255
+ end
+
+ def down
+ remove_text_limit :jira_connect_installations, :instance_url
+ end
+end
diff --git a/db/migrate/20210412142223_add_user_index_on_spam_logs.rb b/db/migrate/20210412142223_add_user_index_on_spam_logs.rb
new file mode 100644
index 00000000000..0a12f0f1a87
--- /dev/null
+++ b/db/migrate/20210412142223_add_user_index_on_spam_logs.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddUserIndexOnSpamLogs < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_spam_logs_on_user_id'
+
+ def up
+ add_concurrent_index :spam_logs, :user_id, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :spam_logs, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210413121101_add_created_at_web_hook_id_index_to_partitioned_web_hook_log.rb b/db/migrate/20210413121101_add_created_at_web_hook_id_index_to_partitioned_web_hook_log.rb
new file mode 100644
index 00000000000..344f4859b47
--- /dev/null
+++ b/db/migrate/20210413121101_add_created_at_web_hook_id_index_to_partitioned_web_hook_log.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddCreatedAtWebHookIdIndexToPartitionedWebHookLog < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ DOWNTIME = false
+
+ CREATED_AT_WEB_HOOK_ID_INDEX_NAME = 'index_web_hook_logs_part_on_created_at_and_web_hook_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_partitioned_index :web_hook_logs_part_0c5294f417,
+ [:created_at, :web_hook_id],
+ name: CREATED_AT_WEB_HOOK_ID_INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_partitioned_index_by_name :web_hook_logs_part_0c5294f417, CREATED_AT_WEB_HOOK_ID_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210413123832_add_index_on_web_hook_id_to_partitioned_web_hook_log.rb b/db/migrate/20210413123832_add_index_on_web_hook_id_to_partitioned_web_hook_log.rb
new file mode 100644
index 00000000000..300c19d3e51
--- /dev/null
+++ b/db/migrate/20210413123832_add_index_on_web_hook_id_to_partitioned_web_hook_log.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddIndexOnWebHookIdToPartitionedWebHookLog < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ DOWNTIME = false
+
+ WEB_HOOK_ID_INDEX_NAME = 'index_web_hook_logs_part_on_web_hook_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_partitioned_index :web_hook_logs_part_0c5294f417,
+ :web_hook_id,
+ name: WEB_HOOK_ID_INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_partitioned_index_by_name :web_hook_logs_part_0c5294f417, WEB_HOOK_ID_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210414095944_add_index_services_on_project_and_type_where_inherit_null.rb b/db/migrate/20210414095944_add_index_services_on_project_and_type_where_inherit_null.rb
new file mode 100644
index 00000000000..395742318e2
--- /dev/null
+++ b/db/migrate/20210414095944_add_index_services_on_project_and_type_where_inherit_null.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexServicesOnProjectAndTypeWhereInheritNull < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_services_on_project_and_type_where_inherit_null'
+
+ def up
+ add_concurrent_index(:services, [:project_id, :type], where: 'inherit_from_id IS NULL', name: INDEX_NAME)
+ end
+
+ def down
+ remove_concurrent_index_by_name(:services, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210414131600_add_external_pipeline_validation_to_application_setting.rb b/db/migrate/20210414131600_add_external_pipeline_validation_to_application_setting.rb
new file mode 100644
index 00000000000..537f7727691
--- /dev/null
+++ b/db/migrate/20210414131600_add_external_pipeline_validation_to_application_setting.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddExternalPipelineValidationToApplicationSetting < ActiveRecord::Migration[6.0]
+ def up
+ add_column :application_settings, :external_pipeline_validation_service_timeout, :integer
+ # rubocop:disable Migration/AddLimitToTextColumns
+ add_column :application_settings, :encrypted_external_pipeline_validation_service_token, :text
+ add_column :application_settings, :encrypted_external_pipeline_validation_service_token_iv, :text
+ add_column :application_settings, :external_pipeline_validation_service_url, :text
+ # rubocop:enable Migration/AddLimitToTextColumns
+ end
+
+ def down
+ remove_column :application_settings, :external_pipeline_validation_service_timeout
+ remove_column :application_settings, :encrypted_external_pipeline_validation_service_token
+ remove_column :application_settings, :encrypted_external_pipeline_validation_service_token_iv
+ remove_column :application_settings, :external_pipeline_validation_service_url
+ end
+end
diff --git a/db/migrate/20210415142700_add_url_limit_to_pipeline_validation.rb b/db/migrate/20210415142700_add_url_limit_to_pipeline_validation.rb
new file mode 100644
index 00000000000..9c38e04a96b
--- /dev/null
+++ b/db/migrate/20210415142700_add_url_limit_to_pipeline_validation.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddUrlLimitToPipelineValidation < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ CONSTRAINT_NAME = 'app_settings_ext_pipeline_validation_service_url_text_limit'
+
+ def up
+ add_text_limit :application_settings, :external_pipeline_validation_service_url, 255, constraint_name: CONSTRAINT_NAME
+ end
+
+ def down
+ remove_check_constraint(:application_settings, CONSTRAINT_NAME)
+ end
+end
diff --git a/db/migrate/20210415144538_remove_index_epics_on_group_id_from_epics.rb b/db/migrate/20210415144538_remove_index_epics_on_group_id_from_epics.rb
new file mode 100644
index 00000000000..f691af4d8d2
--- /dev/null
+++ b/db/migrate/20210415144538_remove_index_epics_on_group_id_from_epics.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class RemoveIndexEpicsOnGroupIdFromEpics < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'index_epics_on_group_id'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :epics, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :epics, :group_id, name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20190214112022_schedule_sync_issuables_state_id.rb b/db/post_migrate/20190214112022_schedule_sync_issuables_state_id.rb
index 34536e22bbf..de062937fbe 100644
--- a/db/post_migrate/20190214112022_schedule_sync_issuables_state_id.rb
+++ b/db/post_migrate/20190214112022_schedule_sync_issuables_state_id.rb
@@ -19,8 +19,8 @@ class ScheduleSyncIssuablesStateId < ActiveRecord::Migration[5.0]
#
BATCH_SIZE = 5000
DELAY_INTERVAL = 120.seconds.to_i
- ISSUES_MIGRATION = 'SyncIssuesStateId'.freeze
- MERGE_REQUESTS_MIGRATION = 'SyncMergeRequestsStateId'.freeze
+ ISSUES_MIGRATION = 'SyncIssuesStateId'
+ MERGE_REQUESTS_MIGRATION = 'SyncMergeRequestsStateId'
disable_ddl_transaction!
diff --git a/db/post_migrate/20191105094625_set_report_type_for_vulnerabilities.rb b/db/post_migrate/20191105094625_set_report_type_for_vulnerabilities.rb
index 5a8529c24d7..40e9e3bddc8 100644
--- a/db/post_migrate/20191105094625_set_report_type_for_vulnerabilities.rb
+++ b/db/post_migrate/20191105094625_set_report_type_for_vulnerabilities.rb
@@ -7,7 +7,7 @@ class SetReportTypeForVulnerabilities < ActiveRecord::Migration[5.2]
# set report_type based on vulnerability_occurrences from which the vulnerabilities were promoted,
# that is, first vulnerability_occurrences among those having the same vulnerability_id
execute <<~SQL
- WITH first_findings_for_vulnerabilities AS (
+ WITH first_findings_for_vulnerabilities AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
SELECT MIN(id) AS id, vulnerability_id
FROM vulnerability_occurrences
WHERE vulnerability_id IS NOT NULL
diff --git a/db/post_migrate/20191114173624_set_resolved_state_on_vulnerabilities.rb b/db/post_migrate/20191114173624_set_resolved_state_on_vulnerabilities.rb
index b28aecdc0a3..2900ef852a5 100644
--- a/db/post_migrate/20191114173624_set_resolved_state_on_vulnerabilities.rb
+++ b/db/post_migrate/20191114173624_set_resolved_state_on_vulnerabilities.rb
@@ -6,7 +6,7 @@ class SetResolvedStateOnVulnerabilities < ActiveRecord::Migration[5.2]
def up
execute <<~SQL
-- selecting IDs for all non-orphan Findings that either have no feedback or it's a non-dismissal feedback
- WITH resolved_vulnerability_ids AS (
+ WITH resolved_vulnerability_ids AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
SELECT DISTINCT vulnerability_id AS id
FROM vulnerability_occurrences
LEFT JOIN vulnerability_feedback ON vulnerability_feedback.project_fingerprint = ENCODE(vulnerability_occurrences.project_fingerprint::bytea, 'HEX')
diff --git a/db/post_migrate/20200305082754_remove_duplicate_labels_from_project.rb b/db/post_migrate/20200305082754_remove_duplicate_labels_from_project.rb
index 33f8118534d..4bb43da43bb 100644
--- a/db/post_migrate/20200305082754_remove_duplicate_labels_from_project.rb
+++ b/db/post_migrate/20200305082754_remove_duplicate_labels_from_project.rb
@@ -55,7 +55,7 @@ class RemoveDuplicateLabelsFromProject < ActiveRecord::Migration[6.0]
# project_id title template description type color
duplicate_labels = ApplicationRecord.connection.execute(<<-SQL.squish)
-WITH data AS (
+WITH data AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
SELECT labels.*,
row_number() OVER (PARTITION BY labels.project_id, labels.title, labels.template, labels.description, labels.type, labels.color ORDER BY labels.id) AS row_number,
#{CREATE} AS restore_action
@@ -83,7 +83,7 @@ WITH data AS (
# then add `_duplicate#{ID}`
soft_duplicates = ApplicationRecord.connection.execute(<<-SQL.squish)
-WITH data AS (
+WITH data AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
SELECT
*,
substring(title from 1 for 245 - length(id::text)) || '_duplicate' || id::text as new_title,
@@ -108,7 +108,7 @@ WHERE labels.id IN (#{soft_duplicates.map { |dup| dup["id"] }.join(", ")});
def restore_renamed_labels(start_id, stop_id)
# the backup label IDs are not incremental, they are copied directly from the Labels table
ApplicationRecord.connection.execute(<<-SQL.squish)
-WITH backups AS (
+WITH backups AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
SELECT id, title
FROM backup_labels
WHERE project_id BETWEEN #{start_id} AND #{stop_id} AND
diff --git a/db/post_migrate/20200325162730_schedule_backfill_push_rules_id_in_projects.rb b/db/post_migrate/20200325162730_schedule_backfill_push_rules_id_in_projects.rb
index 8ff3ab6aa0c..984f4f20441 100644
--- a/db/post_migrate/20200325162730_schedule_backfill_push_rules_id_in_projects.rb
+++ b/db/post_migrate/20200325162730_schedule_backfill_push_rules_id_in_projects.rb
@@ -5,7 +5,7 @@ class ScheduleBackfillPushRulesIdInProjects < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
- MIGRATION = 'BackfillPushRulesIdInProjects'.freeze
+ MIGRATION = 'BackfillPushRulesIdInProjects'
BATCH_SIZE = 1_000
class PushRules < ActiveRecord::Base
diff --git a/db/post_migrate/20200406102120_backfill_deployment_clusters_from_deployments.rb b/db/post_migrate/20200406102120_backfill_deployment_clusters_from_deployments.rb
index 76b00796d1a..ab217ba92ab 100644
--- a/db/post_migrate/20200406102120_backfill_deployment_clusters_from_deployments.rb
+++ b/db/post_migrate/20200406102120_backfill_deployment_clusters_from_deployments.rb
@@ -17,7 +17,7 @@ class BackfillDeploymentClustersFromDeployments < ActiveRecord::Migration[6.0]
class Deployment < ActiveRecord::Base
include EachBatch
- default_scope { where('cluster_id IS NOT NULL') } # rubocop:disable Cop/DefaultScope
+ default_scope { where.not(cluster_id: nil) } # rubocop:disable Cop/DefaultScope
self.table_name = 'deployments'
end
diff --git a/db/post_migrate/20200416111111_migrate_vulnerability_dismissals.rb b/db/post_migrate/20200416111111_migrate_vulnerability_dismissals.rb
index 6ec8b991968..6ca3db8902b 100644
--- a/db/post_migrate/20200416111111_migrate_vulnerability_dismissals.rb
+++ b/db/post_migrate/20200416111111_migrate_vulnerability_dismissals.rb
@@ -7,7 +7,7 @@ class MigrateVulnerabilityDismissals < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
- MIGRATION = 'UpdateVulnerabilitiesToDismissed'.freeze
+ MIGRATION = 'UpdateVulnerabilitiesToDismissed'
BATCH_SIZE = 500
DELAY_INTERVAL = 2.minutes.to_i
diff --git a/db/post_migrate/20200716234259_remove_duplicate_labels_from_group.rb b/db/post_migrate/20200716234259_remove_duplicate_labels_from_group.rb
index f19a209092b..114276df875 100644
--- a/db/post_migrate/20200716234259_remove_duplicate_labels_from_group.rb
+++ b/db/post_migrate/20200716234259_remove_duplicate_labels_from_group.rb
@@ -59,7 +59,7 @@ class RemoveDuplicateLabelsFromGroup < ActiveRecord::Migration[6.0]
# group_id title template description type color
duplicate_labels = ApplicationRecord.connection.execute(<<-SQL.squish)
-WITH data AS (
+WITH data AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
SELECT labels.*,
row_number() OVER (PARTITION BY labels.group_id, labels.title, labels.template, labels.description, labels.type, labels.color ORDER BY labels.id) AS row_number,
#{CREATE} AS restore_action
@@ -87,7 +87,7 @@ WITH data AS (
# then add `_duplicate#{ID}`
soft_duplicates = ApplicationRecord.connection.execute(<<-SQL.squish)
-WITH data AS (
+WITH data AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
SELECT
*,
substring(title from 1 for 245 - length(id::text)) || '_duplicate' || id::text as new_title,
@@ -112,7 +112,7 @@ WHERE labels.id IN (#{soft_duplicates.map { |dup| dup["id"] }.join(", ")});
def restore_renamed_labels(start_id, stop_id)
# the backup label IDs are not incremental, they are copied directly from the Labels table
ApplicationRecord.connection.execute(<<-SQL.squish)
-WITH backups AS (
+WITH backups AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
SELECT id, title
FROM backup_labels
WHERE id BETWEEN #{start_id} AND #{stop_id}
diff --git a/db/post_migrate/20200809221641_migrate_license_management_artifacts_to_license_scanning.rb b/db/post_migrate/20200809221641_migrate_license_management_artifacts_to_license_scanning.rb
index 0a5dfd72392..66ef4b35dfa 100644
--- a/db/post_migrate/20200809221641_migrate_license_management_artifacts_to_license_scanning.rb
+++ b/db/post_migrate/20200809221641_migrate_license_management_artifacts_to_license_scanning.rb
@@ -26,7 +26,7 @@ class MigrateLicenseManagementArtifactsToLicenseScanning < ActiveRecord::Migrati
min, max = relation.pluck('MIN(job_id)', 'MAX(job_id)').flatten
ActiveRecord::Base.connection.execute <<~SQL
- WITH ci_job_artifacts_with_row_number as (
+ WITH ci_job_artifacts_with_row_number as #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
SELECT job_id, id, ROW_NUMBER() OVER (PARTITION BY job_id ORDER BY id ASC) as row_number
FROM ci_job_artifacts
WHERE (file_type = #{LICENSE_SCANNING_FILE_TYPE} OR file_type = #{LICENSE_MANAGEMENT_FILE_TYPE})
diff --git a/db/post_migrate/20200811130433_create_missing_vulnerabilities_issue_links.rb b/db/post_migrate/20200811130433_create_missing_vulnerabilities_issue_links.rb
index 891201eaa52..031d9ea49e2 100644
--- a/db/post_migrate/20200811130433_create_missing_vulnerabilities_issue_links.rb
+++ b/db/post_migrate/20200811130433_create_missing_vulnerabilities_issue_links.rb
@@ -18,11 +18,11 @@ class CreateMissingVulnerabilitiesIssueLinks < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
def up
- VulnerabilitiesFeedback.where('issue_id IS NOT NULL').each_batch do |relation|
+ VulnerabilitiesFeedback.where.not(issue_id: nil).each_batch do |relation|
timestamp = Time.now
issue_links = relation
.joins("JOIN vulnerability_occurrences vo ON vo.project_id = vulnerability_feedback.project_id AND vo.report_type = vulnerability_feedback.category AND encode(vo.project_fingerprint, 'hex') = vulnerability_feedback.project_fingerprint")
- .where('vo.vulnerability_id IS NOT NULL')
+ .where.not('vo.vulnerability_id' => nil)
.pluck(:vulnerability_id, :issue_id)
.map do |v_id, i_id|
{
diff --git a/db/post_migrate/20200831065705_ensure_target_project_id_is_filled.rb b/db/post_migrate/20200831065705_ensure_target_project_id_is_filled.rb
index 9b267933b04..8693dca0000 100644
--- a/db/post_migrate/20200831065705_ensure_target_project_id_is_filled.rb
+++ b/db/post_migrate/20200831065705_ensure_target_project_id_is_filled.rb
@@ -32,7 +32,7 @@ class EnsureTargetProjectIdIsFilled < ActiveRecord::Migration[6.0]
)
MergeRequestMetrics.connection.execute <<-SQL
- WITH target_project_id_and_metrics_id as (
+ WITH target_project_id_and_metrics_id as #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
#{query_for_cte.to_sql}
)
UPDATE #{MergeRequestMetrics.connection.quote_table_name(MergeRequestMetrics.table_name)}
diff --git a/db/post_migrate/20200930144340_set_job_waiter_ttl.rb b/db/post_migrate/20200930144340_set_job_waiter_ttl.rb
index b15faa61dea..347fa4be5a0 100644
--- a/db/post_migrate/20200930144340_set_job_waiter_ttl.rb
+++ b/db/post_migrate/20200930144340_set_job_waiter_ttl.rb
@@ -3,7 +3,7 @@
class SetJobWaiterTtl < ActiveRecord::Migration[6.0]
DOWNTIME = false
- SCRIPT = <<~LUA.freeze
+ SCRIPT = <<~LUA
if redis.call("ttl", KEYS[1]) < 0 then
redis.call("expire", KEYS[1], 21600)
end
diff --git a/db/post_migrate/20201014142521_schedule_sync_blocking_issues_count.rb b/db/post_migrate/20201014142521_schedule_sync_blocking_issues_count.rb
index 61b2b2aaad5..30a8ea591da 100644
--- a/db/post_migrate/20201014142521_schedule_sync_blocking_issues_count.rb
+++ b/db/post_migrate/20201014142521_schedule_sync_blocking_issues_count.rb
@@ -7,7 +7,7 @@ class ScheduleSyncBlockingIssuesCount < ActiveRecord::Migration[6.0]
BATCH_SIZE = 50
DELAY_INTERVAL = 120.seconds.to_i
- MIGRATION = 'SyncBlockingIssuesCount'.freeze
+ MIGRATION = 'SyncBlockingIssuesCount'
disable_ddl_transaction!
diff --git a/db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb b/db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb
index 1ffe9abbc58..56db148afe6 100644
--- a/db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb
+++ b/db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb
@@ -5,7 +5,7 @@ class ScheduleBackfillingArtifactExpiryMigration < ActiveRecord::Migration[6.0]
DOWNTIME = false
SWITCH_DATE = Time.utc(2020, 6, 22).freeze
- INDEX_NAME = 'expired_artifacts_temp_index'.freeze
+ INDEX_NAME = 'expired_artifacts_temp_index'
INDEX_CONDITION = "expire_at IS NULL AND created_at < '#{SWITCH_DATE}'"
disable_ddl_transaction!
diff --git a/db/post_migrate/20210105030125_cleanup_projects_with_bad_has_external_wiki_data.rb b/db/post_migrate/20210105030125_cleanup_projects_with_bad_has_external_wiki_data.rb
index 73725062bb3..bc90a5f48ea 100644
--- a/db/post_migrate/20210105030125_cleanup_projects_with_bad_has_external_wiki_data.rb
+++ b/db/post_migrate/20210105030125_cleanup_projects_with_bad_has_external_wiki_data.rb
@@ -4,7 +4,7 @@ class CleanupProjectsWithBadHasExternalWikiData < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- TMP_INDEX_NAME = 'tmp_index_projects_on_id_where_has_external_wiki_is_true'.freeze
+ TMP_INDEX_NAME = 'tmp_index_projects_on_id_where_has_external_wiki_is_true'
BATCH_SIZE = 100
disable_ddl_transaction!
@@ -45,7 +45,7 @@ class CleanupProjectsWithBadHasExternalWikiData < ActiveRecord::Migration[6.0]
.merge(Project.where(has_external_wiki: false).where(pending_delete: false).where(archived: false))
execute(<<~SQL)
- WITH project_ids_to_update (id) AS (
+ WITH project_ids_to_update (id) AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
#{scope_with_projects.to_sql}
)
UPDATE projects SET has_external_wiki = true WHERE id IN (SELECT id FROM project_ids_to_update)
@@ -75,7 +75,7 @@ class CleanupProjectsWithBadHasExternalWikiData < ActiveRecord::Migration[6.0]
Project.where(index_where).each_batch(of: BATCH_SIZE) do |relation|
relation_with_exists_query = relation.where('NOT EXISTS (?)', services_sub_query)
execute(<<~SQL)
- WITH project_ids_to_update (id) AS (
+ WITH project_ids_to_update (id) AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
#{relation_with_exists_query.select(:id).to_sql}
)
UPDATE projects SET has_external_wiki = false WHERE id IN (SELECT id FROM project_ids_to_update)
diff --git a/db/post_migrate/20210115220610_schedule_artifact_expiry_backfill.rb b/db/post_migrate/20210115220610_schedule_artifact_expiry_backfill.rb
index 44a76321495..4f49e8b75af 100644
--- a/db/post_migrate/20210115220610_schedule_artifact_expiry_backfill.rb
+++ b/db/post_migrate/20210115220610_schedule_artifact_expiry_backfill.rb
@@ -4,11 +4,11 @@ class ScheduleArtifactExpiryBackfill < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- MIGRATION = 'BackfillArtifactExpiryDate'.freeze
+ MIGRATION = 'BackfillArtifactExpiryDate'
SWITCH_DATE = Date.new(2020, 06, 22).freeze
- INDEX_NAME = 'expired_artifacts_temp_index'.freeze
+ INDEX_NAME = 'expired_artifacts_temp_index'
OLD_INDEX_CONDITION = "expire_at IS NULL AND created_at < '#{SWITCH_DATE}'"
- INDEX_CONDITION = "expire_at IS NULL AND date(created_at AT TIME ZONE 'UTC') < '2020-06-22'::date".freeze
+ INDEX_CONDITION = "expire_at IS NULL AND date(created_at AT TIME ZONE 'UTC') < '2020-06-22'::date"
disable_ddl_transaction!
diff --git a/db/post_migrate/20210210221006_cleanup_projects_with_bad_has_external_issue_tracker_data.rb b/db/post_migrate/20210210221006_cleanup_projects_with_bad_has_external_issue_tracker_data.rb
index 4b8bf014066..7b17faeb4b4 100644
--- a/db/post_migrate/20210210221006_cleanup_projects_with_bad_has_external_issue_tracker_data.rb
+++ b/db/post_migrate/20210210221006_cleanup_projects_with_bad_has_external_issue_tracker_data.rb
@@ -4,7 +4,7 @@ class CleanupProjectsWithBadHasExternalIssueTrackerData < ActiveRecord::Migratio
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- TMP_INDEX_NAME = 'tmp_idx_projects_on_id_where_has_external_issue_tracker_is_true'.freeze
+ TMP_INDEX_NAME = 'tmp_idx_projects_on_id_where_has_external_issue_tracker_is_true'
BATCH_SIZE = 100
disable_ddl_transaction!
@@ -44,7 +44,7 @@ class CleanupProjectsWithBadHasExternalIssueTrackerData < ActiveRecord::Migratio
.merge(Project.where(has_external_issue_tracker: false).where(pending_delete: false))
execute(<<~SQL)
- WITH project_ids_to_update (id) AS (
+ WITH project_ids_to_update (id) AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
#{scope_with_projects.to_sql}
)
UPDATE projects SET has_external_issue_tracker = true WHERE id IN (SELECT id FROM project_ids_to_update)
@@ -71,7 +71,7 @@ class CleanupProjectsWithBadHasExternalIssueTrackerData < ActiveRecord::Migratio
Project.where(index_where).each_batch(of: BATCH_SIZE) do |relation|
relation_with_exists_query = relation.where('NOT EXISTS (?)', services_sub_query)
execute(<<~SQL)
- WITH project_ids_to_update (id) AS (
+ WITH project_ids_to_update (id) AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (
#{relation_with_exists_query.select(:id).to_sql}
)
UPDATE projects SET has_external_issue_tracker = false WHERE id IN (SELECT id FROM project_ids_to_update)
diff --git a/db/post_migrate/20210224150506_reschedule_artifact_expiry_backfill.rb b/db/post_migrate/20210224150506_reschedule_artifact_expiry_backfill.rb
index af5c474e2ba..2c0fe405490 100644
--- a/db/post_migrate/20210224150506_reschedule_artifact_expiry_backfill.rb
+++ b/db/post_migrate/20210224150506_reschedule_artifact_expiry_backfill.rb
@@ -4,7 +4,7 @@ class RescheduleArtifactExpiryBackfill < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- MIGRATION = 'BackfillArtifactExpiryDate'.freeze
+ MIGRATION = 'BackfillArtifactExpiryDate'
SWITCH_DATE = Date.new(2020, 06, 22).freeze
disable_ddl_transaction!
diff --git a/db/post_migrate/20210226120851_move_container_registry_enabled_to_project_features.rb b/db/post_migrate/20210226120851_move_container_registry_enabled_to_project_features.rb
index 7bc7a0e49f7..fce31110866 100644
--- a/db/post_migrate/20210226120851_move_container_registry_enabled_to_project_features.rb
+++ b/db/post_migrate/20210226120851_move_container_registry_enabled_to_project_features.rb
@@ -16,7 +16,10 @@ class MoveContainerRegistryEnabledToProjectFeatures < ActiveRecord::Migration[6.
end
def up
- queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, 2.minutes, batch_size: BATCH_SIZE)
+ # no-op
+ # Superceded by db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb
+
+ # queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, 2.minutes, batch_size: BATCH_SIZE)
end
def down
diff --git a/db/post_migrate/20210226141517_dedup_issue_metrics.rb b/db/post_migrate/20210226141517_dedup_issue_metrics.rb
new file mode 100644
index 00000000000..8228d509e07
--- /dev/null
+++ b/db/post_migrate/20210226141517_dedup_issue_metrics.rb
@@ -0,0 +1,71 @@
+# frozen_string_literal: true
+
+class DedupIssueMetrics < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ TMP_INDEX_NAME = 'tmp_unique_issue_metrics_by_issue_id'
+ OLD_INDEX_NAME = 'index_issue_metrics'
+ INDEX_NAME = 'index_unique_issue_metrics_issue_id'
+ BATCH_SIZE = 1_000
+
+ disable_ddl_transaction!
+
+ class IssueMetrics < ActiveRecord::Base
+ self.table_name = 'issue_metrics'
+
+ include EachBatch
+ end
+
+ def up
+ IssueMetrics.reset_column_information
+
+ last_metrics_record_id = IssueMetrics.maximum(:id) || 0
+
+ # This index will disallow further duplicates while we're deduplicating the data.
+ add_concurrent_index(:issue_metrics, :issue_id, where: "id > #{Integer(last_metrics_record_id)}", unique: true, name: TMP_INDEX_NAME)
+
+ IssueMetrics.each_batch(of: BATCH_SIZE) do |relation|
+ duplicated_issue_ids = IssueMetrics
+ .where(issue_id: relation.select(:issue_id))
+ .select(:issue_id)
+ .group(:issue_id)
+ .having('COUNT(issue_metrics.issue_id) > 1')
+ .pluck(:issue_id)
+
+ duplicated_issue_ids.each do |issue_id|
+ deduplicate_item(issue_id)
+ end
+ end
+
+ add_concurrent_index(:issue_metrics, :issue_id, unique: true, name: INDEX_NAME)
+ remove_concurrent_index_by_name(:issue_metrics, TMP_INDEX_NAME)
+ remove_concurrent_index_by_name(:issue_metrics, OLD_INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:issue_metrics, :issue_id, name: OLD_INDEX_NAME)
+ remove_concurrent_index_by_name(:issue_metrics, TMP_INDEX_NAME)
+ remove_concurrent_index_by_name(:issue_metrics, INDEX_NAME)
+ end
+
+ private
+
+ def deduplicate_item(issue_id)
+ issue_metrics_records = IssueMetrics.where(issue_id: issue_id).order(updated_at: :asc).to_a
+
+ attributes = {}
+ issue_metrics_records.each do |issue_metrics_record|
+ params = issue_metrics_record.attributes.except('id')
+ attributes.merge!(params.compact)
+ end
+
+ ActiveRecord::Base.transaction do
+ record_to_keep = issue_metrics_records.pop
+ records_to_delete = issue_metrics_records
+
+ IssueMetrics.where(id: records_to_delete.map(&:id)).delete_all
+ record_to_keep.update!(attributes)
+ end
+ end
+end
diff --git a/db/post_migrate/20210302150310_schedule_migrate_pages_to_zip_storage.rb b/db/post_migrate/20210302150310_schedule_migrate_pages_to_zip_storage.rb
new file mode 100644
index 00000000000..7f6d7ffe9b7
--- /dev/null
+++ b/db/post_migrate/20210302150310_schedule_migrate_pages_to_zip_storage.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+class ScheduleMigratePagesToZipStorage < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ MIGRATION = 'MigratePagesToZipStorage'
+ BATCH_SIZE = 10
+ BATCH_TIME = 5.minutes
+
+ disable_ddl_transaction!
+
+ class ProjectPagesMetadatum < ActiveRecord::Base
+ extend SuppressCompositePrimaryKeyWarning
+
+ include EachBatch
+
+ self.primary_key = :project_id
+ self.table_name = 'project_pages_metadata'
+ self.inheritance_column = :_type_disabled
+
+ scope :deployed, -> { where(deployed: true) }
+ scope :only_on_legacy_storage, -> { deployed.where(pages_deployment_id: nil) }
+ end
+
+ def up
+ queue_background_migration_jobs_by_range_at_intervals(
+ ProjectPagesMetadatum.only_on_legacy_storage,
+ MIGRATION,
+ BATCH_TIME,
+ batch_size: BATCH_SIZE,
+ primary_column_name: :project_id
+ )
+ end
+end
diff --git a/db/post_migrate/20210311045138_set_traversal_ids_for_gitlab_org_group_staging.rb b/db/post_migrate/20210311045138_set_traversal_ids_for_gitlab_org_group_staging.rb
new file mode 100644
index 00000000000..bcf872ded54
--- /dev/null
+++ b/db/post_migrate/20210311045138_set_traversal_ids_for_gitlab_org_group_staging.rb
@@ -0,0 +1,88 @@
+# frozen_string_literal: true
+
+class SetTraversalIdsForGitlabOrgGroupStaging < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ return unless Gitlab.staging?
+
+ # namespace ID 9970 is gitlab-org on staging.
+ with_lock_retries do
+ execute(<<~SQL)
+ UPDATE
+ namespaces
+ SET
+ traversal_ids = cte.traversal_ids
+ FROM
+ (
+ WITH RECURSIVE cte(id, traversal_ids, cycle) AS (
+ VALUES
+ (9970, ARRAY[9970], false)
+ UNION ALL
+ SELECT
+ n.id,
+ cte.traversal_ids || n.id,
+ n.id = ANY(cte.traversal_ids)
+ FROM
+ namespaces n,
+ cte
+ WHERE
+ n.parent_id = cte.id
+ AND NOT cycle
+ )
+ SELECT
+ id,
+ traversal_ids
+ FROM
+ cte FOR
+ UPDATE
+ ) as cte
+ WHERE
+ namespaces.id = cte.id
+ AND namespaces.traversal_ids <> cte.traversal_ids
+ SQL
+ end
+ end
+
+ def down
+ return unless Gitlab.staging?
+
+ # namespace ID 9970 is gitlab-org on staging.
+ with_lock_retries do
+ execute(<<~SQL)
+ UPDATE
+ namespaces
+ SET
+ traversal_ids = '{}'
+ FROM
+ (
+ WITH RECURSIVE cte(id, traversal_ids, cycle) AS (
+ VALUES
+ (9970, ARRAY[9970], false)
+ UNION ALL
+ SELECT
+ n.id,
+ cte.traversal_ids || n.id,
+ n.id = ANY(cte.traversal_ids)
+ FROM
+ namespaces n,
+ cte
+ WHERE
+ n.parent_id = cte.id
+ AND NOT cycle
+ )
+ SELECT
+ id,
+ traversal_ids
+ FROM
+ cte FOR
+ UPDATE
+ ) as cte
+ WHERE
+ namespaces.id = cte.id
+ SQL
+ end
+ end
+end
diff --git a/db/post_migrate/20210311045139_set_traversal_ids_for_gitlab_org_group_com.rb b/db/post_migrate/20210311045139_set_traversal_ids_for_gitlab_org_group_com.rb
new file mode 100644
index 00000000000..8cef1f1cc2b
--- /dev/null
+++ b/db/post_migrate/20210311045139_set_traversal_ids_for_gitlab_org_group_com.rb
@@ -0,0 +1,88 @@
+# frozen_string_literal: true
+
+class SetTraversalIdsForGitlabOrgGroupCom < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ return unless Gitlab.com?
+
+ # namespace ID 9970 is gitlab-org on .com
+ with_lock_retries do
+ execute(<<~SQL)
+ UPDATE
+ namespaces
+ SET
+ traversal_ids = cte.traversal_ids
+ FROM
+ (
+ WITH RECURSIVE cte(id, traversal_ids, cycle) AS (
+ VALUES
+ (9970, ARRAY[9970], false)
+ UNION ALL
+ SELECT
+ n.id,
+ cte.traversal_ids || n.id,
+ n.id = ANY(cte.traversal_ids)
+ FROM
+ namespaces n,
+ cte
+ WHERE
+ n.parent_id = cte.id
+ AND NOT cycle
+ )
+ SELECT
+ id,
+ traversal_ids
+ FROM
+ cte FOR
+ UPDATE
+ ) as cte
+ WHERE
+ namespaces.id = cte.id
+ AND namespaces.traversal_ids <> cte.traversal_ids
+ SQL
+ end
+ end
+
+ def down
+ return unless Gitlab.com?
+
+ # namespace ID 9970 is gitlab-org on .com
+ with_lock_retries do
+ execute(<<~SQL)
+ UPDATE
+ namespaces
+ SET
+ traversal_ids = '{}'
+ FROM
+ (
+ WITH RECURSIVE cte(id, traversal_ids, cycle) AS (
+ VALUES
+ (9970, ARRAY[9970], false)
+ UNION ALL
+ SELECT
+ n.id,
+ cte.traversal_ids || n.id,
+ n.id = ANY(cte.traversal_ids)
+ FROM
+ namespaces n,
+ cte
+ WHERE
+ n.parent_id = cte.id
+ AND NOT cycle
+ )
+ SELECT
+ id,
+ traversal_ids
+ FROM
+ cte FOR
+ UPDATE
+ ) as cte
+ WHERE
+ namespaces.id = cte.id
+ SQL
+ end
+ end
+end
diff --git a/db/post_migrate/20210311093723_add_partial_index_on_ci_pipelines_by_cancelable_status_and_users.rb b/db/post_migrate/20210311093723_add_partial_index_on_ci_pipelines_by_cancelable_status_and_users.rb
new file mode 100644
index 00000000000..176548be6e6
--- /dev/null
+++ b/db/post_migrate/20210311093723_add_partial_index_on_ci_pipelines_by_cancelable_status_and_users.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class AddPartialIndexOnCiPipelinesByCancelableStatusAndUsers < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_ci_pipelines_on_user_id_and_id_and_cancelable_status'
+ INDEX_FILTER_CONDITION = <<~SQL
+ ((status)::text = ANY (
+ ARRAY[
+ ('running'::character varying)::text,
+ ('waiting_for_resource'::character varying)::text,
+ ('preparing'::character varying)::text,
+ ('pending'::character varying)::text,
+ ('created'::character varying)::text,
+ ('scheduled'::character varying)::text
+ ]
+ ))
+ SQL
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_pipelines, [:user_id, :id], where: INDEX_FILTER_CONDITION, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_pipelines, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb
new file mode 100644
index 00000000000..01e81c65eee
--- /dev/null
+++ b/db/post_migrate/20210311120155_backfill_events_id_for_bigint_conversion.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class BackfillEventsIdForBigintConversion < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ return unless should_run?
+
+ backfill_conversion_of_integer_to_bigint :events, :id, batch_size: 15000, sub_batch_size: 100
+ end
+
+ def down
+ return unless should_run?
+
+ Gitlab::Database::BackgroundMigration::BatchedMigration
+ .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob')
+ .where(table_name: 'events', column_name: 'id')
+ .where('job_arguments = ?', %w[id id_convert_to_bigint].to_json)
+ .delete_all
+ end
+
+ private
+
+ def should_run?
+ Gitlab.dev_or_test_env? || Gitlab.com?
+ end
+end
diff --git a/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb
new file mode 100644
index 00000000000..6b8595b3ad3
--- /dev/null
+++ b/db/post_migrate/20210311120156_backfill_push_event_payload_event_id_for_bigint_conversion.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class BackfillPushEventPayloadEventIdForBigintConversion < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ return unless should_run?
+
+ backfill_conversion_of_integer_to_bigint :push_event_payloads, :event_id, primary_key: :event_id,
+ batch_size: 15000, sub_batch_size: 100
+ end
+
+ def down
+ return unless should_run?
+
+ Gitlab::Database::BackgroundMigration::BatchedMigration
+ .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob')
+ .where(table_name: 'push_event_payloads', column_name: 'event_id')
+ .where('job_arguments = ?', %w[event_id event_id_convert_to_bigint].to_json)
+ .delete_all
+ end
+
+ private
+
+ def should_run?
+ Gitlab.dev_or_test_env? || Gitlab.com?
+ end
+end
diff --git a/db/post_migrate/20210317104032_set_iteration_cadence_automatic_to_false.rb b/db/post_migrate/20210317104032_set_iteration_cadence_automatic_to_false.rb
new file mode 100644
index 00000000000..c151551ae64
--- /dev/null
+++ b/db/post_migrate/20210317104032_set_iteration_cadence_automatic_to_false.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class SetIterationCadenceAutomaticToFalse < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ ActiveRecord::Base.connection.execute <<~SQL
+ UPDATE iterations_cadences
+ SET automatic = FALSE
+ WHERE iterations_cadences.automatic = TRUE
+ SQL
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210317155207_validate_not_null_constraint_on_cluster_token_name.rb b/db/post_migrate/20210317155207_validate_not_null_constraint_on_cluster_token_name.rb
new file mode 100644
index 00000000000..b77523c3a44
--- /dev/null
+++ b/db/post_migrate/20210317155207_validate_not_null_constraint_on_cluster_token_name.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class ValidateNotNullConstraintOnClusterTokenName < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ validate_not_null_constraint :cluster_agent_tokens, :name
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210322115438_validate_not_null_constraint_on_gitlab_subscriptions_namespace_id.rb b/db/post_migrate/20210322115438_validate_not_null_constraint_on_gitlab_subscriptions_namespace_id.rb
new file mode 100644
index 00000000000..96d9f383406
--- /dev/null
+++ b/db/post_migrate/20210322115438_validate_not_null_constraint_on_gitlab_subscriptions_namespace_id.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class ValidateNotNullConstraintOnGitlabSubscriptionsNamespaceId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ validate_not_null_constraint :gitlab_subscriptions, :namespace_id
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210326121537_backfill_cleanup_for_partitioned_web_hook_logs.rb b/db/post_migrate/20210326121537_backfill_cleanup_for_partitioned_web_hook_logs.rb
new file mode 100644
index 00000000000..5816d02561e
--- /dev/null
+++ b/db/post_migrate/20210326121537_backfill_cleanup_for_partitioned_web_hook_logs.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class BackfillCleanupForPartitionedWebHookLogs < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ finalize_backfilling_partitioned_table :web_hook_logs
+ end
+
+ def down
+ # no op
+ end
+end
diff --git a/db/post_migrate/20210328214434_remove_temporary_index_from_vulnerabilities_table.rb b/db/post_migrate/20210328214434_remove_temporary_index_from_vulnerabilities_table.rb
new file mode 100644
index 00000000000..f3da1cc69c4
--- /dev/null
+++ b/db/post_migrate/20210328214434_remove_temporary_index_from_vulnerabilities_table.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveTemporaryIndexFromVulnerabilitiesTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'temporary_index_vulnerabilities_on_id'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :vulnerabilities, :id, where: "state = 2 AND (dismissed_at IS NULL OR dismissed_by_id IS NULL)", name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210329102724_add_new_trail_plans.rb b/db/post_migrate/20210329102724_add_new_trail_plans.rb
new file mode 100644
index 00000000000..b142f6385f7
--- /dev/null
+++ b/db/post_migrate/20210329102724_add_new_trail_plans.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+class AddNewTrailPlans < ActiveRecord::Migration[6.0]
+ class Plan < ActiveRecord::Base
+ self.inheritance_column = :_type_disabled
+
+ has_one :limits, class_name: 'PlanLimits'
+
+ def actual_limits
+ self.limits || self.build_limits
+ end
+ end
+
+ class PlanLimits < ActiveRecord::Base
+ self.inheritance_column = :_type_disabled
+
+ belongs_to :plan
+ end
+
+ def create_plan_limits(plan_limit_name, plan)
+ plan_limit = Plan.find_or_initialize_by(name: plan_limit_name).actual_limits.dup
+ plan_limit.plan = plan
+ plan_limit.save!
+ end
+
+ def up
+ return unless Gitlab.dev_env_or_com?
+
+ ultimate_trial = Plan.create!(name: 'ultimate_trial', title: 'Ultimate Trial')
+ premium_trial = Plan.create!(name: 'premium_trial', title: 'Premium Trial')
+
+ create_plan_limits('gold', ultimate_trial)
+ create_plan_limits('silver', premium_trial)
+ end
+
+ def down
+ return unless Gitlab.dev_env_or_com?
+
+ Plan.where(name: %w(ultimate_trial premium_trial)).delete_all
+ end
+end
diff --git a/db/post_migrate/20210330091751_remove_records_without_group_from_webhooks_table.rb b/db/post_migrate/20210330091751_remove_records_without_group_from_webhooks_table.rb
new file mode 100644
index 00000000000..c384aa25ac4
--- /dev/null
+++ b/db/post_migrate/20210330091751_remove_records_without_group_from_webhooks_table.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class RemoveRecordsWithoutGroupFromWebhooksTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ class WebHook < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'web_hooks'
+ end
+
+ class Group < ActiveRecord::Base
+ self.inheritance_column = :_type_disabled
+ self.table_name = 'namespaces'
+ end
+
+ def up
+ subquery = Group.select(1).where(Group.arel_table[:id].eq(WebHook.arel_table[:group_id]))
+
+ WebHook.each_batch(of: 500, column: :id) do |relation|
+ relation.where(type: 'GroupHook').where.not('EXISTS (?)', subquery).delete_all
+ end
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210330130420_drop_finding_fingerprint_table.rb b/db/post_migrate/20210330130420_drop_finding_fingerprint_table.rb
new file mode 100644
index 00000000000..fd77d4d7a4b
--- /dev/null
+++ b/db/post_migrate/20210330130420_drop_finding_fingerprint_table.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+class DropFindingFingerprintTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ FINGERPRINT_IDX = :idx_vuln_fingerprints_on_occurrences_id_and_fingerprint_sha256
+ UNIQ_IDX = :idx_vuln_fingerprints_uniqueness_fingerprint_sha256
+
+ def up
+ with_lock_retries do
+ drop_table :vulnerability_finding_fingerprints
+ end
+ end
+
+ def down
+ with_lock_retries do
+ create_table :vulnerability_finding_fingerprints do |t|
+ t.references :finding,
+ index: true,
+ null: false,
+ foreign_key: { to_table: :vulnerability_occurrences, column: :finding_id, on_delete: :cascade }
+
+ t.timestamps_with_timezone null: false
+
+ t.integer :algorithm_type, null: false, limit: 2
+ t.binary :fingerprint_sha256, null: false
+
+ t.index %i[finding_id fingerprint_sha256],
+ name: FINGERPRINT_IDX,
+ unique: true # only one link should exist between occurrence and the fingerprint
+
+ t.index %i[finding_id algorithm_type fingerprint_sha256],
+ name: UNIQ_IDX,
+ unique: true # these should be unique
+ end
+ end
+ end
+end
diff --git a/db/post_migrate/20210331105335_drop_non_partitioned_audit_events.rb b/db/post_migrate/20210331105335_drop_non_partitioned_audit_events.rb
new file mode 100644
index 00000000000..7c32fc61711
--- /dev/null
+++ b/db/post_migrate/20210331105335_drop_non_partitioned_audit_events.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+class DropNonPartitionedAuditEvents < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers
+
+ DOWNTIME = false
+
+ def up
+ drop_nonpartitioned_archive_table(:audit_events)
+ end
+
+ def down
+ execute(<<~SQL)
+ CREATE TABLE audit_events_archived (
+ id integer NOT NULL,
+ author_id integer NOT NULL,
+ entity_id integer NOT NULL,
+ entity_type character varying NOT NULL,
+ details text,
+ created_at timestamp without time zone,
+ ip_address inet,
+ author_name text,
+ entity_path text,
+ target_details text,
+ target_type text,
+ target_id bigint,
+ CONSTRAINT check_492aaa021d CHECK ((char_length(entity_path) <= 5500)),
+ CONSTRAINT check_82294106dd CHECK ((char_length(target_type) <= 255)),
+ CONSTRAINT check_83ff8406e2 CHECK ((char_length(author_name) <= 255)),
+ CONSTRAINT check_d493ec90b5 CHECK ((char_length(target_details) <= 5500))
+ );
+
+ ALTER TABLE ONLY audit_events_archived ADD CONSTRAINT audit_events_archived_pkey PRIMARY KEY (id);
+
+ CREATE INDEX analytics_index_audit_events_on_created_at_and_author_id ON audit_events_archived USING btree (created_at, author_id);
+ CREATE INDEX idx_audit_events_on_entity_id_desc_author_id_created_at ON audit_events_archived USING btree (entity_id, entity_type, id DESC, author_id, created_at);
+ SQL
+
+ with_lock_retries do
+ create_trigger_to_sync_tables(:audit_events, :audit_events_archived, 'id')
+ end
+ end
+end
diff --git a/db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb b/db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb
new file mode 100644
index 00000000000..6e3f7ae34d1
--- /dev/null
+++ b/db/post_migrate/20210401131948_move_container_registry_enabled_to_project_features2.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class MoveContainerRegistryEnabledToProjectFeatures2 < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ BATCH_SIZE = 21_000
+ MIGRATION = 'MoveContainerRegistryEnabledToProjectFeature'
+
+ disable_ddl_transaction!
+
+ class Project < ActiveRecord::Base
+ include EachBatch
+ self.table_name = 'projects'
+ end
+
+ def up
+ delete_queued_jobs('MoveContainerRegistryEnabledToProjectFeature')
+
+ queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, 2.minutes, batch_size: BATCH_SIZE, track_jobs: true)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210402005225_add_source_and_level_index_on_notification_settings.rb b/db/post_migrate/20210402005225_add_source_and_level_index_on_notification_settings.rb
new file mode 100644
index 00000000000..a29babca93e
--- /dev/null
+++ b/db/post_migrate/20210402005225_add_source_and_level_index_on_notification_settings.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddSourceAndLevelIndexOnNotificationSettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_WITH_SOURCE_LEVEL_USER_NAME = 'index_notification_settings_on_source_and_level_and_user'
+ INDEX_WITH_SOURCE_NAME = 'index_notification_settings_on_source_id_and_source_type'
+ INDEX_WITH_USER_NAME = 'index_notification_settings_on_user_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :notification_settings, [:source_id, :source_type, :level, :user_id], name: INDEX_WITH_SOURCE_LEVEL_USER_NAME
+ remove_concurrent_index_by_name :notification_settings, INDEX_WITH_SOURCE_NAME # Above index expands this index
+ remove_concurrent_index_by_name :notification_settings, INDEX_WITH_USER_NAME # It is redundant as we already have unique index on (user_id, source_id, source_type)
+ end
+
+ def down
+ add_concurrent_index :notification_settings, [:source_id, :source_type], name: INDEX_WITH_SOURCE_NAME
+ add_concurrent_index :notification_settings, [:user_id], name: INDEX_WITH_USER_NAME
+ remove_concurrent_index_by_name :notification_settings, INDEX_WITH_SOURCE_LEVEL_USER_NAME
+ end
+end
diff --git a/db/post_migrate/20210406144743_backfill_total_tuple_count_for_batched_migrations.rb b/db/post_migrate/20210406144743_backfill_total_tuple_count_for_batched_migrations.rb
new file mode 100644
index 00000000000..5fc5a5b2b6e
--- /dev/null
+++ b/db/post_migrate/20210406144743_backfill_total_tuple_count_for_batched_migrations.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class BackfillTotalTupleCountForBatchedMigrations < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ return unless should_run?
+
+ Gitlab::Database::BackgroundMigration::BatchedMigration.all.each do |migration|
+ total_tuple_count = Gitlab::Database::PgClass.for_table(migration.table_name)&.cardinality_estimate
+
+ migration.update(total_tuple_count: total_tuple_count)
+ end
+ end
+
+ def down
+ return unless should_run?
+
+ Gitlab::Database::BackgroundMigration::BatchedMigration.update_all(total_tuple_count: nil)
+ end
+
+ private
+
+ def should_run?
+ Gitlab.dev_or_test_env? || Gitlab.com?
+ end
+end
diff --git a/db/post_migrate/20210407150240_confirm_support_bot_user.rb b/db/post_migrate/20210407150240_confirm_support_bot_user.rb
new file mode 100644
index 00000000000..c26ae153128
--- /dev/null
+++ b/db/post_migrate/20210407150240_confirm_support_bot_user.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class ConfirmSupportBotUser < ActiveRecord::Migration[6.0]
+ SUPPORT_BOT_TYPE = 1
+
+ def up
+ users = Arel::Table.new(:users)
+ um = Arel::UpdateManager.new
+ um.table(users)
+ .where(users[:user_type].eq(SUPPORT_BOT_TYPE))
+ .where(users[:confirmed_at].eq(nil))
+ .set([[users[:confirmed_at], Arel::Nodes::NamedFunction.new('COALESCE', [users[:created_at], Arel::Nodes::SqlLiteral.new('NOW()')])]])
+ connection.execute(um.to_sql)
+ end
+
+ def down
+ # no op
+
+ # The up migration allows for the possibility that the support user might
+ # have already been manually confirmed. It's not reversible as this data is
+ # subsequently lost.
+ end
+end
diff --git a/db/post_migrate/20210409185501_index_members_on_user_id_source_id_source_type.rb b/db/post_migrate/20210409185501_index_members_on_user_id_source_id_source_type.rb
new file mode 100644
index 00000000000..d20eb5e4ea3
--- /dev/null
+++ b/db/post_migrate/20210409185501_index_members_on_user_id_source_id_source_type.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class IndexMembersOnUserIdSourceIdSourceType < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_members_on_user_id_source_id_source_type'
+
+ def up
+ add_concurrent_index(:members, [:user_id, :source_id, :source_type], name: INDEX_NAME)
+ end
+
+ def down
+ remove_concurrent_index_by_name(:members, INDEX_NAME)
+ end
+end
diff --git a/db/post_migrate/20210409185531_remove_members_index_on_user_id.rb b/db/post_migrate/20210409185531_remove_members_index_on_user_id.rb
new file mode 100644
index 00000000000..3f330e44408
--- /dev/null
+++ b/db/post_migrate/20210409185531_remove_members_index_on_user_id.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class RemoveMembersIndexOnUserId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_members_on_user_id'
+
+ def up
+ remove_concurrent_index_by_name(:members, INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:members, :user_id, name: INDEX_NAME)
+ end
+end
diff --git a/db/post_migrate/20210413092922_add_index_to_packages_maven_metadata_path.rb b/db/post_migrate/20210413092922_add_index_to_packages_maven_metadata_path.rb
new file mode 100644
index 00000000000..697b9f9cbf7
--- /dev/null
+++ b/db/post_migrate/20210413092922_add_index_to_packages_maven_metadata_path.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexToPackagesMavenMetadataPath < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_packages_maven_metadata_on_path'
+
+ def up
+ add_concurrent_index :packages_maven_metadata, :path, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :packages_maven_metadata, :path, name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210413130011_add_partitioned_web_hook_log_fk.rb b/db/post_migrate/20210413130011_add_partitioned_web_hook_log_fk.rb
new file mode 100644
index 00000000000..6453993bd51
--- /dev/null
+++ b/db/post_migrate/20210413130011_add_partitioned_web_hook_log_fk.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddPartitionedWebHookLogFk < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_partitioned_foreign_key :web_hook_logs_part_0c5294f417,
+ :web_hooks,
+ column: :web_hook_id,
+ on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :web_hook_logs_part_0c5294f417, column: :web_hook_id
+ end
+ end
+end
diff --git a/db/post_migrate/20210413132500_reschedule_artifact_expiry_backfill_again.rb b/db/post_migrate/20210413132500_reschedule_artifact_expiry_backfill_again.rb
new file mode 100644
index 00000000000..b4570c8398b
--- /dev/null
+++ b/db/post_migrate/20210413132500_reschedule_artifact_expiry_backfill_again.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+class RescheduleArtifactExpiryBackfillAgain < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ MIGRATION = 'BackfillArtifactExpiryDate'
+ SWITCH_DATE = Date.new(2020, 06, 22).freeze
+
+ disable_ddl_transaction!
+
+ class JobArtifact < ActiveRecord::Base
+ include EachBatch
+
+ self.inheritance_column = :_type_disabled
+ self.table_name = 'ci_job_artifacts'
+
+ scope :without_expiry_date, -> { where(expire_at: nil) }
+ scope :before_switch, -> { where("date(created_at AT TIME ZONE 'UTC') < ?::date", SWITCH_DATE) }
+ end
+
+ def up
+ Gitlab::BackgroundMigration.steal(MIGRATION) do |job|
+ job.delete
+
+ false
+ end
+
+ queue_background_migration_jobs_by_range_at_intervals(
+ JobArtifact.without_expiry_date.before_switch,
+ MIGRATION,
+ 2.minutes,
+ batch_size: 200_000
+ )
+ end
+
+ def down
+ Gitlab::BackgroundMigration.steal(MIGRATION) do |job|
+ job.delete
+
+ false
+ end
+ end
+end
diff --git a/db/post_migrate/20210415074645_index_members_on_user_id_access_level_requested_at_is_null.rb b/db/post_migrate/20210415074645_index_members_on_user_id_access_level_requested_at_is_null.rb
new file mode 100644
index 00000000000..fb379d48b2a
--- /dev/null
+++ b/db/post_migrate/20210415074645_index_members_on_user_id_access_level_requested_at_is_null.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class IndexMembersOnUserIdAccessLevelRequestedAtIsNull < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_members_on_user_id_and_access_level_requested_at_is_null'
+
+ def up
+ add_concurrent_index(:members, [:user_id, :access_level], where: 'requested_at IS NULL', name: INDEX_NAME)
+ end
+
+ def down
+ remove_concurrent_index_by_name(:members, INDEX_NAME)
+ end
+end
diff --git a/db/schema_migrations/20201218194311 b/db/schema_migrations/20201218194311
new file mode 100644
index 00000000000..f9beba74a8c
--- /dev/null
+++ b/db/schema_migrations/20201218194311
@@ -0,0 +1 @@
+7c33bd30af66ebb9a837c72e2ced107f015d4a22c7b6393554a9299bf3907cc0 \ No newline at end of file
diff --git a/db/schema_migrations/20210106061254 b/db/schema_migrations/20210106061254
new file mode 100644
index 00000000000..3780e444cd3
--- /dev/null
+++ b/db/schema_migrations/20210106061254
@@ -0,0 +1 @@
+f4c81be1168dc8dc3eaadbc9b0d46cfd5aefa0b9e4d61fa8276bbc4f59216da8 \ No newline at end of file
diff --git a/db/schema_migrations/20210219211845 b/db/schema_migrations/20210219211845
new file mode 100644
index 00000000000..ad45eee91b5
--- /dev/null
+++ b/db/schema_migrations/20210219211845
@@ -0,0 +1 @@
+b58f2853d7a2d9a821198f69c5913d290404a4961410dd66d256eefc7ecf1026 \ No newline at end of file
diff --git a/db/schema_migrations/20210223230600 b/db/schema_migrations/20210223230600
new file mode 100644
index 00000000000..be6e0621771
--- /dev/null
+++ b/db/schema_migrations/20210223230600
@@ -0,0 +1 @@
+18d64af208338baec9d56a6ac9d7fc35aaeb79d3f8036d3cf5bcc72879827299 \ No newline at end of file
diff --git a/db/schema_migrations/20210224161552 b/db/schema_migrations/20210224161552
new file mode 100644
index 00000000000..1fd37a69dd3
--- /dev/null
+++ b/db/schema_migrations/20210224161552
@@ -0,0 +1 @@
+328e095123eb0b8822342b0d4a338d42265ca8eafbcadcc7e15628e9d02c863d \ No newline at end of file
diff --git a/db/schema_migrations/20210226141517 b/db/schema_migrations/20210226141517
new file mode 100644
index 00000000000..00c57cbe827
--- /dev/null
+++ b/db/schema_migrations/20210226141517
@@ -0,0 +1 @@
+400dd521f5c462afdcb3c556815f840e916df7576a6d6dd301fe5a49a1fe6011 \ No newline at end of file
diff --git a/db/schema_migrations/20210302025305 b/db/schema_migrations/20210302025305
new file mode 100644
index 00000000000..935006818be
--- /dev/null
+++ b/db/schema_migrations/20210302025305
@@ -0,0 +1 @@
+bf47b1c4840c97459f99308d9de04644d18c301659ef5f021088911155d2c624 \ No newline at end of file
diff --git a/db/schema_migrations/20210302150310 b/db/schema_migrations/20210302150310
new file mode 100644
index 00000000000..251fdb0ba8e
--- /dev/null
+++ b/db/schema_migrations/20210302150310
@@ -0,0 +1 @@
+7c562d43801c18af48dc526dc6574aebd11689b62bad864b107580d341ba64a1 \ No newline at end of file
diff --git a/db/schema_migrations/20210305031822 b/db/schema_migrations/20210305031822
new file mode 100644
index 00000000000..8c09ba8d22f
--- /dev/null
+++ b/db/schema_migrations/20210305031822
@@ -0,0 +1 @@
+d91eb442db670adef6d610a2c79259377709e5c98615ba10b85eb998715b3130 \ No newline at end of file
diff --git a/db/schema_migrations/20210305180331 b/db/schema_migrations/20210305180331
new file mode 100644
index 00000000000..a7d9a6d10f3
--- /dev/null
+++ b/db/schema_migrations/20210305180331
@@ -0,0 +1 @@
+cf63d7ffd6bfb93c25c894b26424e9890b43652b4f0bfc259917a4857ff414e2 \ No newline at end of file
diff --git a/db/schema_migrations/20210305182740 b/db/schema_migrations/20210305182740
new file mode 100644
index 00000000000..3e45c9cd1d5
--- /dev/null
+++ b/db/schema_migrations/20210305182740
@@ -0,0 +1 @@
+4c1ae24594ccb85706a4c9836ed1fc8ce47d68863262e90b9109ddc1d83d121b \ No newline at end of file
diff --git a/db/schema_migrations/20210305182855 b/db/schema_migrations/20210305182855
new file mode 100644
index 00000000000..4e42b8d3f99
--- /dev/null
+++ b/db/schema_migrations/20210305182855
@@ -0,0 +1 @@
+8f9957b7f7744e3d72bba1b2bf9bd2c9a06203091bf8f9dcafc69755db25fef0 \ No newline at end of file
diff --git a/db/schema_migrations/20210305183904 b/db/schema_migrations/20210305183904
new file mode 100644
index 00000000000..7e391fc6bc5
--- /dev/null
+++ b/db/schema_migrations/20210305183904
@@ -0,0 +1 @@
+43af4a4200ba87ebb50627d341bb324896cbe0c36896d50dd81a8a9cfb2eb426 \ No newline at end of file
diff --git a/db/schema_migrations/20210308175224 b/db/schema_migrations/20210308175224
new file mode 100644
index 00000000000..c222b9101af
--- /dev/null
+++ b/db/schema_migrations/20210308175224
@@ -0,0 +1 @@
+ad6e0feff16589839714098a69673edcba50af7a62d98cd078585c5d2aada919 \ No newline at end of file
diff --git a/db/schema_migrations/20210308175225 b/db/schema_migrations/20210308175225
new file mode 100644
index 00000000000..7fb92d10f8c
--- /dev/null
+++ b/db/schema_migrations/20210308175225
@@ -0,0 +1 @@
+9263c522f0632f5b4fc0004e1fe9666bc3a44e4f70cf0d21aab5bb229f08ab5c \ No newline at end of file
diff --git a/db/schema_migrations/20210308175226 b/db/schema_migrations/20210308175226
new file mode 100644
index 00000000000..4d126ff2b63
--- /dev/null
+++ b/db/schema_migrations/20210308175226
@@ -0,0 +1 @@
+72491b1834a1256a197e8f49c599b28b41773226db4fe70ce402903674d2f622 \ No newline at end of file
diff --git a/db/schema_migrations/20210308175227 b/db/schema_migrations/20210308175227
new file mode 100644
index 00000000000..66aaf4ca558
--- /dev/null
+++ b/db/schema_migrations/20210308175227
@@ -0,0 +1 @@
+e99b8a6242589992ae8b618cb502d16b67672856cef024c1aafe00a1e64e41b9 \ No newline at end of file
diff --git a/db/schema_migrations/20210309160106 b/db/schema_migrations/20210309160106
new file mode 100644
index 00000000000..d10e9176a71
--- /dev/null
+++ b/db/schema_migrations/20210309160106
@@ -0,0 +1 @@
+968ba7808c969e29f1c3b6b635bff22f986b60e56cb001737ad8aba1825fd945 \ No newline at end of file
diff --git a/db/schema_migrations/20210311022012 b/db/schema_migrations/20210311022012
new file mode 100644
index 00000000000..fbfe6d2cd23
--- /dev/null
+++ b/db/schema_migrations/20210311022012
@@ -0,0 +1 @@
+77d023cc7b635f5b3fc4d8c963183ca15e90f6bb747c145bd8efd1a4e47f65a0 \ No newline at end of file
diff --git a/db/schema_migrations/20210311045138 b/db/schema_migrations/20210311045138
new file mode 100644
index 00000000000..3dcf40429f9
--- /dev/null
+++ b/db/schema_migrations/20210311045138
@@ -0,0 +1 @@
+01bbe2af2bc6bdaa6bf1e2fe10557e3f9f969cc60a348f188fbfe126ea7ea97d \ No newline at end of file
diff --git a/db/schema_migrations/20210311045139 b/db/schema_migrations/20210311045139
new file mode 100644
index 00000000000..71026c1b2af
--- /dev/null
+++ b/db/schema_migrations/20210311045139
@@ -0,0 +1 @@
+2387c8a5516aaf8bcf44c9bad45bfc9844d68d2c03330f67773ce046b21a7a6c \ No newline at end of file
diff --git a/db/schema_migrations/20210311093723 b/db/schema_migrations/20210311093723
new file mode 100644
index 00000000000..9036880454b
--- /dev/null
+++ b/db/schema_migrations/20210311093723
@@ -0,0 +1 @@
+6af1c870e685b5a7fbc31b658959018c313713f0f35ad776f97d0a804f1c0f05 \ No newline at end of file
diff --git a/db/schema_migrations/20210311120152 b/db/schema_migrations/20210311120152
new file mode 100644
index 00000000000..d5e739cdf05
--- /dev/null
+++ b/db/schema_migrations/20210311120152
@@ -0,0 +1 @@
+2ad45eaf6589600d9aadd225b55451d9213a4d858ef2717b7151062f1db225c8 \ No newline at end of file
diff --git a/db/schema_migrations/20210311120153 b/db/schema_migrations/20210311120153
new file mode 100644
index 00000000000..2d8f5b253ef
--- /dev/null
+++ b/db/schema_migrations/20210311120153
@@ -0,0 +1 @@
+3486452547ffa5da3e12837d2f184e356c90fdd1f016f85144a1ba4865825e87 \ No newline at end of file
diff --git a/db/schema_migrations/20210311120154 b/db/schema_migrations/20210311120154
new file mode 100644
index 00000000000..c3007047230
--- /dev/null
+++ b/db/schema_migrations/20210311120154
@@ -0,0 +1 @@
+e169ea265b942f636b2386a432e04d9dfccdc95f04113400d44ce59e81537843 \ No newline at end of file
diff --git a/db/schema_migrations/20210311120155 b/db/schema_migrations/20210311120155
new file mode 100644
index 00000000000..2d17acdc9f4
--- /dev/null
+++ b/db/schema_migrations/20210311120155
@@ -0,0 +1 @@
+b7af086a68c530dd528c4ceaf4bca8d04951c0f234f75a09922aa392bb17a796 \ No newline at end of file
diff --git a/db/schema_migrations/20210311120156 b/db/schema_migrations/20210311120156
new file mode 100644
index 00000000000..b2ac3c856af
--- /dev/null
+++ b/db/schema_migrations/20210311120156
@@ -0,0 +1 @@
+4715c46f5d76c8eb3a206ad3bbcc94a8c13d1d6a66a7824dba400b0aa49c8aa6 \ No newline at end of file
diff --git a/db/schema_migrations/20210312140029 b/db/schema_migrations/20210312140029
new file mode 100644
index 00000000000..7b4d553e244
--- /dev/null
+++ b/db/schema_migrations/20210312140029
@@ -0,0 +1 @@
+5d63a48f4a9327f683eff093d2862a0b88aa4249c94b2de9751ed6172c9b4799 \ No newline at end of file
diff --git a/db/schema_migrations/20210312174321 b/db/schema_migrations/20210312174321
new file mode 100644
index 00000000000..5126ab2675d
--- /dev/null
+++ b/db/schema_migrations/20210312174321
@@ -0,0 +1 @@
+4fa88193ae328f04465980210d9a43ce8cad978c157bda5e8ae9951538209268 \ No newline at end of file
diff --git a/db/schema_migrations/20210312193532 b/db/schema_migrations/20210312193532
new file mode 100644
index 00000000000..af5cd0b163c
--- /dev/null
+++ b/db/schema_migrations/20210312193532
@@ -0,0 +1 @@
+93e92e8eca0765cb8e6e08ec90ce0143d9b31d13e4d61e1b9690dbaed5a1bb63 \ No newline at end of file
diff --git a/db/schema_migrations/20210313045617 b/db/schema_migrations/20210313045617
new file mode 100644
index 00000000000..d422d0ab5d2
--- /dev/null
+++ b/db/schema_migrations/20210313045617
@@ -0,0 +1 @@
+d1e6596e9c6825e29c50523dce60fd3d0b3c067c10e210f74640ba94f7938871 \ No newline at end of file
diff --git a/db/schema_migrations/20210313045845 b/db/schema_migrations/20210313045845
new file mode 100644
index 00000000000..8e2b5605f8b
--- /dev/null
+++ b/db/schema_migrations/20210313045845
@@ -0,0 +1 @@
+bc6302444f7a0a858c821d971fc45a4ececd7b877020f8e920a244866c60b7a2 \ No newline at end of file
diff --git a/db/schema_migrations/20210316094047 b/db/schema_migrations/20210316094047
new file mode 100644
index 00000000000..d5d23d1e2c2
--- /dev/null
+++ b/db/schema_migrations/20210316094047
@@ -0,0 +1 @@
+208df71aa7c2dc447ea8f63ca8cc02344a78bd739c7a0e9457c665bfb831a879 \ No newline at end of file
diff --git a/db/schema_migrations/20210316094323 b/db/schema_migrations/20210316094323
new file mode 100644
index 00000000000..9ad5baba2bd
--- /dev/null
+++ b/db/schema_migrations/20210316094323
@@ -0,0 +1 @@
+e1d83121dd3bd1a608626910a8238546816870f6f36840d96b2b4ac3415af985 \ No newline at end of file
diff --git a/db/schema_migrations/20210316152500 b/db/schema_migrations/20210316152500
new file mode 100644
index 00000000000..fe2f477a9d7
--- /dev/null
+++ b/db/schema_migrations/20210316152500
@@ -0,0 +1 @@
+c2e3f8f6f283d919d99b0acf970f663fef8ca30ef277116401549014fc99ae91 \ No newline at end of file
diff --git a/db/schema_migrations/20210317035357 b/db/schema_migrations/20210317035357
new file mode 100644
index 00000000000..c8cc61fd9fc
--- /dev/null
+++ b/db/schema_migrations/20210317035357
@@ -0,0 +1 @@
+6fb6381e969d062f19b5269b4958306c3bf9a1b7cf06e5b0eb25beb005952d07 \ No newline at end of file
diff --git a/db/schema_migrations/20210317100520 b/db/schema_migrations/20210317100520
new file mode 100644
index 00000000000..f75c67143c2
--- /dev/null
+++ b/db/schema_migrations/20210317100520
@@ -0,0 +1 @@
+54c701451c305ffdead2a9019cf07adae835c5873025caa1f32169f5ae83bf5d \ No newline at end of file
diff --git a/db/schema_migrations/20210317104032 b/db/schema_migrations/20210317104032
new file mode 100644
index 00000000000..616397a0663
--- /dev/null
+++ b/db/schema_migrations/20210317104032
@@ -0,0 +1 @@
+c954e1f2bfdfddc98030bfa0ab28f58a41921cbb5b81e088cde12637e3ae5a8f \ No newline at end of file
diff --git a/db/schema_migrations/20210317104301 b/db/schema_migrations/20210317104301
new file mode 100644
index 00000000000..c0bd8549c6a
--- /dev/null
+++ b/db/schema_migrations/20210317104301
@@ -0,0 +1 @@
+c502a539a50ef1b8f07a8c22426a23cf974ee663fc80a99abe0d658e2a07f52b \ No newline at end of file
diff --git a/db/schema_migrations/20210317105904 b/db/schema_migrations/20210317105904
new file mode 100644
index 00000000000..51dcb6516a0
--- /dev/null
+++ b/db/schema_migrations/20210317105904
@@ -0,0 +1 @@
+64675f43f66d90158147c62699c0d2a48dc74d017c81b30ce3847408d0dad3cb \ No newline at end of file
diff --git a/db/schema_migrations/20210317155207 b/db/schema_migrations/20210317155207
new file mode 100644
index 00000000000..3038d9cb4ab
--- /dev/null
+++ b/db/schema_migrations/20210317155207
@@ -0,0 +1 @@
+b6c30723c2be7dd0afe535272cded230db4954bfe914d5087542be2c27d0ad79 \ No newline at end of file
diff --git a/db/schema_migrations/20210317192943 b/db/schema_migrations/20210317192943
new file mode 100644
index 00000000000..d03b325fa77
--- /dev/null
+++ b/db/schema_migrations/20210317192943
@@ -0,0 +1 @@
+dfb88ea7a213da1e56bef532255f01a284d7b9be9ec8a6b9dd0e95ec04d0f524 \ No newline at end of file
diff --git a/db/schema_migrations/20210318134427 b/db/schema_migrations/20210318134427
new file mode 100644
index 00000000000..3fe6ac49550
--- /dev/null
+++ b/db/schema_migrations/20210318134427
@@ -0,0 +1 @@
+07f4619577b05ea6a62045c81de7d225841bea28c0dd8f2cdb2011c902fd3e5a \ No newline at end of file
diff --git a/db/schema_migrations/20210322063407 b/db/schema_migrations/20210322063407
new file mode 100644
index 00000000000..bea9c3f2ba0
--- /dev/null
+++ b/db/schema_migrations/20210322063407
@@ -0,0 +1 @@
+d520fe71ca271c135b9684dc7a03ede27832659459f7476787798d11460c4736 \ No newline at end of file
diff --git a/db/schema_migrations/20210322063450 b/db/schema_migrations/20210322063450
new file mode 100644
index 00000000000..7c4a1ba65bf
--- /dev/null
+++ b/db/schema_migrations/20210322063450
@@ -0,0 +1 @@
+fdf858a31e27fb2ce4071642b6e2d76082db95f6ebbec63ce627f92ddf7edfcf \ No newline at end of file
diff --git a/db/schema_migrations/20210322115438 b/db/schema_migrations/20210322115438
new file mode 100644
index 00000000000..94db65a9a8a
--- /dev/null
+++ b/db/schema_migrations/20210322115438
@@ -0,0 +1 @@
+e177c2cc0b59eea54de10417445b391cea7dd308547077aea34054fac22b9e40 \ No newline at end of file
diff --git a/db/schema_migrations/20210322182751 b/db/schema_migrations/20210322182751
new file mode 100644
index 00000000000..615f3c7a5de
--- /dev/null
+++ b/db/schema_migrations/20210322182751
@@ -0,0 +1 @@
+79ad2de15faef8edb8752c2a9c89f1739a805af999c86db6e73482a613c4f9d1 \ No newline at end of file
diff --git a/db/schema_migrations/20210323064751 b/db/schema_migrations/20210323064751
new file mode 100644
index 00000000000..3ce610ecb0d
--- /dev/null
+++ b/db/schema_migrations/20210323064751
@@ -0,0 +1 @@
+4ef75890cf2c30954e0d1ff04c75b58cb910315ea1ed345e351edd035b681cc6 \ No newline at end of file
diff --git a/db/schema_migrations/20210323155010 b/db/schema_migrations/20210323155010
new file mode 100644
index 00000000000..23225216b5a
--- /dev/null
+++ b/db/schema_migrations/20210323155010
@@ -0,0 +1 @@
+1143241b1a8d1554c86a8d72d43276fa15c0193e510f47d5d7c64769860c60e3 \ No newline at end of file
diff --git a/db/schema_migrations/20210323182846 b/db/schema_migrations/20210323182846
new file mode 100644
index 00000000000..aa4ab4ba7fd
--- /dev/null
+++ b/db/schema_migrations/20210323182846
@@ -0,0 +1 @@
+9ee014f462ec0d2affaab146243fb991298e9b30bd57b741fba0440b1676de03 \ No newline at end of file
diff --git a/db/schema_migrations/20210324112439 b/db/schema_migrations/20210324112439
new file mode 100644
index 00000000000..e0cf51c3a54
--- /dev/null
+++ b/db/schema_migrations/20210324112439
@@ -0,0 +1 @@
+7e6dd4e247ad6b610ebebcf59b4212fd0d2258c8fff008d525b891da872613e5 \ No newline at end of file
diff --git a/db/schema_migrations/20210324131727 b/db/schema_migrations/20210324131727
new file mode 100644
index 00000000000..85ea4aad1ee
--- /dev/null
+++ b/db/schema_migrations/20210324131727
@@ -0,0 +1 @@
+e0fab4d950a5be032f823160b1805c44262f9e3d233dc76cd108483a5b92896b \ No newline at end of file
diff --git a/db/schema_migrations/20210325092215 b/db/schema_migrations/20210325092215
new file mode 100644
index 00000000000..0693c47994b
--- /dev/null
+++ b/db/schema_migrations/20210325092215
@@ -0,0 +1 @@
+ea819fd401c5566986fd495ed3b8aa0d296d6c9e3fedf2a10f34cb7fbaeedb20 \ No newline at end of file
diff --git a/db/schema_migrations/20210325113129 b/db/schema_migrations/20210325113129
new file mode 100644
index 00000000000..86c212db71b
--- /dev/null
+++ b/db/schema_migrations/20210325113129
@@ -0,0 +1 @@
+27fcdd54a21d554e44df621e409b81fe248e00851c856d315f4f64b463c7a5b7 \ No newline at end of file
diff --git a/db/schema_migrations/20210325150837 b/db/schema_migrations/20210325150837
new file mode 100644
index 00000000000..716462ad187
--- /dev/null
+++ b/db/schema_migrations/20210325150837
@@ -0,0 +1 @@
+6022464130d7a5697f52b9238837c6a6d3363fd349cbcb14052ff52de6ea2e59 \ No newline at end of file
diff --git a/db/schema_migrations/20210325151758 b/db/schema_migrations/20210325151758
new file mode 100644
index 00000000000..a3d5f1b1b0a
--- /dev/null
+++ b/db/schema_migrations/20210325151758
@@ -0,0 +1 @@
+de55a114773961e6cae9ebae36ac93e60676555fe4c2973527511bb3a2eae69d \ No newline at end of file
diff --git a/db/schema_migrations/20210325152011 b/db/schema_migrations/20210325152011
new file mode 100644
index 00000000000..f685bcd7d9d
--- /dev/null
+++ b/db/schema_migrations/20210325152011
@@ -0,0 +1 @@
+379fdb3c52e55b51ebdb4a3b1e67c12f19b15e97cce22eed351e33953e389c85 \ No newline at end of file
diff --git a/db/schema_migrations/20210326035553 b/db/schema_migrations/20210326035553
new file mode 100644
index 00000000000..da34de0fafe
--- /dev/null
+++ b/db/schema_migrations/20210326035553
@@ -0,0 +1 @@
+018381c15d859a777afb2b3402ca4425ce52ab35dcd4d1e930b3a9928b2a2019 \ No newline at end of file
diff --git a/db/schema_migrations/20210326121537 b/db/schema_migrations/20210326121537
new file mode 100644
index 00000000000..ece53e34413
--- /dev/null
+++ b/db/schema_migrations/20210326121537
@@ -0,0 +1 @@
+ac8063901a0de1f2e6d4fd5336f54bfca0bafa9d081066124ec9d2acf47c9b47 \ No newline at end of file
diff --git a/db/schema_migrations/20210326190903 b/db/schema_migrations/20210326190903
new file mode 100644
index 00000000000..fb98949b3ca
--- /dev/null
+++ b/db/schema_migrations/20210326190903
@@ -0,0 +1 @@
+d6181f8806592106305366f5e8ef508286ed447c1fce0de26f242de736b21809 \ No newline at end of file
diff --git a/db/schema_migrations/20210328214434 b/db/schema_migrations/20210328214434
new file mode 100644
index 00000000000..a1d74aaa772
--- /dev/null
+++ b/db/schema_migrations/20210328214434
@@ -0,0 +1 @@
+134fba876b69fd48697975066a734becf337f53baddd986a5c708ea6dd7cbd75 \ No newline at end of file
diff --git a/db/schema_migrations/20210329095548 b/db/schema_migrations/20210329095548
new file mode 100644
index 00000000000..a3f65e8e446
--- /dev/null
+++ b/db/schema_migrations/20210329095548
@@ -0,0 +1 @@
+412d0cedef5c933c7de3a70ca2365fe0cfaa4087429ca418854092b6c37904f1 \ No newline at end of file
diff --git a/db/schema_migrations/20210329102724 b/db/schema_migrations/20210329102724
new file mode 100644
index 00000000000..b2fdccf2bb8
--- /dev/null
+++ b/db/schema_migrations/20210329102724
@@ -0,0 +1 @@
+b40c702ea6b2120da6fe11b213064a7a124dbc86bfb2d6785bfd2274c44f1e22 \ No newline at end of file
diff --git a/db/schema_migrations/20210329191850 b/db/schema_migrations/20210329191850
new file mode 100644
index 00000000000..9b436c7934d
--- /dev/null
+++ b/db/schema_migrations/20210329191850
@@ -0,0 +1 @@
+2a49d9f33f7dbcbef3cb5d5537db052c527d5268b37496435fe9918ddbb73095 \ No newline at end of file
diff --git a/db/schema_migrations/20210329192716 b/db/schema_migrations/20210329192716
new file mode 100644
index 00000000000..8767c215335
--- /dev/null
+++ b/db/schema_migrations/20210329192716
@@ -0,0 +1 @@
+d0f5341d76183882b68583bc012154566e99050c24a90c9b895d6863ad8f3273 \ No newline at end of file
diff --git a/db/schema_migrations/20210330015805 b/db/schema_migrations/20210330015805
new file mode 100644
index 00000000000..14102a0a2d1
--- /dev/null
+++ b/db/schema_migrations/20210330015805
@@ -0,0 +1 @@
+a435a211d7e8b9a972323769299fc6e537fdeaa127f8db6ab53031901a51ec36 \ No newline at end of file
diff --git a/db/schema_migrations/20210330091751 b/db/schema_migrations/20210330091751
new file mode 100644
index 00000000000..0536252e980
--- /dev/null
+++ b/db/schema_migrations/20210330091751
@@ -0,0 +1 @@
+3a195b9671846409cf6665b13caad9713541d9cdd95c9f246c22b7db225ab02c \ No newline at end of file
diff --git a/db/schema_migrations/20210330130420 b/db/schema_migrations/20210330130420
new file mode 100644
index 00000000000..331738f7f0e
--- /dev/null
+++ b/db/schema_migrations/20210330130420
@@ -0,0 +1 @@
+de04d010fabd62d9dc995938b69ba178caa5e0a8476af5a78ba68c86698633d6 \ No newline at end of file
diff --git a/db/schema_migrations/20210331105335 b/db/schema_migrations/20210331105335
new file mode 100644
index 00000000000..5d9b8d3fea8
--- /dev/null
+++ b/db/schema_migrations/20210331105335
@@ -0,0 +1 @@
+2127018617082dbad341bcee68948afe111286fdc2ea9ce8b3d00d356f3c61e0 \ No newline at end of file
diff --git a/db/schema_migrations/20210331125111 b/db/schema_migrations/20210331125111
new file mode 100644
index 00000000000..7e6429b4289
--- /dev/null
+++ b/db/schema_migrations/20210331125111
@@ -0,0 +1 @@
+8c7343dafaa036115e85f30d2d096d14279c80de99f49b969039ed3afa5acdf6 \ No newline at end of file
diff --git a/db/schema_migrations/20210331145548 b/db/schema_migrations/20210331145548
new file mode 100644
index 00000000000..c903c6f35c8
--- /dev/null
+++ b/db/schema_migrations/20210331145548
@@ -0,0 +1 @@
+f27446d1950acaf45f623b2cec7733cd7ba4b82eefddfa2203acbbaf77d59e18 \ No newline at end of file
diff --git a/db/schema_migrations/20210331180118 b/db/schema_migrations/20210331180118
new file mode 100644
index 00000000000..45e62e7154d
--- /dev/null
+++ b/db/schema_migrations/20210331180118
@@ -0,0 +1 @@
+d8a17ce963801559292265dd0a997d8dbc69d2fa8b8840622490f878bf1eaa6a \ No newline at end of file
diff --git a/db/schema_migrations/20210401131948 b/db/schema_migrations/20210401131948
new file mode 100644
index 00000000000..8b9950cd32c
--- /dev/null
+++ b/db/schema_migrations/20210401131948
@@ -0,0 +1 @@
+cbc1cd66cdbe08ac9edee14da255343acdcd8adaea6748ee82980462ae4bb88f \ No newline at end of file
diff --git a/db/schema_migrations/20210401134157 b/db/schema_migrations/20210401134157
new file mode 100644
index 00000000000..864d11258b4
--- /dev/null
+++ b/db/schema_migrations/20210401134157
@@ -0,0 +1 @@
+02f8ed673f87cb2528022d8352a1551b3c7250986d6dc387c1bbdfbc71123272 \ No newline at end of file
diff --git a/db/schema_migrations/20210401134455 b/db/schema_migrations/20210401134455
new file mode 100644
index 00000000000..20a348695e7
--- /dev/null
+++ b/db/schema_migrations/20210401134455
@@ -0,0 +1 @@
+3420d83bf8a1f44e69960849efa25525883f17a2776ae3ce28db855cd550ca8e \ No newline at end of file
diff --git a/db/schema_migrations/20210401175134 b/db/schema_migrations/20210401175134
new file mode 100644
index 00000000000..8b93c13bfdc
--- /dev/null
+++ b/db/schema_migrations/20210401175134
@@ -0,0 +1 @@
+07d527134f776dbed2199f1717c34b3a6c41caadcaa3c50e6e5866f2cfad31b0 \ No newline at end of file
diff --git a/db/schema_migrations/20210401192808 b/db/schema_migrations/20210401192808
new file mode 100644
index 00000000000..fd005c98732
--- /dev/null
+++ b/db/schema_migrations/20210401192808
@@ -0,0 +1 @@
+1cd4799ed7df41bfb9d96a7d18faaa9cbb2dc03f2a804c2bc3c1a6bba15d6d3d \ No newline at end of file
diff --git a/db/schema_migrations/20210402005225 b/db/schema_migrations/20210402005225
new file mode 100644
index 00000000000..767b1307ca7
--- /dev/null
+++ b/db/schema_migrations/20210402005225
@@ -0,0 +1 @@
+6c44623655732e9c2916f7a71d51f53e819a216b8936d20d28d6acf37cc94fdf \ No newline at end of file
diff --git a/db/schema_migrations/20210406063442 b/db/schema_migrations/20210406063442
new file mode 100644
index 00000000000..75b07b54158
--- /dev/null
+++ b/db/schema_migrations/20210406063442
@@ -0,0 +1 @@
+d29f002f88440a10674b251791fa027cb0ae1c1b0c4fd776a2078e3c94160f17 \ No newline at end of file
diff --git a/db/schema_migrations/20210406140057 b/db/schema_migrations/20210406140057
new file mode 100644
index 00000000000..924de9f2ea3
--- /dev/null
+++ b/db/schema_migrations/20210406140057
@@ -0,0 +1 @@
+b984ddc5765b6f906a3a2046005e8ad45bab360b095eee7e68c44a8ca5534679 \ No newline at end of file
diff --git a/db/schema_migrations/20210406144743 b/db/schema_migrations/20210406144743
new file mode 100644
index 00000000000..2709fa5b1c4
--- /dev/null
+++ b/db/schema_migrations/20210406144743
@@ -0,0 +1 @@
+64011f8d0bcb293bcd36125a52897901421dd18d96129f1514ea360b558f4294 \ No newline at end of file
diff --git a/db/schema_migrations/20210407002511 b/db/schema_migrations/20210407002511
new file mode 100644
index 00000000000..60a45fd29ec
--- /dev/null
+++ b/db/schema_migrations/20210407002511
@@ -0,0 +1 @@
+174d2c4dc57847060cb19405cc08fffd038c7bfbd4ad749e3e1eccf0e281230b \ No newline at end of file
diff --git a/db/schema_migrations/20210407150240 b/db/schema_migrations/20210407150240
new file mode 100644
index 00000000000..cfc187d5dd7
--- /dev/null
+++ b/db/schema_migrations/20210407150240
@@ -0,0 +1 @@
+b5f83e3870dc7c70fbde6071725aa2acb3e99f7c2ed050633c34ed35e696ba1e \ No newline at end of file
diff --git a/db/schema_migrations/20210409084242 b/db/schema_migrations/20210409084242
new file mode 100644
index 00000000000..2d932018355
--- /dev/null
+++ b/db/schema_migrations/20210409084242
@@ -0,0 +1 @@
+6bd35117ca922fc0d9cb8cbd9b0e6d5d9216457182d5679e705c1f03eef05921 \ No newline at end of file
diff --git a/db/schema_migrations/20210409185501 b/db/schema_migrations/20210409185501
new file mode 100644
index 00000000000..9aa098eb495
--- /dev/null
+++ b/db/schema_migrations/20210409185501
@@ -0,0 +1 @@
+3655b51b9975a73f3b141f53a0e89aba5b90a030abb8f1dfec3d3bcbb08aa1ec \ No newline at end of file
diff --git a/db/schema_migrations/20210409185531 b/db/schema_migrations/20210409185531
new file mode 100644
index 00000000000..c399a2e9258
--- /dev/null
+++ b/db/schema_migrations/20210409185531
@@ -0,0 +1 @@
+1ecd19849ca362a360719c46893f793ffc52b08bd85603305e3fd4d43f3b7ef2 \ No newline at end of file
diff --git a/db/schema_migrations/20210411212813 b/db/schema_migrations/20210411212813
new file mode 100644
index 00000000000..835191bf73c
--- /dev/null
+++ b/db/schema_migrations/20210411212813
@@ -0,0 +1 @@
+47c1d8d699a18f4c52178dd5de6434f9997166e05acd70bdc40ff85a1572a797 \ No newline at end of file
diff --git a/db/schema_migrations/20210412132736 b/db/schema_migrations/20210412132736
new file mode 100644
index 00000000000..23cadad52aa
--- /dev/null
+++ b/db/schema_migrations/20210412132736
@@ -0,0 +1 @@
+fa3287ed845c2fa24c3c65825362b4393433e273a3e94ed454ef5cc3b373d8a3 \ No newline at end of file
diff --git a/db/schema_migrations/20210412132824 b/db/schema_migrations/20210412132824
new file mode 100644
index 00000000000..3c5d9b79115
--- /dev/null
+++ b/db/schema_migrations/20210412132824
@@ -0,0 +1 @@
+cb02cb38d6f050ac49ac2c963307da4543590cc5ebd50fbc2225c519f1c96849 \ No newline at end of file
diff --git a/db/schema_migrations/20210412142223 b/db/schema_migrations/20210412142223
new file mode 100644
index 00000000000..9ddb9b7f1e4
--- /dev/null
+++ b/db/schema_migrations/20210412142223
@@ -0,0 +1 @@
+4a1435a56b8e5cddd83b844f84374bca91810bbfc5f44faf2a53fd41f93be69c \ No newline at end of file
diff --git a/db/schema_migrations/20210413092922 b/db/schema_migrations/20210413092922
new file mode 100644
index 00000000000..08d7beaec7f
--- /dev/null
+++ b/db/schema_migrations/20210413092922
@@ -0,0 +1 @@
+2da634fa920e3989d9b8e53ddc1ba005e5bc0f4701426e3841d90a42bd2e908f \ No newline at end of file
diff --git a/db/schema_migrations/20210413121101 b/db/schema_migrations/20210413121101
new file mode 100644
index 00000000000..0eef2adc713
--- /dev/null
+++ b/db/schema_migrations/20210413121101
@@ -0,0 +1 @@
+fe98a617ac8bacf270425c1e9b9b60aee1c3c0e47d5c915fe122cb99c1c1c822 \ No newline at end of file
diff --git a/db/schema_migrations/20210413123832 b/db/schema_migrations/20210413123832
new file mode 100644
index 00000000000..4a8af15f336
--- /dev/null
+++ b/db/schema_migrations/20210413123832
@@ -0,0 +1 @@
+d166250305c2939bea8cc1970faf50d86776d32270a80a429cce668a97280aad \ No newline at end of file
diff --git a/db/schema_migrations/20210413130011 b/db/schema_migrations/20210413130011
new file mode 100644
index 00000000000..c67e9705e7a
--- /dev/null
+++ b/db/schema_migrations/20210413130011
@@ -0,0 +1 @@
+943466b272406a95c478337de84f72388dae88a8cf88f3b389e3ade9d4ecd63d \ No newline at end of file
diff --git a/db/schema_migrations/20210413132500 b/db/schema_migrations/20210413132500
new file mode 100644
index 00000000000..662c7e33ef0
--- /dev/null
+++ b/db/schema_migrations/20210413132500
@@ -0,0 +1 @@
+407806cc168ef9859c9a4f1bd4db7a56aee01367e784ea0767889863b9ace35d \ No newline at end of file
diff --git a/db/schema_migrations/20210414095944 b/db/schema_migrations/20210414095944
new file mode 100644
index 00000000000..67abfa19822
--- /dev/null
+++ b/db/schema_migrations/20210414095944
@@ -0,0 +1 @@
+843d9eabf8b67fe10d9eb453e887032d5b88b8594ae666bc6c6ac81e20e1ab53 \ No newline at end of file
diff --git a/db/schema_migrations/20210414131600 b/db/schema_migrations/20210414131600
new file mode 100644
index 00000000000..2ed1c9856ae
--- /dev/null
+++ b/db/schema_migrations/20210414131600
@@ -0,0 +1 @@
+199c8a540cb4a0dd30a86a81f993798afb3e7384f1176b71a780d5950a52eb5f \ No newline at end of file
diff --git a/db/schema_migrations/20210415074645 b/db/schema_migrations/20210415074645
new file mode 100644
index 00000000000..d996f095dce
--- /dev/null
+++ b/db/schema_migrations/20210415074645
@@ -0,0 +1 @@
+393a7f1029f05f73c26e031c8980734e13c304846c3457d581c006dc2566d94d \ No newline at end of file
diff --git a/db/schema_migrations/20210415142700 b/db/schema_migrations/20210415142700
new file mode 100644
index 00000000000..22b10173911
--- /dev/null
+++ b/db/schema_migrations/20210415142700
@@ -0,0 +1 @@
+2d6d62b036c937136dfbb11becfd3c2c705f0db1e3a38fdcefe676106168ab29 \ No newline at end of file
diff --git a/db/schema_migrations/20210415144538 b/db/schema_migrations/20210415144538
new file mode 100644
index 00000000000..6b8e0d78b65
--- /dev/null
+++ b/db/schema_migrations/20210415144538
@@ -0,0 +1 @@
+d237690af576fb5a85d984416dcca1936a140a10a9b6c968d3ff57419568fb8f \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 8936087bd2b..db463645810 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -97,58 +97,23 @@ $$;
COMMENT ON FUNCTION table_sync_function_29bc99d6db() IS 'Partitioning migration: table sync for web_hook_logs table';
-CREATE FUNCTION table_sync_function_2be879775d() RETURNS trigger
+CREATE FUNCTION trigger_07c94931164e() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
-IF (TG_OP = 'DELETE') THEN
- DELETE FROM audit_events_archived where id = OLD.id;
-ELSIF (TG_OP = 'UPDATE') THEN
- UPDATE audit_events_archived
- SET author_id = NEW.author_id,
- entity_id = NEW.entity_id,
- entity_type = NEW.entity_type,
- details = NEW.details,
- created_at = NEW.created_at,
- ip_address = NEW.ip_address,
- author_name = NEW.author_name,
- entity_path = NEW.entity_path,
- target_details = NEW.target_details,
- target_type = NEW.target_type,
- target_id = NEW.target_id
- WHERE audit_events_archived.id = NEW.id;
-ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO audit_events_archived (id,
- author_id,
- entity_id,
- entity_type,
- details,
- created_at,
- ip_address,
- author_name,
- entity_path,
- target_details,
- target_type,
- target_id)
- VALUES (NEW.id,
- NEW.author_id,
- NEW.entity_id,
- NEW.entity_type,
- NEW.details,
- NEW.created_at,
- NEW.ip_address,
- NEW.author_name,
- NEW.entity_path,
- NEW.target_details,
- NEW.target_type,
- NEW.target_id);
-END IF;
-RETURN NULL;
-
-END
+ NEW."event_id_convert_to_bigint" := NEW."event_id";
+ RETURN NEW;
+END;
$$;
-COMMENT ON FUNCTION table_sync_function_2be879775d() IS 'Partitioning migration: table sync for audit_events table';
+CREATE FUNCTION trigger_69523443cc10() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ NEW."id_convert_to_bigint" := NEW."id";
+ RETURN NEW;
+END;
+$$;
CREATE TABLE audit_events (
id bigint NOT NULL,
@@ -9473,7 +9438,15 @@ CREATE TABLE application_settings (
kroki_formats jsonb DEFAULT '{}'::jsonb NOT NULL,
in_product_marketing_emails_enabled boolean DEFAULT true NOT NULL,
asset_proxy_whitelist text,
+ admin_mode boolean DEFAULT false NOT NULL,
+ delayed_project_removal boolean DEFAULT false NOT NULL,
+ lock_delayed_project_removal boolean DEFAULT false NOT NULL,
+ external_pipeline_validation_service_timeout integer,
+ encrypted_external_pipeline_validation_service_token text,
+ encrypted_external_pipeline_validation_service_token_iv text,
+ external_pipeline_validation_service_url text,
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 check_17d9558205 CHECK ((char_length((kroki_url)::text) <= 1024)),
CONSTRAINT check_2dba05b802 CHECK ((char_length(gitpod_url) <= 255)),
@@ -9723,25 +9696,6 @@ CREATE SEQUENCE atlassian_identities_user_id_seq
ALTER SEQUENCE atlassian_identities_user_id_seq OWNED BY atlassian_identities.user_id;
-CREATE TABLE audit_events_archived (
- id integer NOT NULL,
- author_id integer NOT NULL,
- entity_id integer NOT NULL,
- entity_type character varying NOT NULL,
- details text,
- created_at timestamp without time zone,
- ip_address inet,
- author_name text,
- entity_path text,
- target_details text,
- target_type text,
- target_id bigint,
- CONSTRAINT check_492aaa021d CHECK ((char_length(entity_path) <= 5500)),
- CONSTRAINT check_82294106dd CHECK ((char_length(target_type) <= 255)),
- CONSTRAINT check_83ff8406e2 CHECK ((char_length(author_name) <= 255)),
- CONSTRAINT check_d493ec90b5 CHECK ((char_length(target_details) <= 5500))
-);
-
CREATE SEQUENCE audit_events_id_seq
START WITH 1
INCREMENT BY 1
@@ -9853,7 +9807,8 @@ CREATE TABLE batched_background_migration_jobs (
batch_size integer NOT NULL,
sub_batch_size integer NOT NULL,
status smallint DEFAULT 0 NOT NULL,
- attempts smallint DEFAULT 0 NOT NULL
+ attempts smallint DEFAULT 0 NOT NULL,
+ metrics jsonb DEFAULT '{}'::jsonb NOT NULL
);
CREATE SEQUENCE batched_background_migration_jobs_id_seq
@@ -9880,6 +9835,7 @@ CREATE TABLE batched_background_migrations (
table_name text NOT NULL,
column_name text NOT NULL,
job_arguments jsonb DEFAULT '"[]"'::jsonb NOT NULL,
+ total_tuple_count bigint,
CONSTRAINT check_5bb0382d6f CHECK ((char_length(column_name) <= 63)),
CONSTRAINT check_6b6a06254a CHECK ((char_length(table_name) <= 63)),
CONSTRAINT check_batch_size_in_range CHECK ((batch_size >= sub_batch_size)),
@@ -10671,8 +10627,16 @@ CREATE TABLE ci_pipeline_artifacts (
file_format smallint NOT NULL,
file text,
expire_at timestamp with time zone,
+ verification_started_at timestamp with time zone,
+ verification_retry_at timestamp with time zone,
+ verified_at timestamp with time zone,
+ verification_state smallint DEFAULT 0 NOT NULL,
+ verification_retry_count smallint,
+ verification_checksum bytea,
+ verification_failure text,
CONSTRAINT check_191b5850ec CHECK ((char_length(file) <= 255)),
- CONSTRAINT check_abeeb71caf CHECK ((file IS NOT NULL))
+ CONSTRAINT check_abeeb71caf CHECK ((file IS NOT NULL)),
+ CONSTRAINT ci_pipeline_artifacts_verification_failure_text_limit CHECK ((char_length(verification_failure) <= 255))
);
CREATE SEQUENCE ci_pipeline_artifacts_id_seq
@@ -11129,6 +11093,42 @@ CREATE SEQUENCE ci_triggers_id_seq
ALTER SEQUENCE ci_triggers_id_seq OWNED BY ci_triggers.id;
+CREATE TABLE ci_unit_test_failures (
+ id bigint NOT NULL,
+ failed_at timestamp with time zone NOT NULL,
+ unit_test_id bigint NOT NULL,
+ build_id bigint NOT NULL
+);
+
+CREATE SEQUENCE ci_unit_test_failures_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE ci_unit_test_failures_id_seq OWNED BY ci_unit_test_failures.id;
+
+CREATE TABLE ci_unit_tests (
+ id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ key_hash text NOT NULL,
+ name text NOT NULL,
+ suite_name text NOT NULL,
+ CONSTRAINT check_248fae1a3b CHECK ((char_length(name) <= 255)),
+ CONSTRAINT check_b288215ffe CHECK ((char_length(key_hash) <= 64)),
+ CONSTRAINT check_c2d57b3c49 CHECK ((char_length(suite_name) <= 255))
+);
+
+CREATE SEQUENCE ci_unit_tests_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE ci_unit_tests_id_seq OWNED BY ci_unit_tests.id;
+
CREATE TABLE ci_variables (
id integer NOT NULL,
key character varying NOT NULL,
@@ -11162,6 +11162,7 @@ CREATE TABLE cluster_agent_tokens (
description text,
name text,
last_used_at timestamp with time zone,
+ CONSTRAINT check_0fb634d04d CHECK ((name IS NOT NULL)),
CONSTRAINT check_2b79dbb315 CHECK ((char_length(name) <= 255)),
CONSTRAINT check_4e4ec5070a CHECK ((char_length(description) <= 1024)),
CONSTRAINT check_c60daed227 CHECK ((char_length(token_encrypted) <= 255))
@@ -11576,6 +11577,13 @@ CREATE SEQUENCE clusters_id_seq
ALTER SEQUENCE clusters_id_seq OWNED BY clusters.id;
+CREATE TABLE clusters_integration_prometheus (
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ cluster_id bigint NOT NULL,
+ enabled boolean DEFAULT false NOT NULL
+);
+
CREATE TABLE clusters_kubernetes_namespaces (
id bigint NOT NULL,
cluster_id integer NOT NULL,
@@ -11785,6 +11793,13 @@ CREATE SEQUENCE dast_profiles_id_seq
ALTER SEQUENCE dast_profiles_id_seq OWNED BY dast_profiles.id;
+CREATE TABLE dast_profiles_pipelines (
+ dast_profile_id bigint NOT NULL,
+ ci_pipeline_id bigint NOT NULL
+);
+
+COMMENT ON TABLE dast_profiles_pipelines IS '{"owner":"group::dynamic analysis","description":"Join table between DAST Profiles and CI Pipelines"}';
+
CREATE TABLE dast_scanner_profiles (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -11808,6 +11823,31 @@ CREATE SEQUENCE dast_scanner_profiles_id_seq
ALTER SEQUENCE dast_scanner_profiles_id_seq OWNED BY dast_scanner_profiles.id;
+CREATE TABLE dast_site_profile_secret_variables (
+ id bigint NOT NULL,
+ dast_site_profile_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ variable_type smallint DEFAULT 1 NOT NULL,
+ key text NOT NULL,
+ encrypted_value bytea NOT NULL,
+ encrypted_value_iv bytea NOT NULL,
+ CONSTRAINT check_236213f179 CHECK ((length(encrypted_value) <= 13352)),
+ CONSTRAINT check_8cbef204b2 CHECK ((char_length(key) <= 255)),
+ CONSTRAINT check_b49080abbf CHECK ((length(encrypted_value_iv) <= 17))
+);
+
+COMMENT ON TABLE dast_site_profile_secret_variables IS '{"owner":"group::dynamic analysis","description":"Secret variables used in DAST on-demand scans"}';
+
+CREATE SEQUENCE dast_site_profile_secret_variables_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE dast_site_profile_secret_variables_id_seq OWNED BY dast_site_profile_secret_variables.id;
+
CREATE TABLE dast_site_profiles (
id bigint NOT NULL,
project_id bigint NOT NULL,
@@ -11815,7 +11855,18 @@ CREATE TABLE dast_site_profiles (
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
name text NOT NULL,
- CONSTRAINT check_6cfab17b48 CHECK ((char_length(name) <= 255))
+ excluded_urls text[] DEFAULT '{}'::text[] NOT NULL,
+ auth_enabled boolean DEFAULT false NOT NULL,
+ auth_url text,
+ auth_username_field text,
+ auth_password_field text,
+ auth_username text,
+ target_type smallint DEFAULT 0 NOT NULL,
+ CONSTRAINT check_5203110fee CHECK ((char_length(auth_username_field) <= 255)),
+ CONSTRAINT check_6cfab17b48 CHECK ((char_length(name) <= 255)),
+ CONSTRAINT check_c329dffdba CHECK ((char_length(auth_password_field) <= 255)),
+ CONSTRAINT check_d446f7047b CHECK ((char_length(auth_url) <= 1024)),
+ CONSTRAINT check_f22f18002a CHECK ((char_length(auth_username) <= 255))
);
CREATE SEQUENCE dast_site_profiles_id_seq
@@ -12198,6 +12249,25 @@ CREATE SEQUENCE draft_notes_id_seq
ALTER SEQUENCE draft_notes_id_seq OWNED BY draft_notes.id;
+CREATE TABLE elastic_index_settings (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ number_of_replicas smallint DEFAULT 1 NOT NULL,
+ number_of_shards smallint DEFAULT 5 NOT NULL,
+ alias_name text NOT NULL,
+ CONSTRAINT check_c30005c325 CHECK ((char_length(alias_name) <= 255))
+);
+
+CREATE SEQUENCE elastic_index_settings_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE elastic_index_settings_id_seq OWNED BY elastic_index_settings.id;
+
CREATE TABLE elastic_reindexing_subtasks (
id bigint NOT NULL,
elastic_reindexing_task_id bigint NOT NULL,
@@ -12415,6 +12485,7 @@ CREATE TABLE events (
target_type character varying,
group_id bigint,
fingerprint bytea,
+ id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
CONSTRAINT check_97e06e05ad CHECK ((octet_length(fingerprint) <= 128))
);
@@ -13026,7 +13097,8 @@ CREATE TABLE gitlab_subscription_histories (
gitlab_subscription_id bigint NOT NULL,
created_at timestamp with time zone,
trial_starts_on date,
- auto_renew boolean
+ auto_renew boolean,
+ trial_extension_type smallint
);
CREATE SEQUENCE gitlab_subscription_histories_id_seq
@@ -13053,7 +13125,9 @@ CREATE TABLE gitlab_subscriptions (
trial_starts_on date,
auto_renew boolean,
seats_in_use integer DEFAULT 0 NOT NULL,
- seats_owed integer DEFAULT 0 NOT NULL
+ seats_owed integer DEFAULT 0 NOT NULL,
+ trial_extension_type smallint,
+ CONSTRAINT check_77fea3f0e7 CHECK ((namespace_id IS NOT NULL))
);
CREATE SEQUENCE gitlab_subscriptions_id_seq
@@ -13386,6 +13460,25 @@ CREATE SEQUENCE import_failures_id_seq
ALTER SEQUENCE import_failures_id_seq OWNED BY import_failures.id;
+CREATE TABLE in_product_marketing_emails (
+ id bigint NOT NULL,
+ user_id bigint NOT NULL,
+ cta_clicked_at timestamp with time zone,
+ track smallint NOT NULL,
+ series smallint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE in_product_marketing_emails_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE in_product_marketing_emails_id_seq OWNED BY in_product_marketing_emails.id;
+
CREATE TABLE incident_management_oncall_participants (
id bigint NOT NULL,
oncall_rotation_id bigint NOT NULL,
@@ -13777,7 +13870,9 @@ CREATE TABLE jira_connect_installations (
client_key character varying,
encrypted_shared_secret character varying,
encrypted_shared_secret_iv character varying,
- base_url character varying
+ base_url character varying,
+ instance_url text,
+ CONSTRAINT check_4c6abed669 CHECK ((char_length(instance_url) <= 255))
);
CREATE SEQUENCE jira_connect_installations_id_seq
@@ -13863,6 +13958,7 @@ CREATE TABLE jira_tracker_data (
encrypted_proxy_username_iv text,
encrypted_proxy_password text,
encrypted_proxy_password_iv text,
+ jira_issue_transition_automatic boolean DEFAULT false NOT NULL,
CONSTRAINT check_0bf84b76e9 CHECK ((char_length(vulnerabilities_issuetype) <= 255)),
CONSTRAINT check_214cf6a48b CHECK ((char_length(project_key) <= 255))
);
@@ -13888,7 +13984,9 @@ CREATE TABLE keys (
public boolean DEFAULT false NOT NULL,
last_used_at timestamp without time zone,
fingerprint_sha256 bytea,
- expires_at timestamp with time zone
+ expires_at timestamp with time zone,
+ expiry_notification_delivered_at timestamp with time zone,
+ before_expiry_notification_delivered_at timestamp with time zone
);
CREATE SEQUENCE keys_id_seq
@@ -14039,7 +14137,8 @@ CREATE TABLE licenses (
id integer NOT NULL,
data text NOT NULL,
created_at timestamp without time zone,
- updated_at timestamp without time zone
+ updated_at timestamp without time zone,
+ cloud boolean DEFAULT false
);
CREATE SEQUENCE licenses_id_seq
@@ -14527,6 +14626,24 @@ CREATE SEQUENCE milestones_id_seq
ALTER SEQUENCE milestones_id_seq OWNED BY milestones.id;
+CREATE TABLE namespace_admin_notes (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ namespace_id bigint NOT NULL,
+ note text,
+ CONSTRAINT check_e9d2e71b5d CHECK ((char_length(note) <= 1000))
+);
+
+CREATE SEQUENCE namespace_admin_notes_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE namespace_admin_notes_id_seq OWNED BY namespace_admin_notes.id;
+
CREATE TABLE namespace_aggregation_schedules (
namespace_id integer NOT NULL
);
@@ -14567,7 +14684,9 @@ CREATE TABLE namespace_settings (
allow_mfa_for_subgroups boolean DEFAULT true NOT NULL,
default_branch_name text,
repository_read_only boolean DEFAULT false NOT NULL,
- delayed_project_removal boolean DEFAULT false NOT NULL,
+ delayed_project_removal boolean,
+ resource_access_token_creation_allowed boolean DEFAULT true NOT NULL,
+ lock_delayed_project_removal boolean DEFAULT false NOT NULL,
CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255))
);
@@ -15546,7 +15665,7 @@ CREATE TABLE packages_rubygems_metadata (
CONSTRAINT check_b7b296b420 CHECK ((char_length(author) <= 255)),
CONSTRAINT check_bf16b21a47 CHECK ((char_length(rdoc_options) <= 255)),
CONSTRAINT check_ca641a3354 CHECK ((char_length(required_ruby_version) <= 255)),
- CONSTRAINT check_ea02f4800f CHECK ((char_length(metadata) <= 255)),
+ CONSTRAINT check_ea02f4800f CHECK ((char_length(metadata) <= 30000)),
CONSTRAINT check_f76bad1a9a CHECK ((char_length(require_paths) <= 255))
);
@@ -16416,6 +16535,7 @@ CREATE TABLE project_settings (
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,
CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL))
);
@@ -16780,7 +16900,8 @@ CREATE TABLE push_event_payloads (
commit_to bytea,
ref text,
commit_title character varying(70),
- ref_count integer
+ ref_count integer,
+ event_id_convert_to_bigint bigint DEFAULT 0 NOT NULL
);
CREATE TABLE push_rules (
@@ -16820,7 +16941,8 @@ CREATE TABLE raw_usage_data (
updated_at timestamp with time zone NOT NULL,
recorded_at timestamp with time zone NOT NULL,
sent_at timestamp with time zone,
- payload jsonb NOT NULL
+ payload jsonb NOT NULL,
+ version_usage_data_id_value bigint
);
CREATE SEQUENCE raw_usage_data_id_seq
@@ -17157,7 +17279,8 @@ CREATE TABLE saml_providers (
enforced_sso boolean DEFAULT false NOT NULL,
enforced_group_managed_accounts boolean DEFAULT false NOT NULL,
prohibited_outer_forks boolean DEFAULT true NOT NULL,
- default_membership_role smallint DEFAULT 10 NOT NULL
+ default_membership_role smallint DEFAULT 10 NOT NULL,
+ git_check_enforced boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE saml_providers_id_seq
@@ -17444,6 +17567,8 @@ CREATE TABLE snippet_repositories (
verified_at timestamp with time zone,
verification_checksum bytea,
verification_failure text,
+ verification_state smallint DEFAULT 0 NOT NULL,
+ verification_started_at timestamp with time zone,
CONSTRAINT snippet_repositories_verification_failure_text_limit CHECK ((char_length(verification_failure) <= 255))
);
@@ -18416,23 +18541,23 @@ CREATE SEQUENCE vulnerability_feedback_id_seq
ALTER SEQUENCE vulnerability_feedback_id_seq OWNED BY vulnerability_feedback.id;
-CREATE TABLE vulnerability_finding_fingerprints (
+CREATE TABLE vulnerability_finding_evidences (
id bigint NOT NULL,
- finding_id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
- algorithm_type smallint NOT NULL,
- fingerprint_sha256 bytea NOT NULL
+ vulnerability_occurrence_id bigint NOT NULL,
+ summary text,
+ CONSTRAINT check_5773b236fb CHECK ((char_length(summary) <= 8000000))
);
-CREATE SEQUENCE vulnerability_finding_fingerprints_id_seq
+CREATE SEQUENCE vulnerability_finding_evidences_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
-ALTER SEQUENCE vulnerability_finding_fingerprints_id_seq OWNED BY vulnerability_finding_fingerprints.id;
+ALTER SEQUENCE vulnerability_finding_evidences_id_seq OWNED BY vulnerability_finding_evidences.id;
CREATE TABLE vulnerability_finding_links (
id bigint NOT NULL,
@@ -18454,6 +18579,24 @@ CREATE SEQUENCE vulnerability_finding_links_id_seq
ALTER SEQUENCE vulnerability_finding_links_id_seq OWNED BY vulnerability_finding_links.id;
+CREATE TABLE vulnerability_finding_signatures (
+ id bigint NOT NULL,
+ finding_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ algorithm_type smallint NOT NULL,
+ signature_sha bytea NOT NULL
+);
+
+CREATE SEQUENCE vulnerability_finding_signatures_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE vulnerability_finding_signatures_id_seq OWNED BY vulnerability_finding_signatures.id;
+
CREATE TABLE vulnerability_findings_remediations (
id bigint NOT NULL,
vulnerability_occurrence_id bigint,
@@ -19083,6 +19226,10 @@ ALTER TABLE ONLY ci_trigger_requests ALTER COLUMN id SET DEFAULT nextval('ci_tri
ALTER TABLE ONLY ci_triggers ALTER COLUMN id SET DEFAULT nextval('ci_triggers_id_seq'::regclass);
+ALTER TABLE ONLY ci_unit_test_failures ALTER COLUMN id SET DEFAULT nextval('ci_unit_test_failures_id_seq'::regclass);
+
+ALTER TABLE ONLY ci_unit_tests ALTER COLUMN id SET DEFAULT nextval('ci_unit_tests_id_seq'::regclass);
+
ALTER TABLE ONLY ci_variables ALTER COLUMN id SET DEFAULT nextval('ci_variables_id_seq'::regclass);
ALTER TABLE ONLY cluster_agent_tokens ALTER COLUMN id SET DEFAULT nextval('cluster_agent_tokens_id_seq'::regclass);
@@ -19141,6 +19288,8 @@ ALTER TABLE ONLY dast_profiles ALTER COLUMN id SET DEFAULT nextval('dast_profile
ALTER TABLE ONLY dast_scanner_profiles ALTER COLUMN id SET DEFAULT nextval('dast_scanner_profiles_id_seq'::regclass);
+ALTER TABLE ONLY dast_site_profile_secret_variables ALTER COLUMN id SET DEFAULT nextval('dast_site_profile_secret_variables_id_seq'::regclass);
+
ALTER TABLE ONLY dast_site_profiles ALTER COLUMN id SET DEFAULT nextval('dast_site_profiles_id_seq'::regclass);
ALTER TABLE ONLY dast_site_tokens ALTER COLUMN id SET DEFAULT nextval('dast_site_tokens_id_seq'::regclass);
@@ -19177,6 +19326,8 @@ ALTER TABLE ONLY dora_daily_metrics ALTER COLUMN id SET DEFAULT nextval('dora_da
ALTER TABLE ONLY draft_notes ALTER COLUMN id SET DEFAULT nextval('draft_notes_id_seq'::regclass);
+ALTER TABLE ONLY elastic_index_settings ALTER COLUMN id SET DEFAULT nextval('elastic_index_settings_id_seq'::regclass);
+
ALTER TABLE ONLY elastic_reindexing_subtasks ALTER COLUMN id SET DEFAULT nextval('elastic_reindexing_subtasks_id_seq'::regclass);
ALTER TABLE ONLY elastic_reindexing_tasks ALTER COLUMN id SET DEFAULT nextval('elastic_reindexing_tasks_id_seq'::regclass);
@@ -19287,6 +19438,8 @@ ALTER TABLE ONLY import_export_uploads ALTER COLUMN id SET DEFAULT nextval('impo
ALTER TABLE ONLY import_failures ALTER COLUMN id SET DEFAULT nextval('import_failures_id_seq'::regclass);
+ALTER TABLE ONLY in_product_marketing_emails ALTER COLUMN id SET DEFAULT nextval('in_product_marketing_emails_id_seq'::regclass);
+
ALTER TABLE ONLY incident_management_oncall_participants ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_participants_id_seq'::regclass);
ALTER TABLE ONLY incident_management_oncall_rotations ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_rotations_id_seq'::regclass);
@@ -19385,6 +19538,8 @@ ALTER TABLE ONLY metrics_users_starred_dashboards ALTER COLUMN id SET DEFAULT ne
ALTER TABLE ONLY milestones ALTER COLUMN id SET DEFAULT nextval('milestones_id_seq'::regclass);
+ALTER TABLE ONLY namespace_admin_notes ALTER COLUMN id SET DEFAULT nextval('namespace_admin_notes_id_seq'::regclass);
+
ALTER TABLE ONLY namespace_statistics ALTER COLUMN id SET DEFAULT nextval('namespace_statistics_id_seq'::regclass);
ALTER TABLE ONLY namespaces ALTER COLUMN id SET DEFAULT nextval('namespaces_id_seq'::regclass);
@@ -19691,10 +19846,12 @@ ALTER TABLE ONLY vulnerability_external_issue_links ALTER COLUMN id SET DEFAULT
ALTER TABLE ONLY vulnerability_feedback ALTER COLUMN id SET DEFAULT nextval('vulnerability_feedback_id_seq'::regclass);
-ALTER TABLE ONLY vulnerability_finding_fingerprints ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_fingerprints_id_seq'::regclass);
+ALTER TABLE ONLY vulnerability_finding_evidences ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_evidences_id_seq'::regclass);
ALTER TABLE ONLY vulnerability_finding_links ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_links_id_seq'::regclass);
+ALTER TABLE ONLY vulnerability_finding_signatures ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_signatures_id_seq'::regclass);
+
ALTER TABLE ONLY vulnerability_findings_remediations ALTER COLUMN id SET DEFAULT nextval('vulnerability_findings_remediations_id_seq'::regclass);
ALTER TABLE ONLY vulnerability_historical_statistics ALTER COLUMN id SET DEFAULT nextval('vulnerability_historical_statistics_id_seq'::regclass);
@@ -20023,9 +20180,6 @@ ALTER TABLE ONLY ar_internal_metadata
ALTER TABLE ONLY atlassian_identities
ADD CONSTRAINT atlassian_identities_pkey PRIMARY KEY (user_id);
-ALTER TABLE ONLY audit_events_archived
- ADD CONSTRAINT audit_events_archived_pkey PRIMARY KEY (id);
-
ALTER TABLE ONLY audit_events
ADD CONSTRAINT audit_events_pkey PRIMARY KEY (id, created_at);
@@ -20110,15 +20264,9 @@ ALTER TABLE ONLY chat_names
ALTER TABLE ONLY chat_teams
ADD CONSTRAINT chat_teams_pkey PRIMARY KEY (id);
-ALTER TABLE cluster_agent_tokens
- ADD CONSTRAINT check_0fb634d04d CHECK ((name IS NOT NULL)) NOT VALID;
-
ALTER TABLE vulnerability_scanners
ADD CONSTRAINT check_37608c9db5 CHECK ((char_length(vendor) <= 255)) NOT VALID;
-ALTER TABLE gitlab_subscriptions
- ADD CONSTRAINT check_77fea3f0e7 CHECK ((namespace_id IS NOT NULL)) NOT VALID;
-
ALTER TABLE sprints
ADD CONSTRAINT check_ccd8a1eae0 CHECK ((start_date IS NOT NULL)) NOT VALID;
@@ -20251,6 +20399,12 @@ ALTER TABLE ONLY ci_trigger_requests
ALTER TABLE ONLY ci_triggers
ADD CONSTRAINT ci_triggers_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY ci_unit_test_failures
+ ADD CONSTRAINT ci_unit_test_failures_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY ci_unit_tests
+ ADD CONSTRAINT ci_unit_tests_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY ci_variables
ADD CONSTRAINT ci_variables_pkey PRIMARY KEY (id);
@@ -20308,6 +20462,9 @@ ALTER TABLE ONLY clusters_applications_prometheus
ALTER TABLE ONLY clusters_applications_runners
ADD CONSTRAINT clusters_applications_runners_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY clusters_integration_prometheus
+ ADD CONSTRAINT clusters_integration_prometheus_pkey PRIMARY KEY (cluster_id);
+
ALTER TABLE ONLY clusters_kubernetes_namespaces
ADD CONSTRAINT clusters_kubernetes_namespaces_pkey PRIMARY KEY (id);
@@ -20335,12 +20492,18 @@ ALTER TABLE ONLY csv_issue_imports
ALTER TABLE ONLY custom_emoji
ADD CONSTRAINT custom_emoji_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY dast_profiles_pipelines
+ ADD CONSTRAINT dast_profiles_pipelines_pkey PRIMARY KEY (dast_profile_id, ci_pipeline_id);
+
ALTER TABLE ONLY dast_profiles
ADD CONSTRAINT dast_profiles_pkey PRIMARY KEY (id);
ALTER TABLE ONLY dast_scanner_profiles
ADD CONSTRAINT dast_scanner_profiles_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY dast_site_profile_secret_variables
+ ADD CONSTRAINT dast_site_profile_secret_variables_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY dast_site_profiles
ADD CONSTRAINT dast_site_profiles_pkey PRIMARY KEY (id);
@@ -20401,6 +20564,9 @@ ALTER TABLE ONLY dora_daily_metrics
ALTER TABLE ONLY draft_notes
ADD CONSTRAINT draft_notes_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY elastic_index_settings
+ ADD CONSTRAINT elastic_index_settings_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY elastic_reindexing_subtasks
ADD CONSTRAINT elastic_reindexing_subtasks_pkey PRIMARY KEY (id);
@@ -20581,6 +20747,9 @@ ALTER TABLE ONLY import_export_uploads
ALTER TABLE ONLY import_failures
ADD CONSTRAINT import_failures_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY in_product_marketing_emails
+ ADD CONSTRAINT in_product_marketing_emails_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY incident_management_oncall_shifts
ADD CONSTRAINT inc_mgmnt_no_overlapping_oncall_shifts EXCLUDE USING gist (rotation_id WITH =, tstzrange(starts_at, ends_at, '[)'::text) WITH &&);
@@ -20758,6 +20927,9 @@ ALTER TABLE ONLY milestone_releases
ALTER TABLE ONLY milestones
ADD CONSTRAINT milestones_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY namespace_admin_notes
+ ADD CONSTRAINT namespace_admin_notes_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY namespace_aggregation_schedules
ADD CONSTRAINT namespace_aggregation_schedules_pkey PRIMARY KEY (namespace_id);
@@ -21304,12 +21476,15 @@ ALTER TABLE ONLY vulnerability_external_issue_links
ALTER TABLE ONLY vulnerability_feedback
ADD CONSTRAINT vulnerability_feedback_pkey PRIMARY KEY (id);
-ALTER TABLE ONLY vulnerability_finding_fingerprints
- ADD CONSTRAINT vulnerability_finding_fingerprints_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY vulnerability_finding_evidences
+ ADD CONSTRAINT vulnerability_finding_evidences_pkey PRIMARY KEY (id);
ALTER TABLE ONLY vulnerability_finding_links
ADD CONSTRAINT vulnerability_finding_links_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY vulnerability_finding_signatures
+ ADD CONSTRAINT vulnerability_finding_signatures_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY vulnerability_findings_remediations
ADD CONSTRAINT vulnerability_findings_remediations_pkey PRIMARY KEY (id);
@@ -21505,8 +21680,6 @@ CREATE INDEX product_analytics_events_experi_project_id_collector_tstamp_idx ON
CREATE INDEX active_billable_users ON users USING btree (id) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[NULL::integer, 6, 4]))) AND ((user_type IS NULL) OR (user_type <> ALL ('{2,6,1,3,7,8}'::smallint[]))));
-CREATE INDEX analytics_index_audit_events_on_created_at_and_author_id ON audit_events_archived USING btree (created_at, author_id);
-
CREATE INDEX analytics_index_audit_events_part_on_created_at_and_author_id ON ONLY audit_events USING btree (created_at, author_id);
CREATE INDEX analytics_index_events_on_created_at_and_author_id ON events USING btree (created_at, author_id);
@@ -21539,12 +21712,14 @@ CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_index ON epic_user_mentions US
CREATE INDEX expired_artifacts_temp_index ON ci_job_artifacts USING btree (id, created_at) WHERE ((expire_at IS NULL) AND (date(timezone('UTC'::text, created_at)) < '2020-06-22'::date));
-CREATE INDEX finding_links_on_vulnerability_occurrence_id ON vulnerability_finding_links USING btree (vulnerability_occurrence_id);
+CREATE INDEX finding_evidences_on_vulnerability_occurrence_id ON vulnerability_finding_evidences USING btree (vulnerability_occurrence_id);
-CREATE INDEX idx_audit_events_on_entity_id_desc_author_id_created_at ON audit_events_archived USING btree (entity_id, entity_type, id DESC, author_id, created_at);
+CREATE INDEX finding_links_on_vulnerability_occurrence_id ON vulnerability_finding_links USING btree (vulnerability_occurrence_id);
CREATE INDEX idx_audit_events_part_on_entity_id_desc_author_id_created_at ON ONLY audit_events USING btree (entity_id, entity_type, id DESC, author_id, created_at);
+CREATE INDEX idx_award_emoji_on_user_emoji_name_awardable_type_awardable_id ON award_emoji USING btree (user_id, name, awardable_type, awardable_id);
+
CREATE INDEX idx_ci_pipelines_artifacts_locked ON ci_pipelines USING btree (ci_ref_id, id) WHERE (locked = 1);
CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at_enabled ON container_expiration_policies USING btree (project_id, next_run_at, enabled);
@@ -21575,6 +21750,8 @@ CREATE INDEX idx_jira_connect_subscriptions_on_installation_id ON jira_connect_s
CREATE UNIQUE INDEX idx_jira_connect_subscriptions_on_installation_id_namespace_id ON jira_connect_subscriptions USING btree (jira_connect_installation_id, namespace_id);
+CREATE INDEX idx_keys_expires_at_and_before_expiry_notification_undelivered ON keys USING btree (date(timezone('UTC'::text, expires_at)), before_expiry_notification_delivered_at) WHERE (before_expiry_notification_delivered_at IS NULL);
+
CREATE INDEX idx_members_created_at_user_id_invite_token ON members USING btree (created_at) WHERE ((invite_token IS NOT NULL) AND (user_id IS NULL));
CREATE INDEX idx_merge_requests_on_id_and_merge_jid ON merge_requests USING btree (id, merge_jid) WHERE ((merge_jid IS NOT NULL) AND (state_id = 4));
@@ -21593,6 +21770,8 @@ CREATE UNIQUE INDEX idx_metrics_users_starred_dashboard_on_user_project_dashboar
CREATE INDEX idx_mr_cc_diff_files_on_mr_cc_id_and_sha ON merge_request_context_commit_diff_files USING btree (merge_request_context_commit_id, sha);
+CREATE INDEX idx_mrs_on_target_id_and_created_at_and_state_id ON merge_requests USING btree (target_project_id, state_id, created_at, id);
+
CREATE UNIQUE INDEX idx_on_compliance_management_frameworks_namespace_id_name ON compliance_management_frameworks USING btree (namespace_id, name);
CREATE UNIQUE INDEX idx_on_external_approval_rules_project_id_external_url ON external_approval_rules USING btree (project_id, external_url);
@@ -21645,9 +21824,9 @@ CREATE INDEX idx_security_scans_on_scan_type ON security_scans USING btree (scan
CREATE UNIQUE INDEX idx_serverless_domain_cluster_on_clusters_applications_knative ON serverless_domain_cluster USING btree (clusters_applications_knative_id);
-CREATE UNIQUE INDEX idx_vuln_fingerprints_on_occurrences_id_and_fingerprint_sha256 ON vulnerability_finding_fingerprints USING btree (finding_id, fingerprint_sha256);
+CREATE UNIQUE INDEX idx_vuln_signatures_on_occurrences_id_and_signature_sha ON vulnerability_finding_signatures USING btree (finding_id, signature_sha);
-CREATE UNIQUE INDEX idx_vuln_fingerprints_uniqueness_fingerprint_sha256 ON vulnerability_finding_fingerprints USING btree (finding_id, algorithm_type, fingerprint_sha256);
+CREATE UNIQUE INDEX idx_vuln_signatures_uniqueness_signature_sha ON vulnerability_finding_signatures USING btree (finding_id, algorithm_type, signature_sha);
CREATE UNIQUE INDEX idx_vulnerability_ext_issue_links_on_vulne_id_and_ext_issue ON vulnerability_external_issue_links USING btree (vulnerability_id, external_type, external_project_key, external_issue_key);
@@ -21785,8 +21964,6 @@ CREATE INDEX index_authentication_events_on_user_id ON authentication_events USI
CREATE INDEX index_award_emoji_on_awardable_type_and_awardable_id ON award_emoji USING btree (awardable_type, awardable_id);
-CREATE INDEX index_award_emoji_on_user_id_and_name ON award_emoji USING btree (user_id, name);
-
CREATE UNIQUE INDEX index_aws_roles_on_role_external_id ON aws_roles USING btree (role_external_id);
CREATE UNIQUE INDEX index_aws_roles_on_user_id ON aws_roles USING btree (user_id);
@@ -21995,6 +22172,10 @@ CREATE UNIQUE INDEX index_ci_job_variables_on_key_and_job_id ON ci_job_variables
CREATE UNIQUE INDEX index_ci_namespace_monthly_usages_on_namespace_id_and_date ON ci_namespace_monthly_usages USING btree (namespace_id, date);
+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));
+
CREATE INDEX index_ci_pipeline_artifacts_on_expire_at ON ci_pipeline_artifacts USING btree (expire_at);
CREATE INDEX index_ci_pipeline_artifacts_on_pipeline_id ON ci_pipeline_artifacts USING btree (pipeline_id);
@@ -22003,6 +22184,10 @@ CREATE UNIQUE INDEX index_ci_pipeline_artifacts_on_pipeline_id_and_file_type ON
CREATE INDEX index_ci_pipeline_artifacts_on_project_id ON ci_pipeline_artifacts USING btree (project_id);
+CREATE INDEX index_ci_pipeline_artifacts_pending_verification ON ci_pipeline_artifacts USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);
+
+CREATE INDEX index_ci_pipeline_artifacts_verification_state ON ci_pipeline_artifacts USING btree (verification_state);
+
CREATE INDEX index_ci_pipeline_chat_data_on_chat_name_id ON ci_pipeline_chat_data USING btree (chat_name_id);
CREATE UNIQUE INDEX index_ci_pipeline_chat_data_on_pipeline_id ON ci_pipeline_chat_data USING btree (pipeline_id);
@@ -22015,6 +22200,8 @@ CREATE INDEX index_ci_pipeline_schedules_on_next_run_at_and_active ON ci_pipelin
CREATE INDEX index_ci_pipeline_schedules_on_owner_id ON ci_pipeline_schedules USING btree (owner_id);
+CREATE INDEX index_ci_pipeline_schedules_on_owner_id_and_id_and_active ON ci_pipeline_schedules USING btree (owner_id, id) WHERE (active = true);
+
CREATE INDEX index_ci_pipeline_schedules_on_project_id ON ci_pipeline_schedules USING btree (project_id);
CREATE UNIQUE INDEX index_ci_pipeline_variables_on_pipeline_id_and_key ON ci_pipeline_variables USING btree (pipeline_id, key);
@@ -22059,6 +22246,8 @@ CREATE INDEX index_ci_pipelines_on_user_id_and_created_at_and_config_source ON c
CREATE INDEX index_ci_pipelines_on_user_id_and_created_at_and_source ON ci_pipelines USING btree (user_id, created_at, source);
+CREATE INDEX index_ci_pipelines_on_user_id_and_id_and_cancelable_status ON ci_pipelines USING btree (user_id, id) WHERE ((status)::text = ANY (ARRAY[('running'::character varying)::text, ('waiting_for_resource'::character varying)::text, ('preparing'::character varying)::text, ('pending'::character varying)::text, ('created'::character varying)::text, ('scheduled'::character varying)::text]));
+
CREATE UNIQUE INDEX index_ci_project_monthly_usages_on_project_id_and_date ON ci_project_monthly_usages USING btree (project_id, date);
CREATE UNIQUE INDEX index_ci_refs_on_project_id_and_ref_path ON ci_refs USING btree (project_id, ref_path);
@@ -22103,6 +22292,8 @@ CREATE UNIQUE INDEX index_ci_sources_projects_on_source_project_id_and_pipeline_
CREATE INDEX index_ci_stages_on_pipeline_id ON ci_stages USING btree (pipeline_id);
+CREATE INDEX index_ci_stages_on_pipeline_id_and_id ON ci_stages USING btree (pipeline_id, id) WHERE (status = ANY (ARRAY[0, 1, 2, 8, 9, 10]));
+
CREATE UNIQUE INDEX index_ci_stages_on_pipeline_id_and_name ON ci_stages USING btree (pipeline_id, name);
CREATE INDEX index_ci_stages_on_pipeline_id_and_position ON ci_stages USING btree (pipeline_id, "position");
@@ -22125,6 +22316,10 @@ CREATE INDEX index_ci_triggers_on_owner_id ON ci_triggers USING btree (owner_id)
CREATE INDEX index_ci_triggers_on_project_id ON ci_triggers USING btree (project_id);
+CREATE INDEX index_ci_unit_test_failures_on_build_id ON ci_unit_test_failures USING btree (build_id);
+
+CREATE UNIQUE INDEX index_ci_unit_tests_on_project_id_and_key_hash ON ci_unit_tests USING btree (project_id, key_hash);
+
CREATE INDEX index_ci_variables_on_key ON ci_variables USING btree (key);
CREATE UNIQUE INDEX index_ci_variables_on_project_id_and_key_and_environment_scope ON ci_variables USING btree (project_id, key, environment_scope);
@@ -22233,6 +22428,8 @@ CREATE INDEX index_dast_profiles_on_dast_site_profile_id ON dast_profiles USING
CREATE UNIQUE INDEX index_dast_profiles_on_project_id_and_name ON dast_profiles USING btree (project_id, name);
+CREATE UNIQUE INDEX index_dast_profiles_pipelines_on_ci_pipeline_id ON dast_profiles_pipelines USING btree (ci_pipeline_id);
+
CREATE UNIQUE INDEX index_dast_scanner_profiles_on_project_id_and_name ON dast_scanner_profiles USING btree (project_id, name);
CREATE INDEX index_dast_site_profiles_on_dast_site_id ON dast_site_profiles USING btree (dast_site_id);
@@ -22283,12 +22480,16 @@ CREATE INDEX index_deployments_on_environment_id_and_iid_and_project_id ON deplo
CREATE INDEX index_deployments_on_environment_id_status_and_finished_at ON deployments USING btree (environment_id, status, finished_at);
+CREATE INDEX index_deployments_on_environment_id_status_and_id ON deployments USING btree (environment_id, status, id);
+
CREATE INDEX index_deployments_on_environment_status_sha ON deployments USING btree (environment_id, status, sha);
CREATE INDEX index_deployments_on_id_and_status_and_created_at ON deployments USING btree (id, status, created_at);
CREATE INDEX index_deployments_on_id_where_cluster_id_present ON deployments USING btree (id) WHERE (cluster_id IS NOT NULL);
+CREATE INDEX index_deployments_on_project_and_environment_and_updated_at ON deployments USING btree (project_id, environment_id, updated_at);
+
CREATE INDEX index_deployments_on_project_and_finished ON deployments USING btree (project_id, finished_at) WHERE (status = 2);
CREATE INDEX index_deployments_on_project_id_and_id ON deployments USING btree (project_id, id DESC);
@@ -22345,6 +22546,8 @@ CREATE INDEX index_draft_notes_on_discussion_id ON draft_notes USING btree (disc
CREATE INDEX index_draft_notes_on_merge_request_id ON draft_notes USING btree (merge_request_id);
+CREATE UNIQUE INDEX index_elastic_index_settings_on_alias_name ON elastic_index_settings USING btree (alias_name);
+
CREATE INDEX index_elastic_reindexing_subtasks_on_elastic_reindexing_task_id ON elastic_reindexing_subtasks USING btree (elastic_reindexing_task_id);
CREATE UNIQUE INDEX index_elastic_reindexing_tasks_on_in_progress ON elastic_reindexing_tasks USING btree (in_progress) WHERE in_progress;
@@ -22401,8 +22604,6 @@ CREATE INDEX index_epics_on_due_date_sourcing_milestone_id ON epics USING btree
CREATE INDEX index_epics_on_end_date ON epics USING btree (end_date);
-CREATE INDEX index_epics_on_group_id ON epics USING btree (group_id);
-
CREATE UNIQUE INDEX index_epics_on_group_id_and_external_key ON epics USING btree (group_id, external_key) WHERE (external_key IS NOT NULL);
CREATE UNIQUE INDEX index_epics_on_group_id_and_iid ON epics USING btree (group_id, iid);
@@ -22643,6 +22844,10 @@ CREATE INDEX index_import_failures_on_project_id_not_null ON import_failures USI
CREATE INDEX index_imported_projects_on_import_type_creator_id_created_at ON projects USING btree (import_type, creator_id, created_at) WHERE (import_type IS NOT NULL);
+CREATE INDEX index_in_product_marketing_emails_on_user_id ON in_product_marketing_emails USING btree (user_id);
+
+CREATE UNIQUE INDEX index_in_product_marketing_emails_on_user_track_series ON in_product_marketing_emails USING btree (user_id, track, series);
+
CREATE INDEX index_inc_mgmnt_oncall_participants_on_oncall_user_id ON incident_management_oncall_participants USING btree (user_id);
CREATE UNIQUE INDEX index_inc_mgmnt_oncall_participants_on_user_id_and_rotation_id ON incident_management_oncall_participants USING btree (user_id, oncall_rotation_id);
@@ -22689,8 +22894,6 @@ CREATE UNIQUE INDEX index_issue_links_on_source_id_and_target_id ON issue_links
CREATE INDEX index_issue_links_on_target_id ON issue_links USING btree (target_id);
-CREATE INDEX index_issue_metrics ON issue_metrics USING btree (issue_id);
-
CREATE INDEX index_issue_metrics_on_issue_id_and_timestamps ON issue_metrics USING btree (issue_id, first_mentioned_in_commit_at, first_associated_with_milestone_at, first_added_to_board_at);
CREATE INDEX index_issue_on_project_id_state_id_and_blocking_issues_count ON issues USING btree (project_id, state_id, blocking_issues_count);
@@ -22751,6 +22954,8 @@ CREATE INDEX index_jira_imports_on_user_id ON jira_imports USING btree (user_id)
CREATE INDEX index_jira_tracker_data_on_service_id ON jira_tracker_data USING btree (service_id);
+CREATE INDEX index_keys_on_expires_at_and_expiry_notification_undelivered ON keys USING btree (date(timezone('UTC'::text, expires_at)), expiry_notification_delivered_at) WHERE (expiry_notification_delivered_at IS NULL);
+
CREATE UNIQUE INDEX index_keys_on_fingerprint ON keys USING btree (fingerprint);
CREATE INDEX index_keys_on_fingerprint_sha256 ON keys USING btree (fingerprint_sha256);
@@ -22829,10 +23034,12 @@ CREATE INDEX index_members_on_requested_at ON members USING btree (requested_at)
CREATE INDEX index_members_on_source_id_and_source_type ON members USING btree (source_id, source_type);
-CREATE INDEX index_members_on_user_id ON members USING btree (user_id);
+CREATE INDEX index_members_on_user_id_and_access_level_requested_at_is_null ON members USING btree (user_id, access_level) WHERE (requested_at IS NULL);
CREATE INDEX index_members_on_user_id_created_at ON members USING btree (user_id, created_at) WHERE ((ldap = true) AND ((type)::text = 'GroupMember'::text) AND ((source_type)::text = 'Namespace'::text));
+CREATE INDEX index_members_on_user_id_source_id_source_type ON members USING btree (user_id, source_id, source_type);
+
CREATE INDEX index_merge_request_assignees_on_merge_request_id ON merge_request_assignees USING btree (merge_request_id);
CREATE UNIQUE INDEX index_merge_request_assignees_on_merge_request_id_and_user_id ON merge_request_assignees USING btree (merge_request_id, user_id);
@@ -22913,6 +23120,8 @@ CREATE INDEX index_merge_requests_on_target_project_id_and_iid_and_state_id ON m
CREATE INDEX index_merge_requests_on_target_project_id_and_iid_jira_title ON merge_requests USING btree (target_project_id, iid) WHERE ((title)::text ~ '[A-Z][A-Z_0-9]+-\d+'::text);
+CREATE INDEX index_merge_requests_on_target_project_id_and_source_branch ON merge_requests USING btree (target_project_id, source_branch);
+
CREATE INDEX index_merge_requests_on_target_project_id_and_squash_commit_sha ON merge_requests USING btree (target_project_id, squash_commit_sha);
CREATE INDEX index_merge_requests_on_target_project_id_and_target_branch ON merge_requests USING btree (target_project_id, target_branch) WHERE ((state_id = 1) AND (merge_when_pipeline_succeeds = true));
@@ -22955,7 +23164,7 @@ CREATE INDEX index_milestones_on_title ON milestones USING btree (title);
CREATE INDEX index_milestones_on_title_trigram ON milestones USING gin (title gin_trgm_ops);
-CREATE INDEX index_mirror_data_on_next_execution_and_retry_count ON project_mirror_data USING btree (next_execution_timestamp, retry_count);
+CREATE INDEX index_mirror_data_non_scheduled_or_started ON project_mirror_data USING btree (next_execution_timestamp, retry_count) WHERE ((status)::text <> ALL ('{scheduled,started}'::text[]));
CREATE UNIQUE INDEX index_mr_blocks_on_blocking_and_blocked_mr_ids ON merge_request_blocks USING btree (blocking_merge_request_id, blocked_merge_request_id);
@@ -22967,12 +23176,16 @@ CREATE INDEX index_mr_metrics_on_target_project_id_merged_at_nulls_last ON merge
CREATE INDEX index_mr_metrics_on_target_project_id_merged_at_time_to_merge ON merge_request_metrics USING btree (target_project_id, merged_at, created_at) WHERE (merged_at > created_at);
+CREATE INDEX index_namespace_admin_notes_on_namespace_id ON namespace_admin_notes USING btree (namespace_id);
+
CREATE UNIQUE INDEX index_namespace_aggregation_schedules_on_namespace_id ON namespace_aggregation_schedules USING btree (namespace_id);
CREATE UNIQUE INDEX index_namespace_root_storage_statistics_on_namespace_id ON namespace_root_storage_statistics USING btree (namespace_id);
CREATE UNIQUE INDEX index_namespace_statistics_on_namespace_id ON namespace_statistics USING btree (namespace_id);
+CREATE INDEX index_namespaces_id_parent_id_is_null ON namespaces USING btree (id) WHERE (parent_id IS NULL);
+
CREATE INDEX index_namespaces_on_created_at ON namespaces USING btree (created_at);
CREATE INDEX index_namespaces_on_custom_project_templates_group_id_and_type ON namespaces USING btree (custom_project_templates_group_id, type) WHERE (custom_project_templates_group_id IS NOT NULL);
@@ -23005,12 +23218,16 @@ CREATE UNIQUE INDEX index_namespaces_on_runners_token_encrypted ON namespaces US
CREATE INDEX index_namespaces_on_shared_and_extra_runners_minutes_limit ON namespaces USING btree (shared_runners_minutes_limit, extra_shared_runners_minutes_limit);
+CREATE INDEX index_namespaces_on_traversal_ids ON namespaces USING gin (traversal_ids);
+
CREATE INDEX index_namespaces_on_type_and_id_partial ON namespaces USING btree (type, id) WHERE (type IS NOT NULL);
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);
+CREATE INDEX index_notes_for_cherry_picked_merge_requests ON notes USING btree (project_id, commit_id) WHERE ((noteable_type)::text = 'MergeRequest'::text);
+
CREATE INDEX index_notes_on_author_id_and_created_at_and_id ON notes USING btree (author_id, created_at, id);
CREATE INDEX index_notes_on_commit_id ON notes USING btree (commit_id);
@@ -23031,9 +23248,7 @@ CREATE INDEX index_notes_on_project_id_and_noteable_type ON notes USING btree (p
CREATE INDEX index_notes_on_review_id ON notes USING btree (review_id);
-CREATE INDEX index_notification_settings_on_source_id_and_source_type ON notification_settings USING btree (source_id, source_type);
-
-CREATE INDEX index_notification_settings_on_user_id ON notification_settings USING btree (user_id);
+CREATE INDEX index_notification_settings_on_source_and_level_and_user ON notification_settings USING btree (source_id, source_type, level, user_id);
CREATE UNIQUE INDEX index_notifications_on_user_id_and_source_id_and_source_type ON notification_settings USING btree (user_id, source_id, source_type);
@@ -23163,10 +23378,14 @@ CREATE INDEX index_packages_events_on_package_id ON packages_events USING btree
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);
+
CREATE INDEX index_packages_nuget_dl_metadata_on_dependency_link_id ON packages_nuget_dependency_link_metadata USING btree (dependency_link_id);
CREATE UNIQUE INDEX index_packages_on_project_id_name_version_unique_when_generic ON packages_packages USING btree (project_id, name, version) WHERE (package_type = 7);
+CREATE UNIQUE INDEX index_packages_on_project_id_name_version_unique_when_golang ON packages_packages USING btree (project_id, name, version) WHERE (package_type = 8);
+
CREATE INDEX index_packages_package_file_build_infos_on_package_file_id ON packages_package_file_build_infos USING btree (package_file_id);
CREATE INDEX index_packages_package_file_build_infos_on_pipeline_id ON packages_package_file_build_infos USING btree (pipeline_id);
@@ -23199,6 +23418,8 @@ CREATE INDEX index_packages_tags_on_package_id_and_updated_at ON packages_tags U
CREATE INDEX index_pages_deployments_on_ci_build_id ON pages_deployments USING btree (ci_build_id);
+CREATE INDEX index_pages_deployments_on_file_store_and_id ON pages_deployments USING btree (file_store, id);
+
CREATE INDEX index_pages_deployments_on_project_id ON pages_deployments USING btree (project_id);
CREATE INDEX index_pages_domain_acme_orders_on_challenge_token ON pages_domain_acme_orders USING btree (challenge_token);
@@ -23663,6 +23884,8 @@ CREATE INDEX index_service_desk_enabled_projects_on_id_creator_id_created_at ON
CREATE INDEX index_services_on_inherit_from_id ON services USING btree (inherit_from_id);
+CREATE INDEX index_services_on_project_and_type_where_inherit_null ON services USING btree (project_id, type) WHERE (inherit_from_id IS NULL);
+
CREATE UNIQUE INDEX index_services_on_project_id_and_type_unique ON services USING btree (project_id, type);
CREATE INDEX index_services_on_template ON services USING btree (template);
@@ -23679,6 +23902,8 @@ CREATE UNIQUE INDEX index_services_on_unique_group_id_and_type ON services USING
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);
+
CREATE INDEX index_slack_integrations_on_service_id ON slack_integrations USING btree (service_id);
CREATE UNIQUE INDEX index_slack_integrations_on_team_id_and_alias ON slack_integrations USING btree (team_id, alias);
@@ -23689,10 +23914,18 @@ CREATE INDEX index_smartcard_identities_on_user_id ON smartcard_identities USING
CREATE INDEX index_snippet_on_id_and_project_id ON snippets USING btree (id, project_id);
+CREATE INDEX index_snippet_repositories_failed_verification ON snippet_repositories USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);
+
+CREATE INDEX index_snippet_repositories_needs_verification ON snippet_repositories USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));
+
CREATE UNIQUE INDEX index_snippet_repositories_on_disk_path ON snippet_repositories USING btree (disk_path);
CREATE INDEX index_snippet_repositories_on_shard_id ON snippet_repositories USING btree (shard_id);
+CREATE INDEX index_snippet_repositories_pending_verification ON snippet_repositories USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);
+
+CREATE INDEX index_snippet_repositories_verification_state ON snippet_repositories USING btree (verification_state);
+
CREATE INDEX index_snippet_repository_storage_moves_on_snippet_id ON snippet_repository_storage_moves USING btree (snippet_id);
CREATE UNIQUE INDEX index_snippet_user_mentions_on_note_id ON snippet_user_mentions USING btree (note_id) WHERE (note_id IS NOT NULL);
@@ -23731,6 +23964,8 @@ CREATE UNIQUE INDEX index_sop_configs_on_project_id ON security_orchestration_po
CREATE INDEX index_sop_configurations_project_id_policy_project_id ON security_orchestration_policy_configurations USING btree (security_policy_management_project_id, project_id);
+CREATE INDEX index_spam_logs_on_user_id ON spam_logs USING btree (user_id);
+
CREATE INDEX index_sprints_iterations_cadence_id ON sprints USING btree (iterations_cadence_id);
CREATE INDEX index_sprints_on_description_trigram ON sprints USING gin (description gin_trgm_ops);
@@ -23835,6 +24070,12 @@ CREATE INDEX index_u2f_registrations_on_key_handle ON u2f_registrations USING bt
CREATE INDEX index_u2f_registrations_on_user_id ON u2f_registrations USING btree (user_id);
+CREATE UNIQUE INDEX index_unique_issue_metrics_issue_id ON issue_metrics USING btree (issue_id);
+
+CREATE INDEX index_unit_test_failures_failed_at ON ci_unit_test_failures USING btree (failed_at DESC);
+
+CREATE UNIQUE INDEX index_unit_test_failures_unique_columns ON ci_unit_test_failures USING btree (unit_test_id, failed_at DESC, build_id);
+
CREATE INDEX index_uploads_on_checksum ON uploads USING btree (checksum);
CREATE INDEX index_uploads_on_model_id_and_model_type ON uploads USING btree (model_id, model_type);
@@ -23987,7 +24228,7 @@ CREATE INDEX index_vulnerability_feedback_on_merge_request_id ON vulnerability_f
CREATE INDEX index_vulnerability_feedback_on_pipeline_id ON vulnerability_feedback USING btree (pipeline_id);
-CREATE INDEX index_vulnerability_finding_fingerprints_on_finding_id ON vulnerability_finding_fingerprints USING btree (finding_id);
+CREATE INDEX index_vulnerability_finding_signatures_on_finding_id ON vulnerability_finding_signatures USING btree (finding_id);
CREATE INDEX index_vulnerability_findings_remediations_on_remediation_id ON vulnerability_findings_remediations USING btree (vulnerability_remediation_id);
@@ -24039,6 +24280,10 @@ CREATE INDEX index_web_hook_logs_on_created_at_and_web_hook_id ON web_hook_logs
CREATE INDEX index_web_hook_logs_on_web_hook_id ON web_hook_logs USING btree (web_hook_id);
+CREATE INDEX index_web_hook_logs_part_on_created_at_and_web_hook_id ON ONLY web_hook_logs_part_0c5294f417 USING btree (created_at, web_hook_id);
+
+CREATE INDEX index_web_hook_logs_part_on_web_hook_id ON ONLY web_hook_logs_part_0c5294f417 USING btree (web_hook_id);
+
CREATE INDEX index_web_hooks_on_group_id ON web_hooks USING btree (group_id) WHERE ((type)::text = 'GroupHook'::text);
CREATE INDEX index_web_hooks_on_project_id ON web_hooks USING btree (project_id);
@@ -24121,8 +24366,6 @@ CREATE UNIQUE INDEX snippet_user_mentions_on_snippet_id_index ON snippet_user_me
CREATE UNIQUE INDEX taggings_idx ON taggings USING btree (tag_id, taggable_id, taggable_type, context, tagger_id, tagger_type);
-CREATE INDEX temporary_index_vulnerabilities_on_id ON vulnerabilities USING btree (id) WHERE ((state = 2) AND ((dismissed_at IS NULL) OR (dismissed_by_id IS NULL)));
-
CREATE UNIQUE INDEX term_agreements_unique_index ON term_agreements USING btree (user_id, term_id);
CREATE INDEX tmp_idx_deduplicate_vulnerability_occurrences ON vulnerability_occurrences USING btree (project_id, report_type, location_fingerprint, primary_identifier_id, id);
@@ -24415,7 +24658,9 @@ ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_p
CREATE TRIGGER table_sync_trigger_b99eb6998c AFTER INSERT OR DELETE OR UPDATE ON web_hook_logs FOR EACH ROW EXECUTE PROCEDURE table_sync_function_29bc99d6db();
-CREATE TRIGGER table_sync_trigger_ee39a25f9d AFTER INSERT OR DELETE OR UPDATE ON audit_events FOR EACH ROW EXECUTE PROCEDURE table_sync_function_2be879775d();
+CREATE TRIGGER trigger_07c94931164e BEFORE INSERT OR UPDATE ON push_event_payloads FOR EACH ROW EXECUTE PROCEDURE trigger_07c94931164e();
+
+CREATE TRIGGER trigger_69523443cc10 BEFORE INSERT OR UPDATE ON events FOR EACH ROW EXECUTE PROCEDURE trigger_69523443cc10();
CREATE TRIGGER trigger_has_external_issue_tracker_on_delete AFTER DELETE ON services FOR EACH ROW WHEN ((((old.category)::text = 'issue_tracker'::text) AND (old.active = true) AND (old.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_issue_tracker();
@@ -24468,6 +24713,9 @@ ALTER TABLE ONLY notification_settings
ALTER TABLE ONLY lists
ADD CONSTRAINT fk_0d3f677137 FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_unit_test_failures
+ ADD CONSTRAINT fk_0f09856e1f FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY project_pages_metadata
ADD CONSTRAINT fk_0fd5b22688 FOREIGN KEY (pages_deployment_id) REFERENCES pages_deployments(id) ON DELETE SET NULL;
@@ -24573,6 +24821,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 in_product_marketing_emails
+ ADD CONSTRAINT fk_35c9101b63 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY epics
ADD CONSTRAINT fk_3654b61b03 FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE CASCADE;
@@ -24714,6 +24965,9 @@ ALTER TABLE ONLY geo_event_log
ALTER TABLE ONLY lists
ADD CONSTRAINT fk_7a5553d60f FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_unit_tests
+ ADD CONSTRAINT fk_7a8fabf0a8 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY protected_branches
ADD CONSTRAINT fk_7a9c6d93e7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -24855,6 +25109,9 @@ ALTER TABLE ONLY bulk_import_entities
ALTER TABLE ONLY users
ADD CONSTRAINT fk_a4b8fefe3e FOREIGN KEY (managing_group_id) REFERENCES namespaces(id) ON DELETE SET NULL;
+ALTER TABLE ONLY dast_profiles_pipelines
+ ADD CONSTRAINT fk_a60cad829d FOREIGN KEY (ci_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_a6963e8447 FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -24960,6 +25217,9 @@ ALTER TABLE ONLY external_approval_rules_protected_branches
ALTER TABLE ONLY external_approval_rules_protected_branches
ADD CONSTRAINT fk_ca2ffb55e6 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;
+ALTER TABLE ONLY dast_profiles_pipelines
+ ADD CONSTRAINT fk_cc206a8c13 FOREIGN KEY (dast_profile_id) REFERENCES dast_profiles(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY experiment_subjects
ADD CONSTRAINT fk_ccc28f8ceb FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -24985,7 +25245,7 @@ ALTER TABLE ONLY ci_builds
ADD CONSTRAINT fk_d3130c9a7f FOREIGN KEY (commit_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
ALTER TABLE ONLY web_hooks
- ADD CONSTRAINT fk_d47999a98a FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE NOT VALID;
+ ADD CONSTRAINT fk_d47999a98a FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_sources_pipelines
ADD CONSTRAINT fk_d4e29af7d7 FOREIGN KEY (source_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
@@ -25374,6 +25634,9 @@ ALTER TABLE ONLY group_custom_attributes
ALTER TABLE ONLY incident_management_oncall_rotations
ADD CONSTRAINT fk_rails_256e0bc604 FOREIGN KEY (oncall_schedule_id) REFERENCES incident_management_oncall_schedules(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_unit_test_failures
+ ADD CONSTRAINT fk_rails_259da3e79c FOREIGN KEY (unit_test_id) REFERENCES ci_unit_tests(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY analytics_devops_adoption_snapshots
ADD CONSTRAINT fk_rails_25da9a92c0 FOREIGN KEY (segment_id) REFERENCES analytics_devops_adoption_segments(id) ON DELETE CASCADE;
@@ -25560,6 +25823,9 @@ ALTER TABLE ONLY operations_strategies_user_lists
ALTER TABLE ONLY lfs_file_locks
ADD CONSTRAINT fk_rails_43df7a0412 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY dast_site_profile_secret_variables
+ ADD CONSTRAINT fk_rails_43e2897950 FOREIGN KEY (dast_site_profile_id) REFERENCES dast_site_profiles(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY merge_request_assignees
ADD CONSTRAINT fk_rails_443443ce6f FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
@@ -25782,6 +26048,9 @@ ALTER TABLE ONLY approval_merge_request_rules_approved_approvers
ALTER TABLE ONLY operations_feature_flags_clients
ADD CONSTRAINT fk_rails_6650ed902c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY namespace_admin_notes
+ ADD CONSTRAINT fk_rails_666166ea7b FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY web_hook_logs
ADD CONSTRAINT fk_rails_666826e111 FOREIGN KEY (web_hook_id) REFERENCES web_hooks(id) ON DELETE CASCADE;
@@ -26067,6 +26336,9 @@ ALTER TABLE ONLY analytics_language_trend_repository_languages
ALTER TABLE ONLY badges
ADD CONSTRAINT fk_rails_9df4a56538 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+ALTER TABLE ONLY vulnerability_finding_signatures
+ ADD CONSTRAINT fk_rails_9e0baf9dcd FOREIGN KEY (finding_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY clusters_applications_cert_managers
ADD CONSTRAINT fk_rails_9e4f2cb4b2 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;
@@ -26214,6 +26486,9 @@ ALTER TABLE ONLY approval_project_rules_users
ALTER TABLE ONLY lists
ADD CONSTRAINT fk_rails_baed5f39b7 FOREIGN KEY (milestone_id) REFERENCES milestones(id) ON DELETE CASCADE;
+ALTER TABLE web_hook_logs_part_0c5294f417
+ ADD CONSTRAINT fk_rails_bb3355782d FOREIGN KEY (web_hook_id) REFERENCES web_hooks(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY security_findings
ADD CONSTRAINT fk_rails_bb63863cf1 FOREIGN KEY (scan_id) REFERENCES security_scans(id) ON DELETE CASCADE;
@@ -26352,6 +26627,9 @@ ALTER TABLE ONLY requirements_management_test_reports
ALTER TABLE ONLY pool_repositories
ADD CONSTRAINT fk_rails_d2711daad4 FOREIGN KEY (source_project_id) REFERENCES projects(id) ON DELETE SET NULL;
+ALTER TABLE ONLY web_hooks
+ ADD CONSTRAINT fk_rails_d35697648e FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE NOT VALID;
+
ALTER TABLE ONLY group_group_links
ADD CONSTRAINT fk_rails_d3a0488427 FOREIGN KEY (shared_group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -26415,6 +26693,12 @@ ALTER TABLE ONLY cluster_platforms_kubernetes
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;
+
+ALTER TABLE ONLY clusters_integration_prometheus
+ ADD CONSTRAINT fk_rails_e44472034c FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY vulnerability_occurrence_identifiers
ADD CONSTRAINT fk_rails_e4ef6d027c FOREIGN KEY (occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;
@@ -26556,9 +26840,6 @@ ALTER TABLE ONLY merge_trains
ALTER TABLE ONLY ci_runner_namespaces
ADD CONSTRAINT fk_rails_f9d9ed3308 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
-ALTER TABLE ONLY vulnerability_finding_fingerprints
- ADD CONSTRAINT fk_rails_fa411253b2 FOREIGN KEY (finding_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY requirements_management_test_reports
ADD CONSTRAINT fk_rails_fb3308ad55 FOREIGN KEY (requirement_id) REFERENCES requirements(id) ON DELETE CASCADE;