LinuxCommandLibrary

sequelize

Promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server.

TLDR

Create a model with 3 fields and a migration file

$ sequelize model:generate --name [table_name] --attributes [field1:integer,field2:string,field3:boolean]
copy


Run the migration file
$ sequelize db:migrate
copy


Revert all migrations
$ sequelize db:migrate:undo:all
copy


Create a seed file with the specified name to populate the database
$ sequelize seed:generate --name [seed_filename]
copy


Populate database using all seed files
$ sequelize db:seed:all
copy

Copied to clipboard