diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-12-03 23:20:28 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-12-03 23:20:28 +0800 |
commit | abf3c9680e132af49662f3600dc601b2d995b81c (patch) | |
tree | c29528faca9dcf9a662f62a580dc515bb244129d /db | |
parent | 5733f5b875308ba848753e4ada81f8a4a633a7b7 (diff) | |
download | gitlab-ce-abf3c9680e132af49662f3600dc601b2d995b81c.tar.gz |
Remove redundant ci_builds partial index on GitLab.com
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20181121101843_remove_redundant_ci_builds_partial_index.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/db/migrate/20181121101843_remove_redundant_ci_builds_partial_index.rb b/db/migrate/20181121101843_remove_redundant_ci_builds_partial_index.rb new file mode 100644 index 00000000000..a0a02e81323 --- /dev/null +++ b/db/migrate/20181121101843_remove_redundant_ci_builds_partial_index.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class RemoveRedundantCiBuildsPartialIndex < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + remove_concurrent_index(*index_arguments) + end + + def down + add_concurrent_index(*index_arguments) + end + + private + + def index_arguments + [ + :ci_builds, + [:project_id, :status], + { + name: 'index_ci_builds_project_id_and_status_for_live_jobs_partial', + where: "((status)::text = ANY (ARRAY[('running'::character varying)::text, ('pending'::character varying)::text, ('created'::character varying)::text]))" + } + ] + end +end |