To create an empty project you will need to execute `init` command
```bash
$ npx sequelize init
$ npx sequelize-cli init
```
This will create following folders
...
...
@@ -75,7 +75,7 @@ We will use `model:generate` command. This command requires two options
Let's create a model named `User`.
```bash
$ npx sequelize model:generate --name User --attributes firstName:string,lastName:string,email:string
$ npx sequelize-cli model:generate --name User --attributes firstName:string,lastName:string,email:string
```
This will do following
...
...
@@ -90,7 +90,7 @@ This will do following
Until this step, we haven't inserted anything into the database. We have just created required model and migration files for our first model `User`. Now to actually create that table in database you need to run `db:migrate` command.
```bash
$ npx sequelize db:migrate
$ npx sequelize-cli db:migrate
```
This command will execute these steps:
...
...
@@ -106,13 +106,13 @@ Now our table has been created and saved in database. With migration you can rev
You can use `db:migrate:undo`, this command will revert most recent migration.
```bash
$ npx sequelize db:migrate:undo
$ npx sequelize-cli db:migrate:undo
```
You can revert back to initial state by undoing all migrations with `db:migrate:undo:all` command. You can also revert back to a specific migration by passing its name in `--to` option.
This command will create a seed file in `seeders` folder. File name will look something like `XXXXXXXXXXXXXX-demo-user.js`. It follows the same `up / down` semantics as the migration files.
...
...
@@ -155,7 +155,7 @@ module.exports = {
In last step you have create a seed file. It's still not committed to database. To do that we need to run a simple command.
```bash
$ npx sequelize db:seed:all
$ npx sequelize-cli db:seed:all
```
This will execute that seed file and you will have a demo user inserted into `User` table.
...
...
@@ -169,19 +169,19 @@ Seeders can be undone if they are using any storage. There are two commands avai