# PostgreSQL Database Setup

Before start, make sure to read [Migrations](https://sequelize.org/docs/v6/other-topics/migrations/).

You will use "__sequelize-cli__" to create a database, create the "__students__" table and then seed it.

There are already NPM scripts you can use.

```sh
npm run db:create
npm run db:migrate
npm run db:seed
```

Connect to the database using pgAdmin4 and then perform the following SQL.

```sql
select * from students;
```

## Create a migration

The following command was use to create a 'student' table migration as well as a student model file.

```sh
npx sequelize-cli model:generate --name students --attributes name:string,surname:string,email:string
```

Look in the following folders:

1. migrations/
1. models/

## Seeding the database

To generate a seed file, run the command:

```sh
npx sequelize-cli seed:generate --name students
```

This will create a file under the "seeders/" folder.
