forked from Senama/SwitchIt-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseed.sql
More file actions
73 lines (54 loc) · 2.08 KB
/
Copy pathseed.sql
File metadata and controls
73 lines (54 loc) · 2.08 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
-- DROP DATABASE IF EXISTS switchit;
-- CREATE DATABASE switchit;
-- \c switchit;
DROP TABLE IF EXISTS favorites CASCADE;
DROP TABLE IF EXISTS outfits CASCADE;
DROP TABLE IF EXISTS ootd CASCADE;
DROP TABLE IF EXISTS users CASCADE;
DROP TABLE IF EXISTS clothes CASCADE;
CREATE TABLE users (
id SERIAL PRIMARY KEY,
uid VARCHAR NOT NULL,
firstname VARCHAR NOT NULL,
lastname VARCHAR NOT NULL,
email VARCHAR NOT NULL,
username VARCHAR NOT NULL);
CREATE TABLE clothes (
id SERIAL PRIMARY KEY,
category VARCHAR NOT NULL,
style VARCHAR NOT NULL,
color VARCHAR NOT NULL,
season VARCHAR NOT NULL,
user_id INT REFERENCES users (id) NOT NULL, --unique
img_url VARCHAR NOT NULL
); --delete and add to outfits table
CREATE TABLE favorites (
id SERIAL PRIMARY KEY,
clothes_id INT REFERENCES clothes (id) NOT NULL,
favorited BOOLEAN DEFAULT FALSE
);
CREATE TABLE outfits (
id SERIAL PRIMARY KEY,
top_id INT REFERENCES clothes (id) NOT NULL,
bottom_id INT REFERENCES clothes (id) NOT NULL,
descriptions VARCHAR NOT NULL
);
CREATE TABLE ootd(
id SERIAL PRIMARY KEY,
top_id INT REFERENCES clothes (id) NOT NULL,
bottom_id INT REFERENCES clothes (id) NOT NULL,
nickname VARCHAR NOT NULL,
stamp VARCHAR NOT NULL
);
INSERT INTO users (uid,firstname,lastname,email,username) VALUES
('123abc','Lukas', 'Augustinho','lukas@pursuit.org','singer4Christ'),
('456cdf','Lala', 'Jones','jones@pursuit.org','joneslala');
INSERT INTO clothes(category, style,color,season,user_id,img_url) VALUES
('top','long-sleeve','black', 'fall-winter',1,'https://m.media-amazon.com/images/I/81DyVYd89PL._AC_UL320_.jpg'),
('top', 'long-sleeve','red','summer-spring',1,'https://sep.yimg.com/ay/yhst-54326505879580/sp14rd-men-s-red-long-sleeve-industrial-work-shirt-15.jpg'),
('top', 'short-sleeve','other','summer-spring',1,'https://gloimg.rglcdn.com/rosegal/pdm-product-pic/Clothing/2018/05/16/source-img/20180516180432_11443.jpg');
INSERT INTO outfits (top_id,bottom_id,descriptions) VALUES
(1,8,'cute outfit need to wear this again'),
(11,12,'wearing this for my next outing');
INSERT INTO favorites(clothes_id) VALUES
(8);