-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm start 启动报错 #4
Comments
嗯,我看了你的报错信息得出原因是:你的数据库用户分类表冲突了,非常抱歉,我周六时候更新了一个多表关联,导致前面的数据库表需要重新创建了 解决方法:你删除掉数据库表 user,category,和article,然后重新启动,:) |
OK,还有个问题我想问下,schema中定义模型的createdAt和updatedAt,我想知道他是预留字段吗?怎么做到创建的时候自动添加createdAt,更新的时候自动更新updatedAt?我没有看到相关的修改或者赋值的代码,我只在官网看到说可以通过get()自定义getter,使用this.getDataValue(String)操作基础值。我是个node新手,数据库这块不太了解,见谅! |
现在才发现有回复,回复晚了,非常抱歉。首先默认情况下,Sequelize会将createdAt和updatedAt的属性添加到模型中,以便您可以知道数据库条目何时进入数据库以及何时被更新。然后你在操作一些数据或者更新数据时候,可以操作这两个字段的,共勉:) |
npm start 启动报错,报错信息是不能加入有约束的外键
The text was updated successfully, but these errors were encountered: