-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Email uniqueness not being enforced properly #85
Comments
the error happens when you try to save the record at
The constraints can only be checked in a safe way when performing the operation in the database. As a consequence, validations are always checked before constraints. Constraints won’t even be checked in case validations failed. |
If I add a unique_constraint(:email) on my User model I get this error. Is there an existing way to add a unique constraint to a User model while using Addict? |
I just started tinkering with Addict and i'm running into this issue as well.
|
Still happening to me with a fresh phoenix and addict project. Anyone else still having this issue as well? |
Hello, according to the documentation,
But, out of the box, it does not validate the uniqueness of the email. It lets me insert 2 users with the same email.
Now, if I add a unique index on the database table with
create unique_index(:users, [:email])
, I prevent that from happening at the database layer, but the DB error is not converted to a changeset error asunique_constraint
is supposed to do, a 500 internal server error is raised.The text was updated successfully, but these errors were encountered: