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

Enforce uniqueness constraints using doobie #48

Open
pauljamescleary opened this issue Dec 24, 2017 · 1 comment
Open

Enforce uniqueness constraints using doobie #48

pauljamescleary opened this issue Dec 24, 2017 · 1 comment

Comments

@pauljamescleary
Copy link
Owner

The way we check if something exists, or is unique, is done via Validations.

The correct way to do this in a SQL db application is to enforce those invariants in the data base using unique constraints.

Consider using http://tpolecat.github.io/doobie/docs/09-Error-Handling.html as a guide for handling these kinds of exceptions.

@pauljamescleary
Copy link
Owner Author

pauljamescleary commented Dec 25, 2017

Actually unsure if we should do this or not tbh. Happy to get other people's thoughts on it.

Assuming all data was in a single JDBC database, this seems like the best approach. However, I have built systems with heterogeneous backing stores where this would not be possible.

Also, unless I have other ways to demonstrate dependent validations (i.e. validations requiring external data), then these serve as a good use case for those.

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

1 participant