I need to run third party application in node.js environment but Sequelize throws 'Dialect needs to be explicitly supplied as of v4.0.0' I've found similar topic here Dialect needs to be explicitly supplied as of v4.0.0 but 'export NODE_ENV=development' doesn't work and I can not find Sequelize config file. How can I fix this error?
Here is code:
const Sequelize = require('sequelize');
const scheme = require('./scheme');
const Op = Sequelize.Op;
const sequelize = new Sequelize(null, null, {
dialect: 'sqlite',
storage: 'db.sqlite3',
operatorsAliases: { $and: Op.and },
logging: false
});
scheme(sequelize);
sequelize.sync();
module.exports.sequelize = sequelize;
module.exports.models = sequelize.models;
You simply supply the dialect when you initialize sequelize;
const sequelize = new Sequelize('database', 'username', 'password', {
host: 'localhost',
dialect: // pick one of 'mysql','sqlite','postgres','mssql',
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments