Remove constraint indexes if data is not unique.

When failing to create a unique index for a uniqueness constraint, the
index should be dropped immediately.

Fixes #1492.