Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced table names with restaurants and ratings in db_build.sql #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions database/db_build.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ BEGIN;

DROP TABLE IF EXISTS restaurantInfo cascade;

CREATE TABLE restaurant_info (
CREATE TABLE restaurants (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL UNIQUE,
cuisine VARCHAR(100) NOT NULL,
Expand All @@ -11,36 +11,36 @@ CREATE TABLE restaurant_info (
price_range INT NOT NULL
);

INSERT INTO restaurant_info (name, cuisine, address, open_hours, price_range)
INSERT INTO restaurants (name, cuisine, address, open_hours, price_range)
VALUES ('Casa Nova', 'Falafel', 'Al Bishara St 4, Nazareth, 17100', 'Monday-Sunday: 08:00-20:00', 2);

INSERT INTO restaurant_info (name, cuisine, address, open_hours, price_range)
INSERT INTO restaurants (name, cuisine, address, open_hours, price_range)
VALUES ('Tishreen', 'Asian', '24 Marys Road, Nazareth, 14500', 'Monday-Sunday: 13:00-22:00', 5);

INSERT INTO restaurant_info (name, cuisine, address, open_hours, price_range)
INSERT INTO restaurants (name, cuisine, address, open_hours, price_range)
VALUES ('Cheeky Shwarma', 'Fast Food', '6 Shwarma Street', 'Monday-Friday: 16:00-00:00', 5);

COMMIT;

BEGIN;

DROP TABLE IF EXISTS restaurant_ratings cascade;
DROP TABLE IF EXISTS ratings cascade;

CREATE TABLE restaurant_ratings (
CREATE TABLE ratings (
id SERIAL PRIMARY KEY,
restaurant_id INT NOT NULL,
rating INT NOT NULL,
review TEXT,
reviewer_name TEXT
);

INSERT INTO restaurant_ratings (restaurant_id, rating, review, reviewer_name)
INSERT INTO ratings (restaurant_id, rating, review, reviewer_name)
VALUES (1, 4, 'Great falafel, noisy parrot', 'King Edgar');

INSERT INTO restaurant_ratings (restaurant_id, rating, review, reviewer_name)
INSERT INTO ratings (restaurant_id, rating, review, reviewer_name)
VALUES (2, 2, 'Average food. Good service', 'Ravenous Reem');

INSERT INTO restaurant_ratings (restaurant_id, rating, review, reviewer_name)
INSERT INTO ratings (restaurant_id, rating, review, reviewer_name)
VALUES (3, 5, 'The cheekiest shwarma I ever ate, seriously!', 'ShwarMacintosh Helper');

COMMIT;