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 ruleP2stack specificStack: sql
sqlmigrationsmaintainabilityrollback
Keep each migration focused on a single table or concern
Split unrelated schema changes into separate migration files so each can be tested, reasoned about, and rolled back independently.
PR: vinify-database-migrator · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codejavascript
| 1 | // one migration creating several unrelated tables |
| 2 | async up(qi, S) { |
| 3 | await qi.createTable("tasting_lists", { /* ... */ }); |
| 4 | await qi.createTable("tl_tasting_notes", { /* ... */ }); |
| 5 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codejavascript
| 1 | // 20260204-create-tasting-lists.js |
| 2 | async up(qi, S) { await qi.createTable("tasting_lists", { /* ... */ }); } |
| 3 |
|
| 4 | // 20260204-create-tl-tasting-notes.js |
| 5 | async up(qi, S) { await qi.createTable("tl_tasting_notes", { /* ... */ }); } |
Explanation (EN)
Objašnjenje (HR)