diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/account-server/storage.cpp | 2 | ||||
-rw-r--r-- | src/sql/mysql/createTables.sql | 2 | ||||
-rw-r--r-- | src/sql/mysql/updates/update_14_to_15.sql | 22 | ||||
-rw-r--r-- | src/sql/sqlite/createTables.sql | 2 | ||||
-rw-r--r-- | src/sql/sqlite/updates/update_14_to_15.sql | 21 |
5 files changed, 46 insertions, 3 deletions
diff --git a/src/account-server/storage.cpp b/src/account-server/storage.cpp index 05f8ec69..ef66c020 100644 --- a/src/account-server/storage.cpp +++ b/src/account-server/storage.cpp @@ -41,7 +41,7 @@ static const char *DEFAULT_ITEM_FILE = "items.xml"; // Defines the supported db version static const char *DB_VERSION_PARAMETER = "database_version"; -static const char *SUPPORTED_DB_VERSION = "14"; +static const char *SUPPORTED_DB_VERSION = "15"; /* * MySQL specificities: diff --git a/src/sql/mysql/createTables.sql b/src/sql/mysql/createTables.sql index d017ceee..041e88de 100644 --- a/src/sql/mysql/createTables.sql +++ b/src/sql/mysql/createTables.sql @@ -421,7 +421,7 @@ AUTO_INCREMENT=0 ; INSERT INTO mana_world_states VALUES('accountserver_startup',NULL,NULL, NOW()); INSERT INTO mana_world_states VALUES('accountserver_version',NULL,NULL, NOW()); -INSERT INTO mana_world_states VALUES('database_version', NULL,'14', NOW()); +INSERT INTO mana_world_states VALUES('database_version', NULL,'15', NOW()); -- all known transaction codes diff --git a/src/sql/mysql/updates/update_14_to_15.sql b/src/sql/mysql/updates/update_14_to_15.sql new file mode 100644 index 00000000..1036817b --- /dev/null +++ b/src/sql/mysql/updates/update_14_to_15.sql @@ -0,0 +1,22 @@ + +-- Dropping the table will only unequip characters, so it's not an issue. +DROP TABLE mana_char_equips; + +-- Recreate the table using the latest definition. +CREATE TABLE IF NOT EXISTS `mana_char_equips` ( + `id` int(10) unsigned NOT NULL auto_increment, + `owner_id` int(10) unsigned NOT NULL, + `slot_type` int(10) unsigned NOT NULL, + `item_id` int(10) unsigned NOT NULL, + `item_instance` int(10) unsigned NOT NULL, + -- + PRIMARY KEY (`id`), + FOREIGN KEY (`owner_id`) REFERENCES `mana_characters` (`id`) +) ENGINE=InnoDB +DEFAULT CHARSET=utf8; + +-- Update database version. +UPDATE mana_world_states +SET value = '15', +moddate = UNIX_TIMESTAMP() +WHERE state_name = 'database_version'; diff --git a/src/sql/sqlite/createTables.sql b/src/sql/sqlite/createTables.sql index 1027b580..2b4f7aa6 100644 --- a/src/sql/sqlite/createTables.sql +++ b/src/sql/sqlite/createTables.sql @@ -407,7 +407,7 @@ AS INSERT INTO mana_world_states VALUES('accountserver_startup',NULL,NULL, strftime('%s','now')); INSERT INTO mana_world_states VALUES('accountserver_version',NULL,NULL, strftime('%s','now')); -INSERT INTO mana_world_states VALUES('database_version', NULL,'14', strftime('%s','now')); +INSERT INTO mana_world_states VALUES('database_version', NULL,'15', strftime('%s','now')); -- all known transaction codes diff --git a/src/sql/sqlite/updates/update_14_to_15.sql b/src/sql/sqlite/updates/update_14_to_15.sql new file mode 100644 index 00000000..777764d8 --- /dev/null +++ b/src/sql/sqlite/updates/update_14_to_15.sql @@ -0,0 +1,21 @@ + +-- Dropping the table will only unequip characters, so it's not an issue. +DROP TABLE mana_char_equips; + +-- Recreate the table using the latest definition. +CREATE TABLE mana_char_equips +( + id INTEGER PRIMARY KEY, + owner_id INTEGER NOT NULL, + slot_type INTEGER NOT NULL, + item_id INTEGER NOT NULL, + item_instance INTEGER NOT NULL, + -- + FOREIGN KEY (owner_id) REFERENCES mana_characters(id) +); + +-- Update the database version, and set date of update +UPDATE mana_world_states + SET value = '15', + moddate = strftime('%s','now') + WHERE state_name = 'database_version'; |