diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-03-07 19:08:53 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-03-07 19:09:01 +0300 |
commit | 5d9762b3b5ace3da397b83f501d103a5152f0dd3 (patch) | |
tree | bed282cc9a07e165842c6b28e18746c8558c0c21 /db/migrate/20160808085602_add_index_for_build_token.rb | |
parent | 6a52cda31da4becc3e342530a2bdf0868d8921cc (diff) |
Add cop to ensure reversibility of add_concurrent_index
Diffstat (limited to 'db/migrate/20160808085602_add_index_for_build_token.rb')
-rw-r--r-- | db/migrate/20160808085602_add_index_for_build_token.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/db/migrate/20160808085602_add_index_for_build_token.rb b/db/migrate/20160808085602_add_index_for_build_token.rb index 10ef42afce1..6c5d7268e72 100644 --- a/db/migrate/20160808085602_add_index_for_build_token.rb +++ b/db/migrate/20160808085602_add_index_for_build_token.rb @@ -6,7 +6,11 @@ class AddIndexForBuildToken < ActiveRecord::Migration disable_ddl_transaction! - def change + def up add_concurrent_index :ci_builds, :token, unique: true end + + def down + remove_index :ci_builds, :token, unique: true if index_exists? :ci_builds, :token, unique: true + end end |