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

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

class AddIndexOnNoteableTypeAndNoteableIdToSentNotifications < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  INDEX_NAME = 'index_sent_notifications_on_noteable_type_noteable_id'

  disable_ddl_transaction!

  def up
    add_concurrent_index :sent_notifications,
      [:noteable_id],
      name: INDEX_NAME,
      where: "noteable_type = 'Issue'"
  end

  def down
    remove_concurrent_index_by_name :sent_notifications, INDEX_NAME
  end
end