summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-24 00:07:35 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-24 00:07:35 +0000
commit1d78b1f77add7a986a5be4b71dc03ff2bbe0d8b7 (patch)
treee0075b71b8c2af58bf6dafc2973b8370a4583551 /db
parent87e9d9675af5df4c703c502b79567baea24f5395 (diff)
downloadgitlab-ce-1d78b1f77add7a986a5be4b71dc03ff2bbe0d8b7.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20210616145254_add_partial_index_for_ci_builds_token.rb17
-rw-r--r--db/schema_migrations/202106161452541
-rw-r--r--db/structure.sql2
3 files changed, 20 insertions, 0 deletions
diff --git a/db/post_migrate/20210616145254_add_partial_index_for_ci_builds_token.rb b/db/post_migrate/20210616145254_add_partial_index_for_ci_builds_token.rb
new file mode 100644
index 00000000000..6e169a6f0e1
--- /dev/null
+++ b/db/post_migrate/20210616145254_add_partial_index_for_ci_builds_token.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddPartialIndexForCiBuildsToken < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ NAME = 'index_ci_builds_on_token_partial'
+
+ def up
+ add_concurrent_index :ci_builds, :token, unique: true, where: 'token IS NOT NULL', name: NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_builds, NAME
+ end
+end
diff --git a/db/schema_migrations/20210616145254 b/db/schema_migrations/20210616145254
new file mode 100644
index 00000000000..e5d7553d883
--- /dev/null
+++ b/db/schema_migrations/20210616145254
@@ -0,0 +1 @@
+525fbdd66dcabbf1e6d0430468600f86fbc3c00dcfdab1c5a052294d7d73de37 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index 9effc26af91..9c4900c9e50 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -22830,6 +22830,8 @@ CREATE UNIQUE INDEX index_ci_builds_on_token ON ci_builds USING btree (token);
CREATE UNIQUE INDEX index_ci_builds_on_token_encrypted ON ci_builds USING btree (token_encrypted) WHERE (token_encrypted IS NOT NULL);
+CREATE UNIQUE INDEX index_ci_builds_on_token_partial ON ci_builds USING btree (token) WHERE (token IS NOT NULL);
+
CREATE INDEX index_ci_builds_on_updated_at ON ci_builds USING btree (updated_at);
CREATE INDEX index_ci_builds_on_upstream_pipeline_id ON ci_builds USING btree (upstream_pipeline_id) WHERE (upstream_pipeline_id IS NOT NULL);