Sequelize Cheatsheet
Command Line
Init Project
$ npx sequelize-cli initCreate Database
$ npx sequelize-cli db:createGenerate a model and its migration
$ npx sequelize-cli model:generate --name <ModelName> --attributes <column1>:<type>,<column2>:<type>,...Run pending migrations
$ npx sequelize-cli db:migrateRollback one migration
$ npx sequelize-cli db:migrate:undoRollback all migrations
Generate a new seed file
Run all pending seeds
Rollback one seed
Rollback all seeds
Migrations
Column Attribute Keywords
Model Associations
One to One between Student and Scholarship
One to Many between Student and Class
Many to Many between Student and Lesson through StudentLessons table
Query Format
findOne
findAll
findByPk
Common Where Operators
Last updated