From The Mana World
Revision as of 12:25, 30 November 2008 by Exceptionfault (talk | contribs) (describe process of upgrade before next change in the database model)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

From time to time, the database model used by tmwserv will be extended or modified. To prevent inconsistencies between the database model and the account server, the database model has its own version number which has to match the known version of the account server. That means, if you upgrade you database model, you also have to update tmwserv and vice versa.

Determine the database version

To find out which version your current database is of, try the following SELECT statement, which should work well independent of your database backend.

  SELECT value FROM tmw_world_states WHERE state_name = 'database_version';

This should give you a numeric value which represents your current database version.

How to upgrade my database

According to your chosen database backend, you will find a subdirectory called "updates" under "tmwserv/src/sql/<db_backend>". The update scripts follow a naming scheme like "update_<old_version>_to_<new_version>.sql". So if your current version is "1" and you want to upgrade to "2", find the script called "update_1_to_2.sql".

Steps to execute the script depends on your backend. For SQLite just move to the folder where your current database file "tmw.db" lies and type:

 sqlite3 tmw.db < src/sql/sqlite/updates/update_1_to_2.sql

Attention: The scripts don't matter what version you are running, so check it before running a script!