summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
committerRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
commit6438df3a1e0fb944485cebf07976160184697d72 (patch)
tree00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /db
parent42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff)
downloadgitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/03_project.rb1
-rw-r--r--db/migrate/20190108192941_remove_partial_index_from_ci_builds_artifacts_file.rb2
-rw-r--r--db/migrate/20190402150158_backport_enterprise_schema.rb8
-rw-r--r--db/migrate/20190709220143_add_index_to_issues_relative_position.rb2
-rw-r--r--db/migrate/20190716144222_create_analytics_cycle_analytics_project_stages.rb13
-rw-r--r--db/migrate/20190729062536_create_analytics_cycle_analytics_group_stages.rb13
-rw-r--r--db/migrate/20190910125852_create_analytics_language_trend_repository_languages.rb7
-rw-r--r--db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb4
-rw-r--r--db/migrate/20191121161018_add_project_id_name_version_package_type_index_to_packages_packages.rb2
-rw-r--r--db/migrate/20191129144631_add_index_to_resource_group_id.rb2
-rw-r--r--db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb2
-rw-r--r--db/migrate/20200115135234_add_group_index_and_fk_to_import_failures.rb2
-rw-r--r--db/migrate/20200117112554_update_project_index_to_import_failures.rb4
-rw-r--r--db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb4
-rw-r--r--db/migrate/20200528054112_add_index_to_package_name.rb2
-rw-r--r--db/migrate/20200624142107_create_analytics_cycle_analytics_group_value_streams.rb4
-rw-r--r--db/migrate/20200826092324_add_projects_index_on_import_type_creator_id_created_at.rb2
-rw-r--r--db/migrate/20201005092709_remove_compliance_frameworks_group_id_fk.rb2
-rw-r--r--db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb4
-rw-r--r--db/migrate/20201112215132_swap_partitioned_audit_events.rb15
-rw-r--r--db/migrate/20201204105300_create_packages_debian_file_metadata.rb29
-rw-r--r--db/migrate/20201204110700_create_packages_debian_project_distributions.rb62
-rw-r--r--db/migrate/20201204110800_create_packages_debian_group_distributions.rb62
-rw-r--r--db/migrate/20201204111000_create_packages_debian_project_architectures.rb38
-rw-r--r--db/migrate/20201204111100_create_packages_debian_group_architectures.rb38
-rw-r--r--db/migrate/20201204193952_keep_latest_artifact_project_level.rb19
-rw-r--r--db/migrate/20201208210209_create_incident_management_oncall_shifts.rb35
-rw-r--r--db/migrate/20201209163958_add_code_challenge_to_oauth_access_grants.rb26
-rw-r--r--db/migrate/20201209193551_add_version_sha_cache_to_composer_metadata.rb19
-rw-r--r--db/migrate/20201214000000_change_mr_allow_maintainer_to_push_default.rb17
-rw-r--r--db/migrate/20201214032220_add_has_external_wiki_trigger.rb52
-rw-r--r--db/migrate/20201214111858_add_container_registry_cleanup_tags_service_max_list_size_to_application_settings.rb11
-rw-r--r--db/migrate/20201214112752_add_app_settings_container_reg_cleanup_tags_service_max_list_size_constraint.rb19
-rw-r--r--db/migrate/20201214184020_add_epic_board_list.rb33
-rw-r--r--db/migrate/20201215205404_create_namespace_package_settings.rb25
-rw-r--r--db/migrate/20201216151616_add_squash_commit_sha_index.rb22
-rw-r--r--db/migrate/20201216154457_add_devops_adoption_snapshot_range_end.rb11
-rw-r--r--db/migrate/20201217070530_add_group_merge_request_approval_settings.rb24
-rw-r--r--db/migrate/20201217132603_create_elastic_reindexing_subtasks.rb56
-rw-r--r--db/migrate/20201221124036_add_devops_snapshot_index.rb19
-rw-r--r--db/migrate/20201221213415_change_clusters_helm_major_version_default_to_3.rb9
-rw-r--r--db/migrate/20201223114050_add_restrict_user_defined_variables_to_project_settings.rb19
-rw-r--r--db/migrate/20201224144948_migrate_coverage_report_worker.rb15
-rw-r--r--db/migrate/20201228184500_add_dismissal_reason_into_vulnerability_feedback_table.rb13
-rw-r--r--db/migrate/20201229105948_add_invisible_captcha_enabled_to_settings.rb9
-rw-r--r--db/migrate/20201230161206_add_rate_limiting_response_text_to_application_settings.rb12
-rw-r--r--db/migrate/20201230180202_create_onboarding_progress.rb36
-rw-r--r--db/migrate/20210101110640_set_limit_for_rate_limiting_response_text.rb16
-rw-r--r--db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb19
-rw-r--r--db/migrate/20210104163218_add_epic_board_position_index.rb18
-rw-r--r--db/migrate/20210106153021_drop_tmp_index_on_emails.rb20
-rw-r--r--db/migrate/20210108161039_update_max_import_size_default.rb9
-rw-r--r--db/migrate/20210112084512_drop_tmp_index_on_emails_again.rb18
-rw-r--r--db/migrate/20210114033715_remove_group_id_title_index.rb20
-rw-r--r--db/post_migrate/20190402224749_schedule_merge_request_assignees_migration_progress_check.rb2
-rw-r--r--db/post_migrate/20190506135400_schedule_sync_issuables_state_id_where_nil.rb4
-rw-r--r--db/post_migrate/20190611161642_add_index_to_events_and_audit_events_created_at_author_id.rb6
-rw-r--r--db/post_migrate/20191030223057_backfill_version_author_and_created_at.rb2
-rw-r--r--db/post_migrate/20191104142124_nullify_users_role.rb2
-rw-r--r--db/post_migrate/20200207185149_schedule_fix_orphan_promoted_issues.rb2
-rw-r--r--db/post_migrate/20200217225719_schedule_migrate_security_scans.rb2
-rw-r--r--db/post_migrate/20200716234259_remove_duplicate_labels_from_group.rb135
-rw-r--r--db/post_migrate/20200716234518_add_uniqueness_index_to_label_title_and_group.rb21
-rw-r--r--db/post_migrate/20201207165956_remove_duplicate_services.rb14
-rw-r--r--db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb38
-rw-r--r--db/post_migrate/20201211090634_schedule_populate_finding_uuid_for_vulnerability_feedback.rb25
-rw-r--r--db/post_migrate/20201216185336_add_devops_adoption_snapshot_not_null.rb31
-rw-r--r--db/post_migrate/20201223012231_reindex_ci_pipelines_on_schedule_id_and_id.rb21
-rw-r--r--db/post_migrate/20210105103649_delete_column_group_id_on_compliance_framework.rb9
-rw-r--r--db/post_migrate/20210107194543_remove_alerts_service_records.rb19
-rw-r--r--db/post_migrate/20210112143418_remove_duplicate_services2.rb29
-rw-r--r--db/schema_migrations/202007162342591
-rw-r--r--db/schema_migrations/202007162345181
-rw-r--r--db/schema_migrations/202011122151321
-rw-r--r--db/schema_migrations/202012041053001
-rw-r--r--db/schema_migrations/202012041107001
-rw-r--r--db/schema_migrations/202012041108001
-rw-r--r--db/schema_migrations/202012041110001
-rw-r--r--db/schema_migrations/202012041111001
-rw-r--r--db/schema_migrations/202012041939521
-rw-r--r--db/schema_migrations/202012071659561
-rw-r--r--db/schema_migrations/202012081751171
-rw-r--r--db/schema_migrations/202012082102091
-rw-r--r--db/schema_migrations/202012091639581
-rw-r--r--db/schema_migrations/202012091935511
-rw-r--r--db/schema_migrations/202012110906341
-rw-r--r--db/schema_migrations/202012140000001
-rw-r--r--db/schema_migrations/202012140322201
-rw-r--r--db/schema_migrations/202012141118581
-rw-r--r--db/schema_migrations/202012141127521
-rw-r--r--db/schema_migrations/202012141840201
-rw-r--r--db/schema_migrations/202012152054041
-rw-r--r--db/schema_migrations/202012161516161
-rw-r--r--db/schema_migrations/202012161544571
-rw-r--r--db/schema_migrations/202012161853361
-rw-r--r--db/schema_migrations/202012170705301
-rw-r--r--db/schema_migrations/202012171326031
-rw-r--r--db/schema_migrations/202012211240361
-rw-r--r--db/schema_migrations/202012212134151
-rw-r--r--db/schema_migrations/202012230122311
-rw-r--r--db/schema_migrations/202012231140501
-rw-r--r--db/schema_migrations/202012241449481
-rw-r--r--db/schema_migrations/202012281845001
-rw-r--r--db/schema_migrations/202012291059481
-rw-r--r--db/schema_migrations/202012301612061
-rw-r--r--db/schema_migrations/202012301802021
-rw-r--r--db/schema_migrations/202101011106401
-rw-r--r--db/schema_migrations/202101021641211
-rw-r--r--db/schema_migrations/202101041632181
-rw-r--r--db/schema_migrations/202101051036491
-rw-r--r--db/schema_migrations/202101061530211
-rw-r--r--db/schema_migrations/202101071945431
-rw-r--r--db/schema_migrations/202101081610391
-rw-r--r--db/schema_migrations/202101120845121
-rw-r--r--db/schema_migrations/202101121434181
-rw-r--r--db/schema_migrations/202101140337151
-rw-r--r--db/structure.sql474
117 files changed, 1743 insertions, 83 deletions
diff --git a/db/fixtures/development/03_project.rb b/db/fixtures/development/03_project.rb
index 596c5e81a2e..e879db84e68 100644
--- a/db/fixtures/development/03_project.rb
+++ b/db/fixtures/development/03_project.rb
@@ -113,6 +113,7 @@ class Gitlab::Seeder::Projects
group.save!
group.add_owner(User.first)
+ group.create_namespace_settings
end
project_path.gsub!(".git", "")
diff --git a/db/migrate/20190108192941_remove_partial_index_from_ci_builds_artifacts_file.rb b/db/migrate/20190108192941_remove_partial_index_from_ci_builds_artifacts_file.rb
index 073faf721ae..86de78b831b 100644
--- a/db/migrate/20190108192941_remove_partial_index_from_ci_builds_artifacts_file.rb
+++ b/db/migrate/20190108192941_remove_partial_index_from_ci_builds_artifacts_file.rb
@@ -4,7 +4,7 @@ class RemovePartialIndexFromCiBuildsArtifactsFile < ActiveRecord::Migration[5.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- INDEX_NAME = 'partial_index_ci_builds_on_id_with_legacy_artifacts'.freeze
+ INDEX_NAME = 'partial_index_ci_builds_on_id_with_legacy_artifacts'
disable_ddl_transaction!
diff --git a/db/migrate/20190402150158_backport_enterprise_schema.rb b/db/migrate/20190402150158_backport_enterprise_schema.rb
index dcf84d762a3..c4fbb4b2ab9 100644
--- a/db/migrate/20190402150158_backport_enterprise_schema.rb
+++ b/db/migrate/20190402150158_backport_enterprise_schema.rb
@@ -198,9 +198,9 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0]
# rubocop:enable Migration/DropTable
end
- def add_column_with_default_if_not_exists(table, name, *args)
+ def add_column_with_default_if_not_exists(table, name, type, **args)
unless column_exists?(table, name)
- add_column_with_default(table, name, *args) # rubocop:disable Migration/AddColumnWithDefault
+ add_column_with_default(table, name, type, **args) # rubocop:disable Migration/AddColumnWithDefault
end
end
@@ -226,10 +226,10 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0]
end
end
- def create_table_if_not_exists(name, *args, &block)
+ def create_table_if_not_exists(name, **args, &block)
return if table_exists?(name)
- create_table(name, *args, &block)
+ create_table(name, **args, &block)
end
def add_concurrent_foreign_key(source, target, column:, on_delete: nil, name: nil)
diff --git a/db/migrate/20190709220143_add_index_to_issues_relative_position.rb b/db/migrate/20190709220143_add_index_to_issues_relative_position.rb
index effab33ce4f..ec11c6d768f 100644
--- a/db/migrate/20190709220143_add_index_to_issues_relative_position.rb
+++ b/db/migrate/20190709220143_add_index_to_issues_relative_position.rb
@@ -8,7 +8,7 @@ class AddIndexToIssuesRelativePosition < ActiveRecord::Migration[5.1]
disable_ddl_transaction!
- INDEX_NAME = 'index_issues_on_project_id_and_state_and_rel_position_and_id'.freeze
+ INDEX_NAME = 'index_issues_on_project_id_and_state_and_rel_position_and_id'
def up
add_concurrent_index :issues, [:project_id, :state, :relative_position, :id], order: { id: :desc }, name: INDEX_NAME
diff --git a/db/migrate/20190716144222_create_analytics_cycle_analytics_project_stages.rb b/db/migrate/20190716144222_create_analytics_cycle_analytics_project_stages.rb
index c03191013dc..5723f6db0a3 100644
--- a/db/migrate/20190716144222_create_analytics_cycle_analytics_project_stages.rb
+++ b/db/migrate/20190716144222_create_analytics_cycle_analytics_project_stages.rb
@@ -11,19 +11,20 @@ class CreateAnalyticsCycleAnalyticsProjectStages < ActiveRecord::Migration[5.2]
t.integer :relative_position
t.integer :start_event_identifier, null: false
t.integer :end_event_identifier, null: false
- t.references(:project, {
+
+ t.references(:project,
null: false,
foreign_key: { to_table: :projects, on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_project_id' }
- })
- t.references(:start_event_label, {
+ )
+ t.references(:start_event_label,
foreign_key: { to_table: :labels, on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_start_event_label_id' }
- })
- t.references(:end_event_label, {
+ )
+ t.references(:end_event_label,
foreign_key: { to_table: :labels, on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_end_event_label_id' }
- })
+ )
t.boolean :hidden, default: false, null: false
t.boolean :custom, default: true, null: false
t.string :name, null: false, limit: 255 # rubocop:disable Migration/PreventStrings
diff --git a/db/migrate/20190729062536_create_analytics_cycle_analytics_group_stages.rb b/db/migrate/20190729062536_create_analytics_cycle_analytics_group_stages.rb
index 4753a7684e7..d438ece9951 100644
--- a/db/migrate/20190729062536_create_analytics_cycle_analytics_group_stages.rb
+++ b/db/migrate/20190729062536_create_analytics_cycle_analytics_group_stages.rb
@@ -11,19 +11,20 @@ class CreateAnalyticsCycleAnalyticsGroupStages < ActiveRecord::Migration[5.2]
t.integer :relative_position
t.integer :start_event_identifier, null: false
t.integer :end_event_identifier, null: false
- t.references(:group, {
+
+ t.references(:group,
null: false,
foreign_key: { to_table: :namespaces, on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_group_id' }
- })
- t.references(:start_event_label, {
+ )
+ t.references(:start_event_label,
foreign_key: { to_table: :labels, on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_start_event_label_id' }
- })
- t.references(:end_event_label, {
+ )
+ t.references(:end_event_label,
foreign_key: { to_table: :labels, on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_end_event_label_id' }
- })
+ )
t.boolean :hidden, default: false, null: false
t.boolean :custom, default: true, null: false
t.string :name, null: false, limit: 255 # rubocop:disable Migration/PreventStrings
diff --git a/db/migrate/20190910125852_create_analytics_language_trend_repository_languages.rb b/db/migrate/20190910125852_create_analytics_language_trend_repository_languages.rb
index 07da4c20d55..1fc9034655c 100644
--- a/db/migrate/20190910125852_create_analytics_language_trend_repository_languages.rb
+++ b/db/migrate/20190910125852_create_analytics_language_trend_repository_languages.rb
@@ -7,16 +7,15 @@ class CreateAnalyticsLanguageTrendRepositoryLanguages < ActiveRecord::Migration[
def change
create_table :analytics_language_trend_repository_languages, id: false do |t|
t.integer :file_count, null: false, default: 0
- t.references :programming_language, {
+
+ t.references :programming_language,
null: false,
foreign_key: { on_delete: :cascade },
index: false
- }
- t.references :project, {
+ t.references :project,
null: false,
foreign_key: { on_delete: :cascade },
index: { name: INDEX_PREFIX + 'on_project_id' }
- }
t.integer :loc, null: false, default: 0
t.integer :bytes, null: false, default: 0
# Storing percentage (with 2 decimal places), on 2 bytes.
diff --git a/db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb b/db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb
index b88a1f01d79..01272dfad44 100644
--- a/db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb
+++ b/db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb
@@ -4,8 +4,8 @@ class AddIndexToEnvironmentsOnProjectIdStateEnvironmentType < ActiveRecord::Migr
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- OLD_INDEX_NAME = 'index_environments_on_project_id_and_state'.freeze
- NEW_INDEX_NAME = 'index_environments_on_project_id_state_environment_type'.freeze
+ OLD_INDEX_NAME = 'index_environments_on_project_id_and_state'
+ NEW_INDEX_NAME = 'index_environments_on_project_id_state_environment_type'
disable_ddl_transaction!
diff --git a/db/migrate/20191121161018_add_project_id_name_version_package_type_index_to_packages_packages.rb b/db/migrate/20191121161018_add_project_id_name_version_package_type_index_to_packages_packages.rb
index 4511a2a0e49..4a34b9e791e 100644
--- a/db/migrate/20191121161018_add_project_id_name_version_package_type_index_to_packages_packages.rb
+++ b/db/migrate/20191121161018_add_project_id_name_version_package_type_index_to_packages_packages.rb
@@ -4,7 +4,7 @@ class AddProjectIdNameVersionPackageTypeIndexToPackagesPackages < ActiveRecord::
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- INDEX_NAME = 'idx_packages_packages_on_project_id_name_version_package_type'.freeze
+ INDEX_NAME = 'idx_packages_packages_on_project_id_name_version_package_type'
disable_ddl_transaction!
diff --git a/db/migrate/20191129144631_add_index_to_resource_group_id.rb b/db/migrate/20191129144631_add_index_to_resource_group_id.rb
index 0e5a84f094d..01d56f417b5 100644
--- a/db/migrate/20191129144631_add_index_to_resource_group_id.rb
+++ b/db/migrate/20191129144631_add_index_to_resource_group_id.rb
@@ -4,7 +4,7 @@ class AddIndexToResourceGroupId < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- INDEX_NAME = 'index_for_resource_group'.freeze
+ INDEX_NAME = 'index_for_resource_group'
disable_ddl_transaction!
diff --git a/db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb b/db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb
index 5dacc3c0c66..ea92f9cfd32 100644
--- a/db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb
+++ b/db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb
@@ -4,7 +4,7 @@ class AddIndexesToDeploymentsOnProjectIdAndRef < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- INDEX_NAME = 'partial_index_deployments_for_project_id_and_tag'.freeze
+ INDEX_NAME = 'partial_index_deployments_for_project_id_and_tag'
disable_ddl_transaction!
diff --git a/db/migrate/20200115135234_add_group_index_and_fk_to_import_failures.rb b/db/migrate/20200115135234_add_group_index_and_fk_to_import_failures.rb
index ae0d6d31c42..c7f2354440b 100644
--- a/db/migrate/20200115135234_add_group_index_and_fk_to_import_failures.rb
+++ b/db/migrate/20200115135234_add_group_index_and_fk_to_import_failures.rb
@@ -4,7 +4,7 @@ class AddGroupIndexAndFkToImportFailures < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- GROUP_INDEX = 'index_import_failures_on_group_id_not_null'.freeze
+ GROUP_INDEX = 'index_import_failures_on_group_id_not_null'
disable_ddl_transaction!
diff --git a/db/migrate/20200117112554_update_project_index_to_import_failures.rb b/db/migrate/20200117112554_update_project_index_to_import_failures.rb
index 1e8347aad44..888a9bec778 100644
--- a/db/migrate/20200117112554_update_project_index_to_import_failures.rb
+++ b/db/migrate/20200117112554_update_project_index_to_import_failures.rb
@@ -5,8 +5,8 @@ class UpdateProjectIndexToImportFailures < ActiveRecord::Migration[5.2]
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
- PROJECT_INDEX_OLD = 'index_import_failures_on_project_id'.freeze
- PROJECT_INDEX_NEW = 'index_import_failures_on_project_id_not_null'.freeze
+ PROJECT_INDEX_OLD = 'index_import_failures_on_project_id'
+ PROJECT_INDEX_NEW = 'index_import_failures_on_project_id_not_null'
disable_ddl_transaction!
diff --git a/db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb b/db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb
index 13b041d8f95..4ec514f7fca 100644
--- a/db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb
+++ b/db/migrate/20200221144534_drop_activate_prometheus_services_background_jobs.rb
@@ -2,8 +2,8 @@
class DropActivatePrometheusServicesBackgroundJobs < ActiveRecord::Migration[6.0]
DOWNTIME = false
- DROPPED_JOB_CLASS = 'ActivatePrometheusServicesForSharedClusterApplications'.freeze
- QUEUE = 'background_migration'.freeze
+ DROPPED_JOB_CLASS = 'ActivatePrometheusServicesForSharedClusterApplications'
+ QUEUE = 'background_migration'
def up
sidekiq_queues.each do |queue|
diff --git a/db/migrate/20200528054112_add_index_to_package_name.rb b/db/migrate/20200528054112_add_index_to_package_name.rb
index 4629c32ab3d..fa12088741d 100644
--- a/db/migrate/20200528054112_add_index_to_package_name.rb
+++ b/db/migrate/20200528054112_add_index_to_package_name.rb
@@ -7,7 +7,7 @@ class AddIndexToPackageName < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
- INDEX_NAME = 'package_name_index'.freeze
+ INDEX_NAME = 'package_name_index'
def up
add_concurrent_index(:packages_packages, :name, name: INDEX_NAME)
diff --git a/db/migrate/20200624142107_create_analytics_cycle_analytics_group_value_streams.rb b/db/migrate/20200624142107_create_analytics_cycle_analytics_group_value_streams.rb
index 24afe463684..4b3f5222399 100644
--- a/db/migrate/20200624142107_create_analytics_cycle_analytics_group_value_streams.rb
+++ b/db/migrate/20200624142107_create_analytics_cycle_analytics_group_value_streams.rb
@@ -13,11 +13,11 @@ class CreateAnalyticsCycleAnalyticsGroupValueStreams < ActiveRecord::Migration[6
with_lock_retries do
create_table :analytics_cycle_analytics_group_value_streams do |t|
t.timestamps_with_timezone
- t.references(:group, {
+ t.references(:group,
null: false,
index: false,
foreign_key: { to_table: :namespaces, on_delete: :cascade }
- })
+ )
t.text :name, null: false
t.index [:group_id, :name], unique: true, name: INDEX_NAME
end
diff --git a/db/migrate/20200826092324_add_projects_index_on_import_type_creator_id_created_at.rb b/db/migrate/20200826092324_add_projects_index_on_import_type_creator_id_created_at.rb
index 94d2e5cb4ab..5938d3c8d3a 100644
--- a/db/migrate/20200826092324_add_projects_index_on_import_type_creator_id_created_at.rb
+++ b/db/migrate/20200826092324_add_projects_index_on_import_type_creator_id_created_at.rb
@@ -4,7 +4,7 @@ class AddProjectsIndexOnImportTypeCreatorIdCreatedAt < ActiveRecord::Migration[6
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- INDEX_NAME = 'index_imported_projects_on_import_type_creator_id_created_at'.freeze
+ INDEX_NAME = 'index_imported_projects_on_import_type_creator_id_created_at'
disable_ddl_transaction!
diff --git a/db/migrate/20201005092709_remove_compliance_frameworks_group_id_fk.rb b/db/migrate/20201005092709_remove_compliance_frameworks_group_id_fk.rb
index 88c019c849e..dcbe48c03f9 100644
--- a/db/migrate/20201005092709_remove_compliance_frameworks_group_id_fk.rb
+++ b/db/migrate/20201005092709_remove_compliance_frameworks_group_id_fk.rb
@@ -4,7 +4,7 @@ class RemoveComplianceFrameworksGroupIdFk < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- INDEX_NAME = 'index_compliance_management_frameworks_on_group_id_and_name'.freeze
+ INDEX_NAME = 'index_compliance_management_frameworks_on_group_id_and_name'
class TmpComplianceFramework < ActiveRecord::Base
self.table_name = 'compliance_management_frameworks'
diff --git a/db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb b/db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb
index ea45e82dcc4..c26636444af 100644
--- a/db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb
+++ b/db/migrate/20201014205300_drop_backfill_jira_tracker_deployment_type_jobs.rb
@@ -2,8 +2,8 @@
class DropBackfillJiraTrackerDeploymentTypeJobs < ActiveRecord::Migration[6.0]
DOWNTIME = false
- DROPPED_JOB_CLASS = 'BackfillJiraTrackerDeploymentType'.freeze
- QUEUE = 'background_migration'.freeze
+ DROPPED_JOB_CLASS = 'BackfillJiraTrackerDeploymentType'
+ QUEUE = 'background_migration'
def up
sidekiq_queues.each do |queue|
diff --git a/db/migrate/20201112215132_swap_partitioned_audit_events.rb b/db/migrate/20201112215132_swap_partitioned_audit_events.rb
new file mode 100644
index 00000000000..8360dbd4aa5
--- /dev/null
+++ b/db/migrate/20201112215132_swap_partitioned_audit_events.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class SwapPartitionedAuditEvents < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::PartitioningMigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ replace_with_partitioned_table :audit_events
+ end
+
+ def down
+ rollback_replace_with_partitioned_table :audit_events
+ end
+end
diff --git a/db/migrate/20201204105300_create_packages_debian_file_metadata.rb b/db/migrate/20201204105300_create_packages_debian_file_metadata.rb
new file mode 100644
index 00000000000..2bba1b6f38e
--- /dev/null
+++ b/db/migrate/20201204105300_create_packages_debian_file_metadata.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class CreatePackagesDebianFileMetadata < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:packages_debian_file_metadata)
+ create_table :packages_debian_file_metadata, id: false do |t|
+ t.timestamps_with_timezone
+ t.references :package_file, primary_key: true, index: false, default: nil, null: false, foreign_key: { to_table: :packages_package_files, on_delete: :cascade }, type: :bigint
+ t.integer :file_type, limit: 2, null: false
+ t.text :component
+ t.text :architecture
+ t.jsonb :fields
+ end
+ end
+
+ add_text_limit :packages_debian_file_metadata, :component, 255
+ add_text_limit :packages_debian_file_metadata, :architecture, 255
+ end
+
+ def down
+ drop_table :packages_debian_file_metadata
+ end
+end
diff --git a/db/migrate/20201204110700_create_packages_debian_project_distributions.rb b/db/migrate/20201204110700_create_packages_debian_project_distributions.rb
new file mode 100644
index 00000000000..5fe45c6236f
--- /dev/null
+++ b/db/migrate/20201204110700_create_packages_debian_project_distributions.rb
@@ -0,0 +1,62 @@
+# frozen_string_literal: true
+
+class CreatePackagesDebianProjectDistributions < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ UNIQUE_CODENAME = 'uniq_pkgs_debian_project_distributions_project_id_and_codename'
+ UNIQUE_SUITE = 'uniq_pkgs_debian_project_distributions_project_id_and_suite'
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ unless table_exists?(:packages_debian_project_distributions)
+ create_table :packages_debian_project_distributions do |t|
+ t.timestamps_with_timezone
+ t.references :project, foreign_key: { to_table: :projects, on_delete: :restrict }, null: false
+ t.references :creator, foreign_key: { to_table: :users, on_delete: :nullify }
+ t.integer :valid_time_duration_seconds
+ t.integer :file_store, limit: 2, default: 1, null: false
+ t.boolean :automatic, default: true, null: false
+ t.boolean :automatic_upgrades, default: false, null: false
+ t.text :codename, null: false
+ t.text :suite
+ t.text :origin
+ t.text :label
+ t.text :version
+ t.text :description
+ t.text :encrypted_signing_keys
+ t.text :encrypted_signing_keys_iv
+ t.text :file
+ t.text :file_signature
+
+ t.index %w(project_id codename),
+ name: UNIQUE_CODENAME,
+ unique: true,
+ using: :btree
+ t.index %w(project_id suite),
+ name: UNIQUE_SUITE,
+ unique: true,
+ using: :btree
+ end
+ end
+ end
+
+ add_text_limit :packages_debian_project_distributions, :codename, 255
+ add_text_limit :packages_debian_project_distributions, :suite, 255
+ add_text_limit :packages_debian_project_distributions, :origin, 255
+ add_text_limit :packages_debian_project_distributions, :label, 255
+ add_text_limit :packages_debian_project_distributions, :version, 255
+ add_text_limit :packages_debian_project_distributions, :description, 255
+ add_text_limit :packages_debian_project_distributions, :encrypted_signing_keys, 2048
+ add_text_limit :packages_debian_project_distributions, :encrypted_signing_keys_iv, 255
+ add_text_limit :packages_debian_project_distributions, :file, 255
+ add_text_limit :packages_debian_project_distributions, :file_signature, 4096
+ end
+
+ def down
+ drop_table :packages_debian_project_distributions
+ end
+end
diff --git a/db/migrate/20201204110800_create_packages_debian_group_distributions.rb b/db/migrate/20201204110800_create_packages_debian_group_distributions.rb
new file mode 100644
index 00000000000..9ad9a59b3e9
--- /dev/null
+++ b/db/migrate/20201204110800_create_packages_debian_group_distributions.rb
@@ -0,0 +1,62 @@
+# frozen_string_literal: true
+
+class CreatePackagesDebianGroupDistributions < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ UNIQUE_CODENAME = 'uniq_pkgs_debian_group_distributions_group_id_and_codename'
+ UNIQUE_SUITE = 'uniq_pkgs_debian_group_distributions_group_id_and_suite'
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ unless table_exists?(:packages_debian_group_distributions)
+ create_table :packages_debian_group_distributions do |t|
+ t.timestamps_with_timezone
+ t.references :group, foreign_key: { to_table: :namespaces, on_delete: :restrict }, null: false
+ t.references :creator, foreign_key: { to_table: :users, on_delete: :nullify }
+ t.integer :valid_time_duration_seconds
+ t.integer :file_store, limit: 2, default: 1, null: false
+ t.boolean :automatic, default: true, null: false
+ t.boolean :automatic_upgrades, default: false, null: false
+ t.text :codename, null: false
+ t.text :suite
+ t.text :origin
+ t.text :label
+ t.text :version
+ t.text :description
+ t.text :encrypted_signing_keys
+ t.text :encrypted_signing_keys_iv
+ t.text :file
+ t.text :file_signature
+
+ t.index %w(group_id codename),
+ name: UNIQUE_CODENAME,
+ unique: true,
+ using: :btree
+ t.index %w(group_id suite),
+ name: UNIQUE_SUITE,
+ unique: true,
+ using: :btree
+ end
+ end
+ end
+
+ add_text_limit :packages_debian_group_distributions, :codename, 255
+ add_text_limit :packages_debian_group_distributions, :suite, 255
+ add_text_limit :packages_debian_group_distributions, :origin, 255
+ add_text_limit :packages_debian_group_distributions, :label, 255
+ add_text_limit :packages_debian_group_distributions, :version, 255
+ add_text_limit :packages_debian_group_distributions, :description, 255
+ add_text_limit :packages_debian_group_distributions, :encrypted_signing_keys, 2048
+ add_text_limit :packages_debian_group_distributions, :encrypted_signing_keys_iv, 255
+ add_text_limit :packages_debian_group_distributions, :file, 255
+ add_text_limit :packages_debian_group_distributions, :file_signature, 4096
+ end
+
+ def down
+ drop_table :packages_debian_group_distributions
+ end
+end
diff --git a/db/migrate/20201204111000_create_packages_debian_project_architectures.rb b/db/migrate/20201204111000_create_packages_debian_project_architectures.rb
new file mode 100644
index 00000000000..f684a413873
--- /dev/null
+++ b/db/migrate/20201204111000_create_packages_debian_project_architectures.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+class CreatePackagesDebianProjectArchitectures < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ INDEX_NAME = 'idx_pkgs_deb_proj_architectures_on_distribution_id'
+ UNIQUE_NAME = 'uniq_pkgs_deb_proj_architectures_on_distribution_id_and_name'
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ unless table_exists?(:packages_debian_project_architectures)
+ create_table :packages_debian_project_architectures do |t|
+ t.timestamps_with_timezone
+ t.references :distribution,
+ foreign_key: { to_table: :packages_debian_project_distributions, on_delete: :cascade },
+ null: false,
+ index: { name: INDEX_NAME }
+ t.text :name, null: false
+
+ t.index %w(distribution_id name),
+ name: UNIQUE_NAME,
+ unique: true,
+ using: :btree
+ end
+ end
+ end
+
+ add_text_limit :packages_debian_project_architectures, :name, 255
+ end
+
+ def down
+ drop_table :packages_debian_project_architectures
+ end
+end
diff --git a/db/migrate/20201204111100_create_packages_debian_group_architectures.rb b/db/migrate/20201204111100_create_packages_debian_group_architectures.rb
new file mode 100644
index 00000000000..8a001414c45
--- /dev/null
+++ b/db/migrate/20201204111100_create_packages_debian_group_architectures.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+class CreatePackagesDebianGroupArchitectures < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ INDEX_NAME = 'idx_pkgs_deb_grp_architectures_on_distribution_id'
+ UNIQUE_NAME = 'uniq_pkgs_deb_grp_architectures_on_distribution_id_and_name'
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ unless table_exists?(:packages_debian_group_architectures)
+ create_table :packages_debian_group_architectures do |t|
+ t.timestamps_with_timezone
+ t.references :distribution,
+ foreign_key: { to_table: :packages_debian_group_distributions, on_delete: :cascade },
+ null: false,
+ index: { name: INDEX_NAME }
+ t.text :name, null: false
+
+ t.index %w(distribution_id name),
+ name: UNIQUE_NAME,
+ unique: true,
+ using: :btree
+ end
+ end
+ end
+
+ add_text_limit :packages_debian_group_architectures, :name, 255
+ end
+
+ def down
+ drop_table :packages_debian_group_architectures
+ end
+end
diff --git a/db/migrate/20201204193952_keep_latest_artifact_project_level.rb b/db/migrate/20201204193952_keep_latest_artifact_project_level.rb
new file mode 100644
index 00000000000..3fc9fad1dc6
--- /dev/null
+++ b/db/migrate/20201204193952_keep_latest_artifact_project_level.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class KeepLatestArtifactProjectLevel < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :project_ci_cd_settings, :keep_latest_artifact, :boolean, default: true, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :project_ci_cd_settings, :keep_latest_artifact
+ end
+ end
+end
diff --git a/db/migrate/20201208210209_create_incident_management_oncall_shifts.rb b/db/migrate/20201208210209_create_incident_management_oncall_shifts.rb
new file mode 100644
index 00000000000..49cb32ffee0
--- /dev/null
+++ b/db/migrate/20201208210209_create_incident_management_oncall_shifts.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+class CreateIncidentManagementOncallShifts < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ unless table_exists?(:incident_management_oncall_shifts)
+ with_lock_retries do
+ create_table :incident_management_oncall_shifts do |t|
+ t.references :rotation, null: false, foreign_key: { to_table: :incident_management_oncall_rotations, on_delete: :cascade }
+ t.references :participant, null: false, foreign_key: { to_table: :incident_management_oncall_participants, on_delete: :cascade }
+ t.datetime_with_timezone :starts_at, null: false
+ t.datetime_with_timezone :ends_at, null: false
+ end
+
+ execute <<~SQL
+ ALTER TABLE incident_management_oncall_shifts
+ ADD CONSTRAINT inc_mgmnt_no_overlapping_oncall_shifts
+ EXCLUDE USING gist
+ ( rotation_id WITH =,
+ tstzrange(starts_at, ends_at, '[)') WITH &&
+ )
+ SQL
+ end
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :incident_management_oncall_shifts
+ end
+ end
+end
diff --git a/db/migrate/20201209163958_add_code_challenge_to_oauth_access_grants.rb b/db/migrate/20201209163958_add_code_challenge_to_oauth_access_grants.rb
new file mode 100644
index 00000000000..48292cce55b
--- /dev/null
+++ b/db/migrate/20201209163958_add_code_challenge_to_oauth_access_grants.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class AddCodeChallengeToOauthAccessGrants < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_column(:oauth_access_grants, :code_challenge, :text, null: true) unless column_exists?(:oauth_access_grants, :code_challenge)
+ # If `code_challenge_method` is 'plain' the length is at most 128 characters as per the spec
+ # https://tools.ietf.org/html/rfc7636#section-4.1
+ # Otherwise the max length of base64(SHA256(code_verifier)) is 44 characters
+ add_text_limit(:oauth_access_grants, :code_challenge, 128, constraint_name: 'oauth_access_grants_code_challenge')
+
+ add_column(:oauth_access_grants, :code_challenge_method, :text, null: true) unless column_exists?(:oauth_access_grants, :code_challenge_method)
+ # Values are either 'plain' or 'S256'
+ add_text_limit(:oauth_access_grants, :code_challenge_method, 5, constraint_name: 'oauth_access_grants_code_challenge_method')
+ end
+
+ def down
+ remove_column(:oauth_access_grants, :code_challenge)
+ remove_column(:oauth_access_grants, :code_challenge_method)
+ end
+end
diff --git a/db/migrate/20201209193551_add_version_sha_cache_to_composer_metadata.rb b/db/migrate/20201209193551_add_version_sha_cache_to_composer_metadata.rb
new file mode 100644
index 00000000000..62d0cdae8bc
--- /dev/null
+++ b/db/migrate/20201209193551_add_version_sha_cache_to_composer_metadata.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddVersionShaCacheToComposerMetadata < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :packages_composer_metadata, :version_cache_sha, :binary, null: true
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :packages_composer_metadata, :version_cache_sha, :binary
+ end
+ end
+end
diff --git a/db/migrate/20201214000000_change_mr_allow_maintainer_to_push_default.rb b/db/migrate/20201214000000_change_mr_allow_maintainer_to_push_default.rb
new file mode 100644
index 00000000000..0d97d54f3e4
--- /dev/null
+++ b/db/migrate/20201214000000_change_mr_allow_maintainer_to_push_default.rb
@@ -0,0 +1,17 @@
+class ChangeMrAllowMaintainerToPushDefault < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ change_column_default :merge_requests, :allow_maintainer_to_push, from: nil, to: true
+ end
+ end
+
+ def down
+ with_lock_retries do
+ change_column_default :merge_requests, :allow_maintainer_to_push, from: true, to: nil
+ end
+ end
+end
diff --git a/db/migrate/20201214032220_add_has_external_wiki_trigger.rb b/db/migrate/20201214032220_add_has_external_wiki_trigger.rb
new file mode 100644
index 00000000000..f6e066b75da
--- /dev/null
+++ b/db/migrate/20201214032220_add_has_external_wiki_trigger.rb
@@ -0,0 +1,52 @@
+# frozen_string_literal: true
+
+class AddHasExternalWikiTrigger < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::SchemaHelpers
+
+ DOWNTIME = false
+ FUNCTION_NAME = 'set_has_external_wiki'.freeze
+ TRIGGER_ON_INSERT_NAME = 'trigger_has_external_wiki_on_insert'.freeze
+ TRIGGER_ON_UPDATE_NAME = 'trigger_has_external_wiki_on_update'.freeze
+ TRIGGER_ON_DELETE_NAME = 'trigger_has_external_wiki_on_delete'.freeze
+
+ def up
+ create_trigger_function(FUNCTION_NAME, replace: true) do
+ <<~SQL
+ UPDATE projects SET has_external_wiki = COALESCE(NEW.active, FALSE)
+ WHERE projects.id = COALESCE(NEW.project_id, OLD.project_id);
+ RETURN NULL;
+ SQL
+ end
+
+ execute(<<~SQL)
+ CREATE TRIGGER #{TRIGGER_ON_INSERT_NAME}
+ AFTER INSERT ON services
+ FOR EACH ROW
+ WHEN (NEW.active = TRUE AND NEW.type = 'ExternalWikiService' AND NEW.project_id IS NOT NULL)
+ EXECUTE FUNCTION #{FUNCTION_NAME}();
+ SQL
+
+ execute(<<~SQL)
+ CREATE TRIGGER #{TRIGGER_ON_UPDATE_NAME}
+ AFTER UPDATE ON services
+ FOR EACH ROW
+ WHEN (NEW.type = 'ExternalWikiService' AND OLD.active != NEW.active AND NEW.project_id IS NOT NULL)
+ EXECUTE FUNCTION #{FUNCTION_NAME}();
+ SQL
+
+ execute(<<~SQL)
+ CREATE TRIGGER #{TRIGGER_ON_DELETE_NAME}
+ AFTER DELETE ON services
+ FOR EACH ROW
+ WHEN (OLD.type = 'ExternalWikiService' AND OLD.project_id IS NOT NULL)
+ EXECUTE FUNCTION #{FUNCTION_NAME}();
+ SQL
+ end
+
+ def down
+ drop_trigger(:services, TRIGGER_ON_INSERT_NAME)
+ drop_trigger(:services, TRIGGER_ON_UPDATE_NAME)
+ drop_trigger(:services, TRIGGER_ON_DELETE_NAME)
+ drop_function(FUNCTION_NAME)
+ end
+end
diff --git a/db/migrate/20201214111858_add_container_registry_cleanup_tags_service_max_list_size_to_application_settings.rb b/db/migrate/20201214111858_add_container_registry_cleanup_tags_service_max_list_size_to_application_settings.rb
new file mode 100644
index 00000000000..312220914c1
--- /dev/null
+++ b/db/migrate/20201214111858_add_container_registry_cleanup_tags_service_max_list_size_to_application_settings.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddContainerRegistryCleanupTagsServiceMaxListSizeToApplicationSettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ add_column(:application_settings, :container_registry_cleanup_tags_service_max_list_size, :integer, default: 200, null: false)
+ end
+end
diff --git a/db/migrate/20201214112752_add_app_settings_container_reg_cleanup_tags_service_max_list_size_constraint.rb b/db/migrate/20201214112752_add_app_settings_container_reg_cleanup_tags_service_max_list_size_constraint.rb
new file mode 100644
index 00000000000..935dd641b4c
--- /dev/null
+++ b/db/migrate/20201214112752_add_app_settings_container_reg_cleanup_tags_service_max_list_size_constraint.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddAppSettingsContainerRegCleanupTagsServiceMaxListSizeConstraint < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ CONSTRAINT_NAME = 'app_settings_container_reg_cleanup_tags_max_list_size_positive'
+
+ disable_ddl_transaction!
+
+ def up
+ add_check_constraint :application_settings, 'container_registry_cleanup_tags_service_max_list_size >= 0', CONSTRAINT_NAME
+ end
+
+ def down
+ remove_check_constraint :application_settings, CONSTRAINT_NAME
+ end
+end
diff --git a/db/migrate/20201214184020_add_epic_board_list.rb b/db/migrate/20201214184020_add_epic_board_list.rb
new file mode 100644
index 00000000000..9c4e3280754
--- /dev/null
+++ b/db/migrate/20201214184020_add_epic_board_list.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class AddEpicBoardList < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:boards_epic_lists)
+ with_lock_retries do
+ create_table :boards_epic_lists do |t|
+ t.timestamps_with_timezone
+ t.references :epic_board, index: true, foreign_key: { to_table: :boards_epic_boards, on_delete: :cascade }, null: false
+ t.references :label, index: true, foreign_key: { on_delete: :cascade }
+ t.integer :position
+ t.integer :list_type, default: 1, limit: 2, null: false
+
+ t.index [:epic_board_id, :label_id], unique: true, where: 'list_type = 1', name: 'index_boards_epic_lists_on_epic_board_id_and_label_id'
+ end
+ end
+ end
+
+ add_check_constraint :boards_epic_lists, '(list_type <> 1) OR ("position" IS NOT NULL AND "position" >= 0)', 'boards_epic_lists_position_constraint'
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :boards_epic_lists
+ end
+ end
+end
diff --git a/db/migrate/20201215205404_create_namespace_package_settings.rb b/db/migrate/20201215205404_create_namespace_package_settings.rb
new file mode 100644
index 00000000000..d74b99597ce
--- /dev/null
+++ b/db/migrate/20201215205404_create_namespace_package_settings.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class CreateNamespacePackageSettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ create_table :namespace_package_settings, if_not_exists: true, id: false do |t|
+ t.references :namespace, primary_key: true, index: false, default: nil, foreign_key: { to_table: :namespaces, on_delete: :cascade }, type: :bigint
+ t.boolean :maven_duplicates_allowed, null: false, default: true
+ t.text :maven_duplicate_exception_regex, null: false, default: ''
+ end
+ end
+
+ add_text_limit :namespace_package_settings, :maven_duplicate_exception_regex, 255
+ end
+
+ def down
+ drop_table :namespace_package_settings
+ end
+end
diff --git a/db/migrate/20201216151616_add_squash_commit_sha_index.rb b/db/migrate/20201216151616_add_squash_commit_sha_index.rb
new file mode 100644
index 00000000000..ac6d3fda2d2
--- /dev/null
+++ b/db/migrate/20201216151616_add_squash_commit_sha_index.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddSquashCommitShaIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = "index_merge_requests_on_target_project_id_and_squash_commit_sha"
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :merge_requests,
+ [:target_project_id, :squash_commit_sha],
+ name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :merge_requests,
+ [:target_project_id, :squash_commit_sha],
+ name: INDEX_NAME
+ end
+end
diff --git a/db/migrate/20201216154457_add_devops_adoption_snapshot_range_end.rb b/db/migrate/20201216154457_add_devops_adoption_snapshot_range_end.rb
new file mode 100644
index 00000000000..ada1bd9b346
--- /dev/null
+++ b/db/migrate/20201216154457_add_devops_adoption_snapshot_range_end.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddDevopsAdoptionSnapshotRangeEnd < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ add_column :analytics_devops_adoption_snapshots, :end_time, :datetime_with_timezone
+ end
+end
diff --git a/db/migrate/20201217070530_add_group_merge_request_approval_settings.rb b/db/migrate/20201217070530_add_group_merge_request_approval_settings.rb
new file mode 100644
index 00000000000..dba9e6e440f
--- /dev/null
+++ b/db/migrate/20201217070530_add_group_merge_request_approval_settings.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddGroupMergeRequestApprovalSettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ create_table :group_merge_request_approval_settings, id: false do |t|
+ t.timestamps_with_timezone null: false
+ t.references :group, references: :namespaces, primary_key: true, default: nil, index: false,
+ foreign_key: { to_table: :namespaces, on_delete: :cascade }
+ t.boolean :allow_author_approval, null: false, default: false
+ end
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :group_merge_request_approval_settings
+ end
+ end
+end
diff --git a/db/migrate/20201217132603_create_elastic_reindexing_subtasks.rb b/db/migrate/20201217132603_create_elastic_reindexing_subtasks.rb
new file mode 100644
index 00000000000..db084b885c2
--- /dev/null
+++ b/db/migrate/20201217132603_create_elastic_reindexing_subtasks.rb
@@ -0,0 +1,56 @@
+# frozen_string_literal: true
+
+class CreateElasticReindexingSubtasks < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ class ReindexingTask < ActiveRecord::Base
+ self.table_name = 'elastic_reindexing_tasks'
+ end
+
+ class ReindexingSubtask < ActiveRecord::Base
+ self.table_name = 'elastic_reindexing_subtasks'
+ end
+
+ def up
+ unless table_exists?(:elastic_reindexing_subtasks)
+ create_table :elastic_reindexing_subtasks do |t|
+ t.references :elastic_reindexing_task, foreign_key: { on_delete: :cascade }, null: false
+ t.text :alias_name, null: false
+ t.text :index_name_from, null: false
+ t.text :index_name_to, null: false
+ t.text :elastic_task, null: false
+ t.integer :documents_count_target
+ t.integer :documents_count
+ t.timestamps_with_timezone null: false
+ end
+ end
+
+ add_text_limit :elastic_reindexing_subtasks, :index_name_from, 255
+ add_text_limit :elastic_reindexing_subtasks, :index_name_to, 255
+ add_text_limit :elastic_reindexing_subtasks, :elastic_task, 255
+ add_text_limit :elastic_reindexing_subtasks, :alias_name, 255
+
+ ReindexingTask.find_each do |task|
+ next if task.index_name_from.blank? || task.index_name_to.blank? || task.elastic_task.blank?
+ next if ReindexingSubtask.where(elastic_reindexing_task_id: task.id).exists?
+
+ ReindexingSubtask.create(
+ elastic_reindexing_task_id: task.id,
+ documents_count_target: task.documents_count_target,
+ documents_count: task.documents_count,
+ alias_name: 'gitlab-production',
+ index_name_from: task.index_name_from,
+ index_name_to: task.index_name_to,
+ elastic_task: task.elastic_task
+ )
+ end
+ end
+
+ def down
+ drop_table :elastic_reindexing_subtasks
+ end
+end
diff --git a/db/migrate/20201221124036_add_devops_snapshot_index.rb b/db/migrate/20201221124036_add_devops_snapshot_index.rb
new file mode 100644
index 00000000000..85001e9abcf
--- /dev/null
+++ b/db/migrate/20201221124036_add_devops_snapshot_index.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddDevopsSnapshotIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_on_snapshots_segment_id_end_time'
+
+ def up
+ add_concurrent_index :analytics_devops_adoption_snapshots, [:segment_id, :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/20201221213415_change_clusters_helm_major_version_default_to_3.rb b/db/migrate/20201221213415_change_clusters_helm_major_version_default_to_3.rb
new file mode 100644
index 00000000000..baec0da208b
--- /dev/null
+++ b/db/migrate/20201221213415_change_clusters_helm_major_version_default_to_3.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class ChangeClustersHelmMajorVersionDefaultTo3 < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ change_column_default(:clusters, :helm_major_version, from: 2, to: 3)
+ end
+end
diff --git a/db/migrate/20201223114050_add_restrict_user_defined_variables_to_project_settings.rb b/db/migrate/20201223114050_add_restrict_user_defined_variables_to_project_settings.rb
new file mode 100644
index 00000000000..d04c6981bf9
--- /dev/null
+++ b/db/migrate/20201223114050_add_restrict_user_defined_variables_to_project_settings.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddRestrictUserDefinedVariablesToProjectSettings < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :project_ci_cd_settings, :restrict_user_defined_variables, :boolean, default: false, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :project_ci_cd_settings, :restrict_user_defined_variables
+ end
+ end
+end
diff --git a/db/migrate/20201224144948_migrate_coverage_report_worker.rb b/db/migrate/20201224144948_migrate_coverage_report_worker.rb
new file mode 100644
index 00000000000..a13e5e859e0
--- /dev/null
+++ b/db/migrate/20201224144948_migrate_coverage_report_worker.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class MigrateCoverageReportWorker < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ sidekiq_queue_migrate 'ci_pipelines_create_artifact', to: 'ci_pipeline_artifacts_coverage_report'
+ end
+
+ def down
+ sidekiq_queue_migrate 'ci_pipeline_artifacts_coverage_report', to: 'ci_pipelines_create_artifact'
+ end
+end
diff --git a/db/migrate/20201228184500_add_dismissal_reason_into_vulnerability_feedback_table.rb b/db/migrate/20201228184500_add_dismissal_reason_into_vulnerability_feedback_table.rb
new file mode 100644
index 00000000000..92484aced4e
--- /dev/null
+++ b/db/migrate/20201228184500_add_dismissal_reason_into_vulnerability_feedback_table.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddDismissalReasonIntoVulnerabilityFeedbackTable < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ add_column :vulnerability_feedback, :dismissal_reason, :smallint
+ end
+
+ def down
+ remove_column :vulnerability_feedback, :dismissal_reason
+ end
+end
diff --git a/db/migrate/20201229105948_add_invisible_captcha_enabled_to_settings.rb b/db/migrate/20201229105948_add_invisible_captcha_enabled_to_settings.rb
new file mode 100644
index 00000000000..025fcba0729
--- /dev/null
+++ b/db/migrate/20201229105948_add_invisible_captcha_enabled_to_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddInvisibleCaptchaEnabledToSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :invisible_captcha_enabled, :boolean, null: false, default: false
+ end
+end
diff --git a/db/migrate/20201230161206_add_rate_limiting_response_text_to_application_settings.rb b/db/migrate/20201230161206_add_rate_limiting_response_text_to_application_settings.rb
new file mode 100644
index 00000000000..647455f5f88
--- /dev/null
+++ b/db/migrate/20201230161206_add_rate_limiting_response_text_to_application_settings.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class AddRateLimitingResponseTextToApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in 20210101110640_set_limit_for_rate_limiting_response_text
+ def change
+ add_column :application_settings, :rate_limiting_response_text, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20201230180202_create_onboarding_progress.rb b/db/migrate/20201230180202_create_onboarding_progress.rb
new file mode 100644
index 00000000000..b9fe64eb19d
--- /dev/null
+++ b/db/migrate/20201230180202_create_onboarding_progress.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+class CreateOnboardingProgress < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ create_table :onboarding_progresses do |t|
+ t.references :namespace, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade }
+ t.timestamps_with_timezone null: false
+ t.datetime_with_timezone :git_pull_at
+ t.datetime_with_timezone :git_write_at
+ t.datetime_with_timezone :merge_request_created_at
+ t.datetime_with_timezone :pipeline_created_at
+ t.datetime_with_timezone :user_added_at
+ t.datetime_with_timezone :trial_started_at
+ t.datetime_with_timezone :subscription_created_at
+ t.datetime_with_timezone :required_mr_approvals_enabled_at
+ t.datetime_with_timezone :code_owners_enabled_at
+ t.datetime_with_timezone :scoped_label_created_at
+ t.datetime_with_timezone :security_scan_enabled_at
+ t.datetime_with_timezone :issue_auto_closed_at
+ t.datetime_with_timezone :repository_imported_at
+ t.datetime_with_timezone :repository_mirrored_at
+ end
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :onboarding_progresses
+ end
+ end
+end
diff --git a/db/migrate/20210101110640_set_limit_for_rate_limiting_response_text.rb b/db/migrate/20210101110640_set_limit_for_rate_limiting_response_text.rb
new file mode 100644
index 00000000000..b72f2ae7d70
--- /dev/null
+++ b/db/migrate/20210101110640_set_limit_for_rate_limiting_response_text.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class SetLimitForRateLimitingResponseText < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :application_settings, :rate_limiting_response_text, 255
+ end
+
+ def down
+ remove_text_limit :application_settings, :rate_limiting_response_text
+ end
+end
diff --git a/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb b/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb
new file mode 100644
index 00000000000..0ecf194eb97
--- /dev/null
+++ b/db/migrate/20210102164121_drop_temporary_index_on_ci_builds.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class DropTemporaryIndexOnCiBuilds < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX = 'tmp_build_stage_position_index'.freeze
+
+ def up
+ remove_concurrent_index_by_name :ci_builds, INDEX
+ end
+
+ def down
+ add_concurrent_index :ci_builds, [:stage_id, :stage_idx], where: 'stage_idx IS NOT NULL', name: INDEX
+ end
+end
diff --git a/db/migrate/20210104163218_add_epic_board_position_index.rb b/db/migrate/20210104163218_add_epic_board_position_index.rb
new file mode 100644
index 00000000000..32c829f0288
--- /dev/null
+++ b/db/migrate/20210104163218_add_epic_board_position_index.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddEpicBoardPositionIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_boards_epic_board_positions_on_scoped_relative_position'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :boards_epic_board_positions, [:epic_board_id, :epic_id, :relative_position], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :boards_epic_board_positions, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20210106153021_drop_tmp_index_on_emails.rb b/db/migrate/20210106153021_drop_tmp_index_on_emails.rb
new file mode 100644
index 00000000000..94b4a5437af
--- /dev/null
+++ b/db/migrate/20210106153021_drop_tmp_index_on_emails.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class DropTmpIndexOnEmails < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ EMAIL_INDEX_NAME = 'tmp_index_for_email_unconfirmation_migration'
+
+ disable_ddl_transaction!
+
+ def up
+ Gitlab::BackgroundMigration.steal('WrongfullyConfirmedEmailUnconfirmer')
+
+ remove_concurrent_index_by_name(:emails, EMAIL_INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:emails, :id, where: 'confirmed_at IS NOT NULL', name: EMAIL_INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210108161039_update_max_import_size_default.rb b/db/migrate/20210108161039_update_max_import_size_default.rb
new file mode 100644
index 00000000000..5f0591b2766
--- /dev/null
+++ b/db/migrate/20210108161039_update_max_import_size_default.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class UpdateMaxImportSizeDefault < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ change_column_default(:application_settings, :max_import_size, from: 50, to: 0)
+ end
+end
diff --git a/db/migrate/20210112084512_drop_tmp_index_on_emails_again.rb b/db/migrate/20210112084512_drop_tmp_index_on_emails_again.rb
new file mode 100644
index 00000000000..6c2f9cbcb32
--- /dev/null
+++ b/db/migrate/20210112084512_drop_tmp_index_on_emails_again.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class DropTmpIndexOnEmailsAgain < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ EMAIL_INDEX_NAME = 'tmp_index_for_email_unconfirmation_migration'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name(:emails, EMAIL_INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:emails, :id, where: 'confirmed_at IS NOT NULL', name: EMAIL_INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20210114033715_remove_group_id_title_index.rb b/db/migrate/20210114033715_remove_group_id_title_index.rb
new file mode 100644
index 00000000000..8d63da3d400
--- /dev/null
+++ b/db/migrate/20210114033715_remove_group_id_title_index.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class RemoveGroupIdTitleIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_labels_on_group_id_and_title_with_null_project_id'
+ LABELS_TABLE = :labels
+
+ def up
+ remove_concurrent_index_by_name LABELS_TABLE, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index LABELS_TABLE, [:group_id, :title], where: 'project_id IS NULL', name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20190402224749_schedule_merge_request_assignees_migration_progress_check.rb b/db/post_migrate/20190402224749_schedule_merge_request_assignees_migration_progress_check.rb
index 6fb67deb834..8ec6a4a24ec 100644
--- a/db/post_migrate/20190402224749_schedule_merge_request_assignees_migration_progress_check.rb
+++ b/db/post_migrate/20190402224749_schedule_merge_request_assignees_migration_progress_check.rb
@@ -3,7 +3,7 @@
class ScheduleMergeRequestAssigneesMigrationProgressCheck < ActiveRecord::Migration[5.0]
include Gitlab::Database::MigrationHelpers
- MIGRATION = 'MergeRequestAssigneesMigrationProgressCheck'.freeze
+ MIGRATION = 'MergeRequestAssigneesMigrationProgressCheck'
DOWNTIME = false
diff --git a/db/post_migrate/20190506135400_schedule_sync_issuables_state_id_where_nil.rb b/db/post_migrate/20190506135400_schedule_sync_issuables_state_id_where_nil.rb
index cee99f7cf2e..845c855358b 100644
--- a/db/post_migrate/20190506135400_schedule_sync_issuables_state_id_where_nil.rb
+++ b/db/post_migrate/20190506135400_schedule_sync_issuables_state_id_where_nil.rb
@@ -20,8 +20,8 @@ class ScheduleSyncIssuablesStateIdWhereNil < ActiveRecord::Migration[5.1]
#
BATCH_SIZE = 5000
DELAY_INTERVAL = 120.seconds.to_i
- ISSUES_MIGRATION = 'SyncIssuesStateId'.freeze
- MERGE_REQUESTS_MIGRATION = 'SyncMergeRequestsStateId'.freeze
+ ISSUES_MIGRATION = 'SyncIssuesStateId'
+ MERGE_REQUESTS_MIGRATION = 'SyncMergeRequestsStateId'
disable_ddl_transaction!
diff --git a/db/post_migrate/20190611161642_add_index_to_events_and_audit_events_created_at_author_id.rb b/db/post_migrate/20190611161642_add_index_to_events_and_audit_events_created_at_author_id.rb
index 342e83d6322..5b9afbe128c 100644
--- a/db/post_migrate/20190611161642_add_index_to_events_and_audit_events_created_at_author_id.rb
+++ b/db/post_migrate/20190611161642_add_index_to_events_and_audit_events_created_at_author_id.rb
@@ -7,9 +7,9 @@ class AddIndexToEventsAndAuditEventsCreatedAtAuthorId < ActiveRecord::Migration[
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
- INDEX_NAME = 'analytics_index_%s_on_created_at_and_author_id'.freeze
- EVENTS_INDEX_NAME = (INDEX_NAME % 'events').freeze
- AUDIT_EVENTS_INDEX_NAME = (INDEX_NAME % 'audit_events').freeze
+ INDEX_NAME = 'analytics_index_%s_on_created_at_and_author_id'
+ EVENTS_INDEX_NAME = (INDEX_NAME % 'events')
+ AUDIT_EVENTS_INDEX_NAME = (INDEX_NAME % 'audit_events')
disable_ddl_transaction!
diff --git a/db/post_migrate/20191030223057_backfill_version_author_and_created_at.rb b/db/post_migrate/20191030223057_backfill_version_author_and_created_at.rb
index 7a6d0b089a0..5fcec83bfc3 100644
--- a/db/post_migrate/20191030223057_backfill_version_author_and_created_at.rb
+++ b/db/post_migrate/20191030223057_backfill_version_author_and_created_at.rb
@@ -2,7 +2,7 @@
class BackfillVersionAuthorAndCreatedAt < ActiveRecord::Migration[5.2]
DOWNTIME = false
- MIGRATION = 'BackfillVersionDataFromGitaly'.freeze
+ MIGRATION = 'BackfillVersionDataFromGitaly'
BATCH_SIZE = 500
disable_ddl_transaction!
diff --git a/db/post_migrate/20191104142124_nullify_users_role.rb b/db/post_migrate/20191104142124_nullify_users_role.rb
index 540d58e95ba..ab8eae46745 100644
--- a/db/post_migrate/20191104142124_nullify_users_role.rb
+++ b/db/post_migrate/20191104142124_nullify_users_role.rb
@@ -4,7 +4,7 @@ class NullifyUsersRole < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
- INDEX_NAME = 'partial_index_users_updated_at_for_cleaning_mistaken_values'.freeze
+ INDEX_NAME = 'partial_index_users_updated_at_for_cleaning_mistaken_values'
DOWNTIME = false
diff --git a/db/post_migrate/20200207185149_schedule_fix_orphan_promoted_issues.rb b/db/post_migrate/20200207185149_schedule_fix_orphan_promoted_issues.rb
index 83ba56501dd..d25d6ed2dc7 100644
--- a/db/post_migrate/20200207185149_schedule_fix_orphan_promoted_issues.rb
+++ b/db/post_migrate/20200207185149_schedule_fix_orphan_promoted_issues.rb
@@ -5,7 +5,7 @@ class ScheduleFixOrphanPromotedIssues < ActiveRecord::Migration[5.2]
DOWNTIME = false
BATCH_SIZE = 100
- BACKGROUND_MIGRATION = 'FixOrphanPromotedIssues'.freeze
+ BACKGROUND_MIGRATION = 'FixOrphanPromotedIssues'
disable_ddl_transaction!
diff --git a/db/post_migrate/20200217225719_schedule_migrate_security_scans.rb b/db/post_migrate/20200217225719_schedule_migrate_security_scans.rb
index 7ef204ed9de..087c189f9fd 100644
--- a/db/post_migrate/20200217225719_schedule_migrate_security_scans.rb
+++ b/db/post_migrate/20200217225719_schedule_migrate_security_scans.rb
@@ -6,7 +6,7 @@ class ScheduleMigrateSecurityScans < ActiveRecord::Migration[5.2]
DOWNTIME = false
INTERVAL = 2.minutes.to_i
BATCH_SIZE = 10_000
- MIGRATION = 'MigrateSecurityScans'.freeze
+ MIGRATION = 'MigrateSecurityScans'
disable_ddl_transaction!
diff --git a/db/post_migrate/20200716234259_remove_duplicate_labels_from_group.rb b/db/post_migrate/20200716234259_remove_duplicate_labels_from_group.rb
new file mode 100644
index 00000000000..f19a209092b
--- /dev/null
+++ b/db/post_migrate/20200716234259_remove_duplicate_labels_from_group.rb
@@ -0,0 +1,135 @@
+# frozen_string_literal: true
+
+class RemoveDuplicateLabelsFromGroup < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ CREATE = 1
+ RENAME = 2
+
+ disable_ddl_transaction!
+
+ class BackupLabel < ApplicationRecord
+ include EachBatch
+
+ self.table_name = 'backup_labels'
+ end
+
+ class Label < ApplicationRecord
+ self.table_name = 'labels'
+ end
+
+ class Group < ApplicationRecord
+ include EachBatch
+
+ self.table_name = 'namespaces'
+ end
+
+ BATCH_SIZE = 10_000
+
+ def up
+ # Split to smaller chunks
+ # Loop rather than background job, every 10,000
+ # there are ~1,800,000 groups in total (excluding personal namespaces, which can't have labels)
+ Group.where(type: 'Group').each_batch(of: BATCH_SIZE) do |batch|
+ range = batch.pluck('MIN(id)', 'MAX(id)').first
+
+ transaction do
+ remove_full_duplicates(*range)
+ end
+
+ transaction do
+ rename_partial_duplicates(*range)
+ end
+ end
+ end
+
+ DOWN_BATCH_SIZE = 1000
+
+ def down
+ BackupLabel.where('project_id IS NULL AND group_id IS NOT NULL').each_batch(of: DOWN_BATCH_SIZE) do |batch|
+ range = batch.pluck('MIN(id)', 'MAX(id)').first
+
+ restore_renamed_labels(*range)
+ restore_deleted_labels(*range)
+ end
+ end
+
+ def remove_full_duplicates(start_id, stop_id)
+ # Fields that are considered duplicate:
+ # group_id title template description type color
+
+ duplicate_labels = ApplicationRecord.connection.execute(<<-SQL.squish)
+WITH data AS (
+ SELECT labels.*,
+ row_number() OVER (PARTITION BY labels.group_id, labels.title, labels.template, labels.description, labels.type, labels.color ORDER BY labels.id) AS row_number,
+ #{CREATE} AS restore_action
+ FROM labels
+ WHERE labels.group_id BETWEEN #{start_id} AND #{stop_id}
+ AND NOT EXISTS (SELECT * FROM board_labels WHERE board_labels.label_id = labels.id)
+ AND NOT EXISTS (SELECT * FROM label_links WHERE label_links.label_id = labels.id)
+ AND NOT EXISTS (SELECT * FROM label_priorities WHERE label_priorities.label_id = labels.id)
+ AND NOT EXISTS (SELECT * FROM lists WHERE lists.label_id = labels.id)
+ AND NOT EXISTS (SELECT * FROM resource_label_events WHERE resource_label_events.label_id = labels.id)
+) SELECT * FROM data WHERE row_number > 1;
+ SQL
+
+ if duplicate_labels.any?
+ # create backup records
+ BackupLabel.insert_all!(duplicate_labels.map { |label| label.except("row_number") })
+
+ Label.unscoped.where(id: duplicate_labels.pluck("id")).delete_all
+ end
+ end
+
+ def rename_partial_duplicates(start_id, stop_id)
+ # We need to ensure that the new title (with `_duplicate#{ID}`) doesn't exceed the limit.
+ # Truncate the original title (if needed) to 245 characters minus the length of the ID
+ # then add `_duplicate#{ID}`
+
+ soft_duplicates = ApplicationRecord.connection.execute(<<-SQL.squish)
+WITH data AS (
+ SELECT
+ *,
+ substring(title from 1 for 245 - length(id::text)) || '_duplicate' || id::text as new_title,
+ #{RENAME} AS restore_action,
+ row_number() OVER (PARTITION BY group_id, title ORDER BY id) AS row_number
+ FROM labels
+ WHERE group_id BETWEEN #{start_id} AND #{stop_id}
+) SELECT * FROM data WHERE row_number > 1;
+ SQL
+
+ if soft_duplicates.any?
+ # create backup records
+ BackupLabel.insert_all!(soft_duplicates.map { |label| label.except("row_number") })
+
+ ApplicationRecord.connection.execute(<<-SQL.squish)
+UPDATE labels SET title = substring(title from 1 for 245 - length(id::text)) || '_duplicate' || id::text
+WHERE labels.id IN (#{soft_duplicates.map { |dup| dup["id"] }.join(", ")});
+ SQL
+ end
+ end
+
+ def restore_renamed_labels(start_id, stop_id)
+ # the backup label IDs are not incremental, they are copied directly from the Labels table
+ ApplicationRecord.connection.execute(<<-SQL.squish)
+WITH backups AS (
+ SELECT id, title
+ FROM backup_labels
+ WHERE id BETWEEN #{start_id} AND #{stop_id}
+ AND restore_action = #{RENAME}
+) UPDATE labels SET title = backups.title
+FROM backups
+WHERE labels.id = backups.id;
+ SQL
+ end
+
+ def restore_deleted_labels(start_id, stop_id)
+ ActiveRecord::Base.connection.execute(<<-SQL.squish)
+INSERT INTO labels
+SELECT id, title, color, group_id, created_at, updated_at, template, description, description_html, type, cached_markdown_version FROM backup_labels
+ WHERE backup_labels.id BETWEEN #{start_id} AND #{stop_id}
+ AND backup_labels.project_id IS NULL AND backup_labels.group_id IS NOT NULL
+ AND backup_labels.restore_action = #{CREATE}
+ SQL
+ end
+end
diff --git a/db/post_migrate/20200716234518_add_uniqueness_index_to_label_title_and_group.rb b/db/post_migrate/20200716234518_add_uniqueness_index_to_label_title_and_group.rb
new file mode 100644
index 00000000000..08bab811c00
--- /dev/null
+++ b/db/post_migrate/20200716234518_add_uniqueness_index_to_label_title_and_group.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddUniquenessIndexToLabelTitleAndGroup < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ GROUP_AND_TITLE = [:group_id, :title]
+
+ def up
+ add_concurrent_index :labels, GROUP_AND_TITLE, where: "labels.project_id IS NULL", unique: true, name: "index_labels_on_group_id_and_title_unique"
+ remove_concurrent_index :labels, GROUP_AND_TITLE, name: "index_labels_on_group_id_and_title"
+ end
+
+ def down
+ add_concurrent_index :labels, GROUP_AND_TITLE, where: "labels.project_id IS NULL", unique: false, name: "index_labels_on_group_id_and_title"
+ remove_concurrent_index :labels, GROUP_AND_TITLE, name: "index_labels_on_group_id_and_title_unique"
+ end
+end
diff --git a/db/post_migrate/20201207165956_remove_duplicate_services.rb b/db/post_migrate/20201207165956_remove_duplicate_services.rb
new file mode 100644
index 00000000000..1659b9a2095
--- /dev/null
+++ b/db/post_migrate/20201207165956_remove_duplicate_services.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class RemoveDuplicateServices < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ # noop, replaced by 20210112143418_remove_duplicate_services.rb
+ end
+
+ def down
+ end
+end
diff --git a/db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb b/db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb
new file mode 100644
index 00000000000..f11c0bbe33a
--- /dev/null
+++ b/db/post_migrate/20201208175117_schedule_backfilling_artifact_expiry_migration.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+class ScheduleBackfillingArtifactExpiryMigration < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ SWITCH_DATE = Time.utc(2020, 6, 22).freeze
+ INDEX_NAME = 'expired_artifacts_temp_index'.freeze
+ INDEX_CONDITION = "expire_at IS NULL AND created_at < '#{SWITCH_DATE}'"
+
+ disable_ddl_transaction!
+
+ class JobArtifact < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'ci_job_artifacts'
+
+ scope :without_expiry_date, -> { where(expire_at: nil) }
+ scope :before_switch, -> { where('created_at < ?', SWITCH_DATE) }
+ end
+
+ def up
+ # Create temporary index for expired artifacts
+ # Needs to be removed in a later migration
+ add_concurrent_index(:ci_job_artifacts, %i(id created_at), where: INDEX_CONDITION, name: INDEX_NAME)
+
+ queue_background_migration_jobs_by_range_at_intervals(
+ JobArtifact.without_expiry_date.before_switch,
+ ::Gitlab::BackgroundMigration::BackfillArtifactExpiryDate,
+ 2.minutes,
+ batch_size: 200_000
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20201211090634_schedule_populate_finding_uuid_for_vulnerability_feedback.rb b/db/post_migrate/20201211090634_schedule_populate_finding_uuid_for_vulnerability_feedback.rb
new file mode 100644
index 00000000000..3ecb48dab0f
--- /dev/null
+++ b/db/post_migrate/20201211090634_schedule_populate_finding_uuid_for_vulnerability_feedback.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class SchedulePopulateFindingUuidForVulnerabilityFeedback < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ MIGRATION_CLASS = 'PopulateFindingUuidForVulnerabilityFeedback'
+ DELAY_INTERVAL = 2.minutes
+ BATCH_SIZE = 1000
+
+ disable_ddl_transaction!
+
+ def up
+ queue_background_migration_jobs_by_range_at_intervals(
+ Gitlab::BackgroundMigration::PopulateFindingUuidForVulnerabilityFeedback::VulnerabilityFeedback,
+ MIGRATION_CLASS,
+ DELAY_INTERVAL,
+ batch_size: BATCH_SIZE
+ )
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20201216185336_add_devops_adoption_snapshot_not_null.rb b/db/post_migrate/20201216185336_add_devops_adoption_snapshot_not_null.rb
new file mode 100644
index 00000000000..1bb3c57f3cd
--- /dev/null
+++ b/db/post_migrate/20201216185336_add_devops_adoption_snapshot_not_null.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class AddDevopsAdoptionSnapshotNotNull < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ execute(
+ <<~SQL
+ LOCK TABLE analytics_devops_adoption_snapshots IN ACCESS EXCLUSIVE MODE;
+
+ UPDATE analytics_devops_adoption_snapshots SET end_time = date_trunc('month', recorded_at) - interval '1 millisecond';
+
+ ALTER TABLE analytics_devops_adoption_snapshots ALTER COLUMN end_time SET NOT NULL;
+ SQL
+ )
+ end
+ end
+
+ def down
+ with_lock_retries do
+ execute(<<~SQL)
+ ALTER TABLE analytics_devops_adoption_snapshots ALTER COLUMN end_time DROP NOT NULL;
+ SQL
+ end
+ end
+end
diff --git a/db/post_migrate/20201223012231_reindex_ci_pipelines_on_schedule_id_and_id.rb b/db/post_migrate/20201223012231_reindex_ci_pipelines_on_schedule_id_and_id.rb
new file mode 100644
index 00000000000..9ed1aea911a
--- /dev/null
+++ b/db/post_migrate/20201223012231_reindex_ci_pipelines_on_schedule_id_and_id.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class ReindexCiPipelinesOnScheduleIdAndId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ OLD_INDEX_NAME = 'index_ci_pipelines_on_pipeline_schedule_id'
+ NEW_INDEX_NAME = 'index_ci_pipelines_on_pipeline_schedule_id_and_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_pipelines, [:pipeline_schedule_id, :id], name: NEW_INDEX_NAME
+ remove_concurrent_index_by_name :ci_pipelines, OLD_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :ci_pipelines, :pipeline_schedule_id, name: OLD_INDEX_NAME
+ remove_concurrent_index_by_name :ci_pipelines, NEW_INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20210105103649_delete_column_group_id_on_compliance_framework.rb b/db/post_migrate/20210105103649_delete_column_group_id_on_compliance_framework.rb
new file mode 100644
index 00000000000..b13d2fe2d0a
--- /dev/null
+++ b/db/post_migrate/20210105103649_delete_column_group_id_on_compliance_framework.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class DeleteColumnGroupIdOnComplianceFramework < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ remove_column :compliance_management_frameworks, :group_id, :bigint
+ end
+end
diff --git a/db/post_migrate/20210107194543_remove_alerts_service_records.rb b/db/post_migrate/20210107194543_remove_alerts_service_records.rb
new file mode 100644
index 00000000000..51a2f96ac7f
--- /dev/null
+++ b/db/post_migrate/20210107194543_remove_alerts_service_records.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class RemoveAlertsServiceRecords < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ class Service < ActiveRecord::Base
+ self.table_name = 'services'
+ end
+
+ def up
+ Service.delete_by(type: 'AlertsService')
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20210112143418_remove_duplicate_services2.rb b/db/post_migrate/20210112143418_remove_duplicate_services2.rb
new file mode 100644
index 00000000000..83d92a78473
--- /dev/null
+++ b/db/post_migrate/20210112143418_remove_duplicate_services2.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+# This replaces the previous post-deployment migration 20201207165956_remove_duplicate_services_spec.rb,
+# we have to run this again due to a bug in how we were receiving the arguments in the background migration.
+class RemoveDuplicateServices2 < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INTERVAL = 2.minutes
+ BATCH_SIZE = 5_000
+ MIGRATION = 'RemoveDuplicateServices'
+
+ disable_ddl_transaction!
+
+ def up
+ project_ids_with_duplicates = Gitlab::BackgroundMigration::RemoveDuplicateServices::Service.project_ids_with_duplicates
+
+ project_ids_with_duplicates.each_batch(of: BATCH_SIZE, column: :project_id) do |batch, index|
+ migrate_in(
+ INTERVAL * index,
+ MIGRATION,
+ batch.pluck(:project_id)
+ )
+ end
+ end
+
+ def down
+ end
+end
diff --git a/db/schema_migrations/20200716234259 b/db/schema_migrations/20200716234259
new file mode 100644
index 00000000000..51916bdc8af
--- /dev/null
+++ b/db/schema_migrations/20200716234259
@@ -0,0 +1 @@
+9683f55a327b9579b9b0b9484dd11a07b7ea4244b126c46e0144662cb25da6bb \ No newline at end of file
diff --git a/db/schema_migrations/20200716234518 b/db/schema_migrations/20200716234518
new file mode 100644
index 00000000000..c5f438dcfbe
--- /dev/null
+++ b/db/schema_migrations/20200716234518
@@ -0,0 +1 @@
+71cd12e553b3acbb665770fe7478365f1f082e2d278c67b166f41461f689aa5e \ No newline at end of file
diff --git a/db/schema_migrations/20201112215132 b/db/schema_migrations/20201112215132
new file mode 100644
index 00000000000..e478dd0f9bf
--- /dev/null
+++ b/db/schema_migrations/20201112215132
@@ -0,0 +1 @@
+a436597e876a6d9efc2c1558e05dc576cbbc6f829dc8059d62fc231bbf0ce2fa \ No newline at end of file
diff --git a/db/schema_migrations/20201204105300 b/db/schema_migrations/20201204105300
new file mode 100644
index 00000000000..e54d4f939b9
--- /dev/null
+++ b/db/schema_migrations/20201204105300
@@ -0,0 +1 @@
+15f48c654c08b58c90e46ce6e6413efa14d5a6e8299f100fc65f09f38190132a \ No newline at end of file
diff --git a/db/schema_migrations/20201204110700 b/db/schema_migrations/20201204110700
new file mode 100644
index 00000000000..b69e93149c2
--- /dev/null
+++ b/db/schema_migrations/20201204110700
@@ -0,0 +1 @@
+986ffa5e3e168ce9acf9b346c94bdee05d85c71abe238b8aa21f95cc472faabc \ No newline at end of file
diff --git a/db/schema_migrations/20201204110800 b/db/schema_migrations/20201204110800
new file mode 100644
index 00000000000..de1fdf7442a
--- /dev/null
+++ b/db/schema_migrations/20201204110800
@@ -0,0 +1 @@
+aecf517402d3decf8f7323e8f43fdfe7160cbe7542a474e392996abd75b2d70f \ No newline at end of file
diff --git a/db/schema_migrations/20201204111000 b/db/schema_migrations/20201204111000
new file mode 100644
index 00000000000..be3078cf503
--- /dev/null
+++ b/db/schema_migrations/20201204111000
@@ -0,0 +1 @@
+e9ca7eb8a47f6c48667135eca26f729471f8bb4ffa91dfceea87d98c8f2a616b \ No newline at end of file
diff --git a/db/schema_migrations/20201204111100 b/db/schema_migrations/20201204111100
new file mode 100644
index 00000000000..db3832d5331
--- /dev/null
+++ b/db/schema_migrations/20201204111100
@@ -0,0 +1 @@
+b613f8654641948b2933910ebbfc926fd801b18c00a5d23b1c801a9ba9925520 \ No newline at end of file
diff --git a/db/schema_migrations/20201204193952 b/db/schema_migrations/20201204193952
new file mode 100644
index 00000000000..4dcea03722f
--- /dev/null
+++ b/db/schema_migrations/20201204193952
@@ -0,0 +1 @@
+39e5550b6ad6f718a51cf9838ac9148bcaa070aff60f6114bd96e4a76faf2ca1 \ No newline at end of file
diff --git a/db/schema_migrations/20201207165956 b/db/schema_migrations/20201207165956
new file mode 100644
index 00000000000..4bded1d3152
--- /dev/null
+++ b/db/schema_migrations/20201207165956
@@ -0,0 +1 @@
+1ad19d6b4bc37d24f61f158aa58e4ce6be75cc54722cdc59427c00522fd40b4c \ No newline at end of file
diff --git a/db/schema_migrations/20201208175117 b/db/schema_migrations/20201208175117
new file mode 100644
index 00000000000..caa1bcaedd8
--- /dev/null
+++ b/db/schema_migrations/20201208175117
@@ -0,0 +1 @@
+68971e7f9a722e98d9e611f614b5465de83ff3d4dc8c7a8078ed1db8f21e6590 \ No newline at end of file
diff --git a/db/schema_migrations/20201208210209 b/db/schema_migrations/20201208210209
new file mode 100644
index 00000000000..61679844170
--- /dev/null
+++ b/db/schema_migrations/20201208210209
@@ -0,0 +1 @@
+90b661656195e61c3b3ac43b8eebcdc06f462eb7e73a6201b2f2a8bc9dd519bf \ No newline at end of file
diff --git a/db/schema_migrations/20201209163958 b/db/schema_migrations/20201209163958
new file mode 100644
index 00000000000..081f12e64ea
--- /dev/null
+++ b/db/schema_migrations/20201209163958
@@ -0,0 +1 @@
+4bdd5eba48a76d8feab948857ec32ef7fe25e04e8633ee7d94fd059e73703472 \ No newline at end of file
diff --git a/db/schema_migrations/20201209193551 b/db/schema_migrations/20201209193551
new file mode 100644
index 00000000000..2eb96840500
--- /dev/null
+++ b/db/schema_migrations/20201209193551
@@ -0,0 +1 @@
+2278b1e4e19b5306e4b616eb87b622427ef2dcf73dae761739cb3106d5e64718 \ No newline at end of file
diff --git a/db/schema_migrations/20201211090634 b/db/schema_migrations/20201211090634
new file mode 100644
index 00000000000..0c11b8f85fb
--- /dev/null
+++ b/db/schema_migrations/20201211090634
@@ -0,0 +1 @@
+5117b71950bec3c6c746eaf4851c111a335bf2280075ddc2c73b60a30e23d907 \ No newline at end of file
diff --git a/db/schema_migrations/20201214000000 b/db/schema_migrations/20201214000000
new file mode 100644
index 00000000000..420b3f2768a
--- /dev/null
+++ b/db/schema_migrations/20201214000000
@@ -0,0 +1 @@
+58f2bd74adf8b4ef616c8f341053dbeaa8116430a0f4493cbf5f8456d7f4b907 \ No newline at end of file
diff --git a/db/schema_migrations/20201214032220 b/db/schema_migrations/20201214032220
new file mode 100644
index 00000000000..ec14b260583
--- /dev/null
+++ b/db/schema_migrations/20201214032220
@@ -0,0 +1 @@
+db23b5315386ad5d5fec5a14958769cc1e62a0a89ec3246edb9fc024607e917b \ No newline at end of file
diff --git a/db/schema_migrations/20201214111858 b/db/schema_migrations/20201214111858
new file mode 100644
index 00000000000..7d97a34eadf
--- /dev/null
+++ b/db/schema_migrations/20201214111858
@@ -0,0 +1 @@
+e3eb306d7956e396f038f07a20c674929fc4aae3e188b24e1087305b3fea8b4d \ No newline at end of file
diff --git a/db/schema_migrations/20201214112752 b/db/schema_migrations/20201214112752
new file mode 100644
index 00000000000..af432649dea
--- /dev/null
+++ b/db/schema_migrations/20201214112752
@@ -0,0 +1 @@
+59906a3528499dd9c0b4c30088539299c08383ad3b36be8c862a7cc9ef1d50b2 \ No newline at end of file
diff --git a/db/schema_migrations/20201214184020 b/db/schema_migrations/20201214184020
new file mode 100644
index 00000000000..5cf5065b251
--- /dev/null
+++ b/db/schema_migrations/20201214184020
@@ -0,0 +1 @@
+adce3c714064991e93f8a587da3d5892c47dbc14963fa49638ebbbf8b5489359 \ No newline at end of file
diff --git a/db/schema_migrations/20201215205404 b/db/schema_migrations/20201215205404
new file mode 100644
index 00000000000..147ede2064d
--- /dev/null
+++ b/db/schema_migrations/20201215205404
@@ -0,0 +1 @@
+b54cf8b75c5882f2dfca74b218a9eeac766ff65233d43de865717d3ab8c7a217 \ No newline at end of file
diff --git a/db/schema_migrations/20201216151616 b/db/schema_migrations/20201216151616
new file mode 100644
index 00000000000..a8b27610716
--- /dev/null
+++ b/db/schema_migrations/20201216151616
@@ -0,0 +1 @@
+f1c6927431895c6ce03fe7e0be30fcd0a1f4ccfeac8277ee0662d7434b97d257 \ No newline at end of file
diff --git a/db/schema_migrations/20201216154457 b/db/schema_migrations/20201216154457
new file mode 100644
index 00000000000..773218ff906
--- /dev/null
+++ b/db/schema_migrations/20201216154457
@@ -0,0 +1 @@
+c878874bbb9bf2314b90c1328d6e27846fe71513ba1ce688a262d36761b66665 \ No newline at end of file
diff --git a/db/schema_migrations/20201216185336 b/db/schema_migrations/20201216185336
new file mode 100644
index 00000000000..376429a2141
--- /dev/null
+++ b/db/schema_migrations/20201216185336
@@ -0,0 +1 @@
+3647e8b944aedeb58c41d9b3f08c8fb657fab231b0ff25c276f6d2aaa2ea93ae \ No newline at end of file
diff --git a/db/schema_migrations/20201217070530 b/db/schema_migrations/20201217070530
new file mode 100644
index 00000000000..c09f3b03e3b
--- /dev/null
+++ b/db/schema_migrations/20201217070530
@@ -0,0 +1 @@
+59e40a24e8422e64bc85c4d54e6da923512017bac6a167350affeff241046e9f \ No newline at end of file
diff --git a/db/schema_migrations/20201217132603 b/db/schema_migrations/20201217132603
new file mode 100644
index 00000000000..d1db386cbf5
--- /dev/null
+++ b/db/schema_migrations/20201217132603
@@ -0,0 +1 @@
+164bcc838beb7d51775f8b813b92d3ec7080d4c7937d6ad16cf973131b45359e \ No newline at end of file
diff --git a/db/schema_migrations/20201221124036 b/db/schema_migrations/20201221124036
new file mode 100644
index 00000000000..7a1049a7dd0
--- /dev/null
+++ b/db/schema_migrations/20201221124036
@@ -0,0 +1 @@
+15517956f3b5d7ce2c05d196a34881fa169df7b1bf5ccf0dbfbee74fb3143ba7 \ No newline at end of file
diff --git a/db/schema_migrations/20201221213415 b/db/schema_migrations/20201221213415
new file mode 100644
index 00000000000..74df483ac70
--- /dev/null
+++ b/db/schema_migrations/20201221213415
@@ -0,0 +1 @@
+8c123da6a380524c7269ffc67ea0e533a415d3c6eddf96cee4025ea152fc7582 \ No newline at end of file
diff --git a/db/schema_migrations/20201223012231 b/db/schema_migrations/20201223012231
new file mode 100644
index 00000000000..77813ca0655
--- /dev/null
+++ b/db/schema_migrations/20201223012231
@@ -0,0 +1 @@
+e845a6704ac92881926cca56bf7fb01c6252f1fe2b2d94fc9d6548144126d6a5 \ No newline at end of file
diff --git a/db/schema_migrations/20201223114050 b/db/schema_migrations/20201223114050
new file mode 100644
index 00000000000..25ac0eac211
--- /dev/null
+++ b/db/schema_migrations/20201223114050
@@ -0,0 +1 @@
+35acb5bbabfd12f97c988776aafa6ff380e2cbe2267e856b8f439f7102a6fbf2 \ No newline at end of file
diff --git a/db/schema_migrations/20201224144948 b/db/schema_migrations/20201224144948
new file mode 100644
index 00000000000..84e2816433c
--- /dev/null
+++ b/db/schema_migrations/20201224144948
@@ -0,0 +1 @@
+a83762c788d4ec007a26da386dc36bce16b60f5642ed3e6405482acfebefc1be \ No newline at end of file
diff --git a/db/schema_migrations/20201228184500 b/db/schema_migrations/20201228184500
new file mode 100644
index 00000000000..c6168e775b2
--- /dev/null
+++ b/db/schema_migrations/20201228184500
@@ -0,0 +1 @@
+9018fed4aab19642fafee3e50bf41be422fc3f8256d0b5d78c8a70fc96f4090f \ No newline at end of file
diff --git a/db/schema_migrations/20201229105948 b/db/schema_migrations/20201229105948
new file mode 100644
index 00000000000..73da30d5392
--- /dev/null
+++ b/db/schema_migrations/20201229105948
@@ -0,0 +1 @@
+cf391e617ef16f70c0daa4584959d36eda4b29c7e211f3f90ad74b4ebbc7ebbd \ No newline at end of file
diff --git a/db/schema_migrations/20201230161206 b/db/schema_migrations/20201230161206
new file mode 100644
index 00000000000..594ca5ea890
--- /dev/null
+++ b/db/schema_migrations/20201230161206
@@ -0,0 +1 @@
+b3fcc73c6b61469d770e9eb9a14c88bb86398db4ab4b6dc5283718a147db0ac0 \ No newline at end of file
diff --git a/db/schema_migrations/20201230180202 b/db/schema_migrations/20201230180202
new file mode 100644
index 00000000000..62a0e277a55
--- /dev/null
+++ b/db/schema_migrations/20201230180202
@@ -0,0 +1 @@
+c2766b50914c6b4d8c96fb958cdfb67f0d29e40df45654c35d62792c272e3d5a \ No newline at end of file
diff --git a/db/schema_migrations/20210101110640 b/db/schema_migrations/20210101110640
new file mode 100644
index 00000000000..e21e6768e7b
--- /dev/null
+++ b/db/schema_migrations/20210101110640
@@ -0,0 +1 @@
+8aac4108b658a7a0646ec230dc2568cb51fea0535b13dfba8b8c9e6edb401d07 \ No newline at end of file
diff --git a/db/schema_migrations/20210102164121 b/db/schema_migrations/20210102164121
new file mode 100644
index 00000000000..87f9b9e17f4
--- /dev/null
+++ b/db/schema_migrations/20210102164121
@@ -0,0 +1 @@
+d15dc3e57f050f037dd6b6b2b1efdafee49bf411580e35a7b4dbe14868c41e13 \ No newline at end of file
diff --git a/db/schema_migrations/20210104163218 b/db/schema_migrations/20210104163218
new file mode 100644
index 00000000000..c58a142f92e
--- /dev/null
+++ b/db/schema_migrations/20210104163218
@@ -0,0 +1 @@
+37aa0564d2ade1cab56a669facccbaaf08e4d9856c7a4cc120968d33cff161bd \ No newline at end of file
diff --git a/db/schema_migrations/20210105103649 b/db/schema_migrations/20210105103649
new file mode 100644
index 00000000000..9b00aa2524c
--- /dev/null
+++ b/db/schema_migrations/20210105103649
@@ -0,0 +1 @@
+0a318fbcf54860d9fe8b3e8372e10331d2b52df738e621f4b0eec5fd4f255739 \ No newline at end of file
diff --git a/db/schema_migrations/20210106153021 b/db/schema_migrations/20210106153021
new file mode 100644
index 00000000000..a00c59a8534
--- /dev/null
+++ b/db/schema_migrations/20210106153021
@@ -0,0 +1 @@
+71e005116082a59e40194fe5f9a500e31d67a011500d12aeecd59cb64d611848 \ No newline at end of file
diff --git a/db/schema_migrations/20210107194543 b/db/schema_migrations/20210107194543
new file mode 100644
index 00000000000..997bdd98b5a
--- /dev/null
+++ b/db/schema_migrations/20210107194543
@@ -0,0 +1 @@
+d72cf1c88a060ccadd9f90cbef5ae7d4ea6a4416a6263d11a870e01b02d1f935 \ No newline at end of file
diff --git a/db/schema_migrations/20210108161039 b/db/schema_migrations/20210108161039
new file mode 100644
index 00000000000..d60bab2ec5a
--- /dev/null
+++ b/db/schema_migrations/20210108161039
@@ -0,0 +1 @@
+7888a82e3bbc1f4c78badcbe8335ac823ebdedec843a9d90f91cf0d5c169a191 \ No newline at end of file
diff --git a/db/schema_migrations/20210112084512 b/db/schema_migrations/20210112084512
new file mode 100644
index 00000000000..3091c8e2542
--- /dev/null
+++ b/db/schema_migrations/20210112084512
@@ -0,0 +1 @@
+e8e26d49a8292e31ef0ea88a0262f0386b8deda83658ea4de7d464d79c5428e4 \ No newline at end of file
diff --git a/db/schema_migrations/20210112143418 b/db/schema_migrations/20210112143418
new file mode 100644
index 00000000000..3183c8cf220
--- /dev/null
+++ b/db/schema_migrations/20210112143418
@@ -0,0 +1 @@
+05d45e25ab9ef1565c04ca6515e0b01f2f98c5e98b1eeb09fa9dd43ebbe3c4d0 \ No newline at end of file
diff --git a/db/schema_migrations/20210114033715 b/db/schema_migrations/20210114033715
new file mode 100644
index 00000000000..6d25bd971e2
--- /dev/null
+++ b/db/schema_migrations/20210114033715
@@ -0,0 +1 @@
+69aae8d967fdb8af816a969fd818ed325b8d780b4faaa205c78a66c5d533ab2a \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 9bf6799dc85..de4218ed405 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -10,51 +10,62 @@ CREATE EXTENSION IF NOT EXISTS btree_gist;
CREATE EXTENSION IF NOT EXISTS pg_trgm;
+CREATE FUNCTION set_has_external_wiki() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+BEGIN
+UPDATE projects SET has_external_wiki = COALESCE(NEW.active, FALSE)
+WHERE projects.id = COALESCE(NEW.project_id, OLD.project_id);
+RETURN NULL;
+
+END
+$$;
+
CREATE FUNCTION table_sync_function_2be879775d() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
IF (TG_OP = 'DELETE') THEN
- DELETE FROM audit_events_part_5fc467ac26 where id = OLD.id;
+ DELETE FROM audit_events_archived where id = OLD.id;
ELSIF (TG_OP = 'UPDATE') THEN
- UPDATE audit_events_part_5fc467ac26
+ UPDATE audit_events_archived
SET author_id = NEW.author_id,
entity_id = NEW.entity_id,
entity_type = NEW.entity_type,
details = NEW.details,
+ created_at = NEW.created_at,
ip_address = NEW.ip_address,
author_name = NEW.author_name,
entity_path = NEW.entity_path,
target_details = NEW.target_details,
target_type = NEW.target_type,
- target_id = NEW.target_id,
- created_at = NEW.created_at
- WHERE audit_events_part_5fc467ac26.id = NEW.id;
+ target_id = NEW.target_id
+ WHERE audit_events_archived.id = NEW.id;
ELSIF (TG_OP = 'INSERT') THEN
- INSERT INTO audit_events_part_5fc467ac26 (id,
+ INSERT INTO audit_events_archived (id,
author_id,
entity_id,
entity_type,
details,
+ created_at,
ip_address,
author_name,
entity_path,
target_details,
target_type,
- target_id,
- created_at)
+ target_id)
VALUES (NEW.id,
NEW.author_id,
NEW.entity_id,
NEW.entity_type,
NEW.details,
+ NEW.created_at,
NEW.ip_address,
NEW.author_name,
NEW.entity_path,
NEW.target_details,
NEW.target_type,
- NEW.target_id,
- NEW.created_at);
+ NEW.target_id);
END IF;
RETURN NULL;
@@ -63,7 +74,7 @@ $$;
COMMENT ON FUNCTION table_sync_function_2be879775d() IS 'Partitioning migration: table sync for audit_events table';
-CREATE TABLE audit_events_part_5fc467ac26 (
+CREATE TABLE audit_events (
id bigint NOT NULL,
author_id integer NOT NULL,
entity_id integer NOT NULL,
@@ -9003,7 +9014,8 @@ CREATE TABLE analytics_devops_adoption_snapshots (
runner_configured boolean NOT NULL,
pipeline_succeeded boolean NOT NULL,
deploy_succeeded boolean NOT NULL,
- security_scan_succeeded boolean NOT NULL
+ security_scan_succeeded boolean NOT NULL,
+ end_time timestamp with time zone NOT NULL
);
CREATE SEQUENCE analytics_devops_adoption_snapshots_id_seq
@@ -9328,7 +9340,7 @@ CREATE TABLE application_settings (
spam_check_endpoint_enabled boolean DEFAULT false NOT NULL,
elasticsearch_pause_indexing boolean DEFAULT false NOT NULL,
repository_storages_weighted jsonb DEFAULT '{}'::jsonb NOT NULL,
- max_import_size integer DEFAULT 50 NOT NULL,
+ max_import_size integer DEFAULT 0 NOT NULL,
enforce_pat_expiration boolean DEFAULT true NOT NULL,
compliance_frameworks smallint[] DEFAULT '{}'::smallint[] NOT NULL,
notify_on_unknown_sign_in boolean DEFAULT true NOT NULL,
@@ -9375,12 +9387,17 @@ CREATE TABLE application_settings (
cloud_license_enabled boolean DEFAULT false NOT NULL,
disable_feed_token boolean DEFAULT false NOT NULL,
personal_access_token_prefix text,
+ rate_limiting_response_text text,
+ invisible_captcha_enabled boolean DEFAULT false NOT NULL,
+ container_registry_cleanup_tags_service_max_list_size integer DEFAULT 200 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_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)),
CONSTRAINT check_17d9558205 CHECK ((char_length((kroki_url)::text) <= 1024)),
CONSTRAINT check_2dba05b802 CHECK ((char_length(gitpod_url) <= 255)),
CONSTRAINT check_51700b31b5 CHECK ((char_length(default_branch_name) <= 255)),
CONSTRAINT check_57123c9593 CHECK ((char_length(help_page_documentation_base_url) <= 255)),
CONSTRAINT check_718b4458ae CHECK ((char_length(personal_access_token_prefix) <= 20)),
+ CONSTRAINT check_7227fad848 CHECK ((char_length(rate_limiting_response_text) <= 255)),
CONSTRAINT check_85a39b68ff CHECK ((char_length(encrypted_ci_jwt_signing_key_iv) <= 255)),
CONSTRAINT check_9a719834eb CHECK ((char_length(secret_detection_token_revocation_url) <= 255)),
CONSTRAINT check_9c6c447a13 CHECK ((char_length(maintenance_mode_message) <= 255)),
@@ -9623,7 +9640,7 @@ CREATE SEQUENCE atlassian_identities_user_id_seq
ALTER SEQUENCE atlassian_identities_user_id_seq OWNED BY atlassian_identities.user_id;
-CREATE TABLE audit_events (
+CREATE TABLE audit_events_archived (
id integer NOT NULL,
author_id integer NOT NULL,
entity_id integer NOT NULL,
@@ -9909,6 +9926,26 @@ CREATE SEQUENCE boards_epic_boards_id_seq
ALTER SEQUENCE boards_epic_boards_id_seq OWNED BY boards_epic_boards.id;
+CREATE TABLE boards_epic_lists (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ epic_board_id bigint NOT NULL,
+ label_id bigint,
+ "position" integer,
+ list_type smallint DEFAULT 1 NOT NULL,
+ CONSTRAINT boards_epic_lists_position_constraint CHECK (((list_type <> 1) OR (("position" IS NOT NULL) AND ("position" >= 0))))
+);
+
+CREATE SEQUENCE boards_epic_lists_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE boards_epic_lists_id_seq OWNED BY boards_epic_lists.id;
+
CREATE TABLE boards_epic_user_preferences (
id bigint NOT NULL,
board_id bigint NOT NULL,
@@ -11105,7 +11142,7 @@ CREATE TABLE clusters (
management_project_id integer,
cleanup_status smallint DEFAULT 1 NOT NULL,
cleanup_status_reason text,
- helm_major_version integer DEFAULT 2 NOT NULL
+ helm_major_version integer DEFAULT 3 NOT NULL
);
CREATE TABLE clusters_applications_cert_managers (
@@ -11395,7 +11432,6 @@ ALTER SEQUENCE commit_user_mentions_id_seq OWNED BY commit_user_mentions.id;
CREATE TABLE compliance_management_frameworks (
id bigint NOT NULL,
- group_id bigint,
name text NOT NULL,
description text NOT NULL,
color text NOT NULL,
@@ -11925,6 +11961,32 @@ CREATE SEQUENCE draft_notes_id_seq
ALTER SEQUENCE draft_notes_id_seq OWNED BY draft_notes.id;
+CREATE TABLE elastic_reindexing_subtasks (
+ id bigint NOT NULL,
+ elastic_reindexing_task_id bigint NOT NULL,
+ alias_name text NOT NULL,
+ index_name_from text NOT NULL,
+ index_name_to text NOT NULL,
+ elastic_task text NOT NULL,
+ documents_count_target integer,
+ documents_count integer,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ CONSTRAINT check_4910adc798 CHECK ((char_length(elastic_task) <= 255)),
+ CONSTRAINT check_88f56216a4 CHECK ((char_length(alias_name) <= 255)),
+ CONSTRAINT check_a1fbd9faa9 CHECK ((char_length(index_name_from) <= 255)),
+ CONSTRAINT check_f456494bd8 CHECK ((char_length(index_name_to) <= 255))
+);
+
+CREATE SEQUENCE elastic_reindexing_subtasks_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE elastic_reindexing_subtasks_id_seq OWNED BY elastic_reindexing_subtasks.id;
+
CREATE TABLE elastic_reindexing_tasks (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -12929,6 +12991,13 @@ CREATE SEQUENCE group_import_states_group_id_seq
ALTER SEQUENCE group_import_states_group_id_seq OWNED BY group_import_states.group_id;
+CREATE TABLE group_merge_request_approval_settings (
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ group_id bigint NOT NULL,
+ allow_author_approval boolean DEFAULT false NOT NULL
+);
+
CREATE TABLE group_wiki_repositories (
shard_id bigint NOT NULL,
group_id bigint NOT NULL,
@@ -13077,6 +13146,23 @@ CREATE SEQUENCE incident_management_oncall_schedules_id_seq
ALTER SEQUENCE incident_management_oncall_schedules_id_seq OWNED BY incident_management_oncall_schedules.id;
+CREATE TABLE incident_management_oncall_shifts (
+ id bigint NOT NULL,
+ rotation_id bigint NOT NULL,
+ participant_id bigint NOT NULL,
+ starts_at timestamp with time zone NOT NULL,
+ ends_at timestamp with time zone NOT NULL
+);
+
+CREATE SEQUENCE incident_management_oncall_shifts_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE incident_management_oncall_shifts_id_seq OWNED BY incident_management_oncall_shifts.id;
+
CREATE TABLE index_statuses (
id integer NOT NULL,
project_id integer NOT NULL,
@@ -13972,7 +14058,7 @@ CREATE TABLE merge_requests (
merge_jid character varying,
discussion_locked boolean,
latest_merge_request_diff_id integer,
- allow_maintainer_to_push boolean,
+ allow_maintainer_to_push boolean DEFAULT true,
state_id smallint DEFAULT 1 NOT NULL,
rebase_jid character varying,
squash_commit_sha bytea,
@@ -14127,6 +14213,13 @@ CREATE SEQUENCE namespace_onboarding_actions_id_seq
ALTER SEQUENCE namespace_onboarding_actions_id_seq OWNED BY namespace_onboarding_actions.id;
+CREATE TABLE namespace_package_settings (
+ namespace_id bigint NOT NULL,
+ maven_duplicates_allowed boolean DEFAULT true NOT NULL,
+ maven_duplicate_exception_regex text DEFAULT ''::text NOT NULL,
+ CONSTRAINT check_d63274b2b6 CHECK ((char_length(maven_duplicate_exception_regex) <= 255))
+);
+
CREATE TABLE namespace_root_storage_statistics (
namespace_id integer NOT NULL,
updated_at timestamp with time zone NOT NULL,
@@ -14336,7 +14429,11 @@ CREATE TABLE oauth_access_grants (
redirect_uri text NOT NULL,
created_at timestamp without time zone NOT NULL,
revoked_at timestamp without time zone,
- scopes character varying
+ scopes character varying,
+ code_challenge text,
+ code_challenge_method text,
+ CONSTRAINT oauth_access_grants_code_challenge CHECK ((char_length(code_challenge) <= 128)),
+ CONSTRAINT oauth_access_grants_code_challenge_method CHECK ((char_length(code_challenge_method) <= 5))
);
CREATE SEQUENCE oauth_access_grants_id_seq
@@ -14408,6 +14505,36 @@ CREATE SEQUENCE oauth_openid_requests_id_seq
ALTER SEQUENCE oauth_openid_requests_id_seq OWNED BY oauth_openid_requests.id;
+CREATE TABLE onboarding_progresses (
+ id bigint NOT NULL,
+ namespace_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ git_pull_at timestamp with time zone,
+ git_write_at timestamp with time zone,
+ merge_request_created_at timestamp with time zone,
+ pipeline_created_at timestamp with time zone,
+ user_added_at timestamp with time zone,
+ trial_started_at timestamp with time zone,
+ subscription_created_at timestamp with time zone,
+ required_mr_approvals_enabled_at timestamp with time zone,
+ code_owners_enabled_at timestamp with time zone,
+ scoped_label_created_at timestamp with time zone,
+ security_scan_enabled_at timestamp with time zone,
+ issue_auto_closed_at timestamp with time zone,
+ repository_imported_at timestamp with time zone,
+ repository_mirrored_at timestamp with time zone
+);
+
+CREATE SEQUENCE onboarding_progresses_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE onboarding_progresses_id_seq OWNED BY onboarding_progresses.id;
+
CREATE TABLE open_project_tracker_data (
id bigint NOT NULL,
service_id integer NOT NULL,
@@ -14585,7 +14712,8 @@ ALTER SEQUENCE packages_build_infos_id_seq OWNED BY packages_build_infos.id;
CREATE TABLE packages_composer_metadata (
package_id bigint NOT NULL,
target_sha bytea NOT NULL,
- composer_json jsonb DEFAULT '{}'::jsonb NOT NULL
+ composer_json jsonb DEFAULT '{}'::jsonb NOT NULL,
+ version_cache_sha bytea
);
CREATE TABLE packages_conan_file_metadata (
@@ -14626,6 +14754,136 @@ CREATE SEQUENCE packages_conan_metadata_id_seq
ALTER SEQUENCE packages_conan_metadata_id_seq OWNED BY packages_conan_metadata.id;
+CREATE TABLE packages_debian_file_metadata (
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ package_file_id bigint NOT NULL,
+ file_type smallint NOT NULL,
+ component text,
+ architecture text,
+ fields jsonb,
+ CONSTRAINT check_2ebedda4b6 CHECK ((char_length(component) <= 255)),
+ CONSTRAINT check_e6e1fffcca CHECK ((char_length(architecture) <= 255))
+);
+
+CREATE TABLE packages_debian_group_architectures (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ distribution_id bigint NOT NULL,
+ name text NOT NULL,
+ CONSTRAINT check_ddb220164a CHECK ((char_length(name) <= 255))
+);
+
+CREATE SEQUENCE packages_debian_group_architectures_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE packages_debian_group_architectures_id_seq OWNED BY packages_debian_group_architectures.id;
+
+CREATE TABLE packages_debian_group_distributions (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ group_id bigint NOT NULL,
+ creator_id bigint,
+ valid_time_duration_seconds integer,
+ file_store smallint DEFAULT 1 NOT NULL,
+ automatic boolean DEFAULT true NOT NULL,
+ automatic_upgrades boolean DEFAULT false NOT NULL,
+ codename text NOT NULL,
+ suite text,
+ origin text,
+ label text,
+ version text,
+ description text,
+ encrypted_signing_keys text,
+ encrypted_signing_keys_iv text,
+ file text,
+ file_signature text,
+ CONSTRAINT check_310ac457b8 CHECK ((char_length(description) <= 255)),
+ CONSTRAINT check_3d6f87fc31 CHECK ((char_length(file_signature) <= 4096)),
+ CONSTRAINT check_3fdadf4a0c CHECK ((char_length(version) <= 255)),
+ CONSTRAINT check_590e18405a CHECK ((char_length(codename) <= 255)),
+ CONSTRAINT check_9b90bc0f07 CHECK ((char_length(encrypted_signing_keys_iv) <= 255)),
+ CONSTRAINT check_b057cd840a CHECK ((char_length(origin) <= 255)),
+ CONSTRAINT check_b811ec1218 CHECK ((char_length(encrypted_signing_keys) <= 2048)),
+ CONSTRAINT check_be5ed8d307 CHECK ((char_length(file) <= 255)),
+ CONSTRAINT check_d3244bfc0b CHECK ((char_length(label) <= 255)),
+ CONSTRAINT check_e7c928a24b CHECK ((char_length(suite) <= 255))
+);
+
+CREATE SEQUENCE packages_debian_group_distributions_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE packages_debian_group_distributions_id_seq OWNED BY packages_debian_group_distributions.id;
+
+CREATE TABLE packages_debian_project_architectures (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ distribution_id bigint NOT NULL,
+ name text NOT NULL,
+ CONSTRAINT check_9c2e1c99d8 CHECK ((char_length(name) <= 255))
+);
+
+CREATE SEQUENCE packages_debian_project_architectures_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE packages_debian_project_architectures_id_seq OWNED BY packages_debian_project_architectures.id;
+
+CREATE TABLE packages_debian_project_distributions (
+ id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ project_id bigint NOT NULL,
+ creator_id bigint,
+ valid_time_duration_seconds integer,
+ file_store smallint DEFAULT 1 NOT NULL,
+ automatic boolean DEFAULT true NOT NULL,
+ automatic_upgrades boolean DEFAULT false NOT NULL,
+ codename text NOT NULL,
+ suite text,
+ origin text,
+ label text,
+ version text,
+ description text,
+ encrypted_signing_keys text,
+ encrypted_signing_keys_iv text,
+ file text,
+ file_signature text,
+ CONSTRAINT check_6177ccd4a6 CHECK ((char_length(origin) <= 255)),
+ CONSTRAINT check_6f6b55a4c4 CHECK ((char_length(label) <= 255)),
+ CONSTRAINT check_834dabadb6 CHECK ((char_length(codename) <= 255)),
+ CONSTRAINT check_96965792c2 CHECK ((char_length(version) <= 255)),
+ CONSTRAINT check_a56ae58a17 CHECK ((char_length(suite) <= 255)),
+ CONSTRAINT check_a5a2ac6af2 CHECK ((char_length(file_signature) <= 4096)),
+ CONSTRAINT check_b93154339f CHECK ((char_length(description) <= 255)),
+ CONSTRAINT check_c25603a25b CHECK ((char_length(encrypted_signing_keys) <= 2048)),
+ CONSTRAINT check_cb4ac9599e CHECK ((char_length(file) <= 255)),
+ CONSTRAINT check_d488f8cce3 CHECK ((char_length(encrypted_signing_keys_iv) <= 255))
+);
+
+CREATE SEQUENCE packages_debian_project_distributions_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE packages_debian_project_distributions_id_seq OWNED BY packages_debian_project_distributions.id;
+
CREATE TABLE packages_dependencies (
id bigint NOT NULL,
name character varying(255) NOT NULL,
@@ -15313,7 +15571,9 @@ CREATE TABLE project_ci_cd_settings (
default_git_depth integer,
forward_deployment_enabled boolean,
merge_trains_enabled boolean DEFAULT false,
- auto_rollback_enabled boolean DEFAULT false NOT NULL
+ auto_rollback_enabled boolean DEFAULT false NOT NULL,
+ keep_latest_artifact boolean DEFAULT true NOT NULL,
+ restrict_user_defined_variables boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE project_ci_cd_settings_id_seq
@@ -17584,7 +17844,8 @@ CREATE TABLE vulnerability_feedback (
comment_author_id integer,
comment text,
comment_timestamp timestamp with time zone,
- finding_uuid uuid
+ finding_uuid uuid,
+ dismissal_reason smallint
);
CREATE SEQUENCE vulnerability_feedback_id_seq
@@ -18131,6 +18392,8 @@ ALTER TABLE ONLY boards_epic_board_positions ALTER COLUMN id SET DEFAULT nextval
ALTER TABLE ONLY boards_epic_boards ALTER COLUMN id SET DEFAULT nextval('boards_epic_boards_id_seq'::regclass);
+ALTER TABLE ONLY boards_epic_lists ALTER COLUMN id SET DEFAULT nextval('boards_epic_lists_id_seq'::regclass);
+
ALTER TABLE ONLY boards_epic_user_preferences ALTER COLUMN id SET DEFAULT nextval('boards_epic_user_preferences_id_seq'::regclass);
ALTER TABLE ONLY broadcast_messages ALTER COLUMN id SET DEFAULT nextval('broadcast_messages_id_seq'::regclass);
@@ -18315,6 +18578,8 @@ ALTER TABLE ONLY diff_note_positions ALTER COLUMN id SET DEFAULT nextval('diff_n
ALTER TABLE ONLY draft_notes ALTER COLUMN id SET DEFAULT nextval('draft_notes_id_seq'::regclass);
+ALTER TABLE ONLY elastic_reindexing_subtasks ALTER COLUMN id SET DEFAULT nextval('elastic_reindexing_subtasks_id_seq'::regclass);
+
ALTER TABLE ONLY elastic_reindexing_tasks ALTER COLUMN id SET DEFAULT nextval('elastic_reindexing_tasks_id_seq'::regclass);
ALTER TABLE ONLY emails ALTER COLUMN id SET DEFAULT nextval('emails_id_seq'::regclass);
@@ -18423,6 +18688,8 @@ ALTER TABLE ONLY incident_management_oncall_rotations ALTER COLUMN id SET DEFAUL
ALTER TABLE ONLY incident_management_oncall_schedules ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_schedules_id_seq'::regclass);
+ALTER TABLE ONLY incident_management_oncall_shifts ALTER COLUMN id SET DEFAULT nextval('incident_management_oncall_shifts_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);
@@ -18531,6 +18798,8 @@ ALTER TABLE ONLY oauth_applications ALTER COLUMN id SET DEFAULT nextval('oauth_a
ALTER TABLE ONLY oauth_openid_requests ALTER COLUMN id SET DEFAULT nextval('oauth_openid_requests_id_seq'::regclass);
+ALTER TABLE ONLY onboarding_progresses ALTER COLUMN id SET DEFAULT nextval('onboarding_progresses_id_seq'::regclass);
+
ALTER TABLE ONLY open_project_tracker_data ALTER COLUMN id SET DEFAULT nextval('open_project_tracker_data_id_seq'::regclass);
ALTER TABLE ONLY operations_feature_flag_scopes ALTER COLUMN id SET DEFAULT nextval('operations_feature_flag_scopes_id_seq'::regclass);
@@ -18555,6 +18824,14 @@ ALTER TABLE ONLY packages_conan_file_metadata ALTER COLUMN id SET DEFAULT nextva
ALTER TABLE ONLY packages_conan_metadata ALTER COLUMN id SET DEFAULT nextval('packages_conan_metadata_id_seq'::regclass);
+ALTER TABLE ONLY packages_debian_group_architectures ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_architectures_id_seq'::regclass);
+
+ALTER TABLE ONLY packages_debian_group_distributions ALTER COLUMN id SET DEFAULT nextval('packages_debian_group_distributions_id_seq'::regclass);
+
+ALTER TABLE ONLY packages_debian_project_architectures ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_architectures_id_seq'::regclass);
+
+ALTER TABLE ONLY packages_debian_project_distributions ALTER COLUMN id SET DEFAULT nextval('packages_debian_project_distributions_id_seq'::regclass);
+
ALTER TABLE ONLY packages_dependencies ALTER COLUMN id SET DEFAULT nextval('packages_dependencies_id_seq'::regclass);
ALTER TABLE ONLY packages_dependency_links ALTER COLUMN id SET DEFAULT nextval('packages_dependency_links_id_seq'::regclass);
@@ -19126,11 +19403,11 @@ ALTER TABLE ONLY ar_internal_metadata
ALTER TABLE ONLY atlassian_identities
ADD CONSTRAINT atlassian_identities_pkey PRIMARY KEY (user_id);
-ALTER TABLE ONLY audit_events_part_5fc467ac26
- ADD CONSTRAINT audit_events_part_5fc467ac26_pkey PRIMARY KEY (id, created_at);
+ALTER TABLE ONLY audit_events_archived
+ ADD CONSTRAINT audit_events_archived_pkey PRIMARY KEY (id);
ALTER TABLE ONLY audit_events
- ADD CONSTRAINT audit_events_pkey PRIMARY KEY (id);
+ ADD CONSTRAINT audit_events_pkey PRIMARY KEY (id, created_at);
ALTER TABLE ONLY authentication_events
ADD CONSTRAINT authentication_events_pkey PRIMARY KEY (id);
@@ -19174,6 +19451,9 @@ ALTER TABLE ONLY boards_epic_board_positions
ALTER TABLE ONLY boards_epic_boards
ADD CONSTRAINT boards_epic_boards_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY boards_epic_lists
+ ADD CONSTRAINT boards_epic_lists_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY boards_epic_user_preferences
ADD CONSTRAINT boards_epic_user_preferences_pkey PRIMARY KEY (id);
@@ -19471,6 +19751,9 @@ ALTER TABLE ONLY diff_note_positions
ALTER TABLE ONLY draft_notes
ADD CONSTRAINT draft_notes_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY elastic_reindexing_subtasks
+ ADD CONSTRAINT elastic_reindexing_subtasks_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY elastic_reindexing_tasks
ADD CONSTRAINT elastic_reindexing_tasks_pkey PRIMARY KEY (id);
@@ -19621,6 +19904,9 @@ ALTER TABLE ONLY group_group_links
ALTER TABLE ONLY group_import_states
ADD CONSTRAINT group_import_states_pkey PRIMARY KEY (group_id);
+ALTER TABLE ONLY group_merge_request_approval_settings
+ ADD CONSTRAINT group_merge_request_approval_settings_pkey PRIMARY KEY (group_id);
+
ALTER TABLE ONLY group_wiki_repositories
ADD CONSTRAINT group_wiki_repositories_pkey PRIMARY KEY (group_id);
@@ -19636,6 +19922,9 @@ ALTER TABLE ONLY import_export_uploads
ALTER TABLE ONLY import_failures
ADD CONSTRAINT import_failures_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY incident_management_oncall_shifts
+ ADD CONSTRAINT inc_mgmnt_no_overlapping_oncall_shifts EXCLUDE USING gist (rotation_id WITH =, tstzrange(starts_at, ends_at, '[)'::text) WITH &&);
+
ALTER TABLE ONLY incident_management_oncall_participants
ADD CONSTRAINT incident_management_oncall_participants_pkey PRIMARY KEY (id);
@@ -19645,6 +19934,9 @@ ALTER TABLE ONLY incident_management_oncall_rotations
ALTER TABLE ONLY incident_management_oncall_schedules
ADD CONSTRAINT incident_management_oncall_schedules_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY incident_management_oncall_shifts
+ ADD CONSTRAINT incident_management_oncall_shifts_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY index_statuses
ADD CONSTRAINT index_statuses_pkey PRIMARY KEY (id);
@@ -19813,6 +20105,9 @@ ALTER TABLE ONLY namespace_limits
ALTER TABLE ONLY namespace_onboarding_actions
ADD CONSTRAINT namespace_onboarding_actions_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY namespace_package_settings
+ ADD CONSTRAINT namespace_package_settings_pkey PRIMARY KEY (namespace_id);
+
ALTER TABLE ONLY namespace_root_storage_statistics
ADD CONSTRAINT namespace_root_storage_statistics_pkey PRIMARY KEY (namespace_id);
@@ -19846,6 +20141,9 @@ ALTER TABLE ONLY oauth_applications
ALTER TABLE ONLY oauth_openid_requests
ADD CONSTRAINT oauth_openid_requests_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY onboarding_progresses
+ ADD CONSTRAINT onboarding_progresses_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY open_project_tracker_data
ADD CONSTRAINT open_project_tracker_data_pkey PRIMARY KEY (id);
@@ -19885,6 +20183,21 @@ ALTER TABLE ONLY packages_conan_file_metadata
ALTER TABLE ONLY packages_conan_metadata
ADD CONSTRAINT packages_conan_metadata_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY packages_debian_file_metadata
+ ADD CONSTRAINT packages_debian_file_metadata_pkey PRIMARY KEY (package_file_id);
+
+ALTER TABLE ONLY packages_debian_group_architectures
+ ADD CONSTRAINT packages_debian_group_architectures_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY packages_debian_group_distributions
+ ADD CONSTRAINT packages_debian_group_distributions_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY packages_debian_project_architectures
+ ADD CONSTRAINT packages_debian_project_architectures_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY packages_debian_project_distributions
+ ADD CONSTRAINT packages_debian_project_distributions_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY packages_dependencies
ADD CONSTRAINT packages_dependencies_pkey PRIMARY KEY (id);
@@ -20497,9 +20810,9 @@ CREATE INDEX product_analytics_events_experi_project_id_collector_tstamp_idx ON
CREATE INDEX active_billable_users ON users USING btree (id) WHERE (((state)::text = 'active'::text) AND ((user_type IS NULL) OR (user_type = ANY (ARRAY[NULL::integer, 6, 4]))) AND ((user_type IS NULL) OR (user_type <> ALL ('{2,6,1,3,7,8}'::smallint[]))));
-CREATE INDEX analytics_index_audit_events_on_created_at_and_author_id ON audit_events USING btree (created_at, author_id);
+CREATE INDEX analytics_index_audit_events_on_created_at_and_author_id ON audit_events_archived USING btree (created_at, author_id);
-CREATE INDEX analytics_index_audit_events_part_on_created_at_and_author_id ON ONLY audit_events_part_5fc467ac26 USING btree (created_at, author_id);
+CREATE INDEX analytics_index_audit_events_part_on_created_at_and_author_id ON ONLY audit_events USING btree (created_at, author_id);
CREATE INDEX analytics_index_events_on_created_at_and_author_id ON events USING btree (created_at, author_id);
@@ -20541,11 +20854,13 @@ 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 expired_artifacts_temp_index ON ci_job_artifacts USING btree (id, created_at) WHERE ((expire_at IS NULL) AND (created_at < '2020-06-22 00:00:00+00'::timestamp with time zone));
+
CREATE INDEX finding_links_on_vulnerability_occurrence_id ON vulnerability_finding_links USING btree (vulnerability_occurrence_id);
-CREATE INDEX idx_audit_events_on_entity_id_desc_author_id_created_at ON audit_events USING btree (entity_id, entity_type, id DESC, author_id, created_at);
+CREATE INDEX idx_audit_events_on_entity_id_desc_author_id_created_at ON audit_events_archived USING btree (entity_id, entity_type, id DESC, author_id, created_at);
-CREATE INDEX idx_audit_events_part_on_entity_id_desc_author_id_created_at ON ONLY audit_events_part_5fc467ac26 USING btree (entity_id, entity_type, id DESC, author_id, created_at);
+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_ci_pipelines_artifacts_locked ON ci_pipelines USING btree (ci_ref_id, id) WHERE (locked = 1);
@@ -20599,6 +20914,10 @@ CREATE INDEX idx_packages_build_infos_on_package_id ON packages_build_infos USIN
CREATE INDEX idx_packages_packages_on_project_id_name_version_package_type ON packages_packages USING btree (project_id, name, version, package_type);
+CREATE INDEX idx_pkgs_deb_grp_architectures_on_distribution_id ON packages_debian_group_architectures USING btree (distribution_id);
+
+CREATE INDEX idx_pkgs_deb_proj_architectures_on_distribution_id ON packages_debian_project_architectures USING btree (distribution_id);
+
CREATE UNIQUE INDEX idx_pkgs_dep_links_on_pkg_id_dependency_id_dependency_type ON packages_dependency_links USING btree (package_id, dependency_id, dependency_type);
CREATE INDEX idx_proj_feat_usg_on_jira_dvcs_cloud_last_sync_at_and_proj_id ON project_feature_usages USING btree (jira_dvcs_cloud_last_sync_at, project_id) WHERE (jira_dvcs_cloud_last_sync_at IS NOT NULL);
@@ -20823,8 +21142,16 @@ CREATE UNIQUE INDEX index_boards_epic_board_positions_on_epic_board_id_and_epic_
CREATE INDEX index_boards_epic_board_positions_on_epic_id ON boards_epic_board_positions USING btree (epic_id);
+CREATE INDEX index_boards_epic_board_positions_on_scoped_relative_position ON boards_epic_board_positions USING btree (epic_board_id, epic_id, relative_position);
+
CREATE INDEX index_boards_epic_boards_on_group_id ON boards_epic_boards USING btree (group_id);
+CREATE INDEX index_boards_epic_lists_on_epic_board_id ON boards_epic_lists USING btree (epic_board_id);
+
+CREATE UNIQUE INDEX index_boards_epic_lists_on_epic_board_id_and_label_id ON boards_epic_lists USING btree (epic_board_id, label_id) WHERE (list_type = 1);
+
+CREATE INDEX index_boards_epic_lists_on_label_id ON boards_epic_lists USING btree (label_id);
+
CREATE INDEX index_boards_epic_user_preferences_on_board_id ON boards_epic_user_preferences USING btree (board_id);
CREATE UNIQUE INDEX index_boards_epic_user_preferences_on_board_user_epic_unique ON boards_epic_user_preferences USING btree (board_id, user_id, epic_id);
@@ -20999,7 +21326,7 @@ CREATE INDEX index_ci_pipelines_on_external_pull_request_id ON ci_pipelines USIN
CREATE INDEX index_ci_pipelines_on_merge_request_id ON ci_pipelines USING btree (merge_request_id) WHERE (merge_request_id IS NOT NULL);
-CREATE INDEX index_ci_pipelines_on_pipeline_schedule_id ON ci_pipelines USING btree (pipeline_schedule_id);
+CREATE INDEX index_ci_pipelines_on_pipeline_schedule_id_and_id ON ci_pipelines USING btree (pipeline_schedule_id, id);
CREATE INDEX index_ci_pipelines_on_project_id_and_id_desc ON ci_pipelines USING btree (project_id, id DESC);
@@ -21295,6 +21622,8 @@ CREATE INDEX index_draft_notes_on_discussion_id ON draft_notes USING btree (disc
CREATE INDEX index_draft_notes_on_merge_request_id ON draft_notes USING btree (merge_request_id);
+CREATE INDEX index_elastic_reindexing_subtasks_on_elastic_reindexing_task_id ON elastic_reindexing_subtasks USING btree (elastic_reindexing_task_id);
+
CREATE UNIQUE INDEX index_elastic_reindexing_tasks_on_in_progress ON elastic_reindexing_tasks USING btree (in_progress) WHERE in_progress;
CREATE INDEX index_elastic_reindexing_tasks_on_state ON elastic_reindexing_tasks USING btree (state);
@@ -21595,6 +21924,10 @@ CREATE UNIQUE INDEX index_inc_mgmnt_oncall_rotations_on_oncall_schedule_id_and_n
CREATE INDEX index_incident_management_oncall_schedules_on_project_id ON incident_management_oncall_schedules USING btree (project_id);
+CREATE INDEX index_incident_management_oncall_shifts_on_participant_id ON incident_management_oncall_shifts USING btree (participant_id);
+
+CREATE INDEX index_incident_management_oncall_shifts_on_rotation_id ON incident_management_oncall_shifts USING btree (rotation_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);
@@ -21711,7 +22044,7 @@ CREATE UNIQUE INDEX index_label_priorities_on_project_id_and_label_id ON label_p
CREATE UNIQUE INDEX index_labels_on_group_id_and_project_id_and_title ON labels USING btree (group_id, project_id, title);
-CREATE INDEX index_labels_on_group_id_and_title_with_null_project_id ON labels USING btree (group_id, title) WHERE (project_id IS NULL);
+CREATE UNIQUE INDEX index_labels_on_group_id_and_title_unique ON labels USING btree (group_id, title) WHERE (project_id IS NULL);
CREATE INDEX index_labels_on_project_id ON labels USING btree (project_id);
@@ -21847,6 +22180,8 @@ CREATE INDEX index_merge_requests_on_target_project_id_and_iid_and_state_id ON m
CREATE INDEX index_merge_requests_on_target_project_id_and_iid_jira_title ON merge_requests USING btree (target_project_id, iid) WHERE ((title)::text ~ '[A-Z][A-Z_0-9]+-\d+'::text);
+CREATE INDEX index_merge_requests_on_target_project_id_and_squash_commit_sha ON merge_requests USING btree (target_project_id, squash_commit_sha);
+
CREATE INDEX index_merge_requests_on_target_project_id_and_target_branch ON merge_requests USING btree (target_project_id, target_branch) WHERE ((state_id = 1) AND (merge_when_pipeline_succeeds = true));
CREATE INDEX index_merge_requests_on_target_project_id_iid_jira_description ON merge_requests USING btree (target_project_id, iid) WHERE (description ~ '[A-Z][A-Z_0-9]+-\d+'::text);
@@ -22013,6 +22348,8 @@ CREATE UNIQUE INDEX index_on_segment_selections_project_id_segment_id ON analyti
CREATE INDEX index_on_segment_selections_segment_id ON analytics_devops_adoption_segment_selections USING btree (segment_id);
+CREATE INDEX index_on_snapshots_segment_id_end_time ON analytics_devops_adoption_snapshots USING btree (segment_id, end_time);
+
CREATE INDEX index_on_snapshots_segment_id_recorded_at ON analytics_devops_adoption_snapshots USING btree (segment_id, recorded_at);
CREATE INDEX index_on_users_lower_email ON users USING btree (lower((email)::text));
@@ -22021,6 +22358,8 @@ CREATE INDEX index_on_users_lower_username ON users USING btree (lower((username
CREATE INDEX index_on_users_name_lower ON users USING btree (lower((name)::text));
+CREATE UNIQUE INDEX index_onboarding_progresses_on_namespace_id ON onboarding_progresses USING btree (namespace_id);
+
CREATE INDEX index_open_project_tracker_data_on_service_id ON open_project_tracker_data USING btree (service_id);
CREATE INDEX index_operations_feature_flags_issues_on_issue_id ON operations_feature_flags_issues USING btree (issue_id);
@@ -22051,6 +22390,14 @@ CREATE UNIQUE INDEX index_packages_conan_file_metadata_on_package_file_id ON pac
CREATE UNIQUE INDEX index_packages_conan_metadata_on_package_id_username_channel ON packages_conan_metadata USING btree (package_id, package_username, package_channel);
+CREATE INDEX index_packages_debian_group_distributions_on_creator_id ON packages_debian_group_distributions USING btree (creator_id);
+
+CREATE INDEX index_packages_debian_group_distributions_on_group_id ON packages_debian_group_distributions USING btree (group_id);
+
+CREATE INDEX index_packages_debian_project_distributions_on_creator_id ON packages_debian_project_distributions USING btree (creator_id);
+
+CREATE INDEX index_packages_debian_project_distributions_on_project_id ON packages_debian_project_distributions USING btree (project_id);
+
CREATE UNIQUE INDEX index_packages_dependencies_on_name_and_version_pattern ON packages_dependencies USING btree (name, version_pattern);
CREATE INDEX index_packages_dependency_links_on_dependency_id ON packages_dependency_links USING btree (dependency_id);
@@ -23001,14 +23348,22 @@ CREATE INDEX temporary_index_vulnerabilities_on_id ON vulnerabilities USING btre
CREATE UNIQUE INDEX term_agreements_unique_index ON term_agreements USING btree (user_id, term_id);
-CREATE INDEX tmp_build_stage_position_index ON ci_builds USING btree (stage_id, stage_idx) WHERE (stage_idx IS NOT NULL);
-
-CREATE INDEX tmp_index_for_email_unconfirmation_migration ON emails USING btree (id) WHERE (confirmed_at IS NOT NULL);
-
CREATE INDEX tmp_index_oauth_applications_on_id_where_trusted ON oauth_applications USING btree (id) WHERE (trusted = true);
CREATE INDEX tmp_index_on_vulnerabilities_non_dismissed ON vulnerabilities USING btree (id) WHERE (state <> 2);
+CREATE UNIQUE INDEX uniq_pkgs_deb_grp_architectures_on_distribution_id_and_name ON packages_debian_group_architectures USING btree (distribution_id, name);
+
+CREATE UNIQUE INDEX uniq_pkgs_deb_proj_architectures_on_distribution_id_and_name ON packages_debian_project_architectures USING btree (distribution_id, name);
+
+CREATE UNIQUE INDEX uniq_pkgs_debian_group_distributions_group_id_and_codename ON packages_debian_group_distributions USING btree (group_id, codename);
+
+CREATE UNIQUE INDEX uniq_pkgs_debian_group_distributions_group_id_and_suite ON packages_debian_group_distributions USING btree (group_id, suite);
+
+CREATE UNIQUE INDEX uniq_pkgs_debian_project_distributions_project_id_and_codename ON packages_debian_project_distributions USING btree (project_id, codename);
+
+CREATE UNIQUE INDEX uniq_pkgs_debian_project_distributions_project_id_and_suite ON packages_debian_project_distributions USING btree (project_id, suite);
+
CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id);
CREATE UNIQUE INDEX vulnerability_feedback_unique_idx ON vulnerability_feedback USING btree (project_id, category, feedback_type, project_fingerprint);
@@ -23273,6 +23628,12 @@ ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_p
CREATE TRIGGER table_sync_trigger_ee39a25f9d AFTER INSERT OR DELETE OR UPDATE ON audit_events FOR EACH ROW EXECUTE PROCEDURE table_sync_function_2be879775d();
+CREATE TRIGGER trigger_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 PROCEDURE 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 PROCEDURE 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 PROCEDURE set_has_external_wiki();
+
ALTER TABLE ONLY chat_names
ADD CONSTRAINT fk_00797a2bf9 FOREIGN KEY (service_id) REFERENCES services(id) ON DELETE CASCADE;
@@ -24011,6 +24372,9 @@ ALTER TABLE ONLY trending_projects
ALTER TABLE ONLY project_deploy_tokens
ADD CONSTRAINT fk_rails_0aca134388 FOREIGN KEY (deploy_token_id) REFERENCES deploy_tokens(id) ON DELETE CASCADE;
+ALTER TABLE ONLY packages_debian_group_distributions
+ ADD CONSTRAINT fk_rails_0adf75c347 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE RESTRICT;
+
ALTER TABLE ONLY packages_conan_file_metadata
ADD CONSTRAINT fk_rails_0afabd9328 FOREIGN KEY (package_file_id) REFERENCES packages_package_files(id) ON DELETE CASCADE;
@@ -24032,6 +24396,9 @@ ALTER TABLE ONLY user_synced_attributes_metadata
ALTER TABLE ONLY project_authorizations
ADD CONSTRAINT fk_rails_0f84bb11f3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY boards_epic_lists
+ ADD CONSTRAINT fk_rails_0f9c7f646f FOREIGN KEY (epic_board_id) REFERENCES boards_epic_boards(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY issue_email_participants
ADD CONSTRAINT fk_rails_0fdfd8b811 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
@@ -24116,6 +24483,9 @@ ALTER TABLE ONLY incident_management_oncall_schedules
ALTER TABLE ONLY vulnerability_user_mentions
ADD CONSTRAINT fk_rails_1a41c485cd FOREIGN KEY (vulnerability_id) REFERENCES vulnerabilities(id) ON DELETE CASCADE;
+ALTER TABLE ONLY packages_debian_file_metadata
+ ADD CONSTRAINT fk_rails_1ae85be112 FOREIGN KEY (package_file_id) REFERENCES packages_package_files(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY issuable_slas
ADD CONSTRAINT fk_rails_1b8768cd63 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
@@ -24137,6 +24507,9 @@ ALTER TABLE ONLY boards_epic_board_positions
ALTER TABLE ONLY geo_repository_created_events
ADD CONSTRAINT fk_rails_1f49e46a61 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY boards_epic_lists
+ ADD CONSTRAINT fk_rails_1fe6b54909 FOREIGN KEY (label_id) REFERENCES labels(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY approval_merge_request_rules_groups
ADD CONSTRAINT fk_rails_2020a7124a FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -24206,6 +24579,9 @@ ALTER TABLE ONLY geo_repository_updated_events
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 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;
@@ -24260,6 +24636,9 @@ ALTER TABLE ONLY merge_request_blocks
ALTER TABLE ONLY merge_request_reviewers
ADD CONSTRAINT fk_rails_3704a66140 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY group_merge_request_approval_settings
+ ADD CONSTRAINT fk_rails_37b6b4cdba FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY analytics_cycle_analytics_project_stages
ADD CONSTRAINT fk_rails_3829e49b66 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -24449,6 +24828,9 @@ ALTER TABLE ONLY issue_user_mentions
ALTER TABLE ONLY merge_request_assignees
ADD CONSTRAINT fk_rails_579d375628 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY packages_debian_project_architectures
+ ADD CONSTRAINT fk_rails_5808663adf FOREIGN KEY (distribution_id) REFERENCES packages_debian_project_distributions(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY clusters_applications_cilium
ADD CONSTRAINT fk_rails_59dc12eea6 FOREIGN KEY (cluster_id) REFERENCES clusters(id) ON DELETE CASCADE;
@@ -24785,6 +25167,9 @@ ALTER TABLE ONLY alert_management_alert_assignees
ALTER TABLE ONLY scim_identities
ADD CONSTRAINT fk_rails_9421a0bffb FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY packages_debian_project_distributions
+ ADD CONSTRAINT fk_rails_94b95e1f84 FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY packages_pypi_metadata
ADD CONSTRAINT fk_rails_9698717cdd FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE CASCADE;
@@ -25145,6 +25530,12 @@ ALTER TABLE ONLY user_callouts
ALTER TABLE ONLY vulnerability_feedback
ADD CONSTRAINT fk_rails_debd54e456 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY packages_debian_project_distributions
+ ADD CONSTRAINT fk_rails_df44271a30 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE RESTRICT;
+
+ALTER TABLE ONLY incident_management_oncall_shifts
+ ADD CONSTRAINT fk_rails_df4feb286a FOREIGN KEY (rotation_id) REFERENCES incident_management_oncall_rotations(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY analytics_cycle_analytics_group_stages
ADD CONSTRAINT fk_rails_dfb37c880d FOREIGN KEY (end_event_label_id) REFERENCES labels(id) ON DELETE CASCADE;
@@ -25184,6 +25575,9 @@ ALTER TABLE ONLY merge_request_metrics
ALTER TABLE ONLY draft_notes
ADD CONSTRAINT fk_rails_e753681674 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
+ALTER TABLE ONLY namespace_package_settings
+ ADD CONSTRAINT fk_rails_e773444769 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY dast_site_tokens
ADD CONSTRAINT fk_rails_e84f721a8e FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -25214,12 +25608,18 @@ ALTER TABLE ONLY snippet_statistics
ALTER TABLE ONLY project_security_settings
ADD CONSTRAINT fk_rails_ed4abe1338 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY packages_debian_group_distributions
+ ADD CONSTRAINT fk_rails_ede0bb937f FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY experiment_subjects
ADD CONSTRAINT fk_rails_ede5754774 FOREIGN KEY (experiment_id) REFERENCES experiments(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_daily_build_group_report_results
ADD CONSTRAINT fk_rails_ee072d13b3 FOREIGN KEY (last_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE;
+ALTER TABLE ONLY packages_debian_group_architectures
+ ADD CONSTRAINT fk_rails_ef667d1b03 FOREIGN KEY (distribution_id) REFERENCES packages_debian_group_distributions(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY label_priorities
ADD CONSTRAINT fk_rails_ef916d14fa FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -25241,6 +25641,9 @@ ALTER TABLE ONLY requirements
ALTER TABLE ONLY snippet_repositories
ADD CONSTRAINT fk_rails_f21f899728 FOREIGN KEY (shard_id) REFERENCES shards(id) ON DELETE RESTRICT;
+ALTER TABLE ONLY elastic_reindexing_subtasks
+ ADD CONSTRAINT fk_rails_f2cc190164 FOREIGN KEY (elastic_reindexing_task_id) REFERENCES elastic_reindexing_tasks(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY ci_pipeline_chat_data
ADD CONSTRAINT fk_rails_f300456b63 FOREIGN KEY (chat_name_id) REFERENCES chat_names(id) ON DELETE CASCADE;
@@ -25256,6 +25659,9 @@ ALTER TABLE ONLY board_group_recent_visits
ALTER TABLE ONLY resource_state_events
ADD CONSTRAINT fk_rails_f5827a7ccd FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;
+ALTER TABLE ONLY incident_management_oncall_shifts
+ ADD CONSTRAINT fk_rails_f6eef06841 FOREIGN KEY (participant_id) REFERENCES incident_management_oncall_participants(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY design_user_mentions
ADD CONSTRAINT fk_rails_f7075a53c1 FOREIGN KEY (design_id) REFERENCES design_management_designs(id) ON DELETE CASCADE;