Why is this a bad thing? The code in my app can be tested and is much more expressive than some contraints in the DB.
Why is this a bad thing? The code in my app can be tested and is much more expressive than some contraints in the DB.
When validation criteria are changed on an SQL server, it revalidates all the rows - either immediately, or at the end of the transaction. With the DB doing the validation, the default is that all rows are valid.
Also, do you ever side-step your database abstraction layer to send SQL directly? If you ever insert/update/delete rows that way, perhaps for performance reasons, now you have an extra place in your app to make sure the relevant validations are kept up-to-date.
https://robots.thoughtbot.com/validation-database-constraint...
Relatedly, this article suggests that your app should only be validating user input - so there should be no app validation of fields not set by end users - whilst the database itself should validate what your app gives it.