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
diff options
context:
space:
mode:
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