|
|
|
|
|
by concede_pluto
3206 days ago
|
|
This. You don't want to reimplement all your validation in each of your applications (plural!), and you're in for a nasty surprise if you think your entire organization has only one application using your database now and forever. |
|
Front end (JS SPA) for the convenience of users.
Back end API (any web framework) for the convenience of developers, the users of the API.
The database to make sure nobody can corrupt the data.
In my experience the validations in the database almost never go past foreign keys, null fields and bounds on numeric data.
Anecdote. I remember when the consensus of Rails developers was not to use foreign keys: Rails didn't have a way to define them so they probably didn't matter, right? I laughed and added them to every application of mine. Rails has foreign keys now, maybe since version 3.
There are some gems to generate CHECK statements from validations.