-
Notifications
You must be signed in to change notification settings - Fork 0
/
sqlCommands.sql
64 lines (62 loc) · 1.9 KB
/
sqlCommands.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
/*Create main database*/
CREATE DATABASE socialsite;
/*Create Users Table*/
CREATE TABLE users (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(256) NOT NULL ,
email VARCHAR(256) NOT NULL ,
phone BIGINT(20) NOT NULL ,
firstName VARCHAR(256) NOT NULL ,
lastName VARCHAR(256) NOT NULL ,
password VARCHAR(256) NOT NULL
);
/*Connection status for creating friends*/
CREATE TABLE connections (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
userA VARCHAR(256) NOT NULL,
userB VARCHAR(256) NOT NULL,
connectionStatus INT(11) DEFAULT 0
);
/*Posts table for storing Images, profile Pictures, captions*/
CREATE TABLE posts (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(256) NOT NULL,
photo TEXT NOT NULL,
caption LONGTEXT NOT NULL,
type VARCHAR(256) NOT NULL,
dateTimeUploaded datetime NOT NULL
);
/*Table for storing likes*/
CREATE TABLE likes (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
postId INT(11) NOT NULL,
userId INT(11) NOT NULL,
userFullName TEXT NOT NULL /*Just for Reference*/
);
/*Table for storing likes*/
CREATE TABLE comments (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
postId INT(11) NOT NULL,
userId INT(11) NOT NULL,
userFullName TEXT NOT NULL, /*Just for Reference*/
comment LONGTEXT NOT NULL,
commentDateTime datetime NOT NULL
);
/*Table for creating messages*/
CREATE TABLE messages (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
currentUserId INT(11) NOT NULL,
friendUserId INT(11) NOT NULL,
message LONGTEXT NOT NULL,
readStatus INT(11) NOT NULL,
messageDateTime datetime NOT NULL
);
/*Feedback Table*/
CREATE TABLE userFeedback(
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
userId INT(11) NOT NULL,
userFullName TEXT NOT NULL,
userFeedback LONGTEXT NOT NULL
);
/*Privacy in posts table*/
ALTER TABLE posts ADD privacy VARCHAR (256) NOT NULL DEFAULT 'public'