diff options
author | Naios <naios-dev@live.de> | 2015-03-21 00:25:21 +0100 |
---|---|---|
committer | Nayd <dnpd.dd@gmail.com> | 2015-03-21 14:09:38 +0000 |
commit | 352012e53173372ebc82898e1b6854c983b01b25 (patch) | |
tree | d5e89b1d42749075fe38fec76148129657e4bbaf /sql/base/hotfixes_database.sql | |
parent | 127d8a2bcc5acdcc909c7812a53e40d8dc79e437 (diff) |
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>
Diffstat (limited to 'sql/base/hotfixes_database.sql')
-rw-r--r-- | sql/base/hotfixes_database.sql | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/sql/base/hotfixes_database.sql b/sql/base/hotfixes_database.sql new file mode 100644 index 00000000000..61ec102c295 --- /dev/null +++ b/sql/base/hotfixes_database.sql @@ -0,0 +1,56 @@ +-- MySQL dump 10.13 Distrib 5.6.9-rc, for Win64 (x86_64) +-- +-- Host: localhost Database: hotfixes +-- ------------------------------------------------------ +-- Server version 5.6.9-rc + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- Dump completed on 2014-10-19 23:50:46 + +-- Workaround for the update system +-- As long as no full hotfix db exists + +-- 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; + +-- Hotfixes database update data +TRUNCATE TABLE `updates_include`; +INSERT INTO `updates_include` (`path`, `state`) VALUES +('$/sql/updates/hotfixes', 'RELEASED'), +('$/sql/custom/hotfixes', 'RELEASED'), +('$/sql/old/6.x/hotfixes', 'ARCHIVED'); + +INSERT IGNORE INTO `updates` (`name`, `hash`) VALUES +('2015_03_20_00_hotfixes.sql', 'B761760804EA73BD297F296C5C1919687DF7191C'), +('2015_03_20_01_hotfixes.sql', 'A79521F16AE82F0D7487495D0BF7A726D81F250D'); |