Skip to content
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

unique_constraint not working #202

Open
jfcalvo opened this issue Oct 10, 2017 · 4 comments
Open

unique_constraint not working #202

jfcalvo opened this issue Oct 10, 2017 · 4 comments

Comments

@jfcalvo
Copy link

jfcalvo commented Oct 10, 2017

As pointed out on README unique_constraint doesn't work as expected (modifying changeset errors) and instead raising an exception.

There are any plans to implement or improve this or it's totally impossible to give support for this validation because SQLite special characteristics?

@scouten
Copy link

scouten commented Oct 14, 2017

SQLite does not tell you which constraint has been violated, so it's not possible to properly complete the Ecto error response. This is not a great answer, but I'm at a loss for how to improve on it. Suggestions?

@jfcalvo
Copy link
Author

jfcalvo commented Oct 18, 2017

I don't have the necessary knowledge about SQLite to think in a correct solution sorry.

But a possible workaround could be to use unsafe_validate_unique in your changesets so you have at least a previous (and sadly unsafe) validation.

@roylez
Copy link

roylez commented May 10, 2018

The follow is what I get from running ecto integration. I think the error message does tell which constraint has been violated.

 ** (Sqlite.DbConnection.Error) UNIQUE constraint failed: posts_users_composite_pk.post_id, posts_users_composite_pk.user_id

@scouten
Copy link

scouten commented Jun 17, 2018

As noted in the recently-updated README, I am no longer able to actively maintain this project due to some other life circumstances.

I'll review a patch if one comes or transfer ownership to a new maintainer if somebody signals an interest in taking over.

paranojik added a commit to paranojik/sqlite_ecto2 that referenced this issue Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants