我刚刚开始使用Sequelize写入MSSQL数据库 - 一切正常,但我的节点程序永远不会完成并返回到终端。代码如下所示:
const Sequelize = require('sequelize');
var sequelize = new Sequelize(...);
const JournalLine = sequelize.define('journalLine', {...});
JournalLine.sync().then(() => {
JournalLine.bulkCreate([...])
});
为了结束程序,我需要关闭一些东西吗?
答案 0 :(得分:0)
您没有提供callback
功能或使用Promise
,以下工作
const Sequelize = require('sequelize');
var sequelize = new Sequelize(...);
const JournalLine = sequelize.define('journalLine', {...});
JournalLine.sync().then(() => {
return JournalLine.bulkCreate([...]).then( result => {
console.log('done');
return result;
})
});