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

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

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

  INDEX_NAME = 'index_users_on_unconfirmed_and_created_at_for_active_humans'

  def up
    add_concurrent_index :users, [:created_at, :id],
      name: INDEX_NAME,
      where: "confirmed_at IS NULL AND state = 'active' AND user_type IN (0)"
  end

  def down
    remove_concurrent_index_by_name :users, INDEX_NAME
  end
end