From a894af35f20a6f7c0b1d86e3f9b35863cea75d2d Mon Sep 17 00:00:00 2001 From: Blue112 Date: Sun, 19 Apr 2009 19:01:28 +0200 Subject: Mysql Backend Update mysql database to version 3 Fixed compile error with mysql backend --- src/dal/mysqldataprovider.h | 1 + src/sql/mysql/createTables.sql | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/dal/mysqldataprovider.h b/src/dal/mysqldataprovider.h index c5b796f5..ef0f4cfc 100644 --- a/src/dal/mysqldataprovider.h +++ b/src/dal/mysqldataprovider.h @@ -28,6 +28,7 @@ #include #endif #include +#include #include "dataprovider.h" #include "common/configuration.hpp" diff --git a/src/sql/mysql/createTables.sql b/src/sql/mysql/createTables.sql index 5d412095..7b533c7b 100644 --- a/src/sql/mysql/createTables.sql +++ b/src/sql/mysql/createTables.sql @@ -158,7 +158,7 @@ DEFAULT CHARSET=utf8; INSERT INTO tmw_world_states VALUES('accountserver_startup',NULL,NULL,UNIX_TIMESTAMP()); INSERT INTO tmw_world_states VALUES('accountserver_version',NULL,NULL,UNIX_TIMESTAMP()); -INSERT INTO tmw_world_states VALUES('database_version', NULL,'2', UNIX_TIMESTAMP()); +INSERT INTO tmw_world_states VALUES('database_version', NULL,'3', UNIX_TIMESTAMP()); -- -- table: `tmw_guilds` @@ -335,4 +335,12 @@ AS JOIN tmw_characters c ON l.char_id = c.id; - \ No newline at end of file + +CREATE TABLE tmw_transactions +( + id INTEGER PRIMARY KEY, + char_id INTEGER NOT NULL, + action INTEGER NOT NULL, + message TEXT, + time INTEGER NOT NULL +); \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 85bf3af943be6c4cee137c214fb7015ce8fd466a Mon Sep 17 00:00:00 2001 From: Blue112 Date: Sun, 19 Apr 2009 19:12:01 +0200 Subject: Update script mysql 2 to 3 --- src/sql/mysql/updates/update_2_to_3.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/sql/mysql/updates/update_2_to_3.sql (limited to 'src') diff --git a/src/sql/mysql/updates/update_2_to_3.sql b/src/sql/mysql/updates/update_2_to_3.sql new file mode 100644 index 00000000..4edd398f --- /dev/null +++ b/src/sql/mysql/updates/update_2_to_3.sql @@ -0,0 +1,16 @@ + +-- add table tmw_transactions to store transactional history +CREATE TABLE tmw_transactions +( + id INTEGER PRIMARY KEY, + char_id INTEGER NOT NULL, + action INTEGER NOT NULL, + message TEXT, + time INTEGER NOT NULL +); + +-- update the database version, and set date of update +UPDATE tmw_world_states + SET value = '3', + moddate = UNIX_TIMESTAMP() + WHERE state_name = 'database_version'; \ No newline at end of file -- cgit v1.2.3-70-g09d2 From e26e524ad739dafd99954add3c2f35842e9fb6ec Mon Sep 17 00:00:00 2001 From: blue112 Date: Mon, 20 Apr 2009 15:40:38 +0200 Subject: Mysql update file Update file... updated ^^' You can execute it a second time, there's no problem. --- src/sql/mysql/createTables.sql | 17 +++++++++-------- src/sql/mysql/updates/update_2_to_3.sql | 16 +++++++++------- 2 files changed, 18 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/sql/mysql/createTables.sql b/src/sql/mysql/createTables.sql index 7b533c7b..306e7c0a 100644 --- a/src/sql/mysql/createTables.sql +++ b/src/sql/mysql/createTables.sql @@ -336,11 +336,12 @@ AS ON l.char_id = c.id; -CREATE TABLE tmw_transactions -( - id INTEGER PRIMARY KEY, - char_id INTEGER NOT NULL, - action INTEGER NOT NULL, - message TEXT, - time INTEGER NOT NULL -); \ No newline at end of file +CREATE TABLE IF NOT EXISTS `tmw_transactions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `char_id` int(11) NOT NULL, + `action` int(11) NOT NULL, + `message` text, + `time` int(11) NOT NULL, + PRIMARY KEY (`id`) +) +AUTO_INCREMENT=0 ; \ No newline at end of file diff --git a/src/sql/mysql/updates/update_2_to_3.sql b/src/sql/mysql/updates/update_2_to_3.sql index 4edd398f..feb8ee2a 100644 --- a/src/sql/mysql/updates/update_2_to_3.sql +++ b/src/sql/mysql/updates/update_2_to_3.sql @@ -1,13 +1,15 @@ -- add table tmw_transactions to store transactional history -CREATE TABLE tmw_transactions -( - id INTEGER PRIMARY KEY, - char_id INTEGER NOT NULL, - action INTEGER NOT NULL, - message TEXT, - time INTEGER NOT NULL +CREATE TABLE IF NOT EXISTS `tmw_transactions` ( + `id` int(11) NOT NULL, + `char_id` int(11) NOT NULL, + `action` int(11) NOT NULL, + `message` text, + `time` int(11) NOT NULL, + PRIMARY KEY (`id`) ); + +ALTER TABLE `tmw_transactions` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT; -- update the database version, and set date of update UPDATE tmw_world_states -- cgit v1.2.3-70-g09d2