4 ms·
Generally my rule of thumb is to keep the integrity checking as close to the data as possible. Usually that means integrating it into the schema/database (optio
by TotempaaltJ 7y ago
Generally my rule of thumb is to keep the integrity checking as close to the data as possible. Usually that means integrating it into the schema/database (optionally with triggers), as long as that has proper tooling (versioning specifically).
With more complex checks it might be necessary to build a periodically runnable check mechanism. At startup might be a good way to do it, or some sort of cronjob. I can imagine that in larger systems there might even be separate services to check data integrity across other services.
- scarface74 7y agoI’ve never heard someone say as the database grows in complexity - “I’m so glad we decided to use triggers everywhere”.
- TotempaaltJ 7y agoI haven't actually used triggers myself, and I do feel like they're too far away from the data to be visible/easy to understand.