1 | create table user(
|
---|
2 | id int(6),
|
---|
3 | username varchar(10) UNIQUE NOT NULL,
|
---|
4 | passhash varchar(30),
|
---|
5 | fullname varchar(30),
|
---|
6 | admin_bit int(1),
|
---|
7 | PRIMARY KEY(id)
|
---|
8 | );
|
---|
9 |
|
---|
10 | --NEW TABLES ADDED
|
---|
11 | create table location(
|
---|
12 | location_id int(3),
|
---|
13 | location_name varchar(100),
|
---|
14 | description varchar(200),
|
---|
15 | PRIMARY KEY(location_id)
|
---|
16 | );
|
---|
17 |
|
---|
18 | create table room(
|
---|
19 | room_id int(3),
|
---|
20 | room_name varchar(50),
|
---|
21 | description varchar(200),
|
---|
22 | PRIMARY KEY(room_id)
|
---|
23 | );
|
---|
24 |
|
---|
25 | create table equipment(
|
---|
26 | part_id int(6),
|
---|
27 | name varchar(20),
|
---|
28 | description varchar(100),
|
---|
29 | quantity int(3),
|
---|
30 | PRIMARY KEY(part_id)
|
---|
31 | );
|
---|
32 | --END New Tables
|
---|
33 |
|
---|
34 | create table rooms_booked(
|
---|
35 | room_id int(3),
|
---|
36 | begin DATETIME,
|
---|
37 | end DATETIME,
|
---|
38 | FOREIGN KEY(room_id) REFERENCES room(room_id)
|
---|
39 | );
|
---|
40 |
|
---|
41 | create table meeting_final(
|
---|
42 | meeting_id int(10),
|
---|
43 | name varchar(20) NOT NULL,
|
---|
44 | begin DATETIME,
|
---|
45 | end DATETIME,
|
---|
46 | location_id int(3),
|
---|
47 | room_id int(3),
|
---|
48 | description varchar(100),
|
---|
49 | PRIMARY KEY(meeting_id,begin),
|
---|
50 | FOREIGN KEY(location_id) REFERENCES location(location_id),
|
---|
51 | FOREIGN KEY(room_id) REFERENCES room(room_id)
|
---|
52 | );
|
---|
53 |
|
---|
54 | create table participants_final(
|
---|
55 | participant_id int(10),
|
---|
56 | user_id int(6),
|
---|
57 | meeting_id int(10),
|
---|
58 | active_bit int(1),
|
---|
59 | important_bit int(1),
|
---|
60 | PRIMARY KEY(participant_id,user_id,meeting_id),
|
---|
61 | FOREIGN KEY(user_id) REFERENCES user(id),
|
---|
62 | FOREIGN KEY(meeting_id) REFERENCES meeting_final(meeting_id)
|
---|
63 | );
|
---|
64 |
|
---|
65 | create table equipment_needed_final(
|
---|
66 | participant_id int(10),
|
---|
67 | user_id int(6),
|
---|
68 | meeting_id int(10),
|
---|
69 | equipment_id int(5),
|
---|
70 | count int(100),
|
---|
71 | PRIMARY KEY(participant_id,user_id,meeting_id),
|
---|
72 | FOREIGN KEY(user_id) REFERENCES user(id),
|
---|
73 | FOREIGN KEY(meeting_id) REFERENCES meeting_final(meeting_id),
|
---|
74 | FOREIGN KEY(participant_id) REFERENCES participants_final(participant_id),
|
---|
75 | FOREIGN KEY(equipment_id) REFERENCES equipment(part_id)
|
---|
76 | );
|
---|
77 |
|
---|
78 | create table meeting_pending(
|
---|
79 | meeting_id int(10),
|
---|
80 | name varchar(20) NOT NULL,
|
---|
81 | begin DATETIME,
|
---|
82 | end DATETIME,
|
---|
83 | description varchar(100),
|
---|
84 | location_id int(3),
|
---|
85 | room_id int(3),
|
---|
86 | PRIMARY KEY(meeting_id,begin),
|
---|
87 | FOREIGN KEY(location_id) REFERENCES location(location_id),
|
---|
88 | FOREIGN KEY(room_id) REFERENCES room(room_id)
|
---|
89 | );
|
---|
90 |
|
---|
91 | create table participants_pending(
|
---|
92 | participant_id int(10),
|
---|
93 | user_id int(6),
|
---|
94 | meeting_id int(10),
|
---|
95 | active_bit int(1),
|
---|
96 | important_bit int(1),
|
---|
97 | PRIMARY KEY(participant_id,user_id,meeting_id),
|
---|
98 | FOREIGN KEY(user_id) REFERENCES user(id),
|
---|
99 | FOREIGN KEY(meeting_id) REFERENCES meeting_final(meeting_id)
|
---|
100 | );
|
---|
101 |
|
---|
102 | create table equipment_needed_pending(
|
---|
103 | participant_id int(10),
|
---|
104 | user_id int(6),
|
---|
105 | meeting_id int(10),
|
---|
106 | equipment_id int(5),
|
---|
107 | count int(100),
|
---|
108 | PRIMARY KEY(participant_id,user_id,meeting_id),
|
---|
109 | FOREIGN KEY(user_id) REFERENCES user(id),
|
---|
110 | FOREIGN KEY(meeting_id) REFERENCES meeting_final(meeting_id),
|
---|
111 | FOREIGN KEY(participant_id) REFERENCES participants_final(participant_id),
|
---|
112 | FOREIGN KEY(equipment_id) REFERENCES equipment(part_id)
|
---|
113 | );
|
---|
114 |
|
---|
115 | create table calendar_inclusion(
|
---|
116 | id int(6),
|
---|
117 | name varchar(10) NOT NULL,
|
---|
118 | url varchar(50) NOT NULL,
|
---|
119 | last_update DATETIME,
|
---|
120 | PRIMARY KEY(id)
|
---|
121 | );
|
---|
122 |
|
---|
123 | create table calendar_exclusion(
|
---|
124 | id int(6),
|
---|
125 | name varchar(10) NOT NULL,
|
---|
126 | url varchar(50) NOT NULL,
|
---|
127 | last_update DATETIME,
|
---|
128 | PRIMARY KEY(id)
|
---|
129 | );
|
---|
130 |
|
---|
131 | create table calendar_preference(
|
---|
132 | id int(6),
|
---|
133 | name varchar(10) NOT NULL,
|
---|
134 | url varchar(50) NOT NULL,
|
---|
135 | last_update DATETIME,
|
---|
136 | PRIMARY KEY(id)
|
---|
137 | );
|
---|
138 |
|
---|
139 | create table appointments_inclusion(
|
---|
140 | calender_inclusion_id int(6),
|
---|
141 | begin DATETIME,
|
---|
142 | end DATETIME,
|
---|
143 | name varchar(10),
|
---|
144 | description varchar(50),
|
---|
145 | PRIMARY KEY(calender_inclusion_id),
|
---|
146 | FOREIGN KEY(calender_inclusion_id) REFERENCES calendar_inclusion(id)
|
---|
147 | );
|
---|
148 |
|
---|
149 | create table appointments_exclusion(
|
---|
150 | calender_exclusion_id int(6),
|
---|
151 | begin DATETIME,
|
---|
152 | end DATETIME,
|
---|
153 | name varchar(10),
|
---|
154 | description varchar(50),
|
---|
155 | PRIMARY KEY(calender_exclusion_id),
|
---|
156 | FOREIGN KEY(calender_exclusion_id) REFERENCES calendar_exclusion(id)
|
---|
157 | );
|
---|
158 |
|
---|
159 | create table appointments_preference(
|
---|
160 | calender_preference_id int(6),
|
---|
161 | begin DATETIME,
|
---|
162 | end DATETIME,
|
---|
163 | name varchar(10),
|
---|
164 | description varchar(50),
|
---|
165 | PRIMARY KEY(calender_preference_id),
|
---|
166 | FOREIGN KEY(calender_preference_id) REFERENCES calendar_preference(id)
|
---|
167 | );
|
---|