Wiki source code of Database Schema

Last modified by Manuel Leduc on 2022/03/24

Hide last authors
Caleb James DeLisle 101.1 1 This diagram shows the mappings of internal classes to database tables.
2 The tables are shown with the table name on the left top and the Java class name on the right top.
Manuel Smeria 103.4 3 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.
Anca Luca 141.1 4
Anca Luca 142.1 5 {{warning}}
6 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.
7 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.
8 {{/warning}}
Anca Luca 141.1 9
Caleb James DeLisle 101.1 10 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:
11 {{code language="sql"}}SELECT doc.XWD_TITLE FROM xwikidoc AS doc WHERE doc.XWD_FULLNAME = 'Main.WebHome'{{/code}}
12 is equivalent to the HQL query:
13 {{code language="sql"}}SELECT doc.title FROM XWikiDocument AS doc WHERE doc.fullName = 'Main.WebHome'{{/code}}
14 because ##XWD_TITLE## maps to ##getTitle()## which maps to ##title##.
15
Manuel Leduc 191.1 16 {{image reference="database-140200010.svg"/}}
Caleb James DeLisle 101.1 17
Anca Luca 107.1 18 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.
Vincent Massol 1.1 19
20 Note that there may be minor variances for databases other than MySQL, but if so, they have not yet been documented.
21
Vincent Massol 123.1 22 You can also access the raw {{scm path="xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/xwiki.hbm.xml"}}Hibernate mapping file{{/scm}}. 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.
23
Silvia Macovei 99.2 24 = Tables =
Vincent Massol 1.1 25
Helmut Nagy 43.1 26 In alphabetical order
Anca Luca 141.1 27
Caleb James DeLisle 102.1 28 (% style="width:99%" %)
Anca Luca 141.1 29 |(((
Ecaterina Moraru (Valica) 142.5 30 * [[xwikiattachment>>Documentation.DevGuide.DsXWikiAttachment]]
31 * [[xwikiattachment_archive>>Documentation.DevGuide.XWikiAttachmentArchive]]
Vincent Massol 143.1 32 * [[xwikiattachment_content>>Documentation.DevGuide.DatabaseSchema.DsXWikiAttachmentContent.WebHome]]
Vincent Massol 144.1 33 * [[xwikiattrecyclebin>>Documentation.DevGuide.DatabaseSchema.DsXwikiRecycleBin.WebHome]]
Vincent Massol 145.1 34 * [[xwikidates>>Documentation.DevGuide.DatabaseSchema.DsXWikiDates.WebHome]]
Vincent Massol 146.1 35 * [[xwikidbversion>>Documentation.DevGuide.DatabaseSchema.DsXWikiDbVersion.WebHome]]
Vincent Massol 147.1 36 * [[xwikidoc>>Documentation.DevGuide.DatabaseSchema.DsXWikiDoc.WebHome]]
Vincent Massol 148.1 37 * [[xwikidoubles>>Documentation.DevGuide.DatabaseSchema.DsXWikiDoubles.WebHome]]
Vincent Massol 149.1 38 * [[xwikifloats>>Documentation.DevGuide.DatabaseSchema.DsXWikiFloats.WebHome]]
Vincent Massol 150.1 39 * [[xwikiintegers>>Documentation.DevGuide.DatabaseSchema.DsXWikiIntegers.WebHome]]
Vincent Massol 151.1 40 * [[xwikilargestrings>>Documentation.DevGuide.DatabaseSchema.DsXWikiLargeStrings.WebHome]]
Vincent Massol 152.1 41 * [[xwikilinks>>Documentation.DevGuide.DatabaseSchema.DsXWikiLinks.WebHome]]
Manuel Leduc 193.1 42 * [[xwikidocumentindexingqueue>>Documentation.DevGuide.DatabaseSchema.DsXWikiDocumentIndexingQueue.WebHome]]
Anca Luca 141.1 43 )))|(((
Vincent Massol 153.1 44 * [[xwikilistitems>>Documentation.DevGuide.DatabaseSchema.DsXWikiListItems.WebHome]]
Vincent Massol 154.1 45 * [[xwikilists>>Documentation.DevGuide.DatabaseSchema.DsXWikiLists.WebHome]]
Vincent Massol 155.1 46 * [[xwikilock>>Documentation.DevGuide.DatabaseSchema.DsXWikiLocks.WebHome]]
Vincent Massol 156.1 47 * [[xwikilongs>>Documentation.DevGuide.DatabaseSchema.DsXWikiLongs.WebHome]]
Vincent Massol 157.1 48 * [[xwikiobjects>>Documentation.DevGuide.DatabaseSchema.DsXWikiObjects.WebHome]]
Vincent Massol 158.1 49 * [[xwikiproperties>>Documentation.DevGuide.DatabaseSchema.DsXWikiProperties.WebHome]]
Vincent Massol 159.1 50 * [[xwikiircs>>Documentation.DevGuide.DatabaseSchema.DsXWikiIrcs.WebHome]]
Vincent Massol 160.1 51 * [[xwikirecyclebin>>Documentation.DevGuide.DatabaseSchema.DsXwikiRecyleBin.WebHome]]
Vincent Massol 161.1 52 * [[xwikispace>>Documentation.DevGuide.DatabaseSchema.DsXwikiSpace.WebHome]]
Vincent Massol 162.1 53 * [[xwikistringclasses>>Documentation.DevGuide.DatabaseSchema.DsXWikiStringClasses.WebHome]]
Vincent Massol 163.1 54 * [[xwikistrings>>Documentation.DevGuide.DatabaseSchema.DsXWikiStrings.WebHome]]
Vincent Massol 164.1 55 * [[xwikistringlists>>Documentation.DevGuide.DatabaseSchema.DsXWikiStringLists.WebHome]]
Anca Luca 141.1 56 )))
Silvia Macovei 99.2 57
Caleb James DeLisle 102.1 58 == Tables used for custom mapping of XWiki classes ==
Anca Luca 141.1 59
Caleb James DeLisle 102.1 60 (% style="width:99%" %)
Anca Luca 141.1 61 |(((
Vincent Massol 165.1 62 * [[xwikicomments>>Documentation.DevGuide.DatabaseSchema.DsXwikiComments.WebHome]]
Vincent Massol 166.1 63 * [[xwikipreferences>>Documentation.DevGuide.DatabaseSchema.DsXWikiPreferences.WebHome]]
Anca Luca 141.1 64 )))
Caleb James DeLisle 102.1 65
Manuel Smeria 103.4 66 Note: Custom mapping of comments is disabled by default so the ##xwikicomments## table will be empty.
Caleb James DeLisle 102.1 67
68 == Tables used by the statistics plugin ==
Anca Luca 141.1 69
Caleb James DeLisle 102.1 70 If the stats plugin is not enabled then these will be empty.
Anca Luca 141.1 71
Caleb James DeLisle 102.1 72 (% style="width:99%" %)
Anca Luca 141.1 73 |(((
Vincent Massol 167.1 74 * [[xwikistatsdoc>>Documentation.DevGuide.DatabaseSchema.DsXWikiDocumentStats.WebHome]]
Vincent Massol 168.1 75 * [[xwikistatsreferer>>Documentation.DevGuide.DatabaseSchema.DsXWikiRefererStats.WebHome]]
Vincent Massol 169.1 76 * [[xwikistatsvisit>>Documentation.DevGuide.DatabaseSchema.XWikiVisits.WebHome]]
Anca Luca 141.1 77 )))
Caleb James DeLisle 102.1 78
79 == Tables used in the deprecated table class property system ==
Anca Luca 141.1 80
Caleb James DeLisle 102.1 81 These are not used anymore, class information is now stored in XML format in the ##XWD_CLASS_XML## column in the ##xwikidoc## table.
Anca Luca 141.1 82
Caleb James DeLisle 102.1 83 (% style="width:99%" %)
Anca Luca 141.1 84 |(((
Vincent Massol 170.1 85 * [[xwikibooleanclasses>>Documentation.DevGuide.DatabaseSchema.DsXWikiBooleanClasses.WebHome]]
Vincent Massol 171.1 86 * [[xwikiclasses>>Documentation.DevGuide.DatabaseSchema.DsXWikiClasses.WebHome]]
Vincent Massol 172.1 87 * [[xwikiclassesprop>>Documentation.DevGuide.DatabaseSchema.DsXWikiClassesProp.WebHome]]
Vincent Massol 173.1 88 * [[xwikidateclasses>>Documentation.DevGuide.DatabaseSchema.DsXWikiDateClasses.WebHome]]
Vincent Massol 174.1 89 * [[xwikidblistclasses>>Documentation.DevGuide.DatabaseSchema.DsXWikiDatabaseListClasses.WebHome]]
Vincent Massol 175.1 90 * [[xwikinumberclasses>>Documentation.DevGuide.DatabaseSchema.DsXWikiNumberClasses.WebHome]]
Vincent Massol 103.2 91 * xwikilistclasses
92 * xwikistringclasses
Vincent Massol 103.3 93 )))
Caleb James DeLisle 102.1 94
Silvia Macovei 99.2 95 {{velocity}}
Caleb James DeLisle 102.1 96 $xcontext.setCacheDuration(100000)
Silvia Macovei 99.1 97 {{/velocity}}

Get Connected