Skip to content

chore(sequelize-cli): sync define.timestamps with db.config.js#178

Merged
CryptoJones merged 1 commit into
masterfrom
chore/sequelize-cli-config-sync-timestamps-default
May 19, 2026
Merged

chore(sequelize-cli): sync define.timestamps with db.config.js#178
CryptoJones merged 1 commit into
masterfrom
chore/sequelize-cli-config-sync-timestamps-default

Conversation

@CryptoJones
Copy link
Copy Markdown
Owner

Closes #177.

Summary

PR #148 flipped db.config.js's define.timestamps from false to
true so every domain model inherits Sequelize's auto-populated
createdAt / updatedAt. sequelize-cli.config.js was missed and
still declared timestamps: false.

Not breaking today (migrations don't use the model layer) but a
latent footgun if anyone adds model-based code to a migration later.

This PR brings the two configs into sync and adds a unit test pinning
both define.timestamps and define.schema agreement so a future
drift fails CI instead of going silent.

Test plan

  • npm run lint clean
  • npm test — 622 → 628 (+6 cross-config invariants)
  • 3 tests assert cliConfig.<env>.define.timestamps === dbConfig.sequelize.options.define.timestamps
  • 3 tests assert the same for define.schema

Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/

…, not false

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: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CryptoJones CryptoJones merged commit 85d3704 into master May 19, 2026
3 checks passed
@CryptoJones CryptoJones deleted the chore/sequelize-cli-config-sync-timestamps-default branch May 19, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sequelize-cli.config.js drifts from db.config.js on define.timestamps (false vs true)

1 participant