34968-vm/migrations/20251012_create_restaurants_and_menu_items_tables.sql
Flatlogic Bot adf8c9c972 V14
2025-10-16 06:28:46 +00:00

36 lines
1.7 KiB
SQL

DROP TABLE IF EXISTS menu_items CASCADE;
DROP TABLE IF EXISTS restaurants CASCADE;
CREATE TABLE restaurants (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT,
image_url VARCHAR(255)
);
CREATE TABLE menu_items (
id SERIAL PRIMARY KEY,
restaurant_id INT NOT NULL,
name VARCHAR(255) NOT NULL,
description TEXT,
price DECIMAL(10, 2) NOT NULL,
image_url VARCHAR(255),
FOREIGN KEY (restaurant_id) REFERENCES restaurants(id) ON DELETE CASCADE
);
-- Insert some sample data for demonstration purposes
INSERT INTO restaurants (name, description, image_url) VALUES
('The Gourmet Kitchen', 'A fine dining experience with a modern twist.', 'assets/images/hero.jpg'),
('Pizza Palace', 'The best pizza in town, made with fresh ingredients.', 'assets/pasted-20251014-230507-170c4564.jpg'),
('Taco Town', 'Authentic Mexican street tacos and burritos.', 'assets/pasted-20251014-230144-ecd85886.webp');
INSERT INTO menu_items (restaurant_id, name, description, price) VALUES
(1, 'Steak Frites', 'Juicy steak with a side of crispy french fries.', 25.50),
(1, 'Salmon en Papillote', 'Salmon baked with herbs and lemon.', 22.00),
(1, 'Chocolate Lava Cake', 'Warm chocolate cake with a gooey center.', 8.00),
(2, 'Margherita Pizza', 'Classic pizza with tomato, mozzarella, and basil.', 12.00),
(2, 'Pepperoni Pizza', 'A crowd-pleaser with spicy pepperoni.', 14.50),
(2, 'Garlic Bread', 'Toasted bread with garlic butter and herbs.', 5.00),
(3, 'Carne Asada Tacos', 'Grilled steak tacos with onion and cilantro.', 3.50),
(3, 'Al Pastor Tacos', 'Marinated pork tacos with pineapple.', 3.50),
(3, 'Chicken Burrito', 'A large burrito filled with chicken, rice, and beans.', 10.00);