summaryrefslogtreecommitdiff
path: root/db/migrate/20191205094702_add_index_for_cross_projects_dependencies_to_ci_builds.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-18 00:08:09 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-18 00:08:09 +0000
commit2a65a97e12a0754b9f0d91ee996a6e61e00c80c8 (patch)
treef439c93cc95a324ba7422b0b650431a628be9b07 /db/migrate/20191205094702_add_index_for_cross_projects_dependencies_to_ci_builds.rb
parent2d96e61ceb1a3f26283dfba43f85d99488752296 (diff)
downloadgitlab-ce-2a65a97e12a0754b9f0d91ee996a6e61e00c80c8.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate/20191205094702_add_index_for_cross_projects_dependencies_to_ci_builds.rb')
-rw-r--r--db/migrate/20191205094702_add_index_for_cross_projects_dependencies_to_ci_builds.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20191205094702_add_index_for_cross_projects_dependencies_to_ci_builds.rb b/db/migrate/20191205094702_add_index_for_cross_projects_dependencies_to_ci_builds.rb
new file mode 100644
index 00000000000..023414fb4bb
--- /dev/null
+++ b/db/migrate/20191205094702_add_index_for_cross_projects_dependencies_to_ci_builds.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexForCrossProjectsDependenciesToCiBuilds < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_builds, [:project_id, :name, :ref],
+ where: "type = 'Ci::Build' AND status = 'success' AND (retried = FALSE OR retried IS NULL)"
+ end
+
+ def down
+ remove_concurrent_index :ci_builds, [:project_id, :name, :ref],
+ where: "type = 'Ci::Build' AND status = 'success' AND (retried = FALSE OR retried IS NULL)"
+ end
+end