Commit 715d6813 authored by Sean McGivern's avatar Sean McGivern Committed by Lin Jen-Shin

Merge branch 'sh-add-index-to-system-note-metadata' into 'master'

Add unique index to system note metadata

See merge request !10774
parent 27500c14
---
title: Add unique index for notes_id to system note metadata table
merge_request:
author:
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
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170418103908) do ActiveRecord::Schema.define(version: 20170419001229) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -1140,6 +1140,8 @@ ActiveRecord::Schema.define(version: 20170418103908) do ...@@ -1140,6 +1140,8 @@ ActiveRecord::Schema.define(version: 20170418103908) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
end end
add_index "system_note_metadata", ["note_id"], name: "index_system_note_metadata_on_note_id", unique: true, using: :btree
create_table "taggings", force: :cascade do |t| create_table "taggings", force: :cascade do |t|
t.integer "tag_id" t.integer "tag_id"
t.integer "taggable_id" t.integer "taggable_id"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment