- clone the project on your local machine
- Execute
npm install
on the same path as of your root directory of the downloaded project - Create a new
.env
file in the root directory and add the following environment variablePORT=3000
- Inside the
src/config
folder create a new fileconfig.json
and add the following piece of json
{
"development": {
"username": <YOUR_DB_NAME>,
"password": <YOUR_DB_PASS>,
"database": "Flights_Search_DB_dev",
"host": "127.0.0.1",
"dialect": "mysql"
}
}
- Once you have addded your db config as listed above , go to the src folder from your terminal
execute
npx sequelize db:create
npx sequelize db:migrate
- The database will have following tables
- Airplane table
- Flight table
- Airport table
- City table
- A flight belongs to an airplane but one airplane can be used in multiple flights
- A city has many airports but one airport belongs to a city
- One airport can have many flights but one flight of particular id can belong to only one airport
-
City Table
- City->id , name , created_at , updated_at
-
Airport Table
-
Airport->id , name , address , city_id , created_at , updated_at Relationship -> City has many airports and Airport belongs to a city (one to many)
-
Create a seed file by using
npx sequelize seed:generate --name add-airports
-
After putting the dummy data do this
npx sequelize db:seed:all
-
-
Airplane Table
- Airplane->id,modelNumber,capacity , created_at, updated_at
- Create a seed file by using
npx sequelize seed:generate --name add-airplanes
- After putting the dummy data do this
npx sequelize db:seed:all