-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtapthat.sql
More file actions
182 lines (159 loc) · 7.32 KB
/
tapthat.sql
File metadata and controls
182 lines (159 loc) · 7.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
-- MySQL dump 10.13 Distrib 8.0.45, for macos15 (arm64)
--
-- Host: 127.0.0.1 Database: tapthat
-- ------------------------------------------------------
-- Server version 8.4.8
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `beers`
--
DROP TABLE IF EXISTS `beers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `beers` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`brewery` varchar(255) DEFAULT NULL,
`type` varchar(100) DEFAULT NULL,
`abv` decimal(3,1) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `beers`
--
LOCK TABLES `beers` WRITE;
/*!40000 ALTER TABLE `beers` DISABLE KEYS */;
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);
/*!40000 ALTER TABLE `beers` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pub_beers`
--
DROP TABLE IF EXISTS `pub_beers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `pub_beers` (
`pub_id` int NOT NULL,
`beer_id` int NOT NULL,
`is_available` tinyint(1) DEFAULT 1,
PRIMARY KEY (`pub_id`,`beer_id`),
KEY `beer_id` (`beer_id`),
CONSTRAINT `pub_beers_ibfk_1` FOREIGN KEY (`pub_id`) REFERENCES `pubs` (`id`) ON DELETE CASCADE,
CONSTRAINT `pub_beers_ibfk_2` FOREIGN KEY (`beer_id`) REFERENCES `beers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pub_beers`
--
LOCK TABLES `pub_beers` WRITE;
/*!40000 ALTER TABLE `pub_beers` DISABLE KEYS */;
INSERT INTO `pub_beers` VALUES (1,1,1),(1,2,1),(1,3,1),(2,3,1),(2,4,1),(2,5,1);
/*!40000 ALTER TABLE `pub_beers` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pubs`
--
DROP TABLE IF EXISTS `pubs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `pubs` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`address` varchar(255) NOT NULL,
`postcode` varchar(20) NOT NULL,
`latitude` decimal(10,8) NOT NULL,
`longitude` decimal(11,8) NOT NULL,
`description` text,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pubs`
--
LOCK TABLES `pubs` WRITE;
/*!40000 ALTER TABLE `pubs` DISABLE KEYS */;
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');
/*!40000 ALTER TABLE `pubs` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `reviews`
--
DROP TABLE IF EXISTS `reviews`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `reviews` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int NOT NULL,
`pub_id` int NOT NULL,
`beer_id` int NOT NULL,
`rating` int NOT NULL,
`ai_pour_score` decimal(3,2) DEFAULT NULL,
`image_url` varchar(255) DEFAULT NULL,
`comment` text,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `pub_id` (`pub_id`),
KEY `idx_beer_rating` (`beer_id`,`rating`),
CONSTRAINT `reviews_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
CONSTRAINT `reviews_ibfk_2` FOREIGN KEY (`pub_id`) REFERENCES `pubs` (`id`) ON DELETE CASCADE,
CONSTRAINT `reviews_ibfk_3` FOREIGN KEY (`beer_id`) REFERENCES `beers` (`id`) ON DELETE CASCADE,
CONSTRAINT `reviews_chk_1` CHECK ((`rating` between 1 and 5))
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `reviews`
--
LOCK TABLES `reviews` WRITE;
/*!40000 ALTER TABLE `reviews` DISABLE KEYS */;
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');
/*!40000 ALTER TABLE `reviews` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `users` (
`id` int NOT NULL AUTO_INCREMENT,
`first_name` varchar(100) NOT NULL,
`last_name` varchar(100) NOT NULL,
`email` varchar(255) NOT NULL,
`password_hash` varchar(255) NOT NULL,
`date_of_birth` date NOT NULL,
`bio` text,
`profile_image` varchar(255) DEFAULT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
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');
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2026-02-25 18:00:29