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/20160805041956_add_deleted_at_to_namespaces.rb
parent6a52cda31da4becc3e342530a2bdf0868d8921cc (diff)
Add cop to ensure reversibility of add_concurrent_index
Diffstat (limited to 'db/migrate/20160805041956_add_deleted_at_to_namespaces.rb')
-rw-r--r--db/migrate/20160805041956_add_deleted_at_to_namespaces.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/db/migrate/20160805041956_add_deleted_at_to_namespaces.rb b/db/migrate/20160805041956_add_deleted_at_to_namespaces.rb
index a853de3abfb..3f074723b4a 100644
--- a/db/migrate/20160805041956_add_deleted_at_to_namespaces.rb
+++ b/db/migrate/20160805041956_add_deleted_at_to_namespaces.rb
@@ -5,8 +5,15 @@ class AddDeletedAtToNamespaces < ActiveRecord::Migration
disable_ddl_transaction!
- def change
+ def up
add_column :namespaces, :deleted_at, :datetime
+
add_concurrent_index :namespaces, :deleted_at
end
+
+ def down
+ remove_index :namespaces, :deleted_at if index_exists? :namespaces, :deleted_at
+
+ remove_column :namespaces, :deleted_at
+ end
end