Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- There is a list of all the dishes they prepare
- CREATE TABLE dish (
- id serial PRIMARY KEY,
- name text,
- description text
- );
- -- There is a list of all of its costumers
- CREATE TABLE costumer (
- id serial PRIMARY KEY,
- first_name text,
- last_name text
- );
- -- There is a list of the menu of the day
- CREATE TABLE menu (
- id serial PRIMARY KEY,
- published DATE DEFAULT CURRENT_DATE
- );
- -- The list of the dishes of the menu
- CREATE TABLE menu_dish (
- menu_id INTEGER REFERENCES menu(id) ON DELETE CASCADE ON UPDATE CASCADE,
- dish_id INTEGER REFERENCES dish(id) ON DELETE CASCADE ON UPDATE CASCADE,
- PRIMARY KEY (menu_id, dish_id)
- );
- -- The list of the orders
- CREATE TABLE ORDER (
- id serial PRIMARY KEY,
- costumer_id INTEGER REFERENCES costumer(id) ON DELETE CASCADE ON UPDATE CASCADE,
- ordered TIMESTAMP WITH TIME ZONE DEFAULT now()
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement