Skip to content

Commit 8ba7f82

Browse files
authored
TapThat Database
TapThat mysql database
1 parent bcfd33b commit 8ba7f82

1 file changed

Lines changed: 182 additions & 0 deletions

File tree

tapthat.sql

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
-- MySQL dump 10.13 Distrib 8.0.45, for macos15 (arm64)
2+
--
3+
-- Host: 127.0.0.1 Database: tapthat
4+
-- ------------------------------------------------------
5+
-- Server version 8.4.8
6+
7+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10+
/*!50503 SET NAMES utf8 */;
11+
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12+
/*!40103 SET TIME_ZONE='+00:00' */;
13+
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14+
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15+
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16+
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17+
18+
--
19+
-- Table structure for table `beers`
20+
--
21+
22+
DROP TABLE IF EXISTS `beers`;
23+
/*!40101 SET @saved_cs_client = @@character_set_client */;
24+
/*!50503 SET character_set_client = utf8mb4 */;
25+
CREATE TABLE `beers` (
26+
`id` int NOT NULL AUTO_INCREMENT,
27+
`name` varchar(255) NOT NULL,
28+
`brewery` varchar(255) DEFAULT NULL,
29+
`type` varchar(100) DEFAULT NULL,
30+
`abv` decimal(3,1) DEFAULT NULL,
31+
PRIMARY KEY (`id`)
32+
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
33+
/*!40101 SET character_set_client = @saved_cs_client */;
34+
35+
--
36+
-- Dumping data for table `beers`
37+
--
38+
39+
LOCK TABLES `beers` WRITE;
40+
/*!40000 ALTER TABLE `beers` DISABLE KEYS */;
41+
INSERT INTO `beers` VALUES (1,'Doom Bar','Sharp\'s Brewery','Amber Ale',4.0),(2,'Peroni Nastro Azzurro','Peroni Brewery','Lager',5.1),(3,'BrewDog Punk IPA','BrewDog','IPA',5.4),(4,'Birra Moretti','Heineken','Lager',4.6),(5,'Old Speckled Hen','Greene King','Ale',4.8);
42+
/*!40000 ALTER TABLE `beers` ENABLE KEYS */;
43+
UNLOCK TABLES;
44+
45+
--
46+
-- Table structure for table `pub_beers`
47+
--
48+
49+
DROP TABLE IF EXISTS `pub_beers`;
50+
/*!40101 SET @saved_cs_client = @@character_set_client */;
51+
/*!50503 SET character_set_client = utf8mb4 */;
52+
CREATE TABLE `pub_beers` (
53+
`pub_id` int NOT NULL,
54+
`beer_id` int NOT NULL,
55+
`is_available` tinyint(1) DEFAULT '1',
56+
PRIMARY KEY (`pub_id`,`beer_id`),
57+
KEY `beer_id` (`beer_id`),
58+
CONSTRAINT `pub_beers_ibfk_1` FOREIGN KEY (`pub_id`) REFERENCES `pubs` (`id`) ON DELETE CASCADE,
59+
CONSTRAINT `pub_beers_ibfk_2` FOREIGN KEY (`beer_id`) REFERENCES `beers` (`id`) ON DELETE CASCADE
60+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
61+
/*!40101 SET character_set_client = @saved_cs_client */;
62+
63+
--
64+
-- Dumping data for table `pub_beers`
65+
--
66+
67+
LOCK TABLES `pub_beers` WRITE;
68+
/*!40000 ALTER TABLE `pub_beers` DISABLE KEYS */;
69+
INSERT INTO `pub_beers` VALUES (1,1,1),(1,2,1),(1,3,1),(2,3,1),(2,4,1),(2,5,1);
70+
/*!40000 ALTER TABLE `pub_beers` ENABLE KEYS */;
71+
UNLOCK TABLES;
72+
73+
--
74+
-- Table structure for table `pubs`
75+
--
76+
77+
DROP TABLE IF EXISTS `pubs`;
78+
/*!40101 SET @saved_cs_client = @@character_set_client */;
79+
/*!50503 SET character_set_client = utf8mb4 */;
80+
CREATE TABLE `pubs` (
81+
`id` int NOT NULL AUTO_INCREMENT,
82+
`name` varchar(255) NOT NULL,
83+
`address` varchar(255) NOT NULL,
84+
`postcode` varchar(20) NOT NULL,
85+
`latitude` decimal(10,8) NOT NULL,
86+
`longitude` decimal(11,8) NOT NULL,
87+
`description` text,
88+
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
89+
PRIMARY KEY (`id`)
90+
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
91+
/*!40101 SET character_set_client = @saved_cs_client */;
92+
93+
--
94+
-- Dumping data for table `pubs`
95+
--
96+
97+
LOCK TABLES `pubs` WRITE;
98+
/*!40000 ALTER TABLE `pubs` DISABLE KEYS */;
99+
INSERT INTO `pubs` VALUES (1,'The Red Lion','123 Putney High Street','SW15 1AA',51.46130000,-0.21670000,NULL,'2026-02-25 17:51:21'),(2,'The King\'s Arms','45 Roehampton Lane','SW15 5PJ',51.45000000,-0.24200000,NULL,'2026-02-25 17:51:21');
100+
/*!40000 ALTER TABLE `pubs` ENABLE KEYS */;
101+
UNLOCK TABLES;
102+
103+
--
104+
-- Table structure for table `reviews`
105+
--
106+
107+
DROP TABLE IF EXISTS `reviews`;
108+
/*!40101 SET @saved_cs_client = @@character_set_client */;
109+
/*!50503 SET character_set_client = utf8mb4 */;
110+
CREATE TABLE `reviews` (
111+
`id` int NOT NULL AUTO_INCREMENT,
112+
`user_id` int NOT NULL,
113+
`pub_id` int NOT NULL,
114+
`beer_id` int NOT NULL,
115+
`rating` int NOT NULL,
116+
`ai_pour_score` decimal(3,2) DEFAULT NULL,
117+
`image_url` varchar(255) DEFAULT NULL,
118+
`comment` text,
119+
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
120+
PRIMARY KEY (`id`),
121+
KEY `user_id` (`user_id`),
122+
KEY `pub_id` (`pub_id`),
123+
KEY `idx_beer_rating` (`beer_id`,`rating`),
124+
CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
125+
CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`pub_id`) REFERENCES `pubs` (`id`) ON DELETE CASCADE,
126+
CONSTRAINT `reviews_ibfk_3` FOREIGN KEY (`beer_id`) REFERENCES `beers` (`id`) ON DELETE CASCADE,
127+
CONSTRAINT `reviews_chk_1` CHECK ((`rating` between 1 and 5))
128+
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
129+
/*!40101 SET character_set_client = @saved_cs_client */;
130+
131+
--
132+
-- Dumping data for table `reviews`
133+
--
134+
135+
LOCK TABLES `reviews` WRITE;
136+
/*!40000 ALTER TABLE `reviews` DISABLE KEYS */;
137+
INSERT INTO `reviews` VALUES (1,1,1,1,5,4.80,NULL,'Excellent Doom Bar, perfectly poured','2026-02-25 17:55:00'),(2,2,1,1,4,4.50,NULL,'Good pint of Doom Bar','2026-02-25 17:55:00'),(3,3,2,2,5,4.90,NULL,'Peroni was crisp and refreshing','2026-02-25 17:55:00'),(4,2,2,3,3,3.50,NULL,'Punk IPA was decent but slightly flat','2026-02-25 17:55:00'),(5,1,1,2,4,4.20,NULL,'Nice Peroni, smooth finish','2026-02-25 17:55:00');
138+
/*!40000 ALTER TABLE `reviews` ENABLE KEYS */;
139+
UNLOCK TABLES;
140+
141+
--
142+
-- Table structure for table `users`
143+
--
144+
145+
DROP TABLE IF EXISTS `users`;
146+
/*!40101 SET @saved_cs_client = @@character_set_client */;
147+
/*!50503 SET character_set_client = utf8mb4 */;
148+
CREATE TABLE `users` (
149+
`id` int NOT NULL AUTO_INCREMENT,
150+
`first_name` varchar(100) NOT NULL,
151+
`last_name` varchar(100) NOT NULL,
152+
`email` varchar(255) NOT NULL,
153+
`password_hash` varchar(255) NOT NULL,
154+
`date_of_birth` date NOT NULL,
155+
`bio` text,
156+
`profile_image` varchar(255) DEFAULT NULL,
157+
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
158+
PRIMARY KEY (`id`),
159+
UNIQUE KEY `email` (`email`)
160+
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
161+
/*!40101 SET character_set_client = @saved_cs_client */;
162+
163+
--
164+
-- Dumping data for table `users`
165+
--
166+
167+
LOCK TABLES `users` WRITE;
168+
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
169+
INSERT INTO `users` VALUES (1,'Sujal','Shah','sujal@example.com','hashedpassword1','2005-04-12',NULL,NULL,'2026-02-25 17:48:29'),(2,'Luke','Pring','luke@example.com','hashedpassword2','2003-09-21',NULL,NULL,'2026-02-25 17:48:29'),(3,'Jack','Turner','jack@example.com','hashedpassword3','2001-06-10',NULL,NULL,'2026-02-25 17:48:29'),(4,'Victor','Tepeniuc','victor@example.com','hashedpassword4','1999-06-11',NULL,NULL,'2026-02-25 17:48:29'),(5,'Alec','Thompson','alec@example.com','hashedpassword5','2002-07-01',NULL,NULL,'2026-02-25 17:48:29');
170+
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
171+
UNLOCK TABLES;
172+
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
173+
174+
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
175+
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
176+
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
177+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
178+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
179+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
180+
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
181+
182+
-- Dump completed on 2026-02-25 18:00:29

0 commit comments

Comments
 (0)