Database Design Document: Zomato-like App
1. Introduction
This document describes the design of the database for the Zomato-like app.
2. Schema
(A schema diagram would be included here, showing the relationships between the tables.)
3. Tables
3.1. Users
| Column |
Data Type |
Constraints |
| id |
SERIAL |
PRIMARY KEY |
| name |
VARCHAR(255) |
NOT NULL |
| email |
VARCHAR(255) |
NOT NULL, UNIQUE |
| password_hash |
VARCHAR(255) |
NOT NULL |
3.2. Restaurants
| Column |
Data Type |
Constraints |
| id |
SERIAL |
PRIMARY KEY |
| name |
VARCHAR(255) |
NOT NULL |
| address |
VARCHAR(255) |
NOT NULL |
| cuisine |
VARCHAR(255) |
NOT NULL |
| Column |
Data Type |
Constraints |
| id |
SERIAL |
PRIMARY KEY |
| restaurant_id |
INTEGER |
FOREIGN KEY (restaurants.id) |
| name |
VARCHAR(255) |
NOT NULL |
| price |
DECIMAL(10, 2) |
NOT NULL |
3.4. Orders
| Column |
Data Type |
Constraints |
| id |
SERIAL |
PRIMARY KEY |
| user_id |
INTEGER |
FOREIGN KEY (users.id) |
| restaurant_id |
INTEGER |
FOREIGN KEY (restaurants.id) |
| status |
VARCHAR(255) |
NOT NULL |
| total_price |
DECIMAL(10, 2) |
NOT NULL |