Closed athenawisdoms closed 4 years ago
Yes, sequelize-automate
doesn't add option timestamps: false
to models.
The timestamps
field specify whether or not the createdAt
and updatedAt
fields will be created. We can use configurations such as timestamps
paranoid
in sequelize.define
options and Sequelize constructor. e.g.:
// sequelize define
sequelize.define('modelName', attributes, {
modelName: 'bar',
timestamps: false,
paranoid: true,
underscored: true,
// ...
});
// Sequelize constructor
const sequelize = new Sequelize(connectionURI, {
define: {
timestamps: false,
paranoid: true,
underscored: true,
}
});
I think in most cases, we will use these configurations in the Sequelize constructor, so that it works for all tables/models. That's why sequelize-automate
doesn't put these options in model files. If you only want to use these configurations in a specific table, you can manually modify the generated file by sequelize-automate
.
Thanks for the swift, detailed explanation!
Hello author!
I tried using
sequelize-automate
to generate sequelize model files with the optiontimestamps: false
but this option is not included in the model file generated bysequelize-automate
.System
CLI Command used:
./config/sequelize-automate.config.json
Tried
and
Model file generated by
sequelize-automate
timestamps: false
option is not found!Any help is very much appreciated!