diff options
Diffstat (limited to 'db/migrate/20170419001229_add_index_to_system_note_metadata.rb')
-rw-r--r-- | db/migrate/20170419001229_add_index_to_system_note_metadata.rb | 17 |
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 |