wolfadmin/database/new/wolfadmin_mysql.sql

67 lines
2.9 KiB
MySQL
Raw Normal View History

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`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
2016-02-13 11:19:37 +00:00
CREATE TABLE IF NOT EXISTS `alias` (
2016-02-13 11:19:37 +00:00
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`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`),
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
CREATE TABLE IF NOT EXISTS `level` (
2016-02-13 11:19:37 +00:00
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`player_id` int(10) unsigned NOT NULL,
2016-02-13 11:19:37 +00:00
`level` int(11) NOT NULL,
`admin_id` int(10) unsigned NOT NULL,
2016-02-13 11:19:37 +00:00
`datetime` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
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
CREATE TABLE IF NOT EXISTS `warn` (
2016-02-13 11:19:37 +00:00
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`player_id` int(10) unsigned NOT NULL,
2016-02-13 11:19:37 +00:00
`reason` varchar(128) NOT NULL,
`admin_id` int(10) unsigned NOT NULL,
2016-02-13 11:19:37 +00:00
`datetime` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
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
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`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
2016-02-13 11:19:37 +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,
`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;
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);