seq-model-gen
v1.0.2
Published
CLI generator for generating sequelize model from database table schema
Maintainers
Readme
seq-model-gen
CLI for generating Sequelize model files from an existing database table schema.
Installation
npm install -g seq-model-genConfiguration
Create a .env file in the project root:
DB_HOST=<host database>
DB_PORT=<port database>
DB_USER=<user database>
DB_PASS=<password database>
DB_NAME=<nama database>
DB_DIALECT=mysqlThe current initial version only supports mysql.
Usage
npx seq-model-gen table:table_user bean:userBean path:./src/dbExample output: ./src/db/table-user.js
If a model file for the same table already exists, the generator will only update the model column definition and model.attributes. Other custom sections such as model.associate will be preserved.
Model property names will follow the original table field names exactly. For example, first_name will remain first_name, not firstName.
