diff options
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 |