1. npx sequelize init:config
  2. # created database/config.json
  3. npx sequelize init:migrations
  4. # created migrations folder at "database/migrations"
  5. npx sequelize migration:generate --name=init-users
  6. # 数据备份
  7. npx sequelize db:migration
  8. # 环境变量,切换数据库配置,env环境下,使用 test表
  9. npx sequelize db:migrate --env=test

dabase数据库配置

config

config.default.js

初始化数据库

  1. npx sequelize seed:create --name init-users
  2. # 插入数据
  3. npx sequelize db:seed all