summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-06 09:08:54 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-06 09:08:54 +0000
commit4903f95b04db58edc1931ec917d2313c916a06b2 (patch)
tree722e74b8e49f12f8f7aebffc2fa58c9ccc126fb1 /db
parent6367f9bd9cca41c932997c94a338556ded4ced8f (diff)
downloadgitlab-ce-4903f95b04db58edc1931ec917d2313c916a06b2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20230221093533_add_tmp_partial_index_on_vulnerability_report_types.rb15
-rw-r--r--db/post_migrate/20230222055510_remove_concurrent_index_on_token_encrypted_for_ci_builds.rb18
-rw-r--r--db/schema_migrations/202302210935331
-rw-r--r--db/schema_migrations/202302220555101
-rw-r--r--db/structure.sql2
5 files changed, 35 insertions, 2 deletions
diff --git a/db/post_migrate/20230221093533_add_tmp_partial_index_on_vulnerability_report_types.rb b/db/post_migrate/20230221093533_add_tmp_partial_index_on_vulnerability_report_types.rb
new file mode 100644
index 00000000000..4800ce5ed4c
--- /dev/null
+++ b/db/post_migrate/20230221093533_add_tmp_partial_index_on_vulnerability_report_types.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class AddTmpPartialIndexOnVulnerabilityReportTypes < Gitlab::Database::Migration[2.1]
+ INDEX_NAME = 'tmp_idx_vulnerability_occurrences_on_id_where_report_type_7_99'
+ CLAUSE = 'report_type IN (7, 99)'
+
+ def up
+ # Temporary index to be removed in 15.11 https://gitlab.com/gitlab-org/gitlab/-/issues/393052
+ prepare_async_index :vulnerability_occurrences, :id, where: CLAUSE, name: INDEX_NAME
+ end
+
+ def down
+ unprepare_async_index :vulnerability_occurrences, :id, name: INDEX_NAME
+ end
+end
diff --git a/db/post_migrate/20230222055510_remove_concurrent_index_on_token_encrypted_for_ci_builds.rb b/db/post_migrate/20230222055510_remove_concurrent_index_on_token_encrypted_for_ci_builds.rb
new file mode 100644
index 00000000000..d3ed5a8fa2c
--- /dev/null
+++ b/db/post_migrate/20230222055510_remove_concurrent_index_on_token_encrypted_for_ci_builds.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveConcurrentIndexOnTokenEncryptedForCiBuilds < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ TABLE_NAME = :ci_builds
+ COLUMN_NAME = :token_encrypted
+ INDEX_NAME = :index_ci_builds_on_token_encrypted
+ WHERE_STATEMENT = 'token_encrypted IS NOT NULL'
+
+ def up
+ remove_concurrent_index_by_name TABLE_NAME, name: INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index TABLE_NAME, COLUMN_NAME, name: INDEX_NAME, where: WHERE_STATEMENT, unique: true
+ end
+end
diff --git a/db/schema_migrations/20230221093533 b/db/schema_migrations/20230221093533
new file mode 100644
index 00000000000..1d9ac2c72b4
--- /dev/null
+++ b/db/schema_migrations/20230221093533
@@ -0,0 +1 @@
+6a3453275435ebad3269b81f10bc75bf3aeb92f8c9a6769743acf2af78a1dc69 \ No newline at end of file
diff --git a/db/schema_migrations/20230222055510 b/db/schema_migrations/20230222055510
new file mode 100644
index 00000000000..5abc44779d9
--- /dev/null
+++ b/db/schema_migrations/20230222055510
@@ -0,0 +1 @@
+ff8b8d5448460302449025fc79cec95d0d3ae2eb335e9f786031d39caacf631a \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index fdfe26e709b..ceddf2a82a5 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -29469,8 +29469,6 @@ CREATE INDEX index_ci_builds_on_stage_id ON ci_builds USING btree (stage_id);
CREATE INDEX index_ci_builds_on_status_and_type_and_runner_id ON ci_builds USING btree (status, type, runner_id);
-CREATE UNIQUE INDEX index_ci_builds_on_token_encrypted ON ci_builds USING btree (token_encrypted) WHERE (token_encrypted IS NOT NULL);
-
CREATE INDEX index_ci_builds_on_updated_at ON ci_builds USING btree (updated_at);
CREATE INDEX index_ci_builds_on_upstream_pipeline_id ON ci_builds USING btree (upstream_pipeline_id) WHERE (upstream_pipeline_id IS NOT NULL);