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

20170419001229_add_index_to_system_note_metadata.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c68fd920fff45c17b30546e517b0b19e51ad5b4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class AddIndexToSystemNoteMetadata < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  # Set this constant to true if this migration requires downtime.
  DOWNTIME = false

  disable_ddl_transaction!

  def up
    # MySQL automatically creates an index on a foreign-key constraint; PostgreSQL does not
    add_concurrent_index :system_note_metadata, :note_id, unique: true if Gitlab::Database.postgresql?
  end

  def down
    remove_concurrent_index :system_note_metadata, :note_id, unique: true if Gitlab::Database.postgresql?
  end
end