Note: You are currently viewing documentation for Moodle 3.7. Up-to-date documentation for the latest stable version of Moodle may be available here: Using XMLDB.

Development: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 Development: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.

Convert MySQL syntax to XMLDB

This can be done easily by using XMLDB Editor built in every Moodle. Simply go to Administration >> Miscellaneous >> XMLDB Editor