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 ruleP2universalStack: Sequelize
databaseperformancequery-building
Add conditions so update queries touch only the rows that need it
Include extra where conditions (e.g. is_available = false, bottle_id IS NOT NULL) to skip rows that don't require updating, making queries faster and safer.
PR: vinify-backend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | await this.repo.update({ available: false }, { where: { storeId } }); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | await this.repo.update({ available: false }, { where: { storeId, available: true } }); |
Explanation (EN)
Objašnjenje (HR)