Developers want to create the best applications they can for their users. In the process, they want to make sure to give good feedback to their users when data doesnโ€™t get saved into the database. In Elixir, there is a great tool on top of the database that helps โ€“ Ecto! It can put validations and constraints onto specific fields to ensure data integrity.

However, did you know they are differences between validations and constraints? I didnโ€™t. In the process of building a side project, I ran into the problem a few times! Letโ€™s discuss the purpose of each approach and see the differences between them. Weโ€™ll dive into why we need each towards the end.

continue reading on elixirschool.com

โš ๏ธ This post links to an external website. โš ๏ธ