Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/29_instance_statistics.rb6
-rw-r--r--db/migrate/20200905013247_add_golang_package_max_file_size_to_plan_limits.rb9
-rw-r--r--db/migrate/20200907092610_add_user_id_to_group_import_states.rb26
-rw-r--r--db/migrate/20200908094810_add_new_setting_to_namespace_setting.rb19
-rw-r--r--db/migrate/20200909040555_create_package_events.rb19
-rw-r--r--db/migrate/20200909083339_add_change_reviewer_merge_request_to_notification_settings.rb9
-rw-r--r--db/migrate/20200912152943_rename_admin_notification_email_application_setting.rb17
-rw-r--r--db/migrate/20200914070140_add_expiration_policy_started_at_to_container_repositories.rb13
-rw-r--r--db/migrate/20200915134004_add_indices_to_approval_project_rules.rb25
-rw-r--r--db/migrate/20200916135044_add_state_id_index_to_merge_requests.rb17
-rw-r--r--db/migrate/20200916151442_add_result_index_to_authentication_events.rb18
-rw-r--r--db/migrate/20200916165232_add_debian_max_file_size_to_plan_limits.rb9
-rw-r--r--db/migrate/20200921093826_add_index_to_user_preferences.rb17
-rw-r--r--db/migrate/20200921130028_add_pages_deployment_id_to_pages_metadata.rb9
-rw-r--r--db/migrate/20200921131313_add_foreign_key_to_pages_deployment_id_in_project_pages_metadata.rb20
-rw-r--r--db/migrate/20200921203231_remove_duplicate_cluster_agents_index.rb18
-rw-r--r--db/migrate/20200922052316_create_issue_email_participants.rb32
-rw-r--r--db/migrate/20200922093004_add_postgres_index_view.rb33
-rw-r--r--db/migrate/20200923071622_add_description_to_requirements.rb15
-rw-r--r--db/migrate/20200923071644_add_text_limit_to_requirements_description.rb17
-rw-r--r--db/migrate/20200923102312_update_programming_language_colors.rb21
-rw-r--r--db/migrate/20200923130057_remove_tmp_container_scanning_index.rb20
-rw-r--r--db/migrate/20200923140404_add_postgres_reindex_actions_table.rb26
-rw-r--r--db/migrate/20200927224750_add_incident_issue_type_index_to_issues.rb20
-rw-r--r--db/migrate/20200928095732_add_state_to_dast_site_validation.rb12
-rw-r--r--db/migrate/20200928100408_add_text_limit_to_dast_site_validation_state.rb17
-rw-r--r--db/migrate/20200928203531_create_alert_management_http_integrations.rb37
-rw-r--r--db/migrate/20200928210524_add_http_integrations_project_foreign_key.rb19
-rw-r--r--db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb21
-rw-r--r--db/migrate/20200929063159_add_require_admin_approval_after_user_signup_to_application_settings.rb9
-rw-r--r--db/migrate/20200930094812_update_postgres_indexes_view.rb54
-rw-r--r--db/migrate/20200930131343_add_index_on_project_id_and_sha_to_deployments.rb20
-rw-r--r--db/migrate/20200930132319_add_api_fuzzing_to_plan_limits.rb9
-rw-r--r--db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb2
-rw-r--r--db/post_migrate/20200907092715_add_not_null_constraint_to_user_on_group_import_states.rb17
-rw-r--r--db/post_migrate/20200908064229_add_partial_index_to_ci_builds_table_on_user_id_name.rb37
-rw-r--r--db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb80
-rw-r--r--db/post_migrate/20200912153218_cleanup_admin_notification_email_application_setting_rename.rb17
-rw-r--r--db/post_migrate/20200915185707_ensure_filled_file_store_on_package_files.rb33
-rw-r--r--db/post_migrate/20200915191156_validate_not_null_file_store_on_package_files.rb21
-rw-r--r--db/post_migrate/20200917135802_remove_duplicated_cs_findings_without_vulnerability_id.rb30
-rw-r--r--db/post_migrate/20200917165525_update_index_on_namespaces_for_type_and_id.rb23
-rw-r--r--db/post_migrate/20200922054642_drop_snowplow_iglu_registry_url_from_application_settings.rb9
-rw-r--r--db/post_migrate/20200922095954_remove_instance_statistics_visibility_private_from_application_settings.rb13
-rw-r--r--db/post_migrate/20200922170907_change_index_on_pipeline_status.rb21
-rw-r--r--db/post_migrate/20200922231755_remove_created_by_user_id_from_cluster_providers_aws.rb26
-rw-r--r--db/post_migrate/20201001022100_validate_designs_filename_text_limit.rb16
-rw-r--r--db/schema_migrations/202009050132471
-rw-r--r--db/schema_migrations/202009070926101
-rw-r--r--db/schema_migrations/202009070927151
-rw-r--r--db/schema_migrations/202009080642291
-rw-r--r--db/schema_migrations/202009080948101
-rw-r--r--db/schema_migrations/202009090405551
-rw-r--r--db/schema_migrations/202009090833391
-rw-r--r--db/schema_migrations/202009091616241
-rw-r--r--db/schema_migrations/202009121529431
-rw-r--r--db/schema_migrations/202009121532181
-rw-r--r--db/schema_migrations/202009140701401
-rw-r--r--db/schema_migrations/202009151340041
-rw-r--r--db/schema_migrations/202009151857071
-rw-r--r--db/schema_migrations/202009151911561
-rw-r--r--db/schema_migrations/202009161350441
-rw-r--r--db/schema_migrations/202009161514421
-rw-r--r--db/schema_migrations/202009161652321
-rw-r--r--db/schema_migrations/202009171358021
-rw-r--r--db/schema_migrations/202009171655251
-rw-r--r--db/schema_migrations/202009210938261
-rw-r--r--db/schema_migrations/202009211300281
-rw-r--r--db/schema_migrations/202009211313131
-rw-r--r--db/schema_migrations/202009212032311
-rw-r--r--db/schema_migrations/202009220523161
-rw-r--r--db/schema_migrations/202009220546421
-rw-r--r--db/schema_migrations/202009220930041
-rw-r--r--db/schema_migrations/202009220959541
-rw-r--r--db/schema_migrations/202009221709071
-rw-r--r--db/schema_migrations/202009222317551
-rw-r--r--db/schema_migrations/202009230716221
-rw-r--r--db/schema_migrations/202009230716441
-rw-r--r--db/schema_migrations/202009231023121
-rw-r--r--db/schema_migrations/202009231300571
-rw-r--r--db/schema_migrations/202009231404041
-rw-r--r--db/schema_migrations/202009272247501
-rw-r--r--db/schema_migrations/202009280957321
-rw-r--r--db/schema_migrations/202009281004081
-rw-r--r--db/schema_migrations/202009282035311
-rw-r--r--db/schema_migrations/202009282105241
-rw-r--r--db/schema_migrations/202009282336321
-rw-r--r--db/schema_migrations/202009290631591
-rw-r--r--db/schema_migrations/202009300948121
-rw-r--r--db/schema_migrations/202009301313431
-rw-r--r--db/schema_migrations/202009301323191
-rw-r--r--db/schema_migrations/202010010221001
-rw-r--r--db/structure.sql229
93 files changed, 1211 insertions, 41 deletions
diff --git a/db/fixtures/development/29_instance_statistics.rb b/db/fixtures/development/29_instance_statistics.rb
index c4af13d0f4d..e4ef0f26be0 100644
--- a/db/fixtures/development/29_instance_statistics.rb
+++ b/db/fixtures/development/29_instance_statistics.rb
@@ -6,9 +6,9 @@ Gitlab::Seeder.quiet do
model_class = Analytics::InstanceStatistics::Measurement
recorded_at = Date.today
- # Insert random counts for the last 10 weeks
- measurements = 10.times.flat_map do
- recorded_at = (recorded_at - 1.week).end_of_week.end_of_day - 5.minutes
+ # Insert random counts for the last 60 days
+ measurements = 60.times.flat_map do
+ recorded_at = (recorded_at - 1.day).end_of_day - 5.minutes
model_class.identifiers.map do |_, id|
{
diff --git a/db/migrate/20200905013247_add_golang_package_max_file_size_to_plan_limits.rb b/db/migrate/20200905013247_add_golang_package_max_file_size_to_plan_limits.rb
new file mode 100644
index 00000000000..0a6d0ce7339
--- /dev/null
+++ b/db/migrate/20200905013247_add_golang_package_max_file_size_to_plan_limits.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddGolangPackageMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column(:plan_limits, :golang_max_file_size, :bigint, default: 100.megabytes, null: false)
+ end
+end
diff --git a/db/migrate/20200907092610_add_user_id_to_group_import_states.rb b/db/migrate/20200907092610_add_user_id_to_group_import_states.rb
new file mode 100644
index 00000000000..231bafeabdb
--- /dev/null
+++ b/db/migrate/20200907092610_add_user_id_to_group_import_states.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class AddUserIdToGroupImportStates < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless column_exists?(:group_import_states, :user_id)
+ with_lock_retries do
+ add_column :group_import_states, :user_id, :bigint
+ end
+ end
+
+ add_concurrent_foreign_key :group_import_states, :users, column: :user_id, on_delete: :cascade
+ add_concurrent_index :group_import_states, :user_id, where: 'user_id IS NOT NULL', name: 'index_group_import_states_on_user_id'
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :group_import_states, :user_id
+ end
+ end
+end
diff --git a/db/migrate/20200908094810_add_new_setting_to_namespace_setting.rb b/db/migrate/20200908094810_add_new_setting_to_namespace_setting.rb
new file mode 100644
index 00000000000..27fc93a2c53
--- /dev/null
+++ b/db/migrate/20200908094810_add_new_setting_to_namespace_setting.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddNewSettingToNamespaceSetting < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_column :namespace_settings, :allow_mfa_for_subgroups, :boolean, default: true, null: false
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_column :namespace_settings, :allow_mfa_for_subgroups
+ end
+ end
+end
diff --git a/db/migrate/20200909040555_create_package_events.rb b/db/migrate/20200909040555_create_package_events.rb
new file mode 100644
index 00000000000..000ff051a7c
--- /dev/null
+++ b/db/migrate/20200909040555_create_package_events.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class CreatePackageEvents < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ create_table :packages_events do |t|
+ t.integer :event_type, null: false, limit: 2
+ t.integer :event_scope, null: false, limit: 2
+ t.integer :originator_type, null: false, limit: 2
+ t.bigint :originator
+ t.datetime_with_timezone :created_at, null: false
+
+ t.references :package, primary_key: false, default: nil, index: true, foreign_key: { to_table: :packages_packages, on_delete: :nullify }, type: :bigint
+ end
+ end
+end
diff --git a/db/migrate/20200909083339_add_change_reviewer_merge_request_to_notification_settings.rb b/db/migrate/20200909083339_add_change_reviewer_merge_request_to_notification_settings.rb
new file mode 100644
index 00000000000..7024cc4a263
--- /dev/null
+++ b/db/migrate/20200909083339_add_change_reviewer_merge_request_to_notification_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddChangeReviewerMergeRequestToNotificationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :notification_settings, :change_reviewer_merge_request, :boolean
+ end
+end
diff --git a/db/migrate/20200912152943_rename_admin_notification_email_application_setting.rb b/db/migrate/20200912152943_rename_admin_notification_email_application_setting.rb
new file mode 100644
index 00000000000..b469099014d
--- /dev/null
+++ b/db/migrate/20200912152943_rename_admin_notification_email_application_setting.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class RenameAdminNotificationEmailApplicationSetting < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ rename_column_concurrently :application_settings, :admin_notification_email, :abuse_notification_email
+ end
+
+ def down
+ undo_rename_column_concurrently :application_settings, :admin_notification_email, :abuse_notification_email
+ end
+end
diff --git a/db/migrate/20200914070140_add_expiration_policy_started_at_to_container_repositories.rb b/db/migrate/20200914070140_add_expiration_policy_started_at_to_container_repositories.rb
new file mode 100644
index 00000000000..fa787fe98b0
--- /dev/null
+++ b/db/migrate/20200914070140_add_expiration_policy_started_at_to_container_repositories.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddExpirationPolicyStartedAtToContainerRepositories < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ add_column(:container_repositories, :expiration_policy_started_at, :datetime_with_timezone)
+ end
+
+ def down
+ remove_column(:container_repositories, :expiration_policy_started_at)
+ end
+end
diff --git a/db/migrate/20200915134004_add_indices_to_approval_project_rules.rb b/db/migrate/20200915134004_add_indices_to_approval_project_rules.rb
new file mode 100644
index 00000000000..b7b0e1da2cb
--- /dev/null
+++ b/db/migrate/20200915134004_add_indices_to_approval_project_rules.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+# See https://docs.gitlab.com/ee/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddIndicesToApprovalProjectRules < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ RULE_TYPE_INDEX_NAME = 'index_approval_project_rules_on_id_with_regular_type'
+ RULE_ID_INDEX_NAME = 'index_approval_project_rules_users_on_approval_project_rule_id'
+
+ def up
+ add_concurrent_index :approval_project_rules, :id, where: 'rule_type = 0', name: RULE_TYPE_INDEX_NAME
+ add_concurrent_index :approval_project_rules_users, :approval_project_rule_id, name: RULE_ID_INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :approval_project_rules, :id, where: 'rule_type = 0', name: RULE_TYPE_INDEX_NAME
+ remove_concurrent_index :approval_project_rules_users, :approval_project_rule_id, name: RULE_ID_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20200916135044_add_state_id_index_to_merge_requests.rb b/db/migrate/20200916135044_add_state_id_index_to_merge_requests.rb
new file mode 100644
index 00000000000..bec162ff888
--- /dev/null
+++ b/db/migrate/20200916135044_add_state_id_index_to_merge_requests.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddStateIdIndexToMergeRequests < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :merge_requests, [:target_project_id, :iid, :state_id], name: :index_merge_requests_on_target_project_id_and_iid_and_state_id
+ end
+
+ def down
+ remove_concurrent_index :merge_requests, [:target_project_id, :iid, :state_id], name: :index_merge_requests_on_target_project_id_and_iid_and_state_id
+ end
+end
diff --git a/db/migrate/20200916151442_add_result_index_to_authentication_events.rb b/db/migrate/20200916151442_add_result_index_to_authentication_events.rb
new file mode 100644
index 00000000000..13b0521038e
--- /dev/null
+++ b/db/migrate/20200916151442_add_result_index_to_authentication_events.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddResultIndexToAuthenticationEvents < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_authentication_events_on_provider_user_id_created_at'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :authentication_events, [:provider, :user_id, :created_at], where: 'result = 1', name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :authentication_events, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20200916165232_add_debian_max_file_size_to_plan_limits.rb b/db/migrate/20200916165232_add_debian_max_file_size_to_plan_limits.rb
new file mode 100644
index 00000000000..9a91a5d2195
--- /dev/null
+++ b/db/migrate/20200916165232_add_debian_max_file_size_to_plan_limits.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddDebianMaxFileSizeToPlanLimits < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :plan_limits, :debian_max_file_size, :bigint, default: 3.gigabytes, null: false
+ end
+end
diff --git a/db/migrate/20200921093826_add_index_to_user_preferences.rb b/db/migrate/20200921093826_add_index_to_user_preferences.rb
new file mode 100644
index 00000000000..78b04eb7a83
--- /dev/null
+++ b/db/migrate/20200921093826_add_index_to_user_preferences.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexToUserPreferences < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :user_preferences, :gitpod_enabled, name: :index_user_preferences_on_gitpod_enabled
+ end
+
+ def down
+ remove_concurrent_index :user_preferences, :gitpod_enabled, name: :index_user_preferences_on_gitpod_enabled
+ end
+end
diff --git a/db/migrate/20200921130028_add_pages_deployment_id_to_pages_metadata.rb b/db/migrate/20200921130028_add_pages_deployment_id_to_pages_metadata.rb
new file mode 100644
index 00000000000..395ce43d8ac
--- /dev/null
+++ b/db/migrate/20200921130028_add_pages_deployment_id_to_pages_metadata.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddPagesDeploymentIdToPagesMetadata < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :project_pages_metadata, :pages_deployment_id, :bigint
+ end
+end
diff --git a/db/migrate/20200921131313_add_foreign_key_to_pages_deployment_id_in_project_pages_metadata.rb b/db/migrate/20200921131313_add_foreign_key_to_pages_deployment_id_in_project_pages_metadata.rb
new file mode 100644
index 00000000000..8611f3ab943
--- /dev/null
+++ b/db/migrate/20200921131313_add_foreign_key_to_pages_deployment_id_in_project_pages_metadata.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToPagesDeploymentIdInProjectPagesMetadata < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_project_pages_metadata_on_pages_deployment_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:project_pages_metadata, :pages_deployment_id, name: INDEX_NAME)
+ add_concurrent_foreign_key :project_pages_metadata, :pages_deployments, column: :pages_deployment_id, on_delete: :nullify
+ end
+
+ def down
+ remove_foreign_key_if_exists :project_pages_metadata, column: :pages_deployment_id
+ remove_concurrent_index_by_name(:project_pages_metadata, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20200921203231_remove_duplicate_cluster_agents_index.rb b/db/migrate/20200921203231_remove_duplicate_cluster_agents_index.rb
new file mode 100644
index 00000000000..3f073e32d84
--- /dev/null
+++ b/db/migrate/20200921203231_remove_duplicate_cluster_agents_index.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveDuplicateClusterAgentsIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX = 'index_cluster_agents_on_project_id'
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name :cluster_agents, INDEX
+ end
+
+ def down
+ add_concurrent_index :cluster_agents, :project_id, name: INDEX
+ end
+end
diff --git a/db/migrate/20200922052316_create_issue_email_participants.rb b/db/migrate/20200922052316_create_issue_email_participants.rb
new file mode 100644
index 00000000000..a8aeb9d9a5a
--- /dev/null
+++ b/db/migrate/20200922052316_create_issue_email_participants.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+class CreateIssueEmailParticipants < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:issue_email_participants)
+ with_lock_retries do
+ create_table :issue_email_participants do |t|
+ t.references :issue, index: false, null: false, foreign_key: { on_delete: :cascade }
+ t.datetime_with_timezone :created_at, null: false
+ t.datetime_with_timezone :updated_at, null: false
+ t.text :email, null: false
+
+ t.index [:issue_id, :email], unique: true
+ end
+ end
+
+ add_text_limit(:issue_email_participants, :email, 255)
+ end
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :issue_email_participants
+ end
+ end
+end
diff --git a/db/migrate/20200922093004_add_postgres_index_view.rb b/db/migrate/20200922093004_add_postgres_index_view.rb
new file mode 100644
index 00000000000..c16eae4dd0b
--- /dev/null
+++ b/db/migrate/20200922093004_add_postgres_index_view.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class AddPostgresIndexView < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ execute(<<~SQL)
+ CREATE VIEW postgres_indexes AS
+ SELECT
+ pg_namespace.nspname || '.' || pg_class.relname as identifier,
+ pg_index.indexrelid,
+ pg_namespace.nspname as schema,
+ pg_class.relname as name,
+ pg_index.indisunique as unique,
+ pg_index.indisvalid as valid_index,
+ pg_class.relispartition as partitioned,
+ pg_index.indisexclusion as exclusion,
+ pg_indexes.indexdef as definition,
+ pg_relation_size(pg_class.oid) as ondisk_size_bytes
+ FROM pg_index
+ INNER JOIN pg_class ON pg_class.oid = pg_index.indexrelid
+ INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid
+ INNER JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname
+ WHERE pg_namespace.nspname <> 'pg_catalog'
+ SQL
+ end
+
+ def down
+ execute(<<~SQL)
+ DROP VIEW postgres_indexes
+ SQL
+ end
+end
diff --git a/db/migrate/20200923071622_add_description_to_requirements.rb b/db/migrate/20200923071622_add_description_to_requirements.rb
new file mode 100644
index 00000000000..b4b1250c10a
--- /dev/null
+++ b/db/migrate/20200923071622_add_description_to_requirements.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddDescriptionToRequirements < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit for description is added in 20200923071644_add_text_limit_to_requirements_description
+ # for description_html limit is not set because it's for caching purposes and
+ # its value is generated from `description`
+ def change
+ add_column :requirements, :description, :text
+ add_column :requirements, :description_html, :text
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20200923071644_add_text_limit_to_requirements_description.rb b/db/migrate/20200923071644_add_text_limit_to_requirements_description.rb
new file mode 100644
index 00000000000..0172d6bbba3
--- /dev/null
+++ b/db/migrate/20200923071644_add_text_limit_to_requirements_description.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddTextLimitToRequirementsDescription < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :requirements, :description, 10_000
+ end
+
+ def down
+ remove_text_limit :requirements, :description
+ end
+end
diff --git a/db/migrate/20200923102312_update_programming_language_colors.rb b/db/migrate/20200923102312_update_programming_language_colors.rb
new file mode 100644
index 00000000000..37233bd3148
--- /dev/null
+++ b/db/migrate/20200923102312_update_programming_language_colors.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+require 'yaml'
+
+class UpdateProgrammingLanguageColors < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ class ProgrammingLanguage < ActiveRecord::Base; end
+
+ def up
+ YAML.load_file("vendor/languages.yml").each do |name, metadata|
+ color = metadata["color"]
+ next unless color.present?
+
+ ProgrammingLanguage.where(name: name).update(color: color)
+ end
+ end
+
+ def down
+ # noop
+ end
+end
diff --git a/db/migrate/20200923130057_remove_tmp_container_scanning_index.rb b/db/migrate/20200923130057_remove_tmp_container_scanning_index.rb
new file mode 100644
index 00000000000..e9ab6f9ff15
--- /dev/null
+++ b/db/migrate/20200923130057_remove_tmp_container_scanning_index.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class RemoveTmpContainerScanningIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'tmp_index_for_fixing_inconsistent_vulnerability_occurrences'
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index_by_name(:vulnerability_occurrences, INDEX_NAME)
+ end
+
+ def down
+ # report_type: 2 container scanning
+ add_concurrent_index(:vulnerability_occurrences, :id,
+ where: "LENGTH(location_fingerprint) = 40 AND report_type = 2",
+ name: INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20200923140404_add_postgres_reindex_actions_table.rb b/db/migrate/20200923140404_add_postgres_reindex_actions_table.rb
new file mode 100644
index 00000000000..ed37e44e201
--- /dev/null
+++ b/db/migrate/20200923140404_add_postgres_reindex_actions_table.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class AddPostgresReindexActionsTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ create_table :postgres_reindex_actions, if_not_exists: true do |t|
+ t.datetime_with_timezone :action_start, null: false
+ t.datetime_with_timezone :action_end
+ t.bigint :ondisk_size_bytes_start, null: false
+ t.bigint :ondisk_size_bytes_end
+ t.integer :state, limit: 2, null: false, default: 0
+ t.text :index_identifier, null: false, index: true
+ end
+
+ add_text_limit(:postgres_reindex_actions, :index_identifier, 255)
+ end
+
+ def down
+ drop_table :postgres_reindex_actions
+ end
+end
diff --git a/db/migrate/20200927224750_add_incident_issue_type_index_to_issues.rb b/db/migrate/20200927224750_add_incident_issue_type_index_to_issues.rb
new file mode 100644
index 00000000000..ed4dd5b9cc1
--- /dev/null
+++ b/db/migrate/20200927224750_add_incident_issue_type_index_to_issues.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddIncidentIssueTypeIndexToIssues < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INCIDENT_ISSUE_TYPE = 1
+ INDEX_NAME = 'index_issues_project_id_issue_type_incident'
+
+ def up
+ add_concurrent_index :issues, :project_id, where: "issue_type = #{INCIDENT_ISSUE_TYPE}", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name(:issues, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20200928095732_add_state_to_dast_site_validation.rb b/db/migrate/20200928095732_add_state_to_dast_site_validation.rb
new file mode 100644
index 00000000000..7adeef54d71
--- /dev/null
+++ b/db/migrate/20200928095732_add_state_to_dast_site_validation.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class AddStateToDastSiteValidation < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ # rubocop:disable Migration/AddLimitToTextColumns
+ # limit is added in 20200928100408_add_text_limit_to_dast_site_validation_state.rb
+ def change
+ add_column :dast_site_validations, :state, :text, default: :pending, null: false
+ end
+ # rubocop:enable Migration/AddLimitToTextColumns
+end
diff --git a/db/migrate/20200928100408_add_text_limit_to_dast_site_validation_state.rb b/db/migrate/20200928100408_add_text_limit_to_dast_site_validation_state.rb
new file mode 100644
index 00000000000..18bf7ee4bdc
--- /dev/null
+++ b/db/migrate/20200928100408_add_text_limit_to_dast_site_validation_state.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddTextLimitToDastSiteValidationState < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_text_limit :dast_site_validations, :state, 255
+ end
+
+ def down
+ remove_text_limit :dast_site_validations, :state
+ end
+end
diff --git a/db/migrate/20200928203531_create_alert_management_http_integrations.rb b/db/migrate/20200928203531_create_alert_management_http_integrations.rb
new file mode 100644
index 00000000000..fe13fe400e3
--- /dev/null
+++ b/db/migrate/20200928203531_create_alert_management_http_integrations.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class CreateAlertManagementHttpIntegrations < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ UNIQUE_INDEX = 'index_http_integrations_on_active_and_project_and_endpoint'
+
+ disable_ddl_transaction!
+
+ def up
+ create_table :alert_management_http_integrations, if_not_exists: true do |t|
+ t.timestamps_with_timezone
+ t.bigint :project_id, index: true, null: false
+ t.boolean :active, null: false, default: false
+ t.text :encrypted_token, null: false
+ t.text :encrypted_token_iv, null: false
+ t.text :endpoint_identifier, null: false
+ t.text :name, null: false
+ end
+
+ add_text_limit :alert_management_http_integrations, :encrypted_token, 255
+ add_text_limit :alert_management_http_integrations, :encrypted_token_iv, 255
+ add_text_limit :alert_management_http_integrations, :endpoint_identifier, 255
+ add_text_limit :alert_management_http_integrations, :name, 255
+
+ add_index :alert_management_http_integrations,
+ [:active, :project_id, :endpoint_identifier],
+ unique: true,
+ name: UNIQUE_INDEX,
+ where: 'active'
+ end
+
+ def down
+ drop_table :alert_management_http_integrations
+ end
+end
diff --git a/db/migrate/20200928210524_add_http_integrations_project_foreign_key.rb b/db/migrate/20200928210524_add_http_integrations_project_foreign_key.rb
new file mode 100644
index 00000000000..f59a5a0b5bb
--- /dev/null
+++ b/db/migrate/20200928210524_add_http_integrations_project_foreign_key.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddHttpIntegrationsProjectForeignKey < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :alert_management_http_integrations, :projects, column: :project_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :alert_management_http_integrations, column: :project_id
+ end
+ end
+end
diff --git a/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb b/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb
new file mode 100644
index 00000000000..0256d580cd6
--- /dev/null
+++ b/db/migrate/20200928233632_remove_terraform_state_verification_indexes.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class RemoveTerraformStateVerificationIndexes < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ CHECKSUM_INDEX_NAME = "terraform_states_verification_checksum_partial".freeze
+ FAILURE_INDEX_NAME = "terraform_states_verification_failure_partial".freeze
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index :terraform_states, :verification_failure, name: FAILURE_INDEX_NAME
+ remove_concurrent_index :terraform_states, :verification_checksum, name: CHECKSUM_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :terraform_states, :verification_failure, where: "(verification_failure IS NOT NULL)", name: FAILURE_INDEX_NAME
+ add_concurrent_index :terraform_states, :verification_checksum, where: "(verification_checksum IS NOT NULL)", name: CHECKSUM_INDEX_NAME
+ end
+end
diff --git a/db/migrate/20200929063159_add_require_admin_approval_after_user_signup_to_application_settings.rb b/db/migrate/20200929063159_add_require_admin_approval_after_user_signup_to_application_settings.rb
new file mode 100644
index 00000000000..92d82757b79
--- /dev/null
+++ b/db/migrate/20200929063159_add_require_admin_approval_after_user_signup_to_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddRequireAdminApprovalAfterUserSignupToApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :require_admin_approval_after_user_signup, :boolean, default: false, null: false
+ end
+end
diff --git a/db/migrate/20200930094812_update_postgres_indexes_view.rb b/db/migrate/20200930094812_update_postgres_indexes_view.rb
new file mode 100644
index 00000000000..b36ea362e6f
--- /dev/null
+++ b/db/migrate/20200930094812_update_postgres_indexes_view.rb
@@ -0,0 +1,54 @@
+# frozen_string_literal: true
+
+class UpdatePostgresIndexesView < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ execute(<<~SQL)
+ CREATE OR REPLACE VIEW postgres_indexes AS
+ SELECT
+ pg_namespace.nspname || '.' || pg_class.relname as identifier,
+ pg_index.indexrelid,
+ pg_namespace.nspname as schema,
+ pg_class.relname as name,
+ pg_index.indisunique as unique,
+ pg_index.indisvalid as valid_index,
+ pg_class.relispartition as partitioned,
+ pg_index.indisexclusion as exclusion,
+ pg_indexes.indexdef as definition,
+ pg_relation_size(pg_class.oid) as ondisk_size_bytes
+ FROM pg_index
+ INNER JOIN pg_class ON pg_class.oid = pg_index.indexrelid
+ INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid
+ INNER JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname
+ WHERE pg_namespace.nspname <> 'pg_catalog'
+ AND pg_namespace.nspname IN (
+ current_schema(),
+ 'gitlab_partitions_dynamic',
+ 'gitlab_partitions_static'
+ )
+ SQL
+ end
+
+ def down
+ execute(<<~SQL)
+ CREATE OR REPLACE VIEW postgres_indexes AS
+ SELECT
+ pg_namespace.nspname || '.' || pg_class.relname as identifier,
+ pg_index.indexrelid,
+ pg_namespace.nspname as schema,
+ pg_class.relname as name,
+ pg_index.indisunique as unique,
+ pg_index.indisvalid as valid_index,
+ pg_class.relispartition as partitioned,
+ pg_index.indisexclusion as exclusion,
+ pg_indexes.indexdef as definition,
+ pg_relation_size(pg_class.oid) as ondisk_size_bytes
+ FROM pg_index
+ INNER JOIN pg_class ON pg_class.oid = pg_index.indexrelid
+ INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid
+ INNER JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname
+ WHERE pg_namespace.nspname <> 'pg_catalog'
+ SQL
+ end
+end
diff --git a/db/migrate/20200930131343_add_index_on_project_id_and_sha_to_deployments.rb b/db/migrate/20200930131343_add_index_on_project_id_and_sha_to_deployments.rb
new file mode 100644
index 00000000000..19a536f8f6e
--- /dev/null
+++ b/db/migrate/20200930131343_add_index_on_project_id_and_sha_to_deployments.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+# See https://docs.gitlab.com/ee/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddIndexOnProjectIdAndShaToDeployments < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+ INDEX_NAME = 'index_deployments_on_project_id_sha'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :deployments, [:project_id, :sha], name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name(:deployments, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20200930132319_add_api_fuzzing_to_plan_limits.rb b/db/migrate/20200930132319_add_api_fuzzing_to_plan_limits.rb
new file mode 100644
index 00000000000..9be79974ee4
--- /dev/null
+++ b/db/migrate/20200930132319_add_api_fuzzing_to_plan_limits.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddApiFuzzingToPlanLimits < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :plan_limits, "ci_max_artifact_size_api_fuzzing", :integer, default: 0, null: false
+ end
+end
diff --git a/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb b/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb
index 1ead10a4de6..9e606b2264b 100644
--- a/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb
+++ b/db/post_migrate/20200511083541_cleanup_projects_with_missing_namespace.rb
@@ -66,8 +66,6 @@ class CleanupProjectsWithMissingNamespace < ActiveRecord::Migration[6.0]
end
def ensure_bio_is_assigned_to_user_details
- return if Feature.disabled?(:migrate_bio_to_user_details, default_enabled: true)
-
user_detail.bio = bio.to_s[0...255]
end
diff --git a/db/post_migrate/20200907092715_add_not_null_constraint_to_user_on_group_import_states.rb b/db/post_migrate/20200907092715_add_not_null_constraint_to_user_on_group_import_states.rb
new file mode 100644
index 00000000000..4f2edad43d8
--- /dev/null
+++ b/db/post_migrate/20200907092715_add_not_null_constraint_to_user_on_group_import_states.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddNotNullConstraintToUserOnGroupImportStates < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_not_null_constraint :group_import_states, :user_id, validate: false
+ end
+
+ def down
+ remove_not_null_constraint :group_import_states, :user_id
+ end
+end
diff --git a/db/post_migrate/20200908064229_add_partial_index_to_ci_builds_table_on_user_id_name.rb b/db/post_migrate/20200908064229_add_partial_index_to_ci_builds_table_on_user_id_name.rb
new file mode 100644
index 00000000000..433fa957c38
--- /dev/null
+++ b/db/post_migrate/20200908064229_add_partial_index_to_ci_builds_table_on_user_id_name.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class AddPartialIndexToCiBuildsTableOnUserIdName < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_partial_ci_builds_on_user_id_name_parser_features'
+ FILTER_CONDITION = <<~SQL
+ (((type)::text = 'Ci::Build'::text) AND
+ ((name)::text = ANY (
+ ARRAY[
+ ('container_scanning'::character varying)::text,
+ ('dast'::character varying)::text,
+ ('dependency_scanning'::character varying)::text,
+ ('license_management'::character varying)::text,
+ ('license_scanning'::character varying)::text,
+ ('sast'::character varying)::text,
+ ('coverage_fuzzing'::character varying)::text,
+ ('secret_detection'::character varying)::text
+ ]
+ ))
+ )
+ SQL
+
+ def up
+ add_concurrent_index(:ci_builds,
+ [:user_id, :name],
+ where: FILTER_CONDITION,
+ name: INDEX_NAME)
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_builds, INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb b/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb
new file mode 100644
index 00000000000..861d9e40e77
--- /dev/null
+++ b/db/post_migrate/20200909161624_cleanup_group_import_states_with_null_user_id.rb
@@ -0,0 +1,80 @@
+# frozen_string_literal: true
+
+class CleanupGroupImportStatesWithNullUserId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ # With BATCH_SIZE=1000 and group_import_states.count=600 on GitLab.com
+ # - 1 iteration will be run
+ # - each batch requires on average ~2500ms
+ # - 600 rows require on average ~1500ms
+ # Expected total run time: ~2500ms
+ BATCH_SIZE = 1000
+
+ disable_ddl_transaction!
+
+ class User < ActiveRecord::Base
+ self.table_name = 'users'
+ end
+
+ class Namespace < ActiveRecord::Base
+ self.table_name = 'namespaces'
+
+ belongs_to :owner, class_name: 'CleanupGroupImportStatesWithNullUserId::User'
+ end
+
+ class Member < ActiveRecord::Base
+ self.table_name = 'members'
+ self.inheritance_column = :_type_disabled
+
+ belongs_to :user, class_name: 'CleanupGroupImportStatesWithNullUserId::User'
+ end
+
+ class Group < Namespace
+ OWNER = 50
+
+ self.inheritance_column = :_type_disabled
+
+ def default_owner
+ owners.first || parent&.default_owner || owner
+ end
+
+ def parent
+ Group.find_by_id(parent_id)
+ end
+
+ def owners
+ Member.where(type: 'GroupMember', source_type: 'Namespace', source_id: id, requested_at: nil, access_level: OWNER).map(&:user)
+ end
+ end
+
+ class GroupImportState < ActiveRecord::Base
+ include ::EachBatch
+
+ self.table_name = 'group_import_states'
+
+ belongs_to :group, class_name: 'CleanupGroupImportStatesWithNullUserId::Group'
+ belongs_to :user, class_name: 'CleanupGroupImportStatesWithNullUserId::User'
+ end
+
+ def up
+ User.reset_column_information
+ Namespace.reset_column_information
+ Member.reset_column_information
+ Group.reset_column_information
+ GroupImportState.reset_column_information
+
+ GroupImportState.each_batch(of: BATCH_SIZE) do |batch|
+ batch.each do |group_import_state|
+ owner_id = Group.find_by_id(group_import_state.group_id)&.default_owner&.id
+
+ group_import_state.update!(user_id: owner_id) if owner_id
+ end
+ end
+
+ GroupImportState.where('user_id IS NULL').delete_all
+ end
+
+ def down
+ # no-op : can't go back to `NULL` without first dropping the `NOT NULL` constraint
+ end
+end
diff --git a/db/post_migrate/20200912153218_cleanup_admin_notification_email_application_setting_rename.rb b/db/post_migrate/20200912153218_cleanup_admin_notification_email_application_setting_rename.rb
new file mode 100644
index 00000000000..35c54b64ddf
--- /dev/null
+++ b/db/post_migrate/20200912153218_cleanup_admin_notification_email_application_setting_rename.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class CleanupAdminNotificationEmailApplicationSettingRename < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ cleanup_concurrent_column_rename :application_settings, :admin_notification_email, :abuse_notification_email
+ end
+
+ def down
+ undo_cleanup_concurrent_column_rename :application_settings, :admin_notification_email, :abuse_notification_email
+ end
+end
diff --git a/db/post_migrate/20200915185707_ensure_filled_file_store_on_package_files.rb b/db/post_migrate/20200915185707_ensure_filled_file_store_on_package_files.rb
new file mode 100644
index 00000000000..ec6f6df27bc
--- /dev/null
+++ b/db/post_migrate/20200915185707_ensure_filled_file_store_on_package_files.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class EnsureFilledFileStoreOnPackageFiles < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ BACKGROUND_MIGRATION_CLASS = 'SetNullPackageFilesFileStoreToLocalValue'
+ BATCH_SIZE = 5_000
+ LOCAL_STORE = 1 # equal to ObjectStorage::Store::LOCAL
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ module Packages
+ class PackageFile < ActiveRecord::Base
+ self.table_name = 'packages_package_files'
+
+ include ::EachBatch
+ end
+ end
+
+ def up
+ Gitlab::BackgroundMigration.steal(BACKGROUND_MIGRATION_CLASS)
+
+ # Do a manual update in case we lost BG jobs. The expected record count should be 0 or very low.
+ Packages::PackageFile.where(file_store: nil).each_batch(of: BATCH_SIZE) do |batch, index|
+ batch.update_all(file_store: LOCAL_STORE)
+ end
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20200915191156_validate_not_null_file_store_on_package_files.rb b/db/post_migrate/20200915191156_validate_not_null_file_store_on_package_files.rb
new file mode 100644
index 00000000000..5e6db9cec3f
--- /dev/null
+++ b/db/post_migrate/20200915191156_validate_not_null_file_store_on_package_files.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class ValidateNotNullFileStoreOnPackageFiles < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ # Remove index which was only added to fill file_store
+ INDEX_NAME = 'index_packages_package_files_file_store_is_null'
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ validate_not_null_constraint :packages_package_files, :file_store
+
+ remove_concurrent_index_by_name :packages_package_files, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :packages_package_files, :id, where: 'file_store IS NULL', name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20200917135802_remove_duplicated_cs_findings_without_vulnerability_id.rb b/db/post_migrate/20200917135802_remove_duplicated_cs_findings_without_vulnerability_id.rb
new file mode 100644
index 00000000000..0e161b5de78
--- /dev/null
+++ b/db/post_migrate/20200917135802_remove_duplicated_cs_findings_without_vulnerability_id.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class RemoveDuplicatedCsFindingsWithoutVulnerabilityId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ BATCH_SIZE = 1_000
+
+ INTERVAL = 2.minutes
+
+ # 1_500 records will be deleted
+ def up
+ return unless Gitlab.com?
+
+ migration = Gitlab::BackgroundMigration::RemoveDuplicatedCsFindingsWithoutVulnerabilityId
+ migration_name = migration.to_s.demodulize
+ relation = migration::Finding.container_scanning.with_broken_fingerprint.where(vulnerability_id: nil)
+ queue_background_migration_jobs_by_range_at_intervals(relation,
+ migration_name,
+ INTERVAL,
+ batch_size: BATCH_SIZE)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20200917165525_update_index_on_namespaces_for_type_and_id.rb b/db/post_migrate/20200917165525_update_index_on_namespaces_for_type_and_id.rb
new file mode 100644
index 00000000000..35b72b4f160
--- /dev/null
+++ b/db/post_migrate/20200917165525_update_index_on_namespaces_for_type_and_id.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class UpdateIndexOnNamespacesForTypeAndId < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ disable_ddl_transaction!
+
+ OLD_INDEX_NAME = 'index_namespaces_on_type_partial'
+ NEW_INDEX_NAME = 'index_namespaces_on_type_and_id_partial'
+
+ def up
+ add_concurrent_index(:namespaces, [:type, :id], where: 'type IS NOT NULL', name: NEW_INDEX_NAME)
+
+ remove_concurrent_index_by_name(:namespaces, OLD_INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:namespaces, :type, where: 'type IS NOT NULL', name: OLD_INDEX_NAME)
+
+ remove_concurrent_index_by_name(:namespaces, NEW_INDEX_NAME)
+ end
+end
diff --git a/db/post_migrate/20200922054642_drop_snowplow_iglu_registry_url_from_application_settings.rb b/db/post_migrate/20200922054642_drop_snowplow_iglu_registry_url_from_application_settings.rb
new file mode 100644
index 00000000000..d3e64f1f4c2
--- /dev/null
+++ b/db/post_migrate/20200922054642_drop_snowplow_iglu_registry_url_from_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class DropSnowplowIgluRegistryUrlFromApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ remove_column :application_settings, :snowplow_iglu_registry_url, :string, limit: 255
+ end
+end
diff --git a/db/post_migrate/20200922095954_remove_instance_statistics_visibility_private_from_application_settings.rb b/db/post_migrate/20200922095954_remove_instance_statistics_visibility_private_from_application_settings.rb
new file mode 100644
index 00000000000..1d01e54013d
--- /dev/null
+++ b/db/post_migrate/20200922095954_remove_instance_statistics_visibility_private_from_application_settings.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class RemoveInstanceStatisticsVisibilityPrivateFromApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def up
+ remove_column :application_settings, :instance_statistics_visibility_private
+ end
+
+ def down
+ add_column :application_settings, :instance_statistics_visibility_private, :boolean, default: false, null: false
+ end
+end
diff --git a/db/post_migrate/20200922170907_change_index_on_pipeline_status.rb b/db/post_migrate/20200922170907_change_index_on_pipeline_status.rb
new file mode 100644
index 00000000000..61648788d7f
--- /dev/null
+++ b/db/post_migrate/20200922170907_change_index_on_pipeline_status.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class ChangeIndexOnPipelineStatus < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ OLD_INDEX_NAME = 'index_ci_pipelines_on_status'
+ NEW_INDEX_NAME = 'index_ci_pipelines_on_status_and_id'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_pipelines, [:status, :id], name: NEW_INDEX_NAME
+ remove_concurrent_index_by_name :ci_pipelines, name: OLD_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :ci_pipelines, :status, name: OLD_INDEX_NAME
+ remove_concurrent_index_by_name :ci_pipelines, name: NEW_INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20200922231755_remove_created_by_user_id_from_cluster_providers_aws.rb b/db/post_migrate/20200922231755_remove_created_by_user_id_from_cluster_providers_aws.rb
new file mode 100644
index 00000000000..02cc9676202
--- /dev/null
+++ b/db/post_migrate/20200922231755_remove_created_by_user_id_from_cluster_providers_aws.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class RemoveCreatedByUserIdFromClusterProvidersAws < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_cluster_providers_aws_on_created_by_user_id'
+
+ disable_ddl_transaction!
+
+ def up
+ with_lock_retries do
+ remove_column :cluster_providers_aws, :created_by_user_id
+ end
+ end
+
+ def down
+ unless column_exists?(:cluster_providers_aws, :created_by_user_id)
+ add_column :cluster_providers_aws, :created_by_user_id, :integer
+ end
+
+ add_concurrent_index :cluster_providers_aws, :created_by_user_id, name: INDEX_NAME
+
+ add_concurrent_foreign_key :cluster_providers_aws, :users, column: :created_by_user_id, on_delete: :nullify
+ end
+end
diff --git a/db/post_migrate/20201001022100_validate_designs_filename_text_limit.rb b/db/post_migrate/20201001022100_validate_designs_filename_text_limit.rb
new file mode 100644
index 00000000000..35ed8c20671
--- /dev/null
+++ b/db/post_migrate/20201001022100_validate_designs_filename_text_limit.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class ValidateDesignsFilenameTextLimit < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ validate_text_limit :design_management_designs, :filename
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/schema_migrations/20200905013247 b/db/schema_migrations/20200905013247
new file mode 100644
index 00000000000..b0926ca1d99
--- /dev/null
+++ b/db/schema_migrations/20200905013247
@@ -0,0 +1 @@
+860c45fd6293f2f8f10d7351cb5a2fbab2cc9147e56b538cb62d75469b039ef0 \ No newline at end of file
diff --git a/db/schema_migrations/20200907092610 b/db/schema_migrations/20200907092610
new file mode 100644
index 00000000000..63eecc83a3c
--- /dev/null
+++ b/db/schema_migrations/20200907092610
@@ -0,0 +1 @@
+de1051e8f2d9f042ac923686b8c61e743c695736e8c7ebfdf6f87ab1ed09a11f \ No newline at end of file
diff --git a/db/schema_migrations/20200907092715 b/db/schema_migrations/20200907092715
new file mode 100644
index 00000000000..700db177075
--- /dev/null
+++ b/db/schema_migrations/20200907092715
@@ -0,0 +1 @@
+2610104c89134b94d460a714f17c23e5e35d76147c1f25be6c02804a39725d6c \ No newline at end of file
diff --git a/db/schema_migrations/20200908064229 b/db/schema_migrations/20200908064229
new file mode 100644
index 00000000000..37958f04de8
--- /dev/null
+++ b/db/schema_migrations/20200908064229
@@ -0,0 +1 @@
+e73076f6d7540372ee16fe26dcb44e8b84dde69e27c46483ee26883e81059501 \ No newline at end of file
diff --git a/db/schema_migrations/20200908094810 b/db/schema_migrations/20200908094810
new file mode 100644
index 00000000000..a047e64107b
--- /dev/null
+++ b/db/schema_migrations/20200908094810
@@ -0,0 +1 @@
+327cd19cd6c0f273aea61ffebf10046fb7229516bc4ed28f3c0290bb3ad04755 \ No newline at end of file
diff --git a/db/schema_migrations/20200909040555 b/db/schema_migrations/20200909040555
new file mode 100644
index 00000000000..27855514146
--- /dev/null
+++ b/db/schema_migrations/20200909040555
@@ -0,0 +1 @@
+f68d29be164299e5ccf73347841d27b17f028941e37e3510d3da9d513762a17f \ No newline at end of file
diff --git a/db/schema_migrations/20200909083339 b/db/schema_migrations/20200909083339
new file mode 100644
index 00000000000..179a683412c
--- /dev/null
+++ b/db/schema_migrations/20200909083339
@@ -0,0 +1 @@
+8b2090e953e6205b65555408a88d3da7f6bce28b0baa52d1a43a3a3e8001b7e1 \ No newline at end of file
diff --git a/db/schema_migrations/20200909161624 b/db/schema_migrations/20200909161624
new file mode 100644
index 00000000000..941af468398
--- /dev/null
+++ b/db/schema_migrations/20200909161624
@@ -0,0 +1 @@
+2d7f514429e9a08ce13995feff43e221b3e2e74737ed48f81e104008d8ec24b9 \ No newline at end of file
diff --git a/db/schema_migrations/20200912152943 b/db/schema_migrations/20200912152943
new file mode 100644
index 00000000000..4dd1ae708cd
--- /dev/null
+++ b/db/schema_migrations/20200912152943
@@ -0,0 +1 @@
+b8d7a2ec9ecf51fd7cb9346e1484b45d5b472a85d90ad270d08c1cca1b44f039 \ No newline at end of file
diff --git a/db/schema_migrations/20200912153218 b/db/schema_migrations/20200912153218
new file mode 100644
index 00000000000..9c013281ea2
--- /dev/null
+++ b/db/schema_migrations/20200912153218
@@ -0,0 +1 @@
+fd632247f1588c537e83574edd7936c530e154091e3101d0404da3b7ef8b4bef \ No newline at end of file
diff --git a/db/schema_migrations/20200914070140 b/db/schema_migrations/20200914070140
new file mode 100644
index 00000000000..b9cac3a3726
--- /dev/null
+++ b/db/schema_migrations/20200914070140
@@ -0,0 +1 @@
+8cabe224e89ef77fe4a2bc1f8bf7381faaa10d1cab4907a26aeb2162a126af52 \ No newline at end of file
diff --git a/db/schema_migrations/20200915134004 b/db/schema_migrations/20200915134004
new file mode 100644
index 00000000000..a8857de0ada
--- /dev/null
+++ b/db/schema_migrations/20200915134004
@@ -0,0 +1 @@
+dd630c76819641ad64a5f6ae40ad4f49e7fbe1c783398d97886dc7e9852a245e \ No newline at end of file
diff --git a/db/schema_migrations/20200915185707 b/db/schema_migrations/20200915185707
new file mode 100644
index 00000000000..2161aa5acf8
--- /dev/null
+++ b/db/schema_migrations/20200915185707
@@ -0,0 +1 @@
+e1ae80d6f0a6372bb329d45257d9a0a8ca5b6a83718d2a10ee295b8c4c97f60e \ No newline at end of file
diff --git a/db/schema_migrations/20200915191156 b/db/schema_migrations/20200915191156
new file mode 100644
index 00000000000..5005ee15989
--- /dev/null
+++ b/db/schema_migrations/20200915191156
@@ -0,0 +1 @@
+d8ddec6b234d59b3b85705dfa7b724d3be4974bfa57fae70aa5c2dbdd2e73cfa \ No newline at end of file
diff --git a/db/schema_migrations/20200916135044 b/db/schema_migrations/20200916135044
new file mode 100644
index 00000000000..8bb10fbb1e3
--- /dev/null
+++ b/db/schema_migrations/20200916135044
@@ -0,0 +1 @@
+299e6fb38da303f06ab006a25701ff1c58ce2abfa8cf93c3c8b866ee0b2bd1cc \ No newline at end of file
diff --git a/db/schema_migrations/20200916151442 b/db/schema_migrations/20200916151442
new file mode 100644
index 00000000000..36b2a4e9962
--- /dev/null
+++ b/db/schema_migrations/20200916151442
@@ -0,0 +1 @@
+aef52404e6ce83d5d4b3de65ad00b665334f5ff2e5b7b6c3c622f79313657f26 \ No newline at end of file
diff --git a/db/schema_migrations/20200916165232 b/db/schema_migrations/20200916165232
new file mode 100644
index 00000000000..8e97fcf3efa
--- /dev/null
+++ b/db/schema_migrations/20200916165232
@@ -0,0 +1 @@
+18a3981a3becefe6700dd5fea87e8ba9478c0e83ddc80de1b3ee2ed77c221ce6 \ No newline at end of file
diff --git a/db/schema_migrations/20200917135802 b/db/schema_migrations/20200917135802
new file mode 100644
index 00000000000..7b948de646b
--- /dev/null
+++ b/db/schema_migrations/20200917135802
@@ -0,0 +1 @@
+8d9e75f7c6344b03cb740fa691fcbb5bea1751802741229158701bc1af975897 \ No newline at end of file
diff --git a/db/schema_migrations/20200917165525 b/db/schema_migrations/20200917165525
new file mode 100644
index 00000000000..bf01a95ad14
--- /dev/null
+++ b/db/schema_migrations/20200917165525
@@ -0,0 +1 @@
+0080b9192ba5b4ea3853cfd930d58e10b9619f3d9a54016b574712e5ec2084f6 \ No newline at end of file
diff --git a/db/schema_migrations/20200921093826 b/db/schema_migrations/20200921093826
new file mode 100644
index 00000000000..4a405de5215
--- /dev/null
+++ b/db/schema_migrations/20200921093826
@@ -0,0 +1 @@
+8d14013bcb4d8302c91e331f619fb6f621ab79907aebc421d99c9484ecd7a5d8 \ No newline at end of file
diff --git a/db/schema_migrations/20200921130028 b/db/schema_migrations/20200921130028
new file mode 100644
index 00000000000..b718f21c156
--- /dev/null
+++ b/db/schema_migrations/20200921130028
@@ -0,0 +1 @@
+60835078e0a0bd191e9b1f0316f894c5223d6849277992b5034ed4ff9a798fe4 \ No newline at end of file
diff --git a/db/schema_migrations/20200921131313 b/db/schema_migrations/20200921131313
new file mode 100644
index 00000000000..559701acf69
--- /dev/null
+++ b/db/schema_migrations/20200921131313
@@ -0,0 +1 @@
+e4f9e918c86705409555cde065f30ba0c0c405dfd1918f47a169a5dc5c244a8d \ No newline at end of file
diff --git a/db/schema_migrations/20200921203231 b/db/schema_migrations/20200921203231
new file mode 100644
index 00000000000..544b7146ebf
--- /dev/null
+++ b/db/schema_migrations/20200921203231
@@ -0,0 +1 @@
+7f62ce5117a16213bad6537dfeae2af4016262c533f8fa6b7a19572077bcf8d7 \ No newline at end of file
diff --git a/db/schema_migrations/20200922052316 b/db/schema_migrations/20200922052316
new file mode 100644
index 00000000000..31bd12178ef
--- /dev/null
+++ b/db/schema_migrations/20200922052316
@@ -0,0 +1 @@
+384d022662437de21b4b3b97bf2f1dec2925be6afe4b62828c97dc9b3b3fc77c \ No newline at end of file
diff --git a/db/schema_migrations/20200922054642 b/db/schema_migrations/20200922054642
new file mode 100644
index 00000000000..443c13c256e
--- /dev/null
+++ b/db/schema_migrations/20200922054642
@@ -0,0 +1 @@
+ad63096e49440f7f2a15ea2747689ca39f52fdcebc1949a1feed82a22f432e9e \ No newline at end of file
diff --git a/db/schema_migrations/20200922093004 b/db/schema_migrations/20200922093004
new file mode 100644
index 00000000000..04dd5dbfcf6
--- /dev/null
+++ b/db/schema_migrations/20200922093004
@@ -0,0 +1 @@
+705d010620b1aa95e86c8fb5fb9175fe77778376d228003e9fd2c8d0bb20a347 \ No newline at end of file
diff --git a/db/schema_migrations/20200922095954 b/db/schema_migrations/20200922095954
new file mode 100644
index 00000000000..2282da76380
--- /dev/null
+++ b/db/schema_migrations/20200922095954
@@ -0,0 +1 @@
+c55f27f817afc60462e5dc43755a4ddd76f1399f5e461bab4b36bf5e5b26ce0a \ No newline at end of file
diff --git a/db/schema_migrations/20200922170907 b/db/schema_migrations/20200922170907
new file mode 100644
index 00000000000..66ff701973d
--- /dev/null
+++ b/db/schema_migrations/20200922170907
@@ -0,0 +1 @@
+ab044b609a29e9a179813de79dab9770665917a8ed78db907755a64f2d4aa47c \ No newline at end of file
diff --git a/db/schema_migrations/20200922231755 b/db/schema_migrations/20200922231755
new file mode 100644
index 00000000000..504df45b957
--- /dev/null
+++ b/db/schema_migrations/20200922231755
@@ -0,0 +1 @@
+0019105cd2112e138b9926dc000b0c54b41fca6dfb2c4f658900040e0ecb3b70 \ No newline at end of file
diff --git a/db/schema_migrations/20200923071622 b/db/schema_migrations/20200923071622
new file mode 100644
index 00000000000..629b241ce0a
--- /dev/null
+++ b/db/schema_migrations/20200923071622
@@ -0,0 +1 @@
+1751fa6522a88582cb6a580acc95665f4e3f3a879f2365d5fd0a824ad1b4806d \ No newline at end of file
diff --git a/db/schema_migrations/20200923071644 b/db/schema_migrations/20200923071644
new file mode 100644
index 00000000000..431ed5af1f0
--- /dev/null
+++ b/db/schema_migrations/20200923071644
@@ -0,0 +1 @@
+0df2b1e65ef0dc563c55e575968e4fd768cec2e713e3b1c999cf584ef62b629d \ No newline at end of file
diff --git a/db/schema_migrations/20200923102312 b/db/schema_migrations/20200923102312
new file mode 100644
index 00000000000..52ed07034fc
--- /dev/null
+++ b/db/schema_migrations/20200923102312
@@ -0,0 +1 @@
+f19e61e3863905885c8b5b2129be2586d912d616a5b3b54e99a72c5760082059 \ No newline at end of file
diff --git a/db/schema_migrations/20200923130057 b/db/schema_migrations/20200923130057
new file mode 100644
index 00000000000..e95c2da0a1d
--- /dev/null
+++ b/db/schema_migrations/20200923130057
@@ -0,0 +1 @@
+84b272d61f6ab6e9f9f8eb059ba139a3fa0d2f1bbeb337f2e4e7cd4034822b44 \ No newline at end of file
diff --git a/db/schema_migrations/20200923140404 b/db/schema_migrations/20200923140404
new file mode 100644
index 00000000000..9c1bfd59b4c
--- /dev/null
+++ b/db/schema_migrations/20200923140404
@@ -0,0 +1 @@
+8a1898f62a47575c7ea428198163e04ff427e7ab6cd04eb9897930a6b7753681 \ No newline at end of file
diff --git a/db/schema_migrations/20200927224750 b/db/schema_migrations/20200927224750
new file mode 100644
index 00000000000..9454bec58c5
--- /dev/null
+++ b/db/schema_migrations/20200927224750
@@ -0,0 +1 @@
+8e0c5be3d6fe2d0d718c7b7a99d84b14dfc6006f780ec0622eb5aae937e6b367 \ No newline at end of file
diff --git a/db/schema_migrations/20200928095732 b/db/schema_migrations/20200928095732
new file mode 100644
index 00000000000..15f0d5e3eae
--- /dev/null
+++ b/db/schema_migrations/20200928095732
@@ -0,0 +1 @@
+5ff9bf6c542f686729abf18f282351d9bb5b895070c6f06c5fc8d125be4a38f7 \ No newline at end of file
diff --git a/db/schema_migrations/20200928100408 b/db/schema_migrations/20200928100408
new file mode 100644
index 00000000000..e49c397924d
--- /dev/null
+++ b/db/schema_migrations/20200928100408
@@ -0,0 +1 @@
+56984f720cfde6ad28b8612e092809252f948797fecb64dfc3b82d5b3b74f7ec \ No newline at end of file
diff --git a/db/schema_migrations/20200928203531 b/db/schema_migrations/20200928203531
new file mode 100644
index 00000000000..229e2dc9b1f
--- /dev/null
+++ b/db/schema_migrations/20200928203531
@@ -0,0 +1 @@
+fc9719e0822d17eacb375b4adb2eac35afba04cafc2bd429c82c502d2fe5f12e \ No newline at end of file
diff --git a/db/schema_migrations/20200928210524 b/db/schema_migrations/20200928210524
new file mode 100644
index 00000000000..41905703d01
--- /dev/null
+++ b/db/schema_migrations/20200928210524
@@ -0,0 +1 @@
+788fd828a7aa8fb8741f13596f54fc4d9f4f5caeaf34d08aed47bbefe363ae75 \ No newline at end of file
diff --git a/db/schema_migrations/20200928233632 b/db/schema_migrations/20200928233632
new file mode 100644
index 00000000000..d66fc8310f2
--- /dev/null
+++ b/db/schema_migrations/20200928233632
@@ -0,0 +1 @@
+c390843c8a93ca429d1442d7b54f5f9dc01e0343c71ed1a046f11968cc10810d \ No newline at end of file
diff --git a/db/schema_migrations/20200929063159 b/db/schema_migrations/20200929063159
new file mode 100644
index 00000000000..b7815e9bb39
--- /dev/null
+++ b/db/schema_migrations/20200929063159
@@ -0,0 +1 @@
+9ef08404b964ccae3e12332340f16c6b8bb2bbdb2c04ba105fe1c0c7e6bf84f2 \ No newline at end of file
diff --git a/db/schema_migrations/20200930094812 b/db/schema_migrations/20200930094812
new file mode 100644
index 00000000000..ad03614e47d
--- /dev/null
+++ b/db/schema_migrations/20200930094812
@@ -0,0 +1 @@
+b92b48a17bfd350a70017bfee99bcfb3dbc5ae9e33c8f23ab593666e5c3900aa \ No newline at end of file
diff --git a/db/schema_migrations/20200930131343 b/db/schema_migrations/20200930131343
new file mode 100644
index 00000000000..a872607f241
--- /dev/null
+++ b/db/schema_migrations/20200930131343
@@ -0,0 +1 @@
+45530bb3090d9e8df3a79f42a06b042e0c40f6e185078c6d79d7ec334175c7d5 \ No newline at end of file
diff --git a/db/schema_migrations/20200930132319 b/db/schema_migrations/20200930132319
new file mode 100644
index 00000000000..7bffd187de2
--- /dev/null
+++ b/db/schema_migrations/20200930132319
@@ -0,0 +1 @@
+1ded640c70d5e569f0f26729c96d2dc27c528bcb045e28f073ed8fce9f918d95 \ No newline at end of file
diff --git a/db/schema_migrations/20201001022100 b/db/schema_migrations/20201001022100
new file mode 100644
index 00000000000..9c11e9e6094
--- /dev/null
+++ b/db/schema_migrations/20201001022100
@@ -0,0 +1 @@
+a581071767c5484e8286951854b0effe04d4b8951f208f10ceb4812940363959 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 6e921810cfb..52369090416 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -8830,6 +8830,31 @@ CREATE SEQUENCE alert_management_alerts_id_seq
ALTER SEQUENCE alert_management_alerts_id_seq OWNED BY alert_management_alerts.id;
+CREATE TABLE alert_management_http_integrations (
+ 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,
+ active boolean DEFAULT false NOT NULL,
+ encrypted_token text NOT NULL,
+ encrypted_token_iv text NOT NULL,
+ endpoint_identifier text NOT NULL,
+ name text NOT NULL,
+ CONSTRAINT check_286943b636 CHECK ((char_length(encrypted_token_iv) <= 255)),
+ CONSTRAINT check_392143ccf4 CHECK ((char_length(name) <= 255)),
+ CONSTRAINT check_e270820180 CHECK ((char_length(endpoint_identifier) <= 255)),
+ CONSTRAINT check_f68577c4af CHECK ((char_length(encrypted_token) <= 255))
+);
+
+CREATE SEQUENCE alert_management_http_integrations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE alert_management_http_integrations_id_seq OWNED BY alert_management_http_integrations.id;
+
CREATE TABLE alerts_service_data (
id bigint NOT NULL,
service_id integer NOT NULL,
@@ -9031,7 +9056,6 @@ CREATE TABLE application_settings (
session_expire_delay integer DEFAULT 10080 NOT NULL,
import_sources text,
help_page_text text,
- admin_notification_email character varying,
shared_runners_enabled boolean DEFAULT true NOT NULL,
max_artifacts_size integer DEFAULT 100 NOT NULL,
runners_registration_token character varying,
@@ -9146,7 +9170,6 @@ CREATE TABLE application_settings (
snowplow_enabled boolean DEFAULT false NOT NULL,
snowplow_collector_hostname character varying,
snowplow_cookie_domain character varying,
- instance_statistics_visibility_private boolean DEFAULT false NOT NULL,
web_ide_clientside_preview_enabled boolean DEFAULT false NOT NULL,
user_show_add_ssh_key_message boolean DEFAULT true NOT NULL,
custom_project_templates_group_id integer,
@@ -9196,7 +9219,6 @@ CREATE TABLE application_settings (
throttle_incident_management_notification_enabled boolean DEFAULT false NOT NULL,
throttle_incident_management_notification_period_in_seconds integer DEFAULT 3600,
throttle_incident_management_notification_per_period integer DEFAULT 3600,
- snowplow_iglu_registry_url character varying(255),
push_event_hooks_limit integer DEFAULT 3 NOT NULL,
push_event_activities_limit integer DEFAULT 3 NOT NULL,
custom_http_clone_url_root character varying(511),
@@ -9272,6 +9294,8 @@ CREATE TABLE application_settings (
elasticsearch_client_request_timeout integer DEFAULT 0 NOT NULL,
gitpod_enabled boolean DEFAULT false NOT NULL,
gitpod_url text DEFAULT 'https://gitpod.io/'::text,
+ abuse_notification_email character varying,
+ require_admin_approval_after_user_signup boolean DEFAULT false NOT NULL,
CONSTRAINT check_2dba05b802 CHECK ((char_length(gitpod_url) <= 255)),
CONSTRAINT check_51700b31b5 CHECK ((char_length(default_branch_name) <= 255)),
CONSTRAINT check_9c6c447a13 CHECK ((char_length(maintenance_mode_message) <= 255)),
@@ -10701,7 +10725,6 @@ ALTER SEQUENCE cluster_projects_id_seq OWNED BY cluster_projects.id;
CREATE TABLE cluster_providers_aws (
id bigint NOT NULL,
cluster_id bigint NOT NULL,
- created_by_user_id integer,
num_nodes integer NOT NULL,
status integer NOT NULL,
created_at timestamp with time zone NOT NULL,
@@ -11083,7 +11106,8 @@ CREATE TABLE container_repositories (
name character varying NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
- status smallint
+ status smallint,
+ expiration_policy_started_at timestamp with time zone
);
CREATE SEQUENCE container_repositories_id_seq
@@ -11233,7 +11257,9 @@ CREATE TABLE dast_site_validations (
validation_strategy smallint NOT NULL,
url_base text NOT NULL,
url_path text NOT NULL,
+ state text DEFAULT 'pending'::text NOT NULL,
CONSTRAINT check_13b34efe4b CHECK ((char_length(url_path) <= 255)),
+ CONSTRAINT check_283be72e9b CHECK ((char_length(state) <= 255)),
CONSTRAINT check_cd3b538210 CHECK ((char_length(url_base) <= 255))
);
@@ -11411,7 +11437,8 @@ CREATE TABLE design_management_designs (
project_id integer NOT NULL,
issue_id integer,
filename character varying NOT NULL,
- relative_position integer
+ relative_position integer,
+ CONSTRAINT check_07155e2715 CHECK ((char_length((filename)::text) <= 255))
);
CREATE SEQUENCE design_management_designs_id_seq
@@ -12488,6 +12515,7 @@ CREATE TABLE group_import_states (
status smallint DEFAULT 0 NOT NULL,
jid text,
last_error text,
+ user_id bigint,
CONSTRAINT check_87b58f6b30 CHECK ((char_length(last_error) <= 255)),
CONSTRAINT check_96558fff96 CHECK ((char_length(jid) <= 100))
);
@@ -12674,6 +12702,24 @@ CREATE TABLE issue_assignees (
issue_id integer NOT NULL
);
+CREATE TABLE issue_email_participants (
+ id bigint NOT NULL,
+ issue_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ email text NOT NULL,
+ CONSTRAINT check_2c321d408d CHECK ((char_length(email) <= 255))
+);
+
+CREATE SEQUENCE issue_email_participants_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE issue_email_participants_id_seq OWNED BY issue_email_participants.id;
+
CREATE TABLE issue_links (
id integer NOT NULL,
source_id integer NOT NULL,
@@ -13561,7 +13607,8 @@ CREATE TABLE namespace_settings (
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
namespace_id integer NOT NULL,
- prevent_forking_outside_group boolean DEFAULT false NOT NULL
+ prevent_forking_outside_group boolean DEFAULT false NOT NULL,
+ allow_mfa_for_subgroups boolean DEFAULT true NOT NULL
);
CREATE TABLE namespace_statistics (
@@ -13727,7 +13774,8 @@ CREATE TABLE notification_settings (
notification_email character varying,
fixed_pipeline boolean,
new_release boolean,
- moved_project boolean DEFAULT true NOT NULL
+ moved_project boolean DEFAULT true NOT NULL,
+ change_reviewer_merge_request boolean
);
CREATE SEQUENCE notification_settings_id_seq
@@ -14069,6 +14117,25 @@ CREATE SEQUENCE packages_dependency_links_id_seq
ALTER SEQUENCE packages_dependency_links_id_seq OWNED BY packages_dependency_links.id;
+CREATE TABLE packages_events (
+ id bigint NOT NULL,
+ event_type smallint NOT NULL,
+ event_scope smallint NOT NULL,
+ originator_type smallint NOT NULL,
+ originator bigint,
+ created_at timestamp with time zone NOT NULL,
+ package_id bigint
+);
+
+CREATE SEQUENCE packages_events_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE packages_events_id_seq OWNED BY packages_events.id;
+
CREATE TABLE packages_maven_metadata (
id bigint NOT NULL,
package_id bigint NOT NULL,
@@ -14121,7 +14188,8 @@ CREATE TABLE packages_package_files (
verified_at timestamp with time zone,
verification_failure character varying(255),
verification_retry_count integer,
- verification_checksum bytea
+ verification_checksum bytea,
+ CONSTRAINT check_4c5e6bb0b3 CHECK ((file_store IS NOT NULL))
);
CREATE SEQUENCE packages_package_files_id_seq
@@ -14363,7 +14431,10 @@ CREATE TABLE plan_limits (
nuget_max_file_size bigint DEFAULT 524288000 NOT NULL,
pypi_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL,
generic_packages_max_file_size bigint DEFAULT '5368709120'::bigint NOT NULL,
- project_feature_flags integer DEFAULT 200 NOT NULL
+ project_feature_flags integer DEFAULT 200 NOT NULL,
+ golang_max_file_size bigint DEFAULT 104857600 NOT NULL,
+ debian_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL,
+ ci_max_artifact_size_api_fuzzing integer DEFAULT 0 NOT NULL
);
CREATE SEQUENCE plan_limits_id_seq
@@ -14409,6 +14480,43 @@ CREATE SEQUENCE pool_repositories_id_seq
ALTER SEQUENCE pool_repositories_id_seq OWNED BY pool_repositories.id;
+CREATE VIEW postgres_indexes AS
+ SELECT (((pg_namespace.nspname)::text || '.'::text) || (pg_class.relname)::text) AS identifier,
+ pg_index.indexrelid,
+ pg_namespace.nspname AS schema,
+ pg_class.relname AS name,
+ pg_index.indisunique AS "unique",
+ pg_index.indisvalid AS valid_index,
+ pg_class.relispartition AS partitioned,
+ pg_index.indisexclusion AS exclusion,
+ pg_indexes.indexdef AS definition,
+ pg_relation_size((pg_class.oid)::regclass) AS ondisk_size_bytes
+ FROM (((pg_index
+ JOIN pg_class ON ((pg_class.oid = pg_index.indexrelid)))
+ JOIN pg_namespace ON ((pg_class.relnamespace = pg_namespace.oid)))
+ JOIN pg_indexes ON ((pg_class.relname = pg_indexes.indexname)))
+ WHERE ((pg_namespace.nspname <> 'pg_catalog'::name) AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])));
+
+CREATE TABLE postgres_reindex_actions (
+ id bigint NOT NULL,
+ action_start timestamp with time zone NOT NULL,
+ action_end timestamp with time zone,
+ ondisk_size_bytes_start bigint NOT NULL,
+ ondisk_size_bytes_end bigint,
+ state smallint DEFAULT 0 NOT NULL,
+ index_identifier text NOT NULL,
+ CONSTRAINT check_f12527622c CHECK ((char_length(index_identifier) <= 255))
+);
+
+CREATE SEQUENCE postgres_reindex_actions_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE postgres_reindex_actions_id_seq OWNED BY postgres_reindex_actions.id;
+
CREATE TABLE programming_languages (
id integer NOT NULL,
name character varying NOT NULL,
@@ -14710,7 +14818,8 @@ ALTER SEQUENCE project_mirror_data_id_seq OWNED BY project_mirror_data.id;
CREATE TABLE project_pages_metadata (
project_id bigint NOT NULL,
deployed boolean DEFAULT false NOT NULL,
- artifacts_archive_id bigint
+ artifacts_archive_id bigint,
+ pages_deployment_id bigint
);
CREATE TABLE project_repositories (
@@ -15324,7 +15433,10 @@ CREATE TABLE requirements (
cached_markdown_version integer,
state smallint DEFAULT 1 NOT NULL,
title character varying(255) NOT NULL,
- title_html text
+ title_html text,
+ description text,
+ description_html text,
+ CONSTRAINT check_785ae25b9d CHECK ((char_length(description) <= 10000))
);
CREATE SEQUENCE requirements_id_seq
@@ -17043,6 +17155,8 @@ ALTER TABLE ONLY alert_management_alert_user_mentions ALTER COLUMN id SET DEFAUL
ALTER TABLE ONLY alert_management_alerts ALTER COLUMN id SET DEFAULT nextval('alert_management_alerts_id_seq'::regclass);
+ALTER TABLE ONLY alert_management_http_integrations ALTER COLUMN id SET DEFAULT nextval('alert_management_http_integrations_id_seq'::regclass);
+
ALTER TABLE ONLY alerts_service_data ALTER COLUMN id SET DEFAULT nextval('alerts_service_data_id_seq'::regclass);
ALTER TABLE ONLY allowed_email_domains ALTER COLUMN id SET DEFAULT nextval('allowed_email_domains_id_seq'::regclass);
@@ -17379,6 +17493,8 @@ ALTER TABLE ONLY ip_restrictions ALTER COLUMN id SET DEFAULT nextval('ip_restric
ALTER TABLE ONLY issuable_severities ALTER COLUMN id SET DEFAULT nextval('issuable_severities_id_seq'::regclass);
+ALTER TABLE ONLY issue_email_participants ALTER COLUMN id SET DEFAULT nextval('issue_email_participants_id_seq'::regclass);
+
ALTER TABLE ONLY issue_links ALTER COLUMN id SET DEFAULT nextval('issue_links_id_seq'::regclass);
ALTER TABLE ONLY issue_metrics ALTER COLUMN id SET DEFAULT nextval('issue_metrics_id_seq'::regclass);
@@ -17495,6 +17611,8 @@ ALTER TABLE ONLY packages_dependencies ALTER COLUMN id SET DEFAULT nextval('pack
ALTER TABLE ONLY packages_dependency_links ALTER COLUMN id SET DEFAULT nextval('packages_dependency_links_id_seq'::regclass);
+ALTER TABLE ONLY packages_events ALTER COLUMN id SET DEFAULT nextval('packages_events_id_seq'::regclass);
+
ALTER TABLE ONLY packages_maven_metadata ALTER COLUMN id SET DEFAULT nextval('packages_maven_metadata_id_seq'::regclass);
ALTER TABLE ONLY packages_package_files ALTER COLUMN id SET DEFAULT nextval('packages_package_files_id_seq'::regclass);
@@ -17521,6 +17639,8 @@ ALTER TABLE ONLY plans ALTER COLUMN id SET DEFAULT nextval('plans_id_seq'::regcl
ALTER TABLE ONLY pool_repositories ALTER COLUMN id SET DEFAULT nextval('pool_repositories_id_seq'::regclass);
+ALTER TABLE ONLY postgres_reindex_actions ALTER COLUMN id SET DEFAULT nextval('postgres_reindex_actions_id_seq'::regclass);
+
ALTER TABLE ONLY product_analytics_events_experimental ALTER COLUMN id SET DEFAULT nextval('product_analytics_events_experimental_id_seq'::regclass);
ALTER TABLE ONLY programming_languages ALTER COLUMN id SET DEFAULT nextval('programming_languages_id_seq'::regclass);
@@ -17956,6 +18076,9 @@ ALTER TABLE ONLY alert_management_alert_user_mentions
ALTER TABLE ONLY alert_management_alerts
ADD CONSTRAINT alert_management_alerts_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY alert_management_http_integrations
+ ADD CONSTRAINT alert_management_http_integrations_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY alerts_service_data
ADD CONSTRAINT alerts_service_data_pkey PRIMARY KEY (id);
@@ -18076,14 +18199,11 @@ ALTER TABLE ONLY chat_names
ALTER TABLE ONLY chat_teams
ADD CONSTRAINT chat_teams_pkey PRIMARY KEY (id);
-ALTER TABLE design_management_designs
- ADD CONSTRAINT check_07155e2715 CHECK ((char_length((filename)::text) <= 255)) NOT VALID;
-
ALTER TABLE vulnerability_scanners
ADD CONSTRAINT check_37608c9db5 CHECK ((char_length(vendor) <= 255)) NOT VALID;
-ALTER TABLE packages_package_files
- ADD CONSTRAINT check_4c5e6bb0b3 CHECK ((file_store IS NOT NULL)) NOT VALID;
+ALTER TABLE group_import_states
+ ADD CONSTRAINT check_cda75c7c3f CHECK ((user_id IS NOT NULL)) NOT VALID;
ALTER TABLE ONLY ci_build_needs
ADD CONSTRAINT ci_build_needs_pkey PRIMARY KEY (id);
@@ -18493,6 +18613,9 @@ ALTER TABLE ONLY ip_restrictions
ALTER TABLE ONLY issuable_severities
ADD CONSTRAINT issuable_severities_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY issue_email_participants
+ ADD CONSTRAINT issue_email_participants_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY issue_links
ADD CONSTRAINT issue_links_pkey PRIMARY KEY (id);
@@ -18688,6 +18811,9 @@ ALTER TABLE ONLY packages_dependencies
ALTER TABLE ONLY packages_dependency_links
ADD CONSTRAINT packages_dependency_links_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY packages_events
+ ADD CONSTRAINT packages_events_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY packages_maven_metadata
ADD CONSTRAINT packages_maven_metadata_pkey PRIMARY KEY (id);
@@ -18736,6 +18862,9 @@ ALTER TABLE ONLY plans
ALTER TABLE ONLY pool_repositories
ADD CONSTRAINT pool_repositories_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY postgres_reindex_actions
+ ADD CONSTRAINT postgres_reindex_actions_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY programming_languages
ADD CONSTRAINT programming_languages_pkey PRIMARY KEY (id);
@@ -19315,8 +19444,6 @@ CREATE UNIQUE INDEX idx_jira_connect_subscriptions_on_installation_id_namespace_
CREATE INDEX idx_members_created_at_user_id_invite_token ON members USING btree (created_at) WHERE ((invite_token IS NOT NULL) AND (user_id IS NULL));
-CREATE INDEX idx_merge_requests_on_id_and_merge_jid ON merge_requests USING btree (id, merge_jid) WHERE ((merge_jid IS NOT NULL) AND (state_id = 4));
-
CREATE INDEX idx_merge_requests_on_source_project_and_branch_state_opened ON merge_requests USING btree (source_project_id, source_branch) WHERE (state_id = 1);
CREATE INDEX idx_merge_requests_on_state_id_and_merge_status ON merge_requests USING btree (state_id, merge_status) WHERE ((state_id = 1) AND ((merge_status)::text = 'can_be_merged'::text));
@@ -19381,6 +19508,8 @@ CREATE UNIQUE INDEX index_alert_management_alerts_on_project_id_and_iid ON alert
CREATE INDEX index_alert_management_alerts_on_prometheus_alert_id ON alert_management_alerts USING btree (prometheus_alert_id) WHERE (prometheus_alert_id IS NOT NULL);
+CREATE INDEX index_alert_management_http_integrations_on_project_id ON alert_management_http_integrations USING btree (project_id);
+
CREATE UNIQUE INDEX index_alert_user_mentions_on_alert_id ON alert_management_alert_user_mentions USING btree (alert_management_alert_id) WHERE (note_id IS NULL);
CREATE UNIQUE INDEX index_alert_user_mentions_on_alert_id_and_note_id ON alert_management_alert_user_mentions USING btree (alert_management_alert_id, note_id);
@@ -19447,6 +19576,8 @@ CREATE UNIQUE INDEX index_approval_project_rules_groups_1 ON approval_project_ru
CREATE INDEX index_approval_project_rules_groups_2 ON approval_project_rules_groups USING btree (group_id);
+CREATE INDEX index_approval_project_rules_on_id_with_regular_type ON approval_project_rules USING btree (id) WHERE (rule_type = 0);
+
CREATE INDEX index_approval_project_rules_on_project_id ON approval_project_rules USING btree (project_id);
CREATE INDEX index_approval_project_rules_on_rule_type ON approval_project_rules USING btree (rule_type);
@@ -19459,6 +19590,8 @@ CREATE UNIQUE INDEX index_approval_project_rules_users_1 ON approval_project_rul
CREATE INDEX index_approval_project_rules_users_2 ON approval_project_rules_users USING btree (user_id);
+CREATE INDEX index_approval_project_rules_users_on_approval_project_rule_id ON approval_project_rules_users USING btree (approval_project_rule_id);
+
CREATE UNIQUE INDEX index_approval_rule_name_for_code_owners_rule_type ON approval_merge_request_rules USING btree (merge_request_id, name) WHERE ((rule_type = 2) AND (section IS NULL));
CREATE UNIQUE INDEX index_approval_rule_name_for_sectional_code_owners_rule_type ON approval_merge_request_rules USING btree (merge_request_id, name, section) WHERE (rule_type = 2);
@@ -19481,6 +19614,8 @@ CREATE UNIQUE INDEX index_atlassian_identities_on_extern_uid ON atlassian_identi
CREATE INDEX index_authentication_events_on_provider ON authentication_events USING btree (provider);
+CREATE INDEX index_authentication_events_on_provider_user_id_created_at ON authentication_events USING btree (provider, user_id, created_at) WHERE (result = 1);
+
CREATE INDEX index_authentication_events_on_user_id ON authentication_events USING btree (user_id);
CREATE INDEX index_award_emoji_on_awardable_type_and_awardable_id ON award_emoji USING btree (awardable_type, awardable_id);
@@ -19709,7 +19844,7 @@ CREATE INDEX index_ci_pipelines_on_project_id_and_user_id_and_status_and_ref ON
CREATE INDEX index_ci_pipelines_on_project_idandrefandiddesc ON ci_pipelines USING btree (project_id, ref, id DESC);
-CREATE INDEX index_ci_pipelines_on_status ON ci_pipelines USING btree (status);
+CREATE INDEX index_ci_pipelines_on_status_and_id ON ci_pipelines USING btree (status, id);
CREATE INDEX index_ci_pipelines_on_user_id_and_created_at_and_config_source ON ci_pipelines USING btree (user_id, created_at, config_source);
@@ -19785,8 +19920,6 @@ CREATE INDEX index_cluster_agent_tokens_on_agent_id ON cluster_agent_tokens USIN
CREATE UNIQUE INDEX index_cluster_agent_tokens_on_token_encrypted ON cluster_agent_tokens USING btree (token_encrypted);
-CREATE INDEX index_cluster_agents_on_project_id ON cluster_agents USING btree (project_id);
-
CREATE UNIQUE INDEX index_cluster_agents_on_project_id_and_name ON cluster_agents USING btree (project_id, name);
CREATE UNIQUE INDEX index_cluster_groups_on_cluster_id_and_group_id ON cluster_groups USING btree (cluster_id, group_id);
@@ -19803,8 +19936,6 @@ CREATE UNIQUE INDEX index_cluster_providers_aws_on_cluster_id ON cluster_provide
CREATE INDEX index_cluster_providers_aws_on_cluster_id_and_status ON cluster_providers_aws USING btree (cluster_id, status);
-CREATE INDEX index_cluster_providers_aws_on_created_by_user_id ON cluster_providers_aws USING btree (created_by_user_id);
-
CREATE INDEX index_cluster_providers_gcp_on_cloud_run ON cluster_providers_gcp USING btree (cloud_run);
CREATE UNIQUE INDEX index_cluster_providers_gcp_on_cluster_id ON cluster_providers_gcp USING btree (cluster_id);
@@ -19933,6 +20064,8 @@ CREATE INDEX index_deployments_on_project_id_and_status_and_created_at ON deploy
CREATE INDEX index_deployments_on_project_id_and_updated_at_and_id ON deployments USING btree (project_id, updated_at DESC, id DESC);
+CREATE INDEX index_deployments_on_project_id_sha ON deployments USING btree (project_id, sha);
+
CREATE INDEX index_deployments_on_user_id_and_status_and_created_at ON deployments USING btree (user_id, status, created_at);
CREATE INDEX index_description_versions_on_epic_id ON description_versions USING btree (epic_id) WHERE (epic_id IS NOT NULL);
@@ -20219,12 +20352,16 @@ CREATE INDEX index_group_group_links_on_shared_with_group_id ON group_group_link
CREATE INDEX index_group_import_states_on_group_id ON group_import_states USING btree (group_id);
+CREATE INDEX index_group_import_states_on_user_id ON group_import_states USING btree (user_id) WHERE (user_id IS NOT NULL);
+
CREATE UNIQUE INDEX index_group_stages_on_group_id_group_value_stream_id_and_name ON analytics_cycle_analytics_group_stages USING btree (group_id, group_value_stream_id, name);
CREATE UNIQUE INDEX index_group_wiki_repositories_on_disk_path ON group_wiki_repositories USING btree (disk_path);
CREATE INDEX index_group_wiki_repositories_on_shard_id ON group_wiki_repositories USING btree (shard_id);
+CREATE UNIQUE INDEX index_http_integrations_on_active_and_project_and_endpoint ON alert_management_http_integrations USING btree (active, project_id, endpoint_identifier) WHERE active;
+
CREATE INDEX index_identities_on_saml_provider_id ON identities USING btree (saml_provider_id) WHERE (saml_provider_id IS NOT NULL);
CREATE INDEX index_identities_on_user_id ON identities USING btree (user_id);
@@ -20267,6 +20404,8 @@ CREATE UNIQUE INDEX index_issue_assignees_on_issue_id_and_user_id ON issue_assig
CREATE INDEX index_issue_assignees_on_user_id ON issue_assignees USING btree (user_id);
+CREATE UNIQUE INDEX index_issue_email_participants_on_issue_id_and_email ON issue_email_participants USING btree (issue_id, email);
+
CREATE INDEX index_issue_links_on_source_id ON issue_links USING btree (source_id);
CREATE UNIQUE INDEX index_issue_links_on_source_id_and_target_id ON issue_links USING btree (source_id, target_id);
@@ -20319,6 +20458,8 @@ CREATE INDEX index_issues_on_updated_at ON issues USING btree (updated_at);
CREATE INDEX index_issues_on_updated_by_id ON issues USING btree (updated_by_id) WHERE (updated_by_id IS NOT NULL);
+CREATE INDEX index_issues_project_id_issue_type_incident ON issues USING btree (project_id) WHERE (issue_type = 1);
+
CREATE UNIQUE INDEX index_jira_connect_installations_on_client_key ON jira_connect_installations USING btree (client_key);
CREATE INDEX index_jira_connect_subscriptions_on_namespace_id ON jira_connect_subscriptions USING btree (namespace_id);
@@ -20489,6 +20630,8 @@ CREATE INDEX index_merge_requests_on_target_project_id_and_created_at_and_id ON
CREATE UNIQUE INDEX index_merge_requests_on_target_project_id_and_iid ON merge_requests USING btree (target_project_id, iid);
+CREATE INDEX index_merge_requests_on_target_project_id_and_iid_and_state_id ON merge_requests USING btree (target_project_id, iid, state_id);
+
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_title ON merge_requests USING btree (title);
@@ -20573,7 +20716,7 @@ CREATE UNIQUE INDEX index_namespaces_on_runners_token_encrypted ON namespaces US
CREATE INDEX index_namespaces_on_shared_and_extra_runners_minutes_limit ON namespaces USING btree (shared_runners_minutes_limit, extra_shared_runners_minutes_limit);
-CREATE INDEX index_namespaces_on_type_partial ON namespaces USING btree (type) WHERE (type IS NOT NULL);
+CREATE INDEX index_namespaces_on_type_and_id_partial ON namespaces USING btree (type, id) WHERE (type IS NOT NULL);
CREATE INDEX index_non_requested_project_members_on_source_id_and_type ON members USING btree (source_id, source_type) WHERE ((requested_at IS NULL) AND ((type)::text = 'ProjectMember'::text));
@@ -20669,14 +20812,14 @@ CREATE UNIQUE INDEX index_packages_dependencies_on_name_and_version_pattern ON p
CREATE INDEX index_packages_dependency_links_on_dependency_id ON packages_dependency_links USING btree (dependency_id);
+CREATE INDEX index_packages_events_on_package_id ON packages_events USING btree (package_id);
+
CREATE INDEX index_packages_maven_metadata_on_package_id_and_path ON packages_maven_metadata USING btree (package_id, path);
CREATE INDEX index_packages_nuget_dl_metadata_on_dependency_link_id ON packages_nuget_dependency_link_metadata USING btree (dependency_link_id);
CREATE UNIQUE INDEX index_packages_on_project_id_name_version_unique_when_generic ON packages_packages USING btree (project_id, name, version) WHERE (package_type = 7);
-CREATE INDEX index_packages_package_files_file_store_is_null ON packages_package_files USING btree (id) WHERE (file_store IS NULL);
-
CREATE INDEX index_packages_package_files_on_file_store ON packages_package_files USING btree (file_store);
CREATE INDEX index_packages_package_files_on_package_id_and_file_name ON packages_package_files USING btree (package_id, file_name);
@@ -20733,6 +20876,8 @@ CREATE INDEX index_pages_domains_on_wildcard ON pages_domains USING btree (wildc
CREATE UNIQUE INDEX index_partial_am_alerts_on_project_id_and_fingerprint ON alert_management_alerts USING btree (project_id, fingerprint) WHERE (status <> 2);
+CREATE INDEX index_partial_ci_builds_on_user_id_name_parser_features ON ci_builds USING btree (user_id, name) WHERE (((type)::text = 'Ci::Build'::text) AND ((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('license_scanning'::character varying)::text, ('sast'::character varying)::text, ('coverage_fuzzing'::character varying)::text, ('secret_detection'::character varying)::text])));
+
CREATE UNIQUE INDEX index_partitioned_foreign_keys_unique_index ON partitioned_foreign_keys USING btree (to_table, from_table, from_column);
CREATE INDEX index_pat_on_user_id_and_expires_at ON personal_access_tokens USING btree (user_id, expires_at);
@@ -20757,6 +20902,8 @@ CREATE INDEX index_pool_repositories_on_shard_id ON pool_repositories USING btre
CREATE UNIQUE INDEX index_pool_repositories_on_source_project_id_and_shard_id ON pool_repositories USING btree (source_project_id, shard_id);
+CREATE INDEX index_postgres_reindex_actions_on_index_identifier ON postgres_reindex_actions USING btree (index_identifier);
+
CREATE UNIQUE INDEX index_programming_languages_on_name ON programming_languages USING btree (name);
CREATE INDEX index_project_access_tokens_on_project_id ON project_access_tokens USING btree (project_id);
@@ -20817,6 +20964,8 @@ CREATE INDEX index_project_mirror_data_on_status ON project_mirror_data USING bt
CREATE INDEX index_project_pages_metadata_on_artifacts_archive_id ON project_pages_metadata USING btree (artifacts_archive_id);
+CREATE INDEX index_project_pages_metadata_on_pages_deployment_id ON project_pages_metadata USING btree (pages_deployment_id);
+
CREATE UNIQUE INDEX index_project_pages_metadata_on_project_id ON project_pages_metadata USING btree (project_id);
CREATE INDEX index_project_pages_metadata_on_project_id_and_deployed_is_true ON project_pages_metadata USING btree (project_id) WHERE (deployed = true);
@@ -21329,6 +21478,8 @@ CREATE UNIQUE INDEX index_user_interacted_projects_on_project_id_and_user_id ON
CREATE INDEX index_user_interacted_projects_on_user_id ON user_interacted_projects USING btree (user_id);
+CREATE INDEX index_user_preferences_on_gitpod_enabled ON user_preferences USING btree (gitpod_enabled);
+
CREATE UNIQUE INDEX index_user_preferences_on_user_id ON user_preferences USING btree (user_id);
CREATE INDEX index_user_statuses_on_user_id ON user_statuses USING btree (user_id);
@@ -21563,16 +21714,10 @@ CREATE INDEX terraform_state_versions_verification_checksum_partial ON terraform
CREATE INDEX terraform_state_versions_verification_failure_partial ON terraform_state_versions USING btree (verification_failure) WHERE (verification_failure IS NOT NULL);
-CREATE INDEX terraform_states_verification_checksum_partial ON terraform_states USING btree (verification_checksum) WHERE (verification_checksum IS NOT NULL);
-
-CREATE INDEX terraform_states_verification_failure_partial ON terraform_states USING btree (verification_failure) WHERE (verification_failure IS NOT NULL);
-
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_for_fixing_inconsistent_vulnerability_occurrences ON vulnerability_occurrences USING btree (id) WHERE ((length(location_fingerprint) = 40) AND (report_type = 2));
-
CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id);
CREATE UNIQUE INDEX users_security_dashboard_projects_unique_index ON users_security_dashboard_projects USING btree (project_id, user_id);
@@ -21872,6 +22017,9 @@ ALTER TABLE ONLY notification_settings
ALTER TABLE ONLY lists
ADD CONSTRAINT fk_0d3f677137 FOREIGN KEY (board_id) REFERENCES boards(id) ON DELETE CASCADE;
+ALTER TABLE ONLY project_pages_metadata
+ ADD CONSTRAINT fk_0fd5b22688 FOREIGN KEY (pages_deployment_id) REFERENCES pages_deployments(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY group_deletion_schedules
ADD CONSTRAINT fk_11e3ebfcdd FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
@@ -22115,6 +22263,9 @@ ALTER TABLE ONLY merge_requests
ALTER TABLE ONLY merge_request_metrics
ADD CONSTRAINT fk_7f28d925f3 FOREIGN KEY (merged_by_id) REFERENCES users(id) ON DELETE SET NULL;
+ALTER TABLE ONLY group_import_states
+ ADD CONSTRAINT fk_8053b3ebd6 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY sprints
ADD CONSTRAINT fk_80aa8a1f95 FOREIGN KEY (group_id) REFERENCES namespaces(id) ON DELETE CASCADE;
@@ -22523,6 +22674,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 issue_email_participants
+ ADD CONSTRAINT fk_rails_0fdfd8b811 FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY merge_request_context_commits
ADD CONSTRAINT fk_rails_0fe0039f60 FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE;
@@ -23399,6 +23553,9 @@ ALTER TABLE ONLY elasticsearch_indexed_namespaces
ALTER TABLE ONLY vulnerability_occurrence_identifiers
ADD CONSTRAINT fk_rails_be2e49e1d0 FOREIGN KEY (identifier_id) REFERENCES vulnerability_identifiers(id) ON DELETE CASCADE;
+ALTER TABLE ONLY alert_management_http_integrations
+ ADD CONSTRAINT fk_rails_bec49f52cc FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY vulnerability_occurrences
ADD CONSTRAINT fk_rails_bf5b788ca7 FOREIGN KEY (scanner_id) REFERENCES vulnerability_scanners(id) ON DELETE CASCADE;
@@ -23444,6 +23601,9 @@ ALTER TABLE ONLY merge_request_user_mentions
ALTER TABLE ONLY ci_job_artifacts
ADD CONSTRAINT fk_rails_c5137cb2c1 FOREIGN KEY (job_id) REFERENCES ci_builds(id) ON DELETE CASCADE;
+ALTER TABLE ONLY packages_events
+ ADD CONSTRAINT fk_rails_c6c20d0094 FOREIGN KEY (package_id) REFERENCES packages_packages(id) ON DELETE SET NULL;
+
ALTER TABLE ONLY project_settings
ADD CONSTRAINT fk_rails_c6df6e6328 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
@@ -23606,9 +23766,6 @@ ALTER TABLE ONLY alert_management_alert_user_mentions
ALTER TABLE ONLY snippet_statistics
ADD CONSTRAINT fk_rails_ebc283ccf1 FOREIGN KEY (snippet_id) REFERENCES snippets(id) ON DELETE CASCADE;
-ALTER TABLE ONLY cluster_providers_aws
- ADD CONSTRAINT fk_rails_ed1fdfaeb2 FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE SET NULL;
-
ALTER TABLE ONLY project_security_settings
ADD CONSTRAINT fk_rails_ed4abe1338 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;