Unique Indexes With Ecto
Last updated
Was this helpful?
Last updated
Was this helpful?
You can create a unique index in a migration for one or more columns using the function.
For example, if you are creating a join table for followers
and want to ensure that duplicate follower entries are prevented, you may want to include a unique index like so:
Keep in mind that unique_index/3
is a shorthand for when you set unique: true
.