Moodle XMLDB
Our purpose of exploring XMLDB was to try to find a way to place the format of the Moodle database into Subversion so that when we try to check out a branch for development we have a working copy that also performs database changes upon install.
From our research, XMLDB seemed to be the way that Moodle suggest we perform these actions.
XMLDB is a good way to add extra tables that aren’t created or prepopulated by any of the core Moodle functions, which means it’s perfect for any tables that we can label as mdl_ucla_
http://docs.moodle.org/en/Development:Using_XMLDB (How to use XMLDB)
http://docs.moodle.org/en/Development:XMLDB_column_types (Column types of XMLDB)
According to Moodle, it is also possible to generate upgrade.php files using XMLDB which then are used to update an existing version of Moodle. However, our attempts to do so have not been successful so no conclusions can be drawn of this feature as of now.
http://docs.moodle.org/en/Development:Installing_and_upgrading_plugin_database_tables (How to upgrade a plugin)
The problem that we have encountered with XMLDB is that you cannot insert data upon install for tables which are prepopulated by Moodle. For example, if we add extra roles, we need to add those in manually because if we use XMLDB to do this, then the additional data is inserted before the original Moodle data is inserted. This is a known problem for Moodle that has not yet been fixed.
http://tracker.moodle.org/browse/MDL-17440 (Tracker for Moodle)
According to Moodle, if you want to make any changes that aren’t possible to do using plug in points, then you should use the local folder. The local folder contains the version.php, db/install.xml, and db/upgrade.php files. These files should be used like the upgrade.php method for the plugins. In the documentation, they mention that the local folder has no install.xml, but while experimenting with it a install.xml file was created when the “Create” button was clicked on the XMLDB page.
http://docs.moodle.org/en/Development:Local_customisation (How to use the local folder)
So far, XMLDB is usable for creating tables that aren’t part of the original Moodle tables, and can also insert data into those tables perfectly. However, inserting data into the existing Moodle tables in the correct order is not doable, and we are not sure of how to modify the existing Moodle tables through XMLDB yet.

