Commit 1440ac81 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Remove index only if exists

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 031461e1
...@@ -14,7 +14,10 @@ SELECT provider, extern_uid, id FROM users ...@@ -14,7 +14,10 @@ SELECT provider, extern_uid, id FROM users
WHERE provider IS NOT NULL WHERE provider IS NOT NULL
eos eos
if index_exists?(:users, ["extern_uid", "provider"])
remove_index :users, ["extern_uid", "provider"] remove_index :users, ["extern_uid", "provider"]
end
remove_column :users, :extern_uid remove_column :users, :extern_uid
remove_column :users, :provider remove_column :users, :provider
end end
...@@ -35,6 +38,9 @@ eos ...@@ -35,6 +38,9 @@ eos
end end
drop_table :identities drop_table :identities
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 add_index "users", ["extern_uid", "provider"], name: "index_users_on_extern_uid_and_provider", unique: true, using: :btree
end end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment