-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.sql
717 lines (598 loc) · 16 KB
/
schema.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
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
-- MySQL dump 10.13 Distrib 5.5.34, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: tregmine
-- ------------------------------------------------------
-- Server version 5.5.34-0ubuntu0.13.10.1
--
-- Table structure for table blessedblock
--
DROP FUNCTION IF EXISTS UNIX_TIMESTAMP();
CREATE FUNCTION UNIX_TIMESTAMP()
RETURNS INTEGER AS $$
DECLARE currentTime INTEGER;
BEGIN
SELECT (extract(epoch from now())) INTO currentTime;
RETURN currentTime;
END;
$$ LANGUAGE plpgsql;
DROP TABLE IF EXISTS blessedblock;
CREATE TABLE blessedblock (
blessedblock_id serial PRIMARY KEY,
player_id int DEFAULT NULL,
blessedblock_checksum int DEFAULT NULL,
blessedblock_x int DEFAULT NULL,
blessedblock_y int DEFAULT NULL,
blessedblock_z int DEFAULT NULL,
blessedblock_world text DEFAULT NULL
);
--
-- Table structure for table donation
--
DROP TABLE IF EXISTS donation;
CREATE TABLE donation (
donation_id serial PRIMARY KEY,
player_id int DEFAULT NULL,
donation_timestamp int DEFAULT NULL,
donation_amount text DEFAULT NULL,
donation_paypalid text DEFAULT NULL,
donation_payerid text DEFAULT NULL,
donation_email text DEFAULT NULL,
donation_firstname text DEFAULT NULL,
donation_lastname text DEFAULT NULL,
donation_message text
);
--
-- Table structure for table enchantment
--
DROP TABLE IF EXISTS enchantment;
CREATE TABLE enchantment (
enchantment_name text PRIMARY KEY NOT NULL,
enchantment_title text NOT NULL
);
--
-- Table structure for table fishyblock
--
DROP TABLE IF EXISTS fishyblock;
DROP TYPE IF EXISTS fishyblock_status CASCADE;
CREATE TYPE fishyblock_status AS ENUM ('active','deleted');
CREATE TABLE fishyblock (
fishyblock_id serial PRIMARY KEY NOT NULL,
player_id int DEFAULT NULL,
fishyblock_created int DEFAULT NULL,
fishyblock_status text DEFAULT 'active',
fishyblock_material int DEFAULT NULL,
fishyblock_data int DEFAULT NULL,
fishyblock_enchantments text,
fishyblock_cost int DEFAULT NULL,
fishyblock_inventory int DEFAULT NULL,
fishyblock_world text DEFAULT NULL,
fishyblock_blockx int DEFAULT NULL,
fishyblock_blocky int DEFAULT NULL,
fishyblock_blockz int DEFAULT NULL,
fishyblock_signx int DEFAULT NULL,
fishyblock_signy int DEFAULT NULL,
fishyblock_signz int DEFAULT NULL,
fishyblock_storedenchants text DEFAULT '0'
);
--
-- Table structure for table fishyblock_costlog
--
DROP TABLE IF EXISTS fishyblock_costlog;
CREATE TABLE fishyblock_costlog (
costlog_id serial PRIMARY KEY NOT NULL,
fishyblock_id int DEFAULT NULL,
costlog_timestamp int DEFAULT NULL,
costlog_newcost int DEFAULT NULL,
costlog_oldcost int DEFAULT NULL
);
--
-- Table structure for table fishyblock_transaction
--
DROP TABLE IF EXISTS fishyblock_transaction;
DROP TYPE IF EXISTS transaction_type CASCADE;
CREATE TYPE transaction_type AS ENUM ('deposit','withdraw','buy');
CREATE TABLE fishyblock_transaction (
transaction_id serial PRIMARY KEY NOT NULL,
fishyblock_id int DEFAULT NULL,
player_id int DEFAULT NULL,
transaction_type text DEFAULT NULL,
transaction_timestamp int DEFAULT NULL,
transaction_amount int DEFAULT NULL,
transaction_unitcost int DEFAULT NULL,
transaction_totalcost int DEFAULT NULL
);
--
-- Table structure for table inventory
--
DROP TABLE IF EXISTS inventory;
DROP TYPE IF EXISTS inventory_type CASCADE;
CREATE TYPE inventory_type AS ENUM ('block','player','player_armor');
CREATE TABLE inventory (
inventory_id serial PRIMARY KEY NOT NULL,
player_id int DEFAULT NULL,
inventory_checksum int DEFAULT NULL,
inventory_x int DEFAULT NULL,
inventory_y int DEFAULT NULL,
inventory_z int DEFAULT NULL,
inventory_world text,
inventory_player text,
inventory_type text
);
--
-- Table structure for table inventory_accesslog
--
DROP TABLE IF EXISTS inventory_accesslog;
CREATE TABLE inventory_accesslog (
accesslog_id serial PRIMARY KEY NOT NULL,
inventory_id int DEFAULT NULL,
player_id int DEFAULT NULL,
accesslog_timestamp int DEFAULT NULL
);
--
-- Table structure for table inventory_changelog
--
DROP TABLE IF EXISTS inventory_changelog;
DROP TYPE IF EXISTS changelog_type CASCADE;
CREATE TYPE changelog_type AS ENUM ('add','remove');
CREATE TABLE inventory_changelog (
changelog_id serial PRIMARY KEY NOT NULL,
inventory_id int DEFAULT NULL,
player_id int DEFAULT NULL,
changelog_timestamp int DEFAULT NULL,
changelog_slot int DEFAULT NULL,
changelog_material int DEFAULT NULL,
changelog_data int DEFAULT NULL,
changelog_meta text,
changelog_amount int DEFAULT NULL,
changelog_type text DEFAULT NULL
);
--
-- Table structure for table inventory_item
--
DROP TABLE IF EXISTS inventory_item;
CREATE TABLE inventory_item (
inventory_id int NOT NULL,
item_slot int NOT NULL,
item_material text DEFAULT 'AIR',
item_data int DEFAULT 0,
item_meta text,
item_count int DEFAULT 0
);
--
-- Table structure for table item
--
DROP TABLE IF EXISTS item;
CREATE TABLE item (
item_id int UNIQUE DEFAULT NULL,
item_name text,
item_value int DEFAULT NULL
);
--
-- Table structure for table mentorlog
--
DROP TABLE IF EXISTS mentorlog;
DROP TYPE IF EXISTS mentorlog_status CASCADE;
CREATE TYPE mentorlog_status AS ENUM ('started','completed','cancelled');
CREATE TABLE mentorlog (
mentorlog_id serial NOT NULL,
student_id int DEFAULT NULL,
mentor_id int DEFAULT NULL,
mentorlog_resumed int DEFAULT '0',
mentorlog_startedtime int DEFAULT NULL,
mentorlog_completedtime int DEFAULT '0',
mentorlog_cancelledtime int DEFAULT '0',
mentorlog_status text DEFAULT 'started',
mentorlog_channel text DEFAULT NULL,
PRIMARY KEY (mentorlog_id),
UNIQUE (student_id,mentor_id),
UNIQUE (mentor_id,student_id)
);
--
-- Table structure for table motd
--
DROP TABLE IF EXISTS motd;
CREATE TABLE motd (
motd_id serial NOT NULL,
motd_timestamp int NOT NULL,
motd_message text,
PRIMARY KEY (motd_id)
);
--
-- Table structure for table player
--
DROP TABLE IF EXISTS player;
DROP TYPE IF EXISTS player_confirmed CASCADE;
CREATE TYPE player_confirmed AS ENUM ('0','1');
CREATE TABLE player (
player_id serial NOT NULL,
player_name text,
player_password text,
player_email text,
player_uuid text UNIQUE,
player_confirmed text DEFAULT '0',
player_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
player_wallet bigint DEFAULT '50000',
player_rank text DEFAULT 'unverified',
player_flags int DEFAULT NULL,
player_keywords text NOT NULL,
player_ignore text DEFAULT NULL,
player_inventory text DEFAULT NULL,
PRIMARY KEY (player_id)
);
--
-- Table structure for table playerinventory
--
DROP TABLE IF EXISTS playerinventory;
CREATE TABLE playerinventory (
playerinventory_id serial NOT NULL,
player_id int NOT NULL,
playerinventory_name text DEFAULT NULL,
playerinventory_type text NOT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table playerinventory_item
--
DROP TABLE IF EXISTS playerinventory_item;
CREATE TABLE playerinventory_item (
playerinventory_id int DEFAULT NULL,
item_slot int DEFAULT NULL,
item_material varchar DEFAULT NULL,
item_data int DEFAULT NULL,
item_meta text,
item_count int DEFAULT NULL,
item_durability int DEFAULT NULL
);
--
-- Table structure for table player_badge
--
DROP TABLE IF EXISTS player_badge;
CREATE TABLE player_badge (
badge_id serial NOT NULL,
player_id int NOT NULL,
badge_name text NOT NULL,
badge_level int NOT NULL DEFAULT '0',
badge_timestamp int NOT NULL,
PRIMARY KEY (badge_id),
UNIQUE (player_id,badge_name)
);
--
-- Table structure for table player_chatlog
--
DROP TABLE IF EXISTS player_chatlog;
CREATE TABLE player_chatlog (
chatlog_id serial NOT NULL,
player_id int DEFAULT NULL,
chatlog_timestamp int DEFAULT NULL,
chatlog_channel text DEFAULT NULL,
chatlog_message text DEFAULT NULL,
PRIMARY KEY (chatlog_id)
);
--
-- Table structure for table player_givelog
--
DROP TABLE IF EXISTS player_givelog;
CREATE TABLE player_givelog (
givelog_id serial NOT NULL,
sender_id int DEFAULT NULL,
recipient_id int DEFAULT NULL,
givelog_material int DEFAULT NULL,
givelog_data int DEFAULT NULL,
givelog_meta text,
givelog_count int DEFAULT NULL,
givelog_timestamp int DEFAULT NULL,
PRIMARY KEY (givelog_id)
);
--
-- Table structure for table player_home
--
DROP TABLE IF EXISTS player_home;
CREATE TABLE player_home (
home_id serial NOT NULL,
player_id int DEFAULT NULL,
home_name text,
home_x float DEFAULT NULL,
home_y float DEFAULT NULL,
home_z float DEFAULT NULL,
home_pitch float DEFAULT NULL,
home_yaw float DEFAULT NULL,
home_world text,
home_time float DEFAULT NULL,
PRIMARY KEY (home_id)
);
--
-- Table structure for table player_login
--
DROP TABLE IF EXISTS player_login;
DROP TYPE IF EXISTS login_action CASCADE;
CREATE TYPE login_action AS ENUM ('login','logout');
CREATE TABLE player_login (
login_id serial NOT NULL,
player_id int DEFAULT NULL,
login_timestamp int DEFAULT NULL,
login_action text DEFAULT NULL,
login_country text,
login_city text,
login_ip text,
login_hostname text,
login_onlineplayers int DEFAULT NULL,
PRIMARY KEY (login_id)
);
--
-- Table structure for table player_orelog
--
DROP TABLE IF EXISTS player_orelog;
CREATE TABLE player_orelog (
orelog_id serial NOT NULL,
player_id int DEFAULT NULL,
orelog_material int DEFAULT NULL,
orelog_timestamp int DEFAULT NULL,
orelog_x int DEFAULT NULL,
orelog_y int DEFAULT NULL,
orelog_z int DEFAULT NULL,
orelog_world text DEFAULT NULL,
PRIMARY KEY (orelog_id)
);
--
-- Table structure for table player_property
--
DROP TABLE IF EXISTS player_property;
CREATE TABLE player_property (
player_id int NOT NULL DEFAULT '0',
property_key text NOT NULL DEFAULT '',
property_value text,
property_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (player_id,property_key)
);
--
-- Table structure for table player_report
--
DROP TABLE IF EXISTS player_report;
DROP TYPE IF EXISTS report_action CASCADE;
CREATE TYPE report_action AS ENUM ('kick','softwarn','hardwarn','ban','comment');
CREATE TABLE player_report (
report_id serial NOT NULL,
subject_id int NOT NULL,
issuer_id int NOT NULL,
report_action text NOT NULL,
report_message text NOT NULL,
report_timestamp time NOT NULL DEFAULT NOW(),
report_validuntil int DEFAULT NULL,
PRIMARY KEY (report_id)
);
--
-- Table structure for table player_transaction
--
DROP TABLE IF EXISTS player_transaction;
CREATE TABLE player_transaction (
transaction_id serial NOT NULL,
sender_id int DEFAULT NULL,
recipient_id int DEFAULT NULL,
transaction_timestamp int DEFAULT NULL,
transaction_amount int DEFAULT NULL,
PRIMARY KEY (transaction_id)
);
--
-- Table structure for table player_webcookie
--
DROP TABLE IF EXISTS player_webcookie;
CREATE TABLE player_webcookie (
webcookie_id serial NOT NULL,
player_id int DEFAULT NULL,
webcookie_nonce text DEFAULT NULL,
PRIMARY KEY (webcookie_id),
UNIQUE (webcookie_nonce)
);
--
-- Table structure for table shorturl
--
DROP TABLE IF EXISTS shorturl;
CREATE TABLE shorturl (
urlID serial NOT NULL,
link text NOT NULL,
PRIMARY KEY (urlID)
);
--
-- Table structure for table stats_blocks
--
DROP TABLE IF EXISTS stats_blocks;
CREATE TABLE stats_blocks (
checksum float NOT NULL,
player text NOT NULL,
x int NOT NULL,
y int NOT NULL,
z int NOT NULL,
time float NOT NULL,
status smallint NOT NULL,
blockid float NOT NULL,
world text NOT NULL DEFAULT 'world'
);
--
-- Table structure for table trade
--
DROP TABLE IF EXISTS trade;
CREATE TABLE trade (
trade_id serial NOT NULL,
sender_id int DEFAULT NULL,
recipient_id int DEFAULT NULL,
trade_timestamp int DEFAULT NULL,
trade_amount int DEFAULT NULL,
PRIMARY KEY (trade_id)
);
--
-- Table structure for table trade_item
--
DROP TABLE IF EXISTS trade_item;
CREATE TABLE trade_item (
item_id serial NOT NULL,
trade_id int DEFAULT NULL,
item_material text DEFAULT NULL,
item_data int DEFAULT NULL,
item_meta text,
item_count int DEFAULT NULL,
PRIMARY KEY (item_id)
);
--
-- Table structure for table version
--
DROP TABLE IF EXISTS version;
CREATE TABLE version (
version_id serial NOT NULL,
version_number text NOT NULL,
version_string text,
PRIMARY KEY (version_id)
);
--
-- Table structure for table warp
--
DROP TABLE IF EXISTS warp;
CREATE TABLE warp (
warp_id serial NOT NULL,
warp_name text,
warp_x float DEFAULT NULL,
warp_y float DEFAULT NULL,
warp_z float DEFAULT NULL,
warp_pitch float DEFAULT NULL,
warp_yaw float DEFAULT NULL,
warp_world text,
PRIMARY KEY (warp_id),
UNIQUE (warp_name)
);
--
-- Table structure for table warp_log
--
DROP TABLE IF EXISTS warp_log;
CREATE TABLE warp_log (
log_id serial NOT NULL,
player_id int DEFAULT NULL,
warp_id int DEFAULT NULL,
log_timestamp int DEFAULT NULL,
PRIMARY KEY (log_id)
);
--
-- Table structure for table zone
--
DROP TABLE IF EXISTS zone;
CREATE TABLE zone (
zone_id serial NOT NULL,
zone_world text NOT NULL DEFAULT 'world',
zone_name text UNIQUE NOT NULL,
zone_enterdefault text NOT NULL DEFAULT '1',
zone_placedefault text NOT NULL DEFAULT '1',
zone_destroydefault text NOT NULL DEFAULT '1',
zone_pvp text NOT NULL DEFAULT '0',
zone_hostiles text DEFAULT '1',
zone_communist text DEFAULT '0',
zone_publicprofile text DEFAULT '0',
zone_entermessage text NOT NULL,
zone_exitmessage text NOT NULL,
zone_texture text,
zone_owner text,
zone_flags int DEFAULT '0',
PRIMARY KEY (zone_id)
);
--
-- Table structure for table zone_lot
--
DROP TABLE IF EXISTS zone_lot;
CREATE TABLE zone_lot (
lot_id serial NOT NULL,
zone_id int NOT NULL,
lot_name text NOT NULL,
lot_x1 int NOT NULL,
lot_y1 int NOT NULL,
lot_x2 int NOT NULL,
lot_y2 int NOT NULL,
special int DEFAULT NULL,
lot_flags int NOT NULL DEFAULT '3',
PRIMARY KEY (lot_id)
);
--
-- Table structure for table zone_lotuser
--
DROP TABLE IF EXISTS zone_lotuser;
CREATE TABLE zone_lotuser (
lot_id int NOT NULL DEFAULT '0',
user_id int NOT NULL DEFAULT '0',
PRIMARY KEY (lot_id,user_id)
);
--
-- Table structure for table zone_profile
--
DROP TABLE IF EXISTS zone_profile;
CREATE TABLE zone_profile (
profile_id serial NOT NULL,
zone_id int DEFAULT NULL,
player_id int DEFAULT NULL,
profile_timestamp int DEFAULT NULL,
profile_text text,
PRIMARY KEY (profile_id)
);
--
-- Table structure for table zone_rect
--
DROP TABLE IF EXISTS zone_rect;
CREATE TABLE zone_rect (
rect_id serial NOT NULL,
zone_id int DEFAULT NULL,
rect_x1 int DEFAULT NULL,
rect_y1 int DEFAULT NULL,
rect_x2 int DEFAULT NULL,
rect_y2 int DEFAULT NULL,
PRIMARY KEY (rect_id)
);
--
-- Table structure for table zone_user
--
DROP TABLE IF EXISTS zone_user;
DROP TYPE IF EXISTS user_perm CASCADE;
CREATE TYPE user_perm AS ENUM ('owner','maker','allowed','banned');
CREATE TABLE zone_user (
zone_id int NOT NULL DEFAULT '0',
user_id int NOT NULL DEFAULT '0',
user_perm text NOT NULL DEFAULT 'allowed',
PRIMARY KEY (zone_id,user_id)
);
--
-- Table structure for table misc_message
--
DROP TABLE IF EXISTS misc_message;
CREATE TABLE misc_message (
message_type text NOT NULL,
message_value text NOT NULL
);
--
-- Table structure for table bank
--
DROP TABLE IF EXISTS bank;
CREATE TABLE bank (
bank_id serial PRIMARY KEY NOT NULL,
lot_id int DEFAULT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table bank_account
--
DROP TABLE IF EXISTS bank_account;
CREATE TABLE bank_account (
account_id serial PRIMARY KEY NOT NULL,
bank_id int DEFAULT NULL,
player_id int DEFAULT NULL,
account_balance int DEFAULT 0,
account_number int DEFAULT NULL,
account_pin varchar DEFAULT NULL
);
-- --------------------------------------------------------
--
-- Table structure for table bank_transaction
--
DROP TABLE IF EXISTS bank_transaction;
CREATE TABLE bank_transaction (
transaction_id serial PRIMARY KEY NOT NULL,
account_id int NOT NULL,
player_id int NOT NULL,
transaction_type varchar NOT NULL,
transaction_amount int NOT NULL,
transaction_timestamp int NOT NULL
);
-- Dump completed on 2013-12-10 22:18:14