Turorial reference site:
1. https://sequelize.org/v4/manual/tutorial/migrations.html
3.https://sequelize.org/master/manual/model-querying-basics.html
To create an empty project you will need to execute init command
node_modules/.bin/sequelize init
create a model named User
node_modules/.bin/sequelize model:generate --name User --attributes firstName:string,lastName:string,email:string
actually create that table in database
node_modules/.bin/sequelize db:migrate
this command will revert most recent migration.
node_modules/.bin/sequelize db:migrate:undo
Sequelize CLI [Node: 14.17.3, CLI: 6.2.0, ORM: 6.6.5]
sequelize-cli
Commands:
sequelize-cli db:migrate Run pending migrations
sequelize-cli db:migrate:schema:timestamps:add Update migration table to have timestamps
sequelize-cli db:migrate:status List the status of all migrations
sequelize-cli db:migrate:undo Reverts a migration
sequelize-cli db:migrate:undo:all Revert all migrations ran
sequelize-cli db:seed Run specified seeder
sequelize-cli db:seed:undo Deletes data from the database
sequelize-cli db:seed:all Run every seeder
sequelize-cli db:seed:undo:all Deletes data from the database
sequelize-cli db:create Create database specified by configuration
sequelize-cli db:drop Drop database specified by configuration
sequelize-cli init Initializes project
sequelize-cli init:config Initializes configuration
sequelize-cli init:migrations Initializes migrations
sequelize-cli init:models Initializes models
sequelize-cli init:seeders Initializes seeders
sequelize-cli migration:generate Generates a new migration file [aliases: migration:create]
sequelize-cli model:generate Generates a model and its migration [aliases: model:create]
sequelize-cli seed:generate Generates a new seed file [aliases: seed:create]