不使用 sequelize 模型存储 updatedAt [英] Not store updatedAt with sequelize model

查看:22
本文介绍了不使用 sequelize 模型存储 updatedAt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将模型存储在我的 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.

这篇关于不使用 sequelize 模型存储 updatedAt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆