chore(db): flip global timestamps default from false to true to match every model's explicit override#148
Merged
Conversation
… every model's explicit override `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) <noreply@anthropic.com>
This was referenced May 19, 2026
CryptoJones
added a commit
that referenced
this pull request
May 19, 2026
…, not false (#178) PR #148 flipped `db.config.js`'s global `define.timestamps` default from `false` to `true` so every domain model inherits Sequelize's auto-populated `createdAt` / `updatedAt` without an explicit override. `sequelize-cli.config.js` — the config file the migrate CLI reads — was missed and still declared `timestamps: false`. In practice this doesn't break anything today: migrations use `queryInterface` directly, not the model layer, so the `define` default never gets consulted from the CLI path. But two adjacent files declaring opposite defaults is a smell that would burn a future contributor who tried to add model-based logic to a migration. Flip the cli config's value to `true` to match the runtime, and pin both `define.timestamps` and `define.schema` agreement in a new `tests/unit/sequelize-cli-config.test.js` so a future drift fails loudly instead of silently. Co-authored-by: Aaron K. Clark <akclark@thenetwerk.net> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CryptoJones
added a commit
that referenced
this pull request
May 19, 2026
…#261) `app/config/env.js` exported two fields neither consumer reads: - `dialect: 'postgres'` — `db.config.js` (line 28) and `sequelize-cli.config.js` (line 20) both hardcode `'postgres'` inline; neither references `env.dialect`. - `define: { timestamps: false }` — both consumers override with `define: { schema: 'dbo', timestamps: true }`, so the `false` in env.js was both dead AND misleading (a reader scanning env.js could conclude the runtime has timestamps disabled when in fact PR #148 flipped both consumers to `true`). Verified via grep — nothing in app/, server.js, or tests/ touches `env.dialect` or `env.define`. Drop both. No behavior change; just stops env.js from misrepresenting the runtime. 688 tests still pass. Co-authored-by: Aaron K. Clark <akclark@thenetwerk.net> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #147.
Summary
app/config/db.config.jssetdefine.timestamps: falseas a global default for every Sequelize model. But every one of the 18 model files inapp/models/overrides it withtimestamps: true(introduced alongside the 20260520-timestamps migration). The global default never matched reality and sat as dead, misleading code.The trap is for future models. A new model file that forgets the explicit
timestamps: trueoverride would silently inherit the globalfalseand skip the timestamps every other table has — subtle bug, easy to miss in review.Flip the global to
trueso new models inherit the right behaviour without ceremony. Existing per-model overrides stay (visible documentation; a follow-up could strip them for consistency). No behaviour change for any existing model.Test plan
npm run lint— cleannpm test— 520 passed, 15 skipped (unchanged from master; no model's behaviour shifts)Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/