sequelize-cli command

Seonmi Choi·2021년 8월 7일
0

Start again!!!

목록 보기
23/40
post-custom-banner

Turorial reference site:
1. https://sequelize.org/v4/manual/tutorial/migrations.html

  1. https://medium.com/prisma-korea/%EB%B2%88%EC%97%AD-%EB%A7%88%EC%9D%B4%EA%B7%B8%EB%A0%88%EC%9D%B4%EC%85%98%EA%B3%BC-sequelize-cli-%ED%8A%9C%ED%86%A0%EB%A6%AC%EC%96%BC-3926c0a9eae6

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]

profile
I am not afraid of learning!
post-custom-banner

0개의 댓글