sequelize-models-generator
v0.0.1
Published
Util for generate sequelize models from pure MySQL tables.
Downloads
26
Maintainers
Readme
sequelize-models-generator
Util for generate sequelize models from pure MySQL tables.
Install
$ npm i sequelize-models-generator
Tests
$ npm test
Usage
const generateModels = require('sequelize-models-generator')
const { Users } = await generateModels({
host: process.env.DB_HOST,
db: process.env.DB_NAME,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD
}, [
{
tableName: 'game_users', // table name in db
newTableName: 'Users' // table name which return
}
])
// call any sequelize methods as usually
// e.g.
await Users.create({})
await Users.findOne({})
await Users.findAll({})