Egg-Sequelize-Auto
Automatically generate models for egg-sequelize via the command line.
NOTE: Egg-Sequelize-Auto is based on Sequelize-Auto.
Why Egg-Sequelize-Auto
Sequelize-Auto
is a tool used to generate models for Sequelize, which based on old Sequelize
version 3.x.
Now, Sequelize v4
has breaking changes, we need a latest version of Sequelize-Auto
which works in Egg.
So we upgraded Sequelize-Auto
to Sequelize
v4 and adjusted it for egg-sequelize.
Install
npm install -g egg-sequelize-auto
Prerequisites
You will need to install the correct dialect binding globally before using egg-sequelize-auto.
Example for MySQL/MariaDB
npm install -g mysql2
Example for Postgres
npm install -g pg pg-hstore
Example for Sqlite3
npm install -g sqlite3
Example for MSSQL
npm install -g mssql
create model.js
`vi model.js` const SequelizeAuto = const path = const auto = configdatabase configuser configpassword host: confighost dialect: configdialect directory: path camelCase: true {} additional: timestamps: false auto