diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-12-23 11:05:50 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-12-23 11:05:50 +0200 |
commit | 1440ac815435063330955a6c73ca5ba3b2304ba4 (patch) | |
tree | 1f60a9c652ca4d74e2c1d3a1e972b9f5c6256e99 /db | |
parent | 031461e1063040f61f80872de4394e763ec2dfa2 (diff) | |
download | gitlab-ce-1440ac815435063330955a6c73ca5ba3b2304ba4.tar.gz |
Remove index only if exists
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20141121161704_add_identity_table.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/db/migrate/20141121161704_add_identity_table.rb b/db/migrate/20141121161704_add_identity_table.rb index cf56fd6c227..a85b0426cec 100644 --- a/db/migrate/20141121161704_add_identity_table.rb +++ b/db/migrate/20141121161704_add_identity_table.rb @@ -14,7 +14,10 @@ SELECT provider, extern_uid, id FROM users WHERE provider IS NOT NULL eos - remove_index :users, ["extern_uid", "provider"] + if index_exists?(:users, ["extern_uid", "provider"]) + remove_index :users, ["extern_uid", "provider"] + end + remove_column :users, :extern_uid remove_column :users, :provider end @@ -35,6 +38,9 @@ eos end drop_table :identities - add_index "users", ["extern_uid", "provider"], name: "index_users_on_extern_uid_and_provider", unique: true, using: :btree + + unless index_exists?(:users, ["extern_uid", "provider"]) + add_index "users", ["extern_uid", "provider"], name: "index_users_on_extern_uid_and_provider", unique: true, using: :btree + end end end |