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 ruleP1universalStack: sql
databasemigrationsmodelsconsistency
Keep model column types consistent with the migration definitions
A field's type in the ORM model must match how the migration defines the column (e.g. signedness/width); mismatches cause subtle data and validation bugs.
PR: hegnar-investor-ws · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | // migration: Sequelize.INTEGER.UNSIGNED |
| 2 | // model: |
| 3 | @Column(DataType.INTEGER) |
| 4 | public userId: number; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // migration: Sequelize.INTEGER.UNSIGNED |
| 2 | // model: |
| 3 | @Column(DataType.INTEGER.UNSIGNED) |
| 4 | public userId: number; |
Explanation (EN)
Objašnjenje (HR)