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

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

class RemoveTemporaryBillableIndex < Gitlab::Database::Migration[2.1]
  disable_ddl_transaction!

  INDEX_NAME = 'migrate_index_users_for_active_billable_users'
  def up
    remove_concurrent_index_by_name :users, INDEX_NAME
  end

  def down
    add_concurrent_index :users, :id,
      name: INDEX_NAME,
      where: "((state)::text = 'active'::text) " \
             "AND (user_type IS NULL OR user_type = 0 OR user_type = ANY (ARRAY[0, 6, 4, 13])) " \
             "AND (user_type IS NULL OR user_type = 0 OR user_type = ANY (ARRAY[0, 4, 5]))"
  end
end