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 ,-)

(cherry picked from commit 352012e531)
(cherry picked from commit 1f7f9feafc)

For 3.3.5:
* Synchronized ConfigureBoost.cmake with 6.x, libboost-filesystem1.55-dev also added as dependency!

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 20:11:23 +01:00
committed by Nayd
parent 236e43443c
commit 2bd1c8541d
122 changed files with 6736 additions and 138 deletions

View File

@@ -2546,3 +2546,39 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2014-10-18 18:02:06
-- 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/3.3.5a/characters', 'ARCHIVED');
INSERT IGNORE INTO `updates` (`name`, `hash`) VALUES
('2015_03_20_00_characters.sql', 'B761760804EA73BD297F296C5C1919687DF7191C'),
('2015_03_20_01_characters.sql', '894F08B70449A5481FFAF394EE5571D7FC4D8A3A'),
('2015_03_20_02_characters.sql', '');