= MaNGOS -- README =

This file is part of the CMaNGOS Project. See AUTHORS file for Copyright information

See the COPYING file for copying conditions.

== Database Updates ==

This folder contains SQL files which will apply required updates to your MySQL
database, whenever the MaNGOS database structure has been changed or extended.

To see if you need an update, the file names have been given a fixed structure
that should enable you to see if you need an update or not.

=== File Name Description ===

File names are divided into two parts.

First part is the revision and counter that shows the commit revision that
will be compatible with the database after apply that particular update.
Counter sets the order to apply sql updates for the same revision.

The second part of the name is the database and the table that needs an update or has been added.

See an example below:

         6936_01_mangos_spell_chain.sql
         |    |  |      |
         |    |  |      |
         |    |  |      The table `spell_chain`
         |    |  |      will need an update.
         |    |  |
         |    |  Name of affected DB (default recommended name)
         |    |  Can be: characters, mangos, realmd
         |    |
         |    Counter show number of sql updates in updates list for provided revision
         |    and set proper order for sql updates for same revision
         |
         MaNGOS commit revision related to sql update.
         It included in commit description in form [6936] as you can see at http://github.com/mangos/mangos/commits/master

After applying an update the DB is compatible with the mangos revision of this sql update.
SQL updates include special protection against multiple and wrong order of update application.

Attempts to apply sql updates to an older DB without previous SQL updates in list for the database
or to DB with already applied this or later SQL update will generate an error and not be applied.

=== For Commiters ====

MaNGOS sources include special tool ( contrib/git_id ) for generation revision info
in commit notes and in src/shared/revision_nr.h file. It have option '-s' that let set
correct sql update names with revision number, generate sql update order guard queries,
and update version fields in mangos.sql/etc. For it use name sql updates in form
01_mangos_spell_chain.sql or 9999_01_mangos_spell_chain.sql (counter can be _01_, _02_, and etc,
dependent from sql updates amount in commit) and _not_ add to sql updates
guard queries. Include sql updates in commit. After commit adding to local repo call git_id
with -s option (and another, note: -s option not work propertly with -l option). Other steps
tool will do by self and apply changes to commit. After tool use commit with sql updates ready
to push.
