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

(This docs is in progress of writing and editing, aimed to help third-party module developer to switch to XMLDB)

XMLDB in your module

Everywhere in Moodle now use XMLDB. Created to prevent 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, there is "db/" directory where database structure stored. usually contains mysql.php, mysql.sql and so on 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 solves this problem as well. 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