The following script is not finished after the execution. DB got the record but the script is continue working. Why?
var Sequelize = require("sequelize");
var sequelize = new Sequelize('database_name', 'mylogin', 'mypassword', {
host: 'db_host',
port: 5432,
dialect: 'postgres',
protocol: 'postgres',
logging: true,
omitNull: true,
});
var iteration = sequelize.define('iteration', {
id: { type: Sequelize.BIGINT ,
primaryKey: true,
autoIncrement: true,
unique: true},
imported: { type: Sequelize.DATE, defaultValue: Sequelize.NOW },
}, {
tableName: 'iterations'}
);
iteration.create({ imported: Sequelize.NOW}).success(function(iter) {
console.log(iter);
});
You must call sequelize.close() in order to stop the execution. As long as the connection is open the execution does not stop.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With