summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 18:25:58 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-16 18:25:58 +0000
commita5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch)
treefb69158581673816a8cd895f9d352dcb3c678b1e /db
parentd16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff)
downloadgitlab-ce-a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4.tar.gz
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/production/002_admin.rb6
-rw-r--r--db/migrate/20210331000934_add_config_to_ci_runners.rb7
-rw-r--r--db/migrate/20210430121522_initialize_conversion_of_ci_build_trace_sections_to_bigint.rb16
-rw-r--r--db/migrate/20210504143128_add_verification_state_and_started_at_to_mr_diff_details_table.rb10
-rw-r--r--db/migrate/20210505070612_create_packages_debian_group_distribution_keys.rb37
-rw-r--r--db/migrate/20210505070812_create_packages_debian_project_distribution_keys.rb37
-rw-r--r--db/migrate/20210505170152_add_verification_indexes_to_merge_request_diff_details_table.rb26
-rw-r--r--db/migrate/20210506150833_create_vulnerability_finding_evidence_headers.rb29
-rw-r--r--db/migrate/20210507191949_add_remove_on_issue_close_to_labels.rb8
-rw-r--r--db/migrate/20210510083845_add_sha_to_status_check_response.rb13
-rw-r--r--db/migrate/20210511165250_add_foreign_key_to_lfs_objects_projects.rb19
-rw-r--r--db/migrate/20210512120122_add_pending_builds_table.rb15
-rw-r--r--db/migrate/20210517130723_make_snapshot_segment_id_optional.rb11
-rw-r--r--db/migrate/20210517144856_require_snapshot_namespace.rb19
-rw-r--r--db/migrate/20210517221612_add_default_value_to_merge_requests_author_approval_on_projects.rb17
-rw-r--r--db/migrate/20210519132109_initialize_conversion_of_ci_builds_metadata_to_bigint.rb16
-rw-r--r--db/migrate/20210520102039_group_protected_environments_add_column.rb15
-rw-r--r--db/migrate/20210520133032_initialize_conversion_of_taggings_to_bigint.rb16
-rw-r--r--db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb16
-rw-r--r--db/migrate/20210521073920_drop_devops_adoption_namespace_uniqueness.rb23
-rw-r--r--db/migrate/20210525085158_initialize_conversion_of_deployments_to_bigint.rb16
-rw-r--r--db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb16
-rw-r--r--db/migrate/20210525100539_initialize_conversion_of_geo_job_artifact_deleted_events_to_bigint.rb16
-rw-r--r--db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb16
-rw-r--r--db/migrate/20210525184900_add_latest_pipeline_id_into_vulnerability_statistics_table.rb7
-rw-r--r--db/migrate/20210526135911_create_ci_minutes_additional_packs.rb25
-rw-r--r--db/migrate/20210526155257_rename_sync_security_report_approval_rules_sidekiq_queue.rb15
-rw-r--r--db/migrate/20210526181820_add_index_to_vulnerability_statistics_on_latest_pipeline_id.rb17
-rw-r--r--db/migrate/20210526181821_add_foreign_key_for_latest_pipeline_id_to_ci_pipelines.rb17
-rw-r--r--db/migrate/20210526190259_add_ci_daily_pipeline_schedule_triggers_to_plan_limits.rb7
-rw-r--r--db/migrate/20210526190553_insert_ci_daily_pipeline_schedule_triggers_plan_limits.rb26
-rw-r--r--db/migrate/20210527065005_add_index_for_cadence_iterations_automation.rb17
-rw-r--r--db/migrate/20210527130524_rename_experiment_subjects_group_id_to_namespace_id.rb15
-rw-r--r--db/migrate/20210527133919_add_diff_max_lines_to_application_settings.rb11
-rw-r--r--db/migrate/20210527134019_add_diff_max_files_to_application_settings.rb11
-rw-r--r--db/migrate/20210527185542_add_prevent_sharing_groups_outside_hierarchy_to_namespace_settings.rb17
-rw-r--r--db/migrate/20210527194558_create_ci_job_token_project_scope_links.rb24
-rw-r--r--db/migrate/20210529164247_change_iterations_title_uniqueness_index.rb20
-rw-r--r--db/migrate/20210531053916_rename_instance_statistics_measurements.rb13
-rw-r--r--db/migrate/20210531070452_default_enforce_ssh_key_expiration.rb7
-rw-r--r--db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb15
-rw-r--r--db/migrate/20210601080039_group_protected_environments_add_index_and_constraint.rb35
-rw-r--r--db/migrate/20210601123341_add_running_builds_table.rb17
-rw-r--r--db/migrate/20210601125410_add_runners_created_at_index.rb20
-rw-r--r--db/migrate/20210601131742_update_web_hook_calls_limit.rb17
-rw-r--r--db/migrate/20210601133459_replace_runners_contacted_at_index.rb26
-rw-r--r--db/migrate/20210602122213_add_upcoming_reconciliations.rb23
-rw-r--r--db/migrate/20210602122233_add_runners_description_index.rb17
-rw-r--r--db/migrate/20210603140302_add_pronouns_to_user_details.rb20
-rw-r--r--db/migrate/20210603222333_remove_builds_email_service_from_services.rb11
-rw-r--r--db/migrate/20210604082145_create_external_status_checks_table.rb42
-rw-r--r--db/migrate/20210604085600_rename_status_check_responses_approval_rule.rb34
-rw-r--r--db/migrate/20210607050531_add_text_limit_to_user_details_pronouns.rb15
-rw-r--r--db/migrate/20210607080044_remove_temporary_index_on_security_findings_scan_id.rb18
-rw-r--r--db/migrate/20210607154719_add_job_token_scope_enabled_to_ci_cd_settings.rb17
-rw-r--r--db/migrate/20210608072312_initialize_conversion_of_ci_stages_to_bigint.rb16
-rw-r--r--db/migrate/20210608072346_backfill_ci_stages_for_bigint_conversion.rb16
-rw-r--r--db/migrate/20210609013512_add_unique_index_for_batched_background_migrations.rb28
-rw-r--r--db/migrate/20210609090856_add_expiry_id_ssh_key_notification_index.rb20
-rw-r--r--db/migrate/20210609192728_add_status_check_foreign_key_to_external_status_check_id.rb17
-rw-r--r--db/migrate/20210609193101_add_status_check_foreign_key_to_protected_branch_id.rb17
-rw-r--r--db/migrate/20210610102410_add_protected_attribute_to_pending_builds.rb7
-rw-r--r--db/migrate/20210611100359_rebuild_index_for_cadence_iterations_automation.rb39
-rw-r--r--db/migrate/20210614131002_add_detection_method_to_vulnerabilities_finding.rb17
-rw-r--r--db/post_migrate/20190527194900_schedule_calculate_wiki_sizes.rb10
-rw-r--r--db/post_migrate/20210421163509_schedule_update_jira_tracker_data_deployment_type_based_on_url.rb26
-rw-r--r--db/post_migrate/20210426225417_schedule_recalculate_uuid_on_vulnerabilities_occurrences2.rb37
-rw-r--r--db/post_migrate/20210430121542_backfill_ci_build_trace_sections_for_bigint_conversion.rb16
-rw-r--r--db/post_migrate/20210513163904_cleanup_move_container_registry_enabled_to_project_feature.rb36
-rw-r--r--db/post_migrate/20210514063252_schedule_cleanup_orphaned_lfs_objects_projects.rb27
-rw-r--r--db/post_migrate/20210518074332_schedule_disable_expiration_policies_linked_to_no_container_images.rb29
-rw-r--r--db/post_migrate/20210519104931_backfill_clusters_integration_prometheus_enabled.rb42
-rw-r--r--db/post_migrate/20210519132129_backfill_ci_builds_metadata_for_bigint_conversion.rb16
-rw-r--r--db/post_migrate/20210519220019_backfill_escalation_policies_for_oncall_schedules.rb89
-rw-r--r--db/post_migrate/20210520012430_backfill_pk_conversion_for_self_managed.rb44
-rw-r--r--db/post_migrate/20210525075724_clean_up_pending_builds_table.rb28
-rw-r--r--db/post_migrate/20210526160133_remove_segment_selections_table.rb26
-rw-r--r--db/post_migrate/20210526222715_backfill_draft_status_on_merge_requests.rb17
-rw-r--r--db/post_migrate/20210527131039_clean_up_rename_experiment_subjects_group_id_to_namespace_id.rb15
-rw-r--r--db/post_migrate/20210531054108_finalize_rename_instance_statistics_measurements.rb13
-rw-r--r--db/post_migrate/20210601073400_fix_total_stage_in_vsa.rb27
-rw-r--r--db/post_migrate/20210604070207_retry_backfill_traversal_ids.rb21
-rw-r--r--db/post_migrate/20210606143426_add_index_for_container_registry_access_level.rb36
-rw-r--r--db/post_migrate/20210609125005_drop_non_partitioned_web_hook_logs.rb43
-rw-r--r--db/post_migrate/20210610102413_migrate_protected_attribute_to_pending_builds.rb26
-rw-r--r--db/post_migrate/20210610113229_add_index_to_protected_pending_builds.rb17
-rw-r--r--db/post_migrate/20210610141711_disable_expiration_policies_linked_to_no_container_images.rb32
-rw-r--r--db/post_migrate/20210611080951_fix_missing_traversal_ids.rb48
-rw-r--r--db/schema_migrations/202103310009341
-rw-r--r--db/schema_migrations/202104211635091
-rw-r--r--db/schema_migrations/202104262254171
-rw-r--r--db/schema_migrations/202104301215221
-rw-r--r--db/schema_migrations/202104301215421
-rw-r--r--db/schema_migrations/202105041431281
-rw-r--r--db/schema_migrations/202105050706121
-rw-r--r--db/schema_migrations/202105050708121
-rw-r--r--db/schema_migrations/202105051701521
-rw-r--r--db/schema_migrations/202105061508331
-rw-r--r--db/schema_migrations/202105100838451
-rw-r--r--db/schema_migrations/202105111652501
-rw-r--r--db/schema_migrations/202105121201221
-rw-r--r--db/schema_migrations/202105131639041
-rw-r--r--db/schema_migrations/202105140632521
-rw-r--r--db/schema_migrations/202105171307231
-rw-r--r--db/schema_migrations/202105171448561
-rw-r--r--db/schema_migrations/202105172216121
-rw-r--r--db/schema_migrations/202105180743321
-rw-r--r--db/schema_migrations/202105191049311
-rw-r--r--db/schema_migrations/202105191321091
-rw-r--r--db/schema_migrations/202105191321291
-rw-r--r--db/schema_migrations/202105192200191
-rw-r--r--db/schema_migrations/202105200124301
-rw-r--r--db/schema_migrations/202105201020391
-rw-r--r--db/schema_migrations/202105201330321
-rw-r--r--db/schema_migrations/202105201334401
-rw-r--r--db/schema_migrations/202105210739201
-rw-r--r--db/schema_migrations/202105250757241
-rw-r--r--db/schema_migrations/202105250851581
-rw-r--r--db/schema_migrations/202105250853251
-rw-r--r--db/schema_migrations/202105251005391
-rw-r--r--db/schema_migrations/202105251006031
-rw-r--r--db/schema_migrations/202105251849001
-rw-r--r--db/schema_migrations/202105261359111
-rw-r--r--db/schema_migrations/202105261552571
-rw-r--r--db/schema_migrations/202105261601331
-rw-r--r--db/schema_migrations/202105261818201
-rw-r--r--db/schema_migrations/202105261818211
-rw-r--r--db/schema_migrations/202105261902591
-rw-r--r--db/schema_migrations/202105261905531
-rw-r--r--db/schema_migrations/202105262227151
-rw-r--r--db/schema_migrations/202105270650051
-rw-r--r--db/schema_migrations/202105271305241
-rw-r--r--db/schema_migrations/202105271310391
-rw-r--r--db/schema_migrations/202105271339191
-rw-r--r--db/schema_migrations/202105271340191
-rw-r--r--db/schema_migrations/202105271855421
-rw-r--r--db/schema_migrations/202105271945581
-rw-r--r--db/schema_migrations/202105291642471
-rw-r--r--db/schema_migrations/202105310539161
-rw-r--r--db/schema_migrations/202105310541081
-rw-r--r--db/schema_migrations/202105310704521
-rw-r--r--db/schema_migrations/202105310711071
-rw-r--r--db/schema_migrations/202106010734001
-rw-r--r--db/schema_migrations/202106010800391
-rw-r--r--db/schema_migrations/202106011233411
-rw-r--r--db/schema_migrations/202106011254101
-rw-r--r--db/schema_migrations/202106011317421
-rw-r--r--db/schema_migrations/202106011334591
-rw-r--r--db/schema_migrations/202106021222131
-rw-r--r--db/schema_migrations/202106021222331
-rw-r--r--db/schema_migrations/202106031403021
-rw-r--r--db/schema_migrations/202106032223331
-rw-r--r--db/schema_migrations/202106040702071
-rw-r--r--db/schema_migrations/202106040821451
-rw-r--r--db/schema_migrations/202106040856001
-rw-r--r--db/schema_migrations/202106061434261
-rw-r--r--db/schema_migrations/202106070505311
-rw-r--r--db/schema_migrations/202106070800441
-rw-r--r--db/schema_migrations/202106071547191
-rw-r--r--db/schema_migrations/202106080723121
-rw-r--r--db/schema_migrations/202106080723461
-rw-r--r--db/schema_migrations/202106090135121
-rw-r--r--db/schema_migrations/202106090908561
-rw-r--r--db/schema_migrations/202106091250051
-rw-r--r--db/schema_migrations/202106091927281
-rw-r--r--db/schema_migrations/202106091931011
-rw-r--r--db/schema_migrations/202106101024101
-rw-r--r--db/schema_migrations/202106101024131
-rw-r--r--db/schema_migrations/202106101132291
-rw-r--r--db/schema_migrations/202106101417111
-rw-r--r--db/schema_migrations/202106110809511
-rw-r--r--db/schema_migrations/202106111003591
-rw-r--r--db/schema_migrations/202106141310021
-rw-r--r--db/structure.sql696
174 files changed, 2486 insertions, 189 deletions
diff --git a/db/fixtures/production/002_admin.rb b/db/fixtures/production/002_admin.rb
index 1c7c89f7bbd..b6a6da3a188 100644
--- a/db/fixtures/production/002_admin.rb
+++ b/db/fixtures/production/002_admin.rb
@@ -23,7 +23,11 @@ if user.persisted?
puts "login: root".color(:green)
if user_args.key?(:password)
- puts "password: #{user_args[:password]}".color(:green)
+ if ::Settings.gitlab['display_initial_root_password']
+ puts "password: #{user_args[:password]}".color(:green)
+ else
+ puts "password: *** - You opted not to display initial root password to STDOUT."
+ end
else
puts "password: You'll be prompted to create one on your first visit.".color(:green)
end
diff --git a/db/migrate/20210331000934_add_config_to_ci_runners.rb b/db/migrate/20210331000934_add_config_to_ci_runners.rb
new file mode 100644
index 00000000000..e9a5fadc613
--- /dev/null
+++ b/db/migrate/20210331000934_add_config_to_ci_runners.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddConfigToCiRunners < ActiveRecord::Migration[6.0]
+ def change
+ add_column :ci_runners, :config, :jsonb, default: {}, null: false
+ end
+end
diff --git a/db/migrate/20210430121522_initialize_conversion_of_ci_build_trace_sections_to_bigint.rb b/db/migrate/20210430121522_initialize_conversion_of_ci_build_trace_sections_to_bigint.rb
new file mode 100644
index 00000000000..c51ae67ebee
--- /dev/null
+++ b/db/migrate/20210430121522_initialize_conversion_of_ci_build_trace_sections_to_bigint.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class InitializeConversionOfCiBuildTraceSectionsToBigint < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE = :ci_build_trace_sections
+ COLUMN = :build_id
+
+ def up
+ initialize_conversion_of_integer_to_bigint(TABLE, COLUMN, primary_key: COLUMN)
+ end
+
+ def down
+ revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMN)
+ end
+end
diff --git a/db/migrate/20210504143128_add_verification_state_and_started_at_to_mr_diff_details_table.rb b/db/migrate/20210504143128_add_verification_state_and_started_at_to_mr_diff_details_table.rb
new file mode 100644
index 00000000000..7999ea14a12
--- /dev/null
+++ b/db/migrate/20210504143128_add_verification_state_and_started_at_to_mr_diff_details_table.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddVerificationStateAndStartedAtToMrDiffDetailsTable < ActiveRecord::Migration[6.0]
+ def change
+ change_table(:merge_request_diff_details) 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/20210505070612_create_packages_debian_group_distribution_keys.rb b/db/migrate/20210505070612_create_packages_debian_group_distribution_keys.rb
new file mode 100644
index 00000000000..1e79b4e29b0
--- /dev/null
+++ b/db/migrate/20210505070612_create_packages_debian_group_distribution_keys.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class CreatePackagesDebianGroupDistributionKeys < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ INDEX_DISTRIBUTION = 'idx_pkgs_debian_group_distribution_keys_on_distribution_id'
+
+ disable_ddl_transaction!
+
+ def up
+ create_table_with_constraints :packages_debian_group_distribution_keys do |t|
+ t.timestamps_with_timezone
+ t.references :distribution,
+ foreign_key: { to_table: :packages_debian_group_distributions, on_delete: :cascade },
+ index: { name: INDEX_DISTRIBUTION },
+ null: false
+
+ t.text :encrypted_private_key, null: false
+ t.text :encrypted_private_key_iv, null: false
+ t.text :encrypted_passphrase, null: false
+ t.text :encrypted_passphrase_iv, null: false
+ t.text :public_key, null: false
+ t.text :fingerprint, null: false
+
+ t.text_limit :public_key, 512.kilobytes
+ t.text_limit :fingerprint, 255
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :packages_debian_group_distribution_keys
+ end
+ end
+end
diff --git a/db/migrate/20210505070812_create_packages_debian_project_distribution_keys.rb b/db/migrate/20210505070812_create_packages_debian_project_distribution_keys.rb
new file mode 100644
index 00000000000..f5ec01ec0d6
--- /dev/null
+++ b/db/migrate/20210505070812_create_packages_debian_project_distribution_keys.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class CreatePackagesDebianProjectDistributionKeys < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ INDEX_DISTRIBUTION = 'idx_pkgs_debian_project_distribution_keys_on_distribution_id'
+
+ disable_ddl_transaction!
+
+ def up
+ create_table_with_constraints :packages_debian_project_distribution_keys do |t|
+ t.timestamps_with_timezone
+ t.references :distribution,
+ foreign_key: { to_table: :packages_debian_project_distributions, on_delete: :cascade },
+ index: { name: INDEX_DISTRIBUTION },
+ null: false
+
+ t.text :encrypted_private_key, null: false
+ t.text :encrypted_private_key_iv, null: false
+ t.text :encrypted_passphrase, null: false
+ t.text :encrypted_passphrase_iv, null: false
+ t.text :public_key, null: false
+ t.text :fingerprint, null: false
+
+ t.text_limit :public_key, 512.kilobytes
+ t.text_limit :fingerprint, 255
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :packages_debian_project_distribution_keys
+ end
+ end
+end
diff --git a/db/migrate/20210505170152_add_verification_indexes_to_merge_request_diff_details_table.rb b/db/migrate/20210505170152_add_verification_indexes_to_merge_request_diff_details_table.rb
new file mode 100644
index 00000000000..e85a28e3fa7
--- /dev/null
+++ b/db/migrate/20210505170152_add_verification_indexes_to_merge_request_diff_details_table.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class AddVerificationIndexesToMergeRequestDiffDetailsTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ VERIFICATION_STATE_INDEX_NAME = "index_merge_request_diff_details_on_verification_state"
+ PENDING_VERIFICATION_INDEX_NAME = "index_merge_request_diff_details_pending_verification"
+ FAILED_VERIFICATION_INDEX_NAME = "index_merge_request_diff_details_failed_verification"
+ NEEDS_VERIFICATION_INDEX_NAME = "index_merge_request_diff_details_needs_verification"
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :merge_request_diff_details, :verification_state, name: VERIFICATION_STATE_INDEX_NAME
+ add_concurrent_index :merge_request_diff_details, :verified_at, where: "(verification_state = 0)", order: { verified_at: 'ASC NULLS FIRST' }, name: PENDING_VERIFICATION_INDEX_NAME
+ add_concurrent_index :merge_request_diff_details, :verification_retry_at, where: "(verification_state = 3)", order: { verification_retry_at: 'ASC NULLS FIRST' }, name: FAILED_VERIFICATION_INDEX_NAME
+ add_concurrent_index :merge_request_diff_details, :verification_state, where: "(verification_state = 0 OR verification_state = 3)", name: NEEDS_VERIFICATION_INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :merge_request_diff_details, VERIFICATION_STATE_INDEX_NAME
+ remove_concurrent_index_by_name :merge_request_diff_details, PENDING_VERIFICATION_INDEX_NAME
+ remove_concurrent_index_by_name :merge_request_diff_details, FAILED_VERIFICATION_INDEX_NAME
+ remove_concurrent_index_by_name :merge_request_diff_details, NEEDS_VERIFICATION_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210506150833_create_vulnerability_finding_evidence_headers.rb b/db/migrate/20210506150833_create_vulnerability_finding_evidence_headers.rb
new file mode 100644
index 00000000000..0e584303e51
--- /dev/null
+++ b/db/migrate/20210506150833_create_vulnerability_finding_evidence_headers.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class CreateVulnerabilityFindingEvidenceHeaders < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ create_table_with_constraints :vulnerability_finding_evidence_headers do |t|
+ t.timestamps_with_timezone null: false
+
+ t.references :vulnerability_finding_evidence_request, index: { name: 'finding_evidence_header_on_finding_evidence_request_id' }, null: true, foreign_key: { on_delete: :cascade }
+ t.references :vulnerability_finding_evidence_response, index: { name: 'finding_evidence_header_on_finding_evidence_response_id' }, null: true, foreign_key: { on_delete: :cascade }
+ t.text :name, null: false
+ t.text :value, null: false
+
+ t.text_limit :name, 255
+ t.text_limit :value, 8192
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :vulnerability_finding_evidence_headers
+ end
+ end
+end
diff --git a/db/migrate/20210507191949_add_remove_on_issue_close_to_labels.rb b/db/migrate/20210507191949_add_remove_on_issue_close_to_labels.rb
index 107388fe533..131edb20164 100644
--- a/db/migrate/20210507191949_add_remove_on_issue_close_to_labels.rb
+++ b/db/migrate/20210507191949_add_remove_on_issue_close_to_labels.rb
@@ -1,17 +1,11 @@
# frozen_string_literal: true
class AddRemoveOnIssueCloseToLabels < ActiveRecord::Migration[6.0]
- include Gitlab::Database::MigrationHelpers
+ # This migration was reverted in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62056
def up
- with_lock_retries do
- add_column :labels, :remove_on_close, :boolean, null: false, default: false
- end
end
def down
- with_lock_retries do
- remove_column :labels, :remove_on_close, :boolean
- end
end
end
diff --git a/db/migrate/20210510083845_add_sha_to_status_check_response.rb b/db/migrate/20210510083845_add_sha_to_status_check_response.rb
new file mode 100644
index 00000000000..202f5ca00c1
--- /dev/null
+++ b/db/migrate/20210510083845_add_sha_to_status_check_response.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddShaToStatusCheckResponse < ActiveRecord::Migration[6.0]
+ def up
+ execute('DELETE FROM status_check_responses')
+
+ add_column :status_check_responses, :sha, :binary, null: false # rubocop:disable Rails/NotNullColumn
+ end
+
+ def down
+ remove_column :status_check_responses, :sha
+ end
+end
diff --git a/db/migrate/20210511165250_add_foreign_key_to_lfs_objects_projects.rb b/db/migrate/20210511165250_add_foreign_key_to_lfs_objects_projects.rb
new file mode 100644
index 00000000000..4163499a553
--- /dev/null
+++ b/db/migrate/20210511165250_add_foreign_key_to_lfs_objects_projects.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToLfsObjectsProjects < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :lfs_objects_projects, :lfs_objects, column: :lfs_object_id, on_delete: :restrict, validate: false
+ add_concurrent_foreign_key :lfs_objects_projects, :projects, column: :project_id, on_delete: :cascade, validate: false
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :lfs_objects_projects, column: :lfs_object_id
+ remove_foreign_key :lfs_objects_projects, column: :project_id
+ end
+ end
+end
diff --git a/db/migrate/20210512120122_add_pending_builds_table.rb b/db/migrate/20210512120122_add_pending_builds_table.rb
new file mode 100644
index 00000000000..38e13d43b38
--- /dev/null
+++ b/db/migrate/20210512120122_add_pending_builds_table.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddPendingBuildsTable < ActiveRecord::Migration[6.0]
+ def up
+ create_table :ci_pending_builds do |t|
+ t.references :build, index: { unique: true }, null: false, foreign_key: { to_table: :ci_builds, on_delete: :cascade }
+ t.references :project, index: true, null: false, foreign_key: { on_delete: :cascade }
+ t.datetime_with_timezone :created_at, null: false, default: -> { 'NOW()' }
+ end
+ end
+
+ def down
+ drop_table :ci_pending_builds
+ end
+end
diff --git a/db/migrate/20210517130723_make_snapshot_segment_id_optional.rb b/db/migrate/20210517130723_make_snapshot_segment_id_optional.rb
new file mode 100644
index 00000000000..a05be71a243
--- /dev/null
+++ b/db/migrate/20210517130723_make_snapshot_segment_id_optional.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class MakeSnapshotSegmentIdOptional < ActiveRecord::Migration[6.0]
+ def up
+ change_column_null(:analytics_devops_adoption_snapshots, :segment_id, true)
+ end
+
+ def down
+ change_column_null(:analytics_devops_adoption_snapshots, :segment_id, false)
+ end
+end
diff --git a/db/migrate/20210517144856_require_snapshot_namespace.rb b/db/migrate/20210517144856_require_snapshot_namespace.rb
new file mode 100644
index 00000000000..ec25c13383f
--- /dev/null
+++ b/db/migrate/20210517144856_require_snapshot_namespace.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+require Rails.root.join('db', 'post_migrate', '20210430134202_copy_adoption_snapshot_namespace.rb')
+
+class RequireSnapshotNamespace < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ CopyAdoptionSnapshotNamespace.new.up
+
+ add_not_null_constraint(:analytics_devops_adoption_snapshots, :namespace_id)
+ end
+
+ def down
+ remove_not_null_constraint(:analytics_devops_adoption_snapshots, :namespace_id)
+ end
+end
diff --git a/db/migrate/20210517221612_add_default_value_to_merge_requests_author_approval_on_projects.rb b/db/migrate/20210517221612_add_default_value_to_merge_requests_author_approval_on_projects.rb
new file mode 100644
index 00000000000..1c017a366c8
--- /dev/null
+++ b/db/migrate/20210517221612_add_default_value_to_merge_requests_author_approval_on_projects.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddDefaultValueToMergeRequestsAuthorApprovalOnProjects < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ change_column_default :projects, :merge_requests_author_approval, false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ change_column_default :projects, :merge_requests_author_approval, nil
+ end
+ end
+end
diff --git a/db/migrate/20210519132109_initialize_conversion_of_ci_builds_metadata_to_bigint.rb b/db/migrate/20210519132109_initialize_conversion_of_ci_builds_metadata_to_bigint.rb
new file mode 100644
index 00000000000..7ff0276b4b5
--- /dev/null
+++ b/db/migrate/20210519132109_initialize_conversion_of_ci_builds_metadata_to_bigint.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class InitializeConversionOfCiBuildsMetadataToBigint < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE = :ci_builds_metadata
+ COLUMN = :build_id
+
+ def up
+ initialize_conversion_of_integer_to_bigint(TABLE, COLUMN)
+ end
+
+ def down
+ revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMN)
+ end
+end
diff --git a/db/migrate/20210520102039_group_protected_environments_add_column.rb b/db/migrate/20210520102039_group_protected_environments_add_column.rb
new file mode 100644
index 00000000000..642e22c5f48
--- /dev/null
+++ b/db/migrate/20210520102039_group_protected_environments_add_column.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class GroupProtectedEnvironmentsAddColumn < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ add_column :protected_environments, :group_id, :bigint
+ change_column_null :protected_environments, :project_id, true
+ end
+
+ def down
+ change_column_null :protected_environments, :project_id, false
+ remove_column :protected_environments, :group_id
+ end
+end
diff --git a/db/migrate/20210520133032_initialize_conversion_of_taggings_to_bigint.rb b/db/migrate/20210520133032_initialize_conversion_of_taggings_to_bigint.rb
new file mode 100644
index 00000000000..e154c25b082
--- /dev/null
+++ b/db/migrate/20210520133032_initialize_conversion_of_taggings_to_bigint.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class InitializeConversionOfTaggingsToBigint < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE = :taggings
+ COLUMNS = %i(id taggable_id)
+
+ def up
+ initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
+ end
+
+ def down
+ revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
+ end
+end
diff --git a/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb b/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb
new file mode 100644
index 00000000000..63ac308e4be
--- /dev/null
+++ b/db/migrate/20210520133440_backfill_taggings_for_bigint_conversion.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class BackfillTaggingsForBigintConversion < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE = :taggings
+ COLUMNS = %i(id taggable_id)
+
+ def up
+ backfill_conversion_of_integer_to_bigint TABLE, COLUMNS, batch_size: 15000, sub_batch_size: 100
+ end
+
+ def down
+ revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
+ end
+end
diff --git a/db/migrate/20210521073920_drop_devops_adoption_namespace_uniqueness.rb b/db/migrate/20210521073920_drop_devops_adoption_namespace_uniqueness.rb
new file mode 100644
index 00000000000..d255ce844e2
--- /dev/null
+++ b/db/migrate/20210521073920_drop_devops_adoption_namespace_uniqueness.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class DropDevopsAdoptionNamespaceUniqueness < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_analytics_devops_adoption_segments_on_namespace_id'
+ NEW_INDEX_NAME = 'idx_analytics_devops_adoption_segments_on_namespace_id'
+
+ def up
+ add_concurrent_index :analytics_devops_adoption_segments, :namespace_id, name: NEW_INDEX_NAME
+ remove_concurrent_index_by_name :analytics_devops_adoption_segments, INDEX_NAME
+ end
+
+ def down
+ # Clean up duplicated records
+ execute "DELETE FROM analytics_devops_adoption_segments WHERE id NOT IN (SELECT MIN(id) FROM analytics_devops_adoption_segments GROUP BY namespace_id)"
+
+ add_concurrent_index :analytics_devops_adoption_segments, :namespace_id, name: INDEX_NAME, unique: true
+ remove_concurrent_index_by_name :analytics_devops_adoption_segments, NEW_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210525085158_initialize_conversion_of_deployments_to_bigint.rb b/db/migrate/20210525085158_initialize_conversion_of_deployments_to_bigint.rb
new file mode 100644
index 00000000000..70775eb3bb5
--- /dev/null
+++ b/db/migrate/20210525085158_initialize_conversion_of_deployments_to_bigint.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class InitializeConversionOfDeploymentsToBigint < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE = :deployments
+ COLUMNS = %i(deployable_id)
+
+ def up
+ initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
+ end
+
+ def down
+ revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
+ end
+end
diff --git a/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb b/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb
new file mode 100644
index 00000000000..6de89cadef8
--- /dev/null
+++ b/db/migrate/20210525085325_backfill_deployments_for_bigint_conversion.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class BackfillDeploymentsForBigintConversion < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE = :deployments
+ COLUMNS = %i(deployable_id)
+
+ def up
+ backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
+ end
+
+ def down
+ revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
+ end
+end
diff --git a/db/migrate/20210525100539_initialize_conversion_of_geo_job_artifact_deleted_events_to_bigint.rb b/db/migrate/20210525100539_initialize_conversion_of_geo_job_artifact_deleted_events_to_bigint.rb
new file mode 100644
index 00000000000..3e8bcf1851a
--- /dev/null
+++ b/db/migrate/20210525100539_initialize_conversion_of_geo_job_artifact_deleted_events_to_bigint.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class InitializeConversionOfGeoJobArtifactDeletedEventsToBigint < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE = :geo_job_artifact_deleted_events
+ COLUMNS = %i(job_artifact_id)
+
+ def up
+ initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
+ end
+
+ def down
+ revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
+ end
+end
diff --git a/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb b/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb
new file mode 100644
index 00000000000..eab79a33006
--- /dev/null
+++ b/db/migrate/20210525100603_backfill_geo_job_artifact_deleted_events_for_bigint_conversion.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class BackfillGeoJobArtifactDeletedEventsForBigintConversion < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE = :geo_job_artifact_deleted_events
+ COLUMNS = %i(job_artifact_id)
+
+ def up
+ backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
+ end
+
+ def down
+ revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
+ end
+end
diff --git a/db/migrate/20210525184900_add_latest_pipeline_id_into_vulnerability_statistics_table.rb b/db/migrate/20210525184900_add_latest_pipeline_id_into_vulnerability_statistics_table.rb
new file mode 100644
index 00000000000..508ad92f9e5
--- /dev/null
+++ b/db/migrate/20210525184900_add_latest_pipeline_id_into_vulnerability_statistics_table.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddLatestPipelineIdIntoVulnerabilityStatisticsTable < ActiveRecord::Migration[6.0]
+ def change
+ add_column :vulnerability_statistics, :latest_pipeline_id, :bigint
+ end
+end
diff --git a/db/migrate/20210526135911_create_ci_minutes_additional_packs.rb b/db/migrate/20210526135911_create_ci_minutes_additional_packs.rb
new file mode 100644
index 00000000000..3464268a77f
--- /dev/null
+++ b/db/migrate/20210526135911_create_ci_minutes_additional_packs.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class CreateCiMinutesAdditionalPacks < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ create_table_with_constraints :ci_minutes_additional_packs, if_not_exists: true do |t|
+ t.timestamps_with_timezone
+
+ t.references :namespace, index: false, null: false, foreign_key: { on_delete: :cascade }
+ t.date :expires_at, null: true
+ t.integer :number_of_minutes, null: false
+ t.text :purchase_xid, null: true
+ t.text_limit :purchase_xid, 32
+
+ t.index [:namespace_id, :purchase_xid], name: 'index_ci_minutes_additional_packs_on_namespace_id_purchase_xid'
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :ci_minutes_additional_packs
+ end
+ end
+end
diff --git a/db/migrate/20210526155257_rename_sync_security_report_approval_rules_sidekiq_queue.rb b/db/migrate/20210526155257_rename_sync_security_report_approval_rules_sidekiq_queue.rb
new file mode 100644
index 00000000000..b9cefe456b8
--- /dev/null
+++ b/db/migrate/20210526155257_rename_sync_security_report_approval_rules_sidekiq_queue.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class RenameSyncSecurityReportApprovalRulesSidekiqQueue < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ sidekiq_queue_migrate 'sync_security_reports_to_report_approval_rules', to: 'ci_sync_reports_to_report_approval_rules'
+ end
+
+ def down
+ sidekiq_queue_migrate 'ci_sync_reports_to_report_approval_rules', to: 'sync_security_reports_to_report_approval_rules'
+ end
+end
diff --git a/db/migrate/20210526181820_add_index_to_vulnerability_statistics_on_latest_pipeline_id.rb b/db/migrate/20210526181820_add_index_to_vulnerability_statistics_on_latest_pipeline_id.rb
new file mode 100644
index 00000000000..dd11b1e6f11
--- /dev/null
+++ b/db/migrate/20210526181820_add_index_to_vulnerability_statistics_on_latest_pipeline_id.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexToVulnerabilityStatisticsOnLatestPipelineId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'index_vulnerability_statistics_on_latest_pipeline_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :vulnerability_statistics, :latest_pipeline_id, name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :vulnerability_statistics, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210526181821_add_foreign_key_for_latest_pipeline_id_to_ci_pipelines.rb b/db/migrate/20210526181821_add_foreign_key_for_latest_pipeline_id_to_ci_pipelines.rb
new file mode 100644
index 00000000000..adcac5e2637
--- /dev/null
+++ b/db/migrate/20210526181821_add_foreign_key_for_latest_pipeline_id_to_ci_pipelines.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddForeignKeyForLatestPipelineIdToCiPipelines < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :vulnerability_statistics, :ci_pipelines, column: :latest_pipeline_id, on_delete: :nullify
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :vulnerability_statistics, :ci_pipelines
+ end
+ end
+end
diff --git a/db/migrate/20210526190259_add_ci_daily_pipeline_schedule_triggers_to_plan_limits.rb b/db/migrate/20210526190259_add_ci_daily_pipeline_schedule_triggers_to_plan_limits.rb
new file mode 100644
index 00000000000..074bec31160
--- /dev/null
+++ b/db/migrate/20210526190259_add_ci_daily_pipeline_schedule_triggers_to_plan_limits.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddCiDailyPipelineScheduleTriggersToPlanLimits < ActiveRecord::Migration[6.0]
+ def change
+ add_column(:plan_limits, :ci_daily_pipeline_schedule_triggers, :integer, default: 0, null: false)
+ end
+end
diff --git a/db/migrate/20210526190553_insert_ci_daily_pipeline_schedule_triggers_plan_limits.rb b/db/migrate/20210526190553_insert_ci_daily_pipeline_schedule_triggers_plan_limits.rb
new file mode 100644
index 00000000000..fe0969c15fb
--- /dev/null
+++ b/db/migrate/20210526190553_insert_ci_daily_pipeline_schedule_triggers_plan_limits.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class InsertCiDailyPipelineScheduleTriggersPlanLimits < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ EVERY_5_MINUTES = (1.day.in_minutes / 5).to_i
+ EVERY_HOUR = 1.day.in_hours.to_i
+
+ def up
+ return unless Gitlab.com?
+
+ create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'free', EVERY_HOUR)
+ create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'bronze', EVERY_5_MINUTES)
+ create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'silver', EVERY_5_MINUTES)
+ create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'gold', EVERY_5_MINUTES)
+ end
+
+ def down
+ return unless Gitlab.com?
+
+ create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'free', 0)
+ create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'bronze', 0)
+ create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'silver', 0)
+ create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'gold', 0)
+ end
+end
diff --git a/db/migrate/20210527065005_add_index_for_cadence_iterations_automation.rb b/db/migrate/20210527065005_add_index_for_cadence_iterations_automation.rb
new file mode 100644
index 00000000000..62ccdb6a4fd
--- /dev/null
+++ b/db/migrate/20210527065005_add_index_for_cadence_iterations_automation.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexForCadenceIterationsAutomation < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'cadence_create_iterations_automation'
+
+ disable_ddl_transaction!
+
+ def up
+ # no-op
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20210527130524_rename_experiment_subjects_group_id_to_namespace_id.rb b/db/migrate/20210527130524_rename_experiment_subjects_group_id_to_namespace_id.rb
new file mode 100644
index 00000000000..5f60a7f25c2
--- /dev/null
+++ b/db/migrate/20210527130524_rename_experiment_subjects_group_id_to_namespace_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class RenameExperimentSubjectsGroupIdToNamespaceId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers::V2
+
+ disable_ddl_transaction!
+
+ def up
+ rename_column_concurrently :experiment_subjects, :group_id, :namespace_id
+ end
+
+ def down
+ undo_rename_column_concurrently :experiment_subjects, :group_id, :namespace_id
+ end
+end
diff --git a/db/migrate/20210527133919_add_diff_max_lines_to_application_settings.rb b/db/migrate/20210527133919_add_diff_max_lines_to_application_settings.rb
new file mode 100644
index 00000000000..9c1cd94dbaa
--- /dev/null
+++ b/db/migrate/20210527133919_add_diff_max_lines_to_application_settings.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddDiffMaxLinesToApplicationSettings < ActiveRecord::Migration[6.0]
+ def change
+ add_column(:application_settings,
+ :diff_max_lines,
+ :integer,
+ default: 50000,
+ null: false)
+ end
+end
diff --git a/db/migrate/20210527134019_add_diff_max_files_to_application_settings.rb b/db/migrate/20210527134019_add_diff_max_files_to_application_settings.rb
new file mode 100644
index 00000000000..60b1f74cfd0
--- /dev/null
+++ b/db/migrate/20210527134019_add_diff_max_files_to_application_settings.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddDiffMaxFilesToApplicationSettings < ActiveRecord::Migration[6.0]
+ def change
+ add_column(:application_settings,
+ :diff_max_files,
+ :integer,
+ default: 1000,
+ null: false)
+ end
+end
diff --git a/db/migrate/20210527185542_add_prevent_sharing_groups_outside_hierarchy_to_namespace_settings.rb b/db/migrate/20210527185542_add_prevent_sharing_groups_outside_hierarchy_to_namespace_settings.rb
new file mode 100644
index 00000000000..8fb489ac537
--- /dev/null
+++ b/db/migrate/20210527185542_add_prevent_sharing_groups_outside_hierarchy_to_namespace_settings.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddPreventSharingGroupsOutsideHierarchyToNamespaceSettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ add_column :namespace_settings, :prevent_sharing_groups_outside_hierarchy, :boolean, null: false, default: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :namespace_settings, :prevent_sharing_groups_outside_hierarchy
+ end
+ end
+end
diff --git a/db/migrate/20210527194558_create_ci_job_token_project_scope_links.rb b/db/migrate/20210527194558_create_ci_job_token_project_scope_links.rb
new file mode 100644
index 00000000000..aaa94b9a231
--- /dev/null
+++ b/db/migrate/20210527194558_create_ci_job_token_project_scope_links.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class CreateCiJobTokenProjectScopeLinks < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ create_table :ci_job_token_project_scope_links, if_not_exists: true do |t|
+ t.belongs_to :source_project, index: false, null: false, foreign_key: { to_table: :projects, on_delete: :cascade }
+ t.belongs_to :target_project, null: false, foreign_key: { to_table: :projects, on_delete: :cascade }
+ t.belongs_to :added_by, foreign_key: { to_table: :users, on_delete: :nullify }
+ t.datetime_with_timezone :created_at, null: false
+
+ t.index [:source_project_id, :target_project_id], unique: true, name: 'i_ci_job_token_project_scope_links_on_source_and_target_project'
+ end
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :ci_job_token_project_scope_links, if_exists: true
+ end
+ end
+end
diff --git a/db/migrate/20210529164247_change_iterations_title_uniqueness_index.rb b/db/migrate/20210529164247_change_iterations_title_uniqueness_index.rb
new file mode 100644
index 00000000000..47e7e2c757d
--- /dev/null
+++ b/db/migrate/20210529164247_change_iterations_title_uniqueness_index.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class ChangeIterationsTitleUniquenessIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'index_sprints_on_iterations_cadence_id_and_title'
+ OLD_INDEX_NAME = 'index_sprints_on_group_id_and_title'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :sprints, [:iterations_cadence_id, :title], name: INDEX_NAME, unique: true
+ remove_concurrent_index_by_name :sprints, OLD_INDEX_NAME
+ end
+
+ def down
+ # noop
+ # rollback would not work as we can have duplicate records once the unique `index_sprints_on_group_id_and_title` index is removed
+ end
+end
diff --git a/db/migrate/20210531053916_rename_instance_statistics_measurements.rb b/db/migrate/20210531053916_rename_instance_statistics_measurements.rb
new file mode 100644
index 00000000000..9fd459b1275
--- /dev/null
+++ b/db/migrate/20210531053916_rename_instance_statistics_measurements.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class RenameInstanceStatisticsMeasurements < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ rename_table_safely(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
+ end
+
+ def down
+ undo_rename_table_safely(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
+ end
+end
diff --git a/db/migrate/20210531070452_default_enforce_ssh_key_expiration.rb b/db/migrate/20210531070452_default_enforce_ssh_key_expiration.rb
new file mode 100644
index 00000000000..8ddbb528962
--- /dev/null
+++ b/db/migrate/20210531070452_default_enforce_ssh_key_expiration.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class DefaultEnforceSshKeyExpiration < ActiveRecord::Migration[6.0]
+ def change
+ change_column_default(:application_settings, :enforce_ssh_key_expiration, from: false, to: true)
+ end
+end
diff --git a/db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb b/db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb
new file mode 100644
index 00000000000..c164183fbf8
--- /dev/null
+++ b/db/migrate/20210531071107_enable_enforce_ssh_key_expiration.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class EnableEnforceSshKeyExpiration < ActiveRecord::Migration[6.0]
+ class ApplicationSetting < ActiveRecord::Base
+ self.table_name = 'application_settings'
+ end
+
+ def up
+ ApplicationSetting.reset_column_information
+
+ ApplicationSetting.where.not(enforce_ssh_key_expiration: true).each do |application_setting|
+ application_setting.update!(enforce_ssh_key_expiration: true)
+ end
+ end
+end
diff --git a/db/migrate/20210601080039_group_protected_environments_add_index_and_constraint.rb b/db/migrate/20210601080039_group_protected_environments_add_index_and_constraint.rb
new file mode 100644
index 00000000000..611619e496c
--- /dev/null
+++ b/db/migrate/20210601080039_group_protected_environments_add_index_and_constraint.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class GroupProtectedEnvironmentsAddIndexAndConstraint < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'index_protected_environments_on_group_id_and_name'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :protected_environments, [:group_id, :name], unique: true,
+ name: INDEX_NAME, where: 'group_id IS NOT NULL'
+ add_concurrent_foreign_key :protected_environments, :namespaces, column: :group_id, on_delete: :cascade
+
+ add_check_constraint :protected_environments,
+ "((project_id IS NULL) != (group_id IS NULL))",
+ :protected_environments_project_or_group_existence
+ end
+
+ def down
+ remove_group_protected_environments!
+
+ remove_check_constraint :protected_environments, :protected_environments_project_or_group_existence
+ remove_foreign_key_if_exists :protected_environments, column: :group_id
+ remove_concurrent_index_by_name :protected_environments, name: INDEX_NAME
+ end
+
+ private
+
+ def remove_group_protected_environments!
+ execute <<-SQL
+ DELETE FROM protected_environments WHERE group_id IS NOT NULL
+ SQL
+ end
+end
diff --git a/db/migrate/20210601123341_add_running_builds_table.rb b/db/migrate/20210601123341_add_running_builds_table.rb
new file mode 100644
index 00000000000..4093619d2c3
--- /dev/null
+++ b/db/migrate/20210601123341_add_running_builds_table.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddRunningBuildsTable < ActiveRecord::Migration[6.0]
+ def up
+ create_table :ci_running_builds do |t|
+ t.references :build, index: { unique: true }, null: false, foreign_key: { to_table: :ci_builds, on_delete: :cascade }
+ t.references :project, index: true, null: false, foreign_key: { on_delete: :cascade }
+ t.references :runner, index: true, null: false, foreign_key: { to_table: :ci_runners, on_delete: :cascade }
+ t.datetime_with_timezone :created_at, null: false, default: -> { 'NOW()' }
+ t.integer :runner_type, limit: 2, null: false
+ end
+ end
+
+ def down
+ drop_table :ci_running_builds
+ end
+end
diff --git a/db/migrate/20210601125410_add_runners_created_at_index.rb b/db/migrate/20210601125410_add_runners_created_at_index.rb
new file mode 100644
index 00000000000..6a6be6d8480
--- /dev/null
+++ b/db/migrate/20210601125410_add_runners_created_at_index.rb
@@ -0,0 +1,20 @@
+# 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 AddRunnersCreatedAtIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_runners, [:created_at, :id], order: { id: :desc }, name: 'index_ci_runners_on_created_at_and_id_desc'
+ add_concurrent_index :ci_runners, [:created_at, :id], order: { created_at: :desc, id: :desc }, name: 'index_ci_runners_on_created_at_desc_and_id_desc'
+ end
+
+ def down
+ remove_concurrent_index :ci_runners, [:created_at, :id], order: { id: :desc }, name: 'index_ci_runners_on_created_at_and_id_desc'
+ remove_concurrent_index :ci_runners, [:created_at, :id], order: { created_at: :desc, id: :desc }, name: 'index_ci_runners_on_created_at_desc_and_id_desc'
+ end
+end
diff --git a/db/migrate/20210601131742_update_web_hook_calls_limit.rb b/db/migrate/20210601131742_update_web_hook_calls_limit.rb
new file mode 100644
index 00000000000..6af0facd17d
--- /dev/null
+++ b/db/migrate/20210601131742_update_web_hook_calls_limit.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class UpdateWebHookCallsLimit < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ return unless Gitlab.com?
+
+ create_or_update_plan_limit('web_hook_calls', 'free', 120)
+ end
+
+ def down
+ return unless Gitlab.com?
+
+ create_or_update_plan_limit('web_hook_calls', 'free', 0)
+ end
+end
diff --git a/db/migrate/20210601133459_replace_runners_contacted_at_index.rb b/db/migrate/20210601133459_replace_runners_contacted_at_index.rb
new file mode 100644
index 00000000000..a0a933721f0
--- /dev/null
+++ b/db/migrate/20210601133459_replace_runners_contacted_at_index.rb
@@ -0,0 +1,26 @@
+# 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 ReplaceRunnersContactedAtIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ OLD_INDEX_NAME = 'index_ci_runners_on_contacted_at'
+
+ def up
+ add_concurrent_index :ci_runners, [:contacted_at, :id], order: { id: :desc }, name: 'index_ci_runners_on_contacted_at_and_id_desc', using: 'btree'
+ add_concurrent_index :ci_runners, [:contacted_at, :id], order: { contacted_at: :desc, id: :desc }, name: 'index_ci_runners_on_contacted_at_desc_and_id_desc', using: 'btree'
+
+ remove_concurrent_index_by_name :ci_runners, OLD_INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_runners, 'index_ci_runners_on_contacted_at_and_id_desc'
+ remove_concurrent_index_by_name :ci_runners, 'index_ci_runners_on_contacted_at_desc_and_id_desc'
+
+ add_concurrent_index :ci_runners, :contacted_at, name: OLD_INDEX_NAME, using: 'btree'
+ end
+end
diff --git a/db/migrate/20210602122213_add_upcoming_reconciliations.rb b/db/migrate/20210602122213_add_upcoming_reconciliations.rb
new file mode 100644
index 00000000000..90d0013b357
--- /dev/null
+++ b/db/migrate/20210602122213_add_upcoming_reconciliations.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class AddUpcomingReconciliations < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ create_table :upcoming_reconciliations do |t|
+ t.references :namespace, index: { unique: true }, null: true, foreign_key: { on_delete: :cascade }
+ t.date :next_reconciliation_date, null: false
+ t.date :display_alert_from, null: false
+
+ t.timestamps_with_timezone
+ end
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :upcoming_reconciliations
+ end
+ end
+end
diff --git a/db/migrate/20210602122233_add_runners_description_index.rb b/db/migrate/20210602122233_add_runners_description_index.rb
new file mode 100644
index 00000000000..ae779e62f0f
--- /dev/null
+++ b/db/migrate/20210602122233_add_runners_description_index.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddRunnersDescriptionIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'index_ci_runners_on_description_trigram'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_runners, :description, name: INDEX_NAME, using: :gin, opclass: { description: :gin_trgm_ops }
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_runners, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210603140302_add_pronouns_to_user_details.rb b/db/migrate/20210603140302_add_pronouns_to_user_details.rb
new file mode 100644
index 00000000000..f28d45bdf6f
--- /dev/null
+++ b/db/migrate/20210603140302_add_pronouns_to_user_details.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddPronounsToUserDetails < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in 20210607050531_add_text_limit_to_user_details_pronouns
+ with_lock_retries do
+ add_column :user_details, :pronouns, :text, null: true
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :user_details, :pronouns
+ end
+ end
+end
diff --git a/db/migrate/20210603222333_remove_builds_email_service_from_services.rb b/db/migrate/20210603222333_remove_builds_email_service_from_services.rb
new file mode 100644
index 00000000000..791b8b659af
--- /dev/null
+++ b/db/migrate/20210603222333_remove_builds_email_service_from_services.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class RemoveBuildsEmailServiceFromServices < ActiveRecord::Migration[6.1]
+ def up
+ execute("DELETE from services WHERE type = 'BuildsEmailService'")
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20210604082145_create_external_status_checks_table.rb b/db/migrate/20210604082145_create_external_status_checks_table.rb
new file mode 100644
index 00000000000..c1ad3df6c9e
--- /dev/null
+++ b/db/migrate/20210604082145_create_external_status_checks_table.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+class CreateExternalStatusChecksTable < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
+ def up
+ create_table_with_constraints :external_status_checks, if_not_exists: true do |t|
+ t.references :project, foreign_key: { on_delete: :cascade }, null: false, index: false
+ t.timestamps_with_timezone
+ t.text :external_url, null: false
+ t.text_limit :external_url, 255
+ t.text :name, null: false
+ t.text_limit :name, 255
+
+ t.index([:project_id, :name],
+ unique: true,
+ name: 'idx_on_external_status_checks_project_id_name')
+ t.index([:project_id, :external_url],
+ unique: true,
+ name: 'idx_on_external_status_checks_project_id_external_url')
+ end
+
+ create_table :external_status_checks_protected_branches do |t|
+ t.bigint :external_status_check_id, null: false
+ t.bigint :protected_branch_id, null: false
+
+ t.index :external_status_check_id, name: 'index_esc_protected_branches_on_external_status_check_id'
+ t.index :protected_branch_id, name: 'index_esc_protected_branches_on_protected_branch_id'
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :external_status_checks_protected_branches, force: :cascade, if_exists: true
+ end
+
+ with_lock_retries do
+ drop_table :external_status_checks, force: :cascade, if_exists: true
+ end
+ end
+end
diff --git a/db/migrate/20210604085600_rename_status_check_responses_approval_rule.rb b/db/migrate/20210604085600_rename_status_check_responses_approval_rule.rb
new file mode 100644
index 00000000000..a12aef9455d
--- /dev/null
+++ b/db/migrate/20210604085600_rename_status_check_responses_approval_rule.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+class RenameStatusCheckResponsesApprovalRule < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ execute('DELETE FROM status_check_responses')
+
+ unless column_exists?(:status_check_responses, :external_status_check_id)
+ add_column :status_check_responses, :external_status_check_id, :bigint, null: false # rubocop:disable Rails/NotNullColumn
+ end
+
+ add_concurrent_foreign_key :status_check_responses, :external_status_checks, column: :external_status_check_id, on_delete: :cascade
+ add_concurrent_foreign_key :status_check_responses, :merge_requests, column: :merge_request_id, on_delete: :cascade
+
+ add_concurrent_index :status_check_responses, :external_status_check_id
+
+ # Setting this to true so that we can remove the column in a future release once the column has been removed. It has been ignored in 14.0
+ change_column_null :status_check_responses, :external_approval_rule_id, true
+
+ with_lock_retries do
+ remove_foreign_key :status_check_responses, :external_approval_rules
+ end
+ end
+
+ def down
+ change_column_null :status_check_responses, :external_approval_rule_id, false
+ with_lock_retries do
+ add_foreign_key :status_check_responses, :external_approval_rules
+ end
+ remove_column :status_check_responses, :external_status_check_id
+ end
+end
diff --git a/db/migrate/20210607050531_add_text_limit_to_user_details_pronouns.rb b/db/migrate/20210607050531_add_text_limit_to_user_details_pronouns.rb
new file mode 100644
index 00000000000..41c543e5deb
--- /dev/null
+++ b/db/migrate/20210607050531_add_text_limit_to_user_details_pronouns.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddTextLimitToUserDetailsPronouns < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :user_details, :pronouns, 50
+ end
+
+ def down
+ remove_text_limit :user_details, :pronouns
+ end
+end
diff --git a/db/migrate/20210607080044_remove_temporary_index_on_security_findings_scan_id.rb b/db/migrate/20210607080044_remove_temporary_index_on_security_findings_scan_id.rb
new file mode 100644
index 00000000000..5357059f475
--- /dev/null
+++ b/db/migrate/20210607080044_remove_temporary_index_on_security_findings_scan_id.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveTemporaryIndexOnSecurityFindingsScanId < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'tmp_index_on_security_findings_scan_id'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :security_findings, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :security_findings, :scan_id, where: 'uuid is null', name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210607154719_add_job_token_scope_enabled_to_ci_cd_settings.rb b/db/migrate/20210607154719_add_job_token_scope_enabled_to_ci_cd_settings.rb
new file mode 100644
index 00000000000..20b9e8d95ee
--- /dev/null
+++ b/db/migrate/20210607154719_add_job_token_scope_enabled_to_ci_cd_settings.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddJobTokenScopeEnabledToCiCdSettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ add_column :project_ci_cd_settings, :job_token_scope_enabled, :boolean, default: false, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :project_ci_cd_settings, :job_token_scope_enabled
+ end
+ end
+end
diff --git a/db/migrate/20210608072312_initialize_conversion_of_ci_stages_to_bigint.rb b/db/migrate/20210608072312_initialize_conversion_of_ci_stages_to_bigint.rb
new file mode 100644
index 00000000000..490a7f2e960
--- /dev/null
+++ b/db/migrate/20210608072312_initialize_conversion_of_ci_stages_to_bigint.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class InitializeConversionOfCiStagesToBigint < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE = :ci_stages
+ COLUMNS = %i(id)
+
+ def up
+ initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
+ end
+
+ def down
+ revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
+ end
+end
diff --git a/db/migrate/20210608072346_backfill_ci_stages_for_bigint_conversion.rb b/db/migrate/20210608072346_backfill_ci_stages_for_bigint_conversion.rb
new file mode 100644
index 00000000000..6376305c784
--- /dev/null
+++ b/db/migrate/20210608072346_backfill_ci_stages_for_bigint_conversion.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class BackfillCiStagesForBigintConversion < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE = :ci_stages
+ COLUMNS = %i(id)
+
+ def up
+ backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS)
+ end
+
+ def down
+ revert_backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS)
+ end
+end
diff --git a/db/migrate/20210609013512_add_unique_index_for_batched_background_migrations.rb b/db/migrate/20210609013512_add_unique_index_for_batched_background_migrations.rb
new file mode 100644
index 00000000000..28214aedce6
--- /dev/null
+++ b/db/migrate/20210609013512_add_unique_index_for_batched_background_migrations.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class AddUniqueIndexForBatchedBackgroundMigrations < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = :batched_background_migrations
+ INDEX_NAME = 'index_batched_background_migrations_on_unique_configuration'
+ REDUNDANT_INDEX_NAME = 'index_batched_migrations_on_job_table_and_column_name'
+
+ def up
+ add_concurrent_index TABLE_NAME,
+ %i[job_class_name table_name column_name job_arguments],
+ unique: true,
+ name: INDEX_NAME
+
+ remove_concurrent_index_by_name TABLE_NAME, REDUNDANT_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index TABLE_NAME,
+ %i[job_class_name table_name column_name],
+ name: REDUNDANT_INDEX_NAME
+
+ remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210609090856_add_expiry_id_ssh_key_notification_index.rb b/db/migrate/20210609090856_add_expiry_id_ssh_key_notification_index.rb
new file mode 100644
index 00000000000..406bbe2095f
--- /dev/null
+++ b/db/migrate/20210609090856_add_expiry_id_ssh_key_notification_index.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddExpiryIdSshKeyNotificationIndex < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_keys_on_expires_at_and_id'
+
+ def up
+ add_concurrent_index :keys,
+ "date(timezone('UTC', expires_at)), id",
+ 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/20210609192728_add_status_check_foreign_key_to_external_status_check_id.rb b/db/migrate/20210609192728_add_status_check_foreign_key_to_external_status_check_id.rb
new file mode 100644
index 00000000000..461d5838aed
--- /dev/null
+++ b/db/migrate/20210609192728_add_status_check_foreign_key_to_external_status_check_id.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddStatusCheckForeignKeyToExternalStatusCheckId < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :external_status_checks_protected_branches, :external_status_checks, column: :external_status_check_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :external_status_checks_protected_branches, column: :external_status_check_id
+ end
+ end
+end
diff --git a/db/migrate/20210609193101_add_status_check_foreign_key_to_protected_branch_id.rb b/db/migrate/20210609193101_add_status_check_foreign_key_to_protected_branch_id.rb
new file mode 100644
index 00000000000..6eeee60ec3a
--- /dev/null
+++ b/db/migrate/20210609193101_add_status_check_foreign_key_to_protected_branch_id.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddStatusCheckForeignKeyToProtectedBranchId < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :external_status_checks_protected_branches, :protected_branches, column: :protected_branch_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :external_status_checks_protected_branches, column: :protected_branch_id
+ end
+ end
+end
diff --git a/db/migrate/20210610102410_add_protected_attribute_to_pending_builds.rb b/db/migrate/20210610102410_add_protected_attribute_to_pending_builds.rb
new file mode 100644
index 00000000000..026fa0d7043
--- /dev/null
+++ b/db/migrate/20210610102410_add_protected_attribute_to_pending_builds.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddProtectedAttributeToPendingBuilds < ActiveRecord::Migration[6.1]
+ def change
+ add_column :ci_pending_builds, :protected, :boolean, null: false, default: false
+ end
+end
diff --git a/db/migrate/20210611100359_rebuild_index_for_cadence_iterations_automation.rb b/db/migrate/20210611100359_rebuild_index_for_cadence_iterations_automation.rb
new file mode 100644
index 00000000000..ecd8bac22be
--- /dev/null
+++ b/db/migrate/20210611100359_rebuild_index_for_cadence_iterations_automation.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+class RebuildIndexForCadenceIterationsAutomation < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'cadence_create_iterations_automation'
+
+ disable_ddl_transaction!
+
+ def up
+ return if index_exists_and_is_valid?
+
+ remove_concurrent_index_by_name :iterations_cadences, INDEX_NAME
+
+ disable_statement_timeout do
+ execute(
+ <<-SQL
+ CREATE INDEX CONCURRENTLY #{INDEX_NAME} ON iterations_cadences
+ USING BTREE(automatic, duration_in_weeks, (DATE ((COALESCE("iterations_cadences"."last_run_date", DATE('01-01-1970')) + "iterations_cadences"."duration_in_weeks" * INTERVAL '1 week'))))
+ WHERE duration_in_weeks IS NOT NULL
+ SQL
+ )
+ end
+ end
+
+ def down
+ remove_concurrent_index_by_name :iterations_cadences, INDEX_NAME
+ end
+
+ def index_exists_and_is_valid?
+ execute(
+ <<-SQL
+ SELECT identifier
+ FROM postgres_indexes
+ WHERE identifier LIKE '%#{INDEX_NAME}' AND valid_index=TRUE
+ SQL
+ ).any?
+ end
+end
diff --git a/db/migrate/20210614131002_add_detection_method_to_vulnerabilities_finding.rb b/db/migrate/20210614131002_add_detection_method_to_vulnerabilities_finding.rb
new file mode 100644
index 00000000000..cc37c5f1020
--- /dev/null
+++ b/db/migrate/20210614131002_add_detection_method_to_vulnerabilities_finding.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddDetectionMethodToVulnerabilitiesFinding < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ add_column :vulnerability_occurrences, :detection_method, :smallint, null: false, default: 0
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :vulnerability_occurrences, :detection_method
+ end
+ end
+end
diff --git a/db/post_migrate/20190527194900_schedule_calculate_wiki_sizes.rb b/db/post_migrate/20190527194900_schedule_calculate_wiki_sizes.rb
index 04cf5906b61..f337390f10c 100644
--- a/db/post_migrate/20190527194900_schedule_calculate_wiki_sizes.rb
+++ b/db/post_migrate/20190527194900_schedule_calculate_wiki_sizes.rb
@@ -18,12 +18,12 @@ class ScheduleCalculateWikiSizes < ActiveRecord::Migration[5.0]
disable_ddl_transaction!
+ # Disabling this old migration because it should already run
+ # in 14.0. This will allow us to remove some `technical debt`
+ # in ProjectStatistics model, because of some columns
+ # not present by the time the migration is run.
def up
- queue_background_migration_jobs_by_range_at_intervals(
- ::ScheduleCalculateWikiSizes::ProjectStatistics.without_wiki_size,
- MIGRATION,
- BATCH_TIME,
- batch_size: BATCH_SIZE)
+ # no-op
end
def down
diff --git a/db/post_migrate/20210421163509_schedule_update_jira_tracker_data_deployment_type_based_on_url.rb b/db/post_migrate/20210421163509_schedule_update_jira_tracker_data_deployment_type_based_on_url.rb
new file mode 100644
index 00000000000..7d4d97acf58
--- /dev/null
+++ b/db/post_migrate/20210421163509_schedule_update_jira_tracker_data_deployment_type_based_on_url.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class ScheduleUpdateJiraTrackerDataDeploymentTypeBasedOnUrl < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ MIGRATION = 'UpdateJiraTrackerDataDeploymentTypeBasedOnUrl'
+ DELAY_INTERVAL = 2.minutes.to_i
+ BATCH_SIZE = 2_500
+
+ disable_ddl_transaction!
+
+ def up
+ say "Scheduling #{MIGRATION} jobs"
+ queue_background_migration_jobs_by_range_at_intervals(
+ define_batchable_model('jira_tracker_data'),
+ MIGRATION,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE
+ )
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210426225417_schedule_recalculate_uuid_on_vulnerabilities_occurrences2.rb b/db/post_migrate/20210426225417_schedule_recalculate_uuid_on_vulnerabilities_occurrences2.rb
new file mode 100644
index 00000000000..96eea2d5d77
--- /dev/null
+++ b/db/post_migrate/20210426225417_schedule_recalculate_uuid_on_vulnerabilities_occurrences2.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class ScheduleRecalculateUuidOnVulnerabilitiesOccurrences2 < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ MIGRATION = 'RecalculateVulnerabilitiesOccurrencesUuid'
+ DELAY_INTERVAL = 2.minutes.to_i
+ BATCH_SIZE = 2_500
+
+ disable_ddl_transaction!
+
+ class VulnerabilitiesFinding < ActiveRecord::Base
+ include ::EachBatch
+ self.inheritance_column = :_type_disabled
+
+ self.table_name = "vulnerability_occurrences"
+ end
+
+ def up
+ # Make sure that RemoveDuplicateVulnerabilitiesFindings has finished running
+ # so that we don't run into duplicate UUID issues
+ Gitlab::BackgroundMigration.steal('RemoveDuplicateVulnerabilitiesFindings')
+
+ say "Scheduling #{MIGRATION} jobs"
+ queue_background_migration_jobs_by_range_at_intervals(
+ VulnerabilitiesFinding,
+ MIGRATION,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ track_jobs: true
+ )
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210430121542_backfill_ci_build_trace_sections_for_bigint_conversion.rb b/db/post_migrate/20210430121542_backfill_ci_build_trace_sections_for_bigint_conversion.rb
new file mode 100644
index 00000000000..f832b06d439
--- /dev/null
+++ b/db/post_migrate/20210430121542_backfill_ci_build_trace_sections_for_bigint_conversion.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class BackfillCiBuildTraceSectionsForBigintConversion < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE = :ci_build_trace_sections
+ COLUMN = :build_id
+
+ def up
+ backfill_conversion_of_integer_to_bigint TABLE, COLUMN, batch_size: 15000, sub_batch_size: 100, primary_key: COLUMN
+ end
+
+ def down
+ revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMN, primary_key: COLUMN
+ end
+end
diff --git a/db/post_migrate/20210513163904_cleanup_move_container_registry_enabled_to_project_feature.rb b/db/post_migrate/20210513163904_cleanup_move_container_registry_enabled_to_project_feature.rb
new file mode 100644
index 00000000000..665d274a0ee
--- /dev/null
+++ b/db/post_migrate/20210513163904_cleanup_move_container_registry_enabled_to_project_feature.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+class CleanupMoveContainerRegistryEnabledToProjectFeature < ActiveRecord::Migration[6.0]
+ MIGRATION = 'MoveContainerRegistryEnabledToProjectFeature'
+
+ disable_ddl_transaction!
+
+ def up
+ Gitlab::BackgroundMigration.steal(MIGRATION)
+
+ bg_migration_job_class = define_background_migration_jobs_class
+ bg_migration_job_class.where(class_name: MIGRATION, status: bg_migration_job_class.statuses['pending']).each do |job|
+ Gitlab::BackgroundMigration::MoveContainerRegistryEnabledToProjectFeature.new.perform(*job.arguments)
+ end
+
+ bg_migration_job_class.where(class_name: MIGRATION).delete_all
+ end
+
+ def down
+ # no-op
+ end
+
+ private
+
+ def define_background_migration_jobs_class
+ Class.new(ActiveRecord::Base) do
+ self.table_name = 'background_migration_jobs'
+ self.inheritance_column = :_type_disabled
+
+ enum status: {
+ pending: 0,
+ succeeded: 1
+ }
+ end
+ end
+end
diff --git a/db/post_migrate/20210514063252_schedule_cleanup_orphaned_lfs_objects_projects.rb b/db/post_migrate/20210514063252_schedule_cleanup_orphaned_lfs_objects_projects.rb
new file mode 100644
index 00000000000..76e4a0a95bb
--- /dev/null
+++ b/db/post_migrate/20210514063252_schedule_cleanup_orphaned_lfs_objects_projects.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class ScheduleCleanupOrphanedLfsObjectsProjects < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ MIGRATION = 'CleanupOrphanedLfsObjectsProjects'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 50_000
+
+ disable_ddl_transaction!
+
+ class LfsObjectsProject < ActiveRecord::Base
+ self.table_name = 'lfs_objects_projects'
+
+ include ::EachBatch
+ end
+
+ def up
+ queue_background_migration_jobs_by_range_at_intervals(LfsObjectsProject, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE)
+ end
+
+ def down
+ # NOOP
+ end
+end
diff --git a/db/post_migrate/20210518074332_schedule_disable_expiration_policies_linked_to_no_container_images.rb b/db/post_migrate/20210518074332_schedule_disable_expiration_policies_linked_to_no_container_images.rb
new file mode 100644
index 00000000000..8583f8541c7
--- /dev/null
+++ b/db/post_migrate/20210518074332_schedule_disable_expiration_policies_linked_to_no_container_images.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class ScheduleDisableExpirationPoliciesLinkedToNoContainerImages < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ BATCH_SIZE = 30_000
+ DELAY = 2.minutes.freeze
+ DOWNTIME = false
+ MIGRATION = 'DisableExpirationPoliciesLinkedToNoContainerImages'
+
+ disable_ddl_transaction!
+
+ def up
+ queue_background_migration_jobs_by_range_at_intervals(
+ define_batchable_model('container_expiration_policies').where(enabled: true),
+ MIGRATION,
+ DELAY,
+ batch_size: BATCH_SIZE,
+ track_jobs: false,
+ primary_column_name: :project_id
+ )
+ end
+
+ def down
+ # this migration is irreversible
+
+ # we can't accuretaly know which policies were previously enabled during the background migration
+ end
+end
diff --git a/db/post_migrate/20210519104931_backfill_clusters_integration_prometheus_enabled.rb b/db/post_migrate/20210519104931_backfill_clusters_integration_prometheus_enabled.rb
new file mode 100644
index 00000000000..6cd9b1173b6
--- /dev/null
+++ b/db/post_migrate/20210519104931_backfill_clusters_integration_prometheus_enabled.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+class BackfillClustersIntegrationPrometheusEnabled < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ ApplicationRecord.connection.execute(<<~SQL.squish)
+ WITH executed_at AS (VALUES (TIMEZONE('UTC', NOW())))
+ INSERT INTO clusters_integration_prometheus(
+ cluster_id,
+ enabled,
+ encrypted_alert_manager_token,
+ encrypted_alert_manager_token_iv,
+ created_at,
+ updated_at
+ )
+ SELECT
+ cluster_id,
+ true,
+ encrypted_alert_manager_token,
+ encrypted_alert_manager_token_iv,
+ (table executed_at),
+ (table executed_at)
+ FROM clusters_applications_prometheus
+ WHERE status IN (
+ 3, /* installed */
+ 11 /* externally installed */
+ )
+ ON CONFLICT(cluster_id) DO UPDATE SET
+ enabled = true,
+ encrypted_alert_manager_token = EXCLUDED.encrypted_alert_manager_token,
+ encrypted_alert_manager_token_iv = EXCLUDED.encrypted_alert_manager_token_iv,
+ updated_at = (table executed_at)
+ SQL
+ end
+
+ def down
+ # Irreversible
+ end
+end
diff --git a/db/post_migrate/20210519132129_backfill_ci_builds_metadata_for_bigint_conversion.rb b/db/post_migrate/20210519132129_backfill_ci_builds_metadata_for_bigint_conversion.rb
new file mode 100644
index 00000000000..3aeabbcc0ad
--- /dev/null
+++ b/db/post_migrate/20210519132129_backfill_ci_builds_metadata_for_bigint_conversion.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class BackfillCiBuildsMetadataForBigintConversion < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ TABLE = :ci_builds_metadata
+ COLUMN = :build_id
+
+ def up
+ backfill_conversion_of_integer_to_bigint TABLE, COLUMN, batch_size: 15000, sub_batch_size: 100
+ end
+
+ def down
+ revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMN
+ end
+end
diff --git a/db/post_migrate/20210519220019_backfill_escalation_policies_for_oncall_schedules.rb b/db/post_migrate/20210519220019_backfill_escalation_policies_for_oncall_schedules.rb
new file mode 100644
index 00000000000..f972815cf67
--- /dev/null
+++ b/db/post_migrate/20210519220019_backfill_escalation_policies_for_oncall_schedules.rb
@@ -0,0 +1,89 @@
+# frozen_string_literal: true
+
+class BackfillEscalationPoliciesForOncallSchedules < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ # Creates a single new escalation policy for projects which have
+ # existing on-call schedules. Only one schedule is expected
+ # per project, but it is possible to have multiple.
+ #
+ # An escalation rule is created for each existing schedule,
+ # configured to immediately notify the schedule of an incoming
+ # alert payload unless the alert has already been acknowledged.
+ # For projects with multiple schedules, the name of the first saved
+ # schedule will be used for the policy's description.
+ #
+ # Skips projects which already have escalation policies & schedules.
+ #
+ # EX)
+ # For these existing records:
+ # Project #3
+ # IncidentManagement::OncallSchedules #13
+ # project_id: 3
+ # name: 'Awesome Schedule'
+ # description: null
+ # IncidentManagement::OncallSchedules #14
+ # project_id: 3
+ # name: '2ndary sched'
+ # description: 'Backup on-call'
+ #
+ # These will be inserted:
+ # EscalationPolicy #1
+ # project_id: 3
+ # name: 'On-call Escalation Policy'
+ # description: 'Immediately notify Awesome Schedule'
+ # EscalationRule #1
+ # policy_id: 1,
+ # oncall_schedule_id: 13
+ # status: 1 # Acknowledged status
+ # elapsed_time_seconds: 0
+ # EscalationRule #2
+ # policy_id: 1,
+ # oncall_schedule_id: 14
+ # status: 1 # Acknowledged status
+ # elapsed_time_seconds: 0
+ def up
+ ApplicationRecord.connection.exec_query(<<~SQL.squish)
+ WITH new_escalation_policies AS (
+ INSERT INTO incident_management_escalation_policies (
+ project_id,
+ name,
+ description
+ )
+ SELECT
+ DISTINCT ON (project_id) project_id,
+ 'On-call Escalation Policy',
+ CONCAT('Immediately notify ', name)
+ FROM incident_management_oncall_schedules
+ WHERE project_id NOT IN (
+ SELECT DISTINCT project_id
+ FROM incident_management_escalation_policies
+ )
+ ORDER BY project_id, id
+ RETURNING id, project_id
+ )
+
+ INSERT INTO incident_management_escalation_rules (
+ policy_id,
+ oncall_schedule_id,
+ status,
+ elapsed_time_seconds
+ )
+ SELECT
+ new_escalation_policies.id,
+ incident_management_oncall_schedules.id,
+ 1,
+ 0
+ FROM new_escalation_policies
+ INNER JOIN incident_management_oncall_schedules
+ ON new_escalation_policies.project_id = incident_management_oncall_schedules.project_id
+ SQL
+ end
+
+ # There is no way to distinguish between policies created
+ # via the backfill or as a result of a user creating a new
+ # on-call schedule.
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210520012430_backfill_pk_conversion_for_self_managed.rb b/db/post_migrate/20210520012430_backfill_pk_conversion_for_self_managed.rb
new file mode 100644
index 00000000000..d554b412420
--- /dev/null
+++ b/db/post_migrate/20210520012430_backfill_pk_conversion_for_self_managed.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+class BackfillPkConversionForSelfManaged < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ CONVERSIONS = [
+ { table: :events, columns: %i(id), sub_batch_size: 500 },
+ { table: :push_event_payloads, columns: %i(event_id), sub_batch_size: 2500, primary_key: :event_id },
+ { table: :ci_job_artifacts, columns: %i(id job_id), sub_batch_size: 2000 },
+ { table: :ci_sources_pipelines, columns: %i(source_job_id), sub_batch_size: 100 },
+ { table: :ci_build_needs, columns: %i(build_id), sub_batch_size: 1000 },
+ { table: :ci_builds, columns: %i(id stage_id), sub_batch_size: 250 },
+ { table: :ci_builds_runner_session, columns: %i(build_id), sub_batch_size: 5000 },
+ { table: :ci_build_trace_chunks, columns: %i(build_id), sub_batch_size: 1000 }
+ ]
+
+ def up
+ return unless should_run?
+
+ CONVERSIONS.each do |conversion|
+ backfill_conversion_of_integer_to_bigint(
+ conversion[:table], conversion[:columns],
+ sub_batch_size: conversion[:sub_batch_size], primary_key: conversion.fetch(:primary_key, :id)
+ )
+ end
+ end
+
+ def down
+ return unless should_run?
+
+ CONVERSIONS.each do |conversion|
+ revert_backfill_conversion_of_integer_to_bigint(
+ conversion[:table], conversion[:columns],
+ primary_key: conversion.fetch(:primary_key, :id)
+ )
+ end
+ end
+
+ private
+
+ def should_run?
+ !Gitlab.com?
+ end
+end
diff --git a/db/post_migrate/20210525075724_clean_up_pending_builds_table.rb b/db/post_migrate/20210525075724_clean_up_pending_builds_table.rb
new file mode 100644
index 00000000000..c380f15188a
--- /dev/null
+++ b/db/post_migrate/20210525075724_clean_up_pending_builds_table.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class CleanUpPendingBuildsTable < ActiveRecord::Migration[6.0]
+ include ::Gitlab::Database::DynamicModelHelpers
+
+ BATCH_SIZE = 1000
+
+ disable_ddl_transaction!
+
+ def up
+ return unless Gitlab.dev_or_test_env? || Gitlab.com?
+
+ each_batch_range('ci_pending_builds', of: BATCH_SIZE) do |min, max|
+ execute <<~SQL
+ DELETE FROM ci_pending_builds
+ USING ci_builds
+ WHERE ci_builds.id = ci_pending_builds.build_id
+ AND ci_builds.status != 'pending'
+ AND ci_builds.type = 'Ci::Build'
+ AND ci_pending_builds.id BETWEEN #{min} AND #{max}
+ SQL
+ end
+ end
+
+ def down
+ # noop
+ end
+end
diff --git a/db/post_migrate/20210526160133_remove_segment_selections_table.rb b/db/post_migrate/20210526160133_remove_segment_selections_table.rb
new file mode 100644
index 00000000000..02e981b40ba
--- /dev/null
+++ b/db/post_migrate/20210526160133_remove_segment_selections_table.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class RemoveSegmentSelectionsTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ drop_table :analytics_devops_adoption_segment_selections
+ end
+
+ def down
+ create_table :analytics_devops_adoption_segment_selections do |t|
+ t.references :segment, index: { name: 'index_on_segment_selections_segment_id' }, null: false, foreign_key: { to_table: :analytics_devops_adoption_segments, on_delete: :cascade }
+ t.bigint :group_id
+ t.bigint :project_id
+ t.index [:group_id, :segment_id], unique: true, name: 'index_on_segment_selections_group_id_segment_id'
+ t.index [:project_id, :segment_id], unique: true, name: 'index_on_segment_selections_project_id_segment_id'
+
+ t.timestamps_with_timezone
+ end
+ add_concurrent_foreign_key(:analytics_devops_adoption_segment_selections, :projects, column: :project_id, on_delete: :cascade)
+ add_concurrent_foreign_key(:analytics_devops_adoption_segment_selections, :namespaces, column: :group_id, on_delete: :cascade)
+ add_check_constraint :analytics_devops_adoption_segment_selections, '(project_id != NULL AND group_id IS NULL) OR (group_id != NULL AND project_id IS NULL)', 'segment_selection_project_id_or_group_id_required'
+ end
+end
diff --git a/db/post_migrate/20210526222715_backfill_draft_status_on_merge_requests.rb b/db/post_migrate/20210526222715_backfill_draft_status_on_merge_requests.rb
new file mode 100644
index 00000000000..8ff0e306ad5
--- /dev/null
+++ b/db/post_migrate/20210526222715_backfill_draft_status_on_merge_requests.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class BackfillDraftStatusOnMergeRequests < ActiveRecord::Migration[6.0]
+ # include Gitlab::Database::MigrationHelpers
+
+ # Marking these as no-op as the original contents caused timeouts on
+ # staging. Removing the code here per
+ # #https://docs.gitlab.com/ee/development/deleting_migrations.html#how-to-disable-a-data-migration
+ # =>
+ def up
+ # no-op
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210527131039_clean_up_rename_experiment_subjects_group_id_to_namespace_id.rb b/db/post_migrate/20210527131039_clean_up_rename_experiment_subjects_group_id_to_namespace_id.rb
new file mode 100644
index 00000000000..6dec99c8acd
--- /dev/null
+++ b/db/post_migrate/20210527131039_clean_up_rename_experiment_subjects_group_id_to_namespace_id.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class CleanUpRenameExperimentSubjectsGroupIdToNamespaceId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers::V2
+
+ disable_ddl_transaction!
+
+ def up
+ cleanup_concurrent_column_rename :experiment_subjects, :group_id, :namespace_id
+ end
+
+ def down
+ undo_cleanup_concurrent_column_rename :experiment_subjects, :group_id, :namespace_id
+ end
+end
diff --git a/db/post_migrate/20210531054108_finalize_rename_instance_statistics_measurements.rb b/db/post_migrate/20210531054108_finalize_rename_instance_statistics_measurements.rb
new file mode 100644
index 00000000000..7aac4446c0c
--- /dev/null
+++ b/db/post_migrate/20210531054108_finalize_rename_instance_statistics_measurements.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class FinalizeRenameInstanceStatisticsMeasurements < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ finalize_table_rename(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
+ end
+
+ def down
+ undo_finalize_table_rename(:analytics_instance_statistics_measurements, :analytics_usage_trends_measurements)
+ end
+end
diff --git a/db/post_migrate/20210601073400_fix_total_stage_in_vsa.rb b/db/post_migrate/20210601073400_fix_total_stage_in_vsa.rb
new file mode 100644
index 00000000000..85302ee1d20
--- /dev/null
+++ b/db/post_migrate/20210601073400_fix_total_stage_in_vsa.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class FixTotalStageInVsa < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ TOTAL_STAGE = 'Total'
+
+ class GroupStage < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'analytics_cycle_analytics_group_stages'
+ end
+
+ def up
+ GroupStage.reset_column_information
+
+ GroupStage.each_batch(of: 100) do |relation|
+ relation.where(name: TOTAL_STAGE, custom: false).update_all(custom: true)
+ end
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210604070207_retry_backfill_traversal_ids.rb b/db/post_migrate/20210604070207_retry_backfill_traversal_ids.rb
new file mode 100644
index 00000000000..5e540c7f359
--- /dev/null
+++ b/db/post_migrate/20210604070207_retry_backfill_traversal_ids.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class RetryBackfillTraversalIds < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ ROOTS_MIGRATION = 'BackfillNamespaceTraversalIdsRoots'
+ CHILDREN_MIGRATION = 'BackfillNamespaceTraversalIdsChildren'
+ DOWNTIME = false
+ DELAY_INTERVAL = 2.minutes
+
+ disable_ddl_transaction!
+
+ def up
+ duration = requeue_background_migration_jobs_by_range_at_intervals(ROOTS_MIGRATION, DELAY_INTERVAL)
+ requeue_background_migration_jobs_by_range_at_intervals(CHILDREN_MIGRATION, DELAY_INTERVAL, initial_delay: duration)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210606143426_add_index_for_container_registry_access_level.rb b/db/post_migrate/20210606143426_add_index_for_container_registry_access_level.rb
new file mode 100644
index 00000000000..64d37054eb8
--- /dev/null
+++ b/db/post_migrate/20210606143426_add_index_for_container_registry_access_level.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+class AddIndexForContainerRegistryAccessLevel < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::SchemaHelpers
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX = 'index_project_features_on_project_id_include_container_registry'
+
+ def up
+ if index_exists_by_name?('project_features', INDEX)
+ Gitlab::AppLogger.warn "Index not created because it already exists (this may be due to an aborted migration or similar): table_name: project_features, index_name: #{INDEX}"
+ return
+ end
+
+ begin
+ disable_statement_timeout do
+ execute "CREATE UNIQUE INDEX CONCURRENTLY #{INDEX} ON project_features " \
+ 'USING btree (project_id) INCLUDE (container_registry_access_level)'
+ end
+ rescue ActiveRecord::StatementInvalid => ex
+ raise "The index #{INDEX} couldn't be added: #{ex.message}"
+ end
+
+ create_comment(
+ 'INDEX',
+ INDEX,
+ 'Included column (container_registry_access_level) improves performance of the ContainerRepository.for_group_and_its_subgroups scope query'
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name('project_features', INDEX)
+ end
+end
diff --git a/db/post_migrate/20210609125005_drop_non_partitioned_web_hook_logs.rb b/db/post_migrate/20210609125005_drop_non_partitioned_web_hook_logs.rb
new file mode 100644
index 00000000000..596b643e079
--- /dev/null
+++ b/db/post_migrate/20210609125005_drop_non_partitioned_web_hook_logs.rb
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+class DropNonPartitionedWebHookLogs < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+ include Gitlab::Database::PartitioningMigrationHelpers::TableManagementHelpers
+
+ DOWNTIME = false
+
+ def up
+ drop_nonpartitioned_archive_table(:web_hook_logs)
+ end
+
+ def down
+ execute(<<~SQL)
+ CREATE TABLE web_hook_logs_archived (
+ id integer NOT NULL,
+ web_hook_id integer NOT NULL,
+ trigger character varying,
+ url character varying,
+ request_headers text,
+ request_data text,
+ response_headers text,
+ response_body text,
+ response_status character varying,
+ execution_duration double precision,
+ internal_error_message character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+ );
+
+ ALTER TABLE ONLY web_hook_logs_archived ADD CONSTRAINT web_hook_logs_archived_pkey PRIMARY KEY (id);
+
+ CREATE INDEX index_web_hook_logs_on_created_at_and_web_hook_id ON web_hook_logs_archived USING btree (created_at, web_hook_id);
+ CREATE INDEX index_web_hook_logs_on_web_hook_id ON web_hook_logs_archived USING btree (web_hook_id);
+
+ ALTER TABLE ONLY web_hook_logs_archived ADD CONSTRAINT fk_rails_666826e111 FOREIGN KEY (web_hook_id) REFERENCES web_hooks(id) ON DELETE CASCADE;
+ SQL
+
+ with_lock_retries do
+ create_trigger_to_sync_tables(:web_hook_logs, :web_hook_logs_archived, 'id')
+ end
+ end
+end
diff --git a/db/post_migrate/20210610102413_migrate_protected_attribute_to_pending_builds.rb b/db/post_migrate/20210610102413_migrate_protected_attribute_to_pending_builds.rb
new file mode 100644
index 00000000000..f47ff244d7a
--- /dev/null
+++ b/db/post_migrate/20210610102413_migrate_protected_attribute_to_pending_builds.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class MigrateProtectedAttributeToPendingBuilds < ActiveRecord::Migration[6.1]
+ include ::Gitlab::Database::DynamicModelHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ return unless Gitlab.dev_or_test_env? || Gitlab.com?
+
+ each_batch_range('ci_pending_builds', of: 1000) do |min, max|
+ execute <<~SQL
+ UPDATE ci_pending_builds
+ SET protected = true
+ FROM ci_builds
+ WHERE ci_pending_builds.build_id = ci_builds.id
+ AND ci_builds.protected = true
+ AND ci_pending_builds.id BETWEEN #{min} AND #{max}
+ SQL
+ end
+ end
+
+ def down
+ # no op
+ end
+end
diff --git a/db/post_migrate/20210610113229_add_index_to_protected_pending_builds.rb b/db/post_migrate/20210610113229_add_index_to_protected_pending_builds.rb
new file mode 100644
index 00000000000..140bf7df4e6
--- /dev/null
+++ b/db/post_migrate/20210610113229_add_index_to_protected_pending_builds.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexToProtectedPendingBuilds < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'index_ci_pending_builds_id_on_protected_partial'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_pending_builds, :id, where: 'protected = true', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_pending_builds, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210610141711_disable_expiration_policies_linked_to_no_container_images.rb b/db/post_migrate/20210610141711_disable_expiration_policies_linked_to_no_container_images.rb
new file mode 100644
index 00000000000..f4827c0bbc0
--- /dev/null
+++ b/db/post_migrate/20210610141711_disable_expiration_policies_linked_to_no_container_images.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class DisableExpirationPoliciesLinkedToNoContainerImages < ActiveRecord::Migration[6.1]
+ disable_ddl_transaction!
+
+ BATCH_SIZE = 1000
+
+ class ContainerExpirationPolicy < ActiveRecord::Base
+ include ::EachBatch
+ self.table_name = 'container_expiration_policies'
+ end
+
+ def up
+ ContainerExpirationPolicy.where(enabled: true).each_batch(of: BATCH_SIZE) do |batch, _|
+ sql = <<-SQL
+ WITH batched_relation AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (#{batch.limit(BATCH_SIZE).to_sql})
+ UPDATE container_expiration_policies
+ SET enabled = FALSE
+ FROM batched_relation
+ WHERE container_expiration_policies.project_id = batched_relation.project_id
+ AND NOT EXISTS (SELECT 1 FROM "container_repositories" WHERE container_repositories.project_id = container_expiration_policies.project_id)
+ SQL
+ execute(sql)
+ end
+ end
+
+ def down
+ # no-op
+
+ # we can't accuretaly know which policies were previously enabled during `#up`
+ end
+end
diff --git a/db/post_migrate/20210611080951_fix_missing_traversal_ids.rb b/db/post_migrate/20210611080951_fix_missing_traversal_ids.rb
new file mode 100644
index 00000000000..45728ef26f5
--- /dev/null
+++ b/db/post_migrate/20210611080951_fix_missing_traversal_ids.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+class FixMissingTraversalIds < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ ROOTS_MIGRATION = 'BackfillNamespaceTraversalIdsRoots'
+ CHILDREN_MIGRATION = 'BackfillNamespaceTraversalIdsChildren'
+ DOWNTIME = false
+ BATCH_SIZE = 1_000
+ SUB_BATCH_SIZE = 50
+ DELAY_INTERVAL = 2.minutes
+ ROOT_NS_INDEX_NAME = 'tmp_index_namespaces_empty_traversal_ids_with_root_namespaces'
+ CHILD_INDEX_NAME = 'tmp_index_namespaces_empty_traversal_ids_with_child_namespaces'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :namespaces, :id, where: "parent_id IS NULL AND traversal_ids = '{}'", name: ROOT_NS_INDEX_NAME
+ add_concurrent_index :namespaces, :id, where: "parent_id IS NOT NULL AND traversal_ids = '{}'", name: CHILD_INDEX_NAME
+
+ # Personal namespaces and top-level groups
+ final_delay = queue_background_migration_jobs_by_range_at_intervals(
+ ::Gitlab::BackgroundMigration::BackfillNamespaceTraversalIdsRoots::Namespace.base_query.where("traversal_ids = '{}'"),
+ ROOTS_MIGRATION,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ other_job_arguments: [SUB_BATCH_SIZE],
+ track_jobs: true
+ )
+ final_delay += DELAY_INTERVAL
+
+ # Subgroups
+ queue_background_migration_jobs_by_range_at_intervals(
+ ::Gitlab::BackgroundMigration::BackfillNamespaceTraversalIdsChildren::Namespace.base_query.where("traversal_ids = '{}'"),
+ CHILDREN_MIGRATION,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ initial_delay: final_delay,
+ other_job_arguments: [SUB_BATCH_SIZE],
+ track_jobs: true
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name :namespaces, ROOT_NS_INDEX_NAME
+ remove_concurrent_index_by_name :namespaces, CHILD_INDEX_NAME
+ end
+end
diff --git a/db/schema_migrations/20210331000934 b/db/schema_migrations/20210331000934
new file mode 100644
index 00000000000..1d55b126d60
--- /dev/null
+++ b/db/schema_migrations/20210331000934
@@ -0,0 +1 @@
+0bd47f9055aab927a4e8efb4f995f44532880926af9892af60f7d2b8dcdef4a6 \ No newline at end of file
diff --git a/db/schema_migrations/20210421163509 b/db/schema_migrations/20210421163509
new file mode 100644
index 00000000000..b31e8209bbe
--- /dev/null
+++ b/db/schema_migrations/20210421163509
@@ -0,0 +1 @@
+0f6019cc094481cafbf0c9bd42f53ae09034ea87e3f360b02f9ec03192caab9d \ No newline at end of file
diff --git a/db/schema_migrations/20210426225417 b/db/schema_migrations/20210426225417
new file mode 100644
index 00000000000..2ba6e666520
--- /dev/null
+++ b/db/schema_migrations/20210426225417
@@ -0,0 +1 @@
+50d370d2465fa4c0d3c2bd963d5745474ca35a43609d0e754f3fe69eb7a7179f \ No newline at end of file
diff --git a/db/schema_migrations/20210430121522 b/db/schema_migrations/20210430121522
new file mode 100644
index 00000000000..0ad04fc386a
--- /dev/null
+++ b/db/schema_migrations/20210430121522
@@ -0,0 +1 @@
+feee3b817b18ab913071c29b5c6283d91268dc62b31ee2441c1cb116bf0d77c9 \ No newline at end of file
diff --git a/db/schema_migrations/20210430121542 b/db/schema_migrations/20210430121542
new file mode 100644
index 00000000000..40ad284a6ba
--- /dev/null
+++ b/db/schema_migrations/20210430121542
@@ -0,0 +1 @@
+00ac4ff6896f65d7ad7d259d7e5a39efcbf73b189f7c2c5a472f50aa45663235 \ No newline at end of file
diff --git a/db/schema_migrations/20210504143128 b/db/schema_migrations/20210504143128
new file mode 100644
index 00000000000..425120e633b
--- /dev/null
+++ b/db/schema_migrations/20210504143128
@@ -0,0 +1 @@
+e5b552b21c40b83b95442341838ad5951dcac7dd473194c49630d20ce6a46ae2 \ No newline at end of file
diff --git a/db/schema_migrations/20210505070612 b/db/schema_migrations/20210505070612
new file mode 100644
index 00000000000..454634cb74b
--- /dev/null
+++ b/db/schema_migrations/20210505070612
@@ -0,0 +1 @@
+52cc795e577a6de524cc55ce8d11f140e5d919f1164bb9983f7dd2c1ef2f0859 \ No newline at end of file
diff --git a/db/schema_migrations/20210505070812 b/db/schema_migrations/20210505070812
new file mode 100644
index 00000000000..ca53caa49af
--- /dev/null
+++ b/db/schema_migrations/20210505070812
@@ -0,0 +1 @@
+7d57e1fea3652c0c04d29261d3c21b314ed443c9e61b882d22ca7f59807c312b \ No newline at end of file
diff --git a/db/schema_migrations/20210505170152 b/db/schema_migrations/20210505170152
new file mode 100644
index 00000000000..d51d04bc6ab
--- /dev/null
+++ b/db/schema_migrations/20210505170152
@@ -0,0 +1 @@
+9b16e17189d4db708553ce0d9dada1ce097be75433c3a8c09a6102e897e3123a \ No newline at end of file
diff --git a/db/schema_migrations/20210506150833 b/db/schema_migrations/20210506150833
new file mode 100644
index 00000000000..e63559fee8a
--- /dev/null
+++ b/db/schema_migrations/20210506150833
@@ -0,0 +1 @@
+18fdca797ea7f3a60ce5b421bec7af1ea0b0b73fbf6e1c23592acbc9d13a0a52 \ No newline at end of file
diff --git a/db/schema_migrations/20210510083845 b/db/schema_migrations/20210510083845
new file mode 100644
index 00000000000..c3c67b9520e
--- /dev/null
+++ b/db/schema_migrations/20210510083845
@@ -0,0 +1 @@
+307e45d581c48b6f571fc8fa2a00dfd4360296560ee2b320540314b8f9f9e02c \ No newline at end of file
diff --git a/db/schema_migrations/20210511165250 b/db/schema_migrations/20210511165250
new file mode 100644
index 00000000000..d68bd28d356
--- /dev/null
+++ b/db/schema_migrations/20210511165250
@@ -0,0 +1 @@
+8f746d7eb604ae31a5941840d6a078eae2e4fa59b7185bf8cc0db9c55b463c33 \ No newline at end of file
diff --git a/db/schema_migrations/20210512120122 b/db/schema_migrations/20210512120122
new file mode 100644
index 00000000000..ad8640c6068
--- /dev/null
+++ b/db/schema_migrations/20210512120122
@@ -0,0 +1 @@
+1acc251417e3230c9b0a46e294cb9a6e8768f31978b8d4f439101f8de4e9269e \ No newline at end of file
diff --git a/db/schema_migrations/20210513163904 b/db/schema_migrations/20210513163904
new file mode 100644
index 00000000000..dc668704311
--- /dev/null
+++ b/db/schema_migrations/20210513163904
@@ -0,0 +1 @@
+3c4905fbe29227da7a2386f73d9df30e82da48efff24a1193ba3db0ac325cfcf \ No newline at end of file
diff --git a/db/schema_migrations/20210514063252 b/db/schema_migrations/20210514063252
new file mode 100644
index 00000000000..848265418d2
--- /dev/null
+++ b/db/schema_migrations/20210514063252
@@ -0,0 +1 @@
+7e52f9ba8470fd8c2e149fea723c9b06b92ecde2dac4db4512534b3e23952c61 \ No newline at end of file
diff --git a/db/schema_migrations/20210517130723 b/db/schema_migrations/20210517130723
new file mode 100644
index 00000000000..04e94d1b867
--- /dev/null
+++ b/db/schema_migrations/20210517130723
@@ -0,0 +1 @@
+3bcc5ae97f3185ea33e568f42b90d1bfd31ac7c5126dab4580b64bd9b4603721 \ No newline at end of file
diff --git a/db/schema_migrations/20210517144856 b/db/schema_migrations/20210517144856
new file mode 100644
index 00000000000..14d36163797
--- /dev/null
+++ b/db/schema_migrations/20210517144856
@@ -0,0 +1 @@
+1944c983dd384029cef6e456108a1ccfdb9c991c65343d3b7f26aff51f244816 \ No newline at end of file
diff --git a/db/schema_migrations/20210517221612 b/db/schema_migrations/20210517221612
new file mode 100644
index 00000000000..4078e0b44f0
--- /dev/null
+++ b/db/schema_migrations/20210517221612
@@ -0,0 +1 @@
+69e7297ace1301bbdb63053bd30b75c326122873fbc6c5c15f9f118166111434 \ No newline at end of file
diff --git a/db/schema_migrations/20210518074332 b/db/schema_migrations/20210518074332
new file mode 100644
index 00000000000..b5c7d33eec4
--- /dev/null
+++ b/db/schema_migrations/20210518074332
@@ -0,0 +1 @@
+9eb5e68b0d79863687530ff22cbe6a2bffd2e2d31237e919134b9ce77810b1a0 \ No newline at end of file
diff --git a/db/schema_migrations/20210519104931 b/db/schema_migrations/20210519104931
new file mode 100644
index 00000000000..82f84986924
--- /dev/null
+++ b/db/schema_migrations/20210519104931
@@ -0,0 +1 @@
+c31cb40b6251704c699e7fa3e7392bb9eb73fefcd5b0268e2b8fc58df9e6075e \ No newline at end of file
diff --git a/db/schema_migrations/20210519132109 b/db/schema_migrations/20210519132109
new file mode 100644
index 00000000000..9d8537aa6b2
--- /dev/null
+++ b/db/schema_migrations/20210519132109
@@ -0,0 +1 @@
+ba464ad09f3cec0e9cf94b3041ad946e3a5a8c915ce0b9f4f95ab49cb55d305d \ No newline at end of file
diff --git a/db/schema_migrations/20210519132129 b/db/schema_migrations/20210519132129
new file mode 100644
index 00000000000..da7a8212092
--- /dev/null
+++ b/db/schema_migrations/20210519132129
@@ -0,0 +1 @@
+8041e898177bdee3b4d1ad82ec7dd3b79cb7dd740f773cd91dc4306a87a397fd \ No newline at end of file
diff --git a/db/schema_migrations/20210519220019 b/db/schema_migrations/20210519220019
new file mode 100644
index 00000000000..c0578586e62
--- /dev/null
+++ b/db/schema_migrations/20210519220019
@@ -0,0 +1 @@
+6c687ffd41f242dcd0ecf1ff82652aba79130d2d54016729a817dafa0bac6184 \ No newline at end of file
diff --git a/db/schema_migrations/20210520012430 b/db/schema_migrations/20210520012430
new file mode 100644
index 00000000000..d92bc8d8369
--- /dev/null
+++ b/db/schema_migrations/20210520012430
@@ -0,0 +1 @@
+86b9f1c0f4288bf83e8b2d70b06b8951b7bcef0aa9324d9546471f6f094b014b \ No newline at end of file
diff --git a/db/schema_migrations/20210520102039 b/db/schema_migrations/20210520102039
new file mode 100644
index 00000000000..a850a5b07ca
--- /dev/null
+++ b/db/schema_migrations/20210520102039
@@ -0,0 +1 @@
+88d2c1507503de626dfdb3f2f0eaf0f51fad5fc2279fd147d901c5dcc7ae91eb \ No newline at end of file
diff --git a/db/schema_migrations/20210520133032 b/db/schema_migrations/20210520133032
new file mode 100644
index 00000000000..169203e33cd
--- /dev/null
+++ b/db/schema_migrations/20210520133032
@@ -0,0 +1 @@
+eddbcd18c17f9017a2cdfb6fc0144dcfcb539d3617271722b2918bdbe48c481a \ No newline at end of file
diff --git a/db/schema_migrations/20210520133440 b/db/schema_migrations/20210520133440
new file mode 100644
index 00000000000..d5644ab8927
--- /dev/null
+++ b/db/schema_migrations/20210520133440
@@ -0,0 +1 @@
+3ee15db28406522a5fb591395dd3d4a46b10e958339dc60ded3751e23096864d \ No newline at end of file
diff --git a/db/schema_migrations/20210521073920 b/db/schema_migrations/20210521073920
new file mode 100644
index 00000000000..e0ac7ff7f31
--- /dev/null
+++ b/db/schema_migrations/20210521073920
@@ -0,0 +1 @@
+ecef2157c20804acbad9d74df27febcf935f7f36920946fac211f3ef8b419f26 \ No newline at end of file
diff --git a/db/schema_migrations/20210525075724 b/db/schema_migrations/20210525075724
new file mode 100644
index 00000000000..539138e18a9
--- /dev/null
+++ b/db/schema_migrations/20210525075724
@@ -0,0 +1 @@
+5dc1119c5efe28225bb7ac8a9ed2c4c5cfaeaff202194ed4419cfd54eaf7483d \ No newline at end of file
diff --git a/db/schema_migrations/20210525085158 b/db/schema_migrations/20210525085158
new file mode 100644
index 00000000000..c16bb8edeb9
--- /dev/null
+++ b/db/schema_migrations/20210525085158
@@ -0,0 +1 @@
+a2ce644df46a13d65eb0d01931eeb8e9f43967daadf73eed2f033b6c275ca57d \ No newline at end of file
diff --git a/db/schema_migrations/20210525085325 b/db/schema_migrations/20210525085325
new file mode 100644
index 00000000000..38967a72899
--- /dev/null
+++ b/db/schema_migrations/20210525085325
@@ -0,0 +1 @@
+f085c9a7fc2209cf4d3797cda55c2be76b462eff456e7bf92de4545e0b988053 \ No newline at end of file
diff --git a/db/schema_migrations/20210525100539 b/db/schema_migrations/20210525100539
new file mode 100644
index 00000000000..31d93a231ed
--- /dev/null
+++ b/db/schema_migrations/20210525100539
@@ -0,0 +1 @@
+6568aa11d3652fb7ee23d2e6622a1038d891914f629438608993ff0d8b46b748 \ No newline at end of file
diff --git a/db/schema_migrations/20210525100603 b/db/schema_migrations/20210525100603
new file mode 100644
index 00000000000..645d7584d3d
--- /dev/null
+++ b/db/schema_migrations/20210525100603
@@ -0,0 +1 @@
+1a877c384c1e4e9e28a64c8c521aa72965c54d528044b076efdc75aeeb83d796 \ No newline at end of file
diff --git a/db/schema_migrations/20210525184900 b/db/schema_migrations/20210525184900
new file mode 100644
index 00000000000..5e507e7a363
--- /dev/null
+++ b/db/schema_migrations/20210525184900
@@ -0,0 +1 @@
+ae91ea7481ea21ce29b4c0697f77fd83017c36d913739ed67e5c907a48c56f69 \ No newline at end of file
diff --git a/db/schema_migrations/20210526135911 b/db/schema_migrations/20210526135911
new file mode 100644
index 00000000000..be8d46e3cb0
--- /dev/null
+++ b/db/schema_migrations/20210526135911
@@ -0,0 +1 @@
+9f3edf905be3bd3c7fe0149c9b97c68783590b808a96ad08873d983e3d901419 \ No newline at end of file
diff --git a/db/schema_migrations/20210526155257 b/db/schema_migrations/20210526155257
new file mode 100644
index 00000000000..ab3a611d341
--- /dev/null
+++ b/db/schema_migrations/20210526155257
@@ -0,0 +1 @@
+ec4cd687062118b30e516ed7c36677dda056f25c4d96c6ee0b503e457b5a18d4 \ No newline at end of file
diff --git a/db/schema_migrations/20210526160133 b/db/schema_migrations/20210526160133
new file mode 100644
index 00000000000..c61cc233c0e
--- /dev/null
+++ b/db/schema_migrations/20210526160133
@@ -0,0 +1 @@
+ee76ee2e2515c06b09fca23a77bdfb9532fa5d80fc3d5aba44a80d123b74cfa9 \ No newline at end of file
diff --git a/db/schema_migrations/20210526181820 b/db/schema_migrations/20210526181820
new file mode 100644
index 00000000000..b21e0c66d2a
--- /dev/null
+++ b/db/schema_migrations/20210526181820
@@ -0,0 +1 @@
+e72471e63dc108939473232437eda4c718382630c1173ae20023002d382e5ffa \ No newline at end of file
diff --git a/db/schema_migrations/20210526181821 b/db/schema_migrations/20210526181821
new file mode 100644
index 00000000000..055ae0886b3
--- /dev/null
+++ b/db/schema_migrations/20210526181821
@@ -0,0 +1 @@
+3c53d85bec154ec68a23841d37317d10fa6c7c846bc5f54f5b7876081105ac7b \ No newline at end of file
diff --git a/db/schema_migrations/20210526190259 b/db/schema_migrations/20210526190259
new file mode 100644
index 00000000000..0c7c7b88504
--- /dev/null
+++ b/db/schema_migrations/20210526190259
@@ -0,0 +1 @@
+ae2829a06f02ff3e1adc977f5e789b17d1f760e6aaa40be44586cc6a90870c4a \ No newline at end of file
diff --git a/db/schema_migrations/20210526190553 b/db/schema_migrations/20210526190553
new file mode 100644
index 00000000000..5998df03b1c
--- /dev/null
+++ b/db/schema_migrations/20210526190553
@@ -0,0 +1 @@
+824e0930de14587f6ccaeb6b5fbec16676d243550a2dfd3a5999b67dfc16d4c8 \ No newline at end of file
diff --git a/db/schema_migrations/20210526222715 b/db/schema_migrations/20210526222715
new file mode 100644
index 00000000000..905c6a1fcb5
--- /dev/null
+++ b/db/schema_migrations/20210526222715
@@ -0,0 +1 @@
+f80787d85538cedaba34cb204c98df2d0bbbf85f438d4df8f1187d2f4d881588 \ No newline at end of file
diff --git a/db/schema_migrations/20210527065005 b/db/schema_migrations/20210527065005
new file mode 100644
index 00000000000..23df046f302
--- /dev/null
+++ b/db/schema_migrations/20210527065005
@@ -0,0 +1 @@
+983b736defaa128f7466a784d2a06de293fa6b1cee76121e533e7966d19aad73 \ No newline at end of file
diff --git a/db/schema_migrations/20210527130524 b/db/schema_migrations/20210527130524
new file mode 100644
index 00000000000..611865047ef
--- /dev/null
+++ b/db/schema_migrations/20210527130524
@@ -0,0 +1 @@
+c0d6252fc768a431513754f7d51e61c5127f5573fefb278e7e1673dcd9e1b097 \ No newline at end of file
diff --git a/db/schema_migrations/20210527131039 b/db/schema_migrations/20210527131039
new file mode 100644
index 00000000000..acd89af497d
--- /dev/null
+++ b/db/schema_migrations/20210527131039
@@ -0,0 +1 @@
+c07ebd06892bacc936514798d970eb58ed08b6570049d2de07f787e93b5b3316 \ No newline at end of file
diff --git a/db/schema_migrations/20210527133919 b/db/schema_migrations/20210527133919
new file mode 100644
index 00000000000..559860de55d
--- /dev/null
+++ b/db/schema_migrations/20210527133919
@@ -0,0 +1 @@
+aaf5936c945451fa98df7c21ab34c9aa7190dcf301f536c259e5b1fe54407f36 \ No newline at end of file
diff --git a/db/schema_migrations/20210527134019 b/db/schema_migrations/20210527134019
new file mode 100644
index 00000000000..de757dd355e
--- /dev/null
+++ b/db/schema_migrations/20210527134019
@@ -0,0 +1 @@
+ac4522ee51d4a4cda317b680c16be3d9ef3e1619bba80c26aefe8d5dc70f013c \ No newline at end of file
diff --git a/db/schema_migrations/20210527185542 b/db/schema_migrations/20210527185542
new file mode 100644
index 00000000000..175fe5432e3
--- /dev/null
+++ b/db/schema_migrations/20210527185542
@@ -0,0 +1 @@
+56efe7709f07ffe198b4a2068c7e4b1ba8507a878cbc9ac3b1b30a334cbd83ca \ No newline at end of file
diff --git a/db/schema_migrations/20210527194558 b/db/schema_migrations/20210527194558
new file mode 100644
index 00000000000..089b97aa90e
--- /dev/null
+++ b/db/schema_migrations/20210527194558
@@ -0,0 +1 @@
+8c0661a42edbdb79be283df0e88879707ef34ba3fe21b6756b21cd99ea9f05de \ No newline at end of file
diff --git a/db/schema_migrations/20210529164247 b/db/schema_migrations/20210529164247
new file mode 100644
index 00000000000..76637590be7
--- /dev/null
+++ b/db/schema_migrations/20210529164247
@@ -0,0 +1 @@
+8aa9e00be5f2bc6076f4a42a479aff4318b9e4d3da48798117fec67df7158db4 \ No newline at end of file
diff --git a/db/schema_migrations/20210531053916 b/db/schema_migrations/20210531053916
new file mode 100644
index 00000000000..d2eb05fab3d
--- /dev/null
+++ b/db/schema_migrations/20210531053916
@@ -0,0 +1 @@
+862deb2d2845aaa114ba4c56418ae6a041d3aed3ac205cff102414423b60c969 \ No newline at end of file
diff --git a/db/schema_migrations/20210531054108 b/db/schema_migrations/20210531054108
new file mode 100644
index 00000000000..4b0372e7ffc
--- /dev/null
+++ b/db/schema_migrations/20210531054108
@@ -0,0 +1 @@
+9ffb8d6b93f1e994eaa9dd4b16b9250fe007903dca3901d34bf66a81b2f3ad44 \ No newline at end of file
diff --git a/db/schema_migrations/20210531070452 b/db/schema_migrations/20210531070452
new file mode 100644
index 00000000000..51a023a544c
--- /dev/null
+++ b/db/schema_migrations/20210531070452
@@ -0,0 +1 @@
+e569b99998d9c670af17ec747e37726671601ba06fa97da83373649adb3aab31 \ No newline at end of file
diff --git a/db/schema_migrations/20210531071107 b/db/schema_migrations/20210531071107
new file mode 100644
index 00000000000..f855e0990e1
--- /dev/null
+++ b/db/schema_migrations/20210531071107
@@ -0,0 +1 @@
+38dcfcd162a3b49a9b16b45b2f9818275807bf419880729b5c552bccb0d4dc9e \ No newline at end of file
diff --git a/db/schema_migrations/20210601073400 b/db/schema_migrations/20210601073400
new file mode 100644
index 00000000000..eb4eed721fe
--- /dev/null
+++ b/db/schema_migrations/20210601073400
@@ -0,0 +1 @@
+668f65ea77042e5b8054681e76f583a6061aca921b685f90d155fc4121e7ff78 \ No newline at end of file
diff --git a/db/schema_migrations/20210601080039 b/db/schema_migrations/20210601080039
new file mode 100644
index 00000000000..91d517058fe
--- /dev/null
+++ b/db/schema_migrations/20210601080039
@@ -0,0 +1 @@
+2c5c0756757a181cf8bf7968de5184664004a82c093ae3fc14c5d6931a1ab44f \ No newline at end of file
diff --git a/db/schema_migrations/20210601123341 b/db/schema_migrations/20210601123341
new file mode 100644
index 00000000000..7fd9943c89e
--- /dev/null
+++ b/db/schema_migrations/20210601123341
@@ -0,0 +1 @@
+d4a0098c30cd1acea008fa5f1cfb4c23d5b5b894eab2b72f5004acc5233f2576 \ No newline at end of file
diff --git a/db/schema_migrations/20210601125410 b/db/schema_migrations/20210601125410
new file mode 100644
index 00000000000..241a60e966a
--- /dev/null
+++ b/db/schema_migrations/20210601125410
@@ -0,0 +1 @@
+fc500e4dd555a6baad91ad3c9fb8a2f8541e1613dd64afdbdd28b19447a28caf \ No newline at end of file
diff --git a/db/schema_migrations/20210601131742 b/db/schema_migrations/20210601131742
new file mode 100644
index 00000000000..59869b190e5
--- /dev/null
+++ b/db/schema_migrations/20210601131742
@@ -0,0 +1 @@
+63cd83e097a24b39a399918422950caacb6aed8d05d0d8b7bcf66f9155a0d04e \ No newline at end of file
diff --git a/db/schema_migrations/20210601133459 b/db/schema_migrations/20210601133459
new file mode 100644
index 00000000000..2f40fffa40f
--- /dev/null
+++ b/db/schema_migrations/20210601133459
@@ -0,0 +1 @@
+4dcf6277439e8abe52534540100fa621fedcecb3eaf71ad5685ac0230cd2e5bb \ No newline at end of file
diff --git a/db/schema_migrations/20210602122213 b/db/schema_migrations/20210602122213
new file mode 100644
index 00000000000..651f9789b36
--- /dev/null
+++ b/db/schema_migrations/20210602122213
@@ -0,0 +1 @@
+66e50071130c2bd64be2f52d5c5f348a91883b2e9a9f4241175d1d2ad2a74434 \ No newline at end of file
diff --git a/db/schema_migrations/20210602122233 b/db/schema_migrations/20210602122233
new file mode 100644
index 00000000000..c52dbdfd858
--- /dev/null
+++ b/db/schema_migrations/20210602122233
@@ -0,0 +1 @@
+96c70de2567fc3e816c720ed6e4cef2446c0f0ee288d0959cd1298523913077f \ No newline at end of file
diff --git a/db/schema_migrations/20210603140302 b/db/schema_migrations/20210603140302
new file mode 100644
index 00000000000..346cf84c85c
--- /dev/null
+++ b/db/schema_migrations/20210603140302
@@ -0,0 +1 @@
+5b58dbdcba08f6e56802aa58ba0d23e5353c1818a8d4d653d53dabaac4c0234c \ No newline at end of file
diff --git a/db/schema_migrations/20210603222333 b/db/schema_migrations/20210603222333
new file mode 100644
index 00000000000..25b5055f17e
--- /dev/null
+++ b/db/schema_migrations/20210603222333
@@ -0,0 +1 @@
+fb02e0fee2760dad203b54d81c342dbf1461b3010503cab05da1eb14ab5d33da \ No newline at end of file
diff --git a/db/schema_migrations/20210604070207 b/db/schema_migrations/20210604070207
new file mode 100644
index 00000000000..3531c9775bd
--- /dev/null
+++ b/db/schema_migrations/20210604070207
@@ -0,0 +1 @@
+ec44b7f134de2ea6537c6fe3109fa9d7e32785233f3d1b8e9ea118474d21526a \ No newline at end of file
diff --git a/db/schema_migrations/20210604082145 b/db/schema_migrations/20210604082145
new file mode 100644
index 00000000000..2c568f0f2b6
--- /dev/null
+++ b/db/schema_migrations/20210604082145
@@ -0,0 +1 @@
+f4191b4b8ae7c282c0012f533a01ebe341d62cb0418e39ad543d06ed2dac63a4 \ No newline at end of file
diff --git a/db/schema_migrations/20210604085600 b/db/schema_migrations/20210604085600
new file mode 100644
index 00000000000..aa8b3120916
--- /dev/null
+++ b/db/schema_migrations/20210604085600
@@ -0,0 +1 @@
+8b6e1c7bacf2cbc05ba94e3fea2ab20e30b78ccaa6833949c11f89d1bdec8110 \ No newline at end of file
diff --git a/db/schema_migrations/20210606143426 b/db/schema_migrations/20210606143426
new file mode 100644
index 00000000000..a8a2d7d784c
--- /dev/null
+++ b/db/schema_migrations/20210606143426
@@ -0,0 +1 @@
+1f99d446428ddac2a0fa7d64bdce9fc300bf02e88c35cdb3d726c501641e721d \ No newline at end of file
diff --git a/db/schema_migrations/20210607050531 b/db/schema_migrations/20210607050531
new file mode 100644
index 00000000000..e69ab586f4d
--- /dev/null
+++ b/db/schema_migrations/20210607050531
@@ -0,0 +1 @@
+77f24cb4756dfeef16ba48a189d3bf9352534f858446522bc49495b9295374a8 \ No newline at end of file
diff --git a/db/schema_migrations/20210607080044 b/db/schema_migrations/20210607080044
new file mode 100644
index 00000000000..9ccf86d8194
--- /dev/null
+++ b/db/schema_migrations/20210607080044
@@ -0,0 +1 @@
+88f16dc06371d320a1245de68aba5ed4ad7cd8f15c4e5898619a751840981072 \ No newline at end of file
diff --git a/db/schema_migrations/20210607154719 b/db/schema_migrations/20210607154719
new file mode 100644
index 00000000000..0f7aab0fc39
--- /dev/null
+++ b/db/schema_migrations/20210607154719
@@ -0,0 +1 @@
+dd6bf6ae4988e8e07247388554992d5100dedb2bd66e92c42a6bb144dc6b1937 \ No newline at end of file
diff --git a/db/schema_migrations/20210608072312 b/db/schema_migrations/20210608072312
new file mode 100644
index 00000000000..c0c052397b1
--- /dev/null
+++ b/db/schema_migrations/20210608072312
@@ -0,0 +1 @@
+c395f52ee34cd758df87ba0f74f4528a189704498e133fa53f0dd3f6f31a77b3 \ No newline at end of file
diff --git a/db/schema_migrations/20210608072346 b/db/schema_migrations/20210608072346
new file mode 100644
index 00000000000..6ca0ad0f471
--- /dev/null
+++ b/db/schema_migrations/20210608072346
@@ -0,0 +1 @@
+9f8ff974adc7c20908cd423b2d3f69d8ec16b0fcbb8bfbdb9347a9ff3f3a007a \ No newline at end of file
diff --git a/db/schema_migrations/20210609013512 b/db/schema_migrations/20210609013512
new file mode 100644
index 00000000000..52541965dde
--- /dev/null
+++ b/db/schema_migrations/20210609013512
@@ -0,0 +1 @@
+ddd40d4fb063b3a728f4b9a214d6033f70ee3719ac769957f5295a0c5f62a5c0 \ No newline at end of file
diff --git a/db/schema_migrations/20210609090856 b/db/schema_migrations/20210609090856
new file mode 100644
index 00000000000..f0c3c25a01b
--- /dev/null
+++ b/db/schema_migrations/20210609090856
@@ -0,0 +1 @@
+597e04c51bdad1900b2535c9d664c9e3a4d2a5879e657ef470bbc7ac461d3cca \ No newline at end of file
diff --git a/db/schema_migrations/20210609125005 b/db/schema_migrations/20210609125005
new file mode 100644
index 00000000000..3e26956bdb8
--- /dev/null
+++ b/db/schema_migrations/20210609125005
@@ -0,0 +1 @@
+de8468173d8a7499d03b84913cf071af8842a2f47d5f85908af20bf7c71dc96b \ No newline at end of file
diff --git a/db/schema_migrations/20210609192728 b/db/schema_migrations/20210609192728
new file mode 100644
index 00000000000..e39cbc077b4
--- /dev/null
+++ b/db/schema_migrations/20210609192728
@@ -0,0 +1 @@
+b6c503eddc1c5e36957b59efc8fc5dd75da18104499667c3fcc435fcbd739af3 \ No newline at end of file
diff --git a/db/schema_migrations/20210609193101 b/db/schema_migrations/20210609193101
new file mode 100644
index 00000000000..42fc6427247
--- /dev/null
+++ b/db/schema_migrations/20210609193101
@@ -0,0 +1 @@
+09771c6f56e54a4d3dc0caab4891cbaf2a1d5685ccb1161d141ce38e44d6cfdb \ No newline at end of file
diff --git a/db/schema_migrations/20210610102410 b/db/schema_migrations/20210610102410
new file mode 100644
index 00000000000..1d6bb16209e
--- /dev/null
+++ b/db/schema_migrations/20210610102410
@@ -0,0 +1 @@
+dab13c78f6f758c63be923277c0f31e4cce4e30f77a8dc2983a9bb1500a454f9 \ No newline at end of file
diff --git a/db/schema_migrations/20210610102413 b/db/schema_migrations/20210610102413
new file mode 100644
index 00000000000..d94b1623e24
--- /dev/null
+++ b/db/schema_migrations/20210610102413
@@ -0,0 +1 @@
+ce21070d44a34081c6babd14e6a1b607bad5ed9047b18f4ef0beb64b5a2ce120 \ No newline at end of file
diff --git a/db/schema_migrations/20210610113229 b/db/schema_migrations/20210610113229
new file mode 100644
index 00000000000..15d4d567534
--- /dev/null
+++ b/db/schema_migrations/20210610113229
@@ -0,0 +1 @@
+3ad279a7c57e433a8ee349dabd2536c1de9055936b05c26b5469606067eb90d4 \ No newline at end of file
diff --git a/db/schema_migrations/20210610141711 b/db/schema_migrations/20210610141711
new file mode 100644
index 00000000000..786ca655eeb
--- /dev/null
+++ b/db/schema_migrations/20210610141711
@@ -0,0 +1 @@
+b8bfe0d67516f0fe71c166a616c2279fc9f45769c369d8ddd86e9705dbc55097 \ No newline at end of file
diff --git a/db/schema_migrations/20210611080951 b/db/schema_migrations/20210611080951
new file mode 100644
index 00000000000..ca33abde56c
--- /dev/null
+++ b/db/schema_migrations/20210611080951
@@ -0,0 +1 @@
+95e4b697f5c5b18935b73bbeb0c42c96e3e5abde9e4f9e179d1a93a891a0694b \ No newline at end of file
diff --git a/db/schema_migrations/20210611100359 b/db/schema_migrations/20210611100359
new file mode 100644
index 00000000000..058f7c8ff4e
--- /dev/null
+++ b/db/schema_migrations/20210611100359
@@ -0,0 +1 @@
+9429a8adca0bc85167f64e76d8d72b45d09d4303a01bd9c4ca39560bb4d89799 \ No newline at end of file
diff --git a/db/schema_migrations/20210614131002 b/db/schema_migrations/20210614131002
new file mode 100644
index 00000000000..6d59a254365
--- /dev/null
+++ b/db/schema_migrations/20210614131002
@@ -0,0 +1 @@
+dedf2f8d76f4131f34d61fe2c730f8b092ca46f8b35b08a76b7bc096c140aad1 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 77b7557b14f..fcac180738c 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -41,62 +41,6 @@ RETURN NULL;
END
$$;
-CREATE FUNCTION table_sync_function_29bc99d6db() RETURNS trigger
- LANGUAGE plpgsql
- AS $$
-BEGIN
-IF (TG_OP = 'DELETE') THEN
- DELETE FROM web_hook_logs_archived where id = OLD.id;
-ELSIF (TG_OP = 'UPDATE') THEN
- UPDATE web_hook_logs_archived
- SET web_hook_id = NEW.web_hook_id,
- trigger = NEW.trigger,
- url = NEW.url,
- request_headers = NEW.request_headers,
- request_data = NEW.request_data,
- response_headers = NEW.response_headers,
- response_body = NEW.response_body,
- response_status = NEW.response_status,
- execution_duration = NEW.execution_duration,
- internal_error_message = NEW.internal_error_message,
- created_at = NEW.created_at,
- updated_at = NEW.updated_at
- WHERE web_hook_logs_archived.id = NEW.id;
-ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO web_hook_logs_archived (id,
- web_hook_id,
- trigger,
- url,
- request_headers,
- request_data,
- response_headers,
- response_body,
- response_status,
- execution_duration,
- internal_error_message,
- created_at,
- updated_at)
- VALUES (NEW.id,
- NEW.web_hook_id,
- NEW.trigger,
- NEW.url,
- NEW.request_headers,
- NEW.request_data,
- NEW.response_headers,
- NEW.response_body,
- NEW.response_status,
- NEW.execution_duration,
- NEW.internal_error_message,
- NEW.created_at,
- NEW.updated_at);
-END IF;
-RETURN NULL;
-
-END
-$$;
-
-COMMENT ON FUNCTION table_sync_function_29bc99d6db() IS 'Partitioning migration: table sync for web_hook_logs table';
-
CREATE FUNCTION trigger_07c94931164e() RETURNS trigger
LANGUAGE plpgsql
AS $$
@@ -125,6 +69,15 @@ BEGIN
END;
$$;
+CREATE FUNCTION trigger_490d204c00b3() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ NEW."id_convert_to_bigint" := NEW."id";
+ RETURN NEW;
+END;
+$$;
+
CREATE FUNCTION trigger_51ab7cef8934() RETURNS trigger
LANGUAGE plpgsql
AS $$
@@ -143,6 +96,15 @@ BEGIN
END;
$$;
+CREATE FUNCTION trigger_77f5e1d20482() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ NEW."deployable_id_convert_to_bigint" := NEW."deployable_id";
+ RETURN NEW;
+END;
+$$;
+
CREATE FUNCTION trigger_8485e97c00e3() RETURNS trigger
LANGUAGE plpgsql
AS $$
@@ -152,6 +114,34 @@ BEGIN
END;
$$;
+CREATE FUNCTION trigger_8487d4de3e7b() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ NEW."build_id_convert_to_bigint" := NEW."build_id";
+ RETURN NEW;
+END;
+$$;
+
+CREATE FUNCTION trigger_91dc388a5fe6() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ NEW."build_id_convert_to_bigint" := NEW."build_id";
+ RETURN NEW;
+END;
+$$;
+
+CREATE FUNCTION trigger_aebe8b822ad3() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ NEW."id_convert_to_bigint" := NEW."id";
+ NEW."taggable_id_convert_to_bigint" := NEW."taggable_id";
+ RETURN NEW;
+END;
+$$;
+
CREATE FUNCTION trigger_be1804f21693() RETURNS trigger
LANGUAGE plpgsql
AS $$
@@ -171,6 +161,15 @@ BEGIN
END;
$$;
+CREATE FUNCTION trigger_f1ca8ec18d78() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+ NEW."job_artifact_id_convert_to_bigint" := NEW."job_artifact_id";
+ RETURN NEW;
+END;
+$$;
+
CREATE TABLE audit_events (
id bigint NOT NULL,
author_id integer NOT NULL,
@@ -9082,25 +9081,6 @@ CREATE SEQUENCE analytics_cycle_analytics_project_value_streams_id_seq
ALTER SEQUENCE analytics_cycle_analytics_project_value_streams_id_seq OWNED BY analytics_cycle_analytics_project_value_streams.id;
-CREATE TABLE analytics_devops_adoption_segment_selections (
- id bigint NOT NULL,
- segment_id bigint NOT NULL,
- group_id bigint,
- project_id bigint,
- created_at timestamp with time zone NOT NULL,
- updated_at timestamp with time zone NOT NULL,
- CONSTRAINT segment_selection_project_id_or_group_id_required CHECK ((((project_id <> NULL::bigint) AND (group_id IS NULL)) OR ((group_id <> NULL::bigint) AND (project_id IS NULL))))
-);
-
-CREATE SEQUENCE analytics_devops_adoption_segment_selections_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-ALTER SEQUENCE analytics_devops_adoption_segment_selections_id_seq OWNED BY analytics_devops_adoption_segment_selections.id;
-
CREATE TABLE analytics_devops_adoption_segments (
id bigint NOT NULL,
last_recorded_at timestamp with time zone,
@@ -9121,7 +9101,7 @@ ALTER SEQUENCE analytics_devops_adoption_segments_id_seq OWNED BY analytics_devo
CREATE TABLE analytics_devops_adoption_snapshots (
id bigint NOT NULL,
- segment_id bigint NOT NULL,
+ segment_id bigint,
recorded_at timestamp with time zone NOT NULL,
issue_opened boolean NOT NULL,
merge_request_opened boolean NOT NULL,
@@ -9133,7 +9113,8 @@ CREATE TABLE analytics_devops_adoption_snapshots (
end_time timestamp with time zone NOT NULL,
total_projects_count integer,
code_owners_used_count integer,
- namespace_id integer
+ namespace_id integer,
+ CONSTRAINT check_3f472de131 CHECK ((namespace_id IS NOT NULL))
);
CREATE SEQUENCE analytics_devops_adoption_snapshots_id_seq
@@ -9145,31 +9126,31 @@ CREATE SEQUENCE analytics_devops_adoption_snapshots_id_seq
ALTER SEQUENCE analytics_devops_adoption_snapshots_id_seq OWNED BY analytics_devops_adoption_snapshots.id;
-CREATE TABLE analytics_instance_statistics_measurements (
+CREATE TABLE analytics_language_trend_repository_languages (
+ file_count integer DEFAULT 0 NOT NULL,
+ programming_language_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ loc integer DEFAULT 0 NOT NULL,
+ bytes integer DEFAULT 0 NOT NULL,
+ percentage smallint DEFAULT 0 NOT NULL,
+ snapshot_date date NOT NULL
+);
+
+CREATE TABLE analytics_usage_trends_measurements (
id bigint NOT NULL,
count bigint NOT NULL,
recorded_at timestamp with time zone NOT NULL,
identifier smallint NOT NULL
);
-CREATE SEQUENCE analytics_instance_statistics_measurements_id_seq
+CREATE SEQUENCE analytics_usage_trends_measurements_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
-ALTER SEQUENCE analytics_instance_statistics_measurements_id_seq OWNED BY analytics_instance_statistics_measurements.id;
-
-CREATE TABLE analytics_language_trend_repository_languages (
- file_count integer DEFAULT 0 NOT NULL,
- programming_language_id bigint NOT NULL,
- project_id bigint NOT NULL,
- loc integer DEFAULT 0 NOT NULL,
- bytes integer DEFAULT 0 NOT NULL,
- percentage smallint DEFAULT 0 NOT NULL,
- snapshot_date date NOT NULL
-);
+ALTER SEQUENCE analytics_usage_trends_measurements_id_seq OWNED BY analytics_usage_trends_measurements.id;
CREATE TABLE appearances (
id integer NOT NULL,
@@ -9507,7 +9488,7 @@ CREATE TABLE application_settings (
rate_limiting_response_text text,
invisible_captcha_enabled boolean DEFAULT false NOT NULL,
container_registry_cleanup_tags_service_max_list_size integer DEFAULT 200 NOT NULL,
- enforce_ssh_key_expiration boolean DEFAULT false NOT NULL,
+ enforce_ssh_key_expiration boolean DEFAULT true NOT NULL,
git_two_factor_session_expiry integer DEFAULT 15 NOT NULL,
keep_latest_artifact boolean DEFAULT true NOT NULL,
notes_create_limit integer DEFAULT 300 NOT NULL,
@@ -9536,6 +9517,8 @@ CREATE TABLE application_settings (
elasticsearch_username text,
encrypted_elasticsearch_password bytea,
encrypted_elasticsearch_password_iv bytea,
+ diff_max_lines integer DEFAULT 50000 NOT NULL,
+ diff_max_files integer DEFAULT 1000 NOT NULL,
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
CONSTRAINT app_settings_ext_pipeline_validation_service_url_text_limit CHECK ((char_length(external_pipeline_validation_service_url) <= 255)),
CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)),
@@ -10499,7 +10482,8 @@ CREATE TABLE ci_build_trace_sections (
byte_start bigint NOT NULL,
byte_end bigint NOT NULL,
build_id integer NOT NULL,
- section_name_id integer NOT NULL
+ section_name_id integer NOT NULL,
+ build_id_convert_to_bigint bigint DEFAULT 0 NOT NULL
);
CREATE TABLE ci_builds (
@@ -10574,7 +10558,8 @@ CREATE TABLE ci_builds_metadata (
has_exposed_artifacts boolean,
environment_auto_stop_in character varying(255),
expanded_environment_name character varying(255),
- secrets jsonb DEFAULT '{}'::jsonb NOT NULL
+ secrets jsonb DEFAULT '{}'::jsonb NOT NULL,
+ build_id_convert_to_bigint bigint DEFAULT 0 NOT NULL
);
CREATE SEQUENCE ci_builds_metadata_id_seq
@@ -10738,6 +10723,23 @@ CREATE SEQUENCE ci_job_artifacts_id_seq
ALTER SEQUENCE ci_job_artifacts_id_seq OWNED BY ci_job_artifacts.id;
+CREATE TABLE ci_job_token_project_scope_links (
+ id bigint NOT NULL,
+ source_project_id bigint NOT NULL,
+ target_project_id bigint NOT NULL,
+ added_by_id bigint,
+ created_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE ci_job_token_project_scope_links_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE ci_job_token_project_scope_links_id_seq OWNED BY ci_job_token_project_scope_links.id;
+
CREATE TABLE ci_job_variables (
id bigint NOT NULL,
key character varying NOT NULL,
@@ -10757,6 +10759,26 @@ CREATE SEQUENCE ci_job_variables_id_seq
ALTER SEQUENCE ci_job_variables_id_seq OWNED BY ci_job_variables.id;
+CREATE TABLE ci_minutes_additional_packs (
+ 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,
+ expires_at date,
+ number_of_minutes integer NOT NULL,
+ purchase_xid text,
+ CONSTRAINT check_d7ef254af0 CHECK ((char_length(purchase_xid) <= 32))
+);
+
+CREATE SEQUENCE ci_minutes_additional_packs_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE ci_minutes_additional_packs_id_seq OWNED BY ci_minutes_additional_packs.id;
+
CREATE TABLE ci_namespace_monthly_usages (
id bigint NOT NULL,
namespace_id bigint NOT NULL,
@@ -10775,6 +10797,23 @@ CREATE SEQUENCE ci_namespace_monthly_usages_id_seq
ALTER SEQUENCE ci_namespace_monthly_usages_id_seq OWNED BY ci_namespace_monthly_usages.id;
+CREATE TABLE ci_pending_builds (
+ id bigint NOT NULL,
+ build_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ created_at timestamp with time zone DEFAULT now() NOT NULL,
+ protected boolean DEFAULT false NOT NULL
+);
+
+CREATE SEQUENCE ci_pending_builds_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE ci_pending_builds_id_seq OWNED BY ci_pending_builds.id;
+
CREATE TABLE ci_pipeline_artifacts (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -11101,7 +11140,8 @@ CREATE TABLE ci_runners (
runner_type smallint NOT NULL,
token_encrypted character varying,
public_projects_minutes_cost_factor double precision DEFAULT 0.0 NOT NULL,
- private_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL
+ private_projects_minutes_cost_factor double precision DEFAULT 1.0 NOT NULL,
+ config jsonb DEFAULT '{}'::jsonb NOT NULL
);
CREATE SEQUENCE ci_runners_id_seq
@@ -11113,6 +11153,24 @@ CREATE SEQUENCE ci_runners_id_seq
ALTER SEQUENCE ci_runners_id_seq OWNED BY ci_runners.id;
+CREATE TABLE ci_running_builds (
+ id bigint NOT NULL,
+ build_id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ runner_id bigint NOT NULL,
+ created_at timestamp with time zone DEFAULT now() NOT NULL,
+ runner_type smallint NOT NULL
+);
+
+CREATE SEQUENCE ci_running_builds_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE ci_running_builds_id_seq OWNED BY ci_running_builds.id;
+
CREATE TABLE ci_sources_pipelines (
id integer NOT NULL,
project_id integer,
@@ -11157,6 +11215,7 @@ CREATE TABLE ci_stages (
status integer,
lock_version integer DEFAULT 0,
"position" integer,
+ id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
CONSTRAINT check_81b431e49b CHECK ((lock_version IS NOT NULL))
);
@@ -12259,7 +12318,8 @@ CREATE TABLE deployments (
on_stop character varying,
status smallint NOT NULL,
finished_at timestamp with time zone,
- cluster_id integer
+ cluster_id integer,
+ deployable_id_convert_to_bigint bigint
);
CREATE SEQUENCE deployments_id_seq
@@ -12722,14 +12782,14 @@ CREATE TABLE experiment_subjects (
id bigint NOT NULL,
experiment_id bigint NOT NULL,
user_id bigint,
- group_id bigint,
project_id bigint,
variant smallint DEFAULT 0 NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
converted_at timestamp with time zone,
context jsonb DEFAULT '{}'::jsonb NOT NULL,
- CONSTRAINT chk_has_one_subject CHECK ((num_nonnulls(user_id, group_id, project_id) = 1))
+ namespace_id bigint,
+ CONSTRAINT check_f6411bc4b5 CHECK ((num_nonnulls(user_id, namespace_id, project_id) = 1))
);
CREATE SEQUENCE experiment_subjects_id_seq
@@ -12835,6 +12895,41 @@ CREATE SEQUENCE external_pull_requests_id_seq
ALTER SEQUENCE external_pull_requests_id_seq OWNED BY external_pull_requests.id;
+CREATE TABLE external_status_checks (
+ id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ external_url text NOT NULL,
+ name text NOT NULL,
+ CONSTRAINT check_7e3b9eb41a CHECK ((char_length(name) <= 255)),
+ CONSTRAINT check_ae0dec3f61 CHECK ((char_length(external_url) <= 255))
+);
+
+CREATE SEQUENCE external_status_checks_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE external_status_checks_id_seq OWNED BY external_status_checks.id;
+
+CREATE TABLE external_status_checks_protected_branches (
+ id bigint NOT NULL,
+ external_status_check_id bigint NOT NULL,
+ protected_branch_id bigint NOT NULL
+);
+
+CREATE SEQUENCE external_status_checks_protected_branches_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE external_status_checks_protected_branches_id_seq OWNED BY external_status_checks_protected_branches.id;
+
CREATE TABLE feature_gates (
id integer NOT NULL,
feature_key character varying NOT NULL,
@@ -13015,7 +13110,8 @@ ALTER SEQUENCE geo_hashed_storage_migrated_events_id_seq OWNED BY geo_hashed_sto
CREATE TABLE geo_job_artifact_deleted_events (
id bigint NOT NULL,
job_artifact_id integer NOT NULL,
- file_path character varying NOT NULL
+ file_path character varying NOT NULL,
+ job_artifact_id_convert_to_bigint bigint DEFAULT 0 NOT NULL
);
CREATE SEQUENCE geo_job_artifact_deleted_events_id_seq
@@ -14280,8 +14376,7 @@ CREATE TABLE labels (
description_html text,
type character varying,
group_id integer,
- cached_markdown_version integer,
- remove_on_close boolean DEFAULT false NOT NULL
+ cached_markdown_version integer
);
CREATE SEQUENCE labels_id_seq
@@ -14568,6 +14663,8 @@ CREATE TABLE merge_request_diff_details (
verification_retry_count smallint,
verification_checksum bytea,
verification_failure text,
+ verification_state smallint DEFAULT 0 NOT NULL,
+ verification_started_at timestamp with time zone,
CONSTRAINT check_81429e3622 CHECK ((char_length(verification_failure) <= 255))
);
@@ -14926,6 +15023,7 @@ CREATE TABLE namespace_settings (
delayed_project_removal boolean,
resource_access_token_creation_allowed boolean DEFAULT true NOT NULL,
lock_delayed_project_removal boolean DEFAULT false NOT NULL,
+ prevent_sharing_groups_outside_hierarchy boolean DEFAULT false NOT NULL,
CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255))
);
@@ -15538,6 +15636,30 @@ CREATE SEQUENCE packages_debian_group_components_id_seq
ALTER SEQUENCE packages_debian_group_components_id_seq OWNED BY packages_debian_group_components.id;
+CREATE TABLE packages_debian_group_distribution_keys (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ distribution_id bigint NOT NULL,
+ encrypted_private_key text NOT NULL,
+ encrypted_private_key_iv text NOT NULL,
+ encrypted_passphrase text NOT NULL,
+ encrypted_passphrase_iv text NOT NULL,
+ public_key text NOT NULL,
+ fingerprint text NOT NULL,
+ CONSTRAINT check_bc95dc3fbe CHECK ((char_length(fingerprint) <= 255)),
+ CONSTRAINT check_f708183491 CHECK ((char_length(public_key) <= 524288))
+);
+
+CREATE SEQUENCE packages_debian_group_distribution_keys_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE packages_debian_group_distribution_keys_id_seq OWNED BY packages_debian_group_distribution_keys.id;
+
CREATE TABLE packages_debian_group_distributions (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -15640,6 +15762,30 @@ CREATE SEQUENCE packages_debian_project_components_id_seq
ALTER SEQUENCE packages_debian_project_components_id_seq OWNED BY packages_debian_project_components.id;
+CREATE TABLE packages_debian_project_distribution_keys (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ distribution_id bigint NOT NULL,
+ encrypted_private_key text NOT NULL,
+ encrypted_private_key_iv text NOT NULL,
+ encrypted_passphrase text NOT NULL,
+ encrypted_passphrase_iv text NOT NULL,
+ public_key text NOT NULL,
+ fingerprint text NOT NULL,
+ CONSTRAINT check_9e8a5eef0a CHECK ((char_length(fingerprint) <= 255)),
+ CONSTRAINT check_d188f6547f CHECK ((char_length(public_key) <= 524288))
+);
+
+CREATE SEQUENCE packages_debian_project_distribution_keys_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE packages_debian_project_distribution_keys_id_seq OWNED BY packages_debian_project_distribution_keys.id;
+
CREATE TABLE packages_debian_project_distributions (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -16135,7 +16281,8 @@ CREATE TABLE plan_limits (
helm_max_file_size bigint DEFAULT 5242880 NOT NULL,
ci_registered_group_runners integer DEFAULT 1000 NOT NULL,
ci_registered_project_runners integer DEFAULT 1000 NOT NULL,
- web_hook_calls integer DEFAULT 0 NOT NULL
+ web_hook_calls integer DEFAULT 0 NOT NULL,
+ ci_daily_pipeline_schedule_triggers integer DEFAULT 0 NOT NULL
);
CREATE SEQUENCE plan_limits_id_seq
@@ -16454,7 +16601,8 @@ CREATE TABLE project_ci_cd_settings (
merge_trains_enabled boolean DEFAULT false,
auto_rollback_enabled boolean DEFAULT false NOT NULL,
keep_latest_artifact boolean DEFAULT true NOT NULL,
- restrict_user_defined_variables boolean DEFAULT false NOT NULL
+ restrict_user_defined_variables boolean DEFAULT false NOT NULL,
+ job_token_scope_enabled boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE project_ci_cd_settings_id_seq
@@ -16902,7 +17050,7 @@ CREATE TABLE projects (
pages_https_only boolean DEFAULT true,
external_webhook_token character varying,
packages_enabled boolean,
- merge_requests_author_approval boolean,
+ merge_requests_author_approval boolean DEFAULT false,
pool_repository_id bigint,
runners_token_encrypted character varying,
bfg_object_map character varying,
@@ -17092,10 +17240,12 @@ ALTER SEQUENCE protected_environment_deploy_access_levels_id_seq OWNED BY protec
CREATE TABLE protected_environments (
id integer NOT NULL,
- project_id integer NOT NULL,
+ project_id integer,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
- name character varying NOT NULL
+ name character varying NOT NULL,
+ group_id bigint,
+ CONSTRAINT protected_environments_project_or_group_existence CHECK (((project_id IS NULL) <> (group_id IS NULL)))
);
CREATE SEQUENCE protected_environments_id_seq
@@ -18014,7 +18164,9 @@ ALTER SEQUENCE sprints_id_seq OWNED BY sprints.id;
CREATE TABLE status_check_responses (
id bigint NOT NULL,
merge_request_id bigint NOT NULL,
- external_approval_rule_id bigint NOT NULL
+ external_approval_rule_id bigint,
+ sha bytea NOT NULL,
+ external_status_check_id bigint NOT NULL
);
CREATE SEQUENCE status_check_responses_id_seq
@@ -18134,7 +18286,9 @@ CREATE TABLE taggings (
tagger_id integer,
tagger_type character varying,
context character varying,
- created_at timestamp without time zone
+ created_at timestamp without time zone,
+ id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
+ taggable_id_convert_to_bigint bigint
);
CREATE SEQUENCE taggings_id_seq
@@ -18332,6 +18486,24 @@ CREATE SEQUENCE u2f_registrations_id_seq
ALTER SEQUENCE u2f_registrations_id_seq OWNED BY u2f_registrations.id;
+CREATE TABLE upcoming_reconciliations (
+ id bigint NOT NULL,
+ namespace_id bigint,
+ next_reconciliation_date date NOT NULL,
+ display_alert_from date NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE upcoming_reconciliations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE upcoming_reconciliations_id_seq OWNED BY upcoming_reconciliations.id;
+
CREATE TABLE uploads (
id integer NOT NULL,
size bigint NOT NULL,
@@ -18441,8 +18613,10 @@ CREATE TABLE user_details (
webauthn_xid text,
other_role text,
provisioned_by_group_id bigint,
+ pronouns text,
CONSTRAINT check_245664af82 CHECK ((char_length(webauthn_xid) <= 100)),
- CONSTRAINT check_b132136b01 CHECK ((char_length(other_role) <= 100))
+ CONSTRAINT check_b132136b01 CHECK ((char_length(other_role) <= 100)),
+ CONSTRAINT check_eeeaf8d4f0 CHECK ((char_length(pronouns) <= 50))
);
CREATE SEQUENCE user_details_user_id_seq
@@ -18840,6 +19014,27 @@ CREATE SEQUENCE vulnerability_feedback_id_seq
ALTER SEQUENCE vulnerability_feedback_id_seq OWNED BY vulnerability_feedback.id;
+CREATE TABLE vulnerability_finding_evidence_headers (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ vulnerability_finding_evidence_request_id bigint,
+ vulnerability_finding_evidence_response_id bigint,
+ name text NOT NULL,
+ value text NOT NULL,
+ CONSTRAINT check_01d21e8d92 CHECK ((char_length(name) <= 255)),
+ CONSTRAINT check_3f9011f903 CHECK ((char_length(value) <= 8192))
+);
+
+CREATE SEQUENCE vulnerability_finding_evidence_headers_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE vulnerability_finding_evidence_headers_id_seq OWNED BY vulnerability_finding_evidence_headers.id;
+
CREATE TABLE vulnerability_finding_evidence_requests (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -19077,6 +19272,7 @@ CREATE TABLE vulnerability_occurrences (
solution text,
cve text,
location jsonb,
+ detection_method smallint DEFAULT 0 NOT NULL,
CONSTRAINT check_4a3a60f2ba CHECK ((char_length(solution) <= 7000)),
CONSTRAINT check_ade261da6b CHECK ((char_length(description) <= 15000)),
CONSTRAINT check_df6dd20219 CHECK ((char_length(message) <= 3000)),
@@ -19147,7 +19343,8 @@ CREATE TABLE vulnerability_statistics (
low integer DEFAULT 0 NOT NULL,
unknown integer DEFAULT 0 NOT NULL,
info integer DEFAULT 0 NOT NULL,
- letter_grade smallint NOT NULL
+ letter_grade smallint NOT NULL,
+ latest_pipeline_id bigint
);
CREATE SEQUENCE vulnerability_statistics_id_seq
@@ -19177,22 +19374,6 @@ CREATE SEQUENCE vulnerability_user_mentions_id_seq
ALTER SEQUENCE vulnerability_user_mentions_id_seq OWNED BY vulnerability_user_mentions.id;
-CREATE TABLE web_hook_logs_archived (
- id integer NOT NULL,
- web_hook_id integer NOT NULL,
- trigger character varying,
- url character varying,
- request_headers text,
- request_data text,
- response_headers text,
- response_body text,
- response_status character varying,
- execution_duration double precision,
- internal_error_message character varying,
- created_at timestamp without time zone NOT NULL,
- updated_at timestamp without time zone NOT NULL
-);
-
CREATE SEQUENCE web_hook_logs_id_seq
START WITH 1
INCREMENT BY 1
@@ -19401,13 +19582,11 @@ ALTER TABLE ONLY analytics_cycle_analytics_project_stages ALTER COLUMN id SET DE
ALTER TABLE ONLY analytics_cycle_analytics_project_value_streams ALTER COLUMN id SET DEFAULT nextval('analytics_cycle_analytics_project_value_streams_id_seq'::regclass);
-ALTER TABLE ONLY analytics_devops_adoption_segment_selections ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_segment_selections_id_seq'::regclass);
-
ALTER TABLE ONLY analytics_devops_adoption_segments ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_segments_id_seq'::regclass);
ALTER TABLE ONLY analytics_devops_adoption_snapshots ALTER COLUMN id SET DEFAULT nextval('analytics_devops_adoption_snapshots_id_seq'::regclass);
-ALTER TABLE ONLY analytics_instance_statistics_measurements ALTER COLUMN id SET DEFAULT nextval('analytics_instance_statistics_measurements_id_seq'::regclass);
+ALTER TABLE ONLY analytics_usage_trends_measurements ALTER COLUMN id SET DEFAULT nextval('analytics_usage_trends_measurements_id_seq'::regclass);
ALTER TABLE ONLY appearances ALTER COLUMN id SET DEFAULT nextval('appearances_id_seq'::regclass);
@@ -19527,10 +19706,16 @@ ALTER TABLE ONLY ci_instance_variables ALTER COLUMN id SET DEFAULT nextval('ci_i
ALTER TABLE ONLY ci_job_artifacts ALTER COLUMN id SET DEFAULT nextval('ci_job_artifacts_id_seq'::regclass);
+ALTER TABLE ONLY ci_job_token_project_scope_links ALTER COLUMN id SET DEFAULT nextval('ci_job_token_project_scope_links_id_seq'::regclass);
+
ALTER TABLE ONLY ci_job_variables ALTER COLUMN id SET DEFAULT nextval('ci_job_variables_id_seq'::regclass);
+ALTER TABLE ONLY ci_minutes_additional_packs ALTER COLUMN id SET DEFAULT nextval('ci_minutes_additional_packs_id_seq'::regclass);
+
ALTER TABLE ONLY ci_namespace_monthly_usages ALTER COLUMN id SET DEFAULT nextval('ci_namespace_monthly_usages_id_seq'::regclass);
+ALTER TABLE ONLY ci_pending_builds ALTER COLUMN id SET DEFAULT nextval('ci_pending_builds_id_seq'::regclass);
+
ALTER TABLE ONLY ci_pipeline_artifacts ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_artifacts_id_seq'::regclass);
ALTER TABLE ONLY ci_pipeline_chat_data ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_chat_data_id_seq'::regclass);
@@ -19563,6 +19748,8 @@ ALTER TABLE ONLY ci_runner_projects ALTER COLUMN id SET DEFAULT nextval('ci_runn
ALTER TABLE ONLY ci_runners ALTER COLUMN id SET DEFAULT nextval('ci_runners_id_seq'::regclass);
+ALTER TABLE ONLY ci_running_builds ALTER COLUMN id SET DEFAULT nextval('ci_running_builds_id_seq'::regclass);
+
ALTER TABLE ONLY ci_sources_pipelines ALTER COLUMN id SET DEFAULT nextval('ci_sources_pipelines_id_seq'::regclass);
ALTER TABLE ONLY ci_sources_projects ALTER COLUMN id SET DEFAULT nextval('ci_sources_projects_id_seq'::regclass);
@@ -19715,6 +19902,10 @@ ALTER TABLE ONLY external_approval_rules_protected_branches ALTER COLUMN id SET
ALTER TABLE ONLY external_pull_requests ALTER COLUMN id SET DEFAULT nextval('external_pull_requests_id_seq'::regclass);
+ALTER TABLE ONLY external_status_checks ALTER COLUMN id SET DEFAULT nextval('external_status_checks_id_seq'::regclass);
+
+ALTER TABLE ONLY external_status_checks_protected_branches ALTER COLUMN id SET DEFAULT nextval('external_status_checks_protected_branches_id_seq'::regclass);
+
ALTER TABLE ONLY feature_gates ALTER COLUMN id SET DEFAULT nextval('feature_gates_id_seq'::regclass);
ALTER TABLE ONLY features ALTER COLUMN id SET DEFAULT nextval('features_id_seq'::regclass);
@@ -19951,6 +20142,8 @@ ALTER TABLE ONLY packages_debian_group_component_files ALTER COLUMN id SET DEFAU
ALTER TABLE ONLY packages_debian_group_components ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_components_id_seq'::regclass);
+ALTER TABLE ONLY packages_debian_group_distribution_keys ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_distribution_keys_id_seq'::regclass);
+
ALTER TABLE ONLY packages_debian_group_distributions ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_distributions_id_seq'::regclass);
ALTER TABLE ONLY packages_debian_project_architectures ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_architectures_id_seq'::regclass);
@@ -19959,6 +20152,8 @@ ALTER TABLE ONLY packages_debian_project_component_files ALTER COLUMN id SET DEF
ALTER TABLE ONLY packages_debian_project_components ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_components_id_seq'::regclass);
+ALTER TABLE ONLY packages_debian_project_distribution_keys ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_distribution_keys_id_seq'::regclass);
+
ALTER TABLE ONLY packages_debian_project_distributions ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_distributions_id_seq'::regclass);
ALTER TABLE ONLY packages_debian_publications ALTER COLUMN id SET DEFAULT nextval('packages_debian_publications_id_seq'::regclass);
@@ -20173,6 +20368,8 @@ ALTER TABLE ONLY trending_projects ALTER COLUMN id SET DEFAULT nextval('trending
ALTER TABLE ONLY u2f_registrations ALTER COLUMN id SET DEFAULT nextval('u2f_registrations_id_seq'::regclass);
+ALTER TABLE ONLY upcoming_reconciliations ALTER COLUMN id SET DEFAULT nextval('upcoming_reconciliations_id_seq'::regclass);
+
ALTER TABLE ONLY uploads ALTER COLUMN id SET DEFAULT nextval('uploads_id_seq'::regclass);
ALTER TABLE ONLY user_agent_details ALTER COLUMN id SET DEFAULT nextval('user_agent_details_id_seq'::regclass);
@@ -20209,6 +20406,8 @@ 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_evidence_headers ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_evidence_headers_id_seq'::regclass);
+
ALTER TABLE ONLY vulnerability_finding_evidence_requests ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_evidence_requests_id_seq'::regclass);
ALTER TABLE ONLY vulnerability_finding_evidence_responses ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_evidence_responses_id_seq'::regclass);
@@ -20484,21 +20683,18 @@ ALTER TABLE ONLY analytics_cycle_analytics_project_stages
ALTER TABLE ONLY analytics_cycle_analytics_project_value_streams
ADD CONSTRAINT analytics_cycle_analytics_project_value_streams_pkey PRIMARY KEY (id);
-ALTER TABLE ONLY analytics_devops_adoption_segment_selections
- ADD CONSTRAINT analytics_devops_adoption_segment_selections_pkey PRIMARY KEY (id);
-
ALTER TABLE ONLY analytics_devops_adoption_segments
ADD CONSTRAINT analytics_devops_adoption_segments_pkey PRIMARY KEY (id);
ALTER TABLE ONLY analytics_devops_adoption_snapshots
ADD CONSTRAINT analytics_devops_adoption_snapshots_pkey PRIMARY KEY (id);
-ALTER TABLE ONLY analytics_instance_statistics_measurements
- ADD CONSTRAINT analytics_instance_statistics_measurements_pkey PRIMARY KEY (id);
-
ALTER TABLE ONLY analytics_language_trend_repository_languages
ADD CONSTRAINT analytics_language_trend_repository_languages_pkey PRIMARY KEY (programming_language_id, project_id, snapshot_date);
+ALTER TABLE ONLY analytics_usage_trends_measurements
+ ADD CONSTRAINT analytics_usage_trends_measurements_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY appearances
ADD CONSTRAINT appearances_pkey PRIMARY KEY (id);
@@ -20700,12 +20896,21 @@ ALTER TABLE ONLY ci_instance_variables
ALTER TABLE ONLY ci_job_artifacts
ADD CONSTRAINT ci_job_artifacts_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY ci_job_token_project_scope_links
+ ADD CONSTRAINT ci_job_token_project_scope_links_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY ci_job_variables
ADD CONSTRAINT ci_job_variables_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY ci_minutes_additional_packs
+ ADD CONSTRAINT ci_minutes_additional_packs_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY ci_namespace_monthly_usages
ADD CONSTRAINT ci_namespace_monthly_usages_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY ci_pending_builds
+ ADD CONSTRAINT ci_pending_builds_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY ci_pipeline_artifacts
ADD CONSTRAINT ci_pipeline_artifacts_pkey PRIMARY KEY (id);
@@ -20754,6 +20959,9 @@ ALTER TABLE ONLY ci_runner_projects
ALTER TABLE ONLY ci_runners
ADD CONSTRAINT ci_runners_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY ci_running_builds
+ ADD CONSTRAINT ci_running_builds_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY ci_sources_pipelines
ADD CONSTRAINT ci_sources_pipelines_pkey PRIMARY KEY (id);
@@ -21009,6 +21217,12 @@ ALTER TABLE ONLY external_approval_rules_protected_branches
ALTER TABLE ONLY external_pull_requests
ADD CONSTRAINT external_pull_requests_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY external_status_checks
+ ADD CONSTRAINT external_status_checks_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY external_status_checks_protected_branches
+ ADD CONSTRAINT external_status_checks_protected_branches_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY feature_gates
ADD CONSTRAINT feature_gates_pkey PRIMARY KEY (id);
@@ -21423,6 +21637,9 @@ ALTER TABLE ONLY packages_debian_group_component_files
ALTER TABLE ONLY packages_debian_group_components
ADD CONSTRAINT packages_debian_group_components_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY packages_debian_group_distribution_keys
+ ADD CONSTRAINT packages_debian_group_distribution_keys_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY packages_debian_group_distributions
ADD CONSTRAINT packages_debian_group_distributions_pkey PRIMARY KEY (id);
@@ -21435,6 +21652,9 @@ ALTER TABLE ONLY packages_debian_project_component_files
ALTER TABLE ONLY packages_debian_project_components
ADD CONSTRAINT packages_debian_project_components_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY packages_debian_project_distribution_keys
+ ADD CONSTRAINT packages_debian_project_distribution_keys_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY packages_debian_project_distributions
ADD CONSTRAINT packages_debian_project_distributions_pkey PRIMARY KEY (id);
@@ -21813,6 +22033,9 @@ ALTER TABLE ONLY trending_projects
ALTER TABLE ONLY u2f_registrations
ADD CONSTRAINT u2f_registrations_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY upcoming_reconciliations
+ ADD CONSTRAINT upcoming_reconciliations_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY uploads
ADD CONSTRAINT uploads_pkey PRIMARY KEY (id);
@@ -21882,6 +22105,9 @@ 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_evidence_headers
+ ADD CONSTRAINT vulnerability_finding_evidence_headers_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY vulnerability_finding_evidence_requests
ADD CONSTRAINT vulnerability_finding_evidence_requests_pkey PRIMARY KEY (id);
@@ -21930,9 +22156,6 @@ ALTER TABLE ONLY vulnerability_statistics
ALTER TABLE ONLY vulnerability_user_mentions
ADD CONSTRAINT vulnerability_user_mentions_pkey PRIMARY KEY (id);
-ALTER TABLE ONLY web_hook_logs_archived
- ADD CONSTRAINT web_hook_logs_archived_pkey PRIMARY KEY (id);
-
ALTER TABLE ONLY web_hook_logs
ADD CONSTRAINT web_hook_logs_pkey PRIMARY KEY (id, created_at);
@@ -22106,6 +22329,8 @@ CREATE INDEX approval_mr_rule_index_merge_request_id ON approval_merge_request_r
CREATE UNIQUE INDEX bulk_import_trackers_uniq_relation_by_entity ON bulk_import_trackers USING btree (bulk_import_entity_id, relation);
+CREATE INDEX cadence_create_iterations_automation ON iterations_cadences USING btree (automatic, duration_in_weeks, date((COALESCE(last_run_date, '1970-01-01'::date) + ((duration_in_weeks)::double precision * '7 days'::interval)))) WHERE (duration_in_weeks IS NOT NULL);
+
CREATE INDEX ci_builds_gitlab_monitor_metrics ON ci_builds USING btree (status, created_at, project_id) WHERE ((type)::text = 'Ci::Build'::text);
CREATE INDEX code_owner_approval_required ON protected_branches USING btree (project_id, code_owner_approval_required) WHERE (code_owner_approval_required = true);
@@ -22122,6 +22347,10 @@ CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_and_note_id_index ON epic_user
CREATE UNIQUE INDEX epic_user_mentions_on_epic_id_index ON epic_user_mentions USING btree (epic_id) WHERE (note_id IS NULL);
+CREATE INDEX finding_evidence_header_on_finding_evidence_request_id ON vulnerability_finding_evidence_headers USING btree (vulnerability_finding_evidence_request_id);
+
+CREATE INDEX finding_evidence_header_on_finding_evidence_response_id ON vulnerability_finding_evidence_headers USING btree (vulnerability_finding_evidence_response_id);
+
CREATE INDEX finding_evidence_requests_on_finding_evidence_id ON vulnerability_finding_evidence_requests USING btree (vulnerability_finding_evidence_id);
CREATE INDEX finding_evidence_responses_on_finding_evidences_id ON vulnerability_finding_evidence_responses USING btree (vulnerability_finding_evidence_id);
@@ -22130,6 +22359,10 @@ CREATE INDEX finding_evidences_on_vulnerability_occurrence_id ON vulnerability_f
CREATE INDEX finding_links_on_vulnerability_occurrence_id ON vulnerability_finding_links USING btree (vulnerability_occurrence_id);
+CREATE UNIQUE INDEX i_ci_job_token_project_scope_links_on_source_and_target_project ON ci_job_token_project_scope_links USING btree (source_project_id, target_project_id);
+
+CREATE INDEX idx_analytics_devops_adoption_segments_on_namespace_id ON analytics_devops_adoption_segments USING btree (namespace_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);
@@ -22204,6 +22437,10 @@ CREATE UNIQUE INDEX idx_on_external_approval_rules_project_id_external_url ON ex
CREATE UNIQUE INDEX idx_on_external_approval_rules_project_id_name ON external_approval_rules USING btree (project_id, name);
+CREATE UNIQUE INDEX idx_on_external_status_checks_project_id_external_url ON external_status_checks USING btree (project_id, external_url);
+
+CREATE UNIQUE INDEX idx_on_external_status_checks_project_id_name ON external_status_checks USING btree (project_id, name);
+
CREATE INDEX idx_packages_build_infos_on_package_id ON packages_build_infos USING btree (package_id);
CREATE INDEX idx_packages_debian_group_component_files_on_architecture_id ON packages_debian_group_component_files USING btree (architecture_id);
@@ -22212,6 +22449,10 @@ CREATE INDEX idx_packages_debian_project_component_files_on_architecture_id ON p
CREATE INDEX idx_packages_packages_on_project_id_name_version_package_type ON packages_packages USING btree (project_id, name, version, package_type);
+CREATE INDEX idx_pkgs_debian_group_distribution_keys_on_distribution_id ON packages_debian_group_distribution_keys USING btree (distribution_id);
+
+CREATE INDEX idx_pkgs_debian_project_distribution_keys_on_distribution_id ON packages_debian_project_distribution_keys USING btree (distribution_id);
+
CREATE UNIQUE INDEX idx_pkgs_dep_links_on_pkg_id_dependency_id_dependency_type ON packages_dependency_links USING btree (package_id, dependency_id, dependency_type);
CREATE INDEX idx_proj_feat_usg_on_jira_dvcs_cloud_last_sync_at_and_proj_id ON project_feature_usages USING btree (jira_dvcs_cloud_last_sync_at, project_id) WHERE (jira_dvcs_cloud_last_sync_at IS NOT NULL);
@@ -22312,8 +22553,6 @@ CREATE UNIQUE INDEX index_analytics_ca_project_value_streams_on_project_id_and_n
CREATE INDEX index_analytics_cycle_analytics_group_stages_custom_only ON analytics_cycle_analytics_group_stages USING btree (id) WHERE (custom = true);
-CREATE UNIQUE INDEX index_analytics_devops_adoption_segments_on_namespace_id ON analytics_devops_adoption_segments USING btree (namespace_id);
-
CREATE INDEX index_application_settings_on_custom_project_templates_group_id ON application_settings USING btree (custom_project_templates_group_id);
CREATE INDEX index_application_settings_on_file_template_project_id ON application_settings USING btree (file_template_project_id);
@@ -22404,12 +22643,12 @@ CREATE INDEX index_badges_on_group_id ON badges USING btree (group_id);
CREATE INDEX index_badges_on_project_id ON badges USING btree (project_id);
+CREATE UNIQUE INDEX index_batched_background_migrations_on_unique_configuration ON batched_background_migrations USING btree (job_class_name, table_name, column_name, job_arguments);
+
CREATE INDEX index_batched_jobs_by_batched_migration_id_and_id ON batched_background_migration_jobs USING btree (batched_background_migration_id, id);
CREATE INDEX index_batched_jobs_on_batched_migration_id_and_status ON batched_background_migration_jobs USING btree (batched_background_migration_id, status);
-CREATE INDEX index_batched_migrations_on_job_table_and_column_name ON batched_background_migrations USING btree (job_class_name, table_name, column_name);
-
CREATE INDEX index_board_assignees_on_assignee_id ON board_assignees USING btree (assignee_id);
CREATE UNIQUE INDEX index_board_assignees_on_board_id_and_assignee_id ON board_assignees USING btree (board_id, assignee_id);
@@ -22606,12 +22845,24 @@ CREATE INDEX index_ci_job_artifacts_on_project_id ON ci_job_artifacts USING btre
CREATE INDEX index_ci_job_artifacts_on_project_id_for_security_reports ON ci_job_artifacts USING btree (project_id) WHERE (file_type = ANY (ARRAY[5, 6, 7, 8]));
+CREATE INDEX index_ci_job_token_project_scope_links_on_added_by_id ON ci_job_token_project_scope_links USING btree (added_by_id);
+
+CREATE INDEX index_ci_job_token_project_scope_links_on_target_project_id ON ci_job_token_project_scope_links USING btree (target_project_id);
+
CREATE INDEX index_ci_job_variables_on_job_id ON ci_job_variables USING btree (job_id);
CREATE UNIQUE INDEX index_ci_job_variables_on_key_and_job_id ON ci_job_variables USING btree (key, job_id);
+CREATE INDEX index_ci_minutes_additional_packs_on_namespace_id_purchase_xid ON ci_minutes_additional_packs USING btree (namespace_id, purchase_xid);
+
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_pending_builds_id_on_protected_partial ON ci_pending_builds USING btree (id) WHERE (protected = true);
+
+CREATE UNIQUE INDEX index_ci_pending_builds_on_build_id ON ci_pending_builds USING btree (build_id);
+
+CREATE INDEX index_ci_pending_builds_on_project_id ON ci_pending_builds USING btree (project_id);
+
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));
@@ -22706,7 +22957,15 @@ CREATE INDEX index_ci_runner_projects_on_project_id ON ci_runner_projects USING
CREATE INDEX index_ci_runner_projects_on_runner_id ON ci_runner_projects USING btree (runner_id);
-CREATE INDEX index_ci_runners_on_contacted_at ON ci_runners USING btree (contacted_at);
+CREATE INDEX index_ci_runners_on_contacted_at_and_id_desc ON ci_runners USING btree (contacted_at, id DESC);
+
+CREATE INDEX index_ci_runners_on_contacted_at_desc_and_id_desc ON ci_runners USING btree (contacted_at DESC, id DESC);
+
+CREATE INDEX index_ci_runners_on_created_at_and_id_desc ON ci_runners USING btree (created_at, id DESC);
+
+CREATE INDEX index_ci_runners_on_created_at_desc_and_id_desc ON ci_runners USING btree (created_at DESC, id DESC);
+
+CREATE INDEX index_ci_runners_on_description_trigram ON ci_runners USING gin (description gin_trgm_ops);
CREATE INDEX index_ci_runners_on_locked ON ci_runners USING btree (locked);
@@ -22716,6 +22975,12 @@ CREATE INDEX index_ci_runners_on_token ON ci_runners USING btree (token);
CREATE INDEX index_ci_runners_on_token_encrypted ON ci_runners USING btree (token_encrypted);
+CREATE UNIQUE INDEX index_ci_running_builds_on_build_id ON ci_running_builds USING btree (build_id);
+
+CREATE INDEX index_ci_running_builds_on_project_id ON ci_running_builds USING btree (project_id);
+
+CREATE INDEX index_ci_running_builds_on_runner_id ON ci_running_builds USING btree (runner_id);
+
CREATE INDEX index_ci_sources_pipelines_on_pipeline_id ON ci_sources_pipelines USING btree (pipeline_id);
CREATE INDEX index_ci_sources_pipelines_on_project_id ON ci_sources_pipelines USING btree (project_id);
@@ -23066,6 +23331,10 @@ CREATE INDEX index_epics_on_start_date_sourcing_epic_id ON epics USING btree (st
CREATE INDEX index_epics_on_start_date_sourcing_milestone_id ON epics USING btree (start_date_sourcing_milestone_id);
+CREATE INDEX index_esc_protected_branches_on_external_status_check_id ON external_status_checks_protected_branches USING btree (external_status_check_id);
+
+CREATE INDEX index_esc_protected_branches_on_protected_branch_id ON external_status_checks_protected_branches USING btree (protected_branch_id);
+
CREATE INDEX index_events_on_action ON events USING btree (action);
CREATE INDEX index_events_on_author_id_and_created_at ON events USING btree (author_id, created_at);
@@ -23090,7 +23359,7 @@ CREATE INDEX index_evidences_on_release_id ON evidences USING btree (release_id)
CREATE INDEX index_experiment_subjects_on_experiment_id ON experiment_subjects USING btree (experiment_id);
-CREATE INDEX index_experiment_subjects_on_group_id ON experiment_subjects USING btree (group_id);
+CREATE INDEX index_experiment_subjects_on_namespace_id ON experiment_subjects USING btree (namespace_id);
CREATE INDEX index_experiment_subjects_on_project_id ON experiment_subjects USING btree (project_id);
@@ -23400,6 +23669,8 @@ CREATE INDEX index_jira_tracker_data_on_service_id ON jira_tracker_data USING bt
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 INDEX index_keys_on_expires_at_and_id ON keys USING btree (date(timezone('UTC'::text, expires_at)), id) 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);
@@ -23496,8 +23767,16 @@ CREATE UNIQUE INDEX index_merge_request_cleanup_schedules_on_merge_request_id ON
CREATE INDEX index_merge_request_diff_commits_on_sha ON merge_request_diff_commits USING btree (sha);
+CREATE INDEX index_merge_request_diff_details_failed_verification ON merge_request_diff_details USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);
+
+CREATE INDEX index_merge_request_diff_details_needs_verification ON merge_request_diff_details USING btree (verification_state) WHERE ((verification_state = 0) OR (verification_state = 3));
+
CREATE INDEX index_merge_request_diff_details_on_merge_request_diff_id ON merge_request_diff_details USING btree (merge_request_diff_id);
+CREATE INDEX index_merge_request_diff_details_on_verification_state ON merge_request_diff_details USING btree (verification_state);
+
+CREATE INDEX index_merge_request_diff_details_pending_verification ON merge_request_diff_details USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);
+
CREATE INDEX index_merge_request_diffs_by_id_partial ON merge_request_diffs USING btree (id) WHERE ((files_count > 0) AND ((NOT stored_externally) OR (stored_externally IS NULL)));
CREATE INDEX index_merge_request_diffs_on_external_diff_store ON merge_request_diffs USING btree (external_diff_store);
@@ -23724,7 +24003,7 @@ CREATE INDEX index_on_id_partial_with_legacy_storage ON projects USING btree (id
CREATE INDEX index_on_identities_lower_extern_uid_and_provider ON identities USING btree (lower((extern_uid)::text), provider);
-CREATE UNIQUE INDEX index_on_instance_statistics_recorded_at_and_identifier ON analytics_instance_statistics_measurements USING btree (identifier, recorded_at);
+CREATE UNIQUE INDEX index_on_instance_statistics_recorded_at_and_identifier ON analytics_usage_trends_measurements USING btree (identifier, recorded_at);
CREATE INDEX index_on_label_links_all_columns ON label_links USING btree (target_id, label_id, target_type);
@@ -23748,12 +24027,6 @@ CREATE INDEX index_on_projects_lower_path ON projects USING btree (lower((path):
CREATE INDEX index_on_routes_lower_path ON routes USING btree (lower((path)::text));
-CREATE UNIQUE INDEX index_on_segment_selections_group_id_segment_id ON analytics_devops_adoption_segment_selections USING btree (group_id, segment_id);
-
-CREATE UNIQUE INDEX index_on_segment_selections_project_id_segment_id ON analytics_devops_adoption_segment_selections USING btree (project_id, segment_id);
-
-CREATE INDEX index_on_segment_selections_segment_id ON analytics_devops_adoption_segment_selections USING btree (segment_id);
-
CREATE INDEX index_on_snapshots_segment_id_end_time ON analytics_devops_adoption_snapshots USING btree (segment_id, end_time);
CREATE INDEX index_on_snapshots_segment_id_recorded_at ON analytics_devops_adoption_snapshots USING btree (segment_id, recorded_at);
@@ -23978,6 +24251,10 @@ CREATE UNIQUE INDEX index_project_features_on_project_id ON project_features USI
CREATE INDEX index_project_features_on_project_id_bal_20 ON project_features USING btree (project_id) WHERE (builds_access_level = 20);
+CREATE UNIQUE INDEX index_project_features_on_project_id_include_container_registry ON project_features USING btree (project_id) INCLUDE (container_registry_access_level);
+
+COMMENT ON INDEX index_project_features_on_project_id_include_container_registry IS 'Included column (container_registry_access_level) improves performance of the ContainerRepository.for_group_and_its_subgroups scope query';
+
CREATE INDEX index_project_features_on_project_id_ral_20 ON project_features USING btree (project_id) WHERE (repository_access_level = 20);
CREATE INDEX index_project_group_links_on_group_id ON project_group_links USING btree (group_id);
@@ -24164,6 +24441,8 @@ CREATE INDEX index_protected_environment_deploy_access_levels_on_group_id ON pro
CREATE INDEX index_protected_environment_deploy_access_levels_on_user_id ON protected_environment_deploy_access_levels USING btree (user_id);
+CREATE UNIQUE INDEX index_protected_environments_on_group_id_and_name ON protected_environments USING btree (group_id, name) WHERE (group_id IS NOT NULL);
+
CREATE INDEX index_protected_environments_on_project_id ON protected_environments USING btree (project_id);
CREATE UNIQUE INDEX index_protected_environments_on_project_id_and_name ON protected_environments USING btree (project_id, name);
@@ -24434,7 +24713,7 @@ CREATE INDEX index_sprints_on_due_date ON sprints USING btree (due_date);
CREATE INDEX index_sprints_on_group_id ON sprints USING btree (group_id);
-CREATE UNIQUE INDEX index_sprints_on_group_id_and_title ON sprints USING btree (group_id, title) WHERE (group_id IS NOT NULL);
+CREATE UNIQUE INDEX index_sprints_on_iterations_cadence_id_and_title ON sprints USING btree (iterations_cadence_id, title);
CREATE UNIQUE INDEX index_sprints_on_project_id_and_iid ON sprints USING btree (project_id, iid);
@@ -24446,6 +24725,8 @@ CREATE INDEX index_sprints_on_title_trigram ON sprints USING gin (title gin_trgm
CREATE INDEX index_status_check_responses_on_external_approval_rule_id ON status_check_responses USING btree (external_approval_rule_id);
+CREATE INDEX index_status_check_responses_on_external_status_check_id ON status_check_responses USING btree (external_status_check_id);
+
CREATE INDEX index_status_check_responses_on_merge_request_id ON status_check_responses USING btree (merge_request_id);
CREATE UNIQUE INDEX index_status_page_published_incidents_on_issue_id ON status_page_published_incidents USING btree (issue_id);
@@ -24550,6 +24831,8 @@ CREATE INDEX index_unit_test_failures_failed_at ON ci_unit_test_failures USING b
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 UNIQUE INDEX index_upcoming_reconciliations_on_namespace_id ON upcoming_reconciliations USING btree (namespace_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);
@@ -24744,6 +25027,8 @@ CREATE UNIQUE INDEX index_vulnerability_remediations_on_project_id_and_checksum
CREATE UNIQUE INDEX index_vulnerability_scanners_on_project_id_and_external_id ON vulnerability_scanners USING btree (project_id, external_id);
+CREATE INDEX index_vulnerability_statistics_on_latest_pipeline_id ON vulnerability_statistics USING btree (latest_pipeline_id);
+
CREATE INDEX index_vulnerability_statistics_on_letter_grade ON vulnerability_statistics USING btree (letter_grade);
CREATE UNIQUE INDEX index_vulnerability_statistics_on_unique_project_id ON vulnerability_statistics USING btree (project_id);
@@ -24754,10 +25039,6 @@ CREATE UNIQUE INDEX index_vulns_user_mentions_on_vulnerability_id ON vulnerabili
CREATE UNIQUE INDEX index_vulns_user_mentions_on_vulnerability_id_and_note_id ON vulnerability_user_mentions USING btree (vulnerability_id, note_id);
-CREATE INDEX index_web_hook_logs_on_created_at_and_web_hook_id ON web_hook_logs_archived USING btree (created_at, web_hook_id);
-
-CREATE INDEX index_web_hook_logs_on_web_hook_id ON web_hook_logs_archived USING btree (web_hook_id);
-
CREATE INDEX index_web_hook_logs_part_on_created_at_and_web_hook_id ON ONLY web_hook_logs USING btree (created_at, web_hook_id);
CREATE INDEX index_web_hook_logs_part_on_web_hook_id ON ONLY web_hook_logs USING btree (web_hook_id);
@@ -24856,7 +25137,9 @@ CREATE INDEX tmp_idx_deduplicate_vulnerability_occurrences ON vulnerability_occu
CREATE INDEX tmp_idx_on_namespaces_delayed_project_removal ON namespaces USING btree (id) WHERE (delayed_project_removal = true);
-CREATE INDEX tmp_index_on_security_findings_scan_id ON security_findings USING btree (scan_id) WHERE (uuid IS NULL);
+CREATE INDEX tmp_index_namespaces_empty_traversal_ids_with_child_namespaces ON namespaces USING btree (id) WHERE ((parent_id IS NOT NULL) AND (traversal_ids = '{}'::integer[]));
+
+CREATE INDEX tmp_index_namespaces_empty_traversal_ids_with_root_namespaces ON namespaces USING btree (id) WHERE ((parent_id IS NULL) AND (traversal_ids = '{}'::integer[]));
CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING btree (id) WHERE (state <> 2);
@@ -25140,24 +25423,34 @@ ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_p
ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_partitions_static.product_analytics_events_experimental_63_pkey;
-CREATE TRIGGER table_sync_trigger_b99eb6998c AFTER INSERT OR DELETE OR UPDATE ON web_hook_logs FOR EACH ROW EXECUTE FUNCTION table_sync_function_29bc99d6db();
-
CREATE TRIGGER trigger_07c94931164e BEFORE INSERT OR UPDATE ON push_event_payloads FOR EACH ROW EXECUTE FUNCTION trigger_07c94931164e();
CREATE TRIGGER trigger_21e7a2602957 BEFORE INSERT OR UPDATE ON ci_build_needs FOR EACH ROW EXECUTE FUNCTION trigger_21e7a2602957();
CREATE TRIGGER trigger_3f6129be01d2 BEFORE INSERT OR UPDATE ON ci_builds FOR EACH ROW EXECUTE FUNCTION trigger_3f6129be01d2();
+CREATE TRIGGER trigger_490d204c00b3 BEFORE INSERT OR UPDATE ON ci_stages FOR EACH ROW EXECUTE FUNCTION trigger_490d204c00b3();
+
CREATE TRIGGER trigger_51ab7cef8934 BEFORE INSERT OR UPDATE ON ci_builds_runner_session FOR EACH ROW EXECUTE FUNCTION trigger_51ab7cef8934();
CREATE TRIGGER trigger_69523443cc10 BEFORE INSERT OR UPDATE ON events FOR EACH ROW EXECUTE FUNCTION trigger_69523443cc10();
+CREATE TRIGGER trigger_77f5e1d20482 BEFORE INSERT OR UPDATE ON deployments FOR EACH ROW EXECUTE FUNCTION trigger_77f5e1d20482();
+
CREATE TRIGGER trigger_8485e97c00e3 BEFORE INSERT OR UPDATE ON ci_sources_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_8485e97c00e3();
+CREATE TRIGGER trigger_8487d4de3e7b BEFORE INSERT OR UPDATE ON ci_builds_metadata FOR EACH ROW EXECUTE FUNCTION trigger_8487d4de3e7b();
+
+CREATE TRIGGER trigger_91dc388a5fe6 BEFORE INSERT OR UPDATE ON ci_build_trace_sections FOR EACH ROW EXECUTE FUNCTION trigger_91dc388a5fe6();
+
+CREATE TRIGGER trigger_aebe8b822ad3 BEFORE INSERT OR UPDATE ON taggings FOR EACH ROW EXECUTE FUNCTION trigger_aebe8b822ad3();
+
CREATE TRIGGER trigger_be1804f21693 BEFORE INSERT OR UPDATE ON ci_job_artifacts FOR EACH ROW EXECUTE FUNCTION trigger_be1804f21693();
CREATE TRIGGER trigger_cf2f9e35f002 BEFORE INSERT OR UPDATE ON ci_build_trace_chunks FOR EACH ROW EXECUTE FUNCTION trigger_cf2f9e35f002();
+CREATE TRIGGER trigger_f1ca8ec18d78 BEFORE INSERT OR UPDATE ON geo_job_artifact_deleted_events FOR EACH ROW EXECUTE FUNCTION trigger_f1ca8ec18d78();
+
CREATE TRIGGER trigger_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 FUNCTION set_has_external_issue_tracker();
CREATE TRIGGER trigger_has_external_issue_tracker_on_insert AFTER INSERT ON services FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (new.active = true) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker();
@@ -25215,9 +25508,6 @@ ALTER TABLE ONLY ci_unit_test_failures
ALTER TABLE ONLY project_pages_metadata
ADD CONSTRAINT fk_0fd5b22688 FOREIGN KEY (pages_deployment_id) REFERENCES pages_deployments(id) ON DELETE SET NULL;
-ALTER TABLE ONLY status_check_responses
- ADD CONSTRAINT fk_116e7e7369 FOREIGN KEY (external_approval_rule_id) REFERENCES external_approval_rules(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY group_deletion_schedules
ADD CONSTRAINT fk_11e3ebfcdd FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
@@ -25305,6 +25595,9 @@ ALTER TABLE ONLY notes
ALTER TABLE ONLY members
ADD CONSTRAINT fk_2e88fb7ce9 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY lfs_objects_projects
+ ADD CONSTRAINT fk_2eb33f7a78 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE NOT VALID;
+
ALTER TABLE ONLY lists
ADD CONSTRAINT fk_30f2a831f4 FOREIGN KEY (iteration_id) REFERENCES sprints(id) ON DELETE CASCADE;
@@ -25386,6 +25679,9 @@ ALTER TABLE ONLY clusters_applications_prometheus
ALTER TABLE ONLY terraform_states
ADD CONSTRAINT fk_558901b030 FOREIGN KEY (locked_by_user_id) REFERENCES users(id) ON DELETE SET NULL;
+ALTER TABLE ONLY status_check_responses
+ ADD CONSTRAINT fk_55bd2abc83 FOREIGN KEY (external_status_check_id) REFERENCES external_status_checks(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY merge_request_metrics
ADD CONSTRAINT fk_56067dcb44 FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -25506,6 +25802,9 @@ ALTER TABLE ONLY import_export_uploads
ALTER TABLE ONLY push_rules
ADD CONSTRAINT fk_83b29894de FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY experiment_subjects
+ ADD CONSTRAINT fk_842649f2f5 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY merge_request_diffs
ADD CONSTRAINT fk_8483f3258f FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
@@ -25521,9 +25820,6 @@ ALTER TABLE ONLY packages_package_files
ALTER TABLE ONLY ci_builds
ADD CONSTRAINT fk_87f4cefcda FOREIGN KEY (upstream_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
-ALTER TABLE ONLY experiment_subjects
- ADD CONSTRAINT fk_88489af1b1 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY vulnerabilities
ADD CONSTRAINT fk_88b4d546ef FOREIGN KEY (start_date_sourcing_milestone_id) REFERENCES milestones(id) ON DELETE SET NULL;
@@ -25590,6 +25886,9 @@ ALTER TABLE ONLY issues
ALTER TABLE ONLY epics
ADD CONSTRAINT fk_9d480c64b2 FOREIGN KEY (start_date_sourcing_epic_id) REFERENCES epics(id) ON DELETE SET NULL;
+ALTER TABLE ONLY protected_environments
+ ADD CONSTRAINT fk_9e112565b7 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY alert_management_alerts
ADD CONSTRAINT fk_9e49e5c2b7 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -25617,6 +25916,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 lfs_objects_projects
+ ADD CONSTRAINT fk_a56e02279c FOREIGN KEY (lfs_object_id) REFERENCES lfs_objects(id) ON DELETE RESTRICT NOT VALID;
+
ALTER TABLE ONLY dast_profiles_pipelines
ADD CONSTRAINT fk_a60cad829d FOREIGN KEY (ci_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
@@ -25668,6 +25970,9 @@ ALTER TABLE ONLY bulk_import_entities
ALTER TABLE ONLY compliance_management_frameworks
ADD CONSTRAINT fk_b74c45b71f FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+ALTER TABLE ONLY external_status_checks_protected_branches
+ ADD CONSTRAINT fk_b7d788e813 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY issue_assignees
ADD CONSTRAINT fk_b7d881734a FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
@@ -25728,6 +26033,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 external_status_checks_protected_branches
+ ADD CONSTRAINT fk_cc0dcc36d1 FOREIGN KEY (external_status_check_id) REFERENCES external_status_checks(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;
@@ -25794,9 +26102,6 @@ ALTER TABLE ONLY project_group_links
ALTER TABLE ONLY epics
ADD CONSTRAINT fk_dccd3f98fc FOREIGN KEY (assignee_id) REFERENCES users(id) ON DELETE SET NULL;
-ALTER TABLE ONLY analytics_devops_adoption_segment_selections
- ADD CONSTRAINT fk_ded7fe0344 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY issues
ADD CONSTRAINT fk_df75a7c8b8 FOREIGN KEY (promoted_to_epic_id) REFERENCES epics(id) ON DELETE SET NULL;
@@ -25836,6 +26141,9 @@ ALTER TABLE ONLY sprints
ALTER TABLE ONLY application_settings
ADD CONSTRAINT fk_e8a145f3a7 FOREIGN KEY (instance_administrators_group_id) REFERENCES namespaces(id) ON DELETE SET NULL;
+ALTER TABLE ONLY vulnerability_statistics
+ ADD CONSTRAINT fk_e8b13c928f FOREIGN KEY (latest_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY ci_triggers
ADD CONSTRAINT fk_e8e10d1964 FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE CASCADE;
@@ -25866,9 +26174,6 @@ ALTER TABLE ONLY vulnerability_external_issue_links
ALTER TABLE ONLY epics
ADD CONSTRAINT fk_f081aa4489 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
-ALTER TABLE ONLY analytics_devops_adoption_segment_selections
- ADD CONSTRAINT fk_f1472b95f3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY boards
ADD CONSTRAINT fk_f15266b5f9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -25959,9 +26264,6 @@ ALTER TABLE ONLY ip_restrictions
ALTER TABLE ONLY terraform_state_versions
ADD CONSTRAINT fk_rails_04f176e239 FOREIGN KEY (terraform_state_id) REFERENCES terraform_states(id) ON DELETE CASCADE;
-ALTER TABLE ONLY analytics_devops_adoption_segment_selections
- ADD CONSTRAINT fk_rails_053f00a9da FOREIGN KEY (segment_id) REFERENCES analytics_devops_adoption_segments(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY ci_build_report_results
ADD CONSTRAINT fk_rails_056d298d48 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -26121,6 +26423,9 @@ ALTER TABLE ONLY boards_epic_board_positions
ALTER TABLE ONLY geo_repository_created_events
ADD CONSTRAINT fk_rails_1f49e46a61 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY external_status_checks
+ ADD CONSTRAINT fk_rails_1f5a8aa809 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY dora_daily_metrics
ADD CONSTRAINT fk_rails_1fd07aff6f FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE;
@@ -26259,6 +26564,9 @@ ALTER TABLE ONLY metrics_dashboard_annotations
ALTER TABLE ONLY wiki_page_slugs
ADD CONSTRAINT fk_rails_358b46be14 FOREIGN KEY (wiki_page_meta_id) REFERENCES wiki_page_meta(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_job_token_project_scope_links
+ ADD CONSTRAINT fk_rails_35f7f506ce FOREIGN KEY (added_by_id) REFERENCES users(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY board_labels
ADD CONSTRAINT fk_rails_362b0600a3 FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;
@@ -26274,6 +26582,9 @@ ALTER TABLE ONLY group_merge_request_approval_settings
ALTER TABLE ONLY analytics_cycle_analytics_project_stages
ADD CONSTRAINT fk_rails_3829e49b66 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY packages_debian_project_distribution_keys
+ ADD CONSTRAINT fk_rails_3834a11264 FOREIGN KEY (distribution_id) REFERENCES packages_debian_project_distributions(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY issue_user_mentions
ADD CONSTRAINT fk_rails_3861d9fefa FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;
@@ -26382,9 +26693,18 @@ ALTER TABLE ONLY vulnerability_feedback
ALTER TABLE ONLY user_custom_attributes
ADD CONSTRAINT fk_rails_47b91868a8 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_pending_builds
+ ADD CONSTRAINT fk_rails_480669c3b3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY upcoming_reconciliations
+ ADD CONSTRAINT fk_rails_497b4938ac FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY ci_pipeline_artifacts
ADD CONSTRAINT fk_rails_4a70390ca6 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_job_token_project_scope_links
+ ADD CONSTRAINT fk_rails_4b2ee3290b FOREIGN KEY (source_project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY group_deletion_schedules
ADD CONSTRAINT fk_rails_4b8c694a6c FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -26508,6 +26828,9 @@ ALTER TABLE ONLY vulnerability_scanners
ALTER TABLE ONLY reviews
ADD CONSTRAINT fk_rails_5ca11d8c31 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_running_builds
+ ADD CONSTRAINT fk_rails_5ca491d360 FOREIGN KEY (runner_id) REFERENCES ci_runners(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY epic_issues
ADD CONSTRAINT fk_rails_5d942936b4 FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE;
@@ -26580,9 +26903,6 @@ ALTER TABLE ONLY operations_feature_flags_clients
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_archived
- ADD CONSTRAINT fk_rails_666826e111 FOREIGN KEY (web_hook_id) REFERENCES web_hooks(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY analytics_cycle_analytics_project_value_streams
ADD CONSTRAINT fk_rails_669f4ba293 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -26595,9 +26915,15 @@ ALTER TABLE ONLY vulnerability_findings_remediations
ALTER TABLE ONLY resource_iteration_events
ADD CONSTRAINT fk_rails_6830c13ac1 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
+ALTER TABLE ONLY vulnerability_finding_evidence_headers
+ ADD CONSTRAINT fk_rails_683b8e000c FOREIGN KEY (vulnerability_finding_evidence_response_id) REFERENCES vulnerability_finding_evidence_responses(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY geo_hashed_storage_migrated_events
ADD CONSTRAINT fk_rails_687ed7d7c5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_job_token_project_scope_links
+ ADD CONSTRAINT fk_rails_6904b38465 FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY plan_limits
ADD CONSTRAINT fk_rails_69f8b6184f FOREIGN KEY (plan_id) REFERENCES plans(id) ON DELETE CASCADE;
@@ -26628,6 +26954,9 @@ ALTER TABLE ONLY list_user_preferences
ALTER TABLE ONLY project_custom_attributes
ADD CONSTRAINT fk_rails_719c3dccc5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_pending_builds
+ ADD CONSTRAINT fk_rails_725a2644a3 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY security_findings
ADD CONSTRAINT fk_rails_729b763a54 FOREIGN KEY (scanner_id) REFERENCES vulnerability_scanners(id) ON DELETE CASCADE;
@@ -26682,6 +27011,9 @@ ALTER TABLE ONLY packages_debian_publications
ALTER TABLE ONLY boards_epic_user_preferences
ADD CONSTRAINT fk_rails_76c4e9732d FOREIGN KEY (epic_id) REFERENCES epics(id) ON DELETE CASCADE;
+ALTER TABLE ONLY packages_debian_group_distribution_keys
+ ADD CONSTRAINT fk_rails_779438f163 FOREIGN KEY (distribution_id) REFERENCES packages_debian_group_distributions(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY ci_subscriptions_projects
ADD CONSTRAINT fk_rails_7871f9a97b FOREIGN KEY (upstream_project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -27159,6 +27491,9 @@ ALTER TABLE ONLY operations_strategies_user_lists
ALTER TABLE ONLY issue_tracker_data
ADD CONSTRAINT fk_rails_ccc0840427 FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE;
+ALTER TABLE ONLY vulnerability_finding_evidence_headers
+ ADD CONSTRAINT fk_rails_ce7f121a03 FOREIGN KEY (vulnerability_finding_evidence_request_id) REFERENCES vulnerability_finding_evidence_requests(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY resource_milestone_events
ADD CONSTRAINT fk_rails_cedf8cce4d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;
@@ -27201,6 +27536,9 @@ ALTER TABLE ONLY geo_hashed_storage_attachments_events
ALTER TABLE ONLY merge_request_reviewers
ADD CONSTRAINT fk_rails_d9fec24b9d FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_running_builds
+ ADD CONSTRAINT fk_rails_da45cfa165 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY jira_imports
ADD CONSTRAINT fk_rails_da617096ce FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;
@@ -27213,6 +27551,9 @@ ALTER TABLE ONLY issues_prometheus_alert_events
ALTER TABLE ONLY board_user_preferences
ADD CONSTRAINT fk_rails_dbebdaa8fe FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_running_builds
+ ADD CONSTRAINT fk_rails_dc1d0801e8 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY vulnerability_occurrence_pipelines
ADD CONSTRAINT fk_rails_dc3ae04693 FOREIGN KEY (occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;
@@ -27240,6 +27581,9 @@ ALTER TABLE ONLY analytics_cycle_analytics_group_stages
ALTER TABLE ONLY bulk_import_export_uploads
ADD CONSTRAINT fk_rails_dfbfb45eca FOREIGN KEY (export_id) REFERENCES bulk_import_exports(id) ON DELETE CASCADE;
+ALTER TABLE ONLY ci_minutes_additional_packs
+ ADD CONSTRAINT fk_rails_e0e0c4e4b1 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY label_priorities
ADD CONSTRAINT fk_rails_e161058b0f FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;