- Sequelize Setup Cheat Sheet
- Sumário
- Guia
$ npm install sequelize
$ npm install --save-dev sequelize-cli
$ npm install mysql2
O comando criará as pastas models, migrations, seeders e config.
$ npx sequelize-cli init
O comando irá gerar o arquivo model e o arquivo migration correspondente.
$ npx sequelize model:generate --name NomeDoModel --attributes nomeDoAtributo:string
$ npx sequelize migration:generate --name migrationName
$ npx sequelize db:migrate
$ npx sequelize db:migrate:undo
$ npx sequelize-cli db:migrate:undo:all --to XXXXXXXXXXXXXX-create-posts.js
$ npx sequelize seed:generate --name seedName
O comando executa todos os arquivos seeds
$ npx sequelize db:seed:all
$ npx sequelize db:seed:undo:all
$ npx sequelize-cli db:seed:undo
$ npx sequelize-cli db:seed:undo --seed name-of-seed-as-in-data