跳到主要内容
CNode

用 sequelize 的时候,在什么时候调用 sync?

问答
Bbeyond5959发布于 10 年前最后回复 10 年前
438840

大家使用 sequelize 的时候,什么时候调用 sync 方法呢?sync 返回的是个Promise,是不是后续所有关于 db 的操作都要放在 sync 后的 then 里面?这样感觉好不方便呀。

查看回复

回复 (4)

O
oyosc#410 年前

sequelize.sync() will, based on your model definitions, create any missing tables. If force: true it will first drop tables before recreating them. api文档上已经说明了...

B
beyond5959#310 年前
引用 lumia2046按时as

@lumia2046 as 是啥?求指教。

L
lumia2046#210 年前

按时as

O
oyosc#110 年前

你可以将其重新封装一下,结果用回调函数返回,这个很简单的

参与回复

登录后即可参与回复。登录