diff options
Diffstat (limited to 'src/sql/sqlite')
-rw-r--r-- | src/sql/sqlite/createTables.sql | 14 | ||||
-rw-r--r-- | src/sql/sqlite/updates/update_21_to_22.sql | 26 |
2 files changed, 33 insertions, 7 deletions
diff --git a/src/sql/sqlite/createTables.sql b/src/sql/sqlite/createTables.sql index d845e842..aaf18efc 100644 --- a/src/sql/sqlite/createTables.sql +++ b/src/sql/sqlite/createTables.sql @@ -120,16 +120,16 @@ CREATE INDEX mana_char_kill_stats_char on mana_char_kill_stats ( char_id ); ----------------------------------------------------------------------------- -CREATE TABLE mana_char_specials +CREATE TABLE mana_char_abilities ( - char_id INTEGER NOT NULL, - special_id INTEGER NOT NULL, - special_current_mana INTEGER NOT NULL, - PRIMARY KEY (char_id, special_id), + char_id INTEGER NOT NULL, + ability_id INTEGER NOT NULL, + ability_current_points INTEGER NOT NULL, + PRIMARY KEY (char_id, ability_id), FOREIGN KEY (char_id) REFERENCES mana_characters(id) ); -CREATE INDEX mana_char_specials_char on mana_char_specials ( char_id ); +CREATE INDEX mana_char_abilities_char on mana_char_abilities ( char_id ); ----------------------------------------------------------------------------- @@ -424,7 +424,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,'21', strftime('%s','now')); +INSERT INTO mana_world_states VALUES('database_version', -1,'22', strftime('%s','now')); -- all known transaction codes diff --git a/src/sql/sqlite/updates/update_21_to_22.sql b/src/sql/sqlite/updates/update_21_to_22.sql new file mode 100644 index 00000000..dbe6cb07 --- /dev/null +++ b/src/sql/sqlite/updates/update_21_to_22.sql @@ -0,0 +1,26 @@ +BEGIN; + +CREATE TABLE mana_char_abilities +( + char_id INTEGER NOT NULL, + ability_id INTEGER NOT NULL, + ability_current_points INTEGER NOT NULL, + PRIMARY KEY (char_id, ability_id), + FOREIGN KEY (char_id) REFERENCES mana_characters(id) +); + +CREATE INDEX mana_char_abilities_char on mana_char_abilities ( char_id ); + +INSERT INTO mana_char_abilities (char_id, ability_id, ability_current_points) + SELECT char_id, special_id, special_current_mana FROM mana_char_specials; + +DROP TABLE mana_char_specials; + + +-- Update the database version, and set date of update +UPDATE mana_world_states + SET value = '22', + moddate = strftime('%s','now') + WHERE state_name = 'database_version'; + +END; |