summaryrefslogtreecommitdiff
path: root/db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-20 12:10:03 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-20 12:10:03 +0000
commit43b4b3e2d2ddebc0a89b94a8251c162ec5719780 (patch)
tree8a21146370cfd1b24b25cfcacef53e889746f5aa /db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb
parent196ada0844fff7642463fbd08a44609a1e1fa713 (diff)
downloadgitlab-ce-43b4b3e2d2ddebc0a89b94a8251c162ec5719780.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb')
-rw-r--r--db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb b/db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb
new file mode 100644
index 00000000000..0f3b2dbe3ee
--- /dev/null
+++ b/db/migrate/20200318165448_add_index_on_external_key_to_epics_table.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexOnExternalKeyToEpicsTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:epics, [:group_id, :external_key], unique: true, where: 'external_key IS NOT NULL')
+ end
+
+ def down
+ remove_concurrent_index(:epics, [:group_id, :external_key])
+ end
+end