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

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

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

  INDEX_NAME = 'index_users_on_email_domain_and_id'

  def up
    # rubocop:disable Migration/PreventIndexCreation
    add_concurrent_index(:users, "lower(split_part(email, '@', 2)), id", name: INDEX_NAME)
    # rubocop:enable Migration/PreventIndexCreation
  end

  def down
    remove_concurrent_index_by_name :users, INDEX_NAME
  end
end