summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-04-19 20:33:49 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-04-19 20:33:49 +0000
commit28c63ce380d7cc6fc0890536a8b3cc60c3382d1b (patch)
treee586fe8ea9b65a52a1ad4656db7a6eaa7f0a1dbc /db/migrate
parent93e23a5d718eafb78c4b8d5b605d740d48c75418 (diff)
parent3f0054a88c84ef5631ee82c1cc9bc985c2eea58b (diff)
downloadgitlab-ce-28c63ce380d7cc6fc0890536a8b3cc60c3382d1b.tar.gz
Merge branch 'sh-add-index-to-system-note-metadata' into 'master'
Add unique index to system note metadata See merge request !10774
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20170419001229_add_index_to_system_note_metadata.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20170419001229_add_index_to_system_note_metadata.rb b/db/migrate/20170419001229_add_index_to_system_note_metadata.rb
new file mode 100644
index 00000000000..c68fd920fff
--- /dev/null
+++ b/db/migrate/20170419001229_add_index_to_system_note_metadata.rb
@@ -0,0 +1,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