-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sql
300 lines (284 loc) · 11.4 KB
/
install.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
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
-- Adminer 4.1.0 MySQL dump
SET NAMES utf8mb4;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS `country`;
CREATE TABLE `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`code_alpha2` varchar(6) COLLATE utf8mb4_unicode_ci NOT NULL,
`code_ioc` varchar(3) COLLATE utf8mb4_unicode_ci NOT NULL,
`aliases` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
`europe` int(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `country` (`id`, `name`, `code_alpha2`, `code_ioc`, `aliases`, `europe`) VALUES
(1, 'Afghanistan', 'af', 'AFG', '', 0),
(2, 'Albania', 'al', 'ALB', '', 1),
(3, 'Algeria', 'dz', 'ALG', '', 0),
(4, 'Andorra', 'ad', 'AND', '', 1),
(5, 'Angola', 'ao', 'ANG', '', 0),
(6, 'Antigua and Barbuda', 'ag', 'ANT', '', 0),
(7, 'Argentina', 'ar', 'ARG', '', 0),
(8, 'Armenia', 'am', 'ARM', '', 1),
(9, 'Australia', 'au', 'AUS', '', 0),
(10, 'Austria', 'at', 'AUT', '', 1),
(11, 'Azerbaijan', 'az', 'AZE', '', 1),
(12, 'Bahamas', 'bs', 'BAH', '', 0),
(13, 'Bahrain', 'bh', 'BRN', '', 0),
(14, 'Bangladesh', 'bd', 'BAN', '', 0),
(15, 'Barbados', 'bb', 'BAR', '', 0),
(16, 'Belarus', 'by', 'BLR', '', 1),
(17, 'Belgium', 'be', 'BEL', '', 1),
(18, 'Belize', 'bz', 'BIZ', '', 0),
(19, 'Benin', 'bj', 'BEN', '', 0),
(20, 'Bhutan', 'bt', 'BHU', '', 0),
(21, 'Bolivia', 'bo', 'BOL', '', 0),
(22, 'Bosnia and Herzegovina', 'ba', 'BIH', '', 1),
(23, 'Botswana', 'bw', 'BOT', '', 0),
(24, 'Brazil', 'br', 'BRA', '', 0),
(25, 'Brunei', 'bn', 'BRU', '', 0),
(26, 'Bulgaria', 'bg', 'BUL', '', 1),
(27, 'Burkina Faso', 'bf', 'BUR', '', 0),
(28, 'Burundi', 'bi', 'BDI', '', 0),
(29, 'Cambodia', 'kh', 'CAM', '', 0),
(30, 'Cameroon', 'cm', 'CMR', '', 0),
(31, 'Canada', 'ca', 'CAN', '', 0),
(32, 'Cape Verde', 'cv', 'CPV', '', 0),
(33, 'Central African Republic', 'cf', 'CAF', '', 0),
(34, 'Chad', 'td', 'CHA', '', 0),
(35, 'Chile', 'cl', 'CHI', '', 0),
(36, 'China', 'cn', 'CHN', '', 0),
(37, 'Colombia', 'co', 'COL', '', 0),
(38, 'Comoros', 'km', 'COM', '', 0),
(39, 'Congo, Democratic Republic', 'cd', 'COD', '', 0),
(40, 'Congo, Republic', 'cg', 'CGO', '', 0),
(41, 'Costa Rica', 'cr', 'CRC', '', 0),
(42, 'Ivory Coast', 'ci', 'CIV', '', 0),
(43, 'Croatia', 'hr', 'CRO', '', 1),
(44, 'Cuba', 'cu', 'CUB', '', 0),
(45, 'Cyprus', 'cy', 'CYP', '', 1),
(46, 'Czech Republic', 'cz', 'CZE', '', 1),
(47, 'Denmark', 'dk', 'DEN', '', 1),
(48, 'Djibouti', 'dj', 'DJI', '', 0),
(49, 'Dominica', 'dm', 'DMA', '', 0),
(50, 'Dominican Republic', 'do', 'DOM', '', 0),
(51, 'Ecuador', 'ec', 'ECU', '', 0),
(52, 'Egypt', 'eg', 'EGY', '', 0),
(53, 'El Salvador', 'sv', 'ESA', '', 0),
(54, 'Equatorial Guinea', 'gq', 'GEQ', '', 0),
(55, 'Eritrea', 'er', 'ERI', '', 0),
(56, 'Estonia', 'ee', 'EST', '', 1),
(57, 'Ethiopia', 'et', 'ETH', '', 0),
(58, 'Fiji', 'fj', 'FIJ', '', 0),
(59, 'Finland', 'fi', 'FIN', '', 1),
(60, 'France', 'fr', 'FRA', '', 1),
(61, 'Gabon', 'ga', 'GAB', '', 0),
(62, 'Gambia', 'gm', 'GAM', '', 0),
(63, 'Georgia', 'ge', 'GEO', '', 1),
(64, 'Germany', 'de', 'GER', '', 1),
(65, 'Ghana', 'gh', 'GHA', '', 0),
(66, 'Greece', 'gr', 'GRE', '', 1),
(67, 'Grenada', 'gd', 'GRN', '', 0),
(68, 'Guatemala', 'gt', 'GUA', '', 0),
(69, 'Guinea', 'gn', 'GUI', '', 0),
(70, 'Guinea-Bissau', 'gw', 'GBS', '', 0),
(71, 'Guyana', 'gy', 'GUY', '', 0),
(72, 'Haiti', 'ht', 'HAI', '', 0),
(73, 'Honduras', 'hn', 'HON', '', 0),
(74, 'Hungary', 'hu', 'HUN', '', 1),
(75, 'Iceland', 'is', 'ISL', '', 1),
(76, 'India', 'in', 'IND', '', 0),
(77, 'Indonesia', 'id', 'INA', '', 0),
(78, 'Iran', 'ir', 'IRI', '', 0),
(79, 'Iraq', 'iq', 'IRQ', '', 0),
(80, 'Ireland', 'ie', 'IRL', '', 1),
(81, 'Israel', 'il', 'ISR', '', 0),
(82, 'Italy', 'it', 'ITA', '', 1),
(83, 'Jamaica', 'jm', 'JAM', '', 0),
(84, 'Japan', 'jp', 'JPN', '', 0),
(85, 'Jordan', 'jo', 'JOR', '', 0),
(86, 'Kazakhstan', 'kz', 'KAZ', '', 1),
(87, 'Kenya', 'ke', 'KEN', '', 0),
(88, 'Kiribati', 'ki', 'KIR', '', 0),
(89, 'Korea (North Korea)', 'kp', 'PRK', '', 0),
(90, 'Korea (South Korea)', 'kr', 'KOR', '', 0),
(91, 'Kuwait', 'kw', 'KUW', '', 0),
(92, 'Kyrgyzstan', 'kg', 'KGZ', '', 0),
(93, 'Laos', 'la', 'LAO', '', 0),
(94, 'Latvia', 'lv', 'LAT', '', 1),
(95, 'Lebanon', 'lb', 'LIB', '', 0),
(96, 'Lesotho', 'ls', 'LES', '', 0),
(97, 'Liberia', 'lr', 'LBR', '', 0),
(98, 'Libya', 'ly', 'LBA', '', 0),
(99, 'Liechtenstein', 'li', 'LIE', '', 1),
(100, 'Lithuania', 'lt', 'LTU', '', 1),
(101, 'Luxembourg', 'lu', 'LUX', '', 1),
(102, 'Macedonia', 'mk', 'MKD', '', 1),
(103, 'Madagascar', 'mg', 'MAD', '', 0),
(104, 'Malawi', 'mw', 'MAW', '', 0),
(105, 'Malaysia', 'my', 'MAS', '', 0),
(106, 'Maldives', 'mv', 'MDV', '', 0),
(107, 'Mali', 'ml', 'MLI', '', 0),
(108, 'Malta', 'mt', 'MLT', '', 1),
(109, 'Marshall Islands', 'mh', 'MHL', '', 0),
(110, 'Mauritania', 'mr', 'MTN', '', 0),
(111, 'Mauritius', 'mu', 'MRI', '', 0),
(112, 'Mexico', 'mx', 'MEX', '', 0),
(113, 'Micronesia', 'fm', 'FSM', '', 0),
(114, 'Moldova', 'md', 'MDA', '', 1),
(115, 'Monaco', 'mc', 'MON', '', 1),
(116, 'Mongolia', 'mn', 'MGL', '', 0),
(117, 'Montenegro', 'me', 'MNE', '', 1),
(118, 'Morocco', 'ma', 'MAR', '', 0),
(119, 'Mozambique', 'mz', 'MOZ', '', 0),
(120, 'Myanmar (Burma)', 'mm', 'MYA', '', 0),
(121, 'Namibia', 'na', 'NAM', '', 0),
(122, 'Nauru', 'nr', 'NRU', '', 0),
(123, 'Nepal', 'np', 'NEP', '', 0),
(124, 'Netherlands', 'nl', 'NED', '', 1),
(125, 'New Zealand', 'nz', 'NZL', '', 0),
(126, 'Nicaragua', 'ni', 'NCA', '', 0),
(127, 'Niger', 'ne', 'NIG', '', 0),
(128, 'Nigeria', 'ng', 'NGR', '', 0),
(129, 'Norway', 'no', 'NOR', '', 1),
(130, 'Oman', 'om', 'OMA', '', 0),
(131, 'Pakistan', 'pk', 'PAK', '', 0),
(132, 'Palau', 'pw', 'PLW', '', 0),
(133, 'Panama', 'pa', 'PAN', '', 0),
(134, 'Papua New Guinea', 'pg', 'PNG', '', 0),
(135, 'Paraguay', 'py', 'PAR', '', 0),
(136, 'Peru', 'pe', 'PER', '', 0),
(137, 'Philippines', 'ph', 'PHI', '', 0),
(138, 'Poland', 'pl', 'POL', '', 1),
(139, 'Portugal', 'pt', 'POR', '', 1),
(140, 'Qatar', 'qa', 'QAT', '', 0),
(141, 'Romania', 'ro', 'ROU', '', 1),
(142, 'Russia', 'ru', 'RUS', '', 1),
(143, 'Rwanda', 'rw', 'RWA', '', 0),
(144, 'Saint Kitts and Nevis', 'kn', 'SKN', '', 0),
(145, 'Saint Lucia', 'lc', 'LCA', '', 0),
(146, 'Saint Vincent and the Grenadines', 'vc', 'VIN', '', 0),
(147, 'Samoa', 'ws', 'SAM', '', 0),
(148, 'San Marino', 'sm', 'SMR', '', 1),
(149, 'Sao Tome and Principe', 'st', 'STP', '', 0),
(150, 'Saudi Arabia', 'sa', 'KSA', '', 0),
(151, 'Senegal', 'sn', 'SEN', '', 0),
(152, 'Serbia', 'rs', 'SRB', '', 1),
(153, 'Seychelles', 'sc', 'SEY', '', 0),
(154, 'Sierra Leone', 'sl', 'SLE', '', 0),
(155, 'Singapore', 'sg', 'SGP', '', 0),
(156, 'Slovakia', 'sk', 'SVK', '', 1),
(157, 'Slovenia', 'si', 'SLO', '', 1),
(158, 'Solomon Islands', 'sb', 'SOL', '', 0),
(159, 'Somalia', 'so', 'SOM', '', 0),
(160, 'South Africa', 'za', 'RSA', '', 0),
(161, 'Spain', 'es', 'ESP', '', 1),
(162, 'Sri Lanka', 'lk', 'SRI', '', 0),
(163, 'Sudan', 'sd', 'SUD', '', 0),
(164, 'Suriname', 'sr', 'SUR', '', 0),
(165, 'Swaziland', 'sz', 'SWZ', '', 0),
(166, 'Sweden', 'se', 'SWE', '', 1),
(167, 'Switzerland', 'ch', 'SUI', '', 1),
(168, 'Syria', 'sy', 'SYR', '', 0),
(169, 'Tajikistan', 'tj', 'TJK', '', 0),
(170, 'Tanzania', 'tz', 'TAN', '', 0),
(171, 'Thailand', 'th', 'THA', '', 0),
(172, 'East Timor', 'tl', 'TLS', 'Timor-Leste', 0),
(173, 'Togo', 'tg', 'TOG', '', 0),
(174, 'Tonga', 'to', 'TGA', '', 0),
(175, 'Trinidad and Tobago', 'tt', 'TTO', '', 0),
(176, 'Tunisia', 'tn', 'TUN', '', 0),
(177, 'Turkey', 'tr', 'TUR', '', 0),
(178, 'Turkmenistan', 'tm', 'TKM', '', 0),
(179, 'Tuvalu', 'tv', 'TUV', '', 0),
(180, 'Uganda', 'ug', 'UGA', '', 0),
(181, 'Ukraine', 'ua', 'UKR', '', 1),
(182, 'United Arab Emirates', 'ae', 'UAE', '', 0),
(183, 'United Kingdom', 'gb', 'GBR', '', 1),
(184, 'United States', 'us', 'USA', '', 0),
(185, 'Uruguay', 'uy', 'URU', '', 0),
(186, 'Uzbekistan', 'uz', 'UZB', '', 0),
(187, 'Vanuatu', 'vu', 'VAN', '', 0),
(188, 'Vatican City', 'va', '', '', 1),
(189, 'Venezuela', 've', 'VEN', '', 0),
(190, 'Vietnam', 'vn', 'VIE', '', 0),
(191, 'Yemen', 'ye', 'YEM', '', 0),
(192, 'Zambia', 'zm', 'ZAM', '', 0),
(193, 'Zimbabwe', 'zw', 'ZIM', '', 0),
(194, 'Catalonia', 'es-ct', 'CAT', '', 1),
(195, 'Unaffiliated', 'xx', 'XXX', '', 0);
DROP TABLE IF EXISTS `person`;
CREATE TABLE `person` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`lastname` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`gender` enum('male','female') COLLATE utf8mb4_unicode_ci NOT NULL,
`birth` date NOT NULL,
`details` text NOT NULL,
`email` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`team_id` int(11) NOT NULL,
`contact` tinyint(1) DEFAULT 0 NOT NULL,
PRIMARY KEY (`id`),
KEY `team_id` (`team_id`),
CONSTRAINT `person_ibfk_6` FOREIGN KEY (`team_id`) REFERENCES `team` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `team`;
CREATE TABLE `team` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`message` text COLLATE utf8mb4_unicode_ci NOT NULL,
`status` enum('registered','paid','withdrawn') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'registered',
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`details` text COLLATE utf8mb4_unicode_ci NOT NULL,
`ip` varchar(39) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `invoice`;
CREATE TABLE `invoice` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`status` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`team_id` int(11) NOT NULL,
`items` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
KEY `team_id` (`team_id`),
CONSTRAINT `invoice_ibfk_1` FOREIGN KEY (`team_id`) REFERENCES `team` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
DROP TABLE IF EXISTS `message`;
CREATE TABLE `message` (
`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
`status` enum('queued','cancelled','sent') NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`team_id` int(11) NOT NULL,
`subject` varchar(250) NOT NULL,
`body` text NOT NULL,
FOREIGN KEY (`team_id`) REFERENCES `team` (`id`) ON DELETE CASCADE
) ENGINE='InnoDB' COLLATE 'utf8mb4_unicode_ci';
DROP TABLE IF EXISTS `token`;
CREATE TABLE `token` (
`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
`timestamp` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`team_id` int(11) NOT NULL,
`hash` varchar(255) NOT NULL,
FOREIGN KEY (`team_id`) REFERENCES `team` (`id`) ON DELETE CASCADE,
INDEX `hash` (`hash`)
) ENGINE='InnoDB';
ALTER TABLE `message`
ADD COLUMN `sender` varchar(250) COLLATE 'utf8mb4_unicode_ci' NOT NULL AFTER `subject`;
CREATE TABLE `item_reservation` (
`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` varchar(255) COLLATE 'ascii_general_ci' NOT NULL,
`team_id` int(11) NULL,
`person_id` int(11) NULL,
FOREIGN KEY (`team_id`) REFERENCES `team` (`id`) ON DELETE CASCADE,
FOREIGN KEY (`person_id`) REFERENCES `person` (`id`) ON DELETE CASCADE,
INDEX `name` (`name`)
) COLLATE 'utf8mb4_unicode_ci';
ALTER TABLE `person`
ADD COLUMN `placeholder` tinyint(1) DEFAULT 0 NOT NULL AFTER `contact`;
ALTER TABLE `person`
MODIFY `birth` date NULL;