From c7f421cb3d4ca3cc79958328ca9c2453e3143193 Mon Sep 17 00:00:00 2001 From: "Aaron K. Clark" Date: Tue, 19 May 2026 01:58:04 -0500 Subject: [PATCH] chore(db): flip global timestamps default from false to true to match every model's explicit override MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `app/config/db.config.js` set `define.timestamps: false` as a global default for every Sequelize model. But every one of the 18 model files in `app/models/` overrides it with `timestamps: true` (introduced alongside the 20260520-timestamps migration that added `createdAt` / `updatedAt` columns to every domain table + the ApiKey / ApiMaster auth tables). The global default never matched reality, so it sat as dead, misleading code: any reader inspecting db.config.js to learn the project's stance on timestamps got the wrong answer. The trap is for future models. A new model file that forgets the explicit `timestamps: true` override would silently inherit the global `false` and skip the timestamps that every other table has. Subtle bug, hard to spot in code review. Flip the global to `true` so new models inherit the right behaviour without ceremony. Existing models keep their explicit overrides for now — they're redundant but they also serve as visible documentation of the project's stance, and removing them is a separate consistency-cleanup PR if anyone wants it. No behavior change for existing models; `npm test` unchanged at 520 passed. Co-Authored-By: Claude Opus 4.7 (1M context) --- app/config/db.config.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/config/db.config.js b/app/config/db.config.js index 21aa585..7e93988 100644 --- a/app/config/db.config.js +++ b/app/config/db.config.js @@ -29,7 +29,17 @@ const sequelize = new Sequelize(env.database, env.username, env.password, { logging: dbQueryLog, define: { schema: 'dbo', - timestamps: false, + // Match the de facto pattern: every model in app/models/ + // already sets `timestamps: true` explicitly (the 20260520 + // migration added `createdAt` / `updatedAt` columns to every + // domain table + the auth tables, and the model overrides + // were added at the same time). The previous global default + // of `false` was misleading because no model honoured it, + // and a future model that forgot the explicit override would + // silently skip the timestamps Sequelize otherwise auto- + // populates. Flip the default so new models inherit the + // right behaviour without ceremony. + timestamps: true, }, });