To all the people stating that unique indexes and constraints are the same: This is not true.
If all you need are the features and functionality of a unique index the difference does not matter, but if you want to use the unique constraint with all the features of constraints – like being able to defer their validation – the difference does indeed matter.
@mmmrrr you can use execute/1,2
to add the constraint with raw sql after having created the table. Ecto doesn’t need to have explicit api for any and all things your db supports.
Edit: Example of that can be found in Unnest for runtime sorted results | Benjamin Milde (migration is in the code comments)