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

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

class AddUniqueIndexPhoneOnUserDetails < Gitlab::Database::Migration[1.0]
  disable_ddl_transaction!

  INDEX_NAME = 'index_user_details_on_phone'

  def up
    add_concurrent_index :user_details, :phone, unique: true, where: 'phone IS NOT NULL', name: INDEX_NAME, comment: 'JiHu-specific index'
  end

  def down
    remove_concurrent_index_by_name :user_details, INDEX_NAME
  end
end