eggjs 实现后台管理接口
npm run dev
npm start
npm stop
node v14.16.0
npm 6.14.11
npm init egg --type=simple
npm install
npm install --save egg-sequelize mysql2
npm install --save-dev sequelize-cli
egg-sequelize文档: https://github.com/eggjs/egg-sequelize
sequelize中文文档: https://www.sequelize.com.cn/
数据库操作文档: https://sequelize.org/master/class/lib/dialects/mssql/query-interface.js~MSSqlQueryInterface.html
npx sequelize init:config
npx sequelize init:migrations
创建 migration 文件:npx sequelize migration:generate --name=sys_user
执行 migration 文件:npx sequelize db:migrate
撤销:
npx sequelize db:migrate:undo
npx sequelize db:migrate:undo:all
创建演示数据:npx sequelize-cli seed:generate --name demo-user
执行:npx sequelize-cli db:seed:all
撤销:
npx sequelize-cli db:seed:undo
npx sequelize-cli db:seed:undo:all