forked from conops-porta/conops-porta
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase-porta.sql
More file actions
353 lines (317 loc) · 14 KB
/
database-porta.sql
File metadata and controls
353 lines (317 loc) · 14 KB
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
--DATABASE is named ConOps--
--The user table holds encripted password and username and authorization level--
CREATE TABLE "user"
(
"id" SERIAL PRIMARY KEY,
"username" VARCHAR(80) UNIQUE NOT NULL,
"password" VARCHAR(1000) NOT NULL,
"authorization" INT
);
-- Organization table holds all information regarding Organizations--
CREATE TABLE "Organization"
(
"OrganizationID" SERIAL PRIMARY KEY,
"OrganizationName" VARCHAR(255) NOT NULL
);
-- holds all the conventions info--
CREATE TABLE "Convention"
(
"ConventionID" SERIAL PRIMARY KEY,
"OrganizationID" INTEGER
REFERENCES "Organization"("OrganizationID"),
"ConventionName" VARCHAR(255) NOT NULL,
"ConventionStartTime" TIMESTAMP NOT NULL,
"ConventionEndTime" TIMESTAMP NOT NULL,
"ConventionNews" VARCHAR(255)
);
-- holds all the badge type info--
CREATE TABLE "BadgeType"
(
"BadgeTypeID" SERIAL PRIMARY KEY,
"BadgeTypeDescription" VARCHAR(255) NOT NULL,
"isAvailableForSelfRegistration" BOOLEAN NOT NULL
);
-- holds the order id probably connects to one of their existing database tables that hold important attendee info--
CREATE TABLE "Order"
(
"OrderID" SERIAL PRIMARY KEY NOT NULL
);
--Attendees table holds all of these attendees info--
CREATE TABLE "Attendee"
(
"AttendeeID" SERIAL PRIMARY KEY,
"ConventionID" INTEGER NOT NULL
REFERENCES "Convention"("ConventionID"),
"LastName" VARCHAR(255) NOT NULL,
"FirstName" VARCHAR(255) NOT NULL,
"MiddleName" VARCHAR(255) NOT NULL,
"AddressLineOne" VARCHAR(255) NOT NULL,
"AddressLineTwo" VARCHAR(255),
"City" VARCHAR(255) NOT NULL,
"StateProvince" VARCHAR(255) NOT NULL,
"PostalCode" VARCHAR(255) NOT NULL,
"CountryID" VARCHAR(255) NOT NULL,
"EmailAddress" VARCHAR(255) NOT NULL,
"PhoneNumber" VARCHAR(255) NOT NULL,
"DateOfBirth" DATE NOT NULL,
"BadgeName" VARCHAR(255) NOT NULL,
"RegistrationDate" TIMESTAMP NOT NULL,
"CheckInDate" TIMESTAMP,
"PaymentDate" TIMESTAMP,
"BadgeTypeID" INTEGER NOT NULL
REFERENCES "BadgeType"("BadgeTypeID"),
"BadgeNumber" VARCHAR(255) UNIQUE NOT NULL,
"printed" BOOLEAN NOT NULL,
"DiscordVerified" BOOLEAN NOT NULL,
"PreRegSortNumber" INTEGER,
"orderID" INTEGER
REFERENCES "Order"("OrderID"),
"FlaggedNoVolunteer" BOOLEAN DEFAULT false,
"VolunteerID" INTEGER
);
-- holds all the location information --
CREATE TABLE "Location"
(
"LocationID" SERIAL PRIMARY KEY,
"LocationName" VARCHAR (255) NOT NULL,
"LocationDescription" VARCHAR(255) NOT NULL,
"LocationIsActive" BOOLEAN NOT NULL
);
-- holds all sponsor information--
CREATE TABLE "Sponsor"
(
"SponsorID" SERIAL PRIMARY KEY,
"SponsorName" VARCHAR(255) NOT NULL,
"AmountPaid" VARCHAR(255) NOT NULL,
"Website" VARCHAR(255) NOT NULL,
"Notes" VARCHAR(255),
"SponsorIsActive" BOOLEAN NOT NULL
);
-- holds all the events information--
CREATE TABLE "Event"
(
"EventID" SERIAL PRIMARY KEY,
"ConventionID" INTEGER NOT NULL
REFERENCES "Convention"("ConventionID"),
"EventName" VARCHAR(255) NOT NULL,
"EventStartTime" TIMESTAMP WITH TIME ZONE NOT NULL,
"EventEndTime" TIMESTAMP WITH TIME ZONE NOT NULL,
"LocationID" INTEGER NOT NULL
REFERENCES "Location"("LocationID"),
"IsCancelled" BOOLEAN NOT NULL,
"EventDescription" VARCHAR(255) NOT NULL,
"SponsorID" INTEGER
REFERENCES "Sponsor"("SponsorID"),
"DateCreated" TIMESTAMP WITH TIME ZONE NOT NULL,
"DateLastModified" TIMESTAMP WITH TIME ZONE,
"EventModifiedNotes" VARCHAR(255)
);
-- holds all the tags information --
CREATE TABLE "Tags"
(
"TagID" SERIAL PRIMARY KEY,
"TagName" VARCHAR(255) NOT NULL,
"TagIsActive" boolean DEFAULT true
);
-- a join table between events and tags --
CREATE TABLE "EventTags"
(
"EventTagsID" SERIAL PRIMARY KEY,
"Event_ID" INTEGER NOT NULL
REFERENCES "Event"("EventID"),
"Tag_ID" INTEGER NOT NULL
REFERENCES "Tags"("TagID")
);
-- joins sponsor and convention tables --
CREATE TABLE "ConventionSponsor"
(
"ConventionSponsorID" SERIAL PRIMARY KEY,
"Convention_ID" INTEGER NOT NULL
REFERENCES "Convention"("ConventionID"),
"SponsorID" INTEGER NOT NULL
REFERENCES "Sponsor"("SponsorID")
);
-- holds information about departments
CREATE TABLE "Department"
(
"DepartmentID" SERIAL PRIMARY KEY,
"DepartmentName" VARCHAR(255) NOT NULL UNIQUE,
"DepartmentDescription" VARCHAR(255),
"LocationID" integer
REFERENCES "Location"("LocationID"),
"ContactPersonBadge" VARCHAR(255)
REFERENCES "Attendee"("BadgeNumber")
);
-- holds information about volunteers
CREATE TABLE "VolunteerContact" (
"VolunteerID" SERIAL PRIMARY KEY,
"VolunteerName" VARCHAR(255) NOT NULL UNIQUE,
"VolunteerDiscord" VARCHAR(255),
"VolunteerEmail" VARCHAR(255) NOT NULL,
"VolunteerPhone" VARCHAR(255) NOT NULL,
"MainDepartmentID" integer
REFERENCES "Department"("DepartmentID"),
"SecondaryDepartmentID" integer
REFERENCES "Department"("DepartmentID"),
"VolunteerNotes" text,
"VolunteerHours" integer,
"VolunteerShirtSize" VARCHAR(255),
"VolunteerVetted" boolean default false
);
-- attaches VolunteerContact records to Attendee table, where appropriate
ALTER TABLE "Attendee"
ADD CONSTRAINT "Attendee_fk_VolunteerID"
FOREIGN KEY ("VolunteerID") REFERENCES "VolunteerContact"("VolunteerID");
-- holds information about volunteer roles
CREATE TABLE "Role"
(
"RoleID" SERIAL PRIMARY KEY,
"DepartmentID" integer NOT NULL
REFERENCES "Department"("DepartmentID")
ON DELETE CASCADE,
"RoleName" VARCHAR(255) NOT NULL,
"RoleDescription" VARCHAR(255),
"RoleForWalkUps" boolean NOT NULL DEFAULT false,
"RoleAdminNotes" VARCHAR(255)
);
-- holds details about volunteer shifts and the attendees filling them (if any) --
CREATE TABLE "Shift"
(
"ShiftID" SERIAL PRIMARY KEY,
"ShiftDate" date NOT NULL,
"ShiftTime" time NOT NULL,
"RoleID" integer NOT NULL
REFERENCES "Role"("RoleID")
ON DELETE CASCADE,
"NoShow" boolean NOT NULL DEFAULT false,
"BadgeNumber" VARCHAR(255)
REFERENCES "Attendee"("BadgeNumber")
);
-- ** FOR THESE EXAMPLES TO WORK, SERIAL IDS MUST START FROM 1, YOU MIGHT NEED TO CHANGE AFTER YOU INSERT **--
--CONVENTIONS--
INSERT INTO "Convention"
("ConventionName", "ConventionStartTime", "ConventionEndTime", "ConventionNews")
VALUES
('2dCon.20 the 2D-Reconening', '8/20/2018', '08/25/2018', 'Pizza Party in the lobby nerds. Come get some'),
('2dCon 2019: The weird gets weirder', '8/20/2019', '8/25/2019', 'Probably going to have to update these at some point!'),
('2dCon 2020: Remaster' , '8/20/2020', '8/25/2020', 'THE FUTURE WAS NOW');
--BADGE TYPES--
INSERT INTO "BadgeType"
("BadgeTypeDescription", "isAvailableForSelfRegistration")
VALUES
('21 plus', true),
('under 21', true),
('VIP', false);
--ORDERS--
INSERT INTO "Order"
("OrderID")
VALUES
(1),
(2),
(3),
(4);
--Walk-in Attendee who has checked in--
INSERT INTO "Attendee"
("ConventionID", "LastName", "FirstName", "MiddleName", "AddressLineOne", "AddressLineTwo", "City", "StateProvince", "PostalCode", "CountryID", "EmailAddress", "PhoneNumber", "DateOfBirth", "BadgeName", "RegistrationDate", "CheckInDate", "PaymentDate", "BadgeTypeID", "BadgeNumber", "printed", "DiscordVerified", "PreRegSortNumber", "orderID")
VALUES
(3, 'OBannon', 'Chris', 'Ryan', '123 fakestreet', 'apartment 2', 'Savage', 'MN', '55378', 'United States', 'crobwan@gmail.com', '612-750-6236', '04/21/1990', 'pantspoopers', '08/23/2018', '08/23/2018', '08/23/2018', 2, '0001', false, false, '2', null),
(3, 'Decalan', 'Berniedividisde', 'patrick', '789 dummdatalane', 'here', 'townmane', 'Quebec', '55676', 'Canada eh', 'declanB@gmail.com', '555-555-5555', '04/19/1999', 'mapleleaf', '08/22/2020', '08/22/2020', '08/22/2020', 2, '0002', true, true, 4, null);
--Walkinin Attendee who has not checked in--
INSERT INTO "Attendee"
("ConventionID", "LastName", "FirstName", "MiddleName", "AddressLineOne", "AddressLineTwo", "City", "StateProvince", "PostalCode", "CountryID", "EmailAddress", "PhoneNumber", "DateOfBirth", "BadgeName", "RegistrationDate", "BadgeTypeID", "BadgeNumber", "printed", "DiscordVerified", "PreRegSortNumber", "orderID")
VALUES
(3, 'Marit', 'Zelinsky', '??', '123 fakestreet', 'apartment 2', 'Tonka', 'MN', '55345', 'United States', 'Zlinksy@gmail.com', '612-555-5555', '06/21/1992', 'hockey is cool', '08/23/2020', 1, '0003', false, false, '5', null);
--pregistered attendees who have not yet checked in--
INSERT INTO "Attendee"
("ConventionID", "LastName", "FirstName", "MiddleName", "AddressLineOne", "AddressLineTwo", "City", "StateProvince", "PostalCode", "CountryID", "EmailAddress", "PhoneNumber", "DateOfBirth", "BadgeName", "RegistrationDate", "PaymentDate", "BadgeTypeID", "BadgeNumber", "printed", "DiscordVerified", "PreRegSortNumber", "orderID")
VALUES
(3, 'OBannnon', 'Chris', 'Ryan', '123 fakestreet', 'apartment 2', 'Savage', 'MN', '55378', 'United States', 'crobwan@gmail.com', '612-750-6236', '04/21/1990', 'pottytrained', '08/22/2019', '08/22/2019', 1, '0004', true, true, '3', '1'),
(3, 'Smith', 'Alex', 'Smitty', '456 notreal lane', 'apartment 2', 'Minnetonka', 'MN', '55345', 'UNITED STATES', 'rodrigo321$gmail.com', '555-555-555', '10/13/1991', 'pottytrained', '08/22/2019', '08/22/2019', 1, '0005', true, true, '3', '1'),
(3, 'Dustin', 'Fedie', 'guy', '4545 notrealave', 'basmenet', 'Saint Paul', 'MN', '55401', 'United STates', 'dustinisgreat@gamil.com', '555-555-55555', '11/22/1986', 'verysmart', '06/19/2020', '06/19/2020', 1, '0006', true, true, '3', '2');
--VOLUNTEER--
INSERT INTO "VolunteerContact"
("VolunteerName", "VolunteerDiscord", "VolunteerEmail", "VolunteerPhone", "VolunteerHours")
VALUES
('Dane Smith', 'primestuff', 'DainBSmith@gmail.com', '555-555-5555', 10);
--preregistered attendees who have checked in--
INSERT INTO "Attendee"
("ConventionID", "LastName", "FirstName", "MiddleName", "AddressLineOne", "AddressLineTwo", "City", "StateProvince", "PostalCode", "CountryID", "EmailAddress", "PhoneNumber", "DateOfBirth", "BadgeName", "RegistrationDate", "CheckInDate", "PaymentDate", "BadgeTypeID", "BadgeNumber", "printed", "DiscordVerified", "PreRegSortNumber", "orderID", "VolunteerID")
VALUES
(3, 'Dubois', 'Andrew', 'Jamal', '123 fakestreet', 'apartment 2', 'Savage', 'MN', '55378', 'United States', 'doobers@gmail.com', '612-555-5555', '09/30/1989', 'dorkstuff', '04/23/2020', '08/23/2020', '04/23/2020', 1, '0007', true, false, '7', '1', null),
(3, 'Dane', 'Smith', 'Donald', '2020 pretendplace', 'apt 3', 'NorthEast', 'MN', '55403', 'United States', 'DainBSmith@gmail.com', '555-555-5555', '05/05/1984', 'primestuff', '06/01/2020', '08/20/202', '06/01/2020', 1, '0008', true, true, '8', '3', 1);
--LOCATIONS--
INSERT INTO "Location"
("LocationName", "LocationDescription", "LocationIsActive")
VALUES
('Panel Room', 'Lakeshore B', false),
('Kids Corner', 'Regency Ballroom', false),
('Tabletop', 'Exhibition Hall', false),
('Arcade', 'Exhibition Hall', false),
('Console State', 'Greenway Ballroom', false),
('LAN Area', 'Exhibition Hall', false),
('Main Stage', 'Main Stage', false),
('Tournament Room', 'Lakeshore A', false);
--TAGS--
INSERT INTO "Tags"
("TagName")
VALUES
('Fan Run'),
('Panel'),
('Guests'),
('Family Friendly'),
('PS4');
--SPONSORS--
INSERT INTO "Sponsor"
("SponsorName", "AmountPaid", "Website", "SponsorIsActive")
VALUES
('Level Up Games', '2,000', 'https://www.levelupgamesmn.com/', false),
('Highlander Games', '5,000', 'http://highlandergamesmn.com/', false),
('Paradise Arcade Shop', '3,000', 'https://paradisearcadeshop.com', false),
('Anime Twin Cities', '4,000', 'https://www.animetwincities.org/', false),
('Discord', '20,000', 'https://discordapp.com/', false),
('Twitch', '30,000', 'https://www.twitch.tv/2dcon', false);
--SPONSORS W/ NOTES
INSERT INTO "Sponsor"
("SponsorName", "AmountPaid", "Website", "Notes", "SponsorIsActive")
VALUES
('Up Down Minneapolis', '6,000', 'https://www.updownarcadebar.com/minneapolis/', 'donating an arcade game this year!', false);
--EVENTS--
INSERT INTO "Event"
("ConventionID", "EventName", "EventStartTime", "EventEndTime", "LocationID", "IsCancelled", "EventDescription", "DateCreated")
VALUES
('1', 'Gamer Yoga', '08/23/2018 1:00 PM', '08/23/2018 2:00 PM', '2', 'FALSE', 'Want to level up your body at the same time you level up your game? Join us at the kids corner (all ages welcome) and bring your favorite gaming controller or handheld gaming device to experience gaming in the here and now.', '08/22/2018'),
('2', 'Century: Spice Road Trip Tournament', '08/25/2019 2:00 PM', '08/25/2019 6:00 PM', '3', 'FALSE', 'Century: Spice Road is the first in a series of games that explores the history of each century with spice-trading as the theme for the first installment.', '08/03/2019'),
('3', 'Tekken 7', '08/26/2020 1:00 PM', '08/26/2020 6:00 PM', '8', 'FALSE', 'Tekken 7!', '07/27/2020');
--SPONSORED EVENTS--
INSERT INTO "Event"
("ConventionID", "EventName", "EventStartTime", "EventEndTime", "LocationID", "IsCancelled", "EventDescription", "SponsorID", "DateCreated")
VALUES
('3', 'Counterstrike: GO', '08/26/2020 2:00 PM', '08/26/2020 6:00 PM', '6', 'FALSE', 'GO!', '6', '05/20/2020');
--CONVENTIONS SPONSOR JUNCTION TABLE--
INSERT INTO "ConventionSponsor"
("Convention_ID", "SponsorID")
VALUES
('1', '2'),
('2', '3'),
('3', '4'),
('3', '5'),
('3', '6'),
('3', '7');
--CANCELLED EVENTS--
INSERT INTO "Event"
("ConventionID", "EventName", "EventStartTime", "EventEndTime", "LocationID", "IsCancelled", "EventDescription", "DateCreated")
VALUES
('3', 'Marvel Vs. Capcom 2', '08/24/2020 2:00 PM', '08/24/2020 5:00 PM', '4', 'TRUE', 'wow!', '08/22/2020');
--MODIFIED EVENTS--
INSERT INTO "Event"
("ConventionID", "EventName", "EventStartTime", "EventEndTime", "LocationID", "IsCancelled", "EventDescription", "DateCreated", "DateLastModified", "EventModifiedNotes")
VALUES
('3', 'Dragon Ball FighterZ', '08/24/2020 2:00 PM', '08/24/2020 5:00 PM', '4', 'FALSE', 'haha!', '08/22/2020', '08/23/2020', 'please ensure all our guest keep it in under control');
--EVENT TAGS--
INSERT INTO "EventTags"
("Event_ID", "Tag_ID")
VALUES
('1', '4'),
('2', '5'),
('1', '1'),
('4', '1');