不使用 sequelize 模型存储 updatedAt

2022-01-19 00:00:00 mysql sequelize.js

当我将模型存储在我的 MySQL 数据库中时,它们是不可变的.结果,我可以看到表中需要 createdAt 列,但我不需要多余的 updatedAt 列.我可以将 sequelize 配置为不存储 updatedAt 时间,然后我可以从表中删除该列吗?

When I store models in my MySQL DB, they are immutable. As a result I can see the need for the createdAt column in my tables, but I don't need the redundant updatedAt column. Can I configure sequelize not to store updatedAt time and then can I drop the column from my table?

推荐答案

在 http://docs.sequelizejs.com/manual/tutorial/models-definition.html#configuration,我应该在我的模型定义中使用 updatedAt: false.

Found my own answer at http://docs.sequelizejs.com/manual/tutorial/models-definition.html#configuration, I should use updatedAt: false in my model definition.

相关文章