Warning, /pim/akonadi/src/server/storage/akonadidb.xml is written in an unsupported language. File is not indexed.
0001 <?xml version="1.0" encoding="UTF-8"?> 0002 <!-- 0003 0004 SPDX-FileCopyrightText: 2006 Volker Krause <vkrause@kde.org> 0005 SPDX-FileCopyrightText: 2006 Tobias Koenig <tokoe@kde.org> 0006 0007 SPDX-License-Identifier: LGPL-2.0-or-later 0008 0009 --> 0010 0011 0012 <!-- 0013 Akonadi Database Schema Definition 0014 0015 This file is used to generate database access code as well as the tables itself. 0016 0017 Database element (root node, can contain table and relation elements) 0018 0019 Table attributes (can contain column, reference and data elements) 0020 - name: The entity class name, the table will be named FooTable. 0021 0022 Column attributes: 0023 - name: The column name, will be also used as accessor name in the entity class. 0024 - type: The C++ type of this column, the SQL type will be derived from that. 0025 - size: The size of the SQL column (optional, semantic depends on "type") 0026 - default: Default value for entity class constructor. 0027 - refTable, refColumn: foreign key, also used to generate accessor methods for 1:n relations 0028 - methodName: method name to access referred records, the table name is used if not given 0029 - onUpdate, onDelete: referential actions for foreign keys 0030 0031 Indices: 0032 - name: The name of the index 0033 - columns: The columns covered by this index 0034 - unique: bool, indicates if this index must contain unique data 0035 0036 Reference attributes (indication n:1 relations) 0037 - name: Used for naming the method during code generation 0038 - table: name of the table a n:1 relation exist 0039 - key: column name of the referenced table containing the foreign key 0040 0041 Initial data: 0042 - columns: A comma separated list of column names 0043 - values: A comma separated and SQL-quoted list of values 0044 0045 Relation elements define a n:m relation between two tables. 0046 Attributes: 0047 - table[12]: Table names 0048 - column[12]: Column names 0049 0050 --> 0051 <database> 0052 0053 <table name="SchemaVersion"> 0054 <comment>Contains the schema version of the database.</comment> 0055 <column name="version" type="int" default="0" allowNull="false"/> 0056 <column name="generation" type="int" default="0" allowNull="false" /> 0057 <data columns="version" values="41"/> 0058 </table> 0059 0060 <table name="Resource"> 0061 <column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/> 0062 <column name="name" type="QString" allowNull="false" isUnique="true"/> 0063 <column name="isVirtual" type="bool" default="false"/> 0064 <reference name="collections" table="Collection" key="resourceId"/> 0065 <data columns="name,isVirtual" values="'akonadi_search_resource',true"/> 0066 </table> 0067 0068 <table name="Collection"> 0069 <enum name="Tristate"> 0070 <value name="False"/> 0071 <value name="True"/> 0072 <value name="Undefined"/> 0073 </enum> 0074 0075 <column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/> 0076 <column name="remoteId" type="QString"/> 0077 <column name="remoteRevision" type="QString"/> 0078 <column name="name" type="QString" allowNull="false"/> 0079 <column name="parentId" type="qint64" refTable="Collection" refColumn="id" methodName="parent"/> 0080 <column name="resourceId" type="qint64" refTable="Resource" refColumn="id" allowNull="false"/> 0081 <column name="enabled" type="bool" default="true" allowNull="false"/> 0082 <column name="syncPref" type="enum" enumType="Tristate" default="Tristate::Undefined"/> 0083 <column name="displayPref" type="enum" enumType="Tristate" default="Tristate::Undefined"/> 0084 <column name="indexPref" type="enum" enumType="Tristate" default="Tristate::Undefined"/> 0085 <column name="cachePolicyInherit" type="bool" default="true" allowNull="false"/> 0086 <column name="cachePolicyCheckInterval" type="int" default="-1" allowNull="false"/> 0087 <column name="cachePolicyCacheTimeout" type="int" default="-1" allowNull="false"/> 0088 <column name="cachePolicySyncOnDemand" type="bool" default="false" allowNull="false"/> 0089 <column name="cachePolicyLocalParts" type="QString"/> 0090 <column name="queryString" type="QString" size="32768"/> 0091 <column name="queryAttributes" type="QString"/> 0092 <column name="queryCollections" type="QString"/> 0093 <column name="isVirtual" type="bool" default="false"/> 0094 <index name="parentAndNameIndex" columns="parentId,name" unique="true"/> 0095 <index name="parentIndex" columns="parentId" unique="false"/> 0096 <index name="resourceIndex" columns="resourceId" unique="false"/> 0097 <index name="enabledIndex" columns="enabled" unique="false"/> 0098 <index name="syncPrefIndex" columns="syncPref" unique="false"/> 0099 <index name="displayPrefIndex" columns="displayPref" unique="false"/> 0100 <index name="indexPrefIndex" columns="indexPref" unique="false"/> 0101 <reference name="children" table="Collection" key="parentId"/> 0102 <reference name="items" table="PimItem" key="collectionId"/> 0103 <reference name="attributes" table="CollectionAttribute" key="collectionId"/> 0104 <data columns="parentId,name,resourceId,isVirtual" values="NULL,'Search',1,true"/> 0105 </table> 0106 0107 <table name="MimeType"> 0108 <comment>This meta data is stored inside akonadi to provide fast access.</comment> 0109 <column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/> 0110 <column name="name" type="QString" allowNull="false" isUnique="true"/> 0111 </table> 0112 0113 <table name="PimItem"> 0114 <column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/> 0115 <column name="rev" type="int" default="0" allowNull="false"/> 0116 <column name="remoteId" type="QString" size="1024"/> 0117 <column name="remoteRevision" type="QString"/> 0118 <column name="gid" type="QString"/> 0119 <column name="collectionId" type="qint64" refTable="Collection" refColumn="id"/> 0120 <column name="mimeTypeId" type="qint64" refTable="MimeType" refColumn="id" onDelete="Restrict"/> 0121 <column name="datetime" type="QDateTime" default="QDateTime::currentDateTimeUtc()"> 0122 <comment>create/modified time</comment> 0123 </column> 0124 <column name="atime" type="QDateTime" default="QDateTime::currentDateTimeUtc()"> 0125 <comment>read access time</comment> 0126 </column> 0127 <column name="dirty" type="bool"> 0128 <comment>Indicates that this item has unsaved changes.</comment> 0129 </column> 0130 <column name="size" type="qint64" default="0" allowNull="false"/> 0131 <index name="collectionIndex" columns="collectionId" unique="false"/> 0132 <index name="mimeTypeIndex" columns="mimeTypeId" unique="false"/> 0133 <index name="gidIndex" columns="gid" unique="false"/> 0134 <index name="ridIndex" columns="remoteId" unique="false"/> 0135 <index name="idSortIndex" columns="id" unique="false" sort="DESC"/> 0136 <reference name="parts" table="Part" key="pimItemId"/> 0137 </table> 0138 0139 <table name="Flag"> 0140 <comment>This meta data is stored inside akonadi to provide fast access.</comment> 0141 <column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/> 0142 <column name="name" type="QString" allowNull="false" isUnique="true"/> 0143 </table> 0144 0145 <table name="PartType"> 0146 <comment>Table containing item part types.</comment> 0147 <column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/> 0148 <column name="name" type="QString" allowNull="false"> 0149 <comment>Part name, without namespace.</comment> 0150 </column> 0151 <column name="ns" type="QString" allowNull="false"> 0152 <comment>Part namespace.</comment> 0153 </column> 0154 <index name="partTypeNameIndex" columns="ns,name" unique="true"/> 0155 </table> 0156 0157 <table name="Part"> 0158 <enum name="Storage"> 0159 <value name="Internal"/> 0160 <value name="External"/> 0161 <value name="Foreign"/> 0162 </enum> 0163 <column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/> 0164 <column name="pimItemId" type="qint64" refTable="PimItem" refColumn="id" allowNull="false"/> 0165 <column name="partTypeId" type="qint64" refTable="PartType" refColumn="id" allowNull="false" noUpdate="true" /> 0166 <column name="data" type="QByteArray"/> 0167 <column name="datasize" type="qint64" allowNull="false"/> 0168 <column name="version" type="int" default="0"/> 0169 <column name="storage" type="enum" enumType="Storage" default="Internal"/> 0170 <index name="pimItemIdTypeIndex" columns="pimItemId,partTypeId" unique="true"/> 0171 <index name="pimItemIdSortIndex" columns="pimItemId" unique="false" sort="DESC"/> 0172 <index name="partTypeIndex" columns="partTypeId" unique="false"/> 0173 </table> 0174 0175 <table name="CollectionAttribute"> 0176 <column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/> 0177 <column name="collectionId" type="qint64" refTable="Collection" refColumn="id" allowNull="false"/> 0178 <column name="type" type="QByteArray" allowNull="false"/> 0179 <column name="value" type="QByteArray"/> 0180 <index name="collectionIndex" columns="collectionId" unique="false"/> 0181 </table> 0182 0183 <table name="TagType"> 0184 <column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/> 0185 <column name="name" type="QString" allowNull="false" isUnique="true"/> 0186 <data columns="name" values="'PLAIN'"/> 0187 </table> 0188 0189 <table name="Tag"> 0190 <column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/> 0191 <column name="gid" type="QString" allowNull="false"/> 0192 <column name="parentId" type="qint64" refTable="Tag" refColumn="id" allowNull="true" methodName="parent" /> 0193 <column name="typeId" type="qint64" refTable="TagType" refColumn="id" onDelete="Restrict" default="1"/> 0194 <index name="parentIndex" columns="parentId" unique="false"/> 0195 <index name="typeIndex" columns="typeId" unique="false"/> 0196 </table> 0197 0198 <table name="TagAttribute"> 0199 <column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/> 0200 <column name="tagId" type="qint64" allowNull="false" refTable="Tag" refColumn="id"/> 0201 <column name="type" type="QByteArray" allowNull="false"/> 0202 <column name="value" type="QByteArray"/> 0203 <index name="tagIndex" columns="tagId" unique="false"/> 0204 </table> 0205 0206 <table name="TagRemoteIdResourceRelation" identificationColumn=""> 0207 <column name="tagId" type="qint64" allowNull="false" refTable="Tag" refColumn="id" onDelete="Cascade" /> 0208 <column name="resourceId" type="qint64" allowNull="false" refTable="Resource" refColumn="id" onDelete="Cascade" /> 0209 <column name="remoteId" type="QString" allowNull="false" /> 0210 <index name="TagAndResourceIndex" columns="tagId,resourceId" unique="true"/> 0211 <index name="tagIndex" columns="tagId" unique="false"/> 0212 <index name="resourceIndex" columns="resourceId" unique="false"/> 0213 </table> 0214 0215 <table name="RelationType"> 0216 <column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/> 0217 <column name="name" type="QString" allowNull="false" isUnique="true"/> 0218 <data columns="name" values="'GENERIC'"/> 0219 </table> 0220 0221 <table name="Relation" identificationColumn=""> 0222 <column name="leftId" type="qint64" allowNull="false" refTable="PimItem" refColumn="id" onDelete="Cascade" methodName="left" /> 0223 <column name="rightId" type="qint64" allowNull="false" refTable="PimItem" refColumn="id" onDelete="Cascade" methodName="right" /> 0224 <column name="typeId" type="qint64" refTable="RelationType" refColumn="id" onDelete="Restrict" default="1"/> 0225 <column name="remoteId" type="QString" /> 0226 <index name="RelationIndex" columns="leftId,rightId,typeId" unique="true"/> 0227 <index name="leftIndex" columns="leftId" unique="false"/> 0228 <index name="rightIndex" columns="rightId" unique="false"/> 0229 <index name="typeIndex" columns="typeId" unique="false"/> 0230 </table> 0231 0232 <relation table1="PimItem" column1="id" table2="Flag" column2="id"> 0233 <index name="pimItemIdSortIndex" columns="pimitem_id" unique="false" sort="DESC"/> 0234 </relation> 0235 0236 <relation table1="PimItem" column1="id" table2="Tag" column2="id"/> 0237 0238 <relation table1="Collection" column1="id" table2="MimeType" column2="id"> 0239 <comment>Specifies allowed MimeType for a Collection</comment> 0240 </relation> 0241 0242 <relation table1="Collection" column1="id" table2="PimItem" column2="id"> 0243 <comment>Used to associate items with search folders.</comment> 0244 </relation> 0245 </database>