summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
authorFreeyorp <Freeyorp101@hotmail.com>2010-08-29 19:47:25 +1200
committerFreeyorp <Freeyorp101@hotmail.com>2010-08-29 19:47:25 +1200
commit7fc50c2d31e1d289e9d2a950271c6d399fe0896a (patch)
tree1ebff71f7b1526425cc57e2e3b2681297e540f90 /src/sql
parent853cbb6efdb79f879fabc2133acb8c11d9d4f7b1 (diff)
parent7db9f6fe36b737d2eec7c6070497035b0834def2 (diff)
downloadmanaserv-7fc50c2d31e1d289e9d2a950271c6d399fe0896a.tar.gz
manaserv-7fc50c2d31e1d289e9d2a950271c6d399fe0896a.tar.xz
manaserv-7fc50c2d31e1d289e9d2a950271c6d399fe0896a.zip
Merge branch 'testing'
Conflicts: src/account-server/storage.cpp src/game-server/being.cpp src/game-server/being.hpp src/game-server/character.cpp src/game-server/character.hpp src/game-server/gamehandler.cpp src/game-server/inventory.cpp src/scripting/lua.cpp src/sql/mysql/createTables.sql src/sql/sqlite/createTables.sql
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/mysql/createTables.sql42
-rw-r--r--src/sql/mysql/updates/update_10_to_11.sql49
-rw-r--r--src/sql/sqlite/createTables.sql35
3 files changed, 109 insertions, 17 deletions
diff --git a/src/sql/mysql/createTables.sql b/src/sql/mysql/createTables.sql
index 2887f1c..a76cc33 100644
--- a/src/sql/mysql/createTables.sql
+++ b/src/sql/mysql/createTables.sql
@@ -36,18 +36,10 @@ CREATE TABLE IF NOT EXISTS `mana_characters` (
`level` tinyint(3) unsigned NOT NULL,
`char_pts` smallint(5) unsigned NOT NULL,
`correct_pts` smallint(5) unsigned NOT NULL,
- `money` int(10) unsigned NOT NULL,
-- location on the map
`x` smallint(5) unsigned NOT NULL,
`y` smallint(5) unsigned NOT NULL,
`map_id` tinyint(3) unsigned NOT NULL,
- -- attributes
- `str` smallint(5) unsigned NOT NULL,
- `agi` smallint(5) unsigned NOT NULL,
- `dex` smallint(5) unsigned NOT NULL,
- `vit` smallint(5) unsigned NOT NULL,
- `int` smallint(5) unsigned NOT NULL,
- `will` smallint(5) unsigned NOT NULL,
--
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
@@ -60,6 +52,23 @@ DEFAULT CHARSET=utf8
AUTO_INCREMENT=1 ;
--
+-- Create table: `mana_char_attr`
+--
+
+CREATE TABLE IF NOT EXISTS `mana_char_attr` (
+ `char_id` int(10) unsigned NOT NULL,
+ `attr_id` int(10) unsigned NOT NULL,
+ `attr_base` double unsigned NOT NULL,
+ `attr_mod` double unsigned NOT NULL,
+ --
+ PRIMARY KEY (`char_id`, `attr_id`),
+ FOREIGN KEY (`char_id`)
+ REFERENCES `mana_characters` (`id`)
+ ON DELETE CASCADE
+) ENGINE=InnoDB
+DEFAULT CHARSET=utf8;
+
+--
-- table: `mana_char_skills`
--
CREATE TABLE IF NOT EXISTS `mana_char_skills` (
@@ -169,6 +178,21 @@ DEFAULT CHARSET=utf8
AUTO_INCREMENT=1 ;
--
+-- table: `mana_char_equips`
+--
+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 tinyint(3) unsigned NOT NULL,
+ inventory_slot tinyint(3) unsigned NOT NULL,
+ --
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `owner_id` (`owner_id`, )
+ FOREIGN KEY (owner_id) REFERENCES mana_characters(id)
+) ENGINE=InnoDB
+DEFAULT CHARSET=utf8;
+
+--
-- table: `mana_inventories`
-- todo: remove class_id and amount and reference on mana_item_instances
--
@@ -396,7 +420,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,'10', NOW());
+INSERT INTO mana_world_states VALUES('database_version', NULL,'11', NOW());
-- all known transaction codes
diff --git a/src/sql/mysql/updates/update_10_to_11.sql b/src/sql/mysql/updates/update_10_to_11.sql
new file mode 100644
index 0000000..66922f1
--- /dev/null
+++ b/src/sql/mysql/updates/update_10_to_11.sql
@@ -0,0 +1,49 @@
+--
+-- Modify the table `mana_characters` to remove the no longer used columns.
+-- Note that this is not an intelligent update script at the moment - the
+-- values that were stored here are not currently being transferred
+-- into their replacement structures.
+--
+
+ALTER TABLE `mana_char_attr` DROP `money`;
+ALTER TABLE `mana_char_attr` DROP `str`;
+ALTER TABLE `mana_char_attr` DROP `agi`;
+ALTER TABLE `mana_char_attr` DROP `vit`;
+ALTER TABLE `mana_char_attr` DROP `int`;
+ALTER TABLE `mana_char_attr` DROP `dex`;
+ALTER TABLE `mana_char_attr` DROP `will`;
+
+
+--
+-- Create table: `mana_char_attr`
+--
+
+CREATE TABLE IF NOT EXISTS `mana_char_attr` (
+ `char_id` int(10) unsigned NOT NULL,
+ `attr_id` int(10) unsigned NOT NULL,
+ `attr_base` double unsigned NOT NULL,
+ `attr_mod` double unsigned NOT NULL,
+ --
+ PRIMARY KEY (`char_id`, `attr_id`),
+ FOREIGN KEY (`char_id`)
+ REFERENCES `mana_characters` (`id`)
+ ON DELETE CASCADE
+) ENGINE=InnoDB
+DEFAULT CHARSET=utf8;
+
+--
+-- table: `mana_char_equips`
+--
+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 tinyint(3) unsigned NOT NULL,
+ inventory_slot tinyint(3) unsigned NOT NULL,
+ --
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `owner_id` (`owner_id`, )
+ FOREIGN KEY (owner_id) REFERENCES mana_characters(id)
+) ENGINE=InnoDB
+DEFAULT CHARSET=utf8;
+
+UPDATE mana_world_states SET value = '11', moddate = UNIX_TIMESTAMP() WHERE state_name = 'database_version';
diff --git a/src/sql/sqlite/createTables.sql b/src/sql/sqlite/createTables.sql
index 4147860..0345b9e 100644
--- a/src/sql/sqlite/createTables.sql
+++ b/src/sql/sqlite/createTables.sql
@@ -52,16 +52,9 @@ CREATE TABLE mana_characters
level INTEGER NOT NULL,
char_pts INTEGER NOT NULL,
correct_pts INTEGER NOT NULL,
- money INTEGER NOT NULL,
x INTEGER NOT NULL,
y INTEGER NOT NULL,
map_id INTEGER NOT NULL,
- str INTEGER NOT NULL,
- agi INTEGER NOT NULL,
- dex INTEGER NOT NULL,
- vit INTEGER NOT NULL,
- int INTEGER NOT NULL,
- will INTEGER NOT NULL,
--
FOREIGN KEY (user_id) REFERENCES mana_accounts(id)
);
@@ -71,6 +64,20 @@ CREATE UNIQUE INDEX mana_characters_name ON mana_characters ( name );
-----------------------------------------------------------------------------
+CREATE TABLE mana_char_attr
+(
+ char_id INTEGER NOT NULL,
+ attr_id INTEGER NOT NULL,
+ attr_base FLOAT NOT NULL,
+ attr_mod FLOAT NOT NULL,
+ --
+ FOREIGN KEY (char_id) REFERENCES mana_characters(id)
+);
+
+CREATE INDEX mana_char_attr_char ON mana_char_attr ( char_id );
+
+-----------------------------------------------------------------------------
+
CREATE TABLE mana_char_skills
(
char_id INTEGER NOT NULL,
@@ -165,6 +172,18 @@ CREATE INDEX mana_item_attributes_item ON mana_item_attributes ( item_id );
-----------------------------------------------------------------------------
+CREATE TABLE mana_char_equips
+(
+ id INTEGER PRIMARY KEY,
+ owner_id INTEGER NOT NULL,
+ slot_type INTEGER NOT NULL,
+ inventory_slot INTEGER NOT NULL,
+ --
+ FOREIGN KEY (owner_id) REFERENCES mana_characters(id)
+);
+
+-----------------------------------------------------------------------------
+
-- todo: remove class_id and amount and reference on mana_item_instances
CREATE TABLE mana_inventories
(
@@ -386,7 +405,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,'10', strftime('%s','now'));
+INSERT INTO mana_world_states VALUES('database_version', NULL,'11', strftime('%s','now'));
-- all known transaction codes