debian-mirror-gitlab/db/migrate/20170419001229_add_index_to_system_note_metadata.rb
2019-02-15 15:39:39 +05:30

18 lines
565 B
Ruby

class AddIndexToSystemNoteMetadata < ActiveRecord::Migration[4.2]
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