1 -- ------------------------------------------
2 -- Friendica 2018.12-dev (The Tazmans Flax-lily)
3 -- DB_UPDATE_VERSION 1284
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 `rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
193 `reason` text COMMENT '',
194 `closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
195 `info` mediumtext COMMENT '',
196 `profile-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
197 `bdyear` varchar(4) NOT NULL DEFAULT '' COMMENT '',
198 `bd` date NOT NULL DEFAULT '0001-01-01' COMMENT '',
199 `notify_new_posts` boolean NOT NULL DEFAULT '0' COMMENT '',
200 `fetch_further_information` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
201 `ffi_keyword_blacklist` text COMMENT '',
203 INDEX `uid_name` (`uid`,`name`(190)),
204 INDEX `self_uid` (`self`,`uid`),
205 INDEX `alias_uid` (`alias`(32),`uid`),
206 INDEX `pending_uid` (`pending`,`uid`),
207 INDEX `blocked_uid` (`blocked`,`uid`),
208 INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
209 INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
210 INDEX `addr_uid` (`addr`(32),`uid`),
211 INDEX `nurl_uid` (`nurl`(32),`uid`),
212 INDEX `nick_uid` (`nick`(32),`uid`),
213 INDEX `dfrn-id` (`dfrn-id`(64)),
214 INDEX `issued-id` (`issued-id`(64))
215 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contact table';
220 CREATE TABLE IF NOT EXISTS `conv` (
221 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
222 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this conversation',
223 `recips` text COMMENT 'sender_handle;recipient_handle',
224 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
225 `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'handle of creator',
226 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation timestamp',
227 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'edited timestamp',
228 `subject` text COMMENT 'subject of initial message',
231 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
234 -- TABLE conversation
236 CREATE TABLE IF NOT EXISTS `conversation` (
237 `item-uri` varbinary(255) NOT NULL COMMENT 'Original URI of the item - unrelated to the table with the same name',
238 `reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'URI to which this item is a reply',
239 `conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
240 `conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
241 `protocol` tinyint unsigned NOT NULL DEFAULT 255 COMMENT 'The protocol of the item',
242 `source` mediumtext COMMENT 'Original source',
243 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
244 PRIMARY KEY(`item-uri`),
245 INDEX `conversation-uri` (`conversation-uri`),
246 INDEX `received` (`received`)
247 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
252 CREATE TABLE IF NOT EXISTS `event` (
253 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
254 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
255 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
256 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact_id (ID of the contact in contact table)',
257 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
258 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
259 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
260 `start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event start time',
261 `finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event end time',
262 `summary` text COMMENT 'short description or title of the event',
263 `desc` text COMMENT 'event description',
264 `location` text COMMENT 'event location',
265 `type` varchar(20) NOT NULL DEFAULT '' COMMENT 'event or birthday',
266 `nofinish` boolean NOT NULL DEFAULT '0' COMMENT 'if event does have no end this is 1',
267 `adjust` boolean NOT NULL DEFAULT '1' COMMENT 'adjust to timezone of the recipient (0 or 1)',
268 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '0 or 1',
269 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
270 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
271 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
272 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
274 INDEX `uid_start` (`uid`,`start`)
275 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Events';
280 CREATE TABLE IF NOT EXISTS `fcontact` (
281 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
282 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'unique id',
283 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
284 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
285 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
286 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
287 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
288 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
289 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
290 `notify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
291 `poll` varchar(255) NOT NULL DEFAULT '' COMMENT '',
292 `confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '',
293 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
294 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
295 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
296 `pubkey` text COMMENT '',
297 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
299 INDEX `addr` (`addr`(32)),
300 UNIQUE INDEX `url` (`url`(190))
301 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora compatible contacts - used in the Diaspora implementation';
306 CREATE TABLE IF NOT EXISTS `fsuggest` (
307 `id` int unsigned NOT NULL auto_increment COMMENT '',
308 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
309 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
310 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
311 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
312 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
313 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
314 `note` text COMMENT '',
315 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
317 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='friend suggestion stuff';
322 CREATE TABLE IF NOT EXISTS `gcign` (
323 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
324 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Local User id',
325 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'gcontact.id of ignored contact',
328 INDEX `gcid` (`gcid`)
329 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contacts ignored by friend suggestions';
334 CREATE TABLE IF NOT EXISTS `gcontact` (
335 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
336 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
337 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
338 `url` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the contacts profile page',
339 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
340 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the profile photo',
341 `connect` varchar(255) NOT NULL DEFAULT '' COMMENT '',
342 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
343 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
344 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
345 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
346 `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
347 `about` text COMMENT '',
348 `keywords` text COMMENT 'puplic keywords (interests)',
349 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
350 `birthday` varchar(32) NOT NULL DEFAULT '0001-01-01' COMMENT '',
351 `community` boolean NOT NULL DEFAULT '0' COMMENT '1 if contact is forum account',
352 `contact-type` tinyint NOT NULL DEFAULT -1 COMMENT '',
353 `hide` boolean NOT NULL DEFAULT '0' COMMENT '1 = should be hidden from search',
354 `nsfw` boolean NOT NULL DEFAULT '0' COMMENT '1 = contact posts nsfw content',
355 `network` char(4) NOT NULL DEFAULT '' COMMENT 'social network protocol',
356 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
357 `notify` varchar(255) COMMENT '',
358 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
359 `generation` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
360 `server_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'baseurl of the contacts server',
362 UNIQUE INDEX `nurl` (`nurl`(190)),
363 INDEX `name` (`name`(64)),
364 INDEX `nick` (`nick`(32)),
365 INDEX `addr` (`addr`(64)),
366 INDEX `hide_network_updated` (`hide`,`network`,`updated`),
367 INDEX `updated` (`updated`)
368 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='global contacts';
373 CREATE TABLE IF NOT EXISTS `glink` (
374 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
375 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
376 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
377 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
378 `zcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
379 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
381 UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
382 INDEX `gcid` (`gcid`)
383 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='\'friends of friends\' linkages derived from poco';
388 CREATE TABLE IF NOT EXISTS `group` (
389 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
390 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
391 `visible` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the member list is not private',
392 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the group has been deleted',
393 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'human readable name of group',
396 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, group info';
399 -- TABLE group_member
401 CREATE TABLE IF NOT EXISTS `group_member` (
402 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
403 `gid` int unsigned NOT NULL DEFAULT 0 COMMENT 'groups.id of the associated group',
404 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id of the member assigned to the associated group',
406 INDEX `contactid` (`contact-id`),
407 UNIQUE INDEX `gid_contactid` (`gid`,`contact-id`)
408 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, member info';
413 CREATE TABLE IF NOT EXISTS `gserver` (
414 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
415 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
416 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
417 `version` varchar(255) NOT NULL DEFAULT '' COMMENT '',
418 `site_name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
419 `info` text COMMENT '',
420 `register_policy` tinyint NOT NULL DEFAULT 0 COMMENT '',
421 `registered-users` int unsigned NOT NULL DEFAULT 0 COMMENT 'Number of registered users',
422 `poco` varchar(255) NOT NULL DEFAULT '' COMMENT '',
423 `noscrape` varchar(255) NOT NULL DEFAULT '' COMMENT '',
424 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
425 `platform` varchar(255) NOT NULL DEFAULT '' COMMENT '',
426 `relay-subscribe` boolean NOT NULL DEFAULT '0' COMMENT 'Has the server subscribed to the relay system',
427 `relay-scope` varchar(10) NOT NULL DEFAULT '' COMMENT 'The scope of messages that the server wants to get',
428 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
429 `last_poco_query` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
430 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
431 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
433 UNIQUE INDEX `nurl` (`nurl`(190))
434 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Global servers';
439 CREATE TABLE IF NOT EXISTS `gserver-tag` (
440 `gserver-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'The id of the gserver',
441 `tag` varchar(100) NOT NULL DEFAULT '' COMMENT 'Tag that the server has subscribed',
442 PRIMARY KEY(`gserver-id`,`tag`),
444 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Tags that the server has subscribed';
449 CREATE TABLE IF NOT EXISTS `hook` (
450 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
451 `hook` varbinary(100) NOT NULL DEFAULT '' COMMENT 'name of hook',
452 `file` varbinary(200) NOT NULL DEFAULT '' COMMENT 'relative filename of hook handler',
453 `function` varbinary(200) NOT NULL DEFAULT '' COMMENT 'function name of hook handler',
454 `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',
456 UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
457 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='addon hook registry';
462 CREATE TABLE IF NOT EXISTS `intro` (
463 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
464 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
465 `fid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
466 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
467 `knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
468 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
469 `note` text COMMENT '',
470 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
471 `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
472 `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
473 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
475 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
480 CREATE TABLE IF NOT EXISTS `item` (
481 `id` int unsigned NOT NULL auto_increment,
482 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this item',
483 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
484 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
485 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
486 `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',
487 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT 'uri of the parent to this item',
488 `parent-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the parent uri',
489 `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',
490 `thr-parent-id` int unsigned COMMENT 'Id of the item-uri table that contains the thread parent uri',
491 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation timestamp.',
492 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last edit (default is created)',
493 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last comment/reply to this item',
494 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime',
495 `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',
496 `gravity` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
497 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network from where the item comes from',
498 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
499 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
500 `icid` int unsigned COMMENT 'Id of the item-content table entry that contains the whole item content',
501 `iaid` int unsigned COMMENT 'Id of the item-activity table entry that contains the activity data',
502 `extid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
503 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
504 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
505 `private` boolean NOT NULL DEFAULT '0' COMMENT 'distribution is restricted',
506 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
507 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
508 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'item has been deleted',
509 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id which owns this copy of the item',
510 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
511 `wall` boolean NOT NULL DEFAULT '0' COMMENT 'This item was posted to the wall of uid',
512 `origin` boolean NOT NULL DEFAULT '0' COMMENT 'item originated at this site',
513 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
514 `starred` boolean NOT NULL DEFAULT '0' COMMENT 'item has been favourited',
515 `unseen` boolean NOT NULL DEFAULT '1' COMMENT 'item has not been seen',
516 `mention` boolean NOT NULL DEFAULT '0' COMMENT 'The owner of this item was mentioned in it',
517 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
518 `psid` int unsigned COMMENT 'ID of the permission set of this post',
519 `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',
520 `event-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Used to link to the event.id',
521 `attach` mediumtext COMMENT 'JSON structure representing attachments to this item',
522 `allow_cid` mediumtext COMMENT 'Deprecated',
523 `allow_gid` mediumtext COMMENT 'Deprecated',
524 `deny_cid` mediumtext COMMENT 'Deprecated',
525 `deny_gid` mediumtext COMMENT 'Deprecated',
526 `postopts` text COMMENT 'Deprecated',
527 `inform` mediumtext COMMENT 'Deprecated',
528 `type` varchar(20) COMMENT 'Deprecated',
529 `bookmark` boolean COMMENT 'Deprecated',
530 `file` mediumtext COMMENT 'Deprecated',
531 `location` varchar(255) COMMENT 'Deprecated',
532 `coord` varchar(255) COMMENT 'Deprecated',
533 `tag` mediumtext COMMENT 'Deprecated',
534 `plink` varchar(255) COMMENT 'Deprecated',
535 `title` varchar(255) COMMENT 'Deprecated',
536 `content-warning` varchar(255) COMMENT 'Deprecated',
537 `body` mediumtext COMMENT 'Deprecated',
538 `app` varchar(255) COMMENT 'Deprecated',
539 `verb` varchar(100) COMMENT 'Deprecated',
540 `object-type` varchar(100) COMMENT 'Deprecated',
541 `object` text COMMENT 'Deprecated',
542 `target-type` varchar(100) COMMENT 'Deprecated',
543 `target` text COMMENT 'Deprecated',
544 `author-name` varchar(255) COMMENT 'Deprecated',
545 `author-link` varchar(255) COMMENT 'Deprecated',
546 `author-avatar` varchar(255) COMMENT 'Deprecated',
547 `owner-name` varchar(255) COMMENT 'Deprecated',
548 `owner-link` varchar(255) COMMENT 'Deprecated',
549 `owner-avatar` varchar(255) COMMENT 'Deprecated',
550 `rendered-hash` varchar(32) COMMENT 'Deprecated',
551 `rendered-html` mediumtext COMMENT 'Deprecated',
553 INDEX `guid` (`guid`(191)),
554 INDEX `uri` (`uri`(191)),
555 INDEX `parent` (`parent`),
556 INDEX `parent-uri` (`parent-uri`(191)),
557 INDEX `extid` (`extid`(191)),
558 INDEX `uid_id` (`uid`,`id`),
559 INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
560 INDEX `uid_created` (`uid`,`created`),
561 INDEX `uid_commented` (`uid`,`commented`),
562 INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
563 INDEX `uid_network_received` (`uid`,`network`,`received`),
564 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
565 INDEX `uid_thrparent` (`uid`,`thr-parent`(190)),
566 INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
567 INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
568 INDEX `authorid_created` (`author-id`,`created`),
569 INDEX `ownerid` (`owner-id`),
570 INDEX `uid_uri` (`uid`,`uri`(190)),
571 INDEX `resource-id` (`resource-id`),
572 INDEX `deleted_changed` (`deleted`,`changed`),
573 INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
574 INDEX `uid_eventid` (`uid`,`event-id`),
575 INDEX `icid` (`icid`),
576 INDEX `iaid` (`iaid`),
577 INDEX `psid_wall` (`psid`,`wall`)
578 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
581 -- TABLE item-activity
583 CREATE TABLE IF NOT EXISTS `item-activity` (
584 `id` int unsigned NOT NULL auto_increment,
585 `uri` varchar(255) COMMENT '',
586 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
587 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
588 `activity` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
590 UNIQUE INDEX `uri-hash` (`uri-hash`),
591 INDEX `uri` (`uri`(191))
592 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activities for items';
595 -- TABLE item-content
597 CREATE TABLE IF NOT EXISTS `item-content` (
598 `id` int unsigned NOT NULL auto_increment,
599 `uri` varchar(255) COMMENT '',
600 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
601 `uri-plink-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
602 `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'item title',
603 `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
604 `body` mediumtext COMMENT 'item body content',
605 `location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
606 `coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
607 `language` text COMMENT 'Language information about this post',
608 `app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
609 `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
610 `rendered-html` mediumtext COMMENT 'item.body converted to html',
611 `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams object type',
612 `object` text COMMENT 'JSON encoded object structure unless it is an implied object (normal post)',
613 `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
614 `target` text COMMENT 'JSON encoded target structure if used',
615 `plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
616 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams verb',
618 UNIQUE INDEX `uri-plink-hash` (`uri-plink-hash`),
619 INDEX `uri` (`uri`(191))
620 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
623 -- TABLE item-delivery-data
625 CREATE TABLE IF NOT EXISTS `item-delivery-data` (
626 `iid` int unsigned NOT NULL COMMENT 'Item id',
627 `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',
628 `inform` mediumtext COMMENT 'Additional receivers of the linked item',
630 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items';
635 CREATE TABLE IF NOT EXISTS `item-uri` (
636 `id` int unsigned NOT NULL auto_increment,
637 `uri` varbinary(255) NOT NULL COMMENT 'URI of an item',
638 `guid` varbinary(255) COMMENT 'A unique identifier for an item',
640 UNIQUE INDEX `uri` (`uri`),
641 INDEX `guid` (`guid`)
642 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='URI and GUID for items';
647 CREATE TABLE IF NOT EXISTS `locks` (
648 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
649 `name` varchar(128) NOT NULL DEFAULT '' COMMENT '',
650 `locked` boolean NOT NULL DEFAULT '0' COMMENT '',
651 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process ID',
652 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
654 INDEX `name_expires` (`name`,`expires`)
655 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
660 CREATE TABLE IF NOT EXISTS `mail` (
661 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
662 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
663 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
664 `from-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the sender',
665 `from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
666 `from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
667 `contact-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact.id',
668 `convid` int unsigned NOT NULL DEFAULT 0 COMMENT 'conv.id',
669 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
670 `body` mediumtext COMMENT '',
671 `seen` boolean NOT NULL DEFAULT '0' COMMENT 'if message visited it is 1',
672 `reply` boolean NOT NULL DEFAULT '0' COMMENT '',
673 `replied` boolean NOT NULL DEFAULT '0' COMMENT '',
674 `unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
675 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
676 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
677 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
679 INDEX `uid_seen` (`uid`,`seen`),
680 INDEX `convid` (`convid`),
681 INDEX `uri` (`uri`(64)),
682 INDEX `parent-uri` (`parent-uri`(64)),
683 INDEX `contactid` (`contact-id`(32))
684 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
689 CREATE TABLE IF NOT EXISTS `mailacct` (
690 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
691 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
692 `server` varchar(255) NOT NULL DEFAULT '' COMMENT '',
693 `port` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
694 `ssltype` varchar(16) NOT NULL DEFAULT '' COMMENT '',
695 `mailbox` varchar(255) NOT NULL DEFAULT '' COMMENT '',
696 `user` varchar(255) NOT NULL DEFAULT '' COMMENT '',
697 `pass` text COMMENT '',
698 `reply_to` varchar(255) NOT NULL DEFAULT '' COMMENT '',
699 `action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
700 `movetofolder` varchar(255) NOT NULL DEFAULT '' COMMENT '',
701 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
702 `last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
704 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Mail account data for fetching mails';
709 CREATE TABLE IF NOT EXISTS `manage` (
710 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
711 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
712 `mid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
714 UNIQUE INDEX `uid_mid` (`uid`,`mid`)
715 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='table of accounts that can manage each other';
720 CREATE TABLE IF NOT EXISTS `notify` (
721 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
722 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT '',
723 `type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
724 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
725 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
726 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
727 `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
728 `msg` mediumtext COMMENT '',
729 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
730 `link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
731 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
732 `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
733 `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
734 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
735 `otype` varchar(10) NOT NULL DEFAULT '' COMMENT '',
736 `name_cache` tinytext COMMENT 'Cached bbcode parsing of name',
737 `msg_cache` mediumtext COMMENT 'Cached bbcode parsing of msg',
739 INDEX `hash_uid` (`hash`,`uid`),
740 INDEX `seen_uid_date` (`seen`,`uid`,`date`),
741 INDEX `uid_date` (`uid`,`date`),
742 INDEX `uid_type_link` (`uid`,`type`,`link`(190))
743 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='notifications';
746 -- TABLE notify-threads
748 CREATE TABLE IF NOT EXISTS `notify-threads` (
749 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
750 `notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
751 `master-parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
752 `parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
753 `receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
755 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
760 CREATE TABLE IF NOT EXISTS `oembed` (
761 `url` varbinary(255) NOT NULL COMMENT 'page url',
762 `maxwidth` mediumint unsigned NOT NULL COMMENT 'Maximum width passed to Oembed',
763 `content` mediumtext COMMENT 'OEmbed data of the page',
764 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
765 PRIMARY KEY(`url`,`maxwidth`),
766 INDEX `created` (`created`)
767 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for OEmbed queries';
770 -- TABLE openwebauth-token
772 CREATE TABLE IF NOT EXISTS `openwebauth-token` (
773 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
774 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
775 `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Verify type',
776 `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'A generated token',
777 `meta` varchar(255) NOT NULL DEFAULT '' COMMENT '',
778 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
780 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store OpenWebAuth token to verify contacts';
785 CREATE TABLE IF NOT EXISTS `parsed_url` (
786 `url` varbinary(255) NOT NULL COMMENT 'page url',
787 `guessing` boolean NOT NULL DEFAULT '0' COMMENT 'is the \'guessing\' mode active?',
788 `oembed` boolean NOT NULL DEFAULT '0' COMMENT 'is the data the result of oembed?',
789 `content` mediumtext COMMENT 'page data',
790 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
791 PRIMARY KEY(`url`,`guessing`,`oembed`),
792 INDEX `created` (`created`)
793 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for \'parse_url\' queries';
796 -- TABLE participation
798 CREATE TABLE IF NOT EXISTS `participation` (
799 `iid` int unsigned NOT NULL COMMENT '',
800 `server` varchar(60) NOT NULL COMMENT '',
801 `cid` int unsigned NOT NULL COMMENT '',
802 `fid` int unsigned NOT NULL COMMENT '',
803 PRIMARY KEY(`iid`,`server`)
804 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Storage for participation messages from Diaspora';
809 CREATE TABLE IF NOT EXISTS `pconfig` (
810 `id` int unsigned NOT NULL auto_increment COMMENT '',
811 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
812 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
813 `k` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
814 `v` mediumtext COMMENT '',
816 UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
817 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='personal (per user) configuration storage';
820 -- TABLE permissionset
822 CREATE TABLE IF NOT EXISTS `permissionset` (
823 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
824 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id of this permission set',
825 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
826 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
827 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
828 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
830 INDEX `uid_allow_cid_allow_gid_deny_cid_deny_gid` (`allow_cid`(50),`allow_gid`(30),`deny_cid`(50),`deny_gid`(30))
831 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
836 CREATE TABLE IF NOT EXISTS `photo` (
837 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
838 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
839 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
840 `guid` char(16) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this photo',
841 `resource-id` char(32) NOT NULL DEFAULT '' COMMENT '',
842 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation date',
843 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edited date',
844 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
845 `desc` text COMMENT '',
846 `album` varchar(255) NOT NULL DEFAULT '' COMMENT 'The name of the album to which the photo belongs',
847 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
848 `type` varchar(30) NOT NULL DEFAULT 'image/jpeg',
849 `height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
850 `width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
851 `datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
852 `data` mediumblob NOT NULL COMMENT '',
853 `scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
854 `profile` boolean NOT NULL DEFAULT '0' COMMENT '',
855 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
856 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
857 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
858 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
860 INDEX `contactid` (`contact-id`),
861 INDEX `uid_contactid` (`uid`,`contact-id`),
862 INDEX `uid_profile` (`uid`,`profile`),
863 INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
864 INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`,`created`),
865 INDEX `resource-id` (`resource-id`)
866 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='photo storage';
871 CREATE TABLE IF NOT EXISTS `poll` (
872 `id` int unsigned NOT NULL auto_increment COMMENT '',
873 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
874 `q0` text COMMENT '',
875 `q1` text COMMENT '',
876 `q2` text COMMENT '',
877 `q3` text COMMENT '',
878 `q4` text COMMENT '',
879 `q5` text COMMENT '',
880 `q6` text COMMENT '',
881 `q7` text COMMENT '',
882 `q8` text COMMENT '',
883 `q9` text COMMENT '',
886 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently unused table for storing poll results';
891 CREATE TABLE IF NOT EXISTS `poll_result` (
892 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
893 `poll_id` int unsigned NOT NULL DEFAULT 0,
894 `choice` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
896 INDEX `poll_id` (`poll_id`)
897 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='data for polls - currently unused';
902 CREATE TABLE IF NOT EXISTS `process` (
903 `pid` int unsigned NOT NULL COMMENT '',
904 `command` varbinary(32) NOT NULL DEFAULT '' COMMENT '',
905 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
907 INDEX `command` (`command`)
908 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently running system processes';
913 CREATE TABLE IF NOT EXISTS `profile` (
914 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
915 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
916 `profile-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name of the profile',
917 `is-default` boolean NOT NULL DEFAULT '0' COMMENT 'Mark this profile as default profile',
918 `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT 'Hide friend list from viewers of this profile',
919 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
920 `pdesc` varchar(255) NOT NULL DEFAULT '' COMMENT 'Title or description',
921 `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT 'Day of birth',
922 `address` varchar(255) NOT NULL DEFAULT '' COMMENT '',
923 `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '',
924 `region` varchar(255) NOT NULL DEFAULT '' COMMENT '',
925 `postal-code` varchar(32) NOT NULL DEFAULT '' COMMENT '',
926 `country-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
927 `hometown` varchar(255) NOT NULL DEFAULT '' COMMENT '',
928 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
929 `marital` varchar(255) NOT NULL DEFAULT '' COMMENT '',
930 `with` text COMMENT '',
931 `howlong` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
932 `sexual` varchar(255) NOT NULL DEFAULT '' COMMENT '',
933 `politic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
934 `religion` varchar(255) NOT NULL DEFAULT '' COMMENT '',
935 `pub_keywords` text COMMENT '',
936 `prv_keywords` text COMMENT '',
937 `likes` text COMMENT '',
938 `dislikes` text COMMENT '',
939 `about` text COMMENT '',
940 `summary` varchar(255) NOT NULL DEFAULT '' COMMENT '',
941 `music` text COMMENT '',
942 `book` text COMMENT '',
943 `tv` text COMMENT '',
944 `film` text COMMENT '',
945 `interest` text COMMENT '',
946 `romance` text COMMENT '',
947 `work` text COMMENT '',
948 `education` text COMMENT '',
949 `contact` text COMMENT '',
950 `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
951 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
952 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
953 `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
954 `publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
955 `net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
957 INDEX `uid_is-default` (`uid`,`is-default`)
958 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
961 -- TABLE profile_check
963 CREATE TABLE IF NOT EXISTS `profile_check` (
964 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
965 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
966 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
967 `dfrn_id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
968 `sec` varchar(255) NOT NULL DEFAULT '' COMMENT '',
969 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
971 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='DFRN remote auth use';
974 -- TABLE push_subscriber
976 CREATE TABLE IF NOT EXISTS `push_subscriber` (
977 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
978 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
979 `callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
980 `topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
981 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
982 `push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
983 `last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
984 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
985 `renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
986 `secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
988 INDEX `next_try` (`next_try`)
989 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Used for OStatus: Contains feed subscribers';
994 CREATE TABLE IF NOT EXISTS `queue` (
995 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
996 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Message receiver',
997 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Receiver\'s network',
998 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'Unique GUID of the message',
999 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date, when the message was created',
1000 `last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last trial',
1001 `next` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1002 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1003 `content` mediumtext COMMENT '',
1004 `batch` boolean NOT NULL DEFAULT '0' COMMENT '',
1006 INDEX `last` (`last`),
1007 INDEX `next` (`next`)
1008 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Queue for messages that couldn\'t be delivered';
1013 CREATE TABLE IF NOT EXISTS `register` (
1014 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1015 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1016 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1017 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1018 `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1019 `language` varchar(16) NOT NULL DEFAULT '' COMMENT '',
1020 `note` text COMMENT '',
1022 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
1027 CREATE TABLE IF NOT EXISTS `search` (
1028 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1029 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1030 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1033 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
1038 CREATE TABLE IF NOT EXISTS `session` (
1039 `id` bigint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1040 `sid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
1041 `data` text COMMENT '',
1042 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1044 INDEX `sid` (`sid`(64)),
1045 INDEX `expire` (`expire`)
1046 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='web session storage';
1051 CREATE TABLE IF NOT EXISTS `sign` (
1052 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1053 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
1054 `signed_text` mediumtext COMMENT '',
1055 `signature` text COMMENT '',
1056 `signer` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1058 UNIQUE INDEX `iid` (`iid`)
1059 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora signatures';
1064 CREATE TABLE IF NOT EXISTS `term` (
1065 `tid` int unsigned NOT NULL auto_increment COMMENT '',
1066 `oid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1067 `otype` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1068 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1069 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1070 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1071 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1072 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1073 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1074 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
1075 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1077 INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`(32)),
1078 INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
1079 INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
1080 INDEX `guid` (`guid`(64))
1081 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='item taxonomy (categories, tags, etc.) table';
1086 CREATE TABLE IF NOT EXISTS `thread` (
1087 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'sequential ID',
1088 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1089 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1090 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
1091 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item author',
1092 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1093 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1094 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1095 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1096 `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1097 `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
1098 `private` boolean NOT NULL DEFAULT '0' COMMENT '',
1099 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
1100 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
1101 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
1102 `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
1103 `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
1104 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
1105 `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
1106 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
1107 `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
1108 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1109 `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
1110 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
1111 `bookmark` boolean COMMENT '',
1113 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
1114 INDEX `uid_network_created` (`uid`,`network`,`created`),
1115 INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
1116 INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
1117 INDEX `contactid` (`contact-id`),
1118 INDEX `ownerid` (`owner-id`),
1119 INDEX `authorid` (`author-id`),
1120 INDEX `uid_created` (`uid`,`created`),
1121 INDEX `uid_commented` (`uid`,`commented`),
1122 INDEX `uid_wall_created` (`uid`,`wall`,`created`),
1123 INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`)
1124 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Thread related data';
1129 CREATE TABLE IF NOT EXISTS `tokens` (
1130 `id` varchar(40) NOT NULL COMMENT '',
1131 `secret` text COMMENT '',
1132 `client_id` varchar(20) NOT NULL DEFAULT '',
1133 `expires` int NOT NULL DEFAULT 0 COMMENT '',
1134 `scope` varchar(200) NOT NULL DEFAULT '' COMMENT '',
1135 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1137 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
1142 CREATE TABLE IF NOT EXISTS `user` (
1143 `uid` mediumint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1144 `parent-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'The parent user that has full control about this user',
1145 `guid` varchar(64) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this user',
1146 `username` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this user is known by',
1147 `password` varchar(255) NOT NULL DEFAULT '' COMMENT 'encrypted password',
1148 `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?',
1149 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT 'nick- and user name',
1150 `email` varchar(255) NOT NULL DEFAULT '' COMMENT 'the users email address',
1151 `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1152 `timezone` varchar(128) NOT NULL DEFAULT '' COMMENT 'PHP-legal timezone',
1153 `language` varchar(32) NOT NULL DEFAULT 'en' COMMENT 'default language',
1154 `register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of registration',
1155 `login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last login',
1156 `default-location` varchar(255) NOT NULL DEFAULT '' COMMENT 'Default for item.location',
1157 `allow_location` boolean NOT NULL DEFAULT '0' COMMENT '1 allows to display the location',
1158 `theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
1159 `pubkey` text COMMENT 'RSA public key 4096 bit',
1160 `prvkey` text COMMENT 'RSA private key 4096 bit',
1161 `spubkey` text COMMENT '',
1162 `sprvkey` text COMMENT '',
1163 `verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
1164 `blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
1165 `blockwall` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to post to the profile page of the user',
1166 `hidewall` boolean NOT NULL DEFAULT '0' COMMENT 'Hide profile details from unkown viewers',
1167 `blocktags` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to tag the post of this user',
1168 `unkmail` boolean NOT NULL DEFAULT '0' COMMENT 'Permit unknown people to send private mails to this user',
1169 `cntunkmail` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1170 `notify-flags` smallint unsigned NOT NULL DEFAULT 65535 COMMENT 'email notification options',
1171 `page-flags` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'page/profile type',
1172 `account-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1173 `prvnets` boolean NOT NULL DEFAULT '0' COMMENT '',
1174 `pwdreset` varchar(255) COMMENT 'Password reset request token',
1175 `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
1176 `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1177 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1178 `account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed',
1179 `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
1180 `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted',
1181 `expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last warning of account expiration',
1182 `def_gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1183 `allow_cid` mediumtext COMMENT 'default permission for this user',
1184 `allow_gid` mediumtext COMMENT 'default permission for this user',
1185 `deny_cid` mediumtext COMMENT 'default permission for this user',
1186 `deny_gid` mediumtext COMMENT 'default permission for this user',
1187 `openidserver` text COMMENT '',
1189 INDEX `nickname` (`nickname`(32))
1190 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='The local users';
1195 CREATE TABLE IF NOT EXISTS `userd` (
1196 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1197 `username` varchar(255) NOT NULL COMMENT '',
1199 INDEX `username` (`username`(32))
1200 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Deleted usernames';
1203 -- TABLE user-contact
1205 CREATE TABLE IF NOT EXISTS `user-contact` (
1206 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the linked public contact',
1207 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1208 `blocked` boolean COMMENT 'Contact is completely blocked for this user',
1209 `ignored` boolean COMMENT 'Posts from this contact are ignored',
1210 `collapsed` boolean COMMENT 'Posts from this contact are collapsed',
1211 PRIMARY KEY(`uid`,`cid`)
1212 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific public contact data';
1217 CREATE TABLE IF NOT EXISTS `user-item` (
1218 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item id',
1219 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1220 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Marker to hide an item from the user',
1221 `ignored` boolean COMMENT 'Ignore this thread if set',
1222 PRIMARY KEY(`uid`,`iid`)
1223 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
1228 CREATE TABLE IF NOT EXISTS `worker-ipc` (
1229 `key` int NOT NULL COMMENT '',
1230 `jobs` boolean COMMENT 'Flag for outstanding jobs',
1232 ) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Inter process communication between the frontend and the worker';
1235 -- TABLE workerqueue
1237 CREATE TABLE IF NOT EXISTS `workerqueue` (
1238 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id',
1239 `parameter` mediumblob COMMENT 'Task command',
1240 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority',
1241 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
1242 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
1243 `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
1244 `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
1246 INDEX `pid` (`pid`),
1247 INDEX `parameter` (`parameter`(64)),
1248 INDEX `priority_created` (`priority`,`created`),
1249 INDEX `done_executed` (`done`,`executed`)
1250 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';