Core/Updates: Add an automatic database update system. Automatically detects new and edited sql updates through file lists and hashing. Detects renames, deletes and is able to create and auto import full databases. * cleanups in main.cpp of world & bnetserver * refactoring in DatabaseWorkerPool.h & MySQLConnection.cpp

Make sure you re-run cmake, because boost::iostreams was added as dependency.
Maybe you need to install libboost-iostreams1.55-dev on unix as well.

Import every update manual until (included) those INSERT IGNORE updates for each database.

Thanks DDuarte and Shauren for your amazing ideas, help and advises.

In hope that nobody gets a "Your database structure is not up to date..." anymore ,-)

Signed-off-by: Naios <naios-dev@live.de>
Signed-off-by: Nayd <dnpd.dd@gmail.com>
This commit is contained in:
Naios
2015-03-21 00:25:21 +01:00
committed by Nayd
parent 127d8a2bcc
commit 352012e531
129 changed files with 6737 additions and 182 deletions

View File

@@ -2986,3 +2986,58 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2015-01-27 22:41:44
-- Updates base tables
DROP TABLE IF EXISTS `updates`;
CREATE TABLE `updates` (
`name` VARCHAR(200) NOT NULL COMMENT 'filename with extension of the update.',
`hash` CHAR(40) NULL DEFAULT '' COMMENT 'sha1 hash of the sql file.',
`state` ENUM('RELEASED','ARCHIVED') NOT NULL DEFAULT 'RELEASED' COMMENT 'defines if an update is released or archived.',
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'timestamp when the query was applied.',
`speed` INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'time the query takes to apply in ms.',
PRIMARY KEY (`name`)
)
COMMENT='List of all applied updates in this database.'
COLLATE='utf8_general_ci'
ENGINE=MyISAM;
DROP TABLE IF EXISTS `updates_include`;
CREATE TABLE `updates_include` (
`path` VARCHAR(200) NOT NULL COMMENT 'directory to include. $ means relative to the source directory.',
`state` ENUM('RELEASED','ARCHIVED') NOT NULL DEFAULT 'RELEASED' COMMENT 'defines if the directory contains released or archived updates.',
PRIMARY KEY (`path`)
)
COMMENT='List of directories where we want to include sql updates.'
COLLATE='utf8_general_ci'
ENGINE=MyISAM;
-- Characters database update data
TRUNCATE TABLE `updates_include`;
INSERT INTO `updates_include` (`path`, `state`) VALUES
('$/sql/updates/characters', 'RELEASED'),
('$/sql/custom/characters', 'RELEASED'),
('$/sql/old/6.x/characters', 'ARCHIVED');
INSERT IGNORE INTO `updates` (`name`, `hash`) VALUES
('2014_10_20_00_characters.sql', 'A5882DA0979CF4DAE33DA011EBAA006C24BE7230'),
('2014_10_23_00_characters.sql', 'E2AC4758133EE19B7F08464A445802154D1261C8'),
('2014_10_23_01_characters.sql', '20029E6323D9773B32C34D84FFED1711CC60F09F'),
('2014_10_23_02_characters.sql', '8A7A16886EE71E7ACDDB3DDA6D0ECAC2FD2FDCA8'),
('2014_10_24_00_characters.sql', 'D008FE81AE844FCA686439D6ECC5108FB0DD1EB9'),
('2014_10_25_00_characters.sql', 'A39C7BE46686B54776BDAB9D7A882D91EDEC51A4'),
('2014_10_26_00_characters.sql', 'C787954CC35FE34B4101FDE6527F14C027F4947C'),
('2014_11_12_00_characters.sql', 'B160BB2313F1BD5F3B076A5A9279DC10D4796E34'),
('2014_12_23_00_characters.sql', '3D9D648B2387B357F4BD090B33F80682F7924882'),
('2014_12_28_00_characters.sql', '5362922FF4483A336311D73082A5727309CD9219'),
('2014_12_31_00_characters.sql', '498DDF2DD936CF156D74A8208DC93DCE9FCAB5AA'),
('2015_01_02_00_characters.sql', 'E5940BE836F253982E07930120422E598D08BDE1'),
('2015_01_10_00_characters.sql', '30796056C8623699B2FE1BF626A19D38262E9284'),
('2015_01_16_00_characters.sql', '96642760A54C8D799AAFE438049A63AA521656F2'),
('2015_01_27_00_characters.sql', 'EB710E3EB9F2CAFD84AB62CDC84E898403A80A4F'),
('2015_02_13_00_characters.sql', '405BEB4ED207DC6076442A37EE2AFB1F21E274A0'),
('2015_02_13_01_characters.sql', '35F582D4F33BF55D1685A1BA89273ED895FD09C5'),
('2015_02_17_00_characters.sql', '8D21FC5A55BF8B55D6DCDCE5F02CF2B640230E94'),
('2015_03_10_00_characters.sql', 'E565B89B145C340067742DFF2DEF1B74F5F1BD4E'),
('2015_03_20_00_characters.sql', 'B761760804EA73BD297F296C5C1919687DF7191C'),
('2015_03_20_01_characters.sql', '20BD68468C57FCF7E665B4DA185DCD52FACE8B3F'),
('2015_03_20_02_characters.sql', '');