Wiki source code of Database Schema

Last modified by Thomas Mortagne on 2018/12/17

Show last authors
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.
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.
4
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}}
9
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
16 {{image reference="database-1008010.op.svg"/}}
17
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.
19
20 Note that there may be minor variances for databases other than MySQL, but if so, they have not yet been documented.
21
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
24 = Tables =
25
26 In alphabetical order
27
28 (% style="width:99%" %)
29 |(((
30 * [[xwikiattachment>>Documentation.DevGuide.DsXWikiAttachment]]
31 * [[xwikiattachment_archive>>Documentation.DevGuide.XWikiAttachmentArchive]]
32 * [[xwikiattachment_content>>Documentation.DevGuide.DatabaseSchema.DsXWikiAttachmentContent.WebHome]]
33 * [[xwikiattrecyclebin>>Documentation.DevGuide.DatabaseSchema.DsXwikiRecycleBin.WebHome]]
34 * [[xwikidates>>Documentation.DevGuide.DatabaseSchema.DsXWikiDates.WebHome]]
35 * [[xwikidbversion>>Documentation.DevGuide.DatabaseSchema.DsXWikiDbVersion.WebHome]]
36 * [[xwikidoc>>Documentation.DevGuide.DatabaseSchema.DsXWikiDoc.WebHome]]
37 * [[xwikidoubles>>Documentation.DevGuide.DatabaseSchema.DsXWikiDoubles.WebHome]]
38 * [[xwikifloats>>Documentation.DevGuide.DatabaseSchema.DsXWikiFloats.WebHome]]
39 * [[xwikiintegers>>Documentation.DevGuide.DatabaseSchema.DsXWikiIntegers.WebHome]]
40 * [[xwikilargestrings>>Documentation.DevGuide.DatabaseSchema.DsXWikiLargeStrings.WebHome]]
41 * [[xwikilinks>>Documentation.DevGuide.DatabaseSchema.DsXWikiLinks.WebHome]]
42 )))|(((
43 * [[xwikilistitems>>Documentation.DevGuide.DatabaseSchema.DsXWikiListItems.WebHome]]
44 * [[xwikilists>>Documentation.DevGuide.DatabaseSchema.DsXWikiLists.WebHome]]
45 * [[xwikilock>>Documentation.DevGuide.DatabaseSchema.DsXWikiLocks.WebHome]]
46 * [[xwikilongs>>Documentation.DevGuide.DatabaseSchema.DsXWikiLongs.WebHome]]
47 * [[xwikiobjects>>Documentation.DevGuide.DatabaseSchema.DsXWikiObjects.WebHome]]
48 * [[xwikiproperties>>Documentation.DevGuide.DatabaseSchema.DsXWikiProperties.WebHome]]
49 * [[xwikiircs>>Documentation.DevGuide.DatabaseSchema.DsXWikiIrcs.WebHome]]
50 * [[xwikirecyclebin>>Documentation.DevGuide.DatabaseSchema.DsXwikiRecyleBin.WebHome]]
51 * [[xwikispace>>Documentation.DevGuide.DatabaseSchema.DsXwikiSpace.WebHome]]
52 * [[xwikistringclasses>>Documentation.DevGuide.DatabaseSchema.DsXWikiStringClasses.WebHome]]
53 * [[xwikistrings>>Documentation.DevGuide.DatabaseSchema.DsXWikiStrings.WebHome]]
54 * [[xwikistringlists>>Documentation.DevGuide.DatabaseSchema.DsXWikiStringLists.WebHome]]
55 )))
56
57 == Tables used for custom mapping of XWiki classes ==
58
59 (% style="width:99%" %)
60 |(((
61 * [[xwikicomments>>Documentation.DevGuide.DatabaseSchema.DsXwikiComments.WebHome]]
62 * [[xwikipreferences>>Documentation.DevGuide.DatabaseSchema.DsXWikiPreferences.WebHome]]
63 )))
64
65 Note: Custom mapping of comments is disabled by default so the ##xwikicomments## table will be empty.
66
67 == Tables used by the statistics plugin ==
68
69 If the stats plugin is not enabled then these will be empty.
70
71 (% style="width:99%" %)
72 |(((
73 * [[xwikistatsdoc>>Documentation.DevGuide.DatabaseSchema.DsXWikiDocumentStats.WebHome]]
74 * [[xwikistatsreferer>>Documentation.DevGuide.DatabaseSchema.DsXWikiRefererStats.WebHome]]
75 * [[xwikistatsvisit>>Documentation.DevGuide.DatabaseSchema.XWikiVisits.WebHome]]
76 )))
77
78 == Tables used in the deprecated table class property system ==
79
80 These are not used anymore, class information is now stored in XML format in the ##XWD_CLASS_XML## column in the ##xwikidoc## table.
81
82 (% style="width:99%" %)
83 |(((
84 * [[xwikibooleanclasses>>Documentation.DevGuide.DatabaseSchema.DsXWikiBooleanClasses.WebHome]]
85 * [[xwikiclasses>>Documentation.DevGuide.DatabaseSchema.DsXWikiClasses.WebHome]]
86 * [[xwikiclassesprop>>Documentation.DevGuide.DatabaseSchema.DsXWikiClassesProp.WebHome]]
87 * [[xwikidateclasses>>Documentation.DevGuide.DatabaseSchema.DsXWikiDateClasses.WebHome]]
88 * [[xwikidblistclasses>>Documentation.DevGuide.DatabaseSchema.DsXWikiDatabaseListClasses.WebHome]]
89 * [[xwikinumberclasses>>Documentation.DevGuide.DatabaseSchema.DsXWikiNumberClasses.WebHome]]
90 * xwikilistclasses
91 * xwikistringclasses
92 )))
93
94 {{velocity}}
95 $xcontext.setCacheDuration(100000)
96 {{/velocity}}

Get Connected