diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-12-29 07:41:49 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-12-29 07:41:49 +0100 |
commit | 5f03e73484a50c9689956b32ef97630b56d2a00d (patch) | |
tree | ca6d3d7467d4582a2f64be4a45c056f55642fd17 /src/sql | |
parent | 4ead8e0b6af924132a6fb227325a868db0df335c (diff) | |
download | manaserv-5f03e73484a50c9689956b32ef97630b56d2a00d.tar.gz manaserv-5f03e73484a50c9689956b32ef97630b56d2a00d.tar.bz2 manaserv-5f03e73484a50c9689956b32ef97630b56d2a00d.tar.xz manaserv-5f03e73484a50c9689956b32ef97630b56d2a00d.zip |
Made the server handle properly the characters slots.
I turned the vector storing character data into a map,
keeping the character's slot.
Fixed a memleak along the way.
Reviewed-by: Crush.
Diffstat (limited to 'src/sql')
-rw-r--r-- | src/sql/mysql/createTables.sql | 1 | ||||
-rw-r--r-- | src/sql/mysql/updates/update_13_to_14.sql | 11 | ||||
-rw-r--r-- | src/sql/sqlite/createTables.sql | 1 | ||||
-rw-r--r-- | src/sql/sqlite/updates/update_13_to_14.sql | 10 |
4 files changed, 23 insertions, 0 deletions
diff --git a/src/sql/mysql/createTables.sql b/src/sql/mysql/createTables.sql index eb62d869..42ccfa63 100644 --- a/src/sql/mysql/createTables.sql +++ b/src/sql/mysql/createTables.sql @@ -40,6 +40,7 @@ CREATE TABLE IF NOT EXISTS `mana_characters` ( `x` smallint(5) unsigned NOT NULL, `y` smallint(5) unsigned NOT NULL, `map_id` tinyint(3) unsigned NOT NULL, + `slot` smallint(5) unsigned NOT NULL, -- PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), diff --git a/src/sql/mysql/updates/update_13_to_14.sql b/src/sql/mysql/updates/update_13_to_14.sql new file mode 100644 index 00000000..ea5b7e25 --- /dev/null +++ b/src/sql/mysql/updates/update_13_to_14.sql @@ -0,0 +1,11 @@ +-- +-- Modify the table `mana_characters` to add the slot field. +-- + +ALTER TABLE `mana_characters` ADD COLUMN `slot` smallint(5) unsigned NOT NULL; + +-- Update database version. +UPDATE mana_world_states +SET value = '14', +moddate = UNIX_TIMESTAMP() +WHERE state_name = 'database_version'; diff --git a/src/sql/sqlite/createTables.sql b/src/sql/sqlite/createTables.sql index 3ab59d76..8296a7e2 100644 --- a/src/sql/sqlite/createTables.sql +++ b/src/sql/sqlite/createTables.sql @@ -55,6 +55,7 @@ CREATE TABLE mana_characters x INTEGER NOT NULL, y INTEGER NOT NULL, map_id INTEGER NOT NULL, + slot INTEGER NOT NULL, -- FOREIGN KEY (user_id) REFERENCES mana_accounts(id) ); diff --git a/src/sql/sqlite/updates/update_13_to_14.sql b/src/sql/sqlite/updates/update_13_to_14.sql new file mode 100644 index 00000000..a4c4a38a --- /dev/null +++ b/src/sql/sqlite/updates/update_13_to_14.sql @@ -0,0 +1,10 @@ + +-- Add the slot column to table mana_characters +ALTER TABLE mana_characters ADD slot INTEGER NOT NULL; + +-- Update the database version, and set date of update +UPDATE mana_world_states + SET value = '14', + moddate = strftime('%s','now') + WHERE state_name = 'database_version'; + |