Updated MySQL scripts to make use of UTF-8

This commit is contained in:
Timo Smit 2017-03-21 18:54:33 +01:00
parent 875da02712
commit 3927788b66
2 changed files with 20 additions and 7 deletions

View file

@ -2,14 +2,14 @@ CREATE TABLE IF NOT EXISTS `level` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`name` varchar(64) DEFAULT NULL, `name` varchar(64) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE IF NOT EXISTS `level_role` ( CREATE TABLE IF NOT EXISTS `level_role` (
`level_id` int(11) NOT NULL, `level_id` int(11) NOT NULL,
`role` varchar(32) NOT NULL, `role` varchar(32) NOT NULL,
PRIMARY KEY (`level_id`,`role`), PRIMARY KEY (`level_id`,`role`),
CONSTRAINT `level_role_level` FOREIGN KEY (`level_id`) REFERENCES `level` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION CONSTRAINT `level_role_level` FOREIGN KEY (`level_id`) REFERENCES `level` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE IF NOT EXISTS `player` ( CREATE TABLE IF NOT EXISTS `player` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS `player` (
UNIQUE KEY `guid` (`guid`), UNIQUE KEY `guid` (`guid`),
KEY `player_level_idx` (`level_id`), KEY `player_level_idx` (`level_id`),
CONSTRAINT `player_level` FOREIGN KEY (`level_id`) REFERENCES `level` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION CONSTRAINT `player_level` FOREIGN KEY (`level_id`) REFERENCES `level` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE IF NOT EXISTS `alias` ( CREATE TABLE IF NOT EXISTS `alias` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@ -34,7 +34,7 @@ CREATE TABLE IF NOT EXISTS `alias` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `player_idx` (`player_id`), KEY `player_idx` (`player_id`),
CONSTRAINT `alias_player` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION CONSTRAINT `alias_player` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE IF NOT EXISTS `history` ( CREATE TABLE IF NOT EXISTS `history` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@ -48,7 +48,7 @@ CREATE TABLE IF NOT EXISTS `history` (
KEY `history_invoker_idx` (`invoker_id`), KEY `history_invoker_idx` (`invoker_id`),
CONSTRAINT `history_invoker` FOREIGN KEY (`invoker_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `history_invoker` FOREIGN KEY (`invoker_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `history_victim` FOREIGN KEY (`victim_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION CONSTRAINT `history_victim` FOREIGN KEY (`victim_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE IF NOT EXISTS `mute` ( CREATE TABLE IF NOT EXISTS `mute` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@ -86,7 +86,7 @@ CREATE TABLE IF NOT EXISTS `map` (
`name` varchar(128) NOT NULL, `name` varchar(128) NOT NULL,
`lastplayed` int(10) unsigned NOT NULL, `lastplayed` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE IF NOT EXISTS `record` ( CREATE TABLE IF NOT EXISTS `record` (
`map_id` int(10) unsigned NOT NULL, `map_id` int(10) unsigned NOT NULL,
@ -98,7 +98,7 @@ CREATE TABLE IF NOT EXISTS `record` (
KEY `player_idx` (`player_id`), 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_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 CONSTRAINT `record_player` FOREIGN KEY (`player_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- add levels -- add levels
INSERT INTO `level` (`id`, `name`) VALUES (0, 'Guest'); INSERT INTO `level` (`id`, `name`) VALUES (0, 'Guest');

View file

@ -323,3 +323,16 @@ CREATE TABLE IF NOT EXISTS `ban` (
CONSTRAINT `ban_invoker` FOREIGN KEY (`invoker_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `ban_invoker` FOREIGN KEY (`invoker_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `ban_victim` FOREIGN KEY (`victim_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION CONSTRAINT `ban_victim` FOREIGN KEY (`victim_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- update existing tables to UTF-8
ALTER TABLE `alias`
CHARACTER SET = utf8, COLLATE = utf8_unicode_ci;
ALTER TABLE `player`
CHARACTER SET = utf8, COLLATE = utf8_unicode_ci;
ALTER TABLE `map`
CHARACTER SET = utf8, COLLATE = utf8_unicode_ci;
ALTER TABLE `record`
CHARACTER SET = utf8, COLLATE = utf8_unicode_ci;