summaryrefslogtreecommitdiff
path: root/src/sql/sqlite
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql/sqlite')
-rw-r--r--src/sql/sqlite/createTables.sql18
-rw-r--r--src/sql/sqlite/updates/update_22_to_23.sql58
2 files changed, 59 insertions, 17 deletions
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;
+