-
Initilize sequelize
- run
yarn sequelize init
- run
-
Creates 4 files, in config.json put database name and password
-
Create database
- run
yarn sequelize db:create
- run
-
Create booking table
- run
yarn sequelize model:generate --name Booking --attributes flightId:integer,userId:integer,status:enum
- run
-
Migrate DB
- run
yarn sequelize db:migrate
- run
-
Update booking table
- run
yarn sequelize migration:create --name modify_booking
- add column in the table using
model name
andnew column name
- This is how the two columns(noOfSeats & totalCost) are added in Bookings table:
await queryInterface.addColumn('Bookings', 'noOfSeats', { type: Sequelize.INTEGER, allowNull: false, defaultValue: 1 }); await queryInterface.addColumn('Bookings', 'totalCost', { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 });
- Migrate db again by running
yarn sequelize db:migrate
and the columns will be added in Bookings table
- run
-
Update booking table
- Add columns(noOfSeats & totalCost) fields in the
Booking
model - Sync DB and the columns will be added in Bookings table
const db = require('./models/index'); if(process.env.DB_SYNC) { db.sequelize.sync({alter: true}); }
- Add columns(noOfSeats & totalCost) fields in the
-
Notifications
You must be signed in to change notification settings - Fork 0
debjyoti-m28/AirlineTicketBookingService
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
This is a Microservice for Airline management backend system which handles flight ticket booking related functionalities.
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published