-
Notifications
You must be signed in to change notification settings - Fork 0
/
SMP.sql
53 lines (53 loc) · 1.89 KB
/
SMP.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
-- Hayden Free
-- Cole Terrell
USE mysql;
DROP DATABASE SMPDB_test;
CREATE DATABASE SMPDB_test;
USE SMPDB_test;
CREATE TABLE Identity
(idnum BIGINT AUTO_INCREMENT PRIMARY KEY,
handle VARCHAR(100) UNIQUE,
pass VARCHAR(100) NOT NULL,
fullname VARCHAR(100) NOT NULL,
location VARCHAR(100),
email VARCHAR(100) NOT NULL,
bdate DATE NOT NULL,
joined TIMESTAMP
) COMMENT="The Identity Table";
CREATE TABLE Story
(sidnum BIGINT AUTO_INCREMENT PRIMARY KEY,
idnum BIGINT,
chapter VARCHAR(100) NOT NULL,
url VARCHAR(100),
expires DATETIME,
tstamp TIMESTAMP,
FOREIGN KEY(idnum) REFERENCES Identity(idnum)
) COMMENT="The Story Table";
CREATE TABLE Follows
(follower BIGINT,
followed BIGINT,
tstamp TIMESTAMP,
FOREIGN KEY(follower) REFERENCES Identity(idnum),
FOREIGN KEY(followed) REFERENCES Identity(idnum)
) COMMENT="The Follows Table";
CREATE TABLE Reprint
(rpnum BIGINT AUTO_INCREMENT PRIMARY KEY,
idnum BIGINT,
sidnum BIGINT,
likeit BOOLEAN,
tstamp TIMESTAMP,
FOREIGN KEY(idnum) REFERENCES Identity(idnum),
FOREIGN KEY(sidnum) REFERENCES Story(sidnum)
) COMMENT="The Reprint Table";
CREATE TABLE Block
(blknum BIGINT AUTO_INCREMENT PRIMARY KEY,
idnum BIGINT,
blocked BIGINT,
tstamp TIMESTAMP,
FOREIGN KEY(idnum) REFERENCES Identity(idnum),
FOREIGN KEY(blocked) REFERENCES Identity(idnum)
) COMMENT="The Block Table";
GRANT ALL ON SMPDB_test.* TO 'ccte222'@localhost IDENTIFIED BY 'mysqlpass';
GRANT ALL on SMPDB_test.* TO 'paul'@'belgarath.cs.uky.edu' IDENTIFIED BY 'jellydonuts!';
GRANT ALL on SMPDB_test.* TO 'paul'@'paul.cs.uky.edu' IDENTIFIED BY 'jellydonuts!';
FLUSH privileges;