-
Notifications
You must be signed in to change notification settings - Fork 0
/
amity_framework.sql
431 lines (372 loc) · 13.3 KB
/
amity_framework.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
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
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
-- phpMyAdmin SQL Dump
-- version 4.6.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Czas generowania: 26 Mar 2018, 18:04
-- Wersja serwera: 5.7.13
-- Wersja PHP: 7.0.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Baza danych: `amity_framework`
--
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `core_bank`
--
CREATE TABLE `core_bank` (
`id` int(11) NOT NULL,
`account_number` varchar(10) NOT NULL,
`profile_id` int(11) NOT NULL,
`cash` int(11) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `core_factions`
--
CREATE TABLE `core_factions` (
`id` int(11) NOT NULL,
`profile_id` int(11) DEFAULT NULL,
`short_name` varchar(10) NOT NULL,
`full_name` varchar(255) NOT NULL,
`type` enum('company','gang','permanent') NOT NULL DEFAULT 'company',
`bank` int(11) NOT NULL DEFAULT '0',
`upkeep` int(11) DEFAULT NULL,
`delete_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `core_garage`
--
CREATE TABLE `core_garage` (
`id` int(11) NOT NULL,
`profile_id` int(11) DEFAULT NULL,
`faction_id` int(11) DEFAULT NULL,
`vehicle_id` int(11) NOT NULL,
`vin` varchar(20) NOT NULL,
`plate` varchar(7) NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '0',
`stealer_id` int(11) DEFAULT NULL,
`hit` text NOT NULL,
`access_level` int(11) DEFAULT NULL,
`damage` float NOT NULL DEFAULT '0',
`fuel` float NOT NULL DEFAULT '1',
`color` varchar(31) NOT NULL DEFAULT '',
`material` varchar(31) NOT NULL DEFAULT '',
`rims` varchar(31) NOT NULL DEFAULT '',
`windows` int(1) NOT NULL DEFAULT '1',
`lights` int(1) NOT NULL DEFAULT '1',
`position` text NOT NULL,
`inventory` text NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `core_items`
--
CREATE TABLE `core_items` (
`id` int(11) NOT NULL,
`class_name` varchar(255) NOT NULL,
`type` enum('item','magazine','weapon','backpack') NOT NULL DEFAULT 'item',
`name` varchar(127) NOT NULL DEFAULT '',
`description` varchar(255) NOT NULL DEFAULT '',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `core_profiles`
--
CREATE TABLE `core_profiles` (
`id` int(11) NOT NULL,
`player_id` int(11) NOT NULL,
`profile_uid` varchar(20) NOT NULL,
`first_name` varchar(50) NOT NULL,
`last_name` varchar(50) NOT NULL,
`female` tinyint(1) NOT NULL DEFAULT '0',
`cash` int(11) NOT NULL DEFAULT '0',
`items` text NOT NULL,
`clothes` text NOT NULL,
`weapons` text NOT NULL,
`hunger` int(11) NOT NULL DEFAULT '0',
`thirst` int(11) NOT NULL DEFAULT '0',
`position` varchar(255) NOT NULL DEFAULT '[]',
`connected` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `core_users`
--
CREATE TABLE `core_users` (
`id` int(11) NOT NULL,
`uid` varchar(40) NOT NULL,
`subscriber` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `core_variables`
--
CREATE TABLE `core_variables` (
`id` int(10) NOT NULL,
`faction_id` int(10) DEFAULT NULL,
`profile_id` int(10) DEFAULT NULL,
`user_id` int(10) DEFAULT NULL,
`garage_id` int(10) DEFAULT NULL,
`name` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
`type` enum('STRING','SCALAR','CODE','ARRAY') NOT NULL DEFAULT 'STRING',
`public` tinyint(1) NOT NULL DEFAULT '0',
`server` tinyint(1) NOT NULL DEFAULT '0',
`start_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`end_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `core_vehicles`
--
CREATE TABLE `core_vehicles` (
`id` int(11) NOT NULL,
`class_name` varchar(255) NOT NULL,
`type` enum('car','ship','air','') NOT NULL DEFAULT 'car',
`name` varchar(127) NOT NULL DEFAULT '',
`description` varchar(255) NOT NULL DEFAULT '',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `faction_assigned_modules`
--
CREATE TABLE `faction_assigned_modules` (
`id` int(11) NOT NULL,
`faction_id` int(11) NOT NULL,
`module_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `faction_members`
--
CREATE TABLE `faction_members` (
`id` int(11) NOT NULL,
`faction_id` int(11) NOT NULL,
`profile_id` int(11) NOT NULL,
`access_level` int(11) NOT NULL DEFAULT '1',
`salary` int(11) DEFAULT NULL,
`description` varchar(255) NOT NULL DEFAULT '',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Struktura tabeli dla tabeli `faction_modules`
--
CREATE TABLE `faction_modules` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`price` int(11) NOT NULL,
`variable` varchar(255) NOT NULL,
`type` enum('company','gang','permanent') NOT NULL,
`visible` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indeksy dla zrzutów tabel
--
--
-- Indexes for table `core_bank`
--
ALTER TABLE `core_bank`
ADD PRIMARY KEY (`id`),
ADD KEY `profile_id` (`profile_id`);
--
-- Indexes for table `core_factions`
--
ALTER TABLE `core_factions`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `short_name` (`short_name`),
ADD UNIQUE KEY `full_name` (`full_name`),
ADD KEY `owner_id` (`profile_id`);
--
-- Indexes for table `core_garage`
--
ALTER TABLE `core_garage`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `vin` (`vin`),
ADD KEY `vehicle_id` (`vehicle_id`),
ADD KEY `owner_id` (`profile_id`),
ADD KEY `company_id` (`faction_id`),
ADD KEY `current_id` (`stealer_id`);
--
-- Indexes for table `core_items`
--
ALTER TABLE `core_items`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `class_name` (`class_name`);
--
-- Indexes for table `core_profiles`
--
ALTER TABLE `core_profiles`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `name` (`first_name`,`last_name`) USING BTREE,
ADD KEY `player_id` (`player_id`);
--
-- Indexes for table `core_users`
--
ALTER TABLE `core_users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `uid` (`uid`);
--
-- Indexes for table `core_variables`
--
ALTER TABLE `core_variables`
ADD PRIMARY KEY (`id`),
ADD KEY `faction_id` (`faction_id`),
ADD KEY `profile_id` (`profile_id`),
ADD KEY `user_id` (`user_id`),
ADD KEY `garage_id` (`garage_id`);
--
-- Indexes for table `core_vehicles`
--
ALTER TABLE `core_vehicles`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `class_name` (`class_name`);
--
-- Indexes for table `faction_assigned_modules`
--
ALTER TABLE `faction_assigned_modules`
ADD PRIMARY KEY (`id`),
ADD KEY `faction_id` (`faction_id`),
ADD KEY `module_id` (`module_id`);
--
-- Indexes for table `faction_members`
--
ALTER TABLE `faction_members`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `unique` (`faction_id`,`profile_id`) USING BTREE,
ADD KEY `faction_id` (`faction_id`),
ADD KEY `profile_id` (`profile_id`);
--
-- Indexes for table `faction_modules`
--
ALTER TABLE `faction_modules`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT dla tabeli `core_bank`
--
ALTER TABLE `core_bank`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT dla tabeli `core_factions`
--
ALTER TABLE `core_factions`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT dla tabeli `core_garage`
--
ALTER TABLE `core_garage`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT dla tabeli `core_items`
--
ALTER TABLE `core_items`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT dla tabeli `core_profiles`
--
ALTER TABLE `core_profiles`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT dla tabeli `core_users`
--
ALTER TABLE `core_users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT dla tabeli `core_variables`
--
ALTER TABLE `core_variables`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT dla tabeli `core_vehicles`
--
ALTER TABLE `core_vehicles`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT dla tabeli `faction_assigned_modules`
--
ALTER TABLE `faction_assigned_modules`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT dla tabeli `faction_members`
--
ALTER TABLE `faction_members`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT dla tabeli `faction_modules`
--
ALTER TABLE `faction_modules`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Ograniczenia dla zrzutów tabel
--
--
-- Ograniczenia dla tabeli `core_bank`
--
ALTER TABLE `core_bank`
ADD CONSTRAINT `core_bank_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `core_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Ograniczenia dla tabeli `core_factions`
--
ALTER TABLE `core_factions`
ADD CONSTRAINT `core_factions_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `core_profiles` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
--
-- Ograniczenia dla tabeli `core_garage`
--
ALTER TABLE `core_garage`
ADD CONSTRAINT `core_garage_ibfk_1` FOREIGN KEY (`vehicle_id`) REFERENCES `core_vehicles` (`id`) ON UPDATE CASCADE,
ADD CONSTRAINT `core_garage_ibfk_2` FOREIGN KEY (`faction_id`) REFERENCES `core_factions` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `core_garage_ibfk_3` FOREIGN KEY (`profile_id`) REFERENCES `core_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `core_garage_ibfk_4` FOREIGN KEY (`stealer_id`) REFERENCES `core_profiles` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
--
-- Ograniczenia dla tabeli `core_profiles`
--
ALTER TABLE `core_profiles`
ADD CONSTRAINT `core_profiles_ibfk_1` FOREIGN KEY (`player_id`) REFERENCES `core_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Ograniczenia dla tabeli `core_variables`
--
ALTER TABLE `core_variables`
ADD CONSTRAINT `core_variables_ibfk_1` FOREIGN KEY (`faction_id`) REFERENCES `core_factions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `core_variables_ibfk_2` FOREIGN KEY (`profile_id`) REFERENCES `core_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `core_variables_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `core_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `core_variables_ibfk_4` FOREIGN KEY (`garage_id`) REFERENCES `core_garage` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Ograniczenia dla tabeli `faction_assigned_modules`
--
ALTER TABLE `faction_assigned_modules`
ADD CONSTRAINT `faction_assigned_modules_ibfk_1` FOREIGN KEY (`faction_id`) REFERENCES `core_factions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `faction_assigned_modules_ibfk_2` FOREIGN KEY (`module_id`) REFERENCES `faction_modules` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Ograniczenia dla tabeli `faction_members`
--
ALTER TABLE `faction_members`
ADD CONSTRAINT `faction_members_ibfk_1` FOREIGN KEY (`faction_id`) REFERENCES `core_factions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `faction_members_ibfk_2` FOREIGN KEY (`profile_id`) REFERENCES `core_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;