Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-03-07 19:08:53 +0300
committerDouwe Maan <douwe@selenight.nl>2017-03-07 19:09:01 +0300
commit5d9762b3b5ace3da397b83f501d103a5152f0dd3 (patch)
treebed282cc9a07e165842c6b28e18746c8558c0c21 /db/migrate/20161202152035_add_index_to_routes.rb
parent6a52cda31da4becc3e342530a2bdf0868d8921cc (diff)
Add cop to ensure reversibility of add_concurrent_index
Diffstat (limited to 'db/migrate/20161202152035_add_index_to_routes.rb')
-rw-r--r--db/migrate/20161202152035_add_index_to_routes.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/db/migrate/20161202152035_add_index_to_routes.rb b/db/migrate/20161202152035_add_index_to_routes.rb
index 4a51337bda6..6d6c8906204 100644
--- a/db/migrate/20161202152035_add_index_to_routes.rb
+++ b/db/migrate/20161202152035_add_index_to_routes.rb
@@ -9,8 +9,13 @@ class AddIndexToRoutes < ActiveRecord::Migration
disable_ddl_transaction!
- def change
+ def up
add_concurrent_index(:routes, :path, unique: true)
add_concurrent_index(:routes, [:source_type, :source_id], unique: true)
end
+
+ def down
+ remove_index(:routes, :path) if index_exists? :routes, :path
+ remove_index(:routes, [:source_type, :source_id]) if index_exists? :routes, [:source_type, :source_id]
+ end
end