1 -- ------------------------------------------
2 -- Friendica 2019.06-dev (Dalmatian Bellflower)
3 -- DB_UPDATE_VERSION 1308
4 -- ------------------------------------------
10 CREATE TABLE IF NOT EXISTS `addon` (
11 `id` int unsigned NOT NULL auto_increment COMMENT '',
12 `name` varchar(50) NOT NULL DEFAULT '' COMMENT 'addon base (file)name',
13 `version` varchar(50) NOT NULL DEFAULT '' COMMENT 'currently unused',
14 `installed` boolean NOT NULL DEFAULT '0' COMMENT 'currently always 1',
15 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'currently unused',
16 `timestamp` int unsigned NOT NULL DEFAULT 0 COMMENT 'file timestamp to check for reloads',
17 `plugin_admin` boolean NOT NULL DEFAULT '0' COMMENT '1 = has admin config, 0 = has no admin config',
19 UNIQUE INDEX `name` (`name`)
20 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registered addons';
25 CREATE TABLE IF NOT EXISTS `apcontact` (
26 `url` varbinary(255) NOT NULL COMMENT 'URL of the contact',
27 `uuid` varchar(255) COMMENT '',
28 `type` varchar(20) NOT NULL COMMENT '',
29 `following` varchar(255) COMMENT '',
30 `followers` varchar(255) COMMENT '',
31 `inbox` varchar(255) NOT NULL COMMENT '',
32 `outbox` varchar(255) COMMENT '',
33 `sharedinbox` varchar(255) COMMENT '',
34 `manually-approve` boolean COMMENT '',
35 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
36 `name` varchar(255) COMMENT '',
37 `about` text COMMENT '',
38 `photo` varchar(255) COMMENT '',
39 `addr` varchar(255) COMMENT '',
40 `alias` varchar(255) COMMENT '',
41 `pubkey` text COMMENT '',
42 `baseurl` varchar(255) COMMENT 'baseurl of the ap contact',
43 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
45 INDEX `addr` (`addr`(32)),
46 INDEX `alias` (`alias`(190)),
47 INDEX `url` (`followers`(190))
48 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='ActivityPub compatible contacts - used in the ActivityPub implementation';
53 CREATE TABLE IF NOT EXISTS `attach` (
54 `id` int unsigned NOT NULL auto_increment COMMENT 'generated index',
55 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
56 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT 'hash',
57 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT 'filename of original',
58 `filetype` varchar(64) NOT NULL DEFAULT '' COMMENT 'mimetype',
59 `filesize` int unsigned NOT NULL DEFAULT 0 COMMENT 'size in bytes',
60 `data` longblob NOT NULL COMMENT 'file data',
61 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
62 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
63 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>',
64 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
65 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
66 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
67 `backend-class` tinytext COMMENT 'Storage backend class',
68 `backend-ref` text COMMENT 'Storage backend data reference',
70 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='file attachments';
75 CREATE TABLE IF NOT EXISTS `auth_codes` (
76 `id` varchar(40) NOT NULL COMMENT '',
77 `client_id` varchar(20) NOT NULL DEFAULT '' COMMENT '',
78 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
79 `expires` int NOT NULL DEFAULT 0 COMMENT '',
80 `scope` varchar(250) NOT NULL DEFAULT '' COMMENT '',
82 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
87 CREATE TABLE IF NOT EXISTS `cache` (
88 `k` varbinary(255) NOT NULL COMMENT 'cache key',
89 `v` mediumtext COMMENT 'cached serialized value',
90 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
91 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache insertion',
93 INDEX `k_expires` (`k`,`expires`)
94 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Stores temporary data';
99 CREATE TABLE IF NOT EXISTS `challenge` (
100 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
101 `challenge` varchar(255) NOT NULL DEFAULT '' COMMENT '',
102 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
103 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
104 `type` varchar(255) NOT NULL DEFAULT '' COMMENT '',
105 `last_update` varchar(255) NOT NULL DEFAULT '' COMMENT '',
107 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
112 CREATE TABLE IF NOT EXISTS `clients` (
113 `client_id` varchar(20) NOT NULL COMMENT '',
114 `pw` varchar(20) NOT NULL DEFAULT '' COMMENT '',
115 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
116 `name` text COMMENT '',
117 `icon` text COMMENT '',
118 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
119 PRIMARY KEY(`client_id`)
120 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
125 CREATE TABLE IF NOT EXISTS `config` (
126 `id` int unsigned NOT NULL auto_increment COMMENT '',
127 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
128 `k` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
129 `v` mediumtext COMMENT '',
131 UNIQUE INDEX `cat_k` (`cat`,`k`)
132 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='main configuration storage';
137 CREATE TABLE IF NOT EXISTS `contact` (
138 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
139 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
140 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
141 `self` boolean NOT NULL DEFAULT '0' COMMENT '1 if the contact is the user him/her self',
142 `remote_self` boolean NOT NULL DEFAULT '0' COMMENT '',
143 `rel` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'The kind of the relation between the user and the contact',
144 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
145 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network protocol of the contact',
146 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
147 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
148 `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
149 `about` text COMMENT '',
150 `keywords` text COMMENT 'public keywords (interests) of the contact',
151 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
152 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
153 `attag` varchar(255) NOT NULL DEFAULT '' COMMENT '',
154 `avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
155 `photo` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo of the contact',
156 `thumb` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (thumb size)',
157 `micro` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (micro size)',
158 `site-pubkey` text COMMENT '',
159 `issued-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
160 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
161 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
162 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
163 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
164 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
165 `pubkey` text COMMENT 'RSA public key 4096 bit',
166 `prvkey` text COMMENT 'RSA private key 4096 bit',
167 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
168 `request` varchar(255) COMMENT '',
169 `notify` varchar(255) COMMENT '',
170 `poll` varchar(255) COMMENT '',
171 `confirm` varchar(255) COMMENT '',
172 `poco` varchar(255) COMMENT '',
173 `aes_allow` boolean NOT NULL DEFAULT '0' COMMENT '',
174 `ret-aes` boolean NOT NULL DEFAULT '0' COMMENT '',
175 `usehub` boolean NOT NULL DEFAULT '0' COMMENT '',
176 `subhub` boolean NOT NULL DEFAULT '0' COMMENT '',
177 `hub-verify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
178 `last-update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last try to update the contact info',
179 `success_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful contact update',
180 `failure_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed update',
181 `name-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
182 `uri-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
183 `avatar-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
184 `term-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
185 `last-item` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'date of the last post',
186 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
187 `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
188 `readonly` boolean NOT NULL DEFAULT '0' COMMENT 'posts of the contact are readonly',
189 `writable` boolean NOT NULL DEFAULT '0' COMMENT '',
190 `forum` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a forum',
191 `prv` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a private group',
192 `contact-type` tinyint NOT NULL DEFAULT 0 COMMENT '',
193 `hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
194 `archive` boolean NOT NULL DEFAULT '0' COMMENT '',
195 `pending` boolean NOT NULL DEFAULT '1' COMMENT '',
196 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'Contact has been deleted',
197 `rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
198 `reason` text COMMENT '',
199 `closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
200 `info` mediumtext COMMENT '',
201 `profile-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
202 `bdyear` varchar(4) NOT NULL DEFAULT '' COMMENT '',
203 `bd` date NOT NULL DEFAULT '0001-01-01' COMMENT '',
204 `notify_new_posts` boolean NOT NULL DEFAULT '0' COMMENT '',
205 `fetch_further_information` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
206 `ffi_keyword_blacklist` text COMMENT '',
208 INDEX `uid_name` (`uid`,`name`(190)),
209 INDEX `self_uid` (`self`,`uid`),
210 INDEX `alias_uid` (`alias`(32),`uid`),
211 INDEX `pending_uid` (`pending`,`uid`),
212 INDEX `blocked_uid` (`blocked`,`uid`),
213 INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
214 INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
215 INDEX `addr_uid` (`addr`(32),`uid`),
216 INDEX `nurl_uid` (`nurl`(32),`uid`),
217 INDEX `nick_uid` (`nick`(32),`uid`),
218 INDEX `dfrn-id` (`dfrn-id`(64)),
219 INDEX `issued-id` (`issued-id`(64))
220 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contact table';
225 CREATE TABLE IF NOT EXISTS `conv` (
226 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
227 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this conversation',
228 `recips` text COMMENT 'sender_handle;recipient_handle',
229 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
230 `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'handle of creator',
231 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation timestamp',
232 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'edited timestamp',
233 `subject` text COMMENT 'subject of initial message',
236 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
239 -- TABLE conversation
241 CREATE TABLE IF NOT EXISTS `conversation` (
242 `item-uri` varbinary(255) NOT NULL COMMENT 'Original URI of the item - unrelated to the table with the same name',
243 `reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'URI to which this item is a reply',
244 `conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
245 `conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
246 `protocol` tinyint unsigned NOT NULL DEFAULT 255 COMMENT 'The protocol of the item',
247 `source` mediumtext COMMENT 'Original source',
248 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
249 PRIMARY KEY(`item-uri`),
250 INDEX `conversation-uri` (`conversation-uri`),
251 INDEX `received` (`received`)
252 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
255 -- TABLE diaspora-interaction
257 CREATE TABLE IF NOT EXISTS `diaspora-interaction` (
258 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
259 `interaction` mediumtext COMMENT 'The Diaspora interaction',
260 PRIMARY KEY(`uri-id`)
261 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Signed Diaspora Interaction';
266 CREATE TABLE IF NOT EXISTS `event` (
267 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
268 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
269 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
270 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact_id (ID of the contact in contact table)',
271 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
272 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
273 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
274 `start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event start time',
275 `finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event end time',
276 `summary` text COMMENT 'short description or title of the event',
277 `desc` text COMMENT 'event description',
278 `location` text COMMENT 'event location',
279 `type` varchar(20) NOT NULL DEFAULT '' COMMENT 'event or birthday',
280 `nofinish` boolean NOT NULL DEFAULT '0' COMMENT 'if event does have no end this is 1',
281 `adjust` boolean NOT NULL DEFAULT '1' COMMENT 'adjust to timezone of the recipient (0 or 1)',
282 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '0 or 1',
283 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
284 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
285 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
286 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
288 INDEX `uid_start` (`uid`,`start`)
289 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Events';
294 CREATE TABLE IF NOT EXISTS `fcontact` (
295 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
296 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'unique id',
297 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
298 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
299 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
300 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
301 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
302 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
303 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
304 `notify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
305 `poll` varchar(255) NOT NULL DEFAULT '' COMMENT '',
306 `confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '',
307 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
308 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
309 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
310 `pubkey` text COMMENT '',
311 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
313 INDEX `addr` (`addr`(32)),
314 UNIQUE INDEX `url` (`url`(190))
315 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora compatible contacts - used in the Diaspora implementation';
320 CREATE TABLE IF NOT EXISTS `fsuggest` (
321 `id` int unsigned NOT NULL auto_increment COMMENT '',
322 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
323 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
324 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
325 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
326 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
327 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
328 `note` text COMMENT '',
329 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
331 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='friend suggestion stuff';
336 CREATE TABLE IF NOT EXISTS `gcign` (
337 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
338 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Local User id',
339 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'gcontact.id of ignored contact',
342 INDEX `gcid` (`gcid`)
343 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contacts ignored by friend suggestions';
348 CREATE TABLE IF NOT EXISTS `gcontact` (
349 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
350 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
351 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
352 `url` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the contacts profile page',
353 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
354 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the profile photo',
355 `connect` varchar(255) NOT NULL DEFAULT '' COMMENT '',
356 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
357 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
358 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
359 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
360 `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
361 `about` text COMMENT '',
362 `keywords` text COMMENT 'puplic keywords (interests)',
363 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
364 `birthday` varchar(32) NOT NULL DEFAULT '0001-01-01' COMMENT '',
365 `community` boolean NOT NULL DEFAULT '0' COMMENT '1 if contact is forum account',
366 `contact-type` tinyint NOT NULL DEFAULT -1 COMMENT '',
367 `hide` boolean NOT NULL DEFAULT '0' COMMENT '1 = should be hidden from search',
368 `nsfw` boolean NOT NULL DEFAULT '0' COMMENT '1 = contact posts nsfw content',
369 `network` char(4) NOT NULL DEFAULT '' COMMENT 'social network protocol',
370 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
371 `notify` varchar(255) COMMENT '',
372 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
373 `generation` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
374 `server_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'baseurl of the contacts server',
376 UNIQUE INDEX `nurl` (`nurl`(190)),
377 INDEX `name` (`name`(64)),
378 INDEX `nick` (`nick`(32)),
379 INDEX `addr` (`addr`(64)),
380 INDEX `hide_network_updated` (`hide`,`network`,`updated`),
381 INDEX `updated` (`updated`)
382 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='global contacts';
387 CREATE TABLE IF NOT EXISTS `glink` (
388 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
389 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
390 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
391 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
392 `zcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
393 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
395 UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
396 INDEX `gcid` (`gcid`)
397 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='\'friends of friends\' linkages derived from poco';
402 CREATE TABLE IF NOT EXISTS `group` (
403 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
404 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
405 `visible` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the member list is not private',
406 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the group has been deleted',
407 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'human readable name of group',
410 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, group info';
413 -- TABLE group_member
415 CREATE TABLE IF NOT EXISTS `group_member` (
416 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
417 `gid` int unsigned NOT NULL DEFAULT 0 COMMENT 'groups.id of the associated group',
418 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id of the member assigned to the associated group',
420 INDEX `contactid` (`contact-id`),
421 UNIQUE INDEX `gid_contactid` (`gid`,`contact-id`)
422 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, member info';
427 CREATE TABLE IF NOT EXISTS `gserver` (
428 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
429 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
430 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
431 `version` varchar(255) NOT NULL DEFAULT '' COMMENT '',
432 `site_name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
433 `info` text COMMENT '',
434 `register_policy` tinyint NOT NULL DEFAULT 0 COMMENT '',
435 `registered-users` int unsigned NOT NULL DEFAULT 0 COMMENT 'Number of registered users',
436 `poco` varchar(255) NOT NULL DEFAULT '' COMMENT '',
437 `noscrape` varchar(255) NOT NULL DEFAULT '' COMMENT '',
438 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
439 `platform` varchar(255) NOT NULL DEFAULT '' COMMENT '',
440 `relay-subscribe` boolean NOT NULL DEFAULT '0' COMMENT 'Has the server subscribed to the relay system',
441 `relay-scope` varchar(10) NOT NULL DEFAULT '' COMMENT 'The scope of messages that the server wants to get',
442 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
443 `last_poco_query` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
444 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
445 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
447 UNIQUE INDEX `nurl` (`nurl`(190))
448 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Global servers';
453 CREATE TABLE IF NOT EXISTS `gserver-tag` (
454 `gserver-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'The id of the gserver',
455 `tag` varchar(100) NOT NULL DEFAULT '' COMMENT 'Tag that the server has subscribed',
456 PRIMARY KEY(`gserver-id`,`tag`),
458 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Tags that the server has subscribed';
463 CREATE TABLE IF NOT EXISTS `hook` (
464 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
465 `hook` varbinary(100) NOT NULL DEFAULT '' COMMENT 'name of hook',
466 `file` varbinary(200) NOT NULL DEFAULT '' COMMENT 'relative filename of hook handler',
467 `function` varbinary(200) NOT NULL DEFAULT '' COMMENT 'function name of hook handler',
468 `priority` smallint unsigned NOT NULL DEFAULT 0 COMMENT 'not yet implemented - can be used to sort conflicts in hook handling by calling handlers in priority order',
470 UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
471 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='addon hook registry';
474 -- TABLE inbox-status
476 CREATE TABLE IF NOT EXISTS `inbox-status` (
477 `url` varbinary(255) NOT NULL COMMENT 'URL of the inbox',
478 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date of this entry',
479 `success` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful delivery',
480 `failure` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed delivery',
481 `previous` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Previous delivery date',
482 `archive` boolean NOT NULL DEFAULT '0' COMMENT 'Is the inbox archived?',
483 `shared` boolean NOT NULL DEFAULT '0' COMMENT 'Is it a shared inbox?',
485 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Status of ActivityPub inboxes';
490 CREATE TABLE IF NOT EXISTS `intro` (
491 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
492 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
493 `fid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
494 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
495 `knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
496 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
497 `note` text COMMENT '',
498 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
499 `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
500 `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
501 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
503 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
508 CREATE TABLE IF NOT EXISTS `item` (
509 `id` int unsigned NOT NULL auto_increment,
510 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this item',
511 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
512 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
513 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
514 `parent` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id of the parent to this item if it is a reply of some form; otherwise this must be set to the id of this item',
515 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT 'uri of the parent to this item',
516 `parent-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the parent uri',
517 `thr-parent` varchar(255) NOT NULL DEFAULT '' COMMENT 'If the parent of this item is not the top-level item in the conversation, the uri of the immediate parent; otherwise set to parent-uri',
518 `thr-parent-id` int unsigned COMMENT 'Id of the item-uri table that contains the thread parent uri',
519 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation timestamp.',
520 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last edit (default is created)',
521 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last comment/reply to this item',
522 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime',
523 `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date that something in the conversation changed, indicating clients should fetch the conversation again',
524 `gravity` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
525 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network from where the item comes from',
526 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
527 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
528 `icid` int unsigned COMMENT 'Id of the item-content table entry that contains the whole item content',
529 `iaid` int unsigned COMMENT 'Id of the item-activity table entry that contains the activity data',
530 `extid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
531 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
532 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
533 `private` boolean NOT NULL DEFAULT '0' COMMENT 'distribution is restricted',
534 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
535 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
536 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'item has been deleted',
537 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id which owns this copy of the item',
538 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
539 `wall` boolean NOT NULL DEFAULT '0' COMMENT 'This item was posted to the wall of uid',
540 `origin` boolean NOT NULL DEFAULT '0' COMMENT 'item originated at this site',
541 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
542 `starred` boolean NOT NULL DEFAULT '0' COMMENT 'item has been favourited',
543 `unseen` boolean NOT NULL DEFAULT '1' COMMENT 'item has not been seen',
544 `mention` boolean NOT NULL DEFAULT '0' COMMENT 'The owner of this item was mentioned in it',
545 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
546 `psid` int unsigned COMMENT 'ID of the permission set of this post',
547 `resource-id` varchar(32) NOT NULL DEFAULT '' COMMENT 'Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type',
548 `event-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Used to link to the event.id',
549 `attach` mediumtext COMMENT 'JSON structure representing attachments to this item',
550 `allow_cid` mediumtext COMMENT 'Deprecated',
551 `allow_gid` mediumtext COMMENT 'Deprecated',
552 `deny_cid` mediumtext COMMENT 'Deprecated',
553 `deny_gid` mediumtext COMMENT 'Deprecated',
554 `postopts` text COMMENT 'Deprecated',
555 `inform` mediumtext COMMENT 'Deprecated',
556 `type` varchar(20) COMMENT 'Deprecated',
557 `bookmark` boolean COMMENT 'Deprecated',
558 `file` mediumtext COMMENT 'Deprecated',
559 `location` varchar(255) COMMENT 'Deprecated',
560 `coord` varchar(255) COMMENT 'Deprecated',
561 `tag` mediumtext COMMENT 'Deprecated',
562 `plink` varchar(255) COMMENT 'Deprecated',
563 `title` varchar(255) COMMENT 'Deprecated',
564 `content-warning` varchar(255) COMMENT 'Deprecated',
565 `body` mediumtext COMMENT 'Deprecated',
566 `app` varchar(255) COMMENT 'Deprecated',
567 `verb` varchar(100) COMMENT 'Deprecated',
568 `object-type` varchar(100) COMMENT 'Deprecated',
569 `object` text COMMENT 'Deprecated',
570 `target-type` varchar(100) COMMENT 'Deprecated',
571 `target` text COMMENT 'Deprecated',
572 `author-name` varchar(255) COMMENT 'Deprecated',
573 `author-link` varchar(255) COMMENT 'Deprecated',
574 `author-avatar` varchar(255) COMMENT 'Deprecated',
575 `owner-name` varchar(255) COMMENT 'Deprecated',
576 `owner-link` varchar(255) COMMENT 'Deprecated',
577 `owner-avatar` varchar(255) COMMENT 'Deprecated',
578 `rendered-hash` varchar(32) COMMENT 'Deprecated',
579 `rendered-html` mediumtext COMMENT 'Deprecated',
581 INDEX `guid` (`guid`(191)),
582 INDEX `uri` (`uri`(191)),
583 INDEX `parent` (`parent`),
584 INDEX `parent-uri` (`parent-uri`(191)),
585 INDEX `extid` (`extid`(191)),
586 INDEX `uid_id` (`uid`,`id`),
587 INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
588 INDEX `uid_created` (`uid`,`created`),
589 INDEX `uid_commented` (`uid`,`commented`),
590 INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
591 INDEX `uid_network_received` (`uid`,`network`,`received`),
592 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
593 INDEX `uid_thrparent` (`uid`,`thr-parent`(190)),
594 INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
595 INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
596 INDEX `authorid_created` (`author-id`,`created`),
597 INDEX `ownerid` (`owner-id`),
598 INDEX `contact-id` (`contact-id`),
599 INDEX `uid_uri` (`uid`,`uri`(190)),
600 INDEX `resource-id` (`resource-id`),
601 INDEX `deleted_changed` (`deleted`,`changed`),
602 INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
603 INDEX `uid_eventid` (`uid`,`event-id`),
604 INDEX `icid` (`icid`),
605 INDEX `iaid` (`iaid`),
606 INDEX `psid_wall` (`psid`,`wall`)
607 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
610 -- TABLE item-activity
612 CREATE TABLE IF NOT EXISTS `item-activity` (
613 `id` int unsigned NOT NULL auto_increment,
614 `uri` varchar(255) COMMENT '',
615 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
616 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
617 `activity` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
619 UNIQUE INDEX `uri-hash` (`uri-hash`),
620 INDEX `uri` (`uri`(191)),
621 INDEX `uri-id` (`uri-id`)
622 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activities for items';
625 -- TABLE item-content
627 CREATE TABLE IF NOT EXISTS `item-content` (
628 `id` int unsigned NOT NULL auto_increment,
629 `uri` varchar(255) COMMENT '',
630 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
631 `uri-plink-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
632 `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'item title',
633 `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
634 `body` mediumtext COMMENT 'item body content',
635 `location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
636 `coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
637 `language` text COMMENT 'Language information about this post',
638 `app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
639 `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
640 `rendered-html` mediumtext COMMENT 'item.body converted to html',
641 `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams object type',
642 `object` text COMMENT 'JSON encoded object structure unless it is an implied object (normal post)',
643 `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
644 `target` text COMMENT 'JSON encoded target structure if used',
645 `plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
646 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams verb',
648 UNIQUE INDEX `uri-plink-hash` (`uri-plink-hash`),
649 INDEX `uri` (`uri`(191)),
650 INDEX `uri-id` (`uri-id`)
651 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
654 -- TABLE item-delivery-data
656 CREATE TABLE IF NOT EXISTS `item-delivery-data` (
657 `iid` int unsigned NOT NULL COMMENT 'Item id',
658 `postopts` text COMMENT 'External post connectors add their network name to this comma-separated string to identify that they should be delivered to these networks during delivery',
659 `inform` mediumtext COMMENT 'Additional receivers of the linked item',
660 `queue_count` mediumint NOT NULL DEFAULT 0 COMMENT 'Initial number of delivery recipients, used as item.delivery_queue_count',
661 `queue_done` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries, used as item.delivery_queue_done',
663 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items';
668 CREATE TABLE IF NOT EXISTS `item-uri` (
669 `id` int unsigned NOT NULL auto_increment,
670 `uri` varbinary(255) NOT NULL COMMENT 'URI of an item',
671 `guid` varbinary(255) COMMENT 'A unique identifier for an item',
673 UNIQUE INDEX `uri` (`uri`),
674 INDEX `guid` (`guid`)
675 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='URI and GUID for items';
680 CREATE TABLE IF NOT EXISTS `locks` (
681 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
682 `name` varchar(128) NOT NULL DEFAULT '' COMMENT '',
683 `locked` boolean NOT NULL DEFAULT '0' COMMENT '',
684 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process ID',
685 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
687 INDEX `name_expires` (`name`,`expires`)
688 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
693 CREATE TABLE IF NOT EXISTS `mail` (
694 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
695 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
696 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
697 `from-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the sender',
698 `from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
699 `from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
700 `contact-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact.id',
701 `convid` int unsigned NOT NULL DEFAULT 0 COMMENT 'conv.id',
702 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
703 `body` mediumtext COMMENT '',
704 `seen` boolean NOT NULL DEFAULT '0' COMMENT 'if message visited it is 1',
705 `reply` boolean NOT NULL DEFAULT '0' COMMENT '',
706 `replied` boolean NOT NULL DEFAULT '0' COMMENT '',
707 `unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
708 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
709 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
710 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
712 INDEX `uid_seen` (`uid`,`seen`),
713 INDEX `convid` (`convid`),
714 INDEX `uri` (`uri`(64)),
715 INDEX `parent-uri` (`parent-uri`(64)),
716 INDEX `contactid` (`contact-id`(32))
717 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
722 CREATE TABLE IF NOT EXISTS `mailacct` (
723 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
724 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
725 `server` varchar(255) NOT NULL DEFAULT '' COMMENT '',
726 `port` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
727 `ssltype` varchar(16) NOT NULL DEFAULT '' COMMENT '',
728 `mailbox` varchar(255) NOT NULL DEFAULT '' COMMENT '',
729 `user` varchar(255) NOT NULL DEFAULT '' COMMENT '',
730 `pass` text COMMENT '',
731 `reply_to` varchar(255) NOT NULL DEFAULT '' COMMENT '',
732 `action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
733 `movetofolder` varchar(255) NOT NULL DEFAULT '' COMMENT '',
734 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
735 `last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
737 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Mail account data for fetching mails';
742 CREATE TABLE IF NOT EXISTS `manage` (
743 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
744 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
745 `mid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
747 UNIQUE INDEX `uid_mid` (`uid`,`mid`)
748 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='table of accounts that can manage each other';
753 CREATE TABLE IF NOT EXISTS `notify` (
754 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
755 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT '',
756 `type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
757 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
758 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
759 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
760 `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
761 `msg` mediumtext COMMENT '',
762 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
763 `link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
764 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
765 `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
766 `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
767 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
768 `otype` varchar(10) NOT NULL DEFAULT '' COMMENT '',
769 `name_cache` tinytext COMMENT 'Cached bbcode parsing of name',
770 `msg_cache` mediumtext COMMENT 'Cached bbcode parsing of msg',
772 INDEX `hash_uid` (`hash`,`uid`),
773 INDEX `seen_uid_date` (`seen`,`uid`,`date`),
774 INDEX `uid_date` (`uid`,`date`),
775 INDEX `uid_type_link` (`uid`,`type`,`link`(190))
776 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='notifications';
779 -- TABLE notify-threads
781 CREATE TABLE IF NOT EXISTS `notify-threads` (
782 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
783 `notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
784 `master-parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
785 `parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
786 `receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
788 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
793 CREATE TABLE IF NOT EXISTS `oembed` (
794 `url` varbinary(255) NOT NULL COMMENT 'page url',
795 `maxwidth` mediumint unsigned NOT NULL COMMENT 'Maximum width passed to Oembed',
796 `content` mediumtext COMMENT 'OEmbed data of the page',
797 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
798 PRIMARY KEY(`url`,`maxwidth`),
799 INDEX `created` (`created`)
800 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for OEmbed queries';
803 -- TABLE openwebauth-token
805 CREATE TABLE IF NOT EXISTS `openwebauth-token` (
806 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
807 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
808 `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Verify type',
809 `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'A generated token',
810 `meta` varchar(255) NOT NULL DEFAULT '' COMMENT '',
811 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
813 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store OpenWebAuth token to verify contacts';
818 CREATE TABLE IF NOT EXISTS `parsed_url` (
819 `url` varbinary(255) NOT NULL COMMENT 'page url',
820 `guessing` boolean NOT NULL DEFAULT '0' COMMENT 'is the \'guessing\' mode active?',
821 `oembed` boolean NOT NULL DEFAULT '0' COMMENT 'is the data the result of oembed?',
822 `content` mediumtext COMMENT 'page data',
823 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
824 PRIMARY KEY(`url`,`guessing`,`oembed`),
825 INDEX `created` (`created`)
826 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for \'parse_url\' queries';
829 -- TABLE participation
831 CREATE TABLE IF NOT EXISTS `participation` (
832 `iid` int unsigned NOT NULL COMMENT '',
833 `server` varchar(60) NOT NULL COMMENT '',
834 `cid` int unsigned NOT NULL COMMENT '',
835 `fid` int unsigned NOT NULL COMMENT '',
836 PRIMARY KEY(`iid`,`server`),
839 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Storage for participation messages from Diaspora';
844 CREATE TABLE IF NOT EXISTS `pconfig` (
845 `id` int unsigned NOT NULL auto_increment COMMENT '',
846 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
847 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
848 `k` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
849 `v` mediumtext COMMENT '',
851 UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
852 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='personal (per user) configuration storage';
855 -- TABLE permissionset
857 CREATE TABLE IF NOT EXISTS `permissionset` (
858 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
859 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id of this permission set',
860 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
861 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
862 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
863 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
865 INDEX `uid_allow_cid_allow_gid_deny_cid_deny_gid` (`allow_cid`(50),`allow_gid`(30),`deny_cid`(50),`deny_gid`(30))
866 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
871 CREATE TABLE IF NOT EXISTS `photo` (
872 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
873 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
874 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
875 `guid` char(16) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this photo',
876 `resource-id` char(32) NOT NULL DEFAULT '' COMMENT '',
877 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation date',
878 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edited date',
879 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
880 `desc` text COMMENT '',
881 `album` varchar(255) NOT NULL DEFAULT '' COMMENT 'The name of the album to which the photo belongs',
882 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
883 `type` varchar(30) NOT NULL DEFAULT 'image/jpeg',
884 `height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
885 `width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
886 `datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
887 `data` mediumblob NOT NULL COMMENT '',
888 `scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
889 `profile` boolean NOT NULL DEFAULT '0' COMMENT '',
890 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
891 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
892 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
893 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
894 `backend-class` tinytext COMMENT 'Storage backend class',
895 `backend-ref` text COMMENT 'Storage backend data reference',
896 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
898 INDEX `contactid` (`contact-id`),
899 INDEX `uid_contactid` (`uid`,`contact-id`),
900 INDEX `uid_profile` (`uid`,`profile`),
901 INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
902 INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`,`created`),
903 INDEX `resource-id` (`resource-id`)
904 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='photo storage';
909 CREATE TABLE IF NOT EXISTS `poll` (
910 `id` int unsigned NOT NULL auto_increment COMMENT '',
911 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
912 `q0` text COMMENT '',
913 `q1` text COMMENT '',
914 `q2` text COMMENT '',
915 `q3` text COMMENT '',
916 `q4` text COMMENT '',
917 `q5` text COMMENT '',
918 `q6` text COMMENT '',
919 `q7` text COMMENT '',
920 `q8` text COMMENT '',
921 `q9` text COMMENT '',
924 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently unused table for storing poll results';
929 CREATE TABLE IF NOT EXISTS `poll_result` (
930 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
931 `poll_id` int unsigned NOT NULL DEFAULT 0,
932 `choice` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
934 INDEX `poll_id` (`poll_id`)
935 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='data for polls - currently unused';
940 CREATE TABLE IF NOT EXISTS `process` (
941 `pid` int unsigned NOT NULL COMMENT '',
942 `command` varbinary(32) NOT NULL DEFAULT '' COMMENT '',
943 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
945 INDEX `command` (`command`)
946 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently running system processes';
951 CREATE TABLE IF NOT EXISTS `profile` (
952 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
953 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
954 `profile-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name of the profile',
955 `is-default` boolean NOT NULL DEFAULT '0' COMMENT 'Mark this profile as default profile',
956 `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT 'Hide friend list from viewers of this profile',
957 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
958 `pdesc` varchar(255) NOT NULL DEFAULT '' COMMENT 'Title or description',
959 `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT 'Day of birth',
960 `address` varchar(255) NOT NULL DEFAULT '' COMMENT '',
961 `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '',
962 `region` varchar(255) NOT NULL DEFAULT '' COMMENT '',
963 `postal-code` varchar(32) NOT NULL DEFAULT '' COMMENT '',
964 `country-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
965 `hometown` varchar(255) NOT NULL DEFAULT '' COMMENT '',
966 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
967 `marital` varchar(255) NOT NULL DEFAULT '' COMMENT '',
968 `with` text COMMENT '',
969 `howlong` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
970 `sexual` varchar(255) NOT NULL DEFAULT '' COMMENT '',
971 `politic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
972 `religion` varchar(255) NOT NULL DEFAULT '' COMMENT '',
973 `pub_keywords` text COMMENT '',
974 `prv_keywords` text COMMENT '',
975 `likes` text COMMENT '',
976 `dislikes` text COMMENT '',
977 `about` text COMMENT '',
978 `summary` varchar(255) NOT NULL DEFAULT '' COMMENT '',
979 `music` text COMMENT '',
980 `book` text COMMENT '',
981 `tv` text COMMENT '',
982 `film` text COMMENT '',
983 `interest` text COMMENT '',
984 `romance` text COMMENT '',
985 `work` text COMMENT '',
986 `education` text COMMENT '',
987 `contact` text COMMENT '',
988 `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
989 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
990 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
991 `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
992 `publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
993 `net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
995 INDEX `uid_is-default` (`uid`,`is-default`),
996 FULLTEXT INDEX `pub_keywords` (`pub_keywords`)
997 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
1000 -- TABLE profile_check
1002 CREATE TABLE IF NOT EXISTS `profile_check` (
1003 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1004 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1005 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
1006 `dfrn_id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1007 `sec` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1008 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1010 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='DFRN remote auth use';
1013 -- TABLE push_subscriber
1015 CREATE TABLE IF NOT EXISTS `push_subscriber` (
1016 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1017 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1018 `callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1019 `topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1020 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1021 `push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1022 `last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
1023 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1024 `renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
1025 `secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1027 INDEX `next_try` (`next_try`)
1028 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Used for OStatus: Contains feed subscribers';
1033 CREATE TABLE IF NOT EXISTS `queue` (
1034 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1035 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Message receiver',
1036 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Receiver\'s network',
1037 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'Unique GUID of the message',
1038 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date, when the message was created',
1039 `last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last trial',
1040 `next` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1041 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1042 `content` mediumtext COMMENT '',
1043 `batch` boolean NOT NULL DEFAULT '0' COMMENT '',
1045 INDEX `last` (`last`),
1046 INDEX `next` (`next`)
1047 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Queue for messages that couldn\'t be delivered';
1052 CREATE TABLE IF NOT EXISTS `register` (
1053 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1054 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1055 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1056 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1057 `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1058 `language` varchar(16) NOT NULL DEFAULT '' COMMENT '',
1059 `note` text COMMENT '',
1061 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
1066 CREATE TABLE IF NOT EXISTS `search` (
1067 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1068 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1069 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1072 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
1077 CREATE TABLE IF NOT EXISTS `session` (
1078 `id` bigint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1079 `sid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
1080 `data` text COMMENT '',
1081 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1083 INDEX `sid` (`sid`(64)),
1084 INDEX `expire` (`expire`)
1085 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='web session storage';
1090 CREATE TABLE IF NOT EXISTS `sign` (
1091 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1092 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
1093 `signed_text` mediumtext COMMENT '',
1094 `signature` text COMMENT '',
1095 `signer` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1097 UNIQUE INDEX `iid` (`iid`)
1098 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora signatures';
1103 CREATE TABLE IF NOT EXISTS `term` (
1104 `tid` int unsigned NOT NULL auto_increment COMMENT '',
1105 `oid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1106 `otype` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1107 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1108 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1109 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1110 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1111 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1112 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1113 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
1114 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1116 INDEX `term_type` (`term`(64),`type`),
1117 INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`(32)),
1118 INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
1119 INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
1120 INDEX `guid` (`guid`(64))
1121 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='item taxonomy (categories, tags, etc.) table';
1126 CREATE TABLE IF NOT EXISTS `thread` (
1127 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'sequential ID',
1128 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1129 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1130 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
1131 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item author',
1132 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1133 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1134 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1135 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1136 `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1137 `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
1138 `private` boolean NOT NULL DEFAULT '0' COMMENT '',
1139 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
1140 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
1141 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
1142 `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
1143 `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
1144 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
1145 `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
1146 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
1147 `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
1148 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1149 `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
1150 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
1151 `bookmark` boolean COMMENT '',
1153 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
1154 INDEX `uid_network_created` (`uid`,`network`,`created`),
1155 INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
1156 INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
1157 INDEX `contactid` (`contact-id`),
1158 INDEX `ownerid` (`owner-id`),
1159 INDEX `authorid` (`author-id`),
1160 INDEX `uid_created` (`uid`,`created`),
1161 INDEX `uid_commented` (`uid`,`commented`),
1162 INDEX `uid_wall_created` (`uid`,`wall`,`created`),
1163 INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`)
1164 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Thread related data';
1169 CREATE TABLE IF NOT EXISTS `tokens` (
1170 `id` varchar(40) NOT NULL COMMENT '',
1171 `secret` text COMMENT '',
1172 `client_id` varchar(20) NOT NULL DEFAULT '',
1173 `expires` int NOT NULL DEFAULT 0 COMMENT '',
1174 `scope` varchar(200) NOT NULL DEFAULT '' COMMENT '',
1175 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1177 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
1182 CREATE TABLE IF NOT EXISTS `user` (
1183 `uid` mediumint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1184 `parent-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'The parent user that has full control about this user',
1185 `guid` varchar(64) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this user',
1186 `username` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this user is known by',
1187 `password` varchar(255) NOT NULL DEFAULT '' COMMENT 'encrypted password',
1188 `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?',
1189 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT 'nick- and user name',
1190 `email` varchar(255) NOT NULL DEFAULT '' COMMENT 'the users email address',
1191 `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1192 `timezone` varchar(128) NOT NULL DEFAULT '' COMMENT 'PHP-legal timezone',
1193 `language` varchar(32) NOT NULL DEFAULT 'en' COMMENT 'default language',
1194 `register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of registration',
1195 `login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last login',
1196 `default-location` varchar(255) NOT NULL DEFAULT '' COMMENT 'Default for item.location',
1197 `allow_location` boolean NOT NULL DEFAULT '0' COMMENT '1 allows to display the location',
1198 `theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
1199 `pubkey` text COMMENT 'RSA public key 4096 bit',
1200 `prvkey` text COMMENT 'RSA private key 4096 bit',
1201 `spubkey` text COMMENT '',
1202 `sprvkey` text COMMENT '',
1203 `verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
1204 `blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
1205 `blockwall` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to post to the profile page of the user',
1206 `hidewall` boolean NOT NULL DEFAULT '0' COMMENT 'Hide profile details from unkown viewers',
1207 `blocktags` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to tag the post of this user',
1208 `unkmail` boolean NOT NULL DEFAULT '0' COMMENT 'Permit unknown people to send private mails to this user',
1209 `cntunkmail` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1210 `notify-flags` smallint unsigned NOT NULL DEFAULT 65535 COMMENT 'email notification options',
1211 `page-flags` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'page/profile type',
1212 `account-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1213 `prvnets` boolean NOT NULL DEFAULT '0' COMMENT '',
1214 `pwdreset` varchar(255) COMMENT 'Password reset request token',
1215 `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
1216 `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1217 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1218 `account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed',
1219 `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
1220 `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted',
1221 `expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last warning of account expiration',
1222 `def_gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1223 `allow_cid` mediumtext COMMENT 'default permission for this user',
1224 `allow_gid` mediumtext COMMENT 'default permission for this user',
1225 `deny_cid` mediumtext COMMENT 'default permission for this user',
1226 `deny_gid` mediumtext COMMENT 'default permission for this user',
1227 `openidserver` text COMMENT '',
1229 INDEX `nickname` (`nickname`(32))
1230 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='The local users';
1235 CREATE TABLE IF NOT EXISTS `userd` (
1236 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1237 `username` varchar(255) NOT NULL COMMENT '',
1239 INDEX `username` (`username`(32))
1240 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Deleted usernames';
1243 -- TABLE user-contact
1245 CREATE TABLE IF NOT EXISTS `user-contact` (
1246 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the linked public contact',
1247 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1248 `blocked` boolean COMMENT 'Contact is completely blocked for this user',
1249 `ignored` boolean COMMENT 'Posts from this contact are ignored',
1250 `collapsed` boolean COMMENT 'Posts from this contact are collapsed',
1251 PRIMARY KEY(`uid`,`cid`)
1252 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific public contact data';
1257 CREATE TABLE IF NOT EXISTS `user-item` (
1258 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item id',
1259 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1260 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Marker to hide an item from the user',
1261 `ignored` boolean COMMENT 'Ignore this thread if set',
1262 PRIMARY KEY(`uid`,`iid`)
1263 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
1268 CREATE TABLE IF NOT EXISTS `worker-ipc` (
1269 `key` int NOT NULL COMMENT '',
1270 `jobs` boolean COMMENT 'Flag for outstanding jobs',
1272 ) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Inter process communication between the frontend and the worker';
1275 -- TABLE workerqueue
1277 CREATE TABLE IF NOT EXISTS `workerqueue` (
1278 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id',
1279 `parameter` mediumtext COMMENT 'Task command',
1280 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority',
1281 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
1282 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
1283 `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
1284 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1285 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1286 `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
1288 INDEX `done_parameter` (`done`,`parameter`(64)),
1289 INDEX `done_executed` (`done`,`executed`),
1290 INDEX `done_priority_created` (`done`,`priority`,`created`),
1291 INDEX `done_priority_next_try` (`done`,`priority`,`next_try`),
1292 INDEX `done_pid_next_try` (`done`,`pid`,`next_try`),
1293 INDEX `done_pid_priority_created` (`done`,`pid`,`priority`,`created`)
1294 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
1299 CREATE TABLE IF NOT EXISTS `storage` (
1300 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented image data id',
1301 `data` longblob NOT NULL COMMENT 'file data',
1303 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Data stored by Database storage backend';