2016-03-09 10:32:57 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS `player` (
|
2016-02-13 11:19:37 +00:00
|
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
|
|
`guid` char(32) NOT NULL,
|
|
|
|
`ip` varchar(40) NOT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
UNIQUE KEY `guid` (`guid`)
|
2016-03-09 10:32:57 +00:00
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
2016-02-13 11:19:37 +00:00
|
|
|
|
2016-03-09 10:32:57 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS `alias` (
|
2016-02-13 11:19:37 +00:00
|
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
2016-03-09 10:32:57 +00:00
|
|
|
`player_id` int(10) unsigned NOT NULL,
|
2016-02-13 11:19:37 +00:00
|
|
|
`alias` varchar(128) NOT NULL,
|
|
|
|
`cleanalias` varchar(128) NOT NULL,
|
|
|
|
`lastused` int(10) unsigned NOT NULL,
|
|
|
|
`used` int(10) unsigned NOT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
2016-03-09 10:32:57 +00:00
|
|
|
KEY `player_idx` (`player_id`),
|
|
|
|
CONSTRAINT `alias_player` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
2016-02-13 11:19:37 +00:00
|
|
|
|
2016-03-09 10:32:57 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS `level` (
|
2016-02-13 11:19:37 +00:00
|
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
2016-03-09 10:32:57 +00:00
|
|
|
`player_id` int(10) unsigned NOT NULL,
|
2016-02-13 11:19:37 +00:00
|
|
|
`level` int(11) NOT NULL,
|
2016-03-09 10:32:57 +00:00
|
|
|
`admin_id` int(10) unsigned NOT NULL,
|
2016-02-13 11:19:37 +00:00
|
|
|
`datetime` int(10) unsigned NOT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
2016-03-09 10:32:57 +00:00
|
|
|
KEY `player_idx` (`player_id`),
|
|
|
|
KEY `admin_idx` (`admin_id`),
|
|
|
|
CONSTRAINT `level_player` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
|
|
CONSTRAINT `level_admin` FOREIGN KEY (`admin_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
2016-02-13 11:19:37 +00:00
|
|
|
|
2016-03-09 10:32:57 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS `warn` (
|
2016-02-13 11:19:37 +00:00
|
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
2016-03-09 10:32:57 +00:00
|
|
|
`player_id` int(10) unsigned NOT NULL,
|
2016-02-13 11:19:37 +00:00
|
|
|
`reason` varchar(128) NOT NULL,
|
2016-03-09 10:32:57 +00:00
|
|
|
`admin_id` int(10) unsigned NOT NULL,
|
2016-02-13 11:19:37 +00:00
|
|
|
`datetime` int(10) unsigned NOT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
2016-03-09 10:32:57 +00:00
|
|
|
KEY `player_idx` (`player_id`),
|
|
|
|
KEY `admin_idx` (`admin_id`),
|
|
|
|
CONSTRAINT `warn_player` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
|
|
CONSTRAINT `warn_admin` FOREIGN KEY (`admin_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
2016-02-13 11:19:37 +00:00
|
|
|
|
2016-03-09 10:32:57 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS `map` (
|
2016-02-13 11:19:37 +00:00
|
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
|
|
`name` varchar(128) NOT NULL,
|
|
|
|
`lastplayed` int(10) unsigned NOT NULL,
|
|
|
|
PRIMARY KEY (`id`)
|
2016-03-09 10:32:57 +00:00
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
2016-02-13 11:19:37 +00:00
|
|
|
|
2016-03-09 10:32:57 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS `record` (
|
|
|
|
`map_id` int(10) unsigned NOT NULL,
|
2016-02-13 11:19:37 +00:00
|
|
|
`type` tinyint(3) unsigned NOT NULL,
|
|
|
|
`date` int(10) unsigned NOT NULL,
|
|
|
|
`record` smallint(5) unsigned NOT NULL,
|
2016-03-09 10:32:57 +00:00
|
|
|
`player_id` int(10) unsigned NOT NULL,
|
|
|
|
PRIMARY KEY (`map_id`,`type`),
|
|
|
|
KEY `player_idx` (`player_id`),
|
|
|
|
CONSTRAINT `record_map` FOREIGN KEY (`map_id`) REFERENCES `map` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
|
|
CONSTRAINT `record_player` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
2016-02-13 11:19:37 +00:00
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
|
|
|
|
2016-03-09 10:32:57 +00:00
|
|
|
INSERT INTO `player` (`id`, `guid`, `ip`) VALUES (1, 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', '127.0.0.1');
|
|
|
|
INSERT INTO `alias` (`id`, `player_id`, `alias`, `cleanalias`, `lastused`, `used`) VALUES (1, 1, 'console', 'console', 0, 0);
|