Set constraints on Readouts.user_id foreign key

Add Measurements table
This commit is contained in:
2026-05-05 20:33:21 +02:00
parent 4a36ffc8bf
commit d3a34233b9
10 changed files with 107 additions and 22 deletions

View File

@@ -34,10 +34,10 @@ whenever a change is considered, to avoid regressions.
custom `BigDecimal` type
### Database layer vs application layer data model constraints
* database constraints are the final frontier against data corruption,
* they should safeguard against data _consistency_ loss under _all_ data
(not schema) manipulation scenarios, including application level logic
errors and direct data manipulation,
* database constraints are the final guard against data integrity corruption,
* they should safeguard against data referential integrity loss under _all_
data (not schema) manipulation scenarios, including application level
logic errors and direct data manipulation (e.g. through `dbconsole`),
* application constraints can be as restrictive as database constraints or more,
but not less, as it doesn't serve any use case,
* proper application level constraints should prevent unhandled database