1 -- ------------------------------------------
2 -- Friendica 2019.09-rc (Dalmatian Bellflower)
3 -- DB_UPDATE_VERSION 1322
4 -- ------------------------------------------
8 -- TABLE 2fa_app_specific_password
10 CREATE TABLE IF NOT EXISTS `2fa_app_specific_password` (
11 `id` mediumint unsigned NOT NULL auto_increment COMMENT 'Password ID for revocation',
12 `uid` mediumint unsigned NOT NULL COMMENT 'User ID',
13 `description` varchar(255) COMMENT 'Description of the usage of the password',
14 `hashed_password` varchar(255) NOT NULL COMMENT 'Hashed password',
15 `generated` datetime NOT NULL COMMENT 'Datetime the password was generated',
16 `last_used` datetime COMMENT 'Datetime the password was last used',
18 INDEX `uid_description` (`uid`,`description`(190))
19 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor app-specific _password';
22 -- TABLE 2fa_recovery_codes
24 CREATE TABLE IF NOT EXISTS `2fa_recovery_codes` (
25 `uid` mediumint unsigned NOT NULL COMMENT 'User ID',
26 `code` varchar(50) NOT NULL COMMENT 'Recovery code string',
27 `generated` datetime NOT NULL COMMENT 'Datetime the code was generated',
28 `used` datetime COMMENT 'Datetime the code was used',
29 PRIMARY KEY(`uid`,`code`)
30 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor authentication recovery codes';
35 CREATE TABLE IF NOT EXISTS `addon` (
36 `id` int unsigned NOT NULL auto_increment COMMENT '',
37 `name` varchar(50) NOT NULL DEFAULT '' COMMENT 'addon base (file)name',
38 `version` varchar(50) NOT NULL DEFAULT '' COMMENT 'currently unused',
39 `installed` boolean NOT NULL DEFAULT '0' COMMENT 'currently always 1',
40 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'currently unused',
41 `timestamp` int unsigned NOT NULL DEFAULT 0 COMMENT 'file timestamp to check for reloads',
42 `plugin_admin` boolean NOT NULL DEFAULT '0' COMMENT '1 = has admin config, 0 = has no admin config',
44 UNIQUE INDEX `name` (`name`)
45 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registered addons';
50 CREATE TABLE IF NOT EXISTS `apcontact` (
51 `url` varbinary(255) NOT NULL COMMENT 'URL of the contact',
52 `uuid` varchar(255) COMMENT '',
53 `type` varchar(20) NOT NULL COMMENT '',
54 `following` varchar(255) COMMENT '',
55 `followers` varchar(255) COMMENT '',
56 `inbox` varchar(255) NOT NULL COMMENT '',
57 `outbox` varchar(255) COMMENT '',
58 `sharedinbox` varchar(255) COMMENT '',
59 `manually-approve` boolean COMMENT '',
60 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
61 `name` varchar(255) COMMENT '',
62 `about` text COMMENT '',
63 `photo` varchar(255) COMMENT '',
64 `addr` varchar(255) COMMENT '',
65 `alias` varchar(255) COMMENT '',
66 `pubkey` text COMMENT '',
67 `baseurl` varchar(255) COMMENT 'baseurl of the ap contact',
68 `generator` varchar(255) COMMENT 'Name of the contact\'s system',
69 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
71 INDEX `addr` (`addr`(32)),
72 INDEX `alias` (`alias`(190)),
73 INDEX `url` (`followers`(190))
74 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='ActivityPub compatible contacts - used in the ActivityPub implementation';
79 CREATE TABLE IF NOT EXISTS `attach` (
80 `id` int unsigned NOT NULL auto_increment COMMENT 'generated index',
81 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
82 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT 'hash',
83 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT 'filename of original',
84 `filetype` varchar(64) NOT NULL DEFAULT '' COMMENT 'mimetype',
85 `filesize` int unsigned NOT NULL DEFAULT 0 COMMENT 'size in bytes',
86 `data` longblob NOT NULL COMMENT 'file data',
87 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
88 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
89 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>',
90 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
91 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
92 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
93 `backend-class` tinytext COMMENT 'Storage backend class',
94 `backend-ref` text COMMENT 'Storage backend data reference',
96 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='file attachments';
101 CREATE TABLE IF NOT EXISTS `auth_codes` (
102 `id` varchar(40) NOT NULL COMMENT '',
103 `client_id` varchar(20) NOT NULL DEFAULT '' COMMENT '',
104 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
105 `expires` int NOT NULL DEFAULT 0 COMMENT '',
106 `scope` varchar(250) NOT NULL DEFAULT '' COMMENT '',
108 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
113 CREATE TABLE IF NOT EXISTS `cache` (
114 `k` varbinary(255) NOT NULL COMMENT 'cache key',
115 `v` mediumtext COMMENT 'cached serialized value',
116 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
117 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache insertion',
119 INDEX `k_expires` (`k`,`expires`)
120 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Stores temporary data';
125 CREATE TABLE IF NOT EXISTS `challenge` (
126 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
127 `challenge` varchar(255) NOT NULL DEFAULT '' COMMENT '',
128 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
129 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
130 `type` varchar(255) NOT NULL DEFAULT '' COMMENT '',
131 `last_update` varchar(255) NOT NULL DEFAULT '' COMMENT '',
133 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
138 CREATE TABLE IF NOT EXISTS `clients` (
139 `client_id` varchar(20) NOT NULL COMMENT '',
140 `pw` varchar(20) NOT NULL DEFAULT '' COMMENT '',
141 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
142 `name` text COMMENT '',
143 `icon` text COMMENT '',
144 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
145 PRIMARY KEY(`client_id`)
146 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
151 CREATE TABLE IF NOT EXISTS `config` (
152 `id` int unsigned NOT NULL auto_increment COMMENT '',
153 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
154 `k` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
155 `v` mediumtext COMMENT '',
157 UNIQUE INDEX `cat_k` (`cat`,`k`)
158 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='main configuration storage';
163 CREATE TABLE IF NOT EXISTS `contact` (
164 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
165 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
166 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
167 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last contact update',
168 `self` boolean NOT NULL DEFAULT '0' COMMENT '1 if the contact is the user him/her self',
169 `remote_self` boolean NOT NULL DEFAULT '0' COMMENT '',
170 `rel` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'The kind of the relation between the user and the contact',
171 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
172 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network of the contact',
173 `protocol` char(4) NOT NULL DEFAULT '' COMMENT 'Protocol of the contact',
174 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
175 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
176 `location` varchar(255) DEFAULT '' COMMENT '',
177 `about` text COMMENT '',
178 `keywords` text COMMENT 'public keywords (interests) of the contact',
179 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
180 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
181 `attag` varchar(255) NOT NULL DEFAULT '' COMMENT '',
182 `avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
183 `photo` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo of the contact',
184 `thumb` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (thumb size)',
185 `micro` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (micro size)',
186 `site-pubkey` text COMMENT '',
187 `issued-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
188 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
189 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
190 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
191 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
192 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
193 `pubkey` text COMMENT 'RSA public key 4096 bit',
194 `prvkey` text COMMENT 'RSA private key 4096 bit',
195 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
196 `request` varchar(255) COMMENT '',
197 `notify` varchar(255) COMMENT '',
198 `poll` varchar(255) COMMENT '',
199 `confirm` varchar(255) COMMENT '',
200 `poco` varchar(255) COMMENT '',
201 `aes_allow` boolean NOT NULL DEFAULT '0' COMMENT '',
202 `ret-aes` boolean NOT NULL DEFAULT '0' COMMENT '',
203 `usehub` boolean NOT NULL DEFAULT '0' COMMENT '',
204 `subhub` boolean NOT NULL DEFAULT '0' COMMENT '',
205 `hub-verify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
206 `last-update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last try to update the contact info',
207 `success_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful contact update',
208 `failure_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed update',
209 `name-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
210 `uri-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
211 `avatar-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
212 `term-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
213 `last-item` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'date of the last post',
214 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
215 `blocked` boolean NOT NULL DEFAULT '1' COMMENT 'Node-wide block status',
216 `block_reason` text COMMENT 'Node-wide block reason',
217 `readonly` boolean NOT NULL DEFAULT '0' COMMENT 'posts of the contact are readonly',
218 `writable` boolean NOT NULL DEFAULT '0' COMMENT '',
219 `forum` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a forum',
220 `prv` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a private group',
221 `contact-type` tinyint NOT NULL DEFAULT 0 COMMENT '',
222 `hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
223 `archive` boolean NOT NULL DEFAULT '0' COMMENT '',
224 `pending` boolean NOT NULL DEFAULT '1' COMMENT '',
225 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'Contact has been deleted',
226 `rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
227 `unsearchable` boolean NOT NULL DEFAULT '0' COMMENT 'Contact prefers to not be searchable',
228 `sensitive` boolean NOT NULL DEFAULT '0' COMMENT 'Contact posts sensitive content',
229 `baseurl` varchar(255) DEFAULT '' COMMENT 'baseurl of the contact',
230 `reason` text COMMENT '',
231 `closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
232 `info` mediumtext COMMENT '',
233 `profile-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
234 `bdyear` varchar(4) NOT NULL DEFAULT '' COMMENT '',
235 `bd` date NOT NULL DEFAULT '0001-01-01' COMMENT '',
236 `notify_new_posts` boolean NOT NULL DEFAULT '0' COMMENT '',
237 `fetch_further_information` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
238 `ffi_keyword_blacklist` text COMMENT '',
240 INDEX `uid_name` (`uid`,`name`(190)),
241 INDEX `self_uid` (`self`,`uid`),
242 INDEX `alias_uid` (`alias`(32),`uid`),
243 INDEX `pending_uid` (`pending`,`uid`),
244 INDEX `blocked_uid` (`blocked`,`uid`),
245 INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
246 INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
247 INDEX `addr_uid` (`addr`(32),`uid`),
248 INDEX `nurl_uid` (`nurl`(32),`uid`),
249 INDEX `nick_uid` (`nick`(32),`uid`),
250 INDEX `dfrn-id` (`dfrn-id`(64)),
251 INDEX `issued-id` (`issued-id`(64))
252 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contact table';
257 CREATE TABLE IF NOT EXISTS `conv` (
258 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
259 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this conversation',
260 `recips` text COMMENT 'sender_handle;recipient_handle',
261 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
262 `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'handle of creator',
263 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation timestamp',
264 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'edited timestamp',
265 `subject` text COMMENT 'subject of initial message',
268 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
271 -- TABLE conversation
273 CREATE TABLE IF NOT EXISTS `conversation` (
274 `item-uri` varbinary(255) NOT NULL COMMENT 'Original URI of the item - unrelated to the table with the same name',
275 `reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'URI to which this item is a reply',
276 `conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
277 `conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
278 `protocol` tinyint unsigned NOT NULL DEFAULT 255 COMMENT 'The protocol of the item',
279 `source` mediumtext COMMENT 'Original source',
280 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
281 PRIMARY KEY(`item-uri`),
282 INDEX `conversation-uri` (`conversation-uri`),
283 INDEX `received` (`received`)
284 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
287 -- TABLE diaspora-interaction
289 CREATE TABLE IF NOT EXISTS `diaspora-interaction` (
290 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
291 `interaction` mediumtext COMMENT 'The Diaspora interaction',
292 PRIMARY KEY(`uri-id`)
293 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Signed Diaspora Interaction';
298 CREATE TABLE IF NOT EXISTS `event` (
299 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
300 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
301 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
302 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact_id (ID of the contact in contact table)',
303 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
304 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
305 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
306 `start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event start time',
307 `finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event end time',
308 `summary` text COMMENT 'short description or title of the event',
309 `desc` text COMMENT 'event description',
310 `location` text COMMENT 'event location',
311 `type` varchar(20) NOT NULL DEFAULT '' COMMENT 'event or birthday',
312 `nofinish` boolean NOT NULL DEFAULT '0' COMMENT 'if event does have no end this is 1',
313 `adjust` boolean NOT NULL DEFAULT '1' COMMENT 'adjust to timezone of the recipient (0 or 1)',
314 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '0 or 1',
315 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
316 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
317 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
318 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
320 INDEX `uid_start` (`uid`,`start`)
321 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Events';
326 CREATE TABLE IF NOT EXISTS `fcontact` (
327 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
328 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'unique id',
329 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
330 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
331 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
332 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
333 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
334 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
335 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
336 `notify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
337 `poll` varchar(255) NOT NULL DEFAULT '' COMMENT '',
338 `confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '',
339 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
340 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
341 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
342 `pubkey` text COMMENT '',
343 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
345 INDEX `addr` (`addr`(32)),
346 UNIQUE INDEX `url` (`url`(190))
347 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora compatible contacts - used in the Diaspora implementation';
352 CREATE TABLE IF NOT EXISTS `fsuggest` (
353 `id` int unsigned NOT NULL auto_increment COMMENT '',
354 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
355 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
356 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
357 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
358 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
359 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
360 `note` text COMMENT '',
361 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
363 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='friend suggestion stuff';
368 CREATE TABLE IF NOT EXISTS `gcign` (
369 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
370 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Local User id',
371 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'gcontact.id of ignored contact',
374 INDEX `gcid` (`gcid`)
375 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contacts ignored by friend suggestions';
380 CREATE TABLE IF NOT EXISTS `gcontact` (
381 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
382 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
383 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
384 `url` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the contacts profile page',
385 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
386 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the profile photo',
387 `connect` varchar(255) NOT NULL DEFAULT '' COMMENT '',
388 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
389 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
390 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
391 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
392 `archive_date` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
393 `archived` boolean NOT NULL DEFAULT '0' COMMENT '',
394 `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
395 `about` text COMMENT '',
396 `keywords` text COMMENT 'puplic keywords (interests)',
397 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
398 `birthday` varchar(32) NOT NULL DEFAULT '0001-01-01' COMMENT '',
399 `community` boolean NOT NULL DEFAULT '0' COMMENT '1 if contact is forum account',
400 `contact-type` tinyint NOT NULL DEFAULT -1 COMMENT '',
401 `hide` boolean NOT NULL DEFAULT '0' COMMENT '1 = should be hidden from search',
402 `nsfw` boolean NOT NULL DEFAULT '0' COMMENT '1 = contact posts nsfw content',
403 `network` char(4) NOT NULL DEFAULT '' COMMENT 'social network protocol',
404 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
405 `notify` varchar(255) COMMENT '',
406 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
407 `generation` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
408 `server_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'baseurl of the contacts server',
410 UNIQUE INDEX `nurl` (`nurl`(190)),
411 INDEX `name` (`name`(64)),
412 INDEX `nick` (`nick`(32)),
413 INDEX `addr` (`addr`(64)),
414 INDEX `hide_network_updated` (`hide`,`network`,`updated`),
415 INDEX `updated` (`updated`)
416 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='global contacts';
421 CREATE TABLE IF NOT EXISTS `glink` (
422 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
423 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
424 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
425 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
426 `zcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
427 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
429 UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
430 INDEX `gcid` (`gcid`)
431 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='\'friends of friends\' linkages derived from poco';
436 CREATE TABLE IF NOT EXISTS `group` (
437 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
438 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
439 `visible` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the member list is not private',
440 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the group has been deleted',
441 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'human readable name of group',
444 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, group info';
447 -- TABLE group_member
449 CREATE TABLE IF NOT EXISTS `group_member` (
450 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
451 `gid` int unsigned NOT NULL DEFAULT 0 COMMENT 'groups.id of the associated group',
452 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id of the member assigned to the associated group',
454 INDEX `contactid` (`contact-id`),
455 UNIQUE INDEX `gid_contactid` (`gid`,`contact-id`)
456 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, member info';
461 CREATE TABLE IF NOT EXISTS `gserver` (
462 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
463 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
464 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
465 `version` varchar(255) NOT NULL DEFAULT '' COMMENT '',
466 `site_name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
467 `info` text COMMENT '',
468 `register_policy` tinyint NOT NULL DEFAULT 0 COMMENT '',
469 `registered-users` int unsigned NOT NULL DEFAULT 0 COMMENT 'Number of registered users',
470 `poco` varchar(255) NOT NULL DEFAULT '' COMMENT '',
471 `noscrape` varchar(255) NOT NULL DEFAULT '' COMMENT '',
472 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
473 `platform` varchar(255) NOT NULL DEFAULT '' COMMENT '',
474 `relay-subscribe` boolean NOT NULL DEFAULT '0' COMMENT 'Has the server subscribed to the relay system',
475 `relay-scope` varchar(10) NOT NULL DEFAULT '' COMMENT 'The scope of messages that the server wants to get',
476 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
477 `last_poco_query` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
478 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
479 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
481 UNIQUE INDEX `nurl` (`nurl`(190))
482 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Global servers';
487 CREATE TABLE IF NOT EXISTS `gserver-tag` (
488 `gserver-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'The id of the gserver',
489 `tag` varchar(100) NOT NULL DEFAULT '' COMMENT 'Tag that the server has subscribed',
490 PRIMARY KEY(`gserver-id`,`tag`),
492 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Tags that the server has subscribed';
497 CREATE TABLE IF NOT EXISTS `hook` (
498 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
499 `hook` varbinary(100) NOT NULL DEFAULT '' COMMENT 'name of hook',
500 `file` varbinary(200) NOT NULL DEFAULT '' COMMENT 'relative filename of hook handler',
501 `function` varbinary(200) NOT NULL DEFAULT '' COMMENT 'function name of hook handler',
502 `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',
504 UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
505 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='addon hook registry';
508 -- TABLE inbox-status
510 CREATE TABLE IF NOT EXISTS `inbox-status` (
511 `url` varbinary(255) NOT NULL COMMENT 'URL of the inbox',
512 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date of this entry',
513 `success` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful delivery',
514 `failure` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed delivery',
515 `previous` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Previous delivery date',
516 `archive` boolean NOT NULL DEFAULT '0' COMMENT 'Is the inbox archived?',
517 `shared` boolean NOT NULL DEFAULT '0' COMMENT 'Is it a shared inbox?',
519 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Status of ActivityPub inboxes';
524 CREATE TABLE IF NOT EXISTS `intro` (
525 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
526 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
527 `fid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
528 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
529 `knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
530 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
531 `note` text COMMENT '',
532 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
533 `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
534 `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
535 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
537 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
542 CREATE TABLE IF NOT EXISTS `item` (
543 `id` int unsigned NOT NULL auto_increment,
544 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this item',
545 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
546 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
547 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
548 `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',
549 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT 'uri of the parent to this item',
550 `parent-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the parent uri',
551 `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',
552 `thr-parent-id` int unsigned COMMENT 'Id of the item-uri table that contains the thread parent uri',
553 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation timestamp.',
554 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last edit (default is created)',
555 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last comment/reply to this item',
556 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime',
557 `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',
558 `gravity` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
559 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network from where the item comes from',
560 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
561 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
562 `icid` int unsigned COMMENT 'Id of the item-content table entry that contains the whole item content',
563 `iaid` int unsigned COMMENT 'Id of the item-activity table entry that contains the activity data',
564 `extid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
565 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
566 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
567 `private` boolean NOT NULL DEFAULT '0' COMMENT 'distribution is restricted',
568 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
569 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
570 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'item has been deleted',
571 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id which owns this copy of the item',
572 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
573 `wall` boolean NOT NULL DEFAULT '0' COMMENT 'This item was posted to the wall of uid',
574 `origin` boolean NOT NULL DEFAULT '0' COMMENT 'item originated at this site',
575 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
576 `starred` boolean NOT NULL DEFAULT '0' COMMENT 'item has been favourited',
577 `unseen` boolean NOT NULL DEFAULT '1' COMMENT 'item has not been seen',
578 `mention` boolean NOT NULL DEFAULT '0' COMMENT 'The owner of this item was mentioned in it',
579 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
580 `psid` int unsigned COMMENT 'ID of the permission set of this post',
581 `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',
582 `event-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Used to link to the event.id',
583 `attach` mediumtext COMMENT 'JSON structure representing attachments to this item',
584 `allow_cid` mediumtext COMMENT 'Deprecated',
585 `allow_gid` mediumtext COMMENT 'Deprecated',
586 `deny_cid` mediumtext COMMENT 'Deprecated',
587 `deny_gid` mediumtext COMMENT 'Deprecated',
588 `postopts` text COMMENT 'Deprecated',
589 `inform` mediumtext COMMENT 'Deprecated',
590 `type` varchar(20) COMMENT 'Deprecated',
591 `bookmark` boolean COMMENT 'Deprecated',
592 `file` mediumtext COMMENT 'Deprecated',
593 `location` varchar(255) COMMENT 'Deprecated',
594 `coord` varchar(255) COMMENT 'Deprecated',
595 `tag` mediumtext COMMENT 'Deprecated',
596 `plink` varchar(255) COMMENT 'Deprecated',
597 `title` varchar(255) COMMENT 'Deprecated',
598 `content-warning` varchar(255) COMMENT 'Deprecated',
599 `body` mediumtext COMMENT 'Deprecated',
600 `app` varchar(255) COMMENT 'Deprecated',
601 `verb` varchar(100) COMMENT 'Deprecated',
602 `object-type` varchar(100) COMMENT 'Deprecated',
603 `object` text COMMENT 'Deprecated',
604 `target-type` varchar(100) COMMENT 'Deprecated',
605 `target` text COMMENT 'Deprecated',
606 `author-name` varchar(255) COMMENT 'Deprecated',
607 `author-link` varchar(255) COMMENT 'Deprecated',
608 `author-avatar` varchar(255) COMMENT 'Deprecated',
609 `owner-name` varchar(255) COMMENT 'Deprecated',
610 `owner-link` varchar(255) COMMENT 'Deprecated',
611 `owner-avatar` varchar(255) COMMENT 'Deprecated',
612 `rendered-hash` varchar(32) COMMENT 'Deprecated',
613 `rendered-html` mediumtext COMMENT 'Deprecated',
615 INDEX `guid` (`guid`(191)),
616 INDEX `uri` (`uri`(191)),
617 INDEX `parent` (`parent`),
618 INDEX `parent-uri` (`parent-uri`(191)),
619 INDEX `extid` (`extid`(191)),
620 INDEX `uid_id` (`uid`,`id`),
621 INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
622 INDEX `uid_received` (`uid`,`received`),
623 INDEX `uid_commented` (`uid`,`commented`),
624 INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
625 INDEX `uid_network_received` (`uid`,`network`,`received`),
626 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
627 INDEX `uid_thrparent` (`uid`,`thr-parent`(190)),
628 INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
629 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
630 INDEX `authorid_received` (`author-id`,`received`),
631 INDEX `ownerid` (`owner-id`),
632 INDEX `contact-id` (`contact-id`),
633 INDEX `uid_uri` (`uid`,`uri`(190)),
634 INDEX `resource-id` (`resource-id`),
635 INDEX `deleted_changed` (`deleted`,`changed`),
636 INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
637 INDEX `uid_eventid` (`uid`,`event-id`),
638 INDEX `icid` (`icid`),
639 INDEX `iaid` (`iaid`),
640 INDEX `psid_wall` (`psid`,`wall`)
641 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
644 -- TABLE item-activity
646 CREATE TABLE IF NOT EXISTS `item-activity` (
647 `id` int unsigned NOT NULL auto_increment,
648 `uri` varchar(255) COMMENT '',
649 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
650 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
651 `activity` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
653 UNIQUE INDEX `uri-hash` (`uri-hash`),
654 INDEX `uri` (`uri`(191)),
655 INDEX `uri-id` (`uri-id`)
656 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activities for items';
659 -- TABLE item-content
661 CREATE TABLE IF NOT EXISTS `item-content` (
662 `id` int unsigned NOT NULL auto_increment,
663 `uri` varchar(255) COMMENT '',
664 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
665 `uri-plink-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
666 `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'item title',
667 `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
668 `body` mediumtext COMMENT 'item body content',
669 `location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
670 `coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
671 `language` text COMMENT 'Language information about this post',
672 `app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
673 `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
674 `rendered-html` mediumtext COMMENT 'item.body converted to html',
675 `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams object type',
676 `object` text COMMENT 'JSON encoded object structure unless it is an implied object (normal post)',
677 `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
678 `target` text COMMENT 'JSON encoded target structure if used',
679 `plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
680 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams verb',
682 UNIQUE INDEX `uri-plink-hash` (`uri-plink-hash`),
683 INDEX `uri` (`uri`(191)),
684 INDEX `plink` (`plink`(191)),
685 INDEX `uri-id` (`uri-id`)
686 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
689 -- TABLE item-delivery-data
691 CREATE TABLE IF NOT EXISTS `item-delivery-data` (
692 `iid` int unsigned NOT NULL COMMENT 'Item id',
693 `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',
694 `inform` mediumtext COMMENT 'Additional receivers of the linked item',
695 `queue_count` mediumint NOT NULL DEFAULT 0 COMMENT 'Initial number of delivery recipients, used as item.delivery_queue_count',
696 `queue_done` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries, used as item.delivery_queue_done',
697 `queue_failed` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of unsuccessful deliveries, used as item.delivery_queue_failed',
698 `activitypub` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via ActivityPub',
699 `dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via DFRN',
700 `legacy_dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via legacy DFRN',
701 `diaspora` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via Diaspora',
702 `ostatus` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via OStatus',
704 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items';
709 CREATE TABLE IF NOT EXISTS `item-uri` (
710 `id` int unsigned NOT NULL auto_increment,
711 `uri` varbinary(255) NOT NULL COMMENT 'URI of an item',
712 `guid` varbinary(255) COMMENT 'A unique identifier for an item',
714 UNIQUE INDEX `uri` (`uri`),
715 INDEX `guid` (`guid`)
716 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='URI and GUID for items';
721 CREATE TABLE IF NOT EXISTS `locks` (
722 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
723 `name` varchar(128) NOT NULL DEFAULT '' COMMENT '',
724 `locked` boolean NOT NULL DEFAULT '0' COMMENT '',
725 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process ID',
726 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
728 INDEX `name_expires` (`name`,`expires`)
729 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
734 CREATE TABLE IF NOT EXISTS `mail` (
735 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
736 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
737 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
738 `from-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the sender',
739 `from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
740 `from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
741 `contact-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact.id',
742 `convid` int unsigned NOT NULL DEFAULT 0 COMMENT 'conv.id',
743 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
744 `body` mediumtext COMMENT '',
745 `seen` boolean NOT NULL DEFAULT '0' COMMENT 'if message visited it is 1',
746 `reply` boolean NOT NULL DEFAULT '0' COMMENT '',
747 `replied` boolean NOT NULL DEFAULT '0' COMMENT '',
748 `unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
749 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
750 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
751 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
753 INDEX `uid_seen` (`uid`,`seen`),
754 INDEX `convid` (`convid`),
755 INDEX `uri` (`uri`(64)),
756 INDEX `parent-uri` (`parent-uri`(64)),
757 INDEX `contactid` (`contact-id`(32))
758 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
763 CREATE TABLE IF NOT EXISTS `mailacct` (
764 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
765 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
766 `server` varchar(255) NOT NULL DEFAULT '' COMMENT '',
767 `port` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
768 `ssltype` varchar(16) NOT NULL DEFAULT '' COMMENT '',
769 `mailbox` varchar(255) NOT NULL DEFAULT '' COMMENT '',
770 `user` varchar(255) NOT NULL DEFAULT '' COMMENT '',
771 `pass` text COMMENT '',
772 `reply_to` varchar(255) NOT NULL DEFAULT '' COMMENT '',
773 `action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
774 `movetofolder` varchar(255) NOT NULL DEFAULT '' COMMENT '',
775 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
776 `last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
778 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Mail account data for fetching mails';
783 CREATE TABLE IF NOT EXISTS `manage` (
784 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
785 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
786 `mid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
788 UNIQUE INDEX `uid_mid` (`uid`,`mid`)
789 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='table of accounts that can manage each other';
794 CREATE TABLE IF NOT EXISTS `notify` (
795 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
796 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT '',
797 `type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
798 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
799 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
800 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
801 `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
802 `msg` mediumtext COMMENT '',
803 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
804 `link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
805 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
806 `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
807 `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
808 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
809 `otype` varchar(10) NOT NULL DEFAULT '' COMMENT '',
810 `name_cache` tinytext COMMENT 'Cached bbcode parsing of name',
811 `msg_cache` mediumtext COMMENT 'Cached bbcode parsing of msg',
813 INDEX `hash_uid` (`hash`,`uid`),
814 INDEX `seen_uid_date` (`seen`,`uid`,`date`),
815 INDEX `uid_date` (`uid`,`date`),
816 INDEX `uid_type_link` (`uid`,`type`,`link`(190))
817 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='notifications';
820 -- TABLE notify-threads
822 CREATE TABLE IF NOT EXISTS `notify-threads` (
823 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
824 `notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
825 `master-parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
826 `parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
827 `receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
829 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
834 CREATE TABLE IF NOT EXISTS `oembed` (
835 `url` varbinary(255) NOT NULL COMMENT 'page url',
836 `maxwidth` mediumint unsigned NOT NULL COMMENT 'Maximum width passed to Oembed',
837 `content` mediumtext COMMENT 'OEmbed data of the page',
838 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
839 PRIMARY KEY(`url`,`maxwidth`),
840 INDEX `created` (`created`)
841 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for OEmbed queries';
844 -- TABLE openwebauth-token
846 CREATE TABLE IF NOT EXISTS `openwebauth-token` (
847 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
848 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
849 `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Verify type',
850 `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'A generated token',
851 `meta` varchar(255) NOT NULL DEFAULT '' COMMENT '',
852 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
854 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store OpenWebAuth token to verify contacts';
859 CREATE TABLE IF NOT EXISTS `parsed_url` (
860 `url` varbinary(255) NOT NULL COMMENT 'page url',
861 `guessing` boolean NOT NULL DEFAULT '0' COMMENT 'is the \'guessing\' mode active?',
862 `oembed` boolean NOT NULL DEFAULT '0' COMMENT 'is the data the result of oembed?',
863 `content` mediumtext COMMENT 'page data',
864 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
865 PRIMARY KEY(`url`,`guessing`,`oembed`),
866 INDEX `created` (`created`)
867 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for \'parse_url\' queries';
870 -- TABLE participation
872 CREATE TABLE IF NOT EXISTS `participation` (
873 `iid` int unsigned NOT NULL COMMENT '',
874 `server` varchar(60) NOT NULL COMMENT '',
875 `cid` int unsigned NOT NULL COMMENT '',
876 `fid` int unsigned NOT NULL COMMENT '',
877 PRIMARY KEY(`iid`,`server`),
880 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Storage for participation messages from Diaspora';
885 CREATE TABLE IF NOT EXISTS `pconfig` (
886 `id` int unsigned NOT NULL auto_increment COMMENT '',
887 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
888 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
889 `k` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
890 `v` mediumtext COMMENT '',
892 UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
893 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='personal (per user) configuration storage';
896 -- TABLE permissionset
898 CREATE TABLE IF NOT EXISTS `permissionset` (
899 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
900 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id of this permission set',
901 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
902 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
903 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
904 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
906 INDEX `uid_allow_cid_allow_gid_deny_cid_deny_gid` (`allow_cid`(50),`allow_gid`(30),`deny_cid`(50),`deny_gid`(30))
907 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
912 CREATE TABLE IF NOT EXISTS `photo` (
913 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
914 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
915 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
916 `guid` char(16) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this photo',
917 `resource-id` char(32) NOT NULL DEFAULT '' COMMENT '',
918 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation date',
919 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edited date',
920 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
921 `desc` text COMMENT '',
922 `album` varchar(255) NOT NULL DEFAULT '' COMMENT 'The name of the album to which the photo belongs',
923 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
924 `type` varchar(30) NOT NULL DEFAULT 'image/jpeg',
925 `height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
926 `width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
927 `datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
928 `data` mediumblob NOT NULL COMMENT '',
929 `scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
930 `profile` boolean NOT NULL DEFAULT '0' COMMENT '',
931 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
932 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
933 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
934 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
935 `backend-class` tinytext COMMENT 'Storage backend class',
936 `backend-ref` text COMMENT 'Storage backend data reference',
937 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
939 INDEX `contactid` (`contact-id`),
940 INDEX `uid_contactid` (`uid`,`contact-id`),
941 INDEX `uid_profile` (`uid`,`profile`),
942 INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
943 INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`,`created`),
944 INDEX `resource-id` (`resource-id`)
945 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='photo storage';
950 CREATE TABLE IF NOT EXISTS `poll` (
951 `id` int unsigned NOT NULL auto_increment COMMENT '',
952 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
953 `q0` text COMMENT '',
954 `q1` text COMMENT '',
955 `q2` text COMMENT '',
956 `q3` text COMMENT '',
957 `q4` text COMMENT '',
958 `q5` text COMMENT '',
959 `q6` text COMMENT '',
960 `q7` text COMMENT '',
961 `q8` text COMMENT '',
962 `q9` text COMMENT '',
965 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently unused table for storing poll results';
970 CREATE TABLE IF NOT EXISTS `poll_result` (
971 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
972 `poll_id` int unsigned NOT NULL DEFAULT 0,
973 `choice` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
975 INDEX `poll_id` (`poll_id`)
976 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='data for polls - currently unused';
981 CREATE TABLE IF NOT EXISTS `process` (
982 `pid` int unsigned NOT NULL COMMENT '',
983 `command` varbinary(32) NOT NULL DEFAULT '' COMMENT '',
984 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
986 INDEX `command` (`command`)
987 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently running system processes';
992 CREATE TABLE IF NOT EXISTS `profile` (
993 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
994 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
995 `profile-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name of the profile',
996 `is-default` boolean NOT NULL DEFAULT '0' COMMENT 'Mark this profile as default profile',
997 `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT 'Hide friend list from viewers of this profile',
998 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
999 `pdesc` varchar(255) NOT NULL DEFAULT '' COMMENT 'Title or description',
1000 `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT 'Day of birth',
1001 `address` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1002 `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1003 `region` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1004 `postal-code` varchar(32) NOT NULL DEFAULT '' COMMENT '',
1005 `country-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1006 `hometown` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1007 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
1008 `marital` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1009 `with` text COMMENT '',
1010 `howlong` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1011 `sexual` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1012 `politic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1013 `religion` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1014 `pub_keywords` text COMMENT '',
1015 `prv_keywords` text COMMENT '',
1016 `likes` text COMMENT '',
1017 `dislikes` text COMMENT '',
1018 `about` text COMMENT '',
1019 `summary` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1020 `music` text COMMENT '',
1021 `book` text COMMENT '',
1022 `tv` text COMMENT '',
1023 `film` text COMMENT '',
1024 `interest` text COMMENT '',
1025 `romance` text COMMENT '',
1026 `work` text COMMENT '',
1027 `education` text COMMENT '',
1028 `contact` text COMMENT '',
1029 `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1030 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1031 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1032 `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1033 `publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
1034 `net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
1036 INDEX `uid_is-default` (`uid`,`is-default`),
1037 FULLTEXT INDEX `pub_keywords` (`pub_keywords`)
1038 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
1041 -- TABLE profile_check
1043 CREATE TABLE IF NOT EXISTS `profile_check` (
1044 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1045 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1046 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
1047 `dfrn_id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1048 `sec` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1049 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1051 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='DFRN remote auth use';
1054 -- TABLE push_subscriber
1056 CREATE TABLE IF NOT EXISTS `push_subscriber` (
1057 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1058 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1059 `callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1060 `topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1061 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1062 `push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1063 `last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
1064 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1065 `renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
1066 `secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1068 INDEX `next_try` (`next_try`)
1069 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Used for OStatus: Contains feed subscribers';
1074 CREATE TABLE IF NOT EXISTS `register` (
1075 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1076 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1077 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1078 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1079 `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1080 `language` varchar(16) NOT NULL DEFAULT '' COMMENT '',
1081 `note` text COMMENT '',
1083 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
1088 CREATE TABLE IF NOT EXISTS `search` (
1089 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1090 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1091 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1094 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
1099 CREATE TABLE IF NOT EXISTS `session` (
1100 `id` bigint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1101 `sid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
1102 `data` text COMMENT '',
1103 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1105 INDEX `sid` (`sid`(64)),
1106 INDEX `expire` (`expire`)
1107 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='web session storage';
1112 CREATE TABLE IF NOT EXISTS `sign` (
1113 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1114 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
1115 `signed_text` mediumtext COMMENT '',
1116 `signature` text COMMENT '',
1117 `signer` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1119 UNIQUE INDEX `iid` (`iid`)
1120 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora signatures';
1125 CREATE TABLE IF NOT EXISTS `term` (
1126 `tid` int unsigned NOT NULL auto_increment COMMENT '',
1127 `oid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1128 `otype` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1129 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1130 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1131 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1132 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1133 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1134 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1135 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
1136 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1138 INDEX `term_type` (`term`(64),`type`),
1139 INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`(32)),
1140 INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
1141 INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
1142 INDEX `guid` (`guid`(64))
1143 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='item taxonomy (categories, tags, etc.) table';
1148 CREATE TABLE IF NOT EXISTS `thread` (
1149 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'sequential ID',
1150 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1151 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1152 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
1153 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item author',
1154 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1155 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1156 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1157 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1158 `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1159 `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
1160 `private` boolean NOT NULL DEFAULT '0' COMMENT '',
1161 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
1162 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
1163 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
1164 `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
1165 `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
1166 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
1167 `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
1168 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
1169 `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
1170 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1171 `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
1172 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
1173 `bookmark` boolean COMMENT '',
1175 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
1176 INDEX `uid_network_received` (`uid`,`network`,`received`),
1177 INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
1178 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
1179 INDEX `contactid` (`contact-id`),
1180 INDEX `ownerid` (`owner-id`),
1181 INDEX `authorid` (`author-id`),
1182 INDEX `uid_received` (`uid`,`received`),
1183 INDEX `uid_commented` (`uid`,`commented`),
1184 INDEX `uid_wall_received` (`uid`,`wall`,`received`),
1185 INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`)
1186 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Thread related data';
1191 CREATE TABLE IF NOT EXISTS `tokens` (
1192 `id` varchar(40) NOT NULL COMMENT '',
1193 `secret` text COMMENT '',
1194 `client_id` varchar(20) NOT NULL DEFAULT '',
1195 `expires` int NOT NULL DEFAULT 0 COMMENT '',
1196 `scope` varchar(200) NOT NULL DEFAULT '' COMMENT '',
1197 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1199 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
1204 CREATE TABLE IF NOT EXISTS `user` (
1205 `uid` mediumint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1206 `parent-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'The parent user that has full control about this user',
1207 `guid` varchar(64) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this user',
1208 `username` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this user is known by',
1209 `password` varchar(255) NOT NULL DEFAULT '' COMMENT 'encrypted password',
1210 `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?',
1211 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT 'nick- and user name',
1212 `email` varchar(255) NOT NULL DEFAULT '' COMMENT 'the users email address',
1213 `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1214 `timezone` varchar(128) NOT NULL DEFAULT '' COMMENT 'PHP-legal timezone',
1215 `language` varchar(32) NOT NULL DEFAULT 'en' COMMENT 'default language',
1216 `register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of registration',
1217 `login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last login',
1218 `default-location` varchar(255) NOT NULL DEFAULT '' COMMENT 'Default for item.location',
1219 `allow_location` boolean NOT NULL DEFAULT '0' COMMENT '1 allows to display the location',
1220 `theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
1221 `pubkey` text COMMENT 'RSA public key 4096 bit',
1222 `prvkey` text COMMENT 'RSA private key 4096 bit',
1223 `spubkey` text COMMENT '',
1224 `sprvkey` text COMMENT '',
1225 `verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
1226 `blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
1227 `blockwall` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to post to the profile page of the user',
1228 `hidewall` boolean NOT NULL DEFAULT '0' COMMENT 'Hide profile details from unkown viewers',
1229 `blocktags` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to tag the post of this user',
1230 `unkmail` boolean NOT NULL DEFAULT '0' COMMENT 'Permit unknown people to send private mails to this user',
1231 `cntunkmail` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1232 `notify-flags` smallint unsigned NOT NULL DEFAULT 65535 COMMENT 'email notification options',
1233 `page-flags` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'page/profile type',
1234 `account-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1235 `prvnets` boolean NOT NULL DEFAULT '0' COMMENT '',
1236 `pwdreset` varchar(255) COMMENT 'Password reset request token',
1237 `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
1238 `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1239 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1240 `account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed',
1241 `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
1242 `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted',
1243 `expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last warning of account expiration',
1244 `def_gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1245 `allow_cid` mediumtext COMMENT 'default permission for this user',
1246 `allow_gid` mediumtext COMMENT 'default permission for this user',
1247 `deny_cid` mediumtext COMMENT 'default permission for this user',
1248 `deny_gid` mediumtext COMMENT 'default permission for this user',
1249 `openidserver` text COMMENT '',
1251 INDEX `nickname` (`nickname`(32))
1252 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='The local users';
1257 CREATE TABLE IF NOT EXISTS `userd` (
1258 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1259 `username` varchar(255) NOT NULL COMMENT '',
1261 INDEX `username` (`username`(32))
1262 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Deleted usernames';
1265 -- TABLE user-contact
1267 CREATE TABLE IF NOT EXISTS `user-contact` (
1268 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the linked public contact',
1269 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1270 `blocked` boolean COMMENT 'Contact is completely blocked for this user',
1271 `ignored` boolean COMMENT 'Posts from this contact are ignored',
1272 `collapsed` boolean COMMENT 'Posts from this contact are collapsed',
1273 PRIMARY KEY(`uid`,`cid`)
1274 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific public contact data';
1279 CREATE TABLE IF NOT EXISTS `user-item` (
1280 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item id',
1281 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1282 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Marker to hide an item from the user',
1283 `ignored` boolean COMMENT 'Ignore this thread if set',
1284 PRIMARY KEY(`uid`,`iid`)
1285 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
1290 CREATE TABLE IF NOT EXISTS `worker-ipc` (
1291 `key` int NOT NULL COMMENT '',
1292 `jobs` boolean COMMENT 'Flag for outstanding jobs',
1294 ) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Inter process communication between the frontend and the worker';
1297 -- TABLE workerqueue
1299 CREATE TABLE IF NOT EXISTS `workerqueue` (
1300 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id',
1301 `parameter` mediumtext COMMENT 'Task command',
1302 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority',
1303 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
1304 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
1305 `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
1306 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1307 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1308 `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
1310 INDEX `done_parameter` (`done`,`parameter`(64)),
1311 INDEX `done_executed` (`done`,`executed`),
1312 INDEX `done_priority_created` (`done`,`priority`,`created`),
1313 INDEX `done_priority_next_try` (`done`,`priority`,`next_try`),
1314 INDEX `done_pid_next_try` (`done`,`pid`,`next_try`),
1315 INDEX `done_pid_priority_created` (`done`,`pid`,`priority`,`created`)
1316 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
1321 CREATE TABLE IF NOT EXISTS `storage` (
1322 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented image data id',
1323 `data` longblob NOT NULL COMMENT 'file data',
1325 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Data stored by Database storage backend';