All sequelize-auto generated model defines sequelize

sequelize node is the most popular orm library, the widespread use of Promise. Asynchronous means that all calls can be used ES2017 async / await syntax.

Quick Start Address: https://github.com/demopark/sequelize-docs-Zh-CN/blob/master/getting-started.md

sequelize-auto tool can generate a model sequelize: https://github.com/sequelize/sequelize-auto

Here's how to generate all models with sequelize-auto

1. Install and sequelize-auto mysql

npm install -g sequelize-auto mysql

2. Description Use

Common parameters:

-h 数据库的IP地址 
-d 数据库名 
-u 用户名 
-x 密码 
-p 端口 
-t 表名
-e 数据库类型
-a  json定义文件路径,可以追加一些自定义配置,如{"timestamps": false}

I use the following shell script

#!/bin/bash
HOST="地址"
DB="数据库名"
USER="用户名"
PASS="密码"
PORT="端口号"
DIR="生成路径"
JSON_DEFINED="json文件路径"
EXEC="sequelize-auto -o ${DIR} -d ${DB} -h ${HOST} -u ${USER} -p ${PORT} -x ${PASS} -e mysql -a ${JSON_DEFINED}"

#执行
$EXEC

Guess you like

Origin www.cnblogs.com/chenqionghe/p/11351710.html