Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
backend ruleP1stack specificStack: Sequelize / TypeScript
databasemodelnull-safetyorm
Mark nullable model columns with the allow-null decorator
If a database column can hold null, annotate the ORM model accordingly so the type and the schema agree and consumers handle null correctly.
PR: vinify-backend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | @Column |
| 2 | longName: string; // column is actually nullable |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | @AllowNull(true) |
| 2 | @Column |
| 3 | longName: string | null; |
Explanation (EN)
Objašnjenje (HR)