Database Schema

Last modified by Manuel Leduc on 2022/03/24

This diagram shows the mappings of internal classes to database tables.
The tables are shown with the table name on the left top and the Java class name on the right top.
In the left column you can find the names of the columns in the table and in the right column you can find the get methods in the class for accessing those values.

Despite the explanations in this document that might seem clear enough, note that modifying things directly in the database (updates, inserts, deletes) is not recommended. Look for alternatives in the XWiki APIs and use them if they exist (as they will take proper care of database logical integrity). If you decide to go ahead, please make sure that you master properly the whole schema and proceed with care.
Note that you should not rely on the presence of database constraints (e.g. foreign keys) to help you keep logical integrity, the XWiki database integrity is not fully covered by constraints in the database.

In a hibernate query you can use the same name as the get method but without the get and with the first letter lowercase so the SQL query:
SELECT doc.XWD_TITLE FROM xwikidoc AS doc WHERE doc.XWD_FULLNAME = 'Main.WebHome'
is equivalent to the HQL query:
SELECT doc.title FROM XWikiDocument AS doc WHERE doc.fullName = 'Main.WebHome'
because XWD_TITLE maps to getTitle() which maps to title.

database-140200010.svg

Following are all of the tables that make up the XWiki database schema. Just taking a brief look at the schema's tables can give you a clue to how the underlying system works. Roughly, in order to support defining data types dynamically, the documents metadata are stored in a table, the objects are stored in another table and then the values of the properties of the objects are stored each in their own table, depending on the type of property.

Note that there may be minor variances for databases other than MySQL, but if so, they have not yet been documented.

You can also access the raw Hibernate mapping file. In your XWiki installation this file is bundled inside the WEB-INF/lib/xwiki-platform-legacy-oldcore*.jar (or WEB-INF/lib/xwiki-platform-oldcore*.jar), along with specific mapping files for various databases. 

Tables

In alphabetical order

Tables used for custom mapping of XWiki classes

Note: Custom mapping of comments is disabled by default so the xwikicomments table will be empty.

Tables used by the statistics plugin

If the stats plugin is not enabled then these will be empty.

Tables used in the deprecated table class property system

These are not used anymore, class information is now stored in XML format in the XWD_CLASS_XML column in the xwikidoc table.

Tags:
   

Get Connected