diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 00:08:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 00:08:00 +0300 |
commit | 69d6d3ca2013e97cfd2d89449669ea7bf475f4e9 (patch) | |
tree | 2cc4227ebfc52b7603691f06b0b8e09e030e8428 /db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb | |
parent | 01fdcf49b1553c22ae116fe96cedd7b91d02225c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb')
-rw-r--r-- | db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb b/db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb new file mode 100644 index 00000000000..5dacc3c0c66 --- /dev/null +++ b/db/migrate/20191214175727_add_indexes_to_deployments_on_project_id_and_ref.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddIndexesToDeploymentsOnProjectIdAndRef < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + INDEX_NAME = 'partial_index_deployments_for_project_id_and_tag'.freeze + + disable_ddl_transaction! + + def up + add_concurrent_index :deployments, [:project_id, :ref] + add_concurrent_index :deployments, [:project_id], where: 'tag IS TRUE', name: INDEX_NAME + end + + def down + remove_concurrent_index :deployments, [:project_id, :ref] + remove_concurrent_index :deployments, [:project_id], where: 'tag IS TRUE', name: INDEX_NAME + end +end |