1 -- ------------------------------------------
2 -- Friendica 2018.12-dev (The Tazmans Flax-lily)
3 -- DB_UPDATE_VERSION 1287
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 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
35 `name` varchar(255) COMMENT '',
36 `about` text COMMENT '',
37 `photo` varchar(255) COMMENT '',
38 `addr` varchar(255) COMMENT '',
39 `alias` varchar(255) COMMENT '',
40 `pubkey` text COMMENT '',
41 `baseurl` varchar(255) COMMENT 'baseurl of the ap contact',
42 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
44 INDEX `addr` (`addr`(32)),
45 INDEX `url` (`followers`(190))
46 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='ActivityPub compatible contacts - used in the ActivityPub implementation';
51 CREATE TABLE IF NOT EXISTS `attach` (
52 `id` int unsigned NOT NULL auto_increment COMMENT 'generated index',
53 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
54 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT 'hash',
55 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT 'filename of original',
56 `filetype` varchar(64) NOT NULL DEFAULT '' COMMENT 'mimetype',
57 `filesize` int unsigned NOT NULL DEFAULT 0 COMMENT 'size in bytes',
58 `data` longblob NOT NULL COMMENT 'file data',
59 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
60 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
61 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>',
62 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
63 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
64 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
66 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='file attachments';
71 CREATE TABLE IF NOT EXISTS `auth_codes` (
72 `id` varchar(40) NOT NULL COMMENT '',
73 `client_id` varchar(20) NOT NULL DEFAULT '' COMMENT '',
74 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
75 `expires` int NOT NULL DEFAULT 0 COMMENT '',
76 `scope` varchar(250) NOT NULL DEFAULT '' COMMENT '',
78 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
83 CREATE TABLE IF NOT EXISTS `cache` (
84 `k` varbinary(255) NOT NULL COMMENT 'cache key',
85 `v` mediumtext COMMENT 'cached serialized value',
86 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
87 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache insertion',
89 INDEX `k_expires` (`k`,`expires`)
90 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Stores temporary data';
95 CREATE TABLE IF NOT EXISTS `challenge` (
96 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
97 `challenge` varchar(255) NOT NULL DEFAULT '' COMMENT '',
98 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
99 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
100 `type` varchar(255) NOT NULL DEFAULT '' COMMENT '',
101 `last_update` varchar(255) NOT NULL DEFAULT '' COMMENT '',
103 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
108 CREATE TABLE IF NOT EXISTS `clients` (
109 `client_id` varchar(20) NOT NULL COMMENT '',
110 `pw` varchar(20) NOT NULL DEFAULT '' COMMENT '',
111 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
112 `name` text COMMENT '',
113 `icon` text COMMENT '',
114 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
115 PRIMARY KEY(`client_id`)
116 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
121 CREATE TABLE IF NOT EXISTS `config` (
122 `id` int unsigned NOT NULL auto_increment COMMENT '',
123 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
124 `k` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
125 `v` mediumtext COMMENT '',
127 UNIQUE INDEX `cat_k` (`cat`,`k`)
128 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='main configuration storage';
133 CREATE TABLE IF NOT EXISTS `contact` (
134 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
135 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
136 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
137 `self` boolean NOT NULL DEFAULT '0' COMMENT '1 if the contact is the user him/her self',
138 `remote_self` boolean NOT NULL DEFAULT '0' COMMENT '',
139 `rel` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'The kind of the relation between the user and the contact',
140 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
141 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network protocol of the contact',
142 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
143 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
144 `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
145 `about` text COMMENT '',
146 `keywords` text COMMENT 'public keywords (interests) of the contact',
147 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
148 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
149 `attag` varchar(255) NOT NULL DEFAULT '' COMMENT '',
150 `avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
151 `photo` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo of the contact',
152 `thumb` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (thumb size)',
153 `micro` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (micro size)',
154 `site-pubkey` text COMMENT '',
155 `issued-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
156 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
157 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
158 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
159 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
160 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
161 `pubkey` text COMMENT 'RSA public key 4096 bit',
162 `prvkey` text COMMENT 'RSA private key 4096 bit',
163 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
164 `request` varchar(255) COMMENT '',
165 `notify` varchar(255) COMMENT '',
166 `poll` varchar(255) COMMENT '',
167 `confirm` varchar(255) COMMENT '',
168 `poco` varchar(255) COMMENT '',
169 `aes_allow` boolean NOT NULL DEFAULT '0' COMMENT '',
170 `ret-aes` boolean NOT NULL DEFAULT '0' COMMENT '',
171 `usehub` boolean NOT NULL DEFAULT '0' COMMENT '',
172 `subhub` boolean NOT NULL DEFAULT '0' COMMENT '',
173 `hub-verify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
174 `last-update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last try to update the contact info',
175 `success_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful contact update',
176 `failure_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed update',
177 `name-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
178 `uri-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
179 `avatar-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
180 `term-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
181 `last-item` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'date of the last post',
182 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
183 `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
184 `readonly` boolean NOT NULL DEFAULT '0' COMMENT 'posts of the contact are readonly',
185 `writable` boolean NOT NULL DEFAULT '0' COMMENT '',
186 `forum` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a forum',
187 `prv` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a private group',
188 `contact-type` tinyint NOT NULL DEFAULT 0 COMMENT '',
189 `hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
190 `archive` boolean NOT NULL DEFAULT '0' COMMENT '',
191 `pending` boolean NOT NULL DEFAULT '1' COMMENT '',
192 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'Contact has been deleted',
193 `rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
194 `reason` text COMMENT '',
195 `closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
196 `info` mediumtext COMMENT '',
197 `profile-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
198 `bdyear` varchar(4) NOT NULL DEFAULT '' COMMENT '',
199 `bd` date NOT NULL DEFAULT '0001-01-01' COMMENT '',
200 `notify_new_posts` boolean NOT NULL DEFAULT '0' COMMENT '',
201 `fetch_further_information` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
202 `ffi_keyword_blacklist` text COMMENT '',
204 INDEX `uid_name` (`uid`,`name`(190)),
205 INDEX `self_uid` (`self`,`uid`),
206 INDEX `alias_uid` (`alias`(32),`uid`),
207 INDEX `pending_uid` (`pending`,`uid`),
208 INDEX `blocked_uid` (`blocked`,`uid`),
209 INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
210 INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
211 INDEX `addr_uid` (`addr`(32),`uid`),
212 INDEX `nurl_uid` (`nurl`(32),`uid`),
213 INDEX `nick_uid` (`nick`(32),`uid`),
214 INDEX `dfrn-id` (`dfrn-id`(64)),
215 INDEX `issued-id` (`issued-id`(64))
216 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contact table';
221 CREATE TABLE IF NOT EXISTS `conv` (
222 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
223 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this conversation',
224 `recips` text COMMENT 'sender_handle;recipient_handle',
225 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
226 `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'handle of creator',
227 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation timestamp',
228 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'edited timestamp',
229 `subject` text COMMENT 'subject of initial message',
232 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
235 -- TABLE conversation
237 CREATE TABLE IF NOT EXISTS `conversation` (
238 `item-uri` varbinary(255) NOT NULL COMMENT 'Original URI of the item - unrelated to the table with the same name',
239 `reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'URI to which this item is a reply',
240 `conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
241 `conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
242 `protocol` tinyint unsigned NOT NULL DEFAULT 255 COMMENT 'The protocol of the item',
243 `source` mediumtext COMMENT 'Original source',
244 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
245 PRIMARY KEY(`item-uri`),
246 INDEX `conversation-uri` (`conversation-uri`),
247 INDEX `received` (`received`)
248 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
251 -- TABLE diaspora-interaction
253 CREATE TABLE IF NOT EXISTS `diaspora-interaction` (
254 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
255 `interaction` mediumtext COMMENT 'The Diaspora interaction',
256 PRIMARY KEY(`uri-id`)
257 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Signed Diaspora Interaction';
262 CREATE TABLE IF NOT EXISTS `event` (
263 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
264 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
265 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
266 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact_id (ID of the contact in contact table)',
267 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
268 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
269 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
270 `start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event start time',
271 `finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event end time',
272 `summary` text COMMENT 'short description or title of the event',
273 `desc` text COMMENT 'event description',
274 `location` text COMMENT 'event location',
275 `type` varchar(20) NOT NULL DEFAULT '' COMMENT 'event or birthday',
276 `nofinish` boolean NOT NULL DEFAULT '0' COMMENT 'if event does have no end this is 1',
277 `adjust` boolean NOT NULL DEFAULT '1' COMMENT 'adjust to timezone of the recipient (0 or 1)',
278 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '0 or 1',
279 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
280 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
281 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
282 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
284 INDEX `uid_start` (`uid`,`start`)
285 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Events';
290 CREATE TABLE IF NOT EXISTS `fcontact` (
291 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
292 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'unique id',
293 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
294 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
295 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
296 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
297 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
298 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
299 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
300 `notify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
301 `poll` varchar(255) NOT NULL DEFAULT '' COMMENT '',
302 `confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '',
303 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
304 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
305 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
306 `pubkey` text COMMENT '',
307 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
309 INDEX `addr` (`addr`(32)),
310 UNIQUE INDEX `url` (`url`(190))
311 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora compatible contacts - used in the Diaspora implementation';
316 CREATE TABLE IF NOT EXISTS `fsuggest` (
317 `id` int unsigned NOT NULL auto_increment COMMENT '',
318 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
319 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
320 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
321 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
322 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
323 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
324 `note` text COMMENT '',
325 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
327 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='friend suggestion stuff';
332 CREATE TABLE IF NOT EXISTS `gcign` (
333 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
334 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Local User id',
335 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'gcontact.id of ignored contact',
338 INDEX `gcid` (`gcid`)
339 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contacts ignored by friend suggestions';
344 CREATE TABLE IF NOT EXISTS `gcontact` (
345 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
346 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
347 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
348 `url` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the contacts profile page',
349 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
350 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the profile photo',
351 `connect` varchar(255) NOT NULL DEFAULT '' COMMENT '',
352 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
353 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
354 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
355 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
356 `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
357 `about` text COMMENT '',
358 `keywords` text COMMENT 'puplic keywords (interests)',
359 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
360 `birthday` varchar(32) NOT NULL DEFAULT '0001-01-01' COMMENT '',
361 `community` boolean NOT NULL DEFAULT '0' COMMENT '1 if contact is forum account',
362 `contact-type` tinyint NOT NULL DEFAULT -1 COMMENT '',
363 `hide` boolean NOT NULL DEFAULT '0' COMMENT '1 = should be hidden from search',
364 `nsfw` boolean NOT NULL DEFAULT '0' COMMENT '1 = contact posts nsfw content',
365 `network` char(4) NOT NULL DEFAULT '' COMMENT 'social network protocol',
366 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
367 `notify` varchar(255) COMMENT '',
368 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
369 `generation` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
370 `server_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'baseurl of the contacts server',
372 UNIQUE INDEX `nurl` (`nurl`(190)),
373 INDEX `name` (`name`(64)),
374 INDEX `nick` (`nick`(32)),
375 INDEX `addr` (`addr`(64)),
376 INDEX `hide_network_updated` (`hide`,`network`,`updated`),
377 INDEX `updated` (`updated`)
378 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='global contacts';
383 CREATE TABLE IF NOT EXISTS `glink` (
384 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
385 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
386 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
387 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
388 `zcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
389 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
391 UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
392 INDEX `gcid` (`gcid`)
393 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='\'friends of friends\' linkages derived from poco';
398 CREATE TABLE IF NOT EXISTS `group` (
399 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
400 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
401 `visible` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the member list is not private',
402 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the group has been deleted',
403 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'human readable name of group',
406 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, group info';
409 -- TABLE group_member
411 CREATE TABLE IF NOT EXISTS `group_member` (
412 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
413 `gid` int unsigned NOT NULL DEFAULT 0 COMMENT 'groups.id of the associated group',
414 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id of the member assigned to the associated group',
416 INDEX `contactid` (`contact-id`),
417 UNIQUE INDEX `gid_contactid` (`gid`,`contact-id`)
418 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, member info';
423 CREATE TABLE IF NOT EXISTS `gserver` (
424 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
425 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
426 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
427 `version` varchar(255) NOT NULL DEFAULT '' COMMENT '',
428 `site_name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
429 `info` text COMMENT '',
430 `register_policy` tinyint NOT NULL DEFAULT 0 COMMENT '',
431 `registered-users` int unsigned NOT NULL DEFAULT 0 COMMENT 'Number of registered users',
432 `poco` varchar(255) NOT NULL DEFAULT '' COMMENT '',
433 `noscrape` varchar(255) NOT NULL DEFAULT '' COMMENT '',
434 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
435 `platform` varchar(255) NOT NULL DEFAULT '' COMMENT '',
436 `relay-subscribe` boolean NOT NULL DEFAULT '0' COMMENT 'Has the server subscribed to the relay system',
437 `relay-scope` varchar(10) NOT NULL DEFAULT '' COMMENT 'The scope of messages that the server wants to get',
438 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
439 `last_poco_query` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
440 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
441 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
443 UNIQUE INDEX `nurl` (`nurl`(190))
444 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Global servers';
449 CREATE TABLE IF NOT EXISTS `gserver-tag` (
450 `gserver-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'The id of the gserver',
451 `tag` varchar(100) NOT NULL DEFAULT '' COMMENT 'Tag that the server has subscribed',
452 PRIMARY KEY(`gserver-id`,`tag`),
454 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Tags that the server has subscribed';
459 CREATE TABLE IF NOT EXISTS `hook` (
460 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
461 `hook` varbinary(100) NOT NULL DEFAULT '' COMMENT 'name of hook',
462 `file` varbinary(200) NOT NULL DEFAULT '' COMMENT 'relative filename of hook handler',
463 `function` varbinary(200) NOT NULL DEFAULT '' COMMENT 'function name of hook handler',
464 `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',
466 UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
467 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='addon hook registry';
472 CREATE TABLE IF NOT EXISTS `intro` (
473 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
474 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
475 `fid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
476 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
477 `knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
478 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
479 `note` text COMMENT '',
480 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
481 `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
482 `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
483 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
485 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
490 CREATE TABLE IF NOT EXISTS `item` (
491 `id` int unsigned NOT NULL auto_increment,
492 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this item',
493 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
494 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
495 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
496 `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',
497 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT 'uri of the parent to this item',
498 `parent-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the parent uri',
499 `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',
500 `thr-parent-id` int unsigned COMMENT 'Id of the item-uri table that contains the thread parent uri',
501 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation timestamp.',
502 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last edit (default is created)',
503 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last comment/reply to this item',
504 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime',
505 `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',
506 `gravity` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
507 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network from where the item comes from',
508 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
509 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
510 `icid` int unsigned COMMENT 'Id of the item-content table entry that contains the whole item content',
511 `iaid` int unsigned COMMENT 'Id of the item-activity table entry that contains the activity data',
512 `extid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
513 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
514 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
515 `private` boolean NOT NULL DEFAULT '0' COMMENT 'distribution is restricted',
516 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
517 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
518 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'item has been deleted',
519 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id which owns this copy of the item',
520 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
521 `wall` boolean NOT NULL DEFAULT '0' COMMENT 'This item was posted to the wall of uid',
522 `origin` boolean NOT NULL DEFAULT '0' COMMENT 'item originated at this site',
523 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
524 `starred` boolean NOT NULL DEFAULT '0' COMMENT 'item has been favourited',
525 `unseen` boolean NOT NULL DEFAULT '1' COMMENT 'item has not been seen',
526 `mention` boolean NOT NULL DEFAULT '0' COMMENT 'The owner of this item was mentioned in it',
527 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
528 `psid` int unsigned COMMENT 'ID of the permission set of this post',
529 `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',
530 `event-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Used to link to the event.id',
531 `attach` mediumtext COMMENT 'JSON structure representing attachments to this item',
532 `allow_cid` mediumtext COMMENT 'Deprecated',
533 `allow_gid` mediumtext COMMENT 'Deprecated',
534 `deny_cid` mediumtext COMMENT 'Deprecated',
535 `deny_gid` mediumtext COMMENT 'Deprecated',
536 `postopts` text COMMENT 'Deprecated',
537 `inform` mediumtext COMMENT 'Deprecated',
538 `type` varchar(20) COMMENT 'Deprecated',
539 `bookmark` boolean COMMENT 'Deprecated',
540 `file` mediumtext COMMENT 'Deprecated',
541 `location` varchar(255) COMMENT 'Deprecated',
542 `coord` varchar(255) COMMENT 'Deprecated',
543 `tag` mediumtext COMMENT 'Deprecated',
544 `plink` varchar(255) COMMENT 'Deprecated',
545 `title` varchar(255) COMMENT 'Deprecated',
546 `content-warning` varchar(255) COMMENT 'Deprecated',
547 `body` mediumtext COMMENT 'Deprecated',
548 `app` varchar(255) COMMENT 'Deprecated',
549 `verb` varchar(100) COMMENT 'Deprecated',
550 `object-type` varchar(100) COMMENT 'Deprecated',
551 `object` text COMMENT 'Deprecated',
552 `target-type` varchar(100) COMMENT 'Deprecated',
553 `target` text COMMENT 'Deprecated',
554 `author-name` varchar(255) COMMENT 'Deprecated',
555 `author-link` varchar(255) COMMENT 'Deprecated',
556 `author-avatar` varchar(255) COMMENT 'Deprecated',
557 `owner-name` varchar(255) COMMENT 'Deprecated',
558 `owner-link` varchar(255) COMMENT 'Deprecated',
559 `owner-avatar` varchar(255) COMMENT 'Deprecated',
560 `rendered-hash` varchar(32) COMMENT 'Deprecated',
561 `rendered-html` mediumtext COMMENT 'Deprecated',
563 INDEX `guid` (`guid`(191)),
564 INDEX `uri` (`uri`(191)),
565 INDEX `parent` (`parent`),
566 INDEX `parent-uri` (`parent-uri`(191)),
567 INDEX `extid` (`extid`(191)),
568 INDEX `uid_id` (`uid`,`id`),
569 INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
570 INDEX `uid_created` (`uid`,`created`),
571 INDEX `uid_commented` (`uid`,`commented`),
572 INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
573 INDEX `uid_network_received` (`uid`,`network`,`received`),
574 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
575 INDEX `uid_thrparent` (`uid`,`thr-parent`(190)),
576 INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
577 INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
578 INDEX `authorid_created` (`author-id`,`created`),
579 INDEX `ownerid` (`owner-id`),
580 INDEX `uid_uri` (`uid`,`uri`(190)),
581 INDEX `resource-id` (`resource-id`),
582 INDEX `deleted_changed` (`deleted`,`changed`),
583 INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
584 INDEX `uid_eventid` (`uid`,`event-id`),
585 INDEX `icid` (`icid`),
586 INDEX `iaid` (`iaid`),
587 INDEX `psid_wall` (`psid`,`wall`)
588 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
591 -- TABLE item-activity
593 CREATE TABLE IF NOT EXISTS `item-activity` (
594 `id` int unsigned NOT NULL auto_increment,
595 `uri` varchar(255) COMMENT '',
596 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
597 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
598 `activity` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
600 UNIQUE INDEX `uri-hash` (`uri-hash`),
601 INDEX `uri` (`uri`(191))
602 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activities for items';
605 -- TABLE item-content
607 CREATE TABLE IF NOT EXISTS `item-content` (
608 `id` int unsigned NOT NULL auto_increment,
609 `uri` varchar(255) COMMENT '',
610 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
611 `uri-plink-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
612 `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'item title',
613 `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
614 `body` mediumtext COMMENT 'item body content',
615 `location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
616 `coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
617 `language` text COMMENT 'Language information about this post',
618 `app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
619 `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
620 `rendered-html` mediumtext COMMENT 'item.body converted to html',
621 `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams object type',
622 `object` text COMMENT 'JSON encoded object structure unless it is an implied object (normal post)',
623 `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
624 `target` text COMMENT 'JSON encoded target structure if used',
625 `plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
626 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams verb',
628 UNIQUE INDEX `uri-plink-hash` (`uri-plink-hash`),
629 INDEX `uri` (`uri`(191))
630 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
633 -- TABLE item-delivery-data
635 CREATE TABLE IF NOT EXISTS `item-delivery-data` (
636 `iid` int unsigned NOT NULL COMMENT 'Item id',
637 `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',
638 `inform` mediumtext COMMENT 'Additional receivers of the linked item',
640 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items';
645 CREATE TABLE IF NOT EXISTS `item-uri` (
646 `id` int unsigned NOT NULL auto_increment,
647 `uri` varbinary(255) NOT NULL COMMENT 'URI of an item',
648 `guid` varbinary(255) COMMENT 'A unique identifier for an item',
650 UNIQUE INDEX `uri` (`uri`),
651 INDEX `guid` (`guid`)
652 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='URI and GUID for items';
657 CREATE TABLE IF NOT EXISTS `locks` (
658 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
659 `name` varchar(128) NOT NULL DEFAULT '' COMMENT '',
660 `locked` boolean NOT NULL DEFAULT '0' COMMENT '',
661 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process ID',
662 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
664 INDEX `name_expires` (`name`,`expires`)
665 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
670 CREATE TABLE IF NOT EXISTS `mail` (
671 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
672 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
673 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
674 `from-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the sender',
675 `from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
676 `from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
677 `contact-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact.id',
678 `convid` int unsigned NOT NULL DEFAULT 0 COMMENT 'conv.id',
679 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
680 `body` mediumtext COMMENT '',
681 `seen` boolean NOT NULL DEFAULT '0' COMMENT 'if message visited it is 1',
682 `reply` boolean NOT NULL DEFAULT '0' COMMENT '',
683 `replied` boolean NOT NULL DEFAULT '0' COMMENT '',
684 `unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
685 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
686 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
687 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
689 INDEX `uid_seen` (`uid`,`seen`),
690 INDEX `convid` (`convid`),
691 INDEX `uri` (`uri`(64)),
692 INDEX `parent-uri` (`parent-uri`(64)),
693 INDEX `contactid` (`contact-id`(32))
694 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
699 CREATE TABLE IF NOT EXISTS `mailacct` (
700 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
701 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
702 `server` varchar(255) NOT NULL DEFAULT '' COMMENT '',
703 `port` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
704 `ssltype` varchar(16) NOT NULL DEFAULT '' COMMENT '',
705 `mailbox` varchar(255) NOT NULL DEFAULT '' COMMENT '',
706 `user` varchar(255) NOT NULL DEFAULT '' COMMENT '',
707 `pass` text COMMENT '',
708 `reply_to` varchar(255) NOT NULL DEFAULT '' COMMENT '',
709 `action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
710 `movetofolder` varchar(255) NOT NULL DEFAULT '' COMMENT '',
711 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
712 `last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
714 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Mail account data for fetching mails';
719 CREATE TABLE IF NOT EXISTS `manage` (
720 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
721 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
722 `mid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
724 UNIQUE INDEX `uid_mid` (`uid`,`mid`)
725 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='table of accounts that can manage each other';
730 CREATE TABLE IF NOT EXISTS `notify` (
731 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
732 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT '',
733 `type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
734 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
735 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
736 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
737 `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
738 `msg` mediumtext COMMENT '',
739 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
740 `link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
741 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
742 `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
743 `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
744 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
745 `otype` varchar(10) NOT NULL DEFAULT '' COMMENT '',
746 `name_cache` tinytext COMMENT 'Cached bbcode parsing of name',
747 `msg_cache` mediumtext COMMENT 'Cached bbcode parsing of msg',
749 INDEX `hash_uid` (`hash`,`uid`),
750 INDEX `seen_uid_date` (`seen`,`uid`,`date`),
751 INDEX `uid_date` (`uid`,`date`),
752 INDEX `uid_type_link` (`uid`,`type`,`link`(190))
753 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='notifications';
756 -- TABLE notify-threads
758 CREATE TABLE IF NOT EXISTS `notify-threads` (
759 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
760 `notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
761 `master-parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
762 `parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
763 `receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
765 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
770 CREATE TABLE IF NOT EXISTS `oembed` (
771 `url` varbinary(255) NOT NULL COMMENT 'page url',
772 `maxwidth` mediumint unsigned NOT NULL COMMENT 'Maximum width passed to Oembed',
773 `content` mediumtext COMMENT 'OEmbed data of the page',
774 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
775 PRIMARY KEY(`url`,`maxwidth`),
776 INDEX `created` (`created`)
777 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for OEmbed queries';
780 -- TABLE openwebauth-token
782 CREATE TABLE IF NOT EXISTS `openwebauth-token` (
783 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
784 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
785 `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Verify type',
786 `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'A generated token',
787 `meta` varchar(255) NOT NULL DEFAULT '' COMMENT '',
788 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
790 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store OpenWebAuth token to verify contacts';
795 CREATE TABLE IF NOT EXISTS `parsed_url` (
796 `url` varbinary(255) NOT NULL COMMENT 'page url',
797 `guessing` boolean NOT NULL DEFAULT '0' COMMENT 'is the \'guessing\' mode active?',
798 `oembed` boolean NOT NULL DEFAULT '0' COMMENT 'is the data the result of oembed?',
799 `content` mediumtext COMMENT 'page data',
800 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
801 PRIMARY KEY(`url`,`guessing`,`oembed`),
802 INDEX `created` (`created`)
803 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for \'parse_url\' queries';
806 -- TABLE participation
808 CREATE TABLE IF NOT EXISTS `participation` (
809 `iid` int unsigned NOT NULL COMMENT '',
810 `server` varchar(60) NOT NULL COMMENT '',
811 `cid` int unsigned NOT NULL COMMENT '',
812 `fid` int unsigned NOT NULL COMMENT '',
813 PRIMARY KEY(`iid`,`server`)
814 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Storage for participation messages from Diaspora';
819 CREATE TABLE IF NOT EXISTS `pconfig` (
820 `id` int unsigned NOT NULL auto_increment COMMENT '',
821 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
822 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
823 `k` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
824 `v` mediumtext COMMENT '',
826 UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
827 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='personal (per user) configuration storage';
830 -- TABLE permissionset
832 CREATE TABLE IF NOT EXISTS `permissionset` (
833 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
834 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id of this permission set',
835 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
836 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
837 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
838 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
840 INDEX `uid_allow_cid_allow_gid_deny_cid_deny_gid` (`allow_cid`(50),`allow_gid`(30),`deny_cid`(50),`deny_gid`(30))
841 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
846 CREATE TABLE IF NOT EXISTS `photo` (
847 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
848 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
849 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
850 `guid` char(16) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this photo',
851 `resource-id` char(32) NOT NULL DEFAULT '' COMMENT '',
852 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation date',
853 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edited date',
854 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
855 `desc` text COMMENT '',
856 `album` varchar(255) NOT NULL DEFAULT '' COMMENT 'The name of the album to which the photo belongs',
857 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
858 `type` varchar(30) NOT NULL DEFAULT 'image/jpeg',
859 `height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
860 `width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
861 `datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
862 `data` mediumblob NOT NULL COMMENT '',
863 `scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
864 `profile` boolean NOT NULL DEFAULT '0' COMMENT '',
865 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
866 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
867 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
868 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
870 INDEX `contactid` (`contact-id`),
871 INDEX `uid_contactid` (`uid`,`contact-id`),
872 INDEX `uid_profile` (`uid`,`profile`),
873 INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
874 INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`,`created`),
875 INDEX `resource-id` (`resource-id`)
876 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='photo storage';
881 CREATE TABLE IF NOT EXISTS `poll` (
882 `id` int unsigned NOT NULL auto_increment COMMENT '',
883 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
884 `q0` text COMMENT '',
885 `q1` text COMMENT '',
886 `q2` text COMMENT '',
887 `q3` text COMMENT '',
888 `q4` text COMMENT '',
889 `q5` text COMMENT '',
890 `q6` text COMMENT '',
891 `q7` text COMMENT '',
892 `q8` text COMMENT '',
893 `q9` text COMMENT '',
896 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently unused table for storing poll results';
901 CREATE TABLE IF NOT EXISTS `poll_result` (
902 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
903 `poll_id` int unsigned NOT NULL DEFAULT 0,
904 `choice` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
906 INDEX `poll_id` (`poll_id`)
907 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='data for polls - currently unused';
912 CREATE TABLE IF NOT EXISTS `process` (
913 `pid` int unsigned NOT NULL COMMENT '',
914 `command` varbinary(32) NOT NULL DEFAULT '' COMMENT '',
915 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
917 INDEX `command` (`command`)
918 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently running system processes';
923 CREATE TABLE IF NOT EXISTS `profile` (
924 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
925 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
926 `profile-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name of the profile',
927 `is-default` boolean NOT NULL DEFAULT '0' COMMENT 'Mark this profile as default profile',
928 `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT 'Hide friend list from viewers of this profile',
929 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
930 `pdesc` varchar(255) NOT NULL DEFAULT '' COMMENT 'Title or description',
931 `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT 'Day of birth',
932 `address` varchar(255) NOT NULL DEFAULT '' COMMENT '',
933 `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '',
934 `region` varchar(255) NOT NULL DEFAULT '' COMMENT '',
935 `postal-code` varchar(32) NOT NULL DEFAULT '' COMMENT '',
936 `country-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
937 `hometown` varchar(255) NOT NULL DEFAULT '' COMMENT '',
938 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
939 `marital` varchar(255) NOT NULL DEFAULT '' COMMENT '',
940 `with` text COMMENT '',
941 `howlong` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
942 `sexual` varchar(255) NOT NULL DEFAULT '' COMMENT '',
943 `politic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
944 `religion` varchar(255) NOT NULL DEFAULT '' COMMENT '',
945 `pub_keywords` text COMMENT '',
946 `prv_keywords` text COMMENT '',
947 `likes` text COMMENT '',
948 `dislikes` text COMMENT '',
949 `about` text COMMENT '',
950 `summary` varchar(255) NOT NULL DEFAULT '' COMMENT '',
951 `music` text COMMENT '',
952 `book` text COMMENT '',
953 `tv` text COMMENT '',
954 `film` text COMMENT '',
955 `interest` text COMMENT '',
956 `romance` text COMMENT '',
957 `work` text COMMENT '',
958 `education` text COMMENT '',
959 `contact` text COMMENT '',
960 `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
961 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
962 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
963 `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
964 `publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
965 `net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
967 INDEX `uid_is-default` (`uid`,`is-default`)
968 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
971 -- TABLE profile_check
973 CREATE TABLE IF NOT EXISTS `profile_check` (
974 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
975 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
976 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
977 `dfrn_id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
978 `sec` varchar(255) NOT NULL DEFAULT '' COMMENT '',
979 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
981 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='DFRN remote auth use';
984 -- TABLE push_subscriber
986 CREATE TABLE IF NOT EXISTS `push_subscriber` (
987 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
988 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
989 `callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
990 `topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
991 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
992 `push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
993 `last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
994 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
995 `renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
996 `secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
998 INDEX `next_try` (`next_try`)
999 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Used for OStatus: Contains feed subscribers';
1004 CREATE TABLE IF NOT EXISTS `queue` (
1005 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1006 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Message receiver',
1007 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Receiver\'s network',
1008 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'Unique GUID of the message',
1009 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date, when the message was created',
1010 `last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last trial',
1011 `next` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1012 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1013 `content` mediumtext COMMENT '',
1014 `batch` boolean NOT NULL DEFAULT '0' COMMENT '',
1016 INDEX `last` (`last`),
1017 INDEX `next` (`next`)
1018 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Queue for messages that couldn\'t be delivered';
1023 CREATE TABLE IF NOT EXISTS `register` (
1024 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1025 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1026 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1027 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1028 `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1029 `language` varchar(16) NOT NULL DEFAULT '' COMMENT '',
1030 `note` text COMMENT '',
1032 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
1037 CREATE TABLE IF NOT EXISTS `search` (
1038 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1039 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1040 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1043 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
1048 CREATE TABLE IF NOT EXISTS `session` (
1049 `id` bigint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1050 `sid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
1051 `data` text COMMENT '',
1052 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1054 INDEX `sid` (`sid`(64)),
1055 INDEX `expire` (`expire`)
1056 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='web session storage';
1061 CREATE TABLE IF NOT EXISTS `sign` (
1062 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1063 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
1064 `signed_text` mediumtext COMMENT '',
1065 `signature` text COMMENT '',
1066 `signer` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1068 UNIQUE INDEX `iid` (`iid`)
1069 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora signatures';
1074 CREATE TABLE IF NOT EXISTS `term` (
1075 `tid` int unsigned NOT NULL auto_increment COMMENT '',
1076 `oid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1077 `otype` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1078 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1079 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1080 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1081 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1082 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1083 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1084 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
1085 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1087 INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`(32)),
1088 INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
1089 INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
1090 INDEX `guid` (`guid`(64))
1091 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='item taxonomy (categories, tags, etc.) table';
1096 CREATE TABLE IF NOT EXISTS `thread` (
1097 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'sequential ID',
1098 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1099 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1100 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
1101 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item author',
1102 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1103 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1104 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1105 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1106 `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1107 `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
1108 `private` boolean NOT NULL DEFAULT '0' COMMENT '',
1109 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
1110 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
1111 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
1112 `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
1113 `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
1114 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
1115 `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
1116 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
1117 `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
1118 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1119 `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
1120 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
1121 `bookmark` boolean COMMENT '',
1123 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
1124 INDEX `uid_network_created` (`uid`,`network`,`created`),
1125 INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
1126 INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
1127 INDEX `contactid` (`contact-id`),
1128 INDEX `ownerid` (`owner-id`),
1129 INDEX `authorid` (`author-id`),
1130 INDEX `uid_created` (`uid`,`created`),
1131 INDEX `uid_commented` (`uid`,`commented`),
1132 INDEX `uid_wall_created` (`uid`,`wall`,`created`),
1133 INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`)
1134 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Thread related data';
1139 CREATE TABLE IF NOT EXISTS `tokens` (
1140 `id` varchar(40) NOT NULL COMMENT '',
1141 `secret` text COMMENT '',
1142 `client_id` varchar(20) NOT NULL DEFAULT '',
1143 `expires` int NOT NULL DEFAULT 0 COMMENT '',
1144 `scope` varchar(200) NOT NULL DEFAULT '' COMMENT '',
1145 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1147 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
1152 CREATE TABLE IF NOT EXISTS `user` (
1153 `uid` mediumint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1154 `parent-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'The parent user that has full control about this user',
1155 `guid` varchar(64) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this user',
1156 `username` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this user is known by',
1157 `password` varchar(255) NOT NULL DEFAULT '' COMMENT 'encrypted password',
1158 `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?',
1159 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT 'nick- and user name',
1160 `email` varchar(255) NOT NULL DEFAULT '' COMMENT 'the users email address',
1161 `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1162 `timezone` varchar(128) NOT NULL DEFAULT '' COMMENT 'PHP-legal timezone',
1163 `language` varchar(32) NOT NULL DEFAULT 'en' COMMENT 'default language',
1164 `register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of registration',
1165 `login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last login',
1166 `default-location` varchar(255) NOT NULL DEFAULT '' COMMENT 'Default for item.location',
1167 `allow_location` boolean NOT NULL DEFAULT '0' COMMENT '1 allows to display the location',
1168 `theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
1169 `pubkey` text COMMENT 'RSA public key 4096 bit',
1170 `prvkey` text COMMENT 'RSA private key 4096 bit',
1171 `spubkey` text COMMENT '',
1172 `sprvkey` text COMMENT '',
1173 `verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
1174 `blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
1175 `blockwall` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to post to the profile page of the user',
1176 `hidewall` boolean NOT NULL DEFAULT '0' COMMENT 'Hide profile details from unkown viewers',
1177 `blocktags` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to tag the post of this user',
1178 `unkmail` boolean NOT NULL DEFAULT '0' COMMENT 'Permit unknown people to send private mails to this user',
1179 `cntunkmail` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1180 `notify-flags` smallint unsigned NOT NULL DEFAULT 65535 COMMENT 'email notification options',
1181 `page-flags` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'page/profile type',
1182 `account-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1183 `prvnets` boolean NOT NULL DEFAULT '0' COMMENT '',
1184 `pwdreset` varchar(255) COMMENT 'Password reset request token',
1185 `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
1186 `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1187 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1188 `account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed',
1189 `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
1190 `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted',
1191 `expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last warning of account expiration',
1192 `def_gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1193 `allow_cid` mediumtext COMMENT 'default permission for this user',
1194 `allow_gid` mediumtext COMMENT 'default permission for this user',
1195 `deny_cid` mediumtext COMMENT 'default permission for this user',
1196 `deny_gid` mediumtext COMMENT 'default permission for this user',
1197 `openidserver` text COMMENT '',
1199 INDEX `nickname` (`nickname`(32))
1200 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='The local users';
1205 CREATE TABLE IF NOT EXISTS `userd` (
1206 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1207 `username` varchar(255) NOT NULL COMMENT '',
1209 INDEX `username` (`username`(32))
1210 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Deleted usernames';
1213 -- TABLE user-contact
1215 CREATE TABLE IF NOT EXISTS `user-contact` (
1216 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the linked public contact',
1217 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1218 `blocked` boolean COMMENT 'Contact is completely blocked for this user',
1219 `ignored` boolean COMMENT 'Posts from this contact are ignored',
1220 `collapsed` boolean COMMENT 'Posts from this contact are collapsed',
1221 PRIMARY KEY(`uid`,`cid`)
1222 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific public contact data';
1227 CREATE TABLE IF NOT EXISTS `user-item` (
1228 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item id',
1229 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1230 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Marker to hide an item from the user',
1231 `ignored` boolean COMMENT 'Ignore this thread if set',
1232 PRIMARY KEY(`uid`,`iid`)
1233 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
1238 CREATE TABLE IF NOT EXISTS `worker-ipc` (
1239 `key` int NOT NULL COMMENT '',
1240 `jobs` boolean COMMENT 'Flag for outstanding jobs',
1242 ) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Inter process communication between the frontend and the worker';
1245 -- TABLE workerqueue
1247 CREATE TABLE IF NOT EXISTS `workerqueue` (
1248 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id',
1249 `parameter` mediumblob COMMENT 'Task command',
1250 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority',
1251 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
1252 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
1253 `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
1254 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1255 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1256 `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
1258 INDEX `pid` (`pid`),
1259 INDEX `parameter` (`parameter`(64)),
1260 INDEX `priority_created_next_try` (`priority`,`created`,`next_try`),
1261 INDEX `done_executed_next_try` (`done`,`executed`,`next_try`)
1262 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';