-
Notifications
You must be signed in to change notification settings - Fork 0
/
planit.sql.orig
73 lines (63 loc) · 2.04 KB
/
planit.sql.orig
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 is a dangerous command
DROP DATABASE IF EXISTS planit;
CREATE DATABASE planit;
USE planit;
CREATE TABLE Users(
userID INT(11) PRIMARY KEY AUTO_INCREMENT,
username VARCHAR(20) NOT NULL,
email VARCHAR(50) NOT NULL,
password VARCHAR(20) NOT NULL
);
CREATE TABLE Events(
eventID INT(11) PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
creator VARCHAR(50) NOT NULL,
userID INT(11) NOT NULL,
url VARCHAR(50) NOT NULL,
-- --REMOVE THESE
-- joinedEventID INT(11) NOT NULL,
-- invitedEmailID INT(11) NOT NULL,
duration INT(10) NOT NULL,
isRecurring VARCHAR (20) NOT NULL,
isPublic VARCHAR(20) NOT NULL,
FOREIGN KEY fk1(userID) REFERENCES Users(userID)
-- FOREIGN KEY fk4(joinedEventID) REFERENCES joinedEvent(joinedEventID)
-- FOREIGN KEY fk5(invitedEmailID) REFERENCES invitedEmails(invitedEmailID)
);
CREATE TABLE joinedEvent(
joinedEventID INT(11) PRIMARY KEY AUTO_INCREMENT,
userID INT(11) NOT NULL,
eventID INT(11) NOT NULL,
FOREIGN KEY fk2(eventID) REFERENCES Events(eventID),
FOREIGN KEY fk3(userID) REFERENCES Users(userID)
);
CREATE TABLE invitedEmails(
invitedEmailID INT(11) PRIMARY KEY AUTO_INCREMENT,
emails VARCHAR(50) NOT NULL,
eventID INT(11) NOT NULL,
FOREIGN KEY fk4(eventID) REFERENCES Events(eventID)
);
CREATE TABLE availabilityIntervals(
availabilityIntervalID INT(11) PRIMARY KEY AUTO_INCREMENT,
start VARCHAR(50) NOT NULL,
end VARCHAR(50) NOT NULL,
eventID INT(11) NOT NULL,
FOREIGN KEY fk5(eventID) REFERENCES Events(eventID)
<<<<<<< HEAD
=======
>>>>>>> c14d633eacc157c966dd24d38f9349e42a031e39
);
CREATE TABLE availabilities(
availabilityID INT(11) PRIMARY KEY AUTO_INCREMENT,
userID INT(11) NOT NULL,
start VARCHAR(50) NOT NULL,
end VARCHAR(50) NOT NULL,
<<<<<<< HEAD
eventID INT(11) NOT NULL,
FOREIGN KEY fk6(userID) REFERENCES Users(userID),
FOREIGN KEY fk7(eventID) REFERENCES Events(eventID)
);
=======
FOREIGN KEY fk6(userID) REFERENCES Users(userID)
);
>>>>>>> c14d633eacc157c966dd24d38f9349e42a031e39