1 -- ------------------------------------------
2 -- Friendica 2019.03-dev (The Tazmans Flax-lily)
3 -- DB_UPDATE_VERSION 1300
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';
476 CREATE TABLE IF NOT EXISTS `intro` (
477 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
478 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
479 `fid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
480 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
481 `knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
482 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
483 `note` text COMMENT '',
484 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
485 `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
486 `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
487 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
489 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
494 CREATE TABLE IF NOT EXISTS `item` (
495 `id` int unsigned NOT NULL auto_increment,
496 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this item',
497 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
498 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
499 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
500 `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',
501 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT 'uri of the parent to this item',
502 `parent-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the parent uri',
503 `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',
504 `thr-parent-id` int unsigned COMMENT 'Id of the item-uri table that contains the thread parent uri',
505 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation timestamp.',
506 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last edit (default is created)',
507 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last comment/reply to this item',
508 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime',
509 `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',
510 `gravity` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
511 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network from where the item comes from',
512 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
513 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
514 `icid` int unsigned COMMENT 'Id of the item-content table entry that contains the whole item content',
515 `iaid` int unsigned COMMENT 'Id of the item-activity table entry that contains the activity data',
516 `extid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
517 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
518 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
519 `private` boolean NOT NULL DEFAULT '0' COMMENT 'distribution is restricted',
520 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
521 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
522 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'item has been deleted',
523 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id which owns this copy of the item',
524 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
525 `wall` boolean NOT NULL DEFAULT '0' COMMENT 'This item was posted to the wall of uid',
526 `origin` boolean NOT NULL DEFAULT '0' COMMENT 'item originated at this site',
527 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
528 `starred` boolean NOT NULL DEFAULT '0' COMMENT 'item has been favourited',
529 `unseen` boolean NOT NULL DEFAULT '1' COMMENT 'item has not been seen',
530 `mention` boolean NOT NULL DEFAULT '0' COMMENT 'The owner of this item was mentioned in it',
531 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
532 `psid` int unsigned COMMENT 'ID of the permission set of this post',
533 `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',
534 `event-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Used to link to the event.id',
535 `attach` mediumtext COMMENT 'JSON structure representing attachments to this item',
536 `allow_cid` mediumtext COMMENT 'Deprecated',
537 `allow_gid` mediumtext COMMENT 'Deprecated',
538 `deny_cid` mediumtext COMMENT 'Deprecated',
539 `deny_gid` mediumtext COMMENT 'Deprecated',
540 `postopts` text COMMENT 'Deprecated',
541 `inform` mediumtext COMMENT 'Deprecated',
542 `type` varchar(20) COMMENT 'Deprecated',
543 `bookmark` boolean COMMENT 'Deprecated',
544 `file` mediumtext COMMENT 'Deprecated',
545 `location` varchar(255) COMMENT 'Deprecated',
546 `coord` varchar(255) COMMENT 'Deprecated',
547 `tag` mediumtext COMMENT 'Deprecated',
548 `plink` varchar(255) COMMENT 'Deprecated',
549 `title` varchar(255) COMMENT 'Deprecated',
550 `content-warning` varchar(255) COMMENT 'Deprecated',
551 `body` mediumtext COMMENT 'Deprecated',
552 `app` varchar(255) COMMENT 'Deprecated',
553 `verb` varchar(100) COMMENT 'Deprecated',
554 `object-type` varchar(100) COMMENT 'Deprecated',
555 `object` text COMMENT 'Deprecated',
556 `target-type` varchar(100) COMMENT 'Deprecated',
557 `target` text COMMENT 'Deprecated',
558 `author-name` varchar(255) COMMENT 'Deprecated',
559 `author-link` varchar(255) COMMENT 'Deprecated',
560 `author-avatar` varchar(255) COMMENT 'Deprecated',
561 `owner-name` varchar(255) COMMENT 'Deprecated',
562 `owner-link` varchar(255) COMMENT 'Deprecated',
563 `owner-avatar` varchar(255) COMMENT 'Deprecated',
564 `rendered-hash` varchar(32) COMMENT 'Deprecated',
565 `rendered-html` mediumtext COMMENT 'Deprecated',
567 INDEX `guid` (`guid`(191)),
568 INDEX `uri` (`uri`(191)),
569 INDEX `parent` (`parent`),
570 INDEX `parent-uri` (`parent-uri`(191)),
571 INDEX `extid` (`extid`(191)),
572 INDEX `uid_id` (`uid`,`id`),
573 INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
574 INDEX `uid_created` (`uid`,`created`),
575 INDEX `uid_commented` (`uid`,`commented`),
576 INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
577 INDEX `uid_network_received` (`uid`,`network`,`received`),
578 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
579 INDEX `uid_thrparent` (`uid`,`thr-parent`(190)),
580 INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
581 INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
582 INDEX `authorid_created` (`author-id`,`created`),
583 INDEX `ownerid` (`owner-id`),
584 INDEX `contact-id` (`contact-id`),
585 INDEX `uid_uri` (`uid`,`uri`(190)),
586 INDEX `resource-id` (`resource-id`),
587 INDEX `deleted_changed` (`deleted`,`changed`),
588 INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
589 INDEX `uid_eventid` (`uid`,`event-id`),
590 INDEX `icid` (`icid`),
591 INDEX `iaid` (`iaid`),
592 INDEX `psid_wall` (`psid`,`wall`)
593 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
596 -- TABLE item-activity
598 CREATE TABLE IF NOT EXISTS `item-activity` (
599 `id` int unsigned NOT NULL auto_increment,
600 `uri` varchar(255) COMMENT '',
601 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
602 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
603 `activity` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
605 UNIQUE INDEX `uri-hash` (`uri-hash`),
606 INDEX `uri` (`uri`(191)),
607 INDEX `uri-id` (`uri-id`)
608 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activities for items';
611 -- TABLE item-content
613 CREATE TABLE IF NOT EXISTS `item-content` (
614 `id` int unsigned NOT NULL auto_increment,
615 `uri` varchar(255) COMMENT '',
616 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
617 `uri-plink-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
618 `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'item title',
619 `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
620 `body` mediumtext COMMENT 'item body content',
621 `location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
622 `coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
623 `language` text COMMENT 'Language information about this post',
624 `app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
625 `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
626 `rendered-html` mediumtext COMMENT 'item.body converted to html',
627 `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams object type',
628 `object` text COMMENT 'JSON encoded object structure unless it is an implied object (normal post)',
629 `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
630 `target` text COMMENT 'JSON encoded target structure if used',
631 `plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
632 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams verb',
634 UNIQUE INDEX `uri-plink-hash` (`uri-plink-hash`),
635 INDEX `uri` (`uri`(191)),
636 INDEX `uri-id` (`uri-id`)
637 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
640 -- TABLE item-delivery-data
642 CREATE TABLE IF NOT EXISTS `item-delivery-data` (
643 `iid` int unsigned NOT NULL COMMENT 'Item id',
644 `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',
645 `inform` mediumtext COMMENT 'Additional receivers of the linked item',
646 `queue_count` mediumint NOT NULL DEFAULT 0 COMMENT 'Initial number of delivery recipients, used as item.delivery_queue_count',
647 `queue_done` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries, used as item.delivery_queue_done',
649 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items';
654 CREATE TABLE IF NOT EXISTS `item-uri` (
655 `id` int unsigned NOT NULL auto_increment,
656 `uri` varbinary(255) NOT NULL COMMENT 'URI of an item',
657 `guid` varbinary(255) COMMENT 'A unique identifier for an item',
659 UNIQUE INDEX `uri` (`uri`),
660 INDEX `guid` (`guid`)
661 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='URI and GUID for items';
666 CREATE TABLE IF NOT EXISTS `locks` (
667 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
668 `name` varchar(128) NOT NULL DEFAULT '' COMMENT '',
669 `locked` boolean NOT NULL DEFAULT '0' COMMENT '',
670 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process ID',
671 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
673 INDEX `name_expires` (`name`,`expires`)
674 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
679 CREATE TABLE IF NOT EXISTS `mail` (
680 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
681 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
682 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
683 `from-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the sender',
684 `from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
685 `from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
686 `contact-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact.id',
687 `convid` int unsigned NOT NULL DEFAULT 0 COMMENT 'conv.id',
688 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
689 `body` mediumtext COMMENT '',
690 `seen` boolean NOT NULL DEFAULT '0' COMMENT 'if message visited it is 1',
691 `reply` boolean NOT NULL DEFAULT '0' COMMENT '',
692 `replied` boolean NOT NULL DEFAULT '0' COMMENT '',
693 `unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
694 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
695 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
696 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
698 INDEX `uid_seen` (`uid`,`seen`),
699 INDEX `convid` (`convid`),
700 INDEX `uri` (`uri`(64)),
701 INDEX `parent-uri` (`parent-uri`(64)),
702 INDEX `contactid` (`contact-id`(32))
703 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
708 CREATE TABLE IF NOT EXISTS `mailacct` (
709 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
710 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
711 `server` varchar(255) NOT NULL DEFAULT '' COMMENT '',
712 `port` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
713 `ssltype` varchar(16) NOT NULL DEFAULT '' COMMENT '',
714 `mailbox` varchar(255) NOT NULL DEFAULT '' COMMENT '',
715 `user` varchar(255) NOT NULL DEFAULT '' COMMENT '',
716 `pass` text COMMENT '',
717 `reply_to` varchar(255) NOT NULL DEFAULT '' COMMENT '',
718 `action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
719 `movetofolder` varchar(255) NOT NULL DEFAULT '' COMMENT '',
720 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
721 `last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
723 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Mail account data for fetching mails';
728 CREATE TABLE IF NOT EXISTS `manage` (
729 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
730 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
731 `mid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
733 UNIQUE INDEX `uid_mid` (`uid`,`mid`)
734 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='table of accounts that can manage each other';
739 CREATE TABLE IF NOT EXISTS `notify` (
740 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
741 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT '',
742 `type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
743 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
744 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
745 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
746 `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
747 `msg` mediumtext COMMENT '',
748 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
749 `link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
750 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
751 `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
752 `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
753 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
754 `otype` varchar(10) NOT NULL DEFAULT '' COMMENT '',
755 `name_cache` tinytext COMMENT 'Cached bbcode parsing of name',
756 `msg_cache` mediumtext COMMENT 'Cached bbcode parsing of msg',
758 INDEX `hash_uid` (`hash`,`uid`),
759 INDEX `seen_uid_date` (`seen`,`uid`,`date`),
760 INDEX `uid_date` (`uid`,`date`),
761 INDEX `uid_type_link` (`uid`,`type`,`link`(190))
762 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='notifications';
765 -- TABLE notify-threads
767 CREATE TABLE IF NOT EXISTS `notify-threads` (
768 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
769 `notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
770 `master-parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
771 `parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
772 `receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
774 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
779 CREATE TABLE IF NOT EXISTS `oembed` (
780 `url` varbinary(255) NOT NULL COMMENT 'page url',
781 `maxwidth` mediumint unsigned NOT NULL COMMENT 'Maximum width passed to Oembed',
782 `content` mediumtext COMMENT 'OEmbed data of the page',
783 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
784 PRIMARY KEY(`url`,`maxwidth`),
785 INDEX `created` (`created`)
786 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for OEmbed queries';
789 -- TABLE openwebauth-token
791 CREATE TABLE IF NOT EXISTS `openwebauth-token` (
792 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
793 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
794 `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Verify type',
795 `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'A generated token',
796 `meta` varchar(255) NOT NULL DEFAULT '' COMMENT '',
797 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
799 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store OpenWebAuth token to verify contacts';
804 CREATE TABLE IF NOT EXISTS `parsed_url` (
805 `url` varbinary(255) NOT NULL COMMENT 'page url',
806 `guessing` boolean NOT NULL DEFAULT '0' COMMENT 'is the \'guessing\' mode active?',
807 `oembed` boolean NOT NULL DEFAULT '0' COMMENT 'is the data the result of oembed?',
808 `content` mediumtext COMMENT 'page data',
809 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
810 PRIMARY KEY(`url`,`guessing`,`oembed`),
811 INDEX `created` (`created`)
812 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for \'parse_url\' queries';
815 -- TABLE participation
817 CREATE TABLE IF NOT EXISTS `participation` (
818 `iid` int unsigned NOT NULL COMMENT '',
819 `server` varchar(60) NOT NULL COMMENT '',
820 `cid` int unsigned NOT NULL COMMENT '',
821 `fid` int unsigned NOT NULL COMMENT '',
822 PRIMARY KEY(`iid`,`server`),
825 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Storage for participation messages from Diaspora';
830 CREATE TABLE IF NOT EXISTS `pconfig` (
831 `id` int unsigned NOT NULL auto_increment COMMENT '',
832 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
833 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
834 `k` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
835 `v` mediumtext COMMENT '',
837 UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
838 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='personal (per user) configuration storage';
841 -- TABLE permissionset
843 CREATE TABLE IF NOT EXISTS `permissionset` (
844 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
845 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id of this permission set',
846 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
847 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
848 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
849 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
851 INDEX `uid_allow_cid_allow_gid_deny_cid_deny_gid` (`allow_cid`(50),`allow_gid`(30),`deny_cid`(50),`deny_gid`(30))
852 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
857 CREATE TABLE IF NOT EXISTS `photo` (
858 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
859 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
860 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
861 `guid` char(16) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this photo',
862 `resource-id` char(32) NOT NULL DEFAULT '' COMMENT '',
863 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation date',
864 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edited date',
865 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
866 `desc` text COMMENT '',
867 `album` varchar(255) NOT NULL DEFAULT '' COMMENT 'The name of the album to which the photo belongs',
868 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
869 `type` varchar(30) NOT NULL DEFAULT 'image/jpeg',
870 `height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
871 `width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
872 `datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
873 `data` mediumblob NOT NULL COMMENT '',
874 `scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
875 `profile` boolean NOT NULL DEFAULT '0' COMMENT '',
876 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
877 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
878 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
879 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
880 `backend-class` tinytext COMMENT 'Storage backend class',
881 `backend-ref` text COMMENT 'Storage backend data reference',
883 INDEX `contactid` (`contact-id`),
884 INDEX `uid_contactid` (`uid`,`contact-id`),
885 INDEX `uid_profile` (`uid`,`profile`),
886 INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
887 INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`,`created`),
888 INDEX `resource-id` (`resource-id`)
889 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='photo storage';
894 CREATE TABLE IF NOT EXISTS `poll` (
895 `id` int unsigned NOT NULL auto_increment COMMENT '',
896 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
897 `q0` text COMMENT '',
898 `q1` text COMMENT '',
899 `q2` text COMMENT '',
900 `q3` text COMMENT '',
901 `q4` text COMMENT '',
902 `q5` text COMMENT '',
903 `q6` text COMMENT '',
904 `q7` text COMMENT '',
905 `q8` text COMMENT '',
906 `q9` text COMMENT '',
909 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently unused table for storing poll results';
914 CREATE TABLE IF NOT EXISTS `poll_result` (
915 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
916 `poll_id` int unsigned NOT NULL DEFAULT 0,
917 `choice` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
919 INDEX `poll_id` (`poll_id`)
920 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='data for polls - currently unused';
925 CREATE TABLE IF NOT EXISTS `process` (
926 `pid` int unsigned NOT NULL COMMENT '',
927 `command` varbinary(32) NOT NULL DEFAULT '' COMMENT '',
928 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
930 INDEX `command` (`command`)
931 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently running system processes';
936 CREATE TABLE IF NOT EXISTS `profile` (
937 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
938 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
939 `profile-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name of the profile',
940 `is-default` boolean NOT NULL DEFAULT '0' COMMENT 'Mark this profile as default profile',
941 `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT 'Hide friend list from viewers of this profile',
942 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
943 `pdesc` varchar(255) NOT NULL DEFAULT '' COMMENT 'Title or description',
944 `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT 'Day of birth',
945 `address` varchar(255) NOT NULL DEFAULT '' COMMENT '',
946 `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '',
947 `region` varchar(255) NOT NULL DEFAULT '' COMMENT '',
948 `postal-code` varchar(32) NOT NULL DEFAULT '' COMMENT '',
949 `country-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
950 `hometown` varchar(255) NOT NULL DEFAULT '' COMMENT '',
951 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
952 `marital` varchar(255) NOT NULL DEFAULT '' COMMENT '',
953 `with` text COMMENT '',
954 `howlong` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
955 `sexual` varchar(255) NOT NULL DEFAULT '' COMMENT '',
956 `politic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
957 `religion` varchar(255) NOT NULL DEFAULT '' COMMENT '',
958 `pub_keywords` text COMMENT '',
959 `prv_keywords` text COMMENT '',
960 `likes` text COMMENT '',
961 `dislikes` text COMMENT '',
962 `about` text COMMENT '',
963 `summary` varchar(255) NOT NULL DEFAULT '' COMMENT '',
964 `music` text COMMENT '',
965 `book` text COMMENT '',
966 `tv` text COMMENT '',
967 `film` text COMMENT '',
968 `interest` text COMMENT '',
969 `romance` text COMMENT '',
970 `work` text COMMENT '',
971 `education` text COMMENT '',
972 `contact` text COMMENT '',
973 `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
974 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
975 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
976 `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
977 `publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
978 `net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
980 INDEX `uid_is-default` (`uid`,`is-default`),
981 FULLTEXT INDEX `pub_keywords` (`pub_keywords`)
982 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
985 -- TABLE profile_check
987 CREATE TABLE IF NOT EXISTS `profile_check` (
988 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
989 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
990 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
991 `dfrn_id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
992 `sec` varchar(255) NOT NULL DEFAULT '' COMMENT '',
993 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
995 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='DFRN remote auth use';
998 -- TABLE push_subscriber
1000 CREATE TABLE IF NOT EXISTS `push_subscriber` (
1001 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1002 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1003 `callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1004 `topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1005 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1006 `push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1007 `last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
1008 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1009 `renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
1010 `secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1012 INDEX `next_try` (`next_try`)
1013 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Used for OStatus: Contains feed subscribers';
1018 CREATE TABLE IF NOT EXISTS `queue` (
1019 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1020 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Message receiver',
1021 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Receiver\'s network',
1022 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'Unique GUID of the message',
1023 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date, when the message was created',
1024 `last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last trial',
1025 `next` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1026 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1027 `content` mediumtext COMMENT '',
1028 `batch` boolean NOT NULL DEFAULT '0' COMMENT '',
1030 INDEX `last` (`last`),
1031 INDEX `next` (`next`)
1032 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Queue for messages that couldn\'t be delivered';
1037 CREATE TABLE IF NOT EXISTS `register` (
1038 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1039 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1040 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1041 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1042 `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1043 `language` varchar(16) NOT NULL DEFAULT '' COMMENT '',
1044 `note` text COMMENT '',
1046 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
1051 CREATE TABLE IF NOT EXISTS `search` (
1052 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1053 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1054 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1057 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
1062 CREATE TABLE IF NOT EXISTS `session` (
1063 `id` bigint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1064 `sid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
1065 `data` text COMMENT '',
1066 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1068 INDEX `sid` (`sid`(64)),
1069 INDEX `expire` (`expire`)
1070 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='web session storage';
1075 CREATE TABLE IF NOT EXISTS `sign` (
1076 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1077 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
1078 `signed_text` mediumtext COMMENT '',
1079 `signature` text COMMENT '',
1080 `signer` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1082 UNIQUE INDEX `iid` (`iid`)
1083 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora signatures';
1088 CREATE TABLE IF NOT EXISTS `term` (
1089 `tid` int unsigned NOT NULL auto_increment COMMENT '',
1090 `oid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1091 `otype` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1092 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1093 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1094 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1095 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1096 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1097 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1098 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
1099 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1101 INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`(32)),
1102 INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
1103 INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
1104 INDEX `guid` (`guid`(64))
1105 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='item taxonomy (categories, tags, etc.) table';
1110 CREATE TABLE IF NOT EXISTS `thread` (
1111 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'sequential ID',
1112 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1113 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1114 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
1115 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item author',
1116 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1117 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1118 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1119 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1120 `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1121 `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
1122 `private` boolean NOT NULL DEFAULT '0' COMMENT '',
1123 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
1124 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
1125 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
1126 `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
1127 `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
1128 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
1129 `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
1130 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
1131 `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
1132 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1133 `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
1134 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
1135 `bookmark` boolean COMMENT '',
1137 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
1138 INDEX `uid_network_created` (`uid`,`network`,`created`),
1139 INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
1140 INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
1141 INDEX `contactid` (`contact-id`),
1142 INDEX `ownerid` (`owner-id`),
1143 INDEX `authorid` (`author-id`),
1144 INDEX `uid_created` (`uid`,`created`),
1145 INDEX `uid_commented` (`uid`,`commented`),
1146 INDEX `uid_wall_created` (`uid`,`wall`,`created`),
1147 INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`)
1148 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Thread related data';
1153 CREATE TABLE IF NOT EXISTS `tokens` (
1154 `id` varchar(40) NOT NULL COMMENT '',
1155 `secret` text COMMENT '',
1156 `client_id` varchar(20) NOT NULL DEFAULT '',
1157 `expires` int NOT NULL DEFAULT 0 COMMENT '',
1158 `scope` varchar(200) NOT NULL DEFAULT '' COMMENT '',
1159 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1161 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
1166 CREATE TABLE IF NOT EXISTS `user` (
1167 `uid` mediumint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1168 `parent-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'The parent user that has full control about this user',
1169 `guid` varchar(64) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this user',
1170 `username` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this user is known by',
1171 `password` varchar(255) NOT NULL DEFAULT '' COMMENT 'encrypted password',
1172 `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?',
1173 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT 'nick- and user name',
1174 `email` varchar(255) NOT NULL DEFAULT '' COMMENT 'the users email address',
1175 `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1176 `timezone` varchar(128) NOT NULL DEFAULT '' COMMENT 'PHP-legal timezone',
1177 `language` varchar(32) NOT NULL DEFAULT 'en' COMMENT 'default language',
1178 `register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of registration',
1179 `login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last login',
1180 `default-location` varchar(255) NOT NULL DEFAULT '' COMMENT 'Default for item.location',
1181 `allow_location` boolean NOT NULL DEFAULT '0' COMMENT '1 allows to display the location',
1182 `theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
1183 `pubkey` text COMMENT 'RSA public key 4096 bit',
1184 `prvkey` text COMMENT 'RSA private key 4096 bit',
1185 `spubkey` text COMMENT '',
1186 `sprvkey` text COMMENT '',
1187 `verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
1188 `blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
1189 `blockwall` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to post to the profile page of the user',
1190 `hidewall` boolean NOT NULL DEFAULT '0' COMMENT 'Hide profile details from unkown viewers',
1191 `blocktags` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to tag the post of this user',
1192 `unkmail` boolean NOT NULL DEFAULT '0' COMMENT 'Permit unknown people to send private mails to this user',
1193 `cntunkmail` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1194 `notify-flags` smallint unsigned NOT NULL DEFAULT 65535 COMMENT 'email notification options',
1195 `page-flags` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'page/profile type',
1196 `account-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1197 `prvnets` boolean NOT NULL DEFAULT '0' COMMENT '',
1198 `pwdreset` varchar(255) COMMENT 'Password reset request token',
1199 `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
1200 `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1201 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1202 `account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed',
1203 `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
1204 `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted',
1205 `expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last warning of account expiration',
1206 `def_gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1207 `allow_cid` mediumtext COMMENT 'default permission for this user',
1208 `allow_gid` mediumtext COMMENT 'default permission for this user',
1209 `deny_cid` mediumtext COMMENT 'default permission for this user',
1210 `deny_gid` mediumtext COMMENT 'default permission for this user',
1211 `openidserver` text COMMENT '',
1213 INDEX `nickname` (`nickname`(32))
1214 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='The local users';
1219 CREATE TABLE IF NOT EXISTS `userd` (
1220 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1221 `username` varchar(255) NOT NULL COMMENT '',
1223 INDEX `username` (`username`(32))
1224 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Deleted usernames';
1227 -- TABLE user-contact
1229 CREATE TABLE IF NOT EXISTS `user-contact` (
1230 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the linked public contact',
1231 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1232 `blocked` boolean COMMENT 'Contact is completely blocked for this user',
1233 `ignored` boolean COMMENT 'Posts from this contact are ignored',
1234 `collapsed` boolean COMMENT 'Posts from this contact are collapsed',
1235 PRIMARY KEY(`uid`,`cid`)
1236 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific public contact data';
1241 CREATE TABLE IF NOT EXISTS `user-item` (
1242 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item id',
1243 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1244 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Marker to hide an item from the user',
1245 `ignored` boolean COMMENT 'Ignore this thread if set',
1246 PRIMARY KEY(`uid`,`iid`)
1247 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
1252 CREATE TABLE IF NOT EXISTS `worker-ipc` (
1253 `key` int NOT NULL COMMENT '',
1254 `jobs` boolean COMMENT 'Flag for outstanding jobs',
1256 ) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Inter process communication between the frontend and the worker';
1259 -- TABLE workerqueue
1261 CREATE TABLE IF NOT EXISTS `workerqueue` (
1262 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id',
1263 `parameter` mediumtext COMMENT 'Task command',
1264 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority',
1265 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
1266 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
1267 `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
1268 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1269 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1270 `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
1272 INDEX `pid` (`pid`),
1273 INDEX `parameter` (`parameter`(64)),
1274 INDEX `priority_created_next_try` (`priority`,`created`,`next_try`),
1275 INDEX `done_priority_executed_next_try` (`done`,`priority`,`executed`,`next_try`),
1276 INDEX `done_executed_next_try` (`done`,`executed`,`next_try`),
1277 INDEX `done_priority_next_try` (`done`,`priority`,`next_try`),
1278 INDEX `done_next_try` (`done`,`next_try`)
1279 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
1284 CREATE TABLE IF NOT EXISTS `storage` (
1285 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented image data id',
1286 `data` longblob NOT NULL COMMENT 'file data',
1288 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Data stored by Database storage backend';