|
|
|
|
|
by vbsteven
2594 days ago
|
|
I try to encode all constraints in the database using constraints and triggers. This way your data is always consistent regardless of which app/language is interacting with it. Sometimes I add the same or similar constraints in the application layer because it leads to better error/validation messages. IMO having data integrity enforced in the database instead of application code is similar to having a type system enforcing code integrity at compile time instead of at runtime. It's about catching errors as early and as close to the root as possible. |
|