JSD-0723 / backend-final-3

0 stars 0 forks source link

Database Schema #7

Open Alaalser opened 1 year ago

Alaalser commented 1 year ago

Database Schema

Create the schema of the database, and think about the advantages and disadvantages of everything you do. Think also about the future changes or features that could be required.

Draw the database schema with relations between tables using a drawing tool (draw.io). Share it with the team and take their opinion about it.

ammarhararah commented 1 year ago

Suggested Schema:

https://drive.google.com/file/d/1rxTGoM5Auktv2UGCVkIgB0yLPNldSVHA/view?usp=drive_link

Categories +-------------+--------------+ | category_id | name | +-------------+--------------+ | PK | | +-------------+--------------+

Brands +----------+-------+ | brand_id | name | +----------+-------+ | PK | | +----------+-------+

Products +-------------+---------+--------------+-----------+------------------+-----------------+ | product_id | name | description | price | stock_quantity | discount_percentage | rating_average | brand_id (FK) | category_id (FK) | +-------------+---------+--------------+-----------+------------------+-----------------+ | PK | | | | | | | | | +-------------+---------+--------------+-----------+------------------+-----------------+

Ratings +-------------+--------------+---------+----------------+ | rating_id | product_id | user_id | rating_value | +-------------+--------------+---------+----------------+ | PK | FK | | | +-------------+--------------+---------+----------------+

Reviews +-------------+--------------+---------+--------------+---------------------+ | review_id | product_id | user_id | review_text | timestamp | +-------------+--------------+---------+--------------+---------------------+ | PK | FK | | | | +-------------+--------------+---------+--------------+---------------------+

Cart +----------+---------+-------------+---------+ | cart_id | user_id | product_id | quantity| +----------+---------+-------------+---------+ | PK | | FK | | +----------+---------+-------------+---------+

Wishlist +--------------+---------+-------------+ | wishlist_id | user_id | product_id | +--------------+---------+-------------+ | PK | | FK | +--------------+---------+-------------+

PaymentGateways +---------------+---------+--------------+ | gateway_id | name | description | +---------------+---------+--------------+ | PK | | | +---------------+---------+--------------+

Filters +------------+---------+--------------+ | filter_id | name | description | +------------+---------+--------------+ | PK | | | +------------+---------+--------------+

ammarhararah commented 1 year ago

Table: Category

Table: Brand

Table: Product

Table: Rating

Table: Reviews

Table: Cart

Table: Wishlist

Table: PaymentGateways

Table: Filters