· 6 years ago · Sep 08, 2019, 10:28 AM
1CREATE TABLE IF NOT EXISTS `items` (
2 `item_uid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
3 `itemtype` smallint(6) NOT NULL,
4 `count` smallint(5) NOT NULL,
5 `attributes` blob NOT NULL,
6 PRIMARY KEY (`item_uid`)
7) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
8
9CREATE TABLE IF NOT EXISTS `items_timestamps` (
10 `item_uid` bigint(20) unsigned NOT NULL,
11 `created` bigint(20) unsigned NOT NULL DEFAULT '0',
12 `updated` bigint(20) unsigned NOT NULL DEFAULT '0',
13 `expired` bigint(20) unsigned NOT NULL DEFAULT '0'
14 FOREIGN KEY (`item_uid`) REFERENCES `items`(`item_uid`) ON DELETE CASCADE
15) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
16
17CREATE TABLE IF NOT EXISTS `player_depotitems` (
18 `player_id` int(11) NOT NULL,
19 `sid` int(11) NOT NULL COMMENT 'any given range eg 0-100 will be reserved for depot lockers and all > 100 will be then normal items inside depots',
20 `pid` int(11) NOT NULL DEFAULT '0',
21 `item_uid` bigint(20) unsigned NOT NULL,
22 UNIQUE KEY `player_id_2` (`player_id`, `sid`),
23 FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE,
24 FOREIGN KEY (`item_uid`) REFERENCES `items`(`item_uid`) ON DELETE CASCADE
25) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
26
27CREATE TABLE IF NOT EXISTS `player_inboxitems` (
28 `player_id` int(11) NOT NULL,
29 `sid` int(11) NOT NULL,
30 `pid` int(11) NOT NULL DEFAULT '0',
31 `item_uid` bigint(20) unsigned NOT NULL,
32 UNIQUE KEY `player_id_2` (`player_id`, `sid`),
33 FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE,
34 FOREIGN KEY (`item_uid`) REFERENCES `items`(`item_uid`) ON DELETE CASCADE
35) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
36
37CREATE TABLE IF NOT EXISTS `player_items` (
38 `player_id` int(11) NOT NULL DEFAULT '0',
39 `pid` int(11) NOT NULL DEFAULT '0',
40 `sid` int(11) NOT NULL DEFAULT '0',
41 `item_uid` bigint(20) unsigned NOT NULL,
42 FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON DELETE CASCADE,
43 FOREIGN KEY (`item_uid`) REFERENCES `items`(`item_uid`) ON DELETE CASCADE,
44 KEY `sid` (`sid`)
45) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;