diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-05 18:10:31 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-05 18:10:31 +0000 |
commit | 8f4d63426a207611f71bc19dae62eb19765a4cf2 (patch) | |
tree | b5843aaef889b0d1305e669404693f11ce414d22 /db | |
parent | cf05fd7f3956f0b1a17caf313e89bb7b3315d947 (diff) | |
download | gitlab-ce-8f4d63426a207611f71bc19dae62eb19765a4cf2.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20210505092746_create_partial_covering_index_for_pending_builds.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/db/post_migrate/20210505092746_create_partial_covering_index_for_pending_builds.rb b/db/post_migrate/20210505092746_create_partial_covering_index_for_pending_builds.rb index a1e1dbbeafe..81fe65c1945 100644 --- a/db/post_migrate/20210505092746_create_partial_covering_index_for_pending_builds.rb +++ b/db/post_migrate/20210505092746_create_partial_covering_index_for_pending_builds.rb @@ -9,13 +9,16 @@ class CreatePartialCoveringIndexForPendingBuilds < ActiveRecord::Migration[6.0] NEW_INDEX = 'index_ci_builds_runner_id_pending_covering' def up - execute "CREATE INDEX CONCURRENTLY #{NEW_INDEX} ON ci_builds (runner_id, id) INCLUDE (project_id) WHERE status = 'pending' AND type = 'Ci::Build'" unless index_exists_by_name?(:ci_builds, NEW_INDEX) + disable_statement_timeout do + execute "CREATE INDEX CONCURRENTLY #{NEW_INDEX} ON ci_builds (runner_id, id) INCLUDE (project_id) WHERE status = 'pending' AND type = 'Ci::Build'" unless index_exists_by_name?(:ci_builds, NEW_INDEX) + end remove_concurrent_index_by_name :ci_builds, EXISTING_INDEX end def down add_concurrent_index :ci_builds, :runner_id, where: "status = 'pending' AND type = 'Ci::Build'", name: EXISTING_INDEX + remove_concurrent_index_by_name :ci_builds, NEW_INDEX end end |