diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /db/migrate/20210420210642_recreate_index_for_project_deployments_with_environment_id_and_date_at.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) | |
download | gitlab-ce-4555e1b21c365ed8303ffb7a3325d773c9b8bf31.tar.gz |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'db/migrate/20210420210642_recreate_index_for_project_deployments_with_environment_id_and_date_at.rb')
-rw-r--r-- | db/migrate/20210420210642_recreate_index_for_project_deployments_with_environment_id_and_date_at.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/db/migrate/20210420210642_recreate_index_for_project_deployments_with_environment_id_and_date_at.rb b/db/migrate/20210420210642_recreate_index_for_project_deployments_with_environment_id_and_date_at.rb new file mode 100644 index 00000000000..2674d9e50c8 --- /dev/null +++ b/db/migrate/20210420210642_recreate_index_for_project_deployments_with_environment_id_and_date_at.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This migration recreates the index that introduced in 20210326035553_add_index_for_project_deployments_with_environment_id_and_updated_at.rb. +class RecreateIndexForProjectDeploymentsWithEnvironmentIdAndDateAt < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + OLD_INDEX_NAME = 'index_deployments_on_project_and_environment_and_updated_at' + NEW_INDEX_NAME = 'index_deployments_on_project_and_environment_and_updated_at_id' + + def up + add_concurrent_index :deployments, [:project_id, :environment_id, :updated_at, :id], name: NEW_INDEX_NAME + remove_concurrent_index_by_name :deployments, OLD_INDEX_NAME + end + + def down + add_concurrent_index :deployments, [:project_id, :environment_id, :updated_at], name: OLD_INDEX_NAME + remove_concurrent_index_by_name :deployments, NEW_INDEX_NAME + end +end |