-
Notifications
You must be signed in to change notification settings - Fork 3
/
Database.sql
225 lines (118 loc) · 4.11 KB
/
Database.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
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
CREATE DATABASE EventsWave;
USE EventsWave;
CREATE TABLE Users(
User_ID int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
FULL_NAME VARCHAR(100) NOT NULL,
USER_NAME varchar(50) NOT NULL,
USER_TYPE varchar(2) NOT NULL,
PASSWORD_S varchar(50) NOT NULL,
EMAIL varchar(60) NOT NULL,
IMAGE varchar(200) DEFAULT "assets/images/profile_pics/default.png",
FACEBOOK varchar(200) DEFAULT "www.facebook.com",
WHATSAPP varchar(200) DEFAULT "www.webwhatsapp.com",
BIO varchar(500) DEFAULT "bio here",
FALLOWERS int(11) DEFAULT 0,
FALLOWING int(11) DEFAULT 0,
POSTS int(11) DEFAULT 0
);
CREATE TABLE Posts(
Post_ID int(11) PRIMARY KEY AUTO_INCREMENT,
User_ID int(11) NOT NULL,
Likes int(11) NOT NULL,
Img_Path text NOT NULL,
Caption varchar(700) NOT NULL,
HashTags varchar(250) NOT NULL,
Date_Upload DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (User_ID) REFERENCES Users(User_ID)
);
CREATE TABLE Videos(
Video_ID int(11) PRIMARY KEY AUTO_INCREMENT,
User_ID int(11) NOT NULL,
Likes int(11) NOT NULL,
Video_Path text NOT NULL,
Caption varchar(250) NOT NULL,
HashTags varchar(250) NOT NULL,
Date_Upload DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (User_ID) REFERENCES Users(User_ID)
);
ALTER TABLE Videos ADD Thumbnail_Path varchar(255);
CREATE TABLE Fallowing(
ID int(11) PRIMARY KEY AUTO_INCREMENT,
User_Id int(11) NOT NULL,
Other_user_id int(11) NOT NULL
);
CREATE TABLE Comments(
COMMENT_ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
POST_ID INT(11) NOT NULL,
USER_ID INT(11) NOT NULL,
COMMENT text NOT NULL,
DATE DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (POST_ID) REFERENCES Posts(Post_ID),
FOREIGN KEY (USER_ID) REFERENCES Users(User_ID)
);
CREATE TABLE Likes(
Like_ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
Post_ID INT(11) NOT NULL,
User_ID INT(11) NOT NULL,
FOREIGN KEY (POST_ID) REFERENCES Posts(Post_ID),
FOREIGN KEY (USER_ID) REFERENCES Users(User_ID)
);
CREATE TABLE Comments_Vid(
COMMENT_ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
VIDEO_ID INT(11) NOT NULL,
USER_ID INT(11) NOT NULL,
COMMENT text NOT NULL,
DATE DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (VIDEO_ID) REFERENCES Videos(Video_ID),
FOREIGN KEY (USER_ID) REFERENCES Users(User_ID)
);
CREATE TABLE Likes_Vid(
Like_ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
Video_ID INT(11) NOT NULL,
User_ID INT(11) NOT NULL,
FOREIGN KEY (Video_ID) REFERENCES Videos(Video_ID),
FOREIGN KEY (USER_ID) REFERENCES Users(User_ID)
);
CREATE TABLE Events(
Event_ID int(11) PRIMARY KEY AUTO_INCREMENT,
User_ID int(11) NOT NULL,
Likes int(11) NOT NULL,
Event_Poster text NOT NULL,
Caption varchar(250) NOT NULL,
Event_Time time NOT NULL,
Event_Date DATETIME NOT NULL ,
Invite_Link text NOT NULL,
HashTags varchar(250) NOT NULL,
Date_Upload DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (User_ID) REFERENCES Users(User_ID)
);
CREATE TABLE Likes_Events(
Like_ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
Event_ID INT(11) NOT NULL,
User_ID INT(11) NOT NULL,
FOREIGN KEY (Event_ID) REFERENCES Events(Event_ID),
FOREIGN KEY (USER_ID) REFERENCES Users(User_ID)
);
CREATE TABLE Comments_Events(
COMMENT_ID INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
Event_ID INT(11) NOT NULL,
USER_ID INT(11) NOT NULL,
COMMENT text NOT NULL,
DATE DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (Event_ID) REFERENCES Events(Event_ID),
FOREIGN KEY (USER_ID) REFERENCES Users(User_ID)
);
CREATE TABLE Admin
(
Admin_ID INT(11) AUTO_INCREMENT PRIMARY KEY,
User_Name varchar(100) NOT NULL,
Password varchar(100) NOT NULL
);
CREATE TABLE Special_Events(
Event_ID int(11) PRIMARY KEY AUTO_INCREMENT,
Caption varchar(250) NOT NULL,
Event_Time time NOT NULL,
Event_Date DATETIME NOT NULL ,
Invite_Link text NOT NULL,
Date_Upload DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);