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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-12 12:08:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-12 12:08:08 +0300
commit71d34aac9a0fae0507c265929767422391816b01 (patch)
treededb769442c9576e2f44bf3c500b013beb9604d9 /db
parent90726a8ccc9df6d9b5ff4f5e1eb31d015c1db8e2 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20220428133724_schedule_expire_o_auth_tokens.rb25
-rw-r--r--db/post_migrate/20220505174658_update_index_on_alerts_to_exclude_null_fingerprints.rb28
-rw-r--r--db/schema_migrations/202204281337241
-rw-r--r--db/schema_migrations/202205051746581
-rw-r--r--db/structure.sql4
5 files changed, 57 insertions, 2 deletions
diff --git a/db/post_migrate/20220428133724_schedule_expire_o_auth_tokens.rb b/db/post_migrate/20220428133724_schedule_expire_o_auth_tokens.rb
new file mode 100644
index 00000000000..ef76a097b49
--- /dev/null
+++ b/db/post_migrate/20220428133724_schedule_expire_o_auth_tokens.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class ScheduleExpireOAuthTokens < Gitlab::Database::Migration[2.0]
+ MIGRATION = 'ExpireOAuthTokens'
+ INTERVAL = 2.minutes.freeze
+
+ disable_ddl_transaction!
+
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ queue_batched_background_migration(
+ MIGRATION,
+ :oauth_access_tokens,
+ :id,
+ job_interval: INTERVAL
+ )
+ end
+
+ def down
+ Gitlab::Database::BackgroundMigration::BatchedMigration
+ .for_configuration(MIGRATION, :oauth_access_tokens, :id, [])
+ .delete_all
+ end
+end
diff --git a/db/post_migrate/20220505174658_update_index_on_alerts_to_exclude_null_fingerprints.rb b/db/post_migrate/20220505174658_update_index_on_alerts_to_exclude_null_fingerprints.rb
new file mode 100644
index 00000000000..5cffdb641d6
--- /dev/null
+++ b/db/post_migrate/20220505174658_update_index_on_alerts_to_exclude_null_fingerprints.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+class UpdateIndexOnAlertsToExcludeNullFingerprints < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ OLD_INDEX_NAME = 'index_partial_am_alerts_on_project_id_and_fingerprint'
+ NEW_INDEX_NAME = 'index_unresolved_alerts_on_project_id_and_fingerprint'
+
+ def up
+ add_concurrent_index :alert_management_alerts,
+ [:project_id, :fingerprint],
+ where: "fingerprint IS NOT NULL and status <> 2",
+ name: NEW_INDEX_NAME,
+ unique: true
+
+ remove_concurrent_index_by_name :alert_management_alerts, OLD_INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index :alert_management_alerts,
+ [:project_id, :fingerprint],
+ where: "status <> 2",
+ name: OLD_INDEX_NAME,
+ unique: true
+
+ remove_concurrent_index_by_name :alert_management_alerts, NEW_INDEX_NAME
+ end
+end
diff --git a/db/schema_migrations/20220428133724 b/db/schema_migrations/20220428133724
new file mode 100644
index 00000000000..9b9f36980f1
--- /dev/null
+++ b/db/schema_migrations/20220428133724
@@ -0,0 +1 @@
+9daf43ece9531540c942ade3939bf86f332701af8a9a0e50bd8ef3b90322baa2 \ No newline at end of file
diff --git a/db/schema_migrations/20220505174658 b/db/schema_migrations/20220505174658
new file mode 100644
index 00000000000..67dfd7ca827
--- /dev/null
+++ b/db/schema_migrations/20220505174658
@@ -0,0 +1 @@
+57dd9ed105c0380b660e8cc450848b8662bf6a41e47cbfac1bcc061934cbc24c \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 2fd4399ed27..19de1d7ba2f 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -28679,8 +28679,6 @@ CREATE INDEX index_pages_domains_on_verified_at_and_enabled_until ON pages_domai
CREATE INDEX index_pages_domains_on_wildcard ON pages_domains USING btree (wildcard);
-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 INDEX index_pat_on_user_id_and_expires_at ON personal_access_tokens USING btree (user_id, expires_at);
@@ -29367,6 +29365,8 @@ CREATE INDEX index_unit_test_failures_failed_at ON ci_unit_test_failures USING b
CREATE UNIQUE INDEX index_unit_test_failures_unique_columns ON ci_unit_test_failures USING btree (unit_test_id, failed_at DESC, build_id);
+CREATE UNIQUE INDEX index_unresolved_alerts_on_project_id_and_fingerprint ON alert_management_alerts USING btree (project_id, fingerprint) WHERE ((fingerprint IS NOT NULL) AND (status <> 2));
+
CREATE UNIQUE INDEX index_upcoming_reconciliations_on_namespace_id ON upcoming_reconciliations USING btree (namespace_id);
CREATE INDEX index_upload_states_failed_verification ON upload_states USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);