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