Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Using XMLDB

From MoodleDocs
Revision as of 15:14, 9 January 2008 by Pat B. (talk | contribs)

(This page is in progress of writing and editing, intended for third-party module developers to help them switch to XMLDB.)


How XMLDB can help you

Everywhere in Moodle now use XMLDB. Created to prevent developer from creating custom database schemas for different database system. If you don't know what XMLDB is, You can learn more about it here XMLDB_introduction

In every module folder, there is db/ folder where database structure stored. The folder usually contains mysql.php, mysql.sql, etc for different database.

It's mean that you have to create different files for each database systems. If there are 5 database, you have to create 10 files (2 each). XMLDB is intended to solve this. Switching to XMLDB is very easy, save your time and effort by creating just 1 file.

Creating XMLDB files

XMLDB file in module is stored in db/ folder, named install.xml, You can use a built-in XMLDB editor to create or edit any install.xml files. If you're using MySQL as your default database schemes. XMLDB editor's powerful tools allowing retrofit MySQL table to XMLDB format.

Retrofitting MySQL table to XMLDB

First, your module has to be installed. Then follow these steps.

1. Go to Miscellaneous >> XMLDB editor 2. Find your module folder, be sure it is writable 3. Click Create, then click Load, you will get a page