Problem
PR #148 flipped db.config.js's global define.timestamps from
false to true so every domain model inherits Sequelize's
auto-populated createdAt / updatedAt. The change matched the
de-facto convention (every model in app/models/ already declared
timestamps: true explicitly) and let new models drop the override.
But the runtime config and the CLI config live in two files, and
app/config/sequelize-cli.config.js was not updated alongside:
// app/config/db.config.js (post-#148)
define: { schema: 'dbo', timestamps: true }
// app/config/sequelize-cli.config.js (still pre-#148)
define: { schema: 'dbo', timestamps: false }
Today this isn't a behavioral bug — migrations use queryInterface
directly and never consult the define defaults. But two adjacent
config files declaring opposite values is a latent footgun:
- A future contributor adding model-based logic to a migration (e.g.
a data-fixup migration that loads rows via db.Customer.findAll)
would inherit different createdAt/updatedAt behavior under
npm run migrate than under npm start.
- A reader trying to understand "what's the global default?" sees
conflicting answers.
Fix
Flip sequelize-cli.config.js to timestamps: true to match the
runtime. Add a unit test pinning both define.timestamps and
define.schema agreement across the two configs so a future drift
surfaces as a CI failure.
Acceptance
Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/
Problem
PR #148 flipped
db.config.js's globaldefine.timestampsfromfalsetotrueso every domain model inherits Sequelize'sauto-populated
createdAt/updatedAt. The change matched thede-facto convention (every model in
app/models/already declaredtimestamps: trueexplicitly) and let new models drop the override.But the runtime config and the CLI config live in two files, and
app/config/sequelize-cli.config.jswas not updated alongside:Today this isn't a behavioral bug — migrations use
queryInterfacedirectly and never consult the
definedefaults. But two adjacentconfig files declaring opposite values is a latent footgun:
a data-fixup migration that loads rows via
db.Customer.findAll)would inherit different
createdAt/updatedAtbehavior undernpm run migratethan undernpm start.conflicting answers.
Fix
Flip
sequelize-cli.config.jstotimestamps: trueto match theruntime. Add a unit test pinning both
define.timestampsanddefine.schemaagreement across the two configs so a future driftsurfaces as a CI failure.
Acceptance
sequelize-cli.config.jsdeclaresdefine.timestamps: truecliConfig.<env>.define.timestamps === dbConfig.sequelize.options.define.timestampsdefine.schemaProudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/