Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20230127125018_remove_hosted_plan_id_index_from_gitlab_subscriptions.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6cc21920748b8f51220ac049cc68222f69dce1d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

class RemoveHostedPlanIdIndexFromGitlabSubscriptions < Gitlab::Database::Migration[2.1]
  OLD_INDEX_NAME = 'index_gitlab_subscriptions_on_hosted_plan_id'
  NEW_INDEX_NAME = 'index_gitlab_subscriptions_on_hosted_plan_id_and_trial'
  TABLE = :gitlab_subscriptions

  disable_ddl_transaction!

  def up
    remove_concurrent_index_by_name TABLE, OLD_INDEX_NAME if index_exists_by_name?(TABLE, NEW_INDEX_NAME)
  end

  def down
    add_concurrent_index TABLE, :hosted_plan_id, name: OLD_INDEX_NAME
  end
end