summaryrefslogtreecommitdiff
path: root/src/sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/mysql/createTables.sql20
-rw-r--r--src/sql/mysql/updates/update_22_to_23.sql15
-rw-r--r--src/sql/sqlite/createTables.sql18
-rw-r--r--src/sql/sqlite/updates/update_22_to_23.sql58
4 files changed, 75 insertions, 36 deletions
diff --git a/src/sql/mysql/createTables.sql b/src/sql/mysql/createTables.sql
index 212d4812..50fdae90 100644
--- a/src/sql/mysql/createTables.sql
+++ b/src/sql/mysql/createTables.sql
@@ -33,7 +33,6 @@ CREATE TABLE IF NOT EXISTS `mana_characters` (
`gender` tinyint(3) unsigned NOT NULL,
`hair_style` tinyint(3) unsigned NOT NULL,
`hair_color` tinyint(3) unsigned NOT NULL,
- `level` tinyint(3) unsigned NOT NULL,
`char_pts` smallint(5) unsigned NOT NULL,
`correct_pts` smallint(5) unsigned NOT NULL,
-- location on the map
@@ -70,21 +69,6 @@ CREATE TABLE IF NOT EXISTS `mana_char_attr` (
DEFAULT CHARSET=utf8;
--
--- table: `mana_char_skills`
---
-CREATE TABLE IF NOT EXISTS `mana_char_skills` (
- `char_id` int(10) unsigned NOT NULL,
- `skill_id` smallint(5) unsigned NOT NULL,
- `skill_exp` smallint(5) unsigned NOT NULL,
- --
- PRIMARY KEY (`char_id`, `skill_id`),
- FOREIGN KEY (`char_id`)
- REFERENCES `mana_characters` (`id`)
- ON DELETE CASCADE
-) ENGINE=InnoDB
-DEFAULT CHARSET=utf8;
-
---
-- table: `mana_char_status_effects`
--
CREATE TABLE IF NOT EXISTS `mana_char_status_effects` (
@@ -417,7 +401,6 @@ AS
c.user_id as user_id,
c.name as name,
c.gender as gender,
- c.level as level,
c.map_id as map_id
FROM mana_online_list l
JOIN mana_characters c
@@ -438,7 +421,7 @@ AUTO_INCREMENT=0 ;
INSERT INTO mana_world_states VALUES('accountserver_startup',-1,'0', NOW());
INSERT INTO mana_world_states VALUES('accountserver_version',-1,'0', NOW());
-INSERT INTO mana_world_states VALUES('database_version', -1,'22', NOW());
+INSERT INTO mana_world_states VALUES('database_version', -1,'23', NOW());
-- all known transaction codes
@@ -475,7 +458,6 @@ INSERT INTO mana_transaction_codes VALUES ( 30, 'Trade items', 'Act
INSERT INTO mana_transaction_codes VALUES ( 31, 'Attribute increased', 'Character' );
INSERT INTO mana_transaction_codes VALUES ( 32, 'Attribute decreased', 'Character' );
INSERT INTO mana_transaction_codes VALUES ( 33, 'Command MUTE', 'Commands' );
-INSERT INTO mana_transaction_codes VALUES ( 34, 'Command EXP', 'Commands' );
INSERT INTO mana_transaction_codes VALUES ( 35, 'Command INVISIBLE', 'Commands' );
INSERT INTO mana_transaction_codes VALUES ( 36, 'Command COMBAT', 'Commands' );
INSERT INTO mana_transaction_codes VALUES ( 37, 'Command ANNOUNCE', 'Commands' );
diff --git a/src/sql/mysql/updates/update_22_to_23.sql b/src/sql/mysql/updates/update_22_to_23.sql
new file mode 100644
index 00000000..c4affaed
--- /dev/null
+++ b/src/sql/mysql/updates/update_22_to_23.sql
@@ -0,0 +1,15 @@
+START TRANSACTION;
+
+-- There is no way to convert all your skills to attributes. You will have to
+-- do this manually.
+
+ALTER TABLE mana_characters DROP COLUMN level;
+
+-- Update database version.
+UPDATE mana_world_states
+ SET value = '23',
+ moddate = UNIX_TIMESTAMP()
+ WHERE state_name = 'database_version';
+
+COMMIT;
+
diff --git a/src/sql/sqlite/createTables.sql b/src/sql/sqlite/createTables.sql
index aaf18efc..72a70090 100644
--- a/src/sql/sqlite/createTables.sql
+++ b/src/sql/sqlite/createTables.sql
@@ -51,7 +51,6 @@ CREATE TABLE mana_characters
gender INTEGER NOT NULL,
hair_style INTEGER NOT NULL,
hair_color INTEGER NOT NULL,
- level INTEGER NOT NULL,
char_pts INTEGER NOT NULL,
correct_pts INTEGER NOT NULL,
x INTEGER NOT NULL,
@@ -81,19 +80,6 @@ CREATE INDEX mana_char_attr_char ON mana_char_attr ( char_id );
-----------------------------------------------------------------------------
-CREATE TABLE mana_char_skills
-(
- char_id INTEGER NOT NULL,
- skill_id INTEGER NOT NULL,
- skill_exp INTEGER NOT NULL,
- --
- FOREIGN KEY (char_id) REFERENCES mana_characters(id)
-);
-
-CREATE INDEX mana_char_skills_char ON mana_char_skills ( char_id );
-
------------------------------------------------------------------------------
-
CREATE TABLE mana_char_status_effects
(
char_id INTEGER NOT NULL,
@@ -387,7 +373,6 @@ AS
c.user_id as user_id,
c.name as name,
c.gender as gender,
- c.level as level,
c.map_id as map_id
FROM mana_online_list l
JOIN mana_characters c
@@ -424,7 +409,7 @@ AS
INSERT INTO mana_world_states VALUES('accountserver_startup',-1,'0', strftime('%s','now'));
INSERT INTO mana_world_states VALUES('accountserver_version',-1,'0', strftime('%s','now'));
-INSERT INTO mana_world_states VALUES('database_version', -1,'22', strftime('%s','now'));
+INSERT INTO mana_world_states VALUES('database_version', -1,'23', strftime('%s','now'));
-- all known transaction codes
@@ -461,7 +446,6 @@ INSERT INTO mana_transaction_codes VALUES ( 30, 'Trade items', 'Act
INSERT INTO mana_transaction_codes VALUES ( 31, 'Attribute increased', 'Character' );
INSERT INTO mana_transaction_codes VALUES ( 32, 'Attribute decreased', 'Character' );
INSERT INTO mana_transaction_codes VALUES ( 33, 'Command MUTE', 'Commands' );
-INSERT INTO mana_transaction_codes VALUES ( 34, 'Command EXP', 'Commands' );
INSERT INTO mana_transaction_codes VALUES ( 35, 'Command INVISIBLE', 'Commands' );
INSERT INTO mana_transaction_codes VALUES ( 36, 'Command COMBAT', 'Commands' );
INSERT INTO mana_transaction_codes VALUES ( 37, 'Command ANNOUNCE', 'Commands' );
diff --git a/src/sql/sqlite/updates/update_22_to_23.sql b/src/sql/sqlite/updates/update_22_to_23.sql
new file mode 100644
index 00000000..7172b56f
--- /dev/null
+++ b/src/sql/sqlite/updates/update_22_to_23.sql
@@ -0,0 +1,58 @@
+BEGIN;
+
+-- There is no way to convert all your skills to attributes. You will have to
+-- do this manually.
+
+CREATE TABLE mana_characters_backup
+(
+ id INTEGER PRIMARY KEY,
+ user_id INTEGER NOT NULL,
+ name TEXT NOT NULL UNIQUE,
+ gender INTEGER NOT NULL,
+ hair_style INTEGER NOT NULL,
+ hair_color INTEGER NOT NULL,
+ char_pts INTEGER NOT NULL,
+ correct_pts INTEGER NOT NULL,
+ 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)
+);
+
+INSERT INTO mana_characters_backup SELECT
+ id, user_id, name, gender, hair_style, hair_color, char_pts, correct_pts,
+ x, y, map_id, slot FROM mana_characters;
+
+DROP TABLE mana_characters;
+
+CREATE TABLE mana_characters
+(
+ id INTEGER PRIMARY KEY,
+ user_id INTEGER NOT NULL,
+ name TEXT NOT NULL UNIQUE,
+ gender INTEGER NOT NULL,
+ hair_style INTEGER NOT NULL,
+ hair_color INTEGER NOT NULL,
+ char_pts INTEGER NOT NULL,
+ correct_pts INTEGER NOT NULL,
+ 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)
+);
+
+INSERT INTO mana_characters SELECT * FROM mana_characters_backup;
+DROP TABLE mana_characters_backup;
+
+-- Update the database version, and set date of update
+UPDATE mana_world_states
+ SET value = '23',
+ moddate = strftime('%s','now')
+ WHERE state_name = 'database_version';
+
+END;
+