forked from HRNYC12-Socrates/OkCoupon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.sql
47 lines (41 loc) · 1.15 KB
/
schema.sql
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
DROP DATABASE IF EXISTS okc;
CREATE DATABASE okc;
USE okc;
CREATE TABLE users (
id int NOT NULL AUTO_INCREMENT,
user_name varchar(50) NOT NULL,
password varchar(50) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE coupons (
id int NOT NULL AUTO_INCREMENT,
coupon_id int NOT NULL,
user_id int NOT NULL,
latitude varchar(50) NOT NULL,
longitude varchar(50) NOT NULL,
imgUrl varchar(255) NOT NULL,
title varchar(255) NOT NULL,
price varchar(50) NOT NULL,
discount varchar(50) NOT NULL,
merchant varchar(255) NOT NULL,
-- finePrint varchar(50) NOT NULL,
-- description varchar(50) NOT NULL,
url varchar(255) NOT NULL,
-- saved varchar(50) DEFAULT "null",
pureUrl varchar(50) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (user_id)
REFERENCES users(id)
-- UNIQUE KEY `imgUrl_UNIQUE` (`imgUrl`)
);
CREATE TABLE reviews (
id int NOT NULL AUTO_INCREMENT,
user_id int NOT NULL,
-- coupon_id int NOT NULL,
coupon_URL varchar(255) NOT NULL,
description varchar(255) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (user_id)
REFERENCES users(id)
);
-- If first time loading database remember to comment out the drop database the first time.