summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-20 09:55:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-20 09:55:51 +0000
commite8d2c2579383897a1dd7f9debd359abe8ae8373d (patch)
treec42be41678c2586d49a75cabce89322082698334 /db
parentfc845b37ec3a90aaa719975f607740c22ba6a113 (diff)
downloadgitlab-ce-e8d2c2579383897a1dd7f9debd359abe8ae8373d.tar.gz
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'db')
-rw-r--r--db/ci_migrate/20210617101848_create_ci_instance_variables_on_ci.rb31
-rw-r--r--db/ci_schema_migrations/202106171018481
-rw-r--r--db/ci_structure.sql45
-rw-r--r--db/fixtures/development/19_environments.rb2
-rw-r--r--db/gitlab_structure.sql3
-rw-r--r--db/migrate/20201224144948_migrate_coverage_report_worker.rb4
-rw-r--r--db/migrate/20210317210338_add_valid_runner_registrars.rb7
-rw-r--r--db/migrate/20210526155257_rename_sync_security_report_approval_rules_sidekiq_queue.rb4
-rw-r--r--db/migrate/20210601132134_remove_partial_index_for_hashed_storage_migration.rb15
-rw-r--r--db/migrate/20210602155056_add_merge_request_diff_commit_users.rb31
-rw-r--r--db/migrate/20210602155110_add_merge_request_diff_commit_user_columns.rb25
-rw-r--r--db/migrate/20210604032738_create_dast_site_profiles_builds.rb18
-rw-r--r--db/migrate/20210604034158_add_ci_build_id_fk_to_dast_site_profiles_builds.rb19
-rw-r--r--db/migrate/20210604034354_add_dast_site_profile_id_fk_to_dast_site_profiles_builds.rb19
-rw-r--r--db/migrate/20210604051330_create_dast_scanner_profiles_builds.rb18
-rw-r--r--db/migrate/20210604051742_add_ci_build_id_fk_to_dast_scanner_profiles_builds.rb19
-rw-r--r--db/migrate/20210604051917_add_dast_scanner_profile_id_fk_to_dast_scanner_profiles_builds.rb19
-rw-r--r--db/migrate/20210610153556_delete_legacy_operations_feature_flags.rb13
-rw-r--r--db/migrate/20210611101034_add_devops_adoption_sast_dast.rb8
-rw-r--r--db/migrate/20210614142311_add_running_container_scanning_max_size_to_plan_limits.rb7
-rw-r--r--db/migrate/20210615064342_add_issue_id_to_requirement.rb17
-rw-r--r--db/migrate/20210616110748_add_issue_index_to_requirement.rb17
-rw-r--r--db/migrate/20210616111311_add_issue_requirement_foreign_key.rb19
-rw-r--r--db/migrate/20210616134905_add_timestamp_to_schema_migration.rb15
-rw-r--r--db/migrate/20210616154808_remove_ci_build_protected_index.rb19
-rw-r--r--db/migrate/20210616185947_add_mailgun_settings_to_application_setting.rb10
-rw-r--r--db/migrate/20210617022324_create_incident_management_pending_alert_escalations.rb48
-rw-r--r--db/migrate/20210617161348_cascade_delete_freeze_periods.rb23
-rw-r--r--db/migrate/20210617180131_migrate_usage_ping_sidekiq_queue.rb15
-rw-r--r--db/migrate/20210621043337_rename_services_to_integrations.rb150
-rw-r--r--db/migrate/20210621044000_rename_services_indexes_to_integrations.rb30
-rw-r--r--db/migrate/20210621084632_add_summary_to_timelogs.rb10
-rw-r--r--db/migrate/20210621090030_add_text_limit_to_timelogs_summary.rb15
-rw-r--r--db/migrate/20210621091830_add_devops_adoption_snapshot_dependency_scanning.rb7
-rw-r--r--db/migrate/20210622135221_add_foreign_key_for_environment_id_to_environments.rb21
-rw-r--r--db/migrate/20210623074226_add_usage_ping_features_enabled_to_application_settings.rb11
-rw-r--r--db/migrate/20210623123722_add_present_on_default_branch_to_vulnerabilities.rb17
-rw-r--r--db/migrate/20210623133635_create_error_tracking_errors.rb28
-rw-r--r--db/migrate/20210623163342_add_index_to_compliance_management_frameworks_pipeline_configuration.rb17
-rw-r--r--db/migrate/20210624112821_add_devops_adoption_coverage_fuzzing.rb7
-rw-r--r--db/migrate/20210624180613_add_last_synced_at_to_licenses.rb7
-rw-r--r--db/migrate/20210625094554_create_error_tracking_error_events.rb30
-rw-r--r--db/migrate/20210627204936_add_plan_limits_max_size_cluster_image_scanning_column.rb7
-rw-r--r--db/migrate/20210629153519_add_index_to_bulk_import_entities_on_bulk_import_id_and_status.rb20
-rw-r--r--db/migrate/20210630144339_add_invite_email_success_to_members.rb11
-rw-r--r--db/migrate/20210701111627_add_upvotes_count_to_issues.rb15
-rw-r--r--db/migrate/20210702124842_add_ci_job_trace_size_to_plan_limits.rb7
-rw-r--r--db/migrate/20210705124128_add_project_settings_previous_default_branch.rb20
-rw-r--r--db/migrate/20210705130919_create_container_repos_on_exp_cleanup_status_project_id_start_date_index.rb24
-rw-r--r--db/migrate/20210705132928_add_new_user_signups_cap_to_namespace_settings.rb17
-rw-r--r--db/migrate/20210705144657_add_instance_runners_enabled_to_ci_pending_build.rb19
-rw-r--r--db/migrate/20210706084713_add_devops_adoption_snapshots_index.rb17
-rw-r--r--db/migrate/20210706152139_add_index_type_to_postgres_indexes_view.rb57
-rw-r--r--db/migrate/20210706213537_add_premium_and_ultimate_plan_limits.rb40
-rw-r--r--db/migrate/20210707095545_add_status_to_merge_request_cleanup_schedules.rb25
-rw-r--r--db/migrate/20210707151536_create_vulnerability_finding_evidence_sources.rb26
-rw-r--r--db/migrate/20210707171536_create_vulnerability_finding_evidence_assets.rb28
-rw-r--r--db/migrate/20210707171554_create_vulnerability_flags.rb30
-rw-r--r--db/migrate/20210707173645_add_project_settings_previous_default_branch_text_limit.rb15
-rw-r--r--db/migrate/20210707181536_create_vulnerability_finding_evidence_supporting_messages.rb26
-rw-r--r--db/migrate/20210708063032_add_failed_count_to_merge_request_cleanup_schedules.rb9
-rw-r--r--db/migrate/20210708124229_add_security_scans_created_at_index.rb17
-rw-r--r--db/migrate/20210708131048_add_error_tracking_counter_cache.rb11
-rw-r--r--db/migrate/20210708134446_remove_not_null_constraint_from_terms.rb11
-rw-r--r--db/migrate/20210709085759_index_batched_migration_jobs_by_max_value.rb17
-rw-r--r--db/migrate/20210709132707_change_default_job_token_scope_enabled.rb17
-rw-r--r--db/migrate/20210713070842_update_merge_request_cleanup_schedules_scheduled_at_index.rb20
-rw-r--r--db/migrate/20210713135152_add_devops_adoption_vulnerability_management_used_count.rb7
-rw-r--r--db/migrate/20210713144637_add_vulnerabilities_created_at_index.rb17
-rw-r--r--db/migrate/20210714120600_add_detected_at_to_vulnerabilities.rb18
-rw-r--r--db/migrate/20210716074555_revert_default_job_token_scope.rb17
-rw-r--r--db/post_migrate/20210602164044_schedule_latest_pipeline_id_population.rb13
-rw-r--r--db/post_migrate/20210604133651_schedule_merge_request_diff_users_background_migration.rb11
-rw-r--r--db/post_migrate/20210609202501_schedule_backfill_draft_status_on_merge_requests.rb32
-rw-r--r--db/post_migrate/20210610042700_remove_clusters_applications_fluentd_table.rb26
-rw-r--r--db/post_migrate/20210614124111_add_devops_adoption_sast_dast_indexes.rb20
-rw-r--r--db/post_migrate/20210615234935_fix_batched_migrations_old_format_job_arguments.rb32
-rw-r--r--db/post_migrate/20210616145254_add_partial_index_for_ci_builds_token.rb17
-rw-r--r--db/post_migrate/20210621111747_add_ci_artifacts_devops_adoption_index.rb17
-rw-r--r--db/post_migrate/20210621155328_replace_project_authorizations_project_id_index.rb20
-rw-r--r--db/post_migrate/20210621164210_drop_remove_on_close_from_labels.rb19
-rw-r--r--db/post_migrate/20210621223000_steal_background_jobs_that_reference_services.rb14
-rw-r--r--db/post_migrate/20210621223242_finalize_rename_services_to_integrations.rb13
-rw-r--r--db/post_migrate/20210622041846_finalize_push_event_payloads_bigint_conversion.rb75
-rw-r--r--db/post_migrate/20210622141148_schedule_delete_orphaned_deployments.rb26
-rw-r--r--db/post_migrate/20210628124505_reset_job_token_scope_enabled.rb16
-rw-r--r--db/post_migrate/20210629101712_remove_deprecated_modsecurity_columns.rb21
-rw-r--r--db/post_migrate/20210629104933_drop_index_on_ci_builds_for_token.rb17
-rw-r--r--db/post_migrate/20210630025020_migrate_push_event_payloads_event_id_back_to_integer_for_gitlab_com.rb15
-rw-r--r--db/post_migrate/20210701111909_backfill_issues_upvotes_count.rb26
-rw-r--r--db/post_migrate/20210706115312_add_upvotes_count_index_to_issues.rb17
-rw-r--r--db/post_migrate/20210706120847_remove_framework_column_from_compliance_management_frameworks.rb7
-rw-r--r--db/post_migrate/20210706142819_re_schedule_latest_pipeline_id_population.rb28
-rw-r--r--db/post_migrate/20210708130419_reschedule_merge_request_diff_users_background_migration.rb58
-rw-r--r--db/schema_migrations/202103172103381
-rw-r--r--db/schema_migrations/202106011321341
-rw-r--r--db/schema_migrations/202106021550561
-rw-r--r--db/schema_migrations/202106021551101
-rw-r--r--db/schema_migrations/202106021640441
-rw-r--r--db/schema_migrations/202106040327381
-rw-r--r--db/schema_migrations/202106040341581
-rw-r--r--db/schema_migrations/202106040343541
-rw-r--r--db/schema_migrations/202106040513301
-rw-r--r--db/schema_migrations/202106040517421
-rw-r--r--db/schema_migrations/202106040519171
-rw-r--r--db/schema_migrations/202106041336511
-rw-r--r--db/schema_migrations/202106092025011
-rw-r--r--db/schema_migrations/202106100427001
-rw-r--r--db/schema_migrations/202106101535561
-rw-r--r--db/schema_migrations/202106111010341
-rw-r--r--db/schema_migrations/202106141241111
-rw-r--r--db/schema_migrations/202106141423111
-rw-r--r--db/schema_migrations/202106150643421
-rw-r--r--db/schema_migrations/202106152349351
-rw-r--r--db/schema_migrations/202106161107481
-rw-r--r--db/schema_migrations/202106161113111
-rw-r--r--db/schema_migrations/202106161349051
-rw-r--r--db/schema_migrations/202106161452541
-rw-r--r--db/schema_migrations/202106161548081
-rw-r--r--db/schema_migrations/202106161859471
-rw-r--r--db/schema_migrations/202106170223241
-rw-r--r--db/schema_migrations/202106171613481
-rw-r--r--db/schema_migrations/202106171801311
-rw-r--r--db/schema_migrations/202106210433371
-rw-r--r--db/schema_migrations/202106210440001
-rw-r--r--db/schema_migrations/202106210846321
-rw-r--r--db/schema_migrations/202106210900301
-rw-r--r--db/schema_migrations/202106210918301
-rw-r--r--db/schema_migrations/202106211117471
-rw-r--r--db/schema_migrations/202106211553281
-rw-r--r--db/schema_migrations/202106211642101
-rw-r--r--db/schema_migrations/202106212230001
-rw-r--r--db/schema_migrations/202106212232421
-rw-r--r--db/schema_migrations/202106220418461
-rw-r--r--db/schema_migrations/202106221352211
-rw-r--r--db/schema_migrations/202106221411481
-rw-r--r--db/schema_migrations/202106230742261
-rw-r--r--db/schema_migrations/202106231237221
-rw-r--r--db/schema_migrations/202106231336351
-rw-r--r--db/schema_migrations/202106231633421
-rw-r--r--db/schema_migrations/202106241128211
-rw-r--r--db/schema_migrations/202106241806131
-rw-r--r--db/schema_migrations/202106250945541
-rw-r--r--db/schema_migrations/202106272049361
-rw-r--r--db/schema_migrations/202106281245051
-rw-r--r--db/schema_migrations/202106291017121
-rw-r--r--db/schema_migrations/202106291049331
-rw-r--r--db/schema_migrations/202106291535191
-rw-r--r--db/schema_migrations/202106300250201
-rw-r--r--db/schema_migrations/202106301443391
-rw-r--r--db/schema_migrations/202107011116271
-rw-r--r--db/schema_migrations/202107011119091
-rw-r--r--db/schema_migrations/202107021248421
-rw-r--r--db/schema_migrations/202107051241281
-rw-r--r--db/schema_migrations/202107051309191
-rw-r--r--db/schema_migrations/202107051329281
-rw-r--r--db/schema_migrations/202107051446571
-rw-r--r--db/schema_migrations/202107060847131
-rw-r--r--db/schema_migrations/202107061153121
-rw-r--r--db/schema_migrations/202107061208471
-rw-r--r--db/schema_migrations/202107061428191
-rw-r--r--db/schema_migrations/202107061521391
-rw-r--r--db/schema_migrations/202107062135371
-rw-r--r--db/schema_migrations/202107070955451
-rw-r--r--db/schema_migrations/202107071515361
-rw-r--r--db/schema_migrations/202107071715361
-rw-r--r--db/schema_migrations/202107071715541
-rw-r--r--db/schema_migrations/202107071736451
-rw-r--r--db/schema_migrations/202107071815361
-rw-r--r--db/schema_migrations/202107080630321
-rw-r--r--db/schema_migrations/202107081242291
-rw-r--r--db/schema_migrations/202107081304191
-rw-r--r--db/schema_migrations/202107081310481
-rw-r--r--db/schema_migrations/202107081344461
-rw-r--r--db/schema_migrations/202107090857591
-rw-r--r--db/schema_migrations/202107091327071
-rw-r--r--db/schema_migrations/202107130708421
-rw-r--r--db/schema_migrations/202107131351521
-rw-r--r--db/schema_migrations/202107131446371
-rw-r--r--db/schema_migrations/202107141206001
-rw-r--r--db/schema_migrations/202107160745551
-rw-r--r--db/structure.sql614
182 files changed, 2487 insertions, 160 deletions
diff --git a/db/ci_migrate/20210617101848_create_ci_instance_variables_on_ci.rb b/db/ci_migrate/20210617101848_create_ci_instance_variables_on_ci.rb
new file mode 100644
index 00000000000..7274e6bcdf2
--- /dev/null
+++ b/db/ci_migrate/20210617101848_create_ci_instance_variables_on_ci.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class CreateCiInstanceVariablesOnCi < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:ci_instance_variables)
+ create_table :ci_instance_variables do |t|
+ t.integer :variable_type, null: false, limit: 2, default: 1
+ t.boolean :masked, default: false, allow_null: false
+ t.boolean :protected, default: false, allow_null: false
+ t.text :key, null: false
+ t.text :encrypted_value
+ t.text :encrypted_value_iv
+
+ t.index [:key], name: 'index_ci_instance_variables_on_key', unique: true, using: :btree
+ end
+ end
+
+ add_text_limit(:ci_instance_variables, :key, 255)
+ # Use constraint_name generated from db/migrate/20200625193358_increase_size_on_instance_level_variable_values.rb
+ add_text_limit(:ci_instance_variables, :encrypted_value, 13_579, constraint_name: 'check_956afd70f1')
+ add_text_limit(:ci_instance_variables, :encrypted_value_iv, 255)
+ end
+
+ def down
+ drop_table :ci_instance_variables
+ end
+end
diff --git a/db/ci_schema_migrations/20210617101848 b/db/ci_schema_migrations/20210617101848
new file mode 100644
index 00000000000..2969c694fa2
--- /dev/null
+++ b/db/ci_schema_migrations/20210617101848
@@ -0,0 +1 @@
+1b74312f59f6f8937cd0dd754d22dc72e9bdc7302e6254a2fda5762afebe303c \ No newline at end of file
diff --git a/db/ci_structure.sql b/db/ci_structure.sql
new file mode 100644
index 00000000000..1b898012f46
--- /dev/null
+++ b/db/ci_structure.sql
@@ -0,0 +1,45 @@
+CREATE TABLE ar_internal_metadata (
+ key character varying NOT NULL,
+ value character varying,
+ created_at timestamp(6) without time zone NOT NULL,
+ updated_at timestamp(6) without time zone NOT NULL
+);
+
+CREATE TABLE ci_instance_variables (
+ id bigint NOT NULL,
+ variable_type smallint DEFAULT 1 NOT NULL,
+ masked boolean DEFAULT false,
+ protected boolean DEFAULT false,
+ key text NOT NULL,
+ encrypted_value text,
+ encrypted_value_iv text,
+ CONSTRAINT check_07a45a5bcb CHECK ((char_length(encrypted_value_iv) <= 255)),
+ CONSTRAINT check_5aede12208 CHECK ((char_length(key) <= 255)),
+ CONSTRAINT check_956afd70f1 CHECK ((char_length(encrypted_value) <= 13579))
+);
+
+CREATE SEQUENCE ci_instance_variables_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE ci_instance_variables_id_seq OWNED BY ci_instance_variables.id;
+
+CREATE TABLE schema_migrations (
+ version character varying NOT NULL
+);
+
+ALTER TABLE ONLY ci_instance_variables ALTER COLUMN id SET DEFAULT nextval('ci_instance_variables_id_seq'::regclass);
+
+ALTER TABLE ONLY ar_internal_metadata
+ ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
+
+ALTER TABLE ONLY ci_instance_variables
+ ADD CONSTRAINT ci_instance_variables_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY schema_migrations
+ ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
+
+CREATE UNIQUE INDEX index_ci_instance_variables_on_key ON ci_instance_variables USING btree (key);
diff --git a/db/fixtures/development/19_environments.rb b/db/fixtures/development/19_environments.rb
index 0f9188164c9..50ce6bfc297 100644
--- a/db/fixtures/development/19_environments.rb
+++ b/db/fixtures/development/19_environments.rb
@@ -6,7 +6,7 @@ class Gitlab::Seeder::Environments
end
def seed!
- @project.create_mock_monitoring_service!(active: true)
+ @project.create_mock_monitoring_integration!(active: true)
create_master_deployments!('production')
create_master_deployments!('staging')
diff --git a/db/gitlab_structure.sql b/db/gitlab_structure.sql
deleted file mode 100644
index 0d4943ccde4..00000000000
--- a/db/gitlab_structure.sql
+++ /dev/null
@@ -1,3 +0,0 @@
--- this file tracks custom GitLab data, such as foreign keys referencing partitioned tables
--- more details can be found in the issue: https://gitlab.com/gitlab-org/gitlab/-/issues/201872
-
diff --git a/db/migrate/20201224144948_migrate_coverage_report_worker.rb b/db/migrate/20201224144948_migrate_coverage_report_worker.rb
index a13e5e859e0..8580a15c256 100644
--- a/db/migrate/20201224144948_migrate_coverage_report_worker.rb
+++ b/db/migrate/20201224144948_migrate_coverage_report_worker.rb
@@ -6,10 +6,10 @@ class MigrateCoverageReportWorker < ActiveRecord::Migration[6.0]
DOWNTIME = false
def up
- sidekiq_queue_migrate 'ci_pipelines_create_artifact', to: 'ci_pipeline_artifacts_coverage_report'
+ sidekiq_queue_migrate 'ci_pipelines_create_artifact', to: 'ci_pipeline_artifacts_coverage_report' # rubocop:disable Migration/SidekiqQueueMigrate
end
def down
- sidekiq_queue_migrate 'ci_pipeline_artifacts_coverage_report', to: 'ci_pipelines_create_artifact'
+ sidekiq_queue_migrate 'ci_pipeline_artifacts_coverage_report', to: 'ci_pipelines_create_artifact' # rubocop:disable Migration/SidekiqQueueMigrate
end
end
diff --git a/db/migrate/20210317210338_add_valid_runner_registrars.rb b/db/migrate/20210317210338_add_valid_runner_registrars.rb
new file mode 100644
index 00000000000..61663836d39
--- /dev/null
+++ b/db/migrate/20210317210338_add_valid_runner_registrars.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddValidRunnerRegistrars < ActiveRecord::Migration[6.0]
+ def change
+ add_column :application_settings, :valid_runner_registrars, :string, array: true, default: %w(project group)
+ 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
index b9cefe456b8..51f234166de 100644
--- 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
@@ -6,10 +6,10 @@ class RenameSyncSecurityReportApprovalRulesSidekiqQueue < ActiveRecord::Migratio
DOWNTIME = false
def up
- sidekiq_queue_migrate 'sync_security_reports_to_report_approval_rules', to: 'ci_sync_reports_to_report_approval_rules'
+ sidekiq_queue_migrate 'sync_security_reports_to_report_approval_rules', to: 'ci_sync_reports_to_report_approval_rules' # rubocop:disable Migration/SidekiqQueueMigrate
end
def down
- sidekiq_queue_migrate 'ci_sync_reports_to_report_approval_rules', to: 'sync_security_reports_to_report_approval_rules'
+ sidekiq_queue_migrate 'ci_sync_reports_to_report_approval_rules', to: 'sync_security_reports_to_report_approval_rules' # rubocop:disable Migration/SidekiqQueueMigrate
end
end
diff --git a/db/migrate/20210601132134_remove_partial_index_for_hashed_storage_migration.rb b/db/migrate/20210601132134_remove_partial_index_for_hashed_storage_migration.rb
new file mode 100644
index 00000000000..d9793832d8c
--- /dev/null
+++ b/db/migrate/20210601132134_remove_partial_index_for_hashed_storage_migration.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class RemovePartialIndexForHashedStorageMigration < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index :projects, :id, name: 'index_on_id_partial_with_legacy_storage'
+ end
+
+ def down
+ add_concurrent_index :projects, :id, where: 'storage_version < 2 or storage_version IS NULL', name: 'index_on_id_partial_with_legacy_storage'
+ end
+end
diff --git a/db/migrate/20210602155056_add_merge_request_diff_commit_users.rb b/db/migrate/20210602155056_add_merge_request_diff_commit_users.rb
new file mode 100644
index 00000000000..f99790e0eca
--- /dev/null
+++ b/db/migrate/20210602155056_add_merge_request_diff_commit_users.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class AddMergeRequestDiffCommitUsers < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ create_table_with_constraints :merge_request_diff_commit_users, id: :bigint do |t|
+ t.text :name
+ t.text :email
+
+ t.text_limit :name, 512
+ t.text_limit :email, 512
+
+ t.index [:name, :email], unique: true
+ end
+
+ # Names or Emails can be optional, so in some cases one of these may be
+ # null. But if both are NULL/empty, no row should exist in this table.
+ add_check_constraint(
+ :merge_request_diff_commit_users,
+ "(COALESCE(name, '') != '') OR (COALESCE(email, '') != '')",
+ :merge_request_diff_commit_users_name_or_email_existence
+ )
+ end
+
+ def down
+ drop_table :merge_request_diff_commit_users
+ end
+end
diff --git a/db/migrate/20210602155110_add_merge_request_diff_commit_user_columns.rb b/db/migrate/20210602155110_add_merge_request_diff_commit_user_columns.rb
new file mode 100644
index 00000000000..8cc86c7e73c
--- /dev/null
+++ b/db/migrate/20210602155110_add_merge_request_diff_commit_user_columns.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class AddMergeRequestDiffCommitUserColumns < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ # NOTE: these columns are _not_ indexed, nor do they use foreign keys.
+ #
+ # This is deliberate, as creating these indexes on GitLab.com takes a _very_
+ # long time. In addition, there's no real need for them either based on how
+ # this data is used.
+ #
+ # For more information, refer to the following:
+ #
+ # - https://gitlab.com/gitlab-com/gl-infra/production/-/issues/5038#note_614592881
+ # - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/63669
+ add_column(:merge_request_diff_commits, :commit_author_id, :bigint)
+ add_column(:merge_request_diff_commits, :committer_id, :bigint)
+ end
+
+ def down
+ remove_column(:merge_request_diff_commits, :commit_author_id)
+ remove_column(:merge_request_diff_commits, :committer_id)
+ end
+end
diff --git a/db/migrate/20210604032738_create_dast_site_profiles_builds.rb b/db/migrate/20210604032738_create_dast_site_profiles_builds.rb
new file mode 100644
index 00000000000..2e9eb2c7cb7
--- /dev/null
+++ b/db/migrate/20210604032738_create_dast_site_profiles_builds.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateDastSiteProfilesBuilds < ActiveRecord::Migration[6.1]
+ def up
+ table_comment = { owner: 'group::dynamic analysis', description: 'Join table between DAST Site Profiles and CI Builds' }
+
+ create_table :dast_site_profiles_builds, primary_key: [:dast_site_profile_id, :ci_build_id], comment: table_comment.to_json do |t|
+ t.bigint :dast_site_profile_id, null: false
+ t.bigint :ci_build_id, null: false
+
+ t.index :ci_build_id, unique: true, name: :dast_site_profiles_builds_on_ci_build_id
+ end
+ end
+
+ def down
+ drop_table :dast_site_profiles_builds
+ end
+end
diff --git a/db/migrate/20210604034158_add_ci_build_id_fk_to_dast_site_profiles_builds.rb b/db/migrate/20210604034158_add_ci_build_id_fk_to_dast_site_profiles_builds.rb
new file mode 100644
index 00000000000..6908da69e08
--- /dev/null
+++ b/db/migrate/20210604034158_add_ci_build_id_fk_to_dast_site_profiles_builds.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddCiBuildIdFkToDastSiteProfilesBuilds < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :dast_site_profiles_builds, :ci_builds, column: :ci_build_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :dast_site_profiles_builds, column: :ci_build_id
+ end
+ end
+end
diff --git a/db/migrate/20210604034354_add_dast_site_profile_id_fk_to_dast_site_profiles_builds.rb b/db/migrate/20210604034354_add_dast_site_profile_id_fk_to_dast_site_profiles_builds.rb
new file mode 100644
index 00000000000..58fe3090a4f
--- /dev/null
+++ b/db/migrate/20210604034354_add_dast_site_profile_id_fk_to_dast_site_profiles_builds.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddDastSiteProfileIdFkToDastSiteProfilesBuilds < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :dast_site_profiles_builds, :dast_site_profiles, column: :dast_site_profile_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :dast_site_profiles_builds, column: :dast_site_profile_id
+ end
+ end
+end
diff --git a/db/migrate/20210604051330_create_dast_scanner_profiles_builds.rb b/db/migrate/20210604051330_create_dast_scanner_profiles_builds.rb
new file mode 100644
index 00000000000..f8a5f735f0d
--- /dev/null
+++ b/db/migrate/20210604051330_create_dast_scanner_profiles_builds.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateDastScannerProfilesBuilds < ActiveRecord::Migration[6.1]
+ def up
+ table_comment = { owner: 'group::dynamic analysis', description: 'Join table between DAST Scanner Profiles and CI Builds' }
+
+ create_table :dast_scanner_profiles_builds, primary_key: [:dast_scanner_profile_id, :ci_build_id], comment: table_comment.to_json do |t|
+ t.bigint :dast_scanner_profile_id, null: false
+ t.bigint :ci_build_id, null: false
+
+ t.index :ci_build_id, unique: true, name: :dast_scanner_profiles_builds_on_ci_build_id
+ end
+ end
+
+ def down
+ drop_table :dast_scanner_profiles_builds
+ end
+end
diff --git a/db/migrate/20210604051742_add_ci_build_id_fk_to_dast_scanner_profiles_builds.rb b/db/migrate/20210604051742_add_ci_build_id_fk_to_dast_scanner_profiles_builds.rb
new file mode 100644
index 00000000000..cc495c749c5
--- /dev/null
+++ b/db/migrate/20210604051742_add_ci_build_id_fk_to_dast_scanner_profiles_builds.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddCiBuildIdFkToDastScannerProfilesBuilds < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :dast_scanner_profiles_builds, :ci_builds, column: :ci_build_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :dast_scanner_profiles_builds, column: :ci_build_id
+ end
+ end
+end
diff --git a/db/migrate/20210604051917_add_dast_scanner_profile_id_fk_to_dast_scanner_profiles_builds.rb b/db/migrate/20210604051917_add_dast_scanner_profile_id_fk_to_dast_scanner_profiles_builds.rb
new file mode 100644
index 00000000000..0c14c798da4
--- /dev/null
+++ b/db/migrate/20210604051917_add_dast_scanner_profile_id_fk_to_dast_scanner_profiles_builds.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddDastScannerProfileIdFkToDastScannerProfilesBuilds < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :dast_scanner_profiles_builds, :dast_scanner_profiles, column: :dast_scanner_profile_id, on_delete: :cascade
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :dast_scanner_profiles_builds, column: :dast_scanner_profile_id
+ end
+ end
+end
diff --git a/db/migrate/20210610153556_delete_legacy_operations_feature_flags.rb b/db/migrate/20210610153556_delete_legacy_operations_feature_flags.rb
new file mode 100644
index 00000000000..f0bcbe5e472
--- /dev/null
+++ b/db/migrate/20210610153556_delete_legacy_operations_feature_flags.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class DeleteLegacyOperationsFeatureFlags < ActiveRecord::Migration[6.1]
+ LEGACY_FEATURE_FLAG_VERSION = 1
+
+ def up
+ execute("DELETE FROM operations_feature_flags WHERE version = #{LEGACY_FEATURE_FLAG_VERSION}")
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20210611101034_add_devops_adoption_sast_dast.rb b/db/migrate/20210611101034_add_devops_adoption_sast_dast.rb
new file mode 100644
index 00000000000..0a9eb64a5fc
--- /dev/null
+++ b/db/migrate/20210611101034_add_devops_adoption_sast_dast.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+class AddDevopsAdoptionSastDast < ActiveRecord::Migration[6.1]
+ def change
+ add_column :analytics_devops_adoption_snapshots, :sast_enabled_count, :integer
+ add_column :analytics_devops_adoption_snapshots, :dast_enabled_count, :integer
+ end
+end
diff --git a/db/migrate/20210614142311_add_running_container_scanning_max_size_to_plan_limits.rb b/db/migrate/20210614142311_add_running_container_scanning_max_size_to_plan_limits.rb
new file mode 100644
index 00000000000..248fff6c42f
--- /dev/null
+++ b/db/migrate/20210614142311_add_running_container_scanning_max_size_to_plan_limits.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddRunningContainerScanningMaxSizeToPlanLimits < ActiveRecord::Migration[6.0]
+ def change
+ add_column :plan_limits, :ci_max_artifact_size_running_container_scanning, :integer, null: false, default: 0
+ end
+end
diff --git a/db/migrate/20210615064342_add_issue_id_to_requirement.rb b/db/migrate/20210615064342_add_issue_id_to_requirement.rb
new file mode 100644
index 00000000000..a6d85bd9d6e
--- /dev/null
+++ b/db/migrate/20210615064342_add_issue_id_to_requirement.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIssueIdToRequirement < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ add_column :requirements, :issue_id, :bigint, null: true
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :requirements, :issue_id
+ end
+ end
+end
diff --git a/db/migrate/20210616110748_add_issue_index_to_requirement.rb b/db/migrate/20210616110748_add_issue_index_to_requirement.rb
new file mode 100644
index 00000000000..747ee3875dc
--- /dev/null
+++ b/db/migrate/20210616110748_add_issue_index_to_requirement.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIssueIndexToRequirement < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_requirements_on_issue_id'
+
+ def up
+ add_concurrent_index :requirements, :issue_id, name: INDEX_NAME, unique: true
+ end
+
+ def down
+ remove_concurrent_index_by_name :requirements, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210616111311_add_issue_requirement_foreign_key.rb b/db/migrate/20210616111311_add_issue_requirement_foreign_key.rb
new file mode 100644
index 00000000000..ed851da9f31
--- /dev/null
+++ b/db/migrate/20210616111311_add_issue_requirement_foreign_key.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIssueRequirementForeignKey < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ TARGET_TABLE = :requirements
+
+ def up
+ add_concurrent_foreign_key TARGET_TABLE, :issues, column: :issue_id
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists(TARGET_TABLE, column: :issue_id)
+ end
+ end
+end
diff --git a/db/migrate/20210616134905_add_timestamp_to_schema_migration.rb b/db/migrate/20210616134905_add_timestamp_to_schema_migration.rb
new file mode 100644
index 00000000000..7086b20c48f
--- /dev/null
+++ b/db/migrate/20210616134905_add_timestamp_to_schema_migration.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddTimestampToSchemaMigration < ActiveRecord::Migration[6.1]
+ def up
+ # Add a nullable column with default null first
+ add_column :schema_migrations, :finished_at, :timestamptz
+
+ # Change default to NOW() for new records
+ change_column_default :schema_migrations, :finished_at, -> { 'NOW()' }
+ end
+
+ def down
+ remove_column :schema_migrations, :finished_at
+ end
+end
diff --git a/db/migrate/20210616154808_remove_ci_build_protected_index.rb b/db/migrate/20210616154808_remove_ci_build_protected_index.rb
new file mode 100644
index 00000000000..25a8d159c1e
--- /dev/null
+++ b/db/migrate/20210616154808_remove_ci_build_protected_index.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class RemoveCiBuildProtectedIndex < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ INDEX_NAME = 'index_ci_builds_on_protected'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index :ci_builds, :protected, name: INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :ci_builds, :protected, name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210616185947_add_mailgun_settings_to_application_setting.rb b/db/migrate/20210616185947_add_mailgun_settings_to_application_setting.rb
new file mode 100644
index 00000000000..8447ff79d12
--- /dev/null
+++ b/db/migrate/20210616185947_add_mailgun_settings_to_application_setting.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddMailgunSettingsToApplicationSetting < ActiveRecord::Migration[6.1]
+ def change
+ add_column :application_settings, :encrypted_mailgun_signing_key, :binary
+ add_column :application_settings, :encrypted_mailgun_signing_key_iv, :binary
+
+ add_column :application_settings, :mailgun_events_enabled, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20210617022324_create_incident_management_pending_alert_escalations.rb b/db/migrate/20210617022324_create_incident_management_pending_alert_escalations.rb
new file mode 100644
index 00000000000..32249c9ed56
--- /dev/null
+++ b/db/migrate/20210617022324_create_incident_management_pending_alert_escalations.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+class CreateIncidentManagementPendingAlertEscalations < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ execute(<<~SQL)
+
+ CREATE TABLE incident_management_pending_alert_escalations (
+ id bigserial NOT NULL,
+ rule_id bigint,
+ alert_id bigint NOT NULL,
+ schedule_id bigint NOT NULL,
+ process_at timestamp with time zone NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ status smallint NOT NULL,
+ PRIMARY KEY (id, process_at)
+ ) PARTITION BY RANGE (process_at);
+
+ CREATE INDEX index_incident_management_pending_alert_escalations_on_alert_id
+ ON incident_management_pending_alert_escalations USING btree (alert_id);
+
+ CREATE INDEX index_incident_management_pending_alert_escalations_on_rule_id
+ ON incident_management_pending_alert_escalations USING btree (rule_id);
+
+ CREATE INDEX index_incident_management_pending_alert_escalations_on_schedule_id
+ ON incident_management_pending_alert_escalations USING btree (schedule_id);
+
+ ALTER TABLE incident_management_pending_alert_escalations ADD CONSTRAINT fk_rails_fcbfd9338b
+ FOREIGN KEY (schedule_id) REFERENCES incident_management_oncall_schedules(id) ON DELETE CASCADE;
+
+ ALTER TABLE incident_management_pending_alert_escalations ADD CONSTRAINT fk_rails_057c1e3d87
+ FOREIGN KEY (rule_id) REFERENCES incident_management_escalation_rules(id) ON DELETE SET NULL;
+
+ ALTER TABLE incident_management_pending_alert_escalations ADD CONSTRAINT fk_rails_8d8de95da9
+ FOREIGN KEY (alert_id) REFERENCES alert_management_alerts(id) ON DELETE CASCADE;
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :incident_management_pending_alert_escalations
+ end
+ end
+end
diff --git a/db/migrate/20210617161348_cascade_delete_freeze_periods.rb b/db/migrate/20210617161348_cascade_delete_freeze_periods.rb
new file mode 100644
index 00000000000..90623b27920
--- /dev/null
+++ b/db/migrate/20210617161348_cascade_delete_freeze_periods.rb
@@ -0,0 +1,23 @@
+# 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 CascadeDeleteFreezePeriods < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ OLD_PROJECT_FK = 'fk_rails_2e02bbd1a6'
+ NEW_PROJECT_FK = 'fk_2e02bbd1a6'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :ci_freeze_periods, :projects, column: :project_id, on_delete: :cascade, name: NEW_PROJECT_FK
+ remove_foreign_key_if_exists :ci_freeze_periods, :projects, column: :project_id, name: OLD_PROJECT_FK
+ end
+
+ def down
+ add_concurrent_foreign_key :ci_freeze_periods, :projects, column: :project_id, on_delete: nil, name: OLD_PROJECT_FK
+ remove_foreign_key_if_exists :ci_freeze_periods, :projects, column: :project_id, name: NEW_PROJECT_FK
+ end
+end
diff --git a/db/migrate/20210617180131_migrate_usage_ping_sidekiq_queue.rb b/db/migrate/20210617180131_migrate_usage_ping_sidekiq_queue.rb
new file mode 100644
index 00000000000..9eebc6feb14
--- /dev/null
+++ b/db/migrate/20210617180131_migrate_usage_ping_sidekiq_queue.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class MigrateUsagePingSidekiqQueue < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ # rubocop:disable Migration/SidekiqQueueMigrate
+ def up
+ sidekiq_queue_migrate 'cronjob:gitlab_usage_ping', to: 'cronjob:gitlab_service_ping'
+ end
+
+ def down
+ sidekiq_queue_migrate 'cronjob:gitlab_service_ping', to: 'cronjob:gitlab_usage_ping'
+ end
+ # rubocop:enable Migration/SidekiqQueueMigrate
+end
diff --git a/db/migrate/20210621043337_rename_services_to_integrations.rb b/db/migrate/20210621043337_rename_services_to_integrations.rb
new file mode 100644
index 00000000000..17f4b6a2d4d
--- /dev/null
+++ b/db/migrate/20210621043337_rename_services_to_integrations.rb
@@ -0,0 +1,150 @@
+# frozen_string_literal: true
+
+class RenameServicesToIntegrations < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+ include Gitlab::Database::SchemaHelpers
+
+ # Function and trigger names match those migrated in:
+ # - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49916
+ # - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51852
+
+ WIKI_FUNCTION_NAME = 'set_has_external_wiki'
+ TRACKER_FUNCTION_NAME = 'set_has_external_issue_tracker'
+
+ WIKI_TRIGGER_ON_INSERT_NAME = 'trigger_has_external_wiki_on_insert'
+ WIKI_TRIGGER_ON_UPDATE_NAME = 'trigger_has_external_wiki_on_update'
+ WIKI_TRIGGER_ON_DELETE_NAME = 'trigger_has_external_wiki_on_delete'
+
+ TRACKER_TRIGGER_ON_INSERT_NAME = 'trigger_has_external_issue_tracker_on_insert'
+ TRACKER_TRIGGER_ON_UPDATE_NAME = 'trigger_has_external_issue_tracker_on_update'
+ TRACKER_TRIGGER_ON_DELETE_NAME = 'trigger_has_external_issue_tracker_on_delete'
+
+ ALL_TRIGGERS = [
+ WIKI_TRIGGER_ON_INSERT_NAME,
+ WIKI_TRIGGER_ON_UPDATE_NAME,
+ WIKI_TRIGGER_ON_DELETE_NAME,
+ TRACKER_TRIGGER_ON_INSERT_NAME,
+ TRACKER_TRIGGER_ON_UPDATE_NAME,
+ TRACKER_TRIGGER_ON_DELETE_NAME
+ ].freeze
+
+ def up
+ execute('LOCK services IN ACCESS EXCLUSIVE MODE')
+
+ drop_all_triggers(:services)
+
+ rename_table_safely(:services, :integrations)
+
+ recreate_all_triggers(:integrations)
+ end
+
+ def down
+ execute('LOCK integrations IN ACCESS EXCLUSIVE MODE')
+
+ drop_all_triggers(:integrations)
+
+ undo_rename_table_safely(:services, :integrations)
+
+ recreate_all_triggers(:services)
+ end
+
+ private
+
+ def drop_all_triggers(table_name)
+ ALL_TRIGGERS.each do |trigger_name|
+ drop_trigger(table_name, trigger_name)
+ end
+ end
+
+ def recreate_all_triggers(table_name)
+ wiki_create_insert_trigger(table_name)
+ wiki_create_update_trigger(table_name)
+ wiki_create_delete_trigger(table_name)
+
+ tracker_replace_trigger_function(table_name)
+
+ tracker_create_insert_trigger(table_name)
+ tracker_create_update_trigger(table_name)
+ tracker_create_delete_trigger(table_name)
+ end
+
+ def wiki_create_insert_trigger(table_name)
+ execute(<<~SQL)
+ CREATE TRIGGER #{WIKI_TRIGGER_ON_INSERT_NAME}
+ AFTER INSERT ON #{table_name}
+ FOR EACH ROW
+ WHEN (NEW.active = TRUE AND NEW.type = 'ExternalWikiService' AND NEW.project_id IS NOT NULL)
+ EXECUTE FUNCTION #{WIKI_FUNCTION_NAME}();
+ SQL
+ end
+
+ def wiki_create_update_trigger(table_name)
+ execute(<<~SQL)
+ CREATE TRIGGER #{WIKI_TRIGGER_ON_UPDATE_NAME}
+ AFTER UPDATE ON #{table_name}
+ FOR EACH ROW
+ WHEN (NEW.type = 'ExternalWikiService' AND OLD.active != NEW.active AND NEW.project_id IS NOT NULL)
+ EXECUTE FUNCTION #{WIKI_FUNCTION_NAME}();
+ SQL
+ end
+
+ def wiki_create_delete_trigger(table_name)
+ execute(<<~SQL)
+ CREATE TRIGGER #{WIKI_TRIGGER_ON_DELETE_NAME}
+ AFTER DELETE ON #{table_name}
+ FOR EACH ROW
+ WHEN (OLD.type = 'ExternalWikiService' AND OLD.project_id IS NOT NULL)
+ EXECUTE FUNCTION #{WIKI_FUNCTION_NAME}();
+ SQL
+ end
+
+ # Using `replace: true` to rewrite the existing function
+ def tracker_replace_trigger_function(table_name)
+ create_trigger_function(TRACKER_FUNCTION_NAME, replace: true) do
+ <<~SQL
+ UPDATE projects SET has_external_issue_tracker = (
+ EXISTS
+ (
+ SELECT 1
+ FROM #{table_name}
+ WHERE project_id = COALESCE(NEW.project_id, OLD.project_id)
+ AND active = TRUE
+ AND category = 'issue_tracker'
+ )
+ )
+ WHERE projects.id = COALESCE(NEW.project_id, OLD.project_id);
+ RETURN NULL;
+ SQL
+ end
+ end
+
+ def tracker_create_insert_trigger(table_name)
+ execute(<<~SQL)
+ CREATE TRIGGER #{TRACKER_TRIGGER_ON_INSERT_NAME}
+ AFTER INSERT ON #{table_name}
+ FOR EACH ROW
+ WHEN (NEW.category = 'issue_tracker' AND NEW.active = TRUE AND NEW.project_id IS NOT NULL)
+ EXECUTE FUNCTION #{TRACKER_FUNCTION_NAME}();
+ SQL
+ end
+
+ def tracker_create_update_trigger(table_name)
+ execute(<<~SQL)
+ CREATE TRIGGER #{TRACKER_TRIGGER_ON_UPDATE_NAME}
+ AFTER UPDATE ON #{table_name}
+ FOR EACH ROW
+ WHEN (NEW.category = 'issue_tracker' AND OLD.active != NEW.active AND NEW.project_id IS NOT NULL)
+ EXECUTE FUNCTION #{TRACKER_FUNCTION_NAME}();
+ SQL
+ end
+
+ def tracker_create_delete_trigger(table_name)
+ execute(<<~SQL)
+ CREATE TRIGGER #{TRACKER_TRIGGER_ON_DELETE_NAME}
+ AFTER DELETE ON #{table_name}
+ FOR EACH ROW
+ WHEN (OLD.category = 'issue_tracker' AND OLD.active = TRUE AND OLD.project_id IS NOT NULL)
+ EXECUTE FUNCTION #{TRACKER_FUNCTION_NAME}();
+ SQL
+ end
+end
diff --git a/db/migrate/20210621044000_rename_services_indexes_to_integrations.rb b/db/migrate/20210621044000_rename_services_indexes_to_integrations.rb
new file mode 100644
index 00000000000..9dba663f6a7
--- /dev/null
+++ b/db/migrate/20210621044000_rename_services_indexes_to_integrations.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class RenameServicesIndexesToIntegrations < ActiveRecord::Migration[6.1]
+ INDEXES = %w(
+ project_and_type_where_inherit_null
+ project_id_and_type_unique
+ template
+ type
+ type_and_instance_partial
+ type_and_template_partial
+ type_id_when_active_and_project_id_not_null
+ unique_group_id_and_type
+ ).freeze
+
+ def up
+ INDEXES.each do |index|
+ execute(<<~SQL)
+ ALTER INDEX IF EXISTS "index_services_on_#{index}" RENAME TO "index_integrations_on_#{index}"
+ SQL
+ end
+ end
+
+ def down
+ INDEXES.each do |index|
+ execute(<<~SQL)
+ ALTER INDEX IF EXISTS "index_integrations_on_#{index}" RENAME TO "index_services_on_#{index}"
+ SQL
+ end
+ end
+end
diff --git a/db/migrate/20210621084632_add_summary_to_timelogs.rb b/db/migrate/20210621084632_add_summary_to_timelogs.rb
new file mode 100644
index 00000000000..45fd7f1e0bc
--- /dev/null
+++ b/db/migrate/20210621084632_add_summary_to_timelogs.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddSummaryToTimelogs < ActiveRecord::Migration[6.1]
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in 20210621090030_add_text_limit_to_timelogs_summary
+ def change
+ add_column :timelogs, :summary, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20210621090030_add_text_limit_to_timelogs_summary.rb b/db/migrate/20210621090030_add_text_limit_to_timelogs_summary.rb
new file mode 100644
index 00000000000..ac872afd3fa
--- /dev/null
+++ b/db/migrate/20210621090030_add_text_limit_to_timelogs_summary.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddTextLimitToTimelogsSummary < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :timelogs, :summary, 255
+ end
+
+ def down
+ remove_text_limit :timelogs, :summary
+ end
+end
diff --git a/db/migrate/20210621091830_add_devops_adoption_snapshot_dependency_scanning.rb b/db/migrate/20210621091830_add_devops_adoption_snapshot_dependency_scanning.rb
new file mode 100644
index 00000000000..ae19a46b66f
--- /dev/null
+++ b/db/migrate/20210621091830_add_devops_adoption_snapshot_dependency_scanning.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddDevopsAdoptionSnapshotDependencyScanning < ActiveRecord::Migration[6.1]
+ def change
+ add_column :analytics_devops_adoption_snapshots, :dependency_scanning_enabled_count, :integer
+ end
+end
diff --git a/db/migrate/20210622135221_add_foreign_key_for_environment_id_to_environments.rb b/db/migrate/20210622135221_add_foreign_key_for_environment_id_to_environments.rb
new file mode 100644
index 00000000000..03991cea41c
--- /dev/null
+++ b/db/migrate/20210622135221_add_foreign_key_for_environment_id_to_environments.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddForeignKeyForEnvironmentIdToEnvironments < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ # `validate: false` option is passed here, because validating the existing rows fails by the orphaned deployments,
+ # which will be cleaned up in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64588.
+ # The validation runs for only new records or updates, so that we can at least
+ # stop creating orphaned rows.
+ add_concurrent_foreign_key :deployments, :environments, column: :environment_id, on_delete: :cascade, validate: false
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key_if_exists :deployments, :environments
+ end
+ end
+end
diff --git a/db/migrate/20210623074226_add_usage_ping_features_enabled_to_application_settings.rb b/db/migrate/20210623074226_add_usage_ping_features_enabled_to_application_settings.rb
new file mode 100644
index 00000000000..7a70f695039
--- /dev/null
+++ b/db/migrate/20210623074226_add_usage_ping_features_enabled_to_application_settings.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddUsagePingFeaturesEnabledToApplicationSettings < ActiveRecord::Migration[6.1]
+ def up
+ add_column :application_settings, :usage_ping_features_enabled, :boolean, default: false, null: false
+ end
+
+ def down
+ remove_column :application_settings, :usage_ping_features_enabled
+ end
+end
diff --git a/db/migrate/20210623123722_add_present_on_default_branch_to_vulnerabilities.rb b/db/migrate/20210623123722_add_present_on_default_branch_to_vulnerabilities.rb
new file mode 100644
index 00000000000..d528c4c6967
--- /dev/null
+++ b/db/migrate/20210623123722_add_present_on_default_branch_to_vulnerabilities.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddPresentOnDefaultBranchToVulnerabilities < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ add_column :vulnerabilities, :present_on_default_branch, :boolean, default: true, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :vulnerabilities, :present_on_default_branch
+ end
+ end
+end
diff --git a/db/migrate/20210623133635_create_error_tracking_errors.rb b/db/migrate/20210623133635_create_error_tracking_errors.rb
new file mode 100644
index 00000000000..e26fbe8df86
--- /dev/null
+++ b/db/migrate/20210623133635_create_error_tracking_errors.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class CreateErrorTrackingErrors < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ create_table_with_constraints :error_tracking_errors do |t|
+ t.references :project, index: true, null: false, foreign_key: { on_delete: :cascade }
+ t.text :name, null: false
+ t.text :description, null: false
+ t.text :actor, null: false
+ t.datetime_with_timezone :first_seen_at, null: false, default: -> { 'NOW()' }
+ t.datetime_with_timezone :last_seen_at, null: false, default: -> { 'NOW()' }
+ t.text :platform
+
+ t.text_limit :name, 255
+ t.text_limit :description, 1024
+ t.text_limit :actor, 255
+ t.text_limit :platform, 255
+
+ t.timestamps_with_timezone
+ end
+ end
+
+ def down
+ drop_table :error_tracking_errors
+ end
+end
diff --git a/db/migrate/20210623163342_add_index_to_compliance_management_frameworks_pipeline_configuration.rb b/db/migrate/20210623163342_add_index_to_compliance_management_frameworks_pipeline_configuration.rb
new file mode 100644
index 00000000000..81903230f43
--- /dev/null
+++ b/db/migrate/20210623163342_add_index_to_compliance_management_frameworks_pipeline_configuration.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexToComplianceManagementFrameworksPipelineConfiguration < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_compliance_frameworks_id_where_frameworks_not_null'
+
+ def up
+ add_concurrent_index :compliance_management_frameworks, :id, name: INDEX_NAME, where: 'pipeline_configuration_full_path IS NOT NULL'
+ end
+
+ def down
+ remove_concurrent_index_by_name :compliance_management_frameworks, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210624112821_add_devops_adoption_coverage_fuzzing.rb b/db/migrate/20210624112821_add_devops_adoption_coverage_fuzzing.rb
new file mode 100644
index 00000000000..6ca040dbfbc
--- /dev/null
+++ b/db/migrate/20210624112821_add_devops_adoption_coverage_fuzzing.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddDevopsAdoptionCoverageFuzzing < ActiveRecord::Migration[6.1]
+ def change
+ add_column :analytics_devops_adoption_snapshots, :coverage_fuzzing_enabled_count, :integer
+ end
+end
diff --git a/db/migrate/20210624180613_add_last_synced_at_to_licenses.rb b/db/migrate/20210624180613_add_last_synced_at_to_licenses.rb
new file mode 100644
index 00000000000..085fccdc20f
--- /dev/null
+++ b/db/migrate/20210624180613_add_last_synced_at_to_licenses.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddLastSyncedAtToLicenses < ActiveRecord::Migration[6.1]
+ def change
+ add_column :licenses, :last_synced_at, :datetime_with_timezone
+ end
+end
diff --git a/db/migrate/20210625094554_create_error_tracking_error_events.rb b/db/migrate/20210625094554_create_error_tracking_error_events.rb
new file mode 100644
index 00000000000..c1ed6d6ce6e
--- /dev/null
+++ b/db/migrate/20210625094554_create_error_tracking_error_events.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class CreateErrorTrackingErrorEvents < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ create_table_with_constraints :error_tracking_error_events do |t|
+ t.references :error,
+ index: true,
+ null: false,
+ foreign_key: { on_delete: :cascade, to_table: :error_tracking_errors }
+
+ t.text :description, null: false
+ t.text :environment
+ t.text :level
+ t.datetime_with_timezone :occurred_at, null: false
+ t.jsonb :payload, null: false, default: {}
+
+ t.text_limit :description, 255
+ t.text_limit :environment, 255
+ t.text_limit :level, 255
+
+ t.timestamps_with_timezone
+ end
+ end
+
+ def down
+ drop_table :error_tracking_error_events
+ end
+end
diff --git a/db/migrate/20210627204936_add_plan_limits_max_size_cluster_image_scanning_column.rb b/db/migrate/20210627204936_add_plan_limits_max_size_cluster_image_scanning_column.rb
new file mode 100644
index 00000000000..322e6991d0b
--- /dev/null
+++ b/db/migrate/20210627204936_add_plan_limits_max_size_cluster_image_scanning_column.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddPlanLimitsMaxSizeClusterImageScanningColumn < ActiveRecord::Migration[6.0]
+ def change
+ add_column :plan_limits, :ci_max_artifact_size_cluster_image_scanning, :integer, null: false, default: 0
+ end
+end
diff --git a/db/migrate/20210629153519_add_index_to_bulk_import_entities_on_bulk_import_id_and_status.rb b/db/migrate/20210629153519_add_index_to_bulk_import_entities_on_bulk_import_id_and_status.rb
new file mode 100644
index 00000000000..c84a42cbea4
--- /dev/null
+++ b/db/migrate/20210629153519_add_index_to_bulk_import_entities_on_bulk_import_id_and_status.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddIndexToBulkImportEntitiesOnBulkImportIdAndStatus < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ NEW_INDEX_NAME = 'index_bulk_import_entities_on_bulk_import_id_and_status'
+ OLD_INDEX_NAME = 'index_bulk_import_entities_on_bulk_import_id'
+
+ def up
+ add_concurrent_index :bulk_import_entities, [:bulk_import_id, :status], name: NEW_INDEX_NAME
+ remove_concurrent_index_by_name :bulk_import_entities, name: OLD_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :bulk_import_entities, :bulk_import_id, name: OLD_INDEX_NAME
+ remove_concurrent_index_by_name :bulk_import_entities, name: NEW_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210630144339_add_invite_email_success_to_members.rb b/db/migrate/20210630144339_add_invite_email_success_to_members.rb
new file mode 100644
index 00000000000..6c341ecb3f3
--- /dev/null
+++ b/db/migrate/20210630144339_add_invite_email_success_to_members.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddInviteEmailSuccessToMembers < ActiveRecord::Migration[6.1]
+ def up
+ # no-op
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20210701111627_add_upvotes_count_to_issues.rb b/db/migrate/20210701111627_add_upvotes_count_to_issues.rb
new file mode 100644
index 00000000000..beefb186f37
--- /dev/null
+++ b/db/migrate/20210701111627_add_upvotes_count_to_issues.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddUpvotesCountToIssues < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ add_column :issues, :upvotes_count, :integer, default: 0, null: false
+ end
+ end
+
+ def down
+ remove_column :issues, :upvotes_count
+ end
+end
diff --git a/db/migrate/20210702124842_add_ci_job_trace_size_to_plan_limits.rb b/db/migrate/20210702124842_add_ci_job_trace_size_to_plan_limits.rb
new file mode 100644
index 00000000000..561c98c449c
--- /dev/null
+++ b/db/migrate/20210702124842_add_ci_job_trace_size_to_plan_limits.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddCiJobTraceSizeToPlanLimits < ActiveRecord::Migration[6.1]
+ def change
+ add_column(:plan_limits, :ci_jobs_trace_size_limit, :integer, default: 100, null: false)
+ end
+end
diff --git a/db/migrate/20210705124128_add_project_settings_previous_default_branch.rb b/db/migrate/20210705124128_add_project_settings_previous_default_branch.rb
new file mode 100644
index 00000000000..e54d762fa75
--- /dev/null
+++ b/db/migrate/20210705124128_add_project_settings_previous_default_branch.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddProjectSettingsPreviousDefaultBranch < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in 20210707173645_add_project_settings_previous_default_branch_text_limit
+ def up
+ with_lock_retries do
+ add_column :project_settings, :previous_default_branch, :text
+ end
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+
+ def down
+ with_lock_retries do
+ remove_column :project_settings, :previous_default_branch
+ end
+ end
+end
diff --git a/db/migrate/20210705130919_create_container_repos_on_exp_cleanup_status_project_id_start_date_index.rb b/db/migrate/20210705130919_create_container_repos_on_exp_cleanup_status_project_id_start_date_index.rb
new file mode 100644
index 00000000000..a6983c2d599
--- /dev/null
+++ b/db/migrate/20210705130919_create_container_repos_on_exp_cleanup_status_project_id_start_date_index.rb
@@ -0,0 +1,24 @@
+# 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 CreateContainerReposOnExpCleanupStatusProjectIdStartDateIndex < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ OLD_INDEX_NAME = 'idx_container_repositories_on_exp_cleanup_status_and_start_date'
+ NEW_INDEX_NAME = 'idx_container_repos_on_exp_cleanup_status_project_id_start_date'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:container_repositories, [:expiration_policy_cleanup_status, :project_id, :expiration_policy_started_at], name: NEW_INDEX_NAME)
+ remove_concurrent_index(:container_repositories, [:expiration_policy_cleanup_status, :expiration_policy_started_at], name: OLD_INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:container_repositories, [:expiration_policy_cleanup_status, :expiration_policy_started_at], name: OLD_INDEX_NAME)
+ remove_concurrent_index(:container_repositories, [:expiration_policy_cleanup_status, :project_id, :expiration_policy_started_at], name: NEW_INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210705132928_add_new_user_signups_cap_to_namespace_settings.rb b/db/migrate/20210705132928_add_new_user_signups_cap_to_namespace_settings.rb
new file mode 100644
index 00000000000..7f736bf2b87
--- /dev/null
+++ b/db/migrate/20210705132928_add_new_user_signups_cap_to_namespace_settings.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddNewUserSignupsCapToNamespaceSettings < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ add_column :namespace_settings, :new_user_signups_cap, :integer, null: true
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :namespace_settings, :new_user_signups_cap
+ end
+ end
+end
diff --git a/db/migrate/20210705144657_add_instance_runners_enabled_to_ci_pending_build.rb b/db/migrate/20210705144657_add_instance_runners_enabled_to_ci_pending_build.rb
new file mode 100644
index 00000000000..b362fd930a3
--- /dev/null
+++ b/db/migrate/20210705144657_add_instance_runners_enabled_to_ci_pending_build.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddInstanceRunnersEnabledToCiPendingBuild < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ add_column :ci_pending_builds, :instance_runners_enabled, :boolean, null: false, default: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :ci_pending_builds, :instance_runners_enabled
+ end
+ end
+end
diff --git a/db/migrate/20210706084713_add_devops_adoption_snapshots_index.rb b/db/migrate/20210706084713_add_devops_adoption_snapshots_index.rb
new file mode 100644
index 00000000000..26727b7ad7d
--- /dev/null
+++ b/db/migrate/20210706084713_add_devops_adoption_snapshots_index.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddDevopsAdoptionSnapshotsIndex < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'idx_analytics_devops_adoption_snapshots_finalized'
+
+ def up
+ add_concurrent_index :analytics_devops_adoption_snapshots, [:namespace_id, :end_time], where: "recorded_at >= end_time", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :analytics_devops_adoption_snapshots, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210706152139_add_index_type_to_postgres_indexes_view.rb b/db/migrate/20210706152139_add_index_type_to_postgres_indexes_view.rb
new file mode 100644
index 00000000000..a2a3d74cd49
--- /dev/null
+++ b/db/migrate/20210706152139_add_index_type_to_postgres_indexes_view.rb
@@ -0,0 +1,57 @@
+# frozen_string_literal: true
+
+class AddIndexTypeToPostgresIndexesView < ActiveRecord::Migration[6.1]
+ def up
+ execute(<<~SQL)
+ DROP VIEW IF EXISTS postgres_indexes;
+
+ CREATE VIEW postgres_indexes AS
+ SELECT (pg_namespace.nspname::text || '.'::text) || i.relname::text AS identifier,
+ pg_index.indexrelid,
+ pg_namespace.nspname AS schema,
+ i.relname AS name,
+ pg_indexes.tablename,
+ a.amname AS type,
+ pg_index.indisunique AS "unique",
+ pg_index.indisvalid AS valid_index,
+ i.relispartition AS partitioned,
+ pg_index.indisexclusion AS exclusion,
+ pg_index.indexprs IS NOT NULL AS expression,
+ pg_index.indpred IS NOT NULL AS partial,
+ pg_indexes.indexdef AS definition,
+ pg_relation_size(i.oid::regclass) AS ondisk_size_bytes
+ FROM pg_index
+ JOIN pg_class i ON i.oid = pg_index.indexrelid
+ JOIN pg_namespace ON i.relnamespace = pg_namespace.oid
+ JOIN pg_indexes ON i.relname = pg_indexes.indexname
+ JOIN pg_am a ON i.relam = a.oid
+ WHERE pg_namespace.nspname <> 'pg_catalog'::name AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name]));
+ SQL
+ end
+
+ def down
+ execute(<<~SQL)
+ DROP VIEW IF EXISTS postgres_indexes;
+
+ CREATE VIEW postgres_indexes AS
+ SELECT (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text) AS identifier,
+ pg_index.indexrelid,
+ pg_namespace.nspname AS schema,
+ pg_class.relname AS name,
+ pg_indexes.tablename,
+ pg_index.indisunique AS "unique",
+ pg_index.indisvalid AS valid_index,
+ pg_class.relispartition AS partitioned,
+ pg_index.indisexclusion AS exclusion,
+ (pg_index.indexprs IS NOT NULL) AS expression,
+ (pg_index.indpred IS NOT NULL) AS partial,
+ pg_indexes.indexdef AS definition,
+ pg_relation_size((pg_class.oid)::regclass) AS ondisk_size_bytes
+ FROM (((pg_index
+ JOIN pg_class ON ((pg_class.oid = pg_index.indexrelid)))
+ JOIN pg_namespace ON ((pg_class.relnamespace = pg_namespace.oid)))
+ JOIN pg_indexes ON ((pg_class.relname = pg_indexes.indexname)))
+ WHERE ((pg_namespace.nspname <> 'pg_catalog'::name) AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])));
+ SQL
+ end
+end
diff --git a/db/migrate/20210706213537_add_premium_and_ultimate_plan_limits.rb b/db/migrate/20210706213537_add_premium_and_ultimate_plan_limits.rb
new file mode 100644
index 00000000000..f78e37d645a
--- /dev/null
+++ b/db/migrate/20210706213537_add_premium_and_ultimate_plan_limits.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+class AddPremiumAndUltimatePlanLimits < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ class Plan < ActiveRecord::Base
+ self.inheritance_column = :_type_disabled
+
+ has_one :limits, class_name: 'PlanLimits'
+ end
+
+ class PlanLimits < ActiveRecord::Base
+ self.inheritance_column = :_type_disabled
+
+ belongs_to :plan
+ end
+
+ def copy_plan_limits(from_plan_name:, to_plan_name:)
+ source_plan = Plan.find_by(name: from_plan_name)
+ target_plan = Plan.find_by(name: to_plan_name)
+ return unless source_plan && target_plan
+ return unless source_plan.limits.present?
+ return if target_plan.limits.present?
+
+ limits = source_plan.limits.dup
+ limits.plan = target_plan
+ limits.save!
+ end
+
+ def up
+ return unless Gitlab.com?
+
+ copy_plan_limits(from_plan_name: 'gold', to_plan_name: 'ultimate')
+ copy_plan_limits(from_plan_name: 'silver', to_plan_name: 'premium')
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/migrate/20210707095545_add_status_to_merge_request_cleanup_schedules.rb b/db/migrate/20210707095545_add_status_to_merge_request_cleanup_schedules.rb
new file mode 100644
index 00000000000..597e274cda2
--- /dev/null
+++ b/db/migrate/20210707095545_add_status_to_merge_request_cleanup_schedules.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class AddStatusToMergeRequestCleanupSchedules < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'index_merge_request_cleanup_schedules_on_status'
+
+ disable_ddl_transaction!
+
+ def up
+ unless column_exists?(:merge_request_cleanup_schedules, :status)
+ add_column(:merge_request_cleanup_schedules, :status, :integer, limit: 2, default: 0, null: false)
+ end
+
+ add_concurrent_index(:merge_request_cleanup_schedules, :status, name: INDEX_NAME)
+ end
+
+ def down
+ remove_concurrent_index_by_name(:merge_request_cleanup_schedules, INDEX_NAME)
+
+ if column_exists?(:merge_request_cleanup_schedules, :status)
+ remove_column(:merge_request_cleanup_schedules, :status)
+ end
+ end
+end
diff --git a/db/migrate/20210707151536_create_vulnerability_finding_evidence_sources.rb b/db/migrate/20210707151536_create_vulnerability_finding_evidence_sources.rb
new file mode 100644
index 00000000000..90bc6fb82bd
--- /dev/null
+++ b/db/migrate/20210707151536_create_vulnerability_finding_evidence_sources.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class CreateVulnerabilityFindingEvidenceSources < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ create_table_with_constraints :vulnerability_finding_evidence_sources do |t|
+ t.timestamps_with_timezone null: false
+
+ t.references :vulnerability_finding_evidence, index: { name: 'finding_evidence_sources_on_finding_evidence_id' }, null: false, foreign_key: { on_delete: :cascade }
+ t.text :name
+ t.text :url
+
+ t.text_limit :name, 2048
+ t.text_limit :url, 2048
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :vulnerability_finding_evidence_sources
+ end
+ end
+end
diff --git a/db/migrate/20210707171536_create_vulnerability_finding_evidence_assets.rb b/db/migrate/20210707171536_create_vulnerability_finding_evidence_assets.rb
new file mode 100644
index 00000000000..57c71e6bc17
--- /dev/null
+++ b/db/migrate/20210707171536_create_vulnerability_finding_evidence_assets.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class CreateVulnerabilityFindingEvidenceAssets < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ create_table_with_constraints :vulnerability_finding_evidence_assets do |t|
+ t.timestamps_with_timezone null: false
+
+ t.references :vulnerability_finding_evidence, index: { name: 'finding_evidence_assets_on_finding_evidence_id' }, null: false, foreign_key: { on_delete: :cascade }
+ t.text :type
+ t.text :name
+ t.text :url
+
+ t.text_limit :type, 2048
+ t.text_limit :name, 2048
+ t.text_limit :url, 2048
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :vulnerability_finding_evidence_assets
+ end
+ end
+end
diff --git a/db/migrate/20210707171554_create_vulnerability_flags.rb b/db/migrate/20210707171554_create_vulnerability_flags.rb
new file mode 100644
index 00000000000..bf33963b08f
--- /dev/null
+++ b/db/migrate/20210707171554_create_vulnerability_flags.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class CreateVulnerabilityFlags < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ FALSE_POSITIVE_ENUM_VALUE = 0
+
+ disable_ddl_transaction!
+
+ def up
+ create_table_with_constraints :vulnerability_flags do |t|
+ t.timestamps_with_timezone null: false
+
+ t.references :vulnerability_occurrence, null: false, foreign_key: { on_delete: :cascade }
+
+ t.integer :flag_type, limit: 2, null: false, default: FALSE_POSITIVE_ENUM_VALUE
+
+ t.text :origin, null: false
+ t.text :description, null: false
+
+ t.text_limit :origin, 255
+ t.text_limit :description, 1024
+ end
+ end
+
+ def down
+ drop_table :vulnerability_flags
+ end
+end
diff --git a/db/migrate/20210707173645_add_project_settings_previous_default_branch_text_limit.rb b/db/migrate/20210707173645_add_project_settings_previous_default_branch_text_limit.rb
new file mode 100644
index 00000000000..a6a83b00234
--- /dev/null
+++ b/db/migrate/20210707173645_add_project_settings_previous_default_branch_text_limit.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddProjectSettingsPreviousDefaultBranchTextLimit < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :project_settings, :previous_default_branch, 4096
+ end
+
+ def down
+ remove_text_limit :project_settings, :previous_default_branch
+ end
+end
diff --git a/db/migrate/20210707181536_create_vulnerability_finding_evidence_supporting_messages.rb b/db/migrate/20210707181536_create_vulnerability_finding_evidence_supporting_messages.rb
new file mode 100644
index 00000000000..b9fc822a5a3
--- /dev/null
+++ b/db/migrate/20210707181536_create_vulnerability_finding_evidence_supporting_messages.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class CreateVulnerabilityFindingEvidenceSupportingMessages < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ create_table_with_constraints :vulnerability_finding_evidence_supporting_messages do |t|
+ t.timestamps_with_timezone null: false
+
+ t.references :vulnerability_finding_evidence, index: { name: 'finding_evidence_supporting_messages_on_finding_evidence_id' }, null: false, foreign_key: { on_delete: :cascade }
+ t.text :name
+
+ t.text_limit :name, 2048
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :vulnerability_finding_evidence_supporting_messages
+ end
+ end
+end
diff --git a/db/migrate/20210708063032_add_failed_count_to_merge_request_cleanup_schedules.rb b/db/migrate/20210708063032_add_failed_count_to_merge_request_cleanup_schedules.rb
new file mode 100644
index 00000000000..f613856a18c
--- /dev/null
+++ b/db/migrate/20210708063032_add_failed_count_to_merge_request_cleanup_schedules.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddFailedCountToMergeRequestCleanupSchedules < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def change
+ add_column :merge_request_cleanup_schedules, :failed_count, :integer, default: 0, null: false
+ end
+end
diff --git a/db/migrate/20210708124229_add_security_scans_created_at_index.rb b/db/migrate/20210708124229_add_security_scans_created_at_index.rb
new file mode 100644
index 00000000000..d2d1958f5b9
--- /dev/null
+++ b/db/migrate/20210708124229_add_security_scans_created_at_index.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddSecurityScansCreatedAtIndex < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_security_scans_on_created_at'
+
+ def up
+ add_concurrent_index(:security_scans, :created_at, name: INDEX_NAME)
+ end
+
+ def down
+ remove_concurrent_index_by_name(:security_scans, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210708131048_add_error_tracking_counter_cache.rb b/db/migrate/20210708131048_add_error_tracking_counter_cache.rb
new file mode 100644
index 00000000000..3bf7e1e3688
--- /dev/null
+++ b/db/migrate/20210708131048_add_error_tracking_counter_cache.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddErrorTrackingCounterCache < ActiveRecord::Migration[6.1]
+ def up
+ add_column :error_tracking_errors, :events_count, :bigint, null: false, default: 0
+ end
+
+ def down
+ remove_column :error_tracking_errors, :events_count
+ end
+end
diff --git a/db/migrate/20210708134446_remove_not_null_constraint_from_terms.rb b/db/migrate/20210708134446_remove_not_null_constraint_from_terms.rb
new file mode 100644
index 00000000000..82abfeb57f9
--- /dev/null
+++ b/db/migrate/20210708134446_remove_not_null_constraint_from_terms.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class RemoveNotNullConstraintFromTerms < ActiveRecord::Migration[6.1]
+ def up
+ change_column_null :application_setting_terms, :terms, true
+ end
+
+ def down
+ change_column_null :application_setting_terms, :terms, false
+ end
+end
diff --git a/db/migrate/20210709085759_index_batched_migration_jobs_by_max_value.rb b/db/migrate/20210709085759_index_batched_migration_jobs_by_max_value.rb
new file mode 100644
index 00000000000..8240e968e7a
--- /dev/null
+++ b/db/migrate/20210709085759_index_batched_migration_jobs_by_max_value.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class IndexBatchedMigrationJobsByMaxValue < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_migration_jobs_on_migration_id_and_max_value'
+
+ def up
+ add_concurrent_index :batched_background_migration_jobs, %i(batched_background_migration_id max_value), name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :batched_background_migration_jobs, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210709132707_change_default_job_token_scope_enabled.rb b/db/migrate/20210709132707_change_default_job_token_scope_enabled.rb
new file mode 100644
index 00000000000..fbd9f7baa61
--- /dev/null
+++ b/db/migrate/20210709132707_change_default_job_token_scope_enabled.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class ChangeDefaultJobTokenScopeEnabled < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ change_column_default :project_ci_cd_settings, :job_token_scope_enabled, from: false, to: true
+ end
+ end
+
+ def down
+ with_lock_retries do
+ change_column_default :project_ci_cd_settings, :job_token_scope_enabled, from: true, to: false
+ end
+ end
+end
diff --git a/db/migrate/20210713070842_update_merge_request_cleanup_schedules_scheduled_at_index.rb b/db/migrate/20210713070842_update_merge_request_cleanup_schedules_scheduled_at_index.rb
new file mode 100644
index 00000000000..a19d15d80a0
--- /dev/null
+++ b/db/migrate/20210713070842_update_merge_request_cleanup_schedules_scheduled_at_index.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class UpdateMergeRequestCleanupSchedulesScheduledAtIndex < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = 'index_mr_cleanup_schedules_timestamps_status'
+ OLD_INDEX_NAME = 'index_mr_cleanup_schedules_timestamps'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:merge_request_cleanup_schedules, :scheduled_at, where: 'completed_at IS NULL AND status = 0', name: INDEX_NAME)
+ remove_concurrent_index_by_name(:merge_request_cleanup_schedules, OLD_INDEX_NAME)
+ end
+
+ def down
+ remove_concurrent_index_by_name(:merge_request_cleanup_schedules, INDEX_NAME)
+ add_concurrent_index(:merge_request_cleanup_schedules, :scheduled_at, where: 'completed_at IS NULL', name: OLD_INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210713135152_add_devops_adoption_vulnerability_management_used_count.rb b/db/migrate/20210713135152_add_devops_adoption_vulnerability_management_used_count.rb
new file mode 100644
index 00000000000..74f24364177
--- /dev/null
+++ b/db/migrate/20210713135152_add_devops_adoption_vulnerability_management_used_count.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddDevopsAdoptionVulnerabilityManagementUsedCount < ActiveRecord::Migration[6.1]
+ def change
+ add_column :analytics_devops_adoption_snapshots, :vulnerability_management_used_count, :integer
+ end
+end
diff --git a/db/migrate/20210713144637_add_vulnerabilities_created_at_index.rb b/db/migrate/20210713144637_add_vulnerabilities_created_at_index.rb
new file mode 100644
index 00000000000..27eb2691754
--- /dev/null
+++ b/db/migrate/20210713144637_add_vulnerabilities_created_at_index.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddVulnerabilitiesCreatedAtIndex < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'idx_vulnerabilities_partial_devops_adoption'
+
+ def up
+ add_concurrent_index :vulnerabilities, [:project_id, :created_at], where: 'state != 1', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :vulnerabilities, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210714120600_add_detected_at_to_vulnerabilities.rb b/db/migrate/20210714120600_add_detected_at_to_vulnerabilities.rb
new file mode 100644
index 00000000000..fb18ac4e174
--- /dev/null
+++ b/db/migrate/20210714120600_add_detected_at_to_vulnerabilities.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddDetectedAtToVulnerabilities < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ add_column :vulnerabilities, :detected_at, :datetime_with_timezone
+ change_column_default :vulnerabilities, :detected_at, -> { 'NOW()' }
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :vulnerabilities, :detected_at
+ end
+ end
+end
diff --git a/db/migrate/20210716074555_revert_default_job_token_scope.rb b/db/migrate/20210716074555_revert_default_job_token_scope.rb
new file mode 100644
index 00000000000..d28f75605e4
--- /dev/null
+++ b/db/migrate/20210716074555_revert_default_job_token_scope.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class RevertDefaultJobTokenScope < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ change_column_default :project_ci_cd_settings, :job_token_scope_enabled, from: true, to: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ change_column_default :project_ci_cd_settings, :job_token_scope_enabled, from: false, to: true
+ end
+ end
+end
diff --git a/db/post_migrate/20210602164044_schedule_latest_pipeline_id_population.rb b/db/post_migrate/20210602164044_schedule_latest_pipeline_id_population.rb
new file mode 100644
index 00000000000..dfd2806fece
--- /dev/null
+++ b/db/post_migrate/20210602164044_schedule_latest_pipeline_id_population.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class ScheduleLatestPipelineIdPopulation < ActiveRecord::Migration[6.1]
+ def up
+ # no-op: This migration has been marked as no-op and replaced by
+ # `ReScheduleLatestPipelineIdPopulation` as we've found some problems.
+ # For more information: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/65280
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210604133651_schedule_merge_request_diff_users_background_migration.rb b/db/post_migrate/20210604133651_schedule_merge_request_diff_users_background_migration.rb
new file mode 100644
index 00000000000..b9b694012f2
--- /dev/null
+++ b/db/post_migrate/20210604133651_schedule_merge_request_diff_users_background_migration.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class ScheduleMergeRequestDiffUsersBackgroundMigration < ActiveRecord::Migration[6.1]
+ def up
+ # no-op
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210609202501_schedule_backfill_draft_status_on_merge_requests.rb b/db/post_migrate/20210609202501_schedule_backfill_draft_status_on_merge_requests.rb
new file mode 100644
index 00000000000..72c4168af50
--- /dev/null
+++ b/db/post_migrate/20210609202501_schedule_backfill_draft_status_on_merge_requests.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class ScheduleBackfillDraftStatusOnMergeRequests < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ INDEX_NAME = "tmp_index_merge_requests_draft_and_status"
+ MIGRATION = 'BackfillDraftStatusOnMergeRequests'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 100
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :merge_requests, :id,
+ where: "draft = false AND state_id = 1 AND ((title)::text ~* '^\\[draft\\]|\\(draft\\)|draft:|draft|\\[WIP\\]|WIP:|WIP'::text)",
+ name: INDEX_NAME
+
+ eligible_mrs = Gitlab::BackgroundMigration::BackfillDraftStatusOnMergeRequests::MergeRequest.eligible
+
+ queue_background_migration_jobs_by_range_at_intervals(
+ eligible_mrs,
+ MIGRATION,
+ DELAY_INTERVAL,
+ track_jobs: true,
+ batch_size: BATCH_SIZE
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name :merge_requests, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210610042700_remove_clusters_applications_fluentd_table.rb b/db/post_migrate/20210610042700_remove_clusters_applications_fluentd_table.rb
new file mode 100644
index 00000000000..9d37180326f
--- /dev/null
+++ b/db/post_migrate/20210610042700_remove_clusters_applications_fluentd_table.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class RemoveClustersApplicationsFluentdTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ def up
+ drop_table :clusters_applications_fluentd
+ end
+
+ def down
+ create_table :clusters_applications_fluentd do |t|
+ t.integer :protocol, null: false, limit: 2
+ t.integer :status, null: false
+ t.integer :port, null: false
+ t.references :cluster, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade }
+ t.timestamps_with_timezone null: false
+ t.string :version, null: false, limit: 255
+ t.string :host, null: false, limit: 255
+ t.boolean :cilium_log_enabled, default: true, null: false
+ t.boolean :waf_log_enabled, default: true, null: false
+ t.text :status_reason # rubocop:disable Migration/AddLimitToTextColumns
+ end
+ end
+end
diff --git a/db/post_migrate/20210614124111_add_devops_adoption_sast_dast_indexes.rb b/db/post_migrate/20210614124111_add_devops_adoption_sast_dast_indexes.rb
new file mode 100644
index 00000000000..9d40fe30ed6
--- /dev/null
+++ b/db/post_migrate/20210614124111_add_devops_adoption_sast_dast_indexes.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddDevopsAdoptionSastDastIndexes < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_SAST = 'index_ci_job_artifacts_sast_for_devops_adoption'
+ INDEX_DAST = 'index_ci_job_artifacts_dast_for_devops_adoption'
+
+ def up
+ add_concurrent_index :ci_job_artifacts, [:project_id, :created_at], where: "file_type = 5", name: INDEX_SAST
+ add_concurrent_index :ci_job_artifacts, [:project_id, :created_at], where: "file_type = 8", name: INDEX_DAST
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_job_artifacts, INDEX_SAST
+ remove_concurrent_index_by_name :ci_job_artifacts, INDEX_DAST
+ end
+end
diff --git a/db/post_migrate/20210615234935_fix_batched_migrations_old_format_job_arguments.rb b/db/post_migrate/20210615234935_fix_batched_migrations_old_format_job_arguments.rb
new file mode 100644
index 00000000000..535f7426938
--- /dev/null
+++ b/db/post_migrate/20210615234935_fix_batched_migrations_old_format_job_arguments.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class FixBatchedMigrationsOldFormatJobArguments < ActiveRecord::Migration[6.1]
+ class BatchedMigration < ActiveRecord::Base
+ self.table_name = 'batched_background_migrations'
+ end
+
+ def up
+ # rubocop:disable Style/WordArray
+ [
+ ['events', 'id', ['id', 'id_convert_to_bigint'], [['id'], ['id_convert_to_bigint']]],
+ ['push_event_payloads', 'event_id', ['event_id', 'event_id_convert_to_bigint'], [['event_id'], ['event_id_convert_to_bigint']]]
+ ].each do |table_name, column_name, legacy_job_arguments, current_job_arguments|
+ base_scope = BatchedMigration
+ .where(job_class_name: 'CopyColumnUsingBackgroundMigrationJob', table_name: table_name, column_name: column_name)
+ # rubocop:enable Style/WordArray
+
+ # rubocop:disable Rails/WhereEquals
+ base_scope
+ .where('job_arguments = ?', legacy_job_arguments.to_json)
+ .where('NOT EXISTS (?)', base_scope.select('1').where('job_arguments = ?', current_job_arguments.to_json))
+ .update_all(job_arguments: current_job_arguments)
+ # rubocop:enable Rails/WhereEquals
+ end
+ end
+
+ def down
+ # No-op, there is no way to know were the existing record migrated from
+ # legacy job arguments, or were using the current format from the start.
+ # There is no reason to go back anyway.
+ end
+end
diff --git a/db/post_migrate/20210616145254_add_partial_index_for_ci_builds_token.rb b/db/post_migrate/20210616145254_add_partial_index_for_ci_builds_token.rb
new file mode 100644
index 00000000000..6e169a6f0e1
--- /dev/null
+++ b/db/post_migrate/20210616145254_add_partial_index_for_ci_builds_token.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddPartialIndexForCiBuildsToken < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ NAME = 'index_ci_builds_on_token_partial'
+
+ def up
+ add_concurrent_index :ci_builds, :token, unique: true, where: 'token IS NOT NULL', name: NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_builds, NAME
+ end
+end
diff --git a/db/post_migrate/20210621111747_add_ci_artifacts_devops_adoption_index.rb b/db/post_migrate/20210621111747_add_ci_artifacts_devops_adoption_index.rb
new file mode 100644
index 00000000000..71fd61072ac
--- /dev/null
+++ b/db/post_migrate/20210621111747_add_ci_artifacts_devops_adoption_index.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+#
+class AddCiArtifactsDevopsAdoptionIndex < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ NEW_INDEX = 'index_ci_job_artifacts_on_file_type_for_devops_adoption'
+
+ def up
+ add_concurrent_index :ci_job_artifacts, [:file_type, :project_id, :created_at], name: NEW_INDEX, where: 'file_type IN (5,6,8,23)'
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_job_artifacts, NEW_INDEX
+ end
+end
diff --git a/db/post_migrate/20210621155328_replace_project_authorizations_project_id_index.rb b/db/post_migrate/20210621155328_replace_project_authorizations_project_id_index.rb
new file mode 100644
index 00000000000..498090c3ab9
--- /dev/null
+++ b/db/post_migrate/20210621155328_replace_project_authorizations_project_id_index.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class ReplaceProjectAuthorizationsProjectIdIndex < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ OLD_INDEX_NAME = 'index_project_authorizations_on_project_id'
+ NEW_INDEX_NAME = 'index_project_authorizations_on_project_id_user_id'
+
+ def up
+ add_concurrent_index(:project_authorizations, [:project_id, :user_id], name: NEW_INDEX_NAME)
+ remove_concurrent_index_by_name(:project_authorizations, OLD_INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:project_authorizations, :project_id, name: OLD_INDEX_NAME)
+ remove_concurrent_index_by_name(:project_authorizations, NEW_INDEX_NAME)
+ end
+end
diff --git a/db/post_migrate/20210621164210_drop_remove_on_close_from_labels.rb b/db/post_migrate/20210621164210_drop_remove_on_close_from_labels.rb
new file mode 100644
index 00000000000..0430c8447d9
--- /dev/null
+++ b/db/post_migrate/20210621164210_drop_remove_on_close_from_labels.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class DropRemoveOnCloseFromLabels < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ # Migration that adds column was reverted, but run in Gitlab SaaS stg and prod
+ return unless column_exists?(:labels, :remove_on_close)
+
+ with_lock_retries do
+ remove_column :labels, :remove_on_close
+ end
+ end
+
+ def down
+ # No rollback as the original migration was reverted in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62056
+ # up simply removes the column from envs where the original migration was run
+ end
+end
diff --git a/db/post_migrate/20210621223000_steal_background_jobs_that_reference_services.rb b/db/post_migrate/20210621223000_steal_background_jobs_that_reference_services.rb
new file mode 100644
index 00000000000..8d326036a68
--- /dev/null
+++ b/db/post_migrate/20210621223000_steal_background_jobs_that_reference_services.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class StealBackgroundJobsThatReferenceServices < ActiveRecord::Migration[6.1]
+ def up
+ Gitlab::BackgroundMigration.steal('BackfillJiraTrackerDeploymentType2')
+ Gitlab::BackgroundMigration.steal('FixProjectsWithoutPrometheusService')
+ Gitlab::BackgroundMigration.steal('MigrateIssueTrackersSensitiveData')
+ Gitlab::BackgroundMigration.steal('RemoveDuplicateServices')
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210621223242_finalize_rename_services_to_integrations.rb b/db/post_migrate/20210621223242_finalize_rename_services_to_integrations.rb
new file mode 100644
index 00000000000..803a6fa0aca
--- /dev/null
+++ b/db/post_migrate/20210621223242_finalize_rename_services_to_integrations.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class FinalizeRenameServicesToIntegrations < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ finalize_table_rename(:services, :integrations)
+ end
+
+ def down
+ undo_finalize_table_rename(:services, :integrations)
+ end
+end
diff --git a/db/post_migrate/20210622041846_finalize_push_event_payloads_bigint_conversion.rb b/db/post_migrate/20210622041846_finalize_push_event_payloads_bigint_conversion.rb
new file mode 100644
index 00000000000..38b081e3e5e
--- /dev/null
+++ b/db/post_migrate/20210622041846_finalize_push_event_payloads_bigint_conversion.rb
@@ -0,0 +1,75 @@
+# frozen_string_literal: true
+
+class FinalizePushEventPayloadsBigintConversion < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'push_event_payloads'
+ INDEX_NAME = 'index_push_event_payloads_on_event_id_convert_to_bigint'
+
+ def up
+ return unless should_run?
+
+ ensure_batched_background_migration_is_finished(
+ job_class_name: 'CopyColumnUsingBackgroundMigrationJob',
+ table_name: TABLE_NAME,
+ column_name: 'event_id',
+ job_arguments: [["event_id"], ["event_id_convert_to_bigint"]]
+ )
+
+ swap_columns
+ end
+
+ def down
+ return unless should_run?
+
+ swap_columns
+ end
+
+ private
+
+ def should_run?
+ Gitlab.dev_or_test_env? || Gitlab.com?
+ end
+
+ def swap_columns
+ add_concurrent_index TABLE_NAME, :event_id_convert_to_bigint, unique: true, name: INDEX_NAME
+
+ # Add a foreign key on `event_id_convert_to_bigint` before we swap the columns and drop the old FK (fk_36c74129da)
+ add_concurrent_foreign_key TABLE_NAME, :events, column: :event_id_convert_to_bigint, on_delete: :cascade
+
+ with_lock_retries(raise_on_exhaustion: true) do
+ # Swap column names
+ temp_name = 'event_id_tmp'
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(:event_id)} TO #{quote_column_name(temp_name)}"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(:event_id_convert_to_bigint)} TO #{quote_column_name(:event_id)}"
+ execute "ALTER TABLE #{quote_table_name(TABLE_NAME)} RENAME COLUMN #{quote_column_name(temp_name)} TO #{quote_column_name(:event_id_convert_to_bigint)}"
+
+ # We need to update the trigger function in order to make PostgreSQL to
+ # regenerate the execution plan for it. This is to avoid type mismatch errors like
+ # "type of parameter 15 (bigint) does not match that when preparing the plan (integer)"
+ function_name = Gitlab::Database::UnidirectionalCopyTrigger.on_table(TABLE_NAME).name(:event_id, :event_id_convert_to_bigint)
+ execute "ALTER FUNCTION #{quote_table_name(function_name)} RESET ALL"
+
+ # Swap defaults
+ change_column_default TABLE_NAME, :event_id, nil
+ change_column_default TABLE_NAME, :event_id_convert_to_bigint, 0
+
+ # Swap PK constraint
+ execute "ALTER TABLE #{TABLE_NAME} DROP CONSTRAINT push_event_payloads_pkey"
+ rename_index TABLE_NAME, INDEX_NAME, 'push_event_payloads_pkey'
+ execute "ALTER TABLE #{TABLE_NAME} ADD CONSTRAINT push_event_payloads_pkey PRIMARY KEY USING INDEX push_event_payloads_pkey"
+
+ # Drop original FK on the old int4 `event_id` (fk_36c74129da)
+ remove_foreign_key TABLE_NAME, name: concurrent_foreign_key_name(TABLE_NAME, :event_id)
+ # We swapped the columns but the FK for event_id is still using the old name for the event_id_convert_to_bigint column
+ # So we have to also swap the FK name now that we dropped the other one with the same
+ rename_constraint(
+ TABLE_NAME,
+ concurrent_foreign_key_name(TABLE_NAME, :event_id_convert_to_bigint),
+ concurrent_foreign_key_name(TABLE_NAME, :event_id)
+ )
+ end
+ end
+end
diff --git a/db/post_migrate/20210622141148_schedule_delete_orphaned_deployments.rb b/db/post_migrate/20210622141148_schedule_delete_orphaned_deployments.rb
new file mode 100644
index 00000000000..cbd0d0ea3a2
--- /dev/null
+++ b/db/post_migrate/20210622141148_schedule_delete_orphaned_deployments.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class ScheduleDeleteOrphanedDeployments < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ MIGRATION = 'DeleteOrphanedDeployments'
+ BATCH_SIZE = 100_000
+ DELAY_INTERVAL = 2.minutes
+
+ disable_ddl_transaction!
+
+ def up
+ queue_background_migration_jobs_by_range_at_intervals(
+ define_batchable_model('deployments'),
+ MIGRATION,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ track_jobs: true
+ )
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210628124505_reset_job_token_scope_enabled.rb b/db/post_migrate/20210628124505_reset_job_token_scope_enabled.rb
new file mode 100644
index 00000000000..1176e704d0a
--- /dev/null
+++ b/db/post_migrate/20210628124505_reset_job_token_scope_enabled.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class ResetJobTokenScopeEnabled < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ def up
+ with_lock_retries do
+ remove_column :project_ci_cd_settings, :job_token_scope_enabled
+ add_column :project_ci_cd_settings, :job_token_scope_enabled, :boolean, default: false, null: false
+ end
+ end
+
+ def down
+ # Irreversible
+ end
+end
diff --git a/db/post_migrate/20210629101712_remove_deprecated_modsecurity_columns.rb b/db/post_migrate/20210629101712_remove_deprecated_modsecurity_columns.rb
new file mode 100644
index 00000000000..371298aef62
--- /dev/null
+++ b/db/post_migrate/20210629101712_remove_deprecated_modsecurity_columns.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class RemoveDeprecatedModsecurityColumns < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_clusters_applications_ingress_on_modsecurity'
+
+ def up
+ remove_column :clusters_applications_ingress, :modsecurity_enabled if column_exists?(:clusters_applications_ingress, :modsecurity_enabled)
+ remove_column :clusters_applications_ingress, :modsecurity_mode if column_exists?(:clusters_applications_ingress, :modsecurity_mode)
+ end
+
+ def down
+ add_column :clusters_applications_ingress, :modsecurity_enabled, :boolean unless column_exists?(:clusters_applications_ingress, :modsecurity_enabled)
+ add_column :clusters_applications_ingress, :modsecurity_mode, :smallint, null: false, default: 0 unless column_exists?(:clusters_applications_ingress, :modsecurity_mode)
+
+ add_concurrent_index :clusters_applications_ingress, [:modsecurity_enabled, :modsecurity_mode, :cluster_id], name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210629104933_drop_index_on_ci_builds_for_token.rb b/db/post_migrate/20210629104933_drop_index_on_ci_builds_for_token.rb
new file mode 100644
index 00000000000..cc26db924fe
--- /dev/null
+++ b/db/post_migrate/20210629104933_drop_index_on_ci_builds_for_token.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class DropIndexOnCiBuildsForToken < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEXNAME = :index_ci_builds_on_token
+
+ def up
+ remove_concurrent_index_by_name :ci_builds, INDEXNAME
+ end
+
+ def down
+ add_concurrent_index :ci_builds, :token, unique: true, name: INDEXNAME
+ end
+end
diff --git a/db/post_migrate/20210630025020_migrate_push_event_payloads_event_id_back_to_integer_for_gitlab_com.rb b/db/post_migrate/20210630025020_migrate_push_event_payloads_event_id_back_to_integer_for_gitlab_com.rb
new file mode 100644
index 00000000000..834a23a5c7a
--- /dev/null
+++ b/db/post_migrate/20210630025020_migrate_push_event_payloads_event_id_back_to_integer_for_gitlab_com.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require Rails.root.join('db', 'post_migrate', '20210622041846_finalize_push_event_payloads_bigint_conversion')
+
+class MigratePushEventPayloadsEventIdBackToIntegerForGitlabCom < ActiveRecord::Migration[6.1]
+ disable_ddl_transaction!
+
+ def up
+ FinalizePushEventPayloadsBigintConversion.new.down
+ end
+
+ def down
+ FinalizePushEventPayloadsBigintConversion.new.up
+ end
+end
diff --git a/db/post_migrate/20210701111909_backfill_issues_upvotes_count.rb b/db/post_migrate/20210701111909_backfill_issues_upvotes_count.rb
new file mode 100644
index 00000000000..0afc0bc1d08
--- /dev/null
+++ b/db/post_migrate/20210701111909_backfill_issues_upvotes_count.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class BackfillIssuesUpvotesCount < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ MIGRATION = 'BackfillUpvotesCountOnIssues'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 5_000
+
+ def up
+ scope = Issue.joins("INNER JOIN award_emoji e ON e.awardable_id = issues.id AND e.awardable_type = 'Issue' AND e.name = 'thumbsup'")
+
+ queue_background_migration_jobs_by_range_at_intervals(
+ scope,
+ MIGRATION,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE
+ )
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210706115312_add_upvotes_count_index_to_issues.rb b/db/post_migrate/20210706115312_add_upvotes_count_index_to_issues.rb
new file mode 100644
index 00000000000..65ec43930ea
--- /dev/null
+++ b/db/post_migrate/20210706115312_add_upvotes_count_index_to_issues.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddUpvotesCountIndexToIssues < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_issues_on_project_id_and_upvotes_count'
+
+ def up
+ add_concurrent_index :issues, [:project_id, :upvotes_count], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :issues, [:project_id, :upvotes_count], name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210706120847_remove_framework_column_from_compliance_management_frameworks.rb b/db/post_migrate/20210706120847_remove_framework_column_from_compliance_management_frameworks.rb
new file mode 100644
index 00000000000..73344ee061f
--- /dev/null
+++ b/db/post_migrate/20210706120847_remove_framework_column_from_compliance_management_frameworks.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class RemoveFrameworkColumnFromComplianceManagementFrameworks < ActiveRecord::Migration[6.1]
+ def change
+ remove_column :project_compliance_framework_settings, :framework, :smallint
+ end
+end
diff --git a/db/post_migrate/20210706142819_re_schedule_latest_pipeline_id_population.rb b/db/post_migrate/20210706142819_re_schedule_latest_pipeline_id_population.rb
new file mode 100644
index 00000000000..709e0be8b79
--- /dev/null
+++ b/db/post_migrate/20210706142819_re_schedule_latest_pipeline_id_population.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class ReScheduleLatestPipelineIdPopulation < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ DELAY_INTERVAL = 2.minutes.to_i
+ BATCH_SIZE = 100
+ MIGRATION = 'PopulateLatestPipelineIds'
+
+ disable_ddl_transaction!
+
+ def up
+ return unless Gitlab.ee?
+
+ queue_background_migration_jobs_by_range_at_intervals(
+ Gitlab::BackgroundMigration::PopulateLatestPipelineIds::ProjectSetting.has_vulnerabilities_without_latest_pipeline_set,
+ MIGRATION,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE,
+ primary_column_name: 'project_id'
+ )
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210708130419_reschedule_merge_request_diff_users_background_migration.rb b/db/post_migrate/20210708130419_reschedule_merge_request_diff_users_background_migration.rb
new file mode 100644
index 00000000000..53f13ca96d2
--- /dev/null
+++ b/db/post_migrate/20210708130419_reschedule_merge_request_diff_users_background_migration.rb
@@ -0,0 +1,58 @@
+# frozen_string_literal: true
+
+class RescheduleMergeRequestDiffUsersBackgroundMigration < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ # The number of rows to process in a single migration job.
+ #
+ # The minimum interval for background migrations is two minutes. On staging we
+ # observed we can process roughly 20 000 rows in a minute. Based on the total
+ # number of rows on staging, this translates to a total processing time of
+ # roughly 14 days.
+ #
+ # By using a batch size of 40 000, we maintain a rate of roughly 20 000 rows
+ # per minute, hopefully keeping the total migration time under two weeks;
+ # instead of four weeks.
+ BATCH_SIZE = 40_000
+
+ MIGRATION_NAME = 'MigrateMergeRequestDiffCommitUsers'
+
+ class MergeRequestDiff < ActiveRecord::Base
+ self.table_name = 'merge_request_diffs'
+ end
+
+ def up
+ start = MergeRequestDiff.minimum(:id).to_i
+ max = MergeRequestDiff.maximum(:id).to_i
+ delay = BackgroundMigrationWorker.minimum_interval
+
+ Gitlab::Database::BackgroundMigrationJob
+ .where(class_name: MIGRATION_NAME)
+ .delete_all
+
+ # The table merge_request_diff_commits contains _a lot_ of rows (roughly 400
+ # 000 000 on staging). Iterating a table that large to determine job ranges
+ # would take a while.
+ #
+ # To avoid that overhead, we simply schedule fixed ranges according to the
+ # minimum and maximum IDs. The background migration in turn only processes
+ # rows that actually exist.
+ while start < max
+ stop = start + BATCH_SIZE
+
+ migrate_in(delay, MIGRATION_NAME, [start, stop])
+
+ Gitlab::Database::BackgroundMigrationJob
+ .create!(class_name: MIGRATION_NAME, arguments: [start, stop])
+
+ delay += BackgroundMigrationWorker.minimum_interval
+ start += BATCH_SIZE
+ end
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/schema_migrations/20210317210338 b/db/schema_migrations/20210317210338
new file mode 100644
index 00000000000..15400399589
--- /dev/null
+++ b/db/schema_migrations/20210317210338
@@ -0,0 +1 @@
+e915378e1ebb78b528abfecda55cdc52a690d982e4377876b818197b3134c09a \ No newline at end of file
diff --git a/db/schema_migrations/20210601132134 b/db/schema_migrations/20210601132134
new file mode 100644
index 00000000000..3fa9505de2f
--- /dev/null
+++ b/db/schema_migrations/20210601132134
@@ -0,0 +1 @@
+966299fecd160b594f0837f19cc01b38fc365fa749982f9245c296d912e3eb2f \ No newline at end of file
diff --git a/db/schema_migrations/20210602155056 b/db/schema_migrations/20210602155056
new file mode 100644
index 00000000000..4c6f7f95874
--- /dev/null
+++ b/db/schema_migrations/20210602155056
@@ -0,0 +1 @@
+42b3090efee66f5a7a5c06d8768d1417892c5d6745f60163a09f58e6e3722761 \ No newline at end of file
diff --git a/db/schema_migrations/20210602155110 b/db/schema_migrations/20210602155110
new file mode 100644
index 00000000000..127375dc477
--- /dev/null
+++ b/db/schema_migrations/20210602155110
@@ -0,0 +1 @@
+aa04d433e400ed3ec11e5d40ada72f122b1d8b7a82f8803d9206da5c94ec5ef9 \ No newline at end of file
diff --git a/db/schema_migrations/20210602164044 b/db/schema_migrations/20210602164044
new file mode 100644
index 00000000000..4574aaf9cb9
--- /dev/null
+++ b/db/schema_migrations/20210602164044
@@ -0,0 +1 @@
+6c617b919e6e0cba0bd62cc0d5056dcad3ebe1a9ce25102a288de5456cbaa6c3 \ No newline at end of file
diff --git a/db/schema_migrations/20210604032738 b/db/schema_migrations/20210604032738
new file mode 100644
index 00000000000..1bd62357c71
--- /dev/null
+++ b/db/schema_migrations/20210604032738
@@ -0,0 +1 @@
+fa373e98739d57d829273cfa9246137e2c151be67e97183c1dcdb288150aaeb5 \ No newline at end of file
diff --git a/db/schema_migrations/20210604034158 b/db/schema_migrations/20210604034158
new file mode 100644
index 00000000000..06b04764628
--- /dev/null
+++ b/db/schema_migrations/20210604034158
@@ -0,0 +1 @@
+c7cf4aad7637d793d1ace8fee02111bc9b0d2eea09efadb0fd616bc5c5e5550c \ No newline at end of file
diff --git a/db/schema_migrations/20210604034354 b/db/schema_migrations/20210604034354
new file mode 100644
index 00000000000..a76242b3412
--- /dev/null
+++ b/db/schema_migrations/20210604034354
@@ -0,0 +1 @@
+da868be7c8edefc462110b5b36415870cc0c7c59dba1e3d514348011a9e70642 \ No newline at end of file
diff --git a/db/schema_migrations/20210604051330 b/db/schema_migrations/20210604051330
new file mode 100644
index 00000000000..74140921c2f
--- /dev/null
+++ b/db/schema_migrations/20210604051330
@@ -0,0 +1 @@
+2d025932dca7a407968e14872ce053461e69550098ca089d4e6ece323d240927 \ No newline at end of file
diff --git a/db/schema_migrations/20210604051742 b/db/schema_migrations/20210604051742
new file mode 100644
index 00000000000..32ed06dafff
--- /dev/null
+++ b/db/schema_migrations/20210604051742
@@ -0,0 +1 @@
+7529373266b6c9b179367d5fa8775f5e2ad600008957b3a821d689aec70c7407 \ No newline at end of file
diff --git a/db/schema_migrations/20210604051917 b/db/schema_migrations/20210604051917
new file mode 100644
index 00000000000..0034d9988e7
--- /dev/null
+++ b/db/schema_migrations/20210604051917
@@ -0,0 +1 @@
+3818094a4470ff7d0c105c000655dac4205e8265f78df638df0e2ef3dc6deaf3 \ No newline at end of file
diff --git a/db/schema_migrations/20210604133651 b/db/schema_migrations/20210604133651
new file mode 100644
index 00000000000..7c6394cd470
--- /dev/null
+++ b/db/schema_migrations/20210604133651
@@ -0,0 +1 @@
+0c01bb41113c468a602649b591e1fd2959a6e3190c835ef2e27351cf69f50fd5 \ No newline at end of file
diff --git a/db/schema_migrations/20210609202501 b/db/schema_migrations/20210609202501
new file mode 100644
index 00000000000..ad71feddcfc
--- /dev/null
+++ b/db/schema_migrations/20210609202501
@@ -0,0 +1 @@
+93f577e2fe2dcc0daafc4ff7e15a4511a2e9f86f05f9892f5c7625f11bfce3ae \ No newline at end of file
diff --git a/db/schema_migrations/20210610042700 b/db/schema_migrations/20210610042700
new file mode 100644
index 00000000000..ef0f3e34f48
--- /dev/null
+++ b/db/schema_migrations/20210610042700
@@ -0,0 +1 @@
+f8b8276ed7e120b61f6748a328590a98f0e444e0d26bcb1a2b0daa54c3643acd \ No newline at end of file
diff --git a/db/schema_migrations/20210610153556 b/db/schema_migrations/20210610153556
new file mode 100644
index 00000000000..71b71a671c4
--- /dev/null
+++ b/db/schema_migrations/20210610153556
@@ -0,0 +1 @@
+39ca841ce1de3faadee41fbb756d80c98efd853fbbffa7cb3f8f9de56752078b \ No newline at end of file
diff --git a/db/schema_migrations/20210611101034 b/db/schema_migrations/20210611101034
new file mode 100644
index 00000000000..70712a32be1
--- /dev/null
+++ b/db/schema_migrations/20210611101034
@@ -0,0 +1 @@
+a535348229ff5e9e3c5b530ded9407df9f4308fc4d9967106bf246d7267c2a48 \ No newline at end of file
diff --git a/db/schema_migrations/20210614124111 b/db/schema_migrations/20210614124111
new file mode 100644
index 00000000000..25427277070
--- /dev/null
+++ b/db/schema_migrations/20210614124111
@@ -0,0 +1 @@
+30c6316f3931075bd8b167e06af5d80b7ece65f428d1fa7602ab27b526bc8410 \ No newline at end of file
diff --git a/db/schema_migrations/20210614142311 b/db/schema_migrations/20210614142311
new file mode 100644
index 00000000000..69a2472990a
--- /dev/null
+++ b/db/schema_migrations/20210614142311
@@ -0,0 +1 @@
+5dc0a4f91dc35b7720b20e89fa77374a0337c380b9234704e7d4143639e512f0 \ No newline at end of file
diff --git a/db/schema_migrations/20210615064342 b/db/schema_migrations/20210615064342
new file mode 100644
index 00000000000..a126cd6258e
--- /dev/null
+++ b/db/schema_migrations/20210615064342
@@ -0,0 +1 @@
+509f30d8772e24efc52c5aa12ebcde084f7ded8d228109bbbdda2f21d3235512 \ No newline at end of file
diff --git a/db/schema_migrations/20210615234935 b/db/schema_migrations/20210615234935
new file mode 100644
index 00000000000..83e43f74a53
--- /dev/null
+++ b/db/schema_migrations/20210615234935
@@ -0,0 +1 @@
+205336e95a6e3c9fa8c56fa67e66ef3023ba8c6cd4e6f3599160b74b3fbfaa3c \ No newline at end of file
diff --git a/db/schema_migrations/20210616110748 b/db/schema_migrations/20210616110748
new file mode 100644
index 00000000000..06cab110a99
--- /dev/null
+++ b/db/schema_migrations/20210616110748
@@ -0,0 +1 @@
+8207eb9917b4d02f39cd9e9eca9ec0e001266b25b3378f09e4e8c27ff22b6e73 \ No newline at end of file
diff --git a/db/schema_migrations/20210616111311 b/db/schema_migrations/20210616111311
new file mode 100644
index 00000000000..070f9adfcda
--- /dev/null
+++ b/db/schema_migrations/20210616111311
@@ -0,0 +1 @@
+fd014b505ecd162c232da23a10c34dc4b1f1dbe8fe357a0f20585479b25d50bc \ No newline at end of file
diff --git a/db/schema_migrations/20210616134905 b/db/schema_migrations/20210616134905
new file mode 100644
index 00000000000..90658174989
--- /dev/null
+++ b/db/schema_migrations/20210616134905
@@ -0,0 +1 @@
+52843d12ab18b92c71a334cf877682d9fae57632cf0ba14213dfc0543e39cf1b \ No newline at end of file
diff --git a/db/schema_migrations/20210616145254 b/db/schema_migrations/20210616145254
new file mode 100644
index 00000000000..e5d7553d883
--- /dev/null
+++ b/db/schema_migrations/20210616145254
@@ -0,0 +1 @@
+525fbdd66dcabbf1e6d0430468600f86fbc3c00dcfdab1c5a052294d7d73de37 \ No newline at end of file
diff --git a/db/schema_migrations/20210616154808 b/db/schema_migrations/20210616154808
new file mode 100644
index 00000000000..be7d5811540
--- /dev/null
+++ b/db/schema_migrations/20210616154808
@@ -0,0 +1 @@
+adfa07888317cb7f22062f5d23906bc01de579305acb3bb3384f18e3f581a87b \ No newline at end of file
diff --git a/db/schema_migrations/20210616185947 b/db/schema_migrations/20210616185947
new file mode 100644
index 00000000000..30275f102dc
--- /dev/null
+++ b/db/schema_migrations/20210616185947
@@ -0,0 +1 @@
+8d73f4b4b716176afe5a9b0ee3a4ef28bbbc2fe944a18fb66afa8cf8f763e8ac \ No newline at end of file
diff --git a/db/schema_migrations/20210617022324 b/db/schema_migrations/20210617022324
new file mode 100644
index 00000000000..40bace34b4c
--- /dev/null
+++ b/db/schema_migrations/20210617022324
@@ -0,0 +1 @@
+fa4f1ec80e7039e59d283dc6effd6904ca33c637d27c687d990822eb2f6198e5 \ No newline at end of file
diff --git a/db/schema_migrations/20210617161348 b/db/schema_migrations/20210617161348
new file mode 100644
index 00000000000..238f969d304
--- /dev/null
+++ b/db/schema_migrations/20210617161348
@@ -0,0 +1 @@
+3f73aa7d2cff11d00b330d88e76daaa058f82b7012da3c244f246da6e538921c \ No newline at end of file
diff --git a/db/schema_migrations/20210617180131 b/db/schema_migrations/20210617180131
new file mode 100644
index 00000000000..b44f82a3311
--- /dev/null
+++ b/db/schema_migrations/20210617180131
@@ -0,0 +1 @@
+2adb38e71c6173350d1f98f3237b692e4f12c8a073115be23f3a713f69cde911 \ No newline at end of file
diff --git a/db/schema_migrations/20210621043337 b/db/schema_migrations/20210621043337
new file mode 100644
index 00000000000..1dd6b0ac1dd
--- /dev/null
+++ b/db/schema_migrations/20210621043337
@@ -0,0 +1 @@
+cfe35a1297c4a92c4b5e62757ed74c11ffd6f207777291c11b05a4e3cee91618 \ No newline at end of file
diff --git a/db/schema_migrations/20210621044000 b/db/schema_migrations/20210621044000
new file mode 100644
index 00000000000..0b620576357
--- /dev/null
+++ b/db/schema_migrations/20210621044000
@@ -0,0 +1 @@
+64babbed04b9e3bf59bb723b43e3c30730527f0e0e09906073b5bd9379067ab6 \ No newline at end of file
diff --git a/db/schema_migrations/20210621084632 b/db/schema_migrations/20210621084632
new file mode 100644
index 00000000000..4ab2467fab0
--- /dev/null
+++ b/db/schema_migrations/20210621084632
@@ -0,0 +1 @@
+fb5b54e29400836afb122cd38a2ae34abc1ff6dd800eadaba023220c51da6868 \ No newline at end of file
diff --git a/db/schema_migrations/20210621090030 b/db/schema_migrations/20210621090030
new file mode 100644
index 00000000000..c015bc6ec7f
--- /dev/null
+++ b/db/schema_migrations/20210621090030
@@ -0,0 +1 @@
+5077a5c9cfe9b79506bb65d9dd02b745545a8586c198041bf7cbb945827c07cf \ No newline at end of file
diff --git a/db/schema_migrations/20210621091830 b/db/schema_migrations/20210621091830
new file mode 100644
index 00000000000..89a505b0c9a
--- /dev/null
+++ b/db/schema_migrations/20210621091830
@@ -0,0 +1 @@
+11450695142e5145e5cbf9077f259e28c908b794948be5c4b77e34465f6498aa \ No newline at end of file
diff --git a/db/schema_migrations/20210621111747 b/db/schema_migrations/20210621111747
new file mode 100644
index 00000000000..728eb47b0ba
--- /dev/null
+++ b/db/schema_migrations/20210621111747
@@ -0,0 +1 @@
+582a22626330e93e679a14eff2cdd85a5732f797fc1a6c94409d46cc5027c8ea \ No newline at end of file
diff --git a/db/schema_migrations/20210621155328 b/db/schema_migrations/20210621155328
new file mode 100644
index 00000000000..ba3dd235cee
--- /dev/null
+++ b/db/schema_migrations/20210621155328
@@ -0,0 +1 @@
+d08fdc3da5fe1a7bf20af5fbe42438fc43ebdf1299c61159740df7644e4ea117 \ No newline at end of file
diff --git a/db/schema_migrations/20210621164210 b/db/schema_migrations/20210621164210
new file mode 100644
index 00000000000..6855b8e42ee
--- /dev/null
+++ b/db/schema_migrations/20210621164210
@@ -0,0 +1 @@
+b952f1e3fe2bfa680ba68b79637e0a2a1ee5b388cfa106db62521a663262b024 \ No newline at end of file
diff --git a/db/schema_migrations/20210621223000 b/db/schema_migrations/20210621223000
new file mode 100644
index 00000000000..17f64d4b263
--- /dev/null
+++ b/db/schema_migrations/20210621223000
@@ -0,0 +1 @@
+07d0de05b6a59ba0d1f464ae488f5ead812bc643984ac3dc662c78a02a978f7f \ No newline at end of file
diff --git a/db/schema_migrations/20210621223242 b/db/schema_migrations/20210621223242
new file mode 100644
index 00000000000..9aa2562f30f
--- /dev/null
+++ b/db/schema_migrations/20210621223242
@@ -0,0 +1 @@
+eeee178019c259a6fff85219490abf62f2694227cc2facf454d93e57c373833b \ No newline at end of file
diff --git a/db/schema_migrations/20210622041846 b/db/schema_migrations/20210622041846
new file mode 100644
index 00000000000..f16291b8424
--- /dev/null
+++ b/db/schema_migrations/20210622041846
@@ -0,0 +1 @@
+750cda544df323be99452d53aaf39933c8584fc6754ece45263e131884d980d0 \ No newline at end of file
diff --git a/db/schema_migrations/20210622135221 b/db/schema_migrations/20210622135221
new file mode 100644
index 00000000000..eedd4d82b2c
--- /dev/null
+++ b/db/schema_migrations/20210622135221
@@ -0,0 +1 @@
+e43889baa57ea2cd0b87ba98819408115955f6a6586b3275cf0a08bd79909c71 \ No newline at end of file
diff --git a/db/schema_migrations/20210622141148 b/db/schema_migrations/20210622141148
new file mode 100644
index 00000000000..ba693e271aa
--- /dev/null
+++ b/db/schema_migrations/20210622141148
@@ -0,0 +1 @@
+432954295d6f3a2a45f3deef42b547ffe42501beaea4f376e1be51cf148de671 \ No newline at end of file
diff --git a/db/schema_migrations/20210623074226 b/db/schema_migrations/20210623074226
new file mode 100644
index 00000000000..76d5cd41839
--- /dev/null
+++ b/db/schema_migrations/20210623074226
@@ -0,0 +1 @@
+1a0df6210d9ee0e0229f3cdf3e95acaaa47ebf4ca31ac0fd9f57255115355f99 \ No newline at end of file
diff --git a/db/schema_migrations/20210623123722 b/db/schema_migrations/20210623123722
new file mode 100644
index 00000000000..f635c512d94
--- /dev/null
+++ b/db/schema_migrations/20210623123722
@@ -0,0 +1 @@
+af58377b87f7e0fb4709637f96b24a4075322d0d8cf87dfaf5bf8e0f8a9372e0 \ No newline at end of file
diff --git a/db/schema_migrations/20210623133635 b/db/schema_migrations/20210623133635
new file mode 100644
index 00000000000..bd59fe90c62
--- /dev/null
+++ b/db/schema_migrations/20210623133635
@@ -0,0 +1 @@
+1a930fec524c91c5d382c40514d0d1943e59514f5dbd8588595363c24819b8d0 \ No newline at end of file
diff --git a/db/schema_migrations/20210623163342 b/db/schema_migrations/20210623163342
new file mode 100644
index 00000000000..f60112edd81
--- /dev/null
+++ b/db/schema_migrations/20210623163342
@@ -0,0 +1 @@
+6732401a959a7a691b8729e2bfb38e010dd4da4cd04418aada22946c42fdd6dc \ No newline at end of file
diff --git a/db/schema_migrations/20210624112821 b/db/schema_migrations/20210624112821
new file mode 100644
index 00000000000..86b0e9612e0
--- /dev/null
+++ b/db/schema_migrations/20210624112821
@@ -0,0 +1 @@
+2fca5d3203b7bb766274fc333e9a2a267340142856bd23efaabb1cb2c1cb7cb7 \ No newline at end of file
diff --git a/db/schema_migrations/20210624180613 b/db/schema_migrations/20210624180613
new file mode 100644
index 00000000000..e7f4d25fc78
--- /dev/null
+++ b/db/schema_migrations/20210624180613
@@ -0,0 +1 @@
+705c4cf981f1929f8e8e4d8a8a3c12613516d65e59c71ac79048224cd97c47cc \ No newline at end of file
diff --git a/db/schema_migrations/20210625094554 b/db/schema_migrations/20210625094554
new file mode 100644
index 00000000000..a20925101f8
--- /dev/null
+++ b/db/schema_migrations/20210625094554
@@ -0,0 +1 @@
+df9e976b0f294284ad9e9b617da42310c83cb1acc6db6ea00ea93c49c2310a1c \ No newline at end of file
diff --git a/db/schema_migrations/20210627204936 b/db/schema_migrations/20210627204936
new file mode 100644
index 00000000000..abc39339816
--- /dev/null
+++ b/db/schema_migrations/20210627204936
@@ -0,0 +1 @@
+b37bf7db9c00c8f54c0ccca2d418f1279e12ff7e5b71347966494dc5645eb648 \ No newline at end of file
diff --git a/db/schema_migrations/20210628124505 b/db/schema_migrations/20210628124505
new file mode 100644
index 00000000000..478617f5506
--- /dev/null
+++ b/db/schema_migrations/20210628124505
@@ -0,0 +1 @@
+7add197fec50d8da5bcdbca83115558480668c26ad3a3fefc4ab93c07f34f63a \ No newline at end of file
diff --git a/db/schema_migrations/20210629101712 b/db/schema_migrations/20210629101712
new file mode 100644
index 00000000000..4b4a88bdfa3
--- /dev/null
+++ b/db/schema_migrations/20210629101712
@@ -0,0 +1 @@
+28e448810fdf8bab4de44d45acac862e752f578b5b8fd77b885a385b9ef16b2d \ No newline at end of file
diff --git a/db/schema_migrations/20210629104933 b/db/schema_migrations/20210629104933
new file mode 100644
index 00000000000..4c5a3fb0003
--- /dev/null
+++ b/db/schema_migrations/20210629104933
@@ -0,0 +1 @@
+2ec44dfd0745fd155ab3ab52153688a8969641134a9cc0cc485dd698cc8fd2d1 \ No newline at end of file
diff --git a/db/schema_migrations/20210629153519 b/db/schema_migrations/20210629153519
new file mode 100644
index 00000000000..304ff5c9fa6
--- /dev/null
+++ b/db/schema_migrations/20210629153519
@@ -0,0 +1 @@
+cba36a2e8bedd70f8ccaca47517314d0a3c75a9b8d90715a29919247aa686835 \ No newline at end of file
diff --git a/db/schema_migrations/20210630025020 b/db/schema_migrations/20210630025020
new file mode 100644
index 00000000000..7808a7e3178
--- /dev/null
+++ b/db/schema_migrations/20210630025020
@@ -0,0 +1 @@
+71ad8c8f2419721f8fdf6c6bbd1265c4a7ca277972c59319e155bc6dfc46aa48 \ No newline at end of file
diff --git a/db/schema_migrations/20210630144339 b/db/schema_migrations/20210630144339
new file mode 100644
index 00000000000..5d91d60199c
--- /dev/null
+++ b/db/schema_migrations/20210630144339
@@ -0,0 +1 @@
+8d1777941e1a4b5f9f8f5f5e3ae416d6d02aaee1174eff1f9b4b38a6cdf0103a \ No newline at end of file
diff --git a/db/schema_migrations/20210701111627 b/db/schema_migrations/20210701111627
new file mode 100644
index 00000000000..ca52a786a22
--- /dev/null
+++ b/db/schema_migrations/20210701111627
@@ -0,0 +1 @@
+c2efdad12c3d0ec5371259baa91466137b827f513250e901842ab28e56c3de0a \ No newline at end of file
diff --git a/db/schema_migrations/20210701111909 b/db/schema_migrations/20210701111909
new file mode 100644
index 00000000000..ed6e2d56e8d
--- /dev/null
+++ b/db/schema_migrations/20210701111909
@@ -0,0 +1 @@
+fdd7509fc88e563b65b487706cae1a64066a7ba7d4bd13d0414b8431c3ddfb68 \ No newline at end of file
diff --git a/db/schema_migrations/20210702124842 b/db/schema_migrations/20210702124842
new file mode 100644
index 00000000000..dbaeb88a6fd
--- /dev/null
+++ b/db/schema_migrations/20210702124842
@@ -0,0 +1 @@
+8c4c92c4606cf406def47829ce16e903b3b2da00cbbdccfe6f0af5fa249be862 \ No newline at end of file
diff --git a/db/schema_migrations/20210705124128 b/db/schema_migrations/20210705124128
new file mode 100644
index 00000000000..247378331e4
--- /dev/null
+++ b/db/schema_migrations/20210705124128
@@ -0,0 +1 @@
+02aea8fe759614bc3aa751e023aa508963f8183366f6d6f518bbccc2d85ec1a1 \ No newline at end of file
diff --git a/db/schema_migrations/20210705130919 b/db/schema_migrations/20210705130919
new file mode 100644
index 00000000000..9e0b9ffe69a
--- /dev/null
+++ b/db/schema_migrations/20210705130919
@@ -0,0 +1 @@
+c33dd2c63d5a8c6e3c2f49e640b1780734b4bfca88378fac67ea5f5bd24fb2b4 \ No newline at end of file
diff --git a/db/schema_migrations/20210705132928 b/db/schema_migrations/20210705132928
new file mode 100644
index 00000000000..c1ef3ec3c1f
--- /dev/null
+++ b/db/schema_migrations/20210705132928
@@ -0,0 +1 @@
+c66a42fc813846a09d4389a895a2d20ad48889d8ff45ab642e771b6792490623 \ No newline at end of file
diff --git a/db/schema_migrations/20210705144657 b/db/schema_migrations/20210705144657
new file mode 100644
index 00000000000..557dbdbd95c
--- /dev/null
+++ b/db/schema_migrations/20210705144657
@@ -0,0 +1 @@
+9ba27b5e2599262846a06736db72fb0d31dc904e2ef4d167c1ee9530feb6367f \ No newline at end of file
diff --git a/db/schema_migrations/20210706084713 b/db/schema_migrations/20210706084713
new file mode 100644
index 00000000000..7c87af30919
--- /dev/null
+++ b/db/schema_migrations/20210706084713
@@ -0,0 +1 @@
+f69e3f50e4e5642a59e157a3c4a133090ec843b563e47198d560a54328176e56 \ No newline at end of file
diff --git a/db/schema_migrations/20210706115312 b/db/schema_migrations/20210706115312
new file mode 100644
index 00000000000..a1298418836
--- /dev/null
+++ b/db/schema_migrations/20210706115312
@@ -0,0 +1 @@
+ac150e706b115849aa3802ae7b8e07d983e89eb637c48582c64948cbc7d7163d \ No newline at end of file
diff --git a/db/schema_migrations/20210706120847 b/db/schema_migrations/20210706120847
new file mode 100644
index 00000000000..329e5650dd0
--- /dev/null
+++ b/db/schema_migrations/20210706120847
@@ -0,0 +1 @@
+0fffffc44c32a936760424541e183b1a41938750d4e10da9dd76c2a09094a07b \ No newline at end of file
diff --git a/db/schema_migrations/20210706142819 b/db/schema_migrations/20210706142819
new file mode 100644
index 00000000000..193c6ba1d56
--- /dev/null
+++ b/db/schema_migrations/20210706142819
@@ -0,0 +1 @@
+ed0daff7120cbdba2f0e9ca1f2e40c11114bb2c7db4543903d16891ffbbba3f8 \ No newline at end of file
diff --git a/db/schema_migrations/20210706152139 b/db/schema_migrations/20210706152139
new file mode 100644
index 00000000000..81339dc1d81
--- /dev/null
+++ b/db/schema_migrations/20210706152139
@@ -0,0 +1 @@
+45ec2dd6113d112050a1ac062064950fa18b3b5903a9fd60234e9e9fa48c7070 \ No newline at end of file
diff --git a/db/schema_migrations/20210706213537 b/db/schema_migrations/20210706213537
new file mode 100644
index 00000000000..fa621773ee7
--- /dev/null
+++ b/db/schema_migrations/20210706213537
@@ -0,0 +1 @@
+150463cef309e6bf69240c258dc8aede53b846a08a7e2d668ee0429709022554 \ No newline at end of file
diff --git a/db/schema_migrations/20210707095545 b/db/schema_migrations/20210707095545
new file mode 100644
index 00000000000..83255c22622
--- /dev/null
+++ b/db/schema_migrations/20210707095545
@@ -0,0 +1 @@
+98d4deaf0564119c1ee44d76d3a30bff1a0fceb7cab67c5dbef576faef62ddf5 \ No newline at end of file
diff --git a/db/schema_migrations/20210707151536 b/db/schema_migrations/20210707151536
new file mode 100644
index 00000000000..feea256b2ac
--- /dev/null
+++ b/db/schema_migrations/20210707151536
@@ -0,0 +1 @@
+4fc688d17e374faf806a25635e05b053228ac201b94920d4f3b3810329a6552c \ No newline at end of file
diff --git a/db/schema_migrations/20210707171536 b/db/schema_migrations/20210707171536
new file mode 100644
index 00000000000..dd78b254a67
--- /dev/null
+++ b/db/schema_migrations/20210707171536
@@ -0,0 +1 @@
+ee8576a7dec8e0657a3976422f74202e3f89c9a72aae64f0f75398d0c6ff5b97 \ No newline at end of file
diff --git a/db/schema_migrations/20210707171554 b/db/schema_migrations/20210707171554
new file mode 100644
index 00000000000..ef6f174f734
--- /dev/null
+++ b/db/schema_migrations/20210707171554
@@ -0,0 +1 @@
+5f2acbd5ed9132ad6c11cf4be34061decde2f3c602ef319331454b424e6b4344 \ No newline at end of file
diff --git a/db/schema_migrations/20210707173645 b/db/schema_migrations/20210707173645
new file mode 100644
index 00000000000..0cc2386b4ef
--- /dev/null
+++ b/db/schema_migrations/20210707173645
@@ -0,0 +1 @@
+e440dac0e14df7309c84e72b98ed6373c712901dc66310a474979e0fce7dc59c \ No newline at end of file
diff --git a/db/schema_migrations/20210707181536 b/db/schema_migrations/20210707181536
new file mode 100644
index 00000000000..7bbdcc9a1d0
--- /dev/null
+++ b/db/schema_migrations/20210707181536
@@ -0,0 +1 @@
+0c25d19d03bce4f145eca271c852aad6a8327821a8f5ff0aa2f0286f4a65b328 \ No newline at end of file
diff --git a/db/schema_migrations/20210708063032 b/db/schema_migrations/20210708063032
new file mode 100644
index 00000000000..9d3271bdd91
--- /dev/null
+++ b/db/schema_migrations/20210708063032
@@ -0,0 +1 @@
+77f6db1d2aeebdefd76c96966da6c9e4ce5da2c92a42f6ac2398b35fa21c680f \ No newline at end of file
diff --git a/db/schema_migrations/20210708124229 b/db/schema_migrations/20210708124229
new file mode 100644
index 00000000000..29cf5b8986f
--- /dev/null
+++ b/db/schema_migrations/20210708124229
@@ -0,0 +1 @@
+18f7a9a0e9f0b331028951adf2bf6ca9a9fc4a62872f5307ee9d74761ae06deb \ No newline at end of file
diff --git a/db/schema_migrations/20210708130419 b/db/schema_migrations/20210708130419
new file mode 100644
index 00000000000..b20db5b17c2
--- /dev/null
+++ b/db/schema_migrations/20210708130419
@@ -0,0 +1 @@
+8545d6575c9dacec6796882677c4403cf3559430518e8709bf390f20717413d7 \ No newline at end of file
diff --git a/db/schema_migrations/20210708131048 b/db/schema_migrations/20210708131048
new file mode 100644
index 00000000000..f61978d8e0f
--- /dev/null
+++ b/db/schema_migrations/20210708131048
@@ -0,0 +1 @@
+ed0c0dc015e7c3457248303b8b478c8d259d6a800a2bfed8b05b1f976b6794a7 \ No newline at end of file
diff --git a/db/schema_migrations/20210708134446 b/db/schema_migrations/20210708134446
new file mode 100644
index 00000000000..9ec3b2182df
--- /dev/null
+++ b/db/schema_migrations/20210708134446
@@ -0,0 +1 @@
+1367865e22f6129fa69f3c86dc72b88a9af0479a41f2029a446464aeeed9c18e \ No newline at end of file
diff --git a/db/schema_migrations/20210709085759 b/db/schema_migrations/20210709085759
new file mode 100644
index 00000000000..4546b090e42
--- /dev/null
+++ b/db/schema_migrations/20210709085759
@@ -0,0 +1 @@
+4216604d14b4ccc652ba423a95ee9bd15646b3553903dc4b79497871f5384492 \ No newline at end of file
diff --git a/db/schema_migrations/20210709132707 b/db/schema_migrations/20210709132707
new file mode 100644
index 00000000000..04ba096a692
--- /dev/null
+++ b/db/schema_migrations/20210709132707
@@ -0,0 +1 @@
+e0a2de69a3c9d616b87207b764e33fa3326627e065f28fc200c1414f08ee9fff \ No newline at end of file
diff --git a/db/schema_migrations/20210713070842 b/db/schema_migrations/20210713070842
new file mode 100644
index 00000000000..857dea1627e
--- /dev/null
+++ b/db/schema_migrations/20210713070842
@@ -0,0 +1 @@
+2899d954a199fa52bf6ab4beca5f22dcb9f9f0312e658f1307d1a7355394f1bb \ No newline at end of file
diff --git a/db/schema_migrations/20210713135152 b/db/schema_migrations/20210713135152
new file mode 100644
index 00000000000..a1ba4e939e9
--- /dev/null
+++ b/db/schema_migrations/20210713135152
@@ -0,0 +1 @@
+d7f8f7f5d8a6cf03d500825ef43234c69f7ad36908c0bade337591b05985c2fe \ No newline at end of file
diff --git a/db/schema_migrations/20210713144637 b/db/schema_migrations/20210713144637
new file mode 100644
index 00000000000..ebc122e0275
--- /dev/null
+++ b/db/schema_migrations/20210713144637
@@ -0,0 +1 @@
+699ac7f8b9253920271686c497b57521bf4b0d26c802ca2a57447e4929cd147f \ No newline at end of file
diff --git a/db/schema_migrations/20210714120600 b/db/schema_migrations/20210714120600
new file mode 100644
index 00000000000..e698300671b
--- /dev/null
+++ b/db/schema_migrations/20210714120600
@@ -0,0 +1 @@
+de9167bc4f9e2b68b257a7ff81636d5dbb6d73ff81672fdf1c73adadf5707bea \ No newline at end of file
diff --git a/db/schema_migrations/20210716074555 b/db/schema_migrations/20210716074555
new file mode 100644
index 00000000000..f079b199ca5
--- /dev/null
+++ b/db/schema_migrations/20210716074555
@@ -0,0 +1 @@
+5cf415013b50c46fde5f12702c3f5bae808848a82eb57bfa38764947fc672ad9 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 64161ee7843..da2d4c50068 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -18,7 +18,7 @@ UPDATE projects SET has_external_issue_tracker = (
EXISTS
(
SELECT 1
- FROM services
+ FROM integrations
WHERE project_id = COALESCE(NEW.project_id, OLD.project_id)
AND active = TRUE
AND category = 'issue_tracker'
@@ -199,6 +199,18 @@ CREATE TABLE audit_events (
)
PARTITION BY RANGE (created_at);
+CREATE TABLE incident_management_pending_alert_escalations (
+ id bigint NOT NULL,
+ rule_id bigint,
+ alert_id bigint NOT NULL,
+ schedule_id bigint NOT NULL,
+ process_at timestamp with time zone NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ status smallint NOT NULL
+)
+PARTITION BY RANGE (process_at);
+
CREATE TABLE web_hook_logs (
id bigint NOT NULL,
web_hook_id integer NOT NULL,
@@ -9123,6 +9135,11 @@ CREATE TABLE analytics_devops_adoption_snapshots (
total_projects_count integer,
code_owners_used_count integer,
namespace_id integer,
+ sast_enabled_count integer,
+ dast_enabled_count integer,
+ dependency_scanning_enabled_count integer,
+ coverage_fuzzing_enabled_count integer,
+ vulnerability_management_used_count integer,
CONSTRAINT check_3f472de131 CHECK ((namespace_id IS NOT NULL))
);
@@ -9199,7 +9216,7 @@ ALTER SEQUENCE appearances_id_seq OWNED BY appearances.id;
CREATE TABLE application_setting_terms (
id integer NOT NULL,
cached_markdown_version integer,
- terms text NOT NULL,
+ terms text,
terms_html text
);
@@ -9528,6 +9545,11 @@ CREATE TABLE application_settings (
encrypted_elasticsearch_password_iv bytea,
diff_max_lines integer DEFAULT 50000 NOT NULL,
diff_max_files integer DEFAULT 1000 NOT NULL,
+ valid_runner_registrars character varying[] DEFAULT '{project,group}'::character varying[],
+ encrypted_mailgun_signing_key bytea,
+ encrypted_mailgun_signing_key_iv bytea,
+ mailgun_events_enabled boolean DEFAULT false NOT NULL,
+ usage_ping_features_enabled boolean DEFAULT false 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)),
@@ -10812,7 +10834,8 @@ CREATE TABLE ci_pending_builds (
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
+ protected boolean DEFAULT false NOT NULL,
+ instance_runners_enabled boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE ci_pending_builds_id_seq
@@ -11640,30 +11663,6 @@ CREATE SEQUENCE clusters_applications_elastic_stacks_id_seq
ALTER SEQUENCE clusters_applications_elastic_stacks_id_seq OWNED BY clusters_applications_elastic_stacks.id;
-CREATE TABLE clusters_applications_fluentd (
- id bigint NOT NULL,
- protocol smallint NOT NULL,
- status integer NOT NULL,
- port integer NOT NULL,
- cluster_id bigint NOT NULL,
- created_at timestamp with time zone NOT NULL,
- updated_at timestamp with time zone NOT NULL,
- version character varying(255) NOT NULL,
- host character varying(255) NOT NULL,
- status_reason text,
- waf_log_enabled boolean DEFAULT true NOT NULL,
- cilium_log_enabled boolean DEFAULT true NOT NULL
-);
-
-CREATE SEQUENCE clusters_applications_fluentd_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-ALTER SEQUENCE clusters_applications_fluentd_id_seq OWNED BY clusters_applications_fluentd.id;
-
CREATE TABLE clusters_applications_helm (
id integer NOT NULL,
cluster_id integer NOT NULL,
@@ -11697,9 +11696,7 @@ CREATE TABLE clusters_applications_ingress (
cluster_ip character varying,
status_reason text,
external_ip character varying,
- external_hostname character varying,
- modsecurity_enabled boolean,
- modsecurity_mode smallint DEFAULT 0 NOT NULL
+ external_hostname character varying
);
CREATE SEQUENCE clusters_applications_ingress_id_seq
@@ -12055,6 +12052,13 @@ CREATE TABLE dast_scanner_profiles (
CONSTRAINT check_568568fabf CHECK ((char_length(name) <= 255))
);
+CREATE TABLE dast_scanner_profiles_builds (
+ dast_scanner_profile_id bigint NOT NULL,
+ ci_build_id bigint NOT NULL
+);
+
+COMMENT ON TABLE dast_scanner_profiles_builds IS '{"owner":"group::dynamic analysis","description":"Join table between DAST Scanner Profiles and CI Builds"}';
+
CREATE SEQUENCE dast_scanner_profiles_id_seq
START WITH 1
INCREMENT BY 1
@@ -12110,6 +12114,13 @@ CREATE TABLE dast_site_profiles (
CONSTRAINT check_f22f18002a CHECK ((char_length(auth_username) <= 255))
);
+CREATE TABLE dast_site_profiles_builds (
+ dast_site_profile_id bigint NOT NULL,
+ ci_build_id bigint NOT NULL
+);
+
+COMMENT ON TABLE dast_site_profiles_builds IS '{"owner":"group::dynamic analysis","description":"Join table between DAST Site Profiles and CI Builds"}';
+
CREATE SEQUENCE dast_site_profiles_id_seq
START WITH 1
INCREMENT BY 1
@@ -12746,6 +12757,57 @@ CREATE SEQUENCE epics_id_seq
ALTER SEQUENCE epics_id_seq OWNED BY epics.id;
+CREATE TABLE error_tracking_error_events (
+ id bigint NOT NULL,
+ error_id bigint NOT NULL,
+ description text NOT NULL,
+ environment text,
+ level text,
+ occurred_at timestamp with time zone NOT NULL,
+ payload jsonb DEFAULT '{}'::jsonb NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ CONSTRAINT check_92ecc3077b CHECK ((char_length(description) <= 255)),
+ CONSTRAINT check_c67d5b8007 CHECK ((char_length(level) <= 255)),
+ CONSTRAINT check_f4b52474ad CHECK ((char_length(environment) <= 255))
+);
+
+CREATE SEQUENCE error_tracking_error_events_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE error_tracking_error_events_id_seq OWNED BY error_tracking_error_events.id;
+
+CREATE TABLE error_tracking_errors (
+ id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ name text NOT NULL,
+ description text NOT NULL,
+ actor text NOT NULL,
+ first_seen_at timestamp with time zone DEFAULT now() NOT NULL,
+ last_seen_at timestamp with time zone DEFAULT now() NOT NULL,
+ platform text,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ events_count bigint DEFAULT 0 NOT NULL,
+ CONSTRAINT check_18a758e537 CHECK ((char_length(name) <= 255)),
+ CONSTRAINT check_b5cb4d3888 CHECK ((char_length(actor) <= 255)),
+ CONSTRAINT check_c739788b12 CHECK ((char_length(description) <= 1024)),
+ CONSTRAINT check_fe99886883 CHECK ((char_length(platform) <= 255))
+);
+
+CREATE SEQUENCE error_tracking_errors_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE error_tracking_errors_id_seq OWNED BY error_tracking_errors.id;
+
CREATE TABLE events (
id integer NOT NULL,
project_id integer,
@@ -13906,6 +13968,15 @@ CREATE SEQUENCE incident_management_oncall_shifts_id_seq
ALTER SEQUENCE incident_management_oncall_shifts_id_seq OWNED BY incident_management_oncall_shifts.id;
+CREATE SEQUENCE incident_management_pending_alert_escalations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE incident_management_pending_alert_escalations_id_seq OWNED BY incident_management_pending_alert_escalations.id;
+
CREATE TABLE index_statuses (
id integer NOT NULL,
project_id integer NOT NULL,
@@ -13942,6 +14013,45 @@ CREATE SEQUENCE insights_id_seq
ALTER SEQUENCE insights_id_seq OWNED BY insights.id;
+CREATE TABLE integrations (
+ id integer NOT NULL,
+ type character varying,
+ project_id integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ active boolean DEFAULT false NOT NULL,
+ properties text,
+ push_events boolean DEFAULT true,
+ issues_events boolean DEFAULT true,
+ merge_requests_events boolean DEFAULT true,
+ tag_push_events boolean DEFAULT true,
+ note_events boolean DEFAULT true NOT NULL,
+ category character varying DEFAULT 'common'::character varying NOT NULL,
+ wiki_page_events boolean DEFAULT true,
+ pipeline_events boolean DEFAULT false NOT NULL,
+ confidential_issues_events boolean DEFAULT true NOT NULL,
+ commit_events boolean DEFAULT true NOT NULL,
+ job_events boolean DEFAULT false NOT NULL,
+ confidential_note_events boolean DEFAULT true,
+ deployment_events boolean DEFAULT false NOT NULL,
+ comment_on_event_enabled boolean DEFAULT true NOT NULL,
+ template boolean DEFAULT false,
+ instance boolean DEFAULT false NOT NULL,
+ comment_detail smallint,
+ inherit_from_id bigint,
+ alert_events boolean,
+ group_id bigint
+);
+
+CREATE SEQUENCE integrations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE integrations_id_seq OWNED BY integrations.id;
+
CREATE TABLE internal_ids (
id bigint NOT NULL,
project_id integer,
@@ -14160,6 +14270,7 @@ CREATE TABLE issues (
sprint_id bigint,
issue_type smallint DEFAULT 0 NOT NULL,
blocking_issues_count integer DEFAULT 0 NOT NULL,
+ upvotes_count integer DEFAULT 0 NOT NULL,
CONSTRAINT check_fba63f706d CHECK ((lock_version IS NOT NULL))
);
@@ -14478,7 +14589,8 @@ CREATE TABLE licenses (
data text NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
- cloud boolean DEFAULT false
+ cloud boolean DEFAULT false,
+ last_synced_at timestamp with time zone
);
CREATE SEQUENCE licenses_id_seq
@@ -14600,7 +14712,9 @@ CREATE TABLE merge_request_cleanup_schedules (
scheduled_at timestamp with time zone NOT NULL,
completed_at timestamp with time zone,
created_at timestamp with time zone NOT NULL,
- updated_at timestamp with time zone NOT NULL
+ updated_at timestamp with time zone NOT NULL,
+ status smallint DEFAULT 0 NOT NULL,
+ failed_count integer DEFAULT 0 NOT NULL
);
CREATE SEQUENCE merge_request_cleanup_schedules_merge_request_id_seq
@@ -14652,6 +14766,24 @@ CREATE SEQUENCE merge_request_context_commits_id_seq
ALTER SEQUENCE merge_request_context_commits_id_seq OWNED BY merge_request_context_commits.id;
+CREATE TABLE merge_request_diff_commit_users (
+ id bigint NOT NULL,
+ name text,
+ email text,
+ CONSTRAINT check_147358fc42 CHECK ((char_length(name) <= 512)),
+ CONSTRAINT check_f5fa206cf7 CHECK ((char_length(email) <= 512)),
+ CONSTRAINT merge_request_diff_commit_users_name_or_email_existence CHECK (((COALESCE(name, ''::text) <> ''::text) OR (COALESCE(email, ''::text) <> ''::text)))
+);
+
+CREATE SEQUENCE merge_request_diff_commit_users_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE merge_request_diff_commit_users_id_seq OWNED BY merge_request_diff_commit_users.id;
+
CREATE TABLE merge_request_diff_commits (
authored_date timestamp without time zone,
committed_date timestamp without time zone,
@@ -14663,7 +14795,9 @@ CREATE TABLE merge_request_diff_commits (
committer_name text,
committer_email text,
message text,
- trailers jsonb DEFAULT '{}'::jsonb NOT NULL
+ trailers jsonb DEFAULT '{}'::jsonb NOT NULL,
+ commit_author_id bigint,
+ committer_id bigint
);
CREATE TABLE merge_request_diff_details (
@@ -15034,6 +15168,7 @@ CREATE TABLE namespace_settings (
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,
+ new_user_signups_cap integer,
CONSTRAINT check_0ba93c78c7 CHECK ((char_length(default_branch_name) <= 255))
);
@@ -16292,7 +16427,10 @@ CREATE TABLE plan_limits (
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,
- ci_daily_pipeline_schedule_triggers integer DEFAULT 0 NOT NULL
+ ci_daily_pipeline_schedule_triggers integer DEFAULT 0 NOT NULL,
+ ci_max_artifact_size_running_container_scanning integer DEFAULT 0 NOT NULL,
+ ci_max_artifact_size_cluster_image_scanning integer DEFAULT 0 NOT NULL,
+ ci_jobs_trace_size_limit integer DEFAULT 100 NOT NULL
);
CREATE SEQUENCE plan_limits_id_seq
@@ -16451,23 +16589,25 @@ END AS attrelname
ORDER BY relation_stats.nspname, relation_stats.tblname, relation_stats.idxname;
CREATE VIEW postgres_indexes AS
- SELECT (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text) AS identifier,
+ SELECT (((pg_namespace.nspname)::text || '.'::text) || (i.relname)::text) AS identifier,
pg_index.indexrelid,
pg_namespace.nspname AS schema,
- pg_class.relname AS name,
+ i.relname AS name,
pg_indexes.tablename,
+ a.amname AS type,
pg_index.indisunique AS "unique",
pg_index.indisvalid AS valid_index,
- pg_class.relispartition AS partitioned,
+ i.relispartition AS partitioned,
pg_index.indisexclusion AS exclusion,
(pg_index.indexprs IS NOT NULL) AS expression,
(pg_index.indpred IS NOT NULL) AS partial,
pg_indexes.indexdef AS definition,
- pg_relation_size((pg_class.oid)::regclass) AS ondisk_size_bytes
- FROM (((pg_index
- JOIN pg_class ON ((pg_class.oid = pg_index.indexrelid)))
- JOIN pg_namespace ON ((pg_class.relnamespace = pg_namespace.oid)))
- JOIN pg_indexes ON ((pg_class.relname = pg_indexes.indexname)))
+ pg_relation_size((i.oid)::regclass) AS ondisk_size_bytes
+ FROM ((((pg_index
+ JOIN pg_class i ON ((i.oid = pg_index.indexrelid)))
+ JOIN pg_namespace ON ((i.relnamespace = pg_namespace.oid)))
+ JOIN pg_indexes ON ((i.relname = pg_indexes.indexname)))
+ JOIN pg_am a ON ((i.relam = a.oid)))
WHERE ((pg_namespace.nspname <> 'pg_catalog'::name) AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])));
CREATE VIEW postgres_partitioned_tables AS
@@ -16626,7 +16766,6 @@ ALTER SEQUENCE project_ci_cd_settings_id_seq OWNED BY project_ci_cd_settings.id;
CREATE TABLE project_compliance_framework_settings (
project_id bigint NOT NULL,
- framework smallint,
framework_id bigint,
CONSTRAINT check_d348de9e2d CHECK ((framework_id IS NOT NULL))
);
@@ -16946,6 +17085,8 @@ CREATE TABLE project_settings (
prevent_merge_without_jira_issue boolean DEFAULT false NOT NULL,
cve_id_request_enabled boolean DEFAULT true NOT NULL,
mr_default_target_self boolean DEFAULT false NOT NULL,
+ previous_default_branch text,
+ CONSTRAINT check_3a03e7557a CHECK ((char_length(previous_default_branch) <= 4096)),
CONSTRAINT check_bde223416c CHECK ((show_default_award_emojis IS NOT NULL))
);
@@ -17493,6 +17634,7 @@ CREATE TABLE requirements (
title_html text,
description text,
description_html text,
+ issue_id bigint,
CONSTRAINT check_785ae25b9d CHECK ((char_length(description) <= 10000))
);
@@ -17707,7 +17849,8 @@ CREATE SEQUENCE saml_providers_id_seq
ALTER SEQUENCE saml_providers_id_seq OWNED BY saml_providers.id;
CREATE TABLE schema_migrations (
- version character varying NOT NULL
+ version character varying NOT NULL,
+ finished_at timestamp with time zone DEFAULT now()
);
CREATE TABLE scim_identities (
@@ -17907,45 +18050,6 @@ CREATE TABLE service_desk_settings (
project_key character varying(255)
);
-CREATE TABLE services (
- id integer NOT NULL,
- type character varying,
- project_id integer,
- created_at timestamp without time zone,
- updated_at timestamp without time zone,
- active boolean DEFAULT false NOT NULL,
- properties text,
- push_events boolean DEFAULT true,
- issues_events boolean DEFAULT true,
- merge_requests_events boolean DEFAULT true,
- tag_push_events boolean DEFAULT true,
- note_events boolean DEFAULT true NOT NULL,
- category character varying DEFAULT 'common'::character varying NOT NULL,
- wiki_page_events boolean DEFAULT true,
- pipeline_events boolean DEFAULT false NOT NULL,
- confidential_issues_events boolean DEFAULT true NOT NULL,
- commit_events boolean DEFAULT true NOT NULL,
- job_events boolean DEFAULT false NOT NULL,
- confidential_note_events boolean DEFAULT true,
- deployment_events boolean DEFAULT false NOT NULL,
- comment_on_event_enabled boolean DEFAULT true NOT NULL,
- template boolean DEFAULT false,
- instance boolean DEFAULT false NOT NULL,
- comment_detail smallint,
- inherit_from_id bigint,
- alert_events boolean,
- group_id bigint
-);
-
-CREATE SEQUENCE services_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-ALTER SEQUENCE services_id_seq OWNED BY services.id;
-
CREATE TABLE shards (
id integer NOT NULL,
name character varying NOT NULL
@@ -18409,7 +18513,9 @@ CREATE TABLE timelogs (
merge_request_id integer,
spent_at timestamp without time zone,
note_id integer,
- project_id integer
+ project_id integer,
+ summary text,
+ CONSTRAINT check_271d321699 CHECK ((char_length(summary) <= 255))
);
CREATE SEQUENCE timelogs_id_seq
@@ -18939,7 +19045,9 @@ CREATE TABLE vulnerabilities (
confirmed_at timestamp with time zone,
dismissed_at timestamp with time zone,
dismissed_by_id bigint,
- resolved_on_default_branch boolean DEFAULT false NOT NULL
+ resolved_on_default_branch boolean DEFAULT false NOT NULL,
+ present_on_default_branch boolean DEFAULT true NOT NULL,
+ detected_at timestamp with time zone DEFAULT now()
);
CREATE SEQUENCE vulnerabilities_id_seq
@@ -19026,6 +19134,28 @@ CREATE SEQUENCE vulnerability_feedback_id_seq
ALTER SEQUENCE vulnerability_feedback_id_seq OWNED BY vulnerability_feedback.id;
+CREATE TABLE vulnerability_finding_evidence_assets (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ vulnerability_finding_evidence_id bigint NOT NULL,
+ type text,
+ name text,
+ url text,
+ CONSTRAINT check_5adf5d69de CHECK ((char_length(type) <= 2048)),
+ CONSTRAINT check_839f29d7ca CHECK ((char_length(name) <= 2048)),
+ CONSTRAINT check_9272d912c0 CHECK ((char_length(url) <= 2048))
+);
+
+CREATE SEQUENCE vulnerability_finding_evidence_assets_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE vulnerability_finding_evidence_assets_id_seq OWNED BY vulnerability_finding_evidence_assets.id;
+
CREATE TABLE vulnerability_finding_evidence_headers (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -19090,6 +19220,44 @@ CREATE SEQUENCE vulnerability_finding_evidence_responses_id_seq
ALTER SEQUENCE vulnerability_finding_evidence_responses_id_seq OWNED BY vulnerability_finding_evidence_responses.id;
+CREATE TABLE vulnerability_finding_evidence_sources (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ vulnerability_finding_evidence_id bigint NOT NULL,
+ name text,
+ url text,
+ CONSTRAINT check_0fe01298d6 CHECK ((char_length(url) <= 2048)),
+ CONSTRAINT check_86b537ba1a CHECK ((char_length(name) <= 2048))
+);
+
+CREATE SEQUENCE vulnerability_finding_evidence_sources_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE vulnerability_finding_evidence_sources_id_seq OWNED BY vulnerability_finding_evidence_sources.id;
+
+CREATE TABLE vulnerability_finding_evidence_supporting_messages (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ vulnerability_finding_evidence_id bigint NOT NULL,
+ name text,
+ CONSTRAINT check_fa33b9ae85 CHECK ((char_length(name) <= 2048))
+);
+
+CREATE SEQUENCE vulnerability_finding_evidence_supporting_messages_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE vulnerability_finding_evidence_supporting_messages_id_seq OWNED BY vulnerability_finding_evidence_supporting_messages.id;
+
CREATE TABLE vulnerability_finding_evidences (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -19163,6 +19331,27 @@ CREATE SEQUENCE vulnerability_findings_remediations_id_seq
ALTER SEQUENCE vulnerability_findings_remediations_id_seq OWNED BY vulnerability_findings_remediations.id;
+CREATE TABLE vulnerability_flags (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ vulnerability_occurrence_id bigint NOT NULL,
+ flag_type smallint DEFAULT 0 NOT NULL,
+ origin text NOT NULL,
+ description text NOT NULL,
+ CONSTRAINT check_45e743349f CHECK ((char_length(description) <= 1024)),
+ CONSTRAINT check_49c1d00032 CHECK ((char_length(origin) <= 255))
+);
+
+CREATE SEQUENCE vulnerability_flags_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE vulnerability_flags_id_seq OWNED BY vulnerability_flags.id;
+
CREATE TABLE vulnerability_historical_statistics (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -19808,8 +19997,6 @@ ALTER TABLE ONLY clusters_applications_crossplane ALTER COLUMN id SET DEFAULT ne
ALTER TABLE ONLY clusters_applications_elastic_stacks ALTER COLUMN id SET DEFAULT nextval('clusters_applications_elastic_stacks_id_seq'::regclass);
-ALTER TABLE ONLY clusters_applications_fluentd ALTER COLUMN id SET DEFAULT nextval('clusters_applications_fluentd_id_seq'::regclass);
-
ALTER TABLE ONLY clusters_applications_helm ALTER COLUMN id SET DEFAULT nextval('clusters_applications_helm_id_seq'::regclass);
ALTER TABLE ONLY clusters_applications_ingress ALTER COLUMN id SET DEFAULT nextval('clusters_applications_ingress_id_seq'::regclass);
@@ -19898,6 +20085,10 @@ ALTER TABLE ONLY epic_user_mentions ALTER COLUMN id SET DEFAULT nextval('epic_us
ALTER TABLE ONLY epics ALTER COLUMN id SET DEFAULT nextval('epics_id_seq'::regclass);
+ALTER TABLE ONLY error_tracking_error_events ALTER COLUMN id SET DEFAULT nextval('error_tracking_error_events_id_seq'::regclass);
+
+ALTER TABLE ONLY error_tracking_errors ALTER COLUMN id SET DEFAULT nextval('error_tracking_errors_id_seq'::regclass);
+
ALTER TABLE ONLY events ALTER COLUMN id SET DEFAULT nextval('events_id_seq'::regclass);
ALTER TABLE ONLY evidences ALTER COLUMN id SET DEFAULT nextval('evidences_id_seq'::regclass);
@@ -20010,10 +20201,14 @@ ALTER TABLE ONLY incident_management_oncall_schedules ALTER COLUMN id SET DEFAUL
ALTER TABLE ONLY incident_management_oncall_shifts ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_shifts_id_seq'::regclass);
+ALTER TABLE ONLY incident_management_pending_alert_escalations ALTER COLUMN id SET DEFAULT nextval('incident_management_pending_alert_escalations_id_seq'::regclass);
+
ALTER TABLE ONLY index_statuses ALTER COLUMN id SET DEFAULT nextval('index_statuses_id_seq'::regclass);
ALTER TABLE ONLY insights ALTER COLUMN id SET DEFAULT nextval('insights_id_seq'::regclass);
+ALTER TABLE ONLY integrations ALTER COLUMN id SET DEFAULT nextval('integrations_id_seq'::regclass);
+
ALTER TABLE ONLY internal_ids ALTER COLUMN id SET DEFAULT nextval('internal_ids_id_seq'::regclass);
ALTER TABLE ONLY ip_restrictions ALTER COLUMN id SET DEFAULT nextval('ip_restrictions_id_seq'::regclass);
@@ -20078,6 +20273,8 @@ ALTER TABLE ONLY merge_request_cleanup_schedules ALTER COLUMN merge_request_id S
ALTER TABLE ONLY merge_request_context_commits ALTER COLUMN id SET DEFAULT nextval('merge_request_context_commits_id_seq'::regclass);
+ALTER TABLE ONLY merge_request_diff_commit_users ALTER COLUMN id SET DEFAULT nextval('merge_request_diff_commit_users_id_seq'::regclass);
+
ALTER TABLE ONLY merge_request_diff_details ALTER COLUMN merge_request_diff_id SET DEFAULT nextval('merge_request_diff_details_merge_request_diff_id_seq'::regclass);
ALTER TABLE ONLY merge_request_diffs ALTER COLUMN id SET DEFAULT nextval('merge_request_diffs_id_seq'::regclass);
@@ -20326,8 +20523,6 @@ ALTER TABLE ONLY sent_notifications ALTER COLUMN id SET DEFAULT nextval('sent_no
ALTER TABLE ONLY sentry_issues ALTER COLUMN id SET DEFAULT nextval('sentry_issues_id_seq'::regclass);
-ALTER TABLE ONLY services ALTER COLUMN id SET DEFAULT nextval('services_id_seq'::regclass);
-
ALTER TABLE ONLY shards ALTER COLUMN id SET DEFAULT nextval('shards_id_seq'::regclass);
ALTER TABLE ONLY slack_integrations ALTER COLUMN id SET DEFAULT nextval('slack_integrations_id_seq'::regclass);
@@ -20418,12 +20613,18 @@ 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_assets ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_evidence_assets_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);
+ALTER TABLE ONLY vulnerability_finding_evidence_sources ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_evidence_sources_id_seq'::regclass);
+
+ALTER TABLE ONLY vulnerability_finding_evidence_supporting_messages ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_evidence_supporting_messages_id_seq'::regclass);
+
ALTER TABLE ONLY vulnerability_finding_evidences ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_evidences_id_seq'::regclass);
ALTER TABLE ONLY vulnerability_finding_links ALTER COLUMN id SET DEFAULT nextval('vulnerability_finding_links_id_seq'::regclass);
@@ -20432,6 +20633,8 @@ ALTER TABLE ONLY vulnerability_finding_signatures ALTER COLUMN id SET DEFAULT ne
ALTER TABLE ONLY vulnerability_findings_remediations ALTER COLUMN id SET DEFAULT nextval('vulnerability_findings_remediations_id_seq'::regclass);
+ALTER TABLE ONLY vulnerability_flags ALTER COLUMN id SET DEFAULT nextval('vulnerability_flags_id_seq'::regclass);
+
ALTER TABLE ONLY vulnerability_historical_statistics ALTER COLUMN id SET DEFAULT nextval('vulnerability_historical_statistics_id_seq'::regclass);
ALTER TABLE ONLY vulnerability_identifiers ALTER COLUMN id SET DEFAULT nextval('vulnerability_identifiers_id_seq'::regclass);
@@ -21040,9 +21243,6 @@ ALTER TABLE ONLY clusters_applications_crossplane
ALTER TABLE ONLY clusters_applications_elastic_stacks
ADD CONSTRAINT clusters_applications_elastic_stacks_pkey PRIMARY KEY (id);
-ALTER TABLE ONLY clusters_applications_fluentd
- ADD CONSTRAINT clusters_applications_fluentd_pkey PRIMARY KEY (id);
-
ALTER TABLE ONLY clusters_applications_helm
ADD CONSTRAINT clusters_applications_helm_pkey PRIMARY KEY (id);
@@ -21100,12 +21300,18 @@ ALTER TABLE ONLY dast_profiles_pipelines
ALTER TABLE ONLY dast_profiles
ADD CONSTRAINT dast_profiles_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY dast_scanner_profiles_builds
+ ADD CONSTRAINT dast_scanner_profiles_builds_pkey PRIMARY KEY (dast_scanner_profile_id, ci_build_id);
+
ALTER TABLE ONLY dast_scanner_profiles
ADD CONSTRAINT dast_scanner_profiles_pkey PRIMARY KEY (id);
ALTER TABLE ONLY dast_site_profile_secret_variables
ADD CONSTRAINT dast_site_profile_secret_variables_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY dast_site_profiles_builds
+ ADD CONSTRAINT dast_site_profiles_builds_pkey PRIMARY KEY (dast_site_profile_id, ci_build_id);
+
ALTER TABLE ONLY dast_site_profiles_pipelines
ADD CONSTRAINT dast_site_profiles_pipelines_pkey PRIMARY KEY (dast_site_profile_id, ci_pipeline_id);
@@ -21205,6 +21411,12 @@ ALTER TABLE ONLY epic_user_mentions
ALTER TABLE ONLY epics
ADD CONSTRAINT epics_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY error_tracking_error_events
+ ADD CONSTRAINT error_tracking_error_events_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY error_tracking_errors
+ ADD CONSTRAINT error_tracking_errors_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY events
ADD CONSTRAINT events_pkey PRIMARY KEY (id);
@@ -21385,12 +21597,18 @@ ALTER TABLE ONLY incident_management_oncall_schedules
ALTER TABLE ONLY incident_management_oncall_shifts
ADD CONSTRAINT incident_management_oncall_shifts_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY incident_management_pending_alert_escalations
+ ADD CONSTRAINT incident_management_pending_alert_escalations_pkey PRIMARY KEY (id, process_at);
+
ALTER TABLE ONLY index_statuses
ADD CONSTRAINT index_statuses_pkey PRIMARY KEY (id);
ALTER TABLE ONLY insights
ADD CONSTRAINT insights_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY integrations
+ ADD CONSTRAINT integrations_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY internal_ids
ADD CONSTRAINT internal_ids_pkey PRIMARY KEY (id);
@@ -21505,6 +21723,9 @@ ALTER TABLE ONLY merge_request_context_commit_diff_files
ALTER TABLE ONLY merge_request_context_commits
ADD CONSTRAINT merge_request_context_commits_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY merge_request_diff_commit_users
+ ADD CONSTRAINT merge_request_diff_commit_users_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY merge_request_diff_commits
ADD CONSTRAINT merge_request_diff_commits_pkey PRIMARY KEY (merge_request_diff_id, relative_order);
@@ -21958,9 +22179,6 @@ ALTER TABLE ONLY serverless_domain_cluster
ALTER TABLE ONLY service_desk_settings
ADD CONSTRAINT service_desk_settings_pkey PRIMARY KEY (project_id);
-ALTER TABLE ONLY services
- ADD CONSTRAINT services_pkey PRIMARY KEY (id);
-
ALTER TABLE ONLY shards
ADD CONSTRAINT shards_pkey PRIMARY KEY (id);
@@ -22117,6 +22335,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_assets
+ ADD CONSTRAINT vulnerability_finding_evidence_assets_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY vulnerability_finding_evidence_headers
ADD CONSTRAINT vulnerability_finding_evidence_headers_pkey PRIMARY KEY (id);
@@ -22126,6 +22347,12 @@ ALTER TABLE ONLY vulnerability_finding_evidence_requests
ALTER TABLE ONLY vulnerability_finding_evidence_responses
ADD CONSTRAINT vulnerability_finding_evidence_responses_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY vulnerability_finding_evidence_sources
+ ADD CONSTRAINT vulnerability_finding_evidence_sources_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY vulnerability_finding_evidence_supporting_messages
+ ADD CONSTRAINT vulnerability_finding_evidence_supporting_messages_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY vulnerability_finding_evidences
ADD CONSTRAINT vulnerability_finding_evidences_pkey PRIMARY KEY (id);
@@ -22138,6 +22365,9 @@ ALTER TABLE ONLY vulnerability_finding_signatures
ALTER TABLE ONLY vulnerability_findings_remediations
ADD CONSTRAINT vulnerability_findings_remediations_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY vulnerability_flags
+ ADD CONSTRAINT vulnerability_flags_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY vulnerability_historical_statistics
ADD CONSTRAINT vulnerability_historical_statistics_pkey PRIMARY KEY (id);
@@ -22351,6 +22581,10 @@ CREATE INDEX commit_id_and_note_id_index ON commit_user_mentions USING btree (co
CREATE INDEX composer_cache_files_index_on_deleted_at ON packages_composer_cache_files USING btree (delete_at, id);
+CREATE UNIQUE INDEX dast_scanner_profiles_builds_on_ci_build_id ON dast_scanner_profiles_builds USING btree (ci_build_id);
+
+CREATE UNIQUE INDEX dast_site_profiles_builds_on_ci_build_id ON dast_site_profiles_builds USING btree (ci_build_id);
+
CREATE UNIQUE INDEX design_management_designs_versions_uniqueness ON design_management_designs_versions USING btree (design_id, version_id);
CREATE INDEX design_user_mentions_on_design_id_and_note_id_index ON design_user_mentions USING btree (design_id, note_id);
@@ -22359,6 +22593,8 @@ 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_assets_on_finding_evidence_id ON vulnerability_finding_evidence_assets USING btree (vulnerability_finding_evidence_id);
+
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);
@@ -22367,6 +22603,10 @@ CREATE INDEX finding_evidence_requests_on_finding_evidence_id ON vulnerability_f
CREATE INDEX finding_evidence_responses_on_finding_evidences_id ON vulnerability_finding_evidence_responses USING btree (vulnerability_finding_evidence_id);
+CREATE INDEX finding_evidence_sources_on_finding_evidence_id ON vulnerability_finding_evidence_sources USING btree (vulnerability_finding_evidence_id);
+
+CREATE INDEX finding_evidence_supporting_messages_on_finding_evidence_id ON vulnerability_finding_evidence_supporting_messages USING btree (vulnerability_finding_evidence_id);
+
CREATE INDEX finding_evidences_on_vulnerability_occurrence_id ON vulnerability_finding_evidences USING btree (vulnerability_occurrence_id);
CREATE INDEX finding_links_on_vulnerability_occurrence_id ON vulnerability_finding_links USING btree (vulnerability_occurrence_id);
@@ -22375,6 +22615,8 @@ CREATE UNIQUE INDEX i_ci_job_token_project_scope_links_on_source_and_target_proj
CREATE INDEX idx_analytics_devops_adoption_segments_on_namespace_id ON analytics_devops_adoption_segments USING btree (namespace_id);
+CREATE INDEX idx_analytics_devops_adoption_snapshots_finalized ON analytics_devops_adoption_snapshots USING btree (namespace_id, end_time) WHERE (recorded_at >= end_time);
+
CREATE INDEX idx_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);
@@ -22385,7 +22627,7 @@ CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at ON container_e
CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at_enabled ON container_expiration_policies USING btree (project_id, next_run_at, enabled);
-CREATE INDEX idx_container_repositories_on_exp_cleanup_status_and_start_date ON container_repositories USING btree (expiration_policy_cleanup_status, expiration_policy_started_at);
+CREATE INDEX idx_container_repos_on_exp_cleanup_status_project_id_start_date ON container_repositories USING btree (expiration_policy_cleanup_status, project_id, expiration_policy_started_at);
CREATE INDEX idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace ON deployment_clusters USING btree (cluster_id, kubernetes_namespace);
@@ -22503,6 +22745,8 @@ CREATE UNIQUE INDEX idx_vuln_signatures_on_occurrences_id_and_signature_sha ON v
CREATE UNIQUE INDEX idx_vuln_signatures_uniqueness_signature_sha ON vulnerability_finding_signatures USING btree (finding_id, algorithm_type, signature_sha);
+CREATE INDEX idx_vulnerabilities_partial_devops_adoption ON vulnerabilities USING btree (project_id, created_at) WHERE (state <> 1);
+
CREATE UNIQUE INDEX idx_vulnerability_ext_issue_links_on_vulne_id_and_ext_issue ON vulnerability_external_issue_links USING btree (vulnerability_id, external_type, external_project_key, external_issue_key);
CREATE UNIQUE INDEX idx_vulnerability_ext_issue_links_on_vulne_id_and_link_type ON vulnerability_external_issue_links USING btree (vulnerability_id, link_type) WHERE (link_type = 1);
@@ -22737,7 +22981,7 @@ CREATE INDEX index_broadcast_message_on_ends_at_and_broadcast_type_and_id ON bro
CREATE INDEX index_bulk_import_configurations_on_bulk_import_id ON bulk_import_configurations USING btree (bulk_import_id);
-CREATE INDEX index_bulk_import_entities_on_bulk_import_id ON bulk_import_entities USING btree (bulk_import_id);
+CREATE INDEX index_bulk_import_entities_on_bulk_import_id_and_status ON bulk_import_entities USING btree (bulk_import_id, status);
CREATE INDEX index_bulk_import_entities_on_namespace_id ON bulk_import_entities USING btree (namespace_id);
@@ -22799,8 +23043,6 @@ CREATE INDEX index_ci_builds_on_project_id_and_name_and_ref ON ci_builds USING b
CREATE INDEX index_ci_builds_on_project_id_for_successfull_pages_deploy ON ci_builds USING btree (project_id) WHERE (((type)::text = 'GenericCommitStatus'::text) AND ((stage)::text = 'deploy'::text) AND ((name)::text = 'pages:deploy'::text) AND ((status)::text = 'success'::text));
-CREATE INDEX index_ci_builds_on_protected ON ci_builds USING btree (protected);
-
CREATE INDEX index_ci_builds_on_queued_at ON ci_builds USING btree (queued_at);
CREATE INDEX index_ci_builds_on_runner_id_and_id_desc ON ci_builds USING btree (runner_id, id DESC);
@@ -22809,10 +23051,10 @@ CREATE INDEX index_ci_builds_on_stage_id ON ci_builds USING btree (stage_id);
CREATE INDEX index_ci_builds_on_status_and_type_and_runner_id ON ci_builds USING btree (status, type, runner_id);
-CREATE UNIQUE INDEX index_ci_builds_on_token ON ci_builds USING btree (token);
-
CREATE UNIQUE INDEX index_ci_builds_on_token_encrypted ON ci_builds USING btree (token_encrypted) WHERE (token_encrypted IS NOT NULL);
+CREATE UNIQUE INDEX index_ci_builds_on_token_partial ON ci_builds USING btree (token) WHERE (token IS NOT NULL);
+
CREATE INDEX index_ci_builds_on_updated_at ON ci_builds USING btree (updated_at);
CREATE INDEX index_ci_builds_on_upstream_pipeline_id ON ci_builds USING btree (upstream_pipeline_id) WHERE (upstream_pipeline_id IS NOT NULL);
@@ -22843,6 +23085,8 @@ CREATE UNIQUE INDEX index_ci_group_variables_on_group_id_and_key_and_environment
CREATE UNIQUE INDEX index_ci_instance_variables_on_key ON ci_instance_variables USING btree (key);
+CREATE INDEX index_ci_job_artifacts_dast_for_devops_adoption ON ci_job_artifacts USING btree (project_id, created_at) WHERE (file_type = 8);
+
CREATE INDEX index_ci_job_artifacts_for_terraform_reports ON ci_job_artifacts USING btree (project_id, id) WHERE (file_type = 18);
CREATE INDEX index_ci_job_artifacts_id_for_terraform_reports ON ci_job_artifacts USING btree (id) WHERE (file_type = 18);
@@ -22851,12 +23095,16 @@ CREATE INDEX index_ci_job_artifacts_on_expire_at_and_job_id ON ci_job_artifacts
CREATE INDEX index_ci_job_artifacts_on_file_store ON ci_job_artifacts USING btree (file_store);
+CREATE INDEX index_ci_job_artifacts_on_file_type_for_devops_adoption ON ci_job_artifacts USING btree (file_type, project_id, created_at) WHERE (file_type = ANY (ARRAY[5, 6, 8, 23]));
+
CREATE UNIQUE INDEX index_ci_job_artifacts_on_job_id_and_file_type ON ci_job_artifacts USING btree (job_id, file_type);
CREATE INDEX index_ci_job_artifacts_on_project_id ON ci_job_artifacts USING btree (project_id);
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_artifacts_sast_for_devops_adoption ON ci_job_artifacts USING btree (project_id, created_at) WHERE (file_type = 5);
+
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);
@@ -23077,14 +23325,10 @@ CREATE UNIQUE INDEX index_clusters_applications_crossplane_on_cluster_id ON clus
CREATE UNIQUE INDEX index_clusters_applications_elastic_stacks_on_cluster_id ON clusters_applications_elastic_stacks USING btree (cluster_id);
-CREATE UNIQUE INDEX index_clusters_applications_fluentd_on_cluster_id ON clusters_applications_fluentd USING btree (cluster_id);
-
CREATE UNIQUE INDEX index_clusters_applications_helm_on_cluster_id ON clusters_applications_helm USING btree (cluster_id);
CREATE UNIQUE INDEX index_clusters_applications_ingress_on_cluster_id ON clusters_applications_ingress USING btree (cluster_id);
-CREATE INDEX index_clusters_applications_ingress_on_modsecurity ON clusters_applications_ingress USING btree (modsecurity_enabled, modsecurity_mode, cluster_id);
-
CREATE UNIQUE INDEX index_clusters_applications_jupyter_on_cluster_id ON clusters_applications_jupyter USING btree (cluster_id);
CREATE INDEX index_clusters_applications_jupyter_on_oauth_application_id ON clusters_applications_jupyter USING btree (oauth_application_id);
@@ -23115,6 +23359,8 @@ CREATE INDEX index_clusters_on_user_id ON clusters USING btree (user_id);
CREATE UNIQUE INDEX index_commit_user_mentions_on_note_id ON commit_user_mentions USING btree (note_id);
+CREATE INDEX index_compliance_frameworks_id_where_frameworks_not_null ON compliance_management_frameworks USING btree (id) WHERE (pipeline_configuration_full_path IS NOT NULL);
+
CREATE INDEX index_composer_cache_files_where_namespace_id_is_null ON packages_composer_cache_files USING btree (id) WHERE (namespace_id IS NULL);
CREATE INDEX index_container_expiration_policies_on_next_run_at_and_enabled ON container_expiration_policies USING btree (next_run_at, enabled);
@@ -23343,6 +23589,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_error_tracking_error_events_on_error_id ON error_tracking_error_events USING btree (error_id);
+
+CREATE INDEX index_error_tracking_errors_on_project_id ON error_tracking_errors USING btree (project_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);
@@ -23587,12 +23837,36 @@ CREATE INDEX index_incident_management_oncall_schedules_on_project_id ON inciden
CREATE INDEX index_incident_management_oncall_shifts_on_participant_id ON incident_management_oncall_shifts USING btree (participant_id);
+CREATE INDEX index_incident_management_pending_alert_escalations_on_alert_id ON ONLY incident_management_pending_alert_escalations USING btree (alert_id);
+
+CREATE INDEX index_incident_management_pending_alert_escalations_on_rule_id ON ONLY incident_management_pending_alert_escalations USING btree (rule_id);
+
+CREATE INDEX index_incident_management_pending_alert_escalations_on_schedule ON ONLY incident_management_pending_alert_escalations USING btree (schedule_id);
+
CREATE UNIQUE INDEX index_index_statuses_on_project_id ON index_statuses USING btree (project_id);
CREATE INDEX index_insights_on_namespace_id ON insights USING btree (namespace_id);
CREATE INDEX index_insights_on_project_id ON insights USING btree (project_id);
+CREATE INDEX index_integrations_on_inherit_from_id ON integrations USING btree (inherit_from_id);
+
+CREATE INDEX index_integrations_on_project_and_type_where_inherit_null ON integrations USING btree (project_id, type) WHERE (inherit_from_id IS NULL);
+
+CREATE UNIQUE INDEX index_integrations_on_project_id_and_type_unique ON integrations USING btree (project_id, type);
+
+CREATE INDEX index_integrations_on_template ON integrations USING btree (template);
+
+CREATE INDEX index_integrations_on_type ON integrations USING btree (type);
+
+CREATE UNIQUE INDEX index_integrations_on_type_and_instance_partial ON integrations USING btree (type, instance) WHERE (instance = true);
+
+CREATE UNIQUE INDEX index_integrations_on_type_and_template_partial ON integrations USING btree (type, template) WHERE (template = true);
+
+CREATE INDEX index_integrations_on_type_id_when_active_and_project_id_not_nu ON integrations USING btree (type, id) WHERE ((active = true) AND (project_id IS NOT NULL));
+
+CREATE UNIQUE INDEX index_integrations_on_unique_group_id_and_type ON integrations USING btree (group_id, type);
+
CREATE INDEX index_internal_ids_on_namespace_id ON internal_ids USING btree (namespace_id);
CREATE INDEX index_internal_ids_on_project_id ON internal_ids USING btree (project_id);
@@ -23655,6 +23929,8 @@ CREATE UNIQUE INDEX index_issues_on_project_id_and_external_key ON issues USING
CREATE UNIQUE INDEX index_issues_on_project_id_and_iid ON issues USING btree (project_id, iid);
+CREATE INDEX index_issues_on_project_id_and_upvotes_count ON issues USING btree (project_id, upvotes_count);
+
CREATE INDEX index_issues_on_promoted_to_epic_id ON issues USING btree (promoted_to_epic_id) WHERE (promoted_to_epic_id IS NOT NULL);
CREATE INDEX index_issues_on_sprint_id ON issues USING btree (sprint_id);
@@ -23777,6 +24053,10 @@ CREATE INDEX index_merge_request_blocks_on_blocked_merge_request_id ON merge_req
CREATE UNIQUE INDEX index_merge_request_cleanup_schedules_on_merge_request_id ON merge_request_cleanup_schedules USING btree (merge_request_id);
+CREATE INDEX index_merge_request_cleanup_schedules_on_status ON merge_request_cleanup_schedules USING btree (status);
+
+CREATE UNIQUE INDEX index_merge_request_diff_commit_users_on_name_and_email ON merge_request_diff_commit_users USING btree (name, email);
+
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);
@@ -23887,6 +24167,8 @@ CREATE INDEX index_metrics_users_starred_dashboards_on_project_id ON metrics_use
CREATE INDEX index_migration_jobs_on_migration_id_and_finished_at ON batched_background_migration_jobs USING btree (batched_background_migration_id, finished_at);
+CREATE INDEX index_migration_jobs_on_migration_id_and_max_value ON batched_background_migration_jobs USING btree (batched_background_migration_id, max_value);
+
CREATE INDEX index_milestone_releases_on_release_id ON milestone_releases USING btree (release_id);
CREATE INDEX index_milestones_on_description_trigram ON milestones USING gin (description gin_trgm_ops);
@@ -23905,7 +24187,7 @@ CREATE INDEX index_mirror_data_non_scheduled_or_started ON project_mirror_data U
CREATE UNIQUE INDEX index_mr_blocks_on_blocking_and_blocked_mr_ids ON merge_request_blocks USING btree (blocking_merge_request_id, blocked_merge_request_id);
-CREATE INDEX index_mr_cleanup_schedules_timestamps ON merge_request_cleanup_schedules USING btree (scheduled_at) WHERE (completed_at IS NULL);
+CREATE INDEX index_mr_cleanup_schedules_timestamps_status ON merge_request_cleanup_schedules USING btree (scheduled_at) WHERE ((completed_at IS NULL) AND (status = 0));
CREATE UNIQUE INDEX index_mr_context_commits_on_merge_request_id_and_sha ON merge_request_context_commits USING btree (merge_request_id, sha);
@@ -24011,8 +24293,6 @@ CREATE INDEX index_oauth_openid_requests_on_access_grant_id ON oauth_openid_requ
CREATE UNIQUE INDEX index_on_deploy_keys_id_and_type_and_public ON keys USING btree (id, type) WHERE (public = true);
-CREATE INDEX index_on_id_partial_with_legacy_storage ON projects USING btree (id) WHERE ((storage_version < 2) OR (storage_version IS NULL));
-
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_usage_trends_measurements USING btree (identifier, recorded_at);
@@ -24231,7 +24511,7 @@ CREATE UNIQUE INDEX index_project_aliases_on_name ON project_aliases USING btree
CREATE INDEX index_project_aliases_on_project_id ON project_aliases USING btree (project_id);
-CREATE INDEX index_project_authorizations_on_project_id ON project_authorizations USING btree (project_id);
+CREATE INDEX index_project_authorizations_on_project_id_user_id ON project_authorizations USING btree (project_id, user_id);
CREATE UNIQUE INDEX index_project_auto_devops_on_project_id ON project_auto_devops USING btree (project_id);
@@ -24511,6 +24791,8 @@ CREATE INDEX index_requirements_on_author_id ON requirements USING btree (author
CREATE INDEX index_requirements_on_created_at ON requirements USING btree (created_at);
+CREATE UNIQUE INDEX index_requirements_on_issue_id ON requirements USING btree (issue_id);
+
CREATE INDEX index_requirements_on_project_id ON requirements USING btree (project_id);
CREATE UNIQUE INDEX index_requirements_on_project_id_and_iid ON requirements USING btree (project_id, iid) WHERE (project_id IS NOT NULL);
@@ -24615,6 +24897,8 @@ CREATE INDEX index_security_findings_on_severity ON security_findings USING btre
CREATE UNIQUE INDEX index_security_findings_on_uuid_and_scan_id ON security_findings USING btree (uuid, scan_id);
+CREATE INDEX index_security_scans_on_created_at ON security_scans USING btree (created_at);
+
CREATE INDEX index_security_scans_on_date_created_at_and_id ON security_scans USING btree (date(timezone('UTC'::text, created_at)), id);
CREATE INDEX index_self_managed_prometheus_alert_events_on_environment_id ON self_managed_prometheus_alert_events USING btree (environment_id);
@@ -24633,24 +24917,6 @@ CREATE INDEX index_serverless_domain_cluster_on_pages_domain_id ON serverless_do
CREATE INDEX index_service_desk_enabled_projects_on_id_creator_id_created_at ON projects USING btree (id, creator_id, created_at) WHERE (service_desk_enabled = true);
-CREATE INDEX index_services_on_inherit_from_id ON services USING btree (inherit_from_id);
-
-CREATE INDEX index_services_on_project_and_type_where_inherit_null ON services USING btree (project_id, type) WHERE (inherit_from_id IS NULL);
-
-CREATE UNIQUE INDEX index_services_on_project_id_and_type_unique ON services USING btree (project_id, type);
-
-CREATE INDEX index_services_on_template ON services USING btree (template);
-
-CREATE INDEX index_services_on_type ON services USING btree (type);
-
-CREATE UNIQUE INDEX index_services_on_type_and_instance_partial ON services USING btree (type, instance) WHERE (instance = true);
-
-CREATE UNIQUE INDEX index_services_on_type_and_template_partial ON services USING btree (type, template) WHERE (template = true);
-
-CREATE INDEX index_services_on_type_id_when_active_and_project_id_not_null ON services USING btree (type, id) WHERE ((active = true) AND (project_id IS NOT NULL));
-
-CREATE UNIQUE INDEX index_services_on_unique_group_id_and_type ON services USING btree (group_id, type);
-
CREATE UNIQUE INDEX index_shards_on_name ON shards USING btree (name);
CREATE UNIQUE INDEX index_site_profile_secret_variables_on_site_profile_id_and_key ON dast_site_profile_secret_variables USING btree (dast_site_profile_id, key);
@@ -25011,6 +25277,8 @@ CREATE INDEX index_vulnerability_findings_remediations_on_remediation_id ON vuln
CREATE UNIQUE INDEX index_vulnerability_findings_remediations_on_unique_keys ON vulnerability_findings_remediations USING btree (vulnerability_occurrence_id, vulnerability_remediation_id);
+CREATE INDEX index_vulnerability_flags_on_vulnerability_occurrence_id ON vulnerability_flags USING btree (vulnerability_occurrence_id);
+
CREATE INDEX index_vulnerability_historical_statistics_on_date_and_id ON vulnerability_historical_statistics USING btree (date, id);
CREATE UNIQUE INDEX index_vulnerability_identifiers_on_project_id_and_fingerprint ON vulnerability_identifiers USING btree (project_id, fingerprint);
@@ -25153,6 +25421,8 @@ 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_merge_requests_draft_and_status ON merge_requests USING btree (id) WHERE ((draft = false) AND (state_id = 1) AND ((title)::text ~* '^\[draft\]|\(draft\)|draft:|draft|\[WIP\]|WIP:|WIP'::text));
+
CREATE INDEX tmp_index_namespaces_empty_traversal_ids_with_child_namespaces ON namespaces USING btree (id) WHERE ((parent_id IS NOT NULL) AND (traversal_ids = '{}'::integer[]));
CREATE INDEX tmp_index_namespaces_empty_traversal_ids_with_root_namespaces ON namespaces USING btree (id) WHERE ((parent_id IS NULL) AND (traversal_ids = '{}'::integer[]));
@@ -25469,20 +25739,23 @@ CREATE TRIGGER trigger_cf2f9e35f002 BEFORE INSERT OR UPDATE ON ci_build_trace_ch
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_delete AFTER DELETE ON integrations FOR EACH ROW WHEN ((((old.category)::text = 'issue_tracker'::text) AND (old.active = true) AND (old.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker();
-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();
+CREATE TRIGGER trigger_has_external_issue_tracker_on_insert AFTER INSERT ON integrations 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();
-CREATE TRIGGER trigger_has_external_issue_tracker_on_update AFTER UPDATE ON services FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker();
+CREATE TRIGGER trigger_has_external_issue_tracker_on_update AFTER UPDATE ON integrations FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker();
-CREATE TRIGGER trigger_has_external_wiki_on_delete AFTER DELETE ON services FOR EACH ROW WHEN ((((old.type)::text = 'ExternalWikiService'::text) AND (old.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();
+CREATE TRIGGER trigger_has_external_wiki_on_delete AFTER DELETE ON integrations FOR EACH ROW WHEN ((((old.type)::text = 'ExternalWikiService'::text) AND (old.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();
-CREATE TRIGGER trigger_has_external_wiki_on_insert AFTER INSERT ON services FOR EACH ROW WHEN (((new.active = true) AND ((new.type)::text = 'ExternalWikiService'::text) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();
+CREATE TRIGGER trigger_has_external_wiki_on_insert AFTER INSERT ON integrations FOR EACH ROW WHEN (((new.active = true) AND ((new.type)::text = 'ExternalWikiService'::text) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();
-CREATE TRIGGER trigger_has_external_wiki_on_update AFTER UPDATE ON services FOR EACH ROW WHEN ((((new.type)::text = 'ExternalWikiService'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();
+CREATE TRIGGER trigger_has_external_wiki_on_update AFTER UPDATE ON integrations FOR EACH ROW WHEN ((((new.type)::text = 'ExternalWikiService'::text) AND (old.active <> new.active) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_wiki();
ALTER TABLE ONLY chat_names
- ADD CONSTRAINT fk_00797a2bf9 FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE;
+ ADD CONSTRAINT fk_00797a2bf9 FOREIGN KEY (service_id) REFERENCES integrations(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY deployments
+ ADD CONSTRAINT fk_009fd21147 FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE NOT VALID;
ALTER TABLE ONLY epics
ADD CONSTRAINT fk_013c9f36ca FOREIGN KEY (due_date_sourcing_epic_id) REFERENCES epics(id) ON DELETE SET NULL;
@@ -25607,6 +25880,9 @@ ALTER TABLE ONLY geo_event_log
ALTER TABLE ONLY deployments
ADD CONSTRAINT fk_289bba3222 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE SET NULL;
+ALTER TABLE ONLY ci_freeze_periods
+ ADD CONSTRAINT fk_2e02bbd1a6 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY notes
ADD CONSTRAINT fk_2e82291620 FOREIGN KEY (review_id) REFERENCES reviews(id) ON DELETE SET NULL;
@@ -25709,6 +25985,9 @@ ALTER TABLE ONLY vulnerability_feedback
ALTER TABLE ONLY deploy_keys_projects
ADD CONSTRAINT fk_58a901ca7e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY dast_scanner_profiles_builds
+ ADD CONSTRAINT fk_5d46286ad3 FOREIGN KEY (dast_scanner_profile_id) REFERENCES dast_scanner_profiles(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY issue_assignees
ADD CONSTRAINT fk_5e0c8d9154 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
@@ -25751,7 +26030,7 @@ ALTER TABLE ONLY terraform_state_versions
ALTER TABLE ONLY protected_branch_push_access_levels
ADD CONSTRAINT fk_7111b68cdb FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
-ALTER TABLE ONLY services
+ALTER TABLE ONLY integrations
ADD CONSTRAINT fk_71cce407f9 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY user_interacted_projects
@@ -25826,6 +26105,9 @@ ALTER TABLE ONLY experiment_subjects
ALTER TABLE ONLY merge_request_diffs
ADD CONSTRAINT fk_8483f3258f FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
+ALTER TABLE ONLY requirements
+ ADD CONSTRAINT fk_85044baef0 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY ci_pipelines
ADD CONSTRAINT fk_86635dbd80 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -25868,6 +26150,9 @@ ALTER TABLE ONLY ci_pipeline_schedules
ALTER TABLE ONLY todos
ADD CONSTRAINT fk_91d1f47b13 FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE;
+ALTER TABLE ONLY dast_site_profiles_builds
+ ADD CONSTRAINT fk_94e80df60e FOREIGN KEY (dast_site_profile_id) REFERENCES dast_site_profiles(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY vulnerability_feedback
ADD CONSTRAINT fk_94f7c8a81e FOREIGN KEY (comment_author_id) REFERENCES users(id) ON DELETE SET NULL;
@@ -25931,6 +26216,9 @@ ALTER TABLE ONLY ci_builds
ALTER TABLE ONLY ci_pipelines
ADD CONSTRAINT fk_a23be95014 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
+ALTER TABLE ONLY dast_site_profiles_builds
+ ADD CONSTRAINT fk_a325505e99 FOREIGN KEY (ci_build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY bulk_import_entities
ADD CONSTRAINT fk_a44ff95be5 FOREIGN KEY (parent_id) REFERENCES bulk_import_entities(id) ON DELETE CASCADE;
@@ -26088,7 +26376,7 @@ ALTER TABLE ONLY ci_builds
ADD CONSTRAINT fk_d3130c9a7f FOREIGN KEY (commit_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
ALTER TABLE ONLY web_hooks
- ADD CONSTRAINT fk_d47999a98a FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE;
+ ADD CONSTRAINT fk_d47999a98a FOREIGN KEY (service_id) REFERENCES integrations(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_sources_pipelines
ADD CONSTRAINT fk_d4e29af7d7 FOREIGN KEY (source_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
@@ -26141,6 +26429,9 @@ ALTER TABLE ONLY gitlab_subscriptions
ALTER TABLE ONLY ci_triggers
ADD CONSTRAINT fk_e3e63f966e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY dast_scanner_profiles_builds
+ ADD CONSTRAINT fk_e4c49200f8 FOREIGN KEY (ci_build_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_e719a85f8a FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL;
@@ -26168,7 +26459,7 @@ ALTER TABLE ONLY vulnerability_statistics
ALTER TABLE ONLY ci_triggers
ADD CONSTRAINT fk_e8e10d1964 FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE CASCADE;
-ALTER TABLE ONLY services
+ALTER TABLE ONLY integrations
ADD CONSTRAINT fk_e8fe908a34 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
ALTER TABLE ONLY pages_domains
@@ -26288,6 +26579,9 @@ ALTER TABLE ONLY terraform_state_versions
ALTER TABLE ONLY ci_build_report_results
ADD CONSTRAINT fk_rails_056d298d48 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE incident_management_pending_alert_escalations
+ ADD CONSTRAINT fk_rails_057c1e3d87 FOREIGN KEY (rule_id) REFERENCES incident_management_escalation_rules(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY ci_daily_build_group_report_results
ADD CONSTRAINT fk_rails_0667f7608c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -26409,7 +26703,7 @@ ALTER TABLE ONLY group_wiki_repositories
ADD CONSTRAINT fk_rails_19755e374b FOREIGN KEY (shard_id) REFERENCES shards(id) ON DELETE RESTRICT;
ALTER TABLE ONLY open_project_tracker_data
- ADD CONSTRAINT fk_rails_1987546e48 FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE;
+ ADD CONSTRAINT fk_rails_1987546e48 FOREIGN KEY (service_id) REFERENCES integrations(id) ON DELETE CASCADE;
ALTER TABLE ONLY gpg_signatures
ADD CONSTRAINT fk_rails_19d4f1c6f9 FOREIGN KEY (gpg_key_subkey_id) REFERENCES gpg_key_subkeys(id) ON DELETE SET NULL;
@@ -26537,15 +26831,15 @@ ALTER TABLE ONLY packages_debian_group_component_files
ALTER TABLE ONLY boards_epic_board_labels
ADD CONSTRAINT fk_rails_2bedeb8799 FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;
+ALTER TABLE ONLY error_tracking_error_events
+ ADD CONSTRAINT fk_rails_2c096c0076 FOREIGN KEY (error_id) REFERENCES error_tracking_errors(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY onboarding_progresses
ADD CONSTRAINT fk_rails_2ccfd420cc FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
ALTER TABLE ONLY protected_branch_unprotect_access_levels
ADD CONSTRAINT fk_rails_2d2aba21ef FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
-ALTER TABLE ONLY ci_freeze_periods
- ADD CONSTRAINT fk_rails_2e02bbd1a6 FOREIGN KEY (project_id) REFERENCES projects(id);
-
ALTER TABLE ONLY issuable_severities
ADD CONSTRAINT fk_rails_2fbb74ad6d FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
@@ -26672,9 +26966,6 @@ ALTER TABLE ONLY security_orchestration_policy_configurations
ALTER TABLE ONLY ci_resources
ADD CONSTRAINT fk_rails_430336af2d FOREIGN KEY (resource_group_id) REFERENCES ci_resource_groups(id) ON DELETE CASCADE;
-ALTER TABLE ONLY clusters_applications_fluentd
- ADD CONSTRAINT fk_rails_4319b1dcd2 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;
-
ALTER TABLE ONLY batched_background_migration_jobs
ADD CONSTRAINT fk_rails_432153b86d FOREIGN KEY (batched_background_migration_id) REFERENCES batched_background_migrations(id) ON DELETE CASCADE;
@@ -26951,12 +27242,18 @@ ALTER TABLE ONLY plan_limits
ALTER TABLE ONLY operations_feature_flags_issues
ADD CONSTRAINT fk_rails_6a8856ca4f FOREIGN KEY (feature_flag_id) REFERENCES operations_feature_flags(id) ON DELETE CASCADE;
+ALTER TABLE ONLY error_tracking_errors
+ ADD CONSTRAINT fk_rails_6b41f837ba FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY prometheus_alerts
ADD CONSTRAINT fk_rails_6d9b283465 FOREIGN KEY (environment_id) REFERENCES environments(id) ON DELETE CASCADE;
ALTER TABLE ONLY term_agreements
ADD CONSTRAINT fk_rails_6ea6520e4a FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY vulnerability_finding_evidence_assets
+ ADD CONSTRAINT fk_rails_6edbbecba4 FOREIGN KEY (vulnerability_finding_evidence_id) REFERENCES vulnerability_finding_evidences(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY project_compliance_framework_settings
ADD CONSTRAINT fk_rails_6f5294f16c FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -26991,7 +27288,7 @@ ALTER TABLE ONLY vulnerability_finding_evidence_requests
ADD CONSTRAINT fk_rails_72c87c8eb6 FOREIGN KEY (vulnerability_finding_evidence_id) REFERENCES vulnerability_finding_evidences(id) ON DELETE CASCADE;
ALTER TABLE ONLY slack_integrations
- ADD CONSTRAINT fk_rails_73db19721a FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE;
+ ADD CONSTRAINT fk_rails_73db19721a FOREIGN KEY (service_id) REFERENCES integrations(id) ON DELETE CASCADE;
ALTER TABLE ONLY custom_emoji
ADD CONSTRAINT fk_rails_745925b412 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -27044,6 +27341,9 @@ ALTER TABLE ONLY terraform_states
ALTER TABLE ONLY analytics_cycle_analytics_project_stages
ADD CONSTRAINT fk_rails_796a7dbc9c FOREIGN KEY (project_value_stream_id) REFERENCES analytics_cycle_analytics_project_value_streams(id) ON DELETE CASCADE;
+ALTER TABLE ONLY vulnerability_finding_evidence_supporting_messages
+ ADD CONSTRAINT fk_rails_79e77f6c5c FOREIGN KEY (vulnerability_finding_evidence_id) REFERENCES vulnerability_finding_evidences(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY software_license_policies
ADD CONSTRAINT fk_rails_7a7a2a92de FOREIGN KEY (software_license_id) REFERENCES software_licenses(id) ON DELETE CASCADE;
@@ -27131,6 +27431,9 @@ ALTER TABLE ONLY vulnerability_feedback
ALTER TABLE ONLY ci_pipeline_messages
ADD CONSTRAINT fk_rails_8d3b04e3e1 FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
+ALTER TABLE incident_management_pending_alert_escalations
+ ADD CONSTRAINT fk_rails_8d8de95da9 FOREIGN KEY (alert_id) REFERENCES alert_management_alerts(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY approval_merge_request_rules_approved_approvers
ADD CONSTRAINT fk_rails_8dc94cff4d FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
@@ -27255,7 +27558,7 @@ ALTER TABLE ONLY todos
ADD CONSTRAINT fk_rails_a27c483435 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
ALTER TABLE ONLY jira_tracker_data
- ADD CONSTRAINT fk_rails_a299066916 FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE;
+ ADD CONSTRAINT fk_rails_a299066916 FOREIGN KEY (service_id) REFERENCES integrations(id) ON DELETE CASCADE;
ALTER TABLE ONLY protected_environments
ADD CONSTRAINT fk_rails_a354313d11 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -27510,7 +27813,7 @@ ALTER TABLE ONLY operations_strategies_user_lists
ADD CONSTRAINT fk_rails_ccb7e4bc0b FOREIGN KEY (user_list_id) REFERENCES operations_user_lists(id) ON DELETE CASCADE;
ALTER TABLE ONLY issue_tracker_data
- ADD CONSTRAINT fk_rails_ccc0840427 FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE;
+ ADD CONSTRAINT fk_rails_ccc0840427 FOREIGN KEY (service_id) REFERENCES integrations(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;
@@ -27626,6 +27929,9 @@ ALTER TABLE ONLY clusters_integration_prometheus
ALTER TABLE ONLY vulnerability_occurrence_identifiers
ADD CONSTRAINT fk_rails_e4ef6d027c FOREIGN KEY (occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;
+ALTER TABLE ONLY vulnerability_flags
+ ADD CONSTRAINT fk_rails_e59393b48b FOREIGN KEY (vulnerability_occurrence_id) REFERENCES vulnerability_occurrences(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY serverless_domain_cluster
ADD CONSTRAINT fk_rails_e59e868733 FOREIGN KEY (clusters_applications_knative_id) REFERENCES clusters_applications_knative(id) ON DELETE CASCADE;
@@ -27671,6 +27977,9 @@ ALTER TABLE ONLY vulnerability_issue_links
ALTER TABLE ONLY merge_request_blocks
ADD CONSTRAINT fk_rails_e9387863bc FOREIGN KEY (blocking_merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
+ALTER TABLE ONLY vulnerability_finding_evidence_sources
+ ADD CONSTRAINT fk_rails_e9761bed4c FOREIGN KEY (vulnerability_finding_evidence_id) REFERENCES vulnerability_finding_evidences(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY protected_branch_unprotect_access_levels
ADD CONSTRAINT fk_rails_e9eb8dc025 FOREIGN KEY (protected_branch_id) REFERENCES protected_branches(id) ON DELETE CASCADE;
@@ -27791,6 +28100,9 @@ ALTER TABLE ONLY ci_job_variables
ALTER TABLE ONLY packages_nuget_metadata
ADD CONSTRAINT fk_rails_fc0c19f5b4 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;
+ALTER TABLE incident_management_pending_alert_escalations
+ ADD CONSTRAINT fk_rails_fcbfd9338b FOREIGN KEY (schedule_id) REFERENCES incident_management_oncall_schedules(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY external_approval_rules
ADD CONSTRAINT fk_rails_fd4f9ac573 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -27809,8 +28121,8 @@ ALTER TABLE ONLY resource_label_events
ALTER TABLE ONLY ci_builds_metadata
ADD CONSTRAINT fk_rails_ffcf702a02 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
-ALTER TABLE ONLY services
- ADD CONSTRAINT fk_services_inherit_from_id FOREIGN KEY (inherit_from_id) REFERENCES services(id) ON DELETE CASCADE;
+ALTER TABLE ONLY integrations
+ ADD CONSTRAINT fk_services_inherit_from_id FOREIGN KEY (inherit_from_id) REFERENCES integrations(id) ON DELETE CASCADE;
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_source_project FOREIGN KEY (source_project_id) REFERENCES projects(id) ON DELETE SET NULL;
@@ -27834,6 +28146,4 @@ ALTER TABLE ONLY user_follow_users
ADD CONSTRAINT user_follow_users_followee_id_fkey FOREIGN KEY (followee_id) REFERENCES users(id) ON DELETE CASCADE;
ALTER TABLE ONLY user_follow_users
- ADD CONSTRAINT user_follow_users_follower_id_fkey FOREIGN KEY (follower_id) REFERENCES users(id) ON DELETE CASCADE;-- schema_migrations.version information is no longer stored in this file,
--- but instead tracked in the db/schema_migrations directory
--- see https://gitlab.com/gitlab-org/gitlab/-/issues/218590 for details
+ ADD CONSTRAINT user_follow_users_follower_id_fkey FOREIGN KEY (follower_id) REFERENCES users(id) ON DELETE CASCADE;