1 -- ------------------------------------------
2 -- Friendica 2019.12-rc (Dalmatian Bellflower)
3 -- DB_UPDATE_VERSION 1328
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 `following_count` int unsigned DEFAULT 0 COMMENT 'Number of following contacts',
70 `followers_count` int unsigned DEFAULT 0 COMMENT 'Number of followers',
71 `statuses_count` int unsigned DEFAULT 0 COMMENT 'Number of posts',
72 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
74 INDEX `addr` (`addr`(32)),
75 INDEX `alias` (`alias`(190)),
76 INDEX `url` (`followers`(190))
77 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='ActivityPub compatible contacts - used in the ActivityPub implementation';
82 CREATE TABLE IF NOT EXISTS `attach` (
83 `id` int unsigned NOT NULL auto_increment COMMENT 'generated index',
84 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
85 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT 'hash',
86 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT 'filename of original',
87 `filetype` varchar(64) NOT NULL DEFAULT '' COMMENT 'mimetype',
88 `filesize` int unsigned NOT NULL DEFAULT 0 COMMENT 'size in bytes',
89 `data` longblob NOT NULL COMMENT 'file data',
90 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
91 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
92 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>',
93 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
94 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
95 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
96 `backend-class` tinytext COMMENT 'Storage backend class',
97 `backend-ref` text COMMENT 'Storage backend data reference',
99 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='file attachments';
104 CREATE TABLE IF NOT EXISTS `auth_codes` (
105 `id` varchar(40) NOT NULL COMMENT '',
106 `client_id` varchar(20) NOT NULL DEFAULT '' COMMENT '',
107 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
108 `expires` int NOT NULL DEFAULT 0 COMMENT '',
109 `scope` varchar(250) NOT NULL DEFAULT '' COMMENT '',
111 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
116 CREATE TABLE IF NOT EXISTS `cache` (
117 `k` varbinary(255) NOT NULL COMMENT 'cache key',
118 `v` mediumtext COMMENT 'cached serialized value',
119 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
120 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache insertion',
122 INDEX `k_expires` (`k`,`expires`)
123 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Stores temporary data';
128 CREATE TABLE IF NOT EXISTS `challenge` (
129 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
130 `challenge` varchar(255) NOT NULL DEFAULT '' COMMENT '',
131 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
132 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
133 `type` varchar(255) NOT NULL DEFAULT '' COMMENT '',
134 `last_update` varchar(255) NOT NULL DEFAULT '' COMMENT '',
136 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
141 CREATE TABLE IF NOT EXISTS `clients` (
142 `client_id` varchar(20) NOT NULL COMMENT '',
143 `pw` varchar(20) NOT NULL DEFAULT '' COMMENT '',
144 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
145 `name` text COMMENT '',
146 `icon` text COMMENT '',
147 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
148 PRIMARY KEY(`client_id`)
149 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
154 CREATE TABLE IF NOT EXISTS `config` (
155 `id` int unsigned NOT NULL auto_increment COMMENT '',
156 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
157 `k` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
158 `v` mediumtext COMMENT '',
160 UNIQUE INDEX `cat_k` (`cat`,`k`)
161 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='main configuration storage';
166 CREATE TABLE IF NOT EXISTS `contact` (
167 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
168 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
169 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
170 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last contact update',
171 `self` boolean NOT NULL DEFAULT '0' COMMENT '1 if the contact is the user him/her self',
172 `remote_self` boolean NOT NULL DEFAULT '0' COMMENT '',
173 `rel` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'The kind of the relation between the user and the contact',
174 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
175 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network of the contact',
176 `protocol` char(4) NOT NULL DEFAULT '' COMMENT 'Protocol of the contact',
177 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
178 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
179 `location` varchar(255) DEFAULT '' COMMENT '',
180 `about` text COMMENT '',
181 `keywords` text COMMENT 'public keywords (interests) of the contact',
182 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
183 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
184 `attag` varchar(255) NOT NULL DEFAULT '' COMMENT '',
185 `avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
186 `photo` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo of the contact',
187 `thumb` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (thumb size)',
188 `micro` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (micro size)',
189 `site-pubkey` text COMMENT '',
190 `issued-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
191 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
192 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
193 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
194 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
195 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
196 `pubkey` text COMMENT 'RSA public key 4096 bit',
197 `prvkey` text COMMENT 'RSA private key 4096 bit',
198 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
199 `request` varchar(255) COMMENT '',
200 `notify` varchar(255) COMMENT '',
201 `poll` varchar(255) COMMENT '',
202 `confirm` varchar(255) COMMENT '',
203 `poco` varchar(255) COMMENT '',
204 `aes_allow` boolean NOT NULL DEFAULT '0' COMMENT '',
205 `ret-aes` boolean NOT NULL DEFAULT '0' COMMENT '',
206 `usehub` boolean NOT NULL DEFAULT '0' COMMENT '',
207 `subhub` boolean NOT NULL DEFAULT '0' COMMENT '',
208 `hub-verify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
209 `last-update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last try to update the contact info',
210 `success_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful contact update',
211 `failure_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed update',
212 `name-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
213 `uri-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
214 `avatar-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
215 `term-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
216 `last-item` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'date of the last post',
217 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
218 `blocked` boolean NOT NULL DEFAULT '1' COMMENT 'Node-wide block status',
219 `block_reason` text COMMENT 'Node-wide block reason',
220 `readonly` boolean NOT NULL DEFAULT '0' COMMENT 'posts of the contact are readonly',
221 `writable` boolean NOT NULL DEFAULT '0' COMMENT '',
222 `forum` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a forum',
223 `prv` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a private group',
224 `contact-type` tinyint NOT NULL DEFAULT 0 COMMENT '',
225 `hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
226 `archive` boolean NOT NULL DEFAULT '0' COMMENT '',
227 `pending` boolean NOT NULL DEFAULT '1' COMMENT '',
228 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'Contact has been deleted',
229 `rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
230 `unsearchable` boolean NOT NULL DEFAULT '0' COMMENT 'Contact prefers to not be searchable',
231 `sensitive` boolean NOT NULL DEFAULT '0' COMMENT 'Contact posts sensitive content',
232 `baseurl` varchar(255) DEFAULT '' COMMENT 'baseurl of the contact',
233 `reason` text COMMENT '',
234 `closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
235 `info` mediumtext COMMENT '',
236 `profile-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
237 `bdyear` varchar(4) NOT NULL DEFAULT '' COMMENT '',
238 `bd` date NOT NULL DEFAULT '0001-01-01' COMMENT '',
239 `notify_new_posts` boolean NOT NULL DEFAULT '0' COMMENT '',
240 `fetch_further_information` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
241 `ffi_keyword_blacklist` text COMMENT '',
243 INDEX `uid_name` (`uid`,`name`(190)),
244 INDEX `self_uid` (`self`,`uid`),
245 INDEX `alias_uid` (`alias`(32),`uid`),
246 INDEX `pending_uid` (`pending`,`uid`),
247 INDEX `blocked_uid` (`blocked`,`uid`),
248 INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
249 INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
250 INDEX `addr_uid` (`addr`(32),`uid`),
251 INDEX `nurl_uid` (`nurl`(32),`uid`),
252 INDEX `nick_uid` (`nick`(32),`uid`),
253 INDEX `dfrn-id` (`dfrn-id`(64)),
254 INDEX `issued-id` (`issued-id`(64))
255 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contact table';
260 CREATE TABLE IF NOT EXISTS `conv` (
261 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
262 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this conversation',
263 `recips` text COMMENT 'sender_handle;recipient_handle',
264 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
265 `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'handle of creator',
266 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation timestamp',
267 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'edited timestamp',
268 `subject` text COMMENT 'subject of initial message',
271 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
274 -- TABLE conversation
276 CREATE TABLE IF NOT EXISTS `conversation` (
277 `item-uri` varbinary(255) NOT NULL COMMENT 'Original URI of the item - unrelated to the table with the same name',
278 `reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'URI to which this item is a reply',
279 `conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
280 `conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
281 `protocol` tinyint unsigned NOT NULL DEFAULT 255 COMMENT 'The protocol of the item',
282 `source` mediumtext COMMENT 'Original source',
283 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
284 PRIMARY KEY(`item-uri`),
285 INDEX `conversation-uri` (`conversation-uri`),
286 INDEX `received` (`received`)
287 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
290 -- TABLE diaspora-interaction
292 CREATE TABLE IF NOT EXISTS `diaspora-interaction` (
293 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
294 `interaction` mediumtext COMMENT 'The Diaspora interaction',
295 PRIMARY KEY(`uri-id`)
296 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Signed Diaspora Interaction';
301 CREATE TABLE IF NOT EXISTS `event` (
302 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
303 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
304 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
305 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact_id (ID of the contact in contact table)',
306 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
307 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
308 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
309 `start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event start time',
310 `finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event end time',
311 `summary` text COMMENT 'short description or title of the event',
312 `desc` text COMMENT 'event description',
313 `location` text COMMENT 'event location',
314 `type` varchar(20) NOT NULL DEFAULT '' COMMENT 'event or birthday',
315 `nofinish` boolean NOT NULL DEFAULT '0' COMMENT 'if event does have no end this is 1',
316 `adjust` boolean NOT NULL DEFAULT '1' COMMENT 'adjust to timezone of the recipient (0 or 1)',
317 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '0 or 1',
318 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
319 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
320 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
321 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
323 INDEX `uid_start` (`uid`,`start`)
324 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Events';
329 CREATE TABLE IF NOT EXISTS `fcontact` (
330 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
331 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'unique id',
332 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
333 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
334 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
335 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
336 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
337 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
338 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
339 `notify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
340 `poll` varchar(255) NOT NULL DEFAULT '' COMMENT '',
341 `confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '',
342 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
343 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
344 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
345 `pubkey` text COMMENT '',
346 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
348 INDEX `addr` (`addr`(32)),
349 UNIQUE INDEX `url` (`url`(190))
350 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora compatible contacts - used in the Diaspora implementation';
355 CREATE TABLE IF NOT EXISTS `fsuggest` (
356 `id` int unsigned NOT NULL auto_increment COMMENT '',
357 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
358 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
359 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
360 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
361 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
362 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
363 `note` text COMMENT '',
364 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
366 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='friend suggestion stuff';
371 CREATE TABLE IF NOT EXISTS `gcign` (
372 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
373 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Local User id',
374 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'gcontact.id of ignored contact',
377 INDEX `gcid` (`gcid`)
378 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contacts ignored by friend suggestions';
383 CREATE TABLE IF NOT EXISTS `gcontact` (
384 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
385 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
386 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
387 `url` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the contacts profile page',
388 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
389 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the profile photo',
390 `connect` varchar(255) NOT NULL DEFAULT '' COMMENT '',
391 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
392 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
393 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
394 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
395 `archive_date` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
396 `archived` boolean NOT NULL DEFAULT '0' COMMENT '',
397 `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
398 `about` text COMMENT '',
399 `keywords` text COMMENT 'puplic keywords (interests)',
400 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
401 `birthday` varchar(32) NOT NULL DEFAULT '0001-01-01' COMMENT '',
402 `community` boolean NOT NULL DEFAULT '0' COMMENT '1 if contact is forum account',
403 `contact-type` tinyint NOT NULL DEFAULT -1 COMMENT '',
404 `hide` boolean NOT NULL DEFAULT '0' COMMENT '1 = should be hidden from search',
405 `nsfw` boolean NOT NULL DEFAULT '0' COMMENT '1 = contact posts nsfw content',
406 `network` char(4) NOT NULL DEFAULT '' COMMENT 'social network protocol',
407 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
408 `notify` varchar(255) COMMENT '',
409 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
410 `generation` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
411 `server_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'baseurl of the contacts server',
413 UNIQUE INDEX `nurl` (`nurl`(190)),
414 INDEX `name` (`name`(64)),
415 INDEX `nick` (`nick`(32)),
416 INDEX `addr` (`addr`(64)),
417 INDEX `hide_network_updated` (`hide`,`network`,`updated`),
418 INDEX `updated` (`updated`)
419 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='global contacts';
424 CREATE TABLE IF NOT EXISTS `glink` (
425 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
426 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
427 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
428 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
429 `zcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
430 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
432 UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
433 INDEX `gcid` (`gcid`)
434 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='\'friends of friends\' linkages derived from poco';
439 CREATE TABLE IF NOT EXISTS `group` (
440 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
441 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
442 `visible` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the member list is not private',
443 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the group has been deleted',
444 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'human readable name of group',
447 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, group info';
450 -- TABLE group_member
452 CREATE TABLE IF NOT EXISTS `group_member` (
453 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
454 `gid` int unsigned NOT NULL DEFAULT 0 COMMENT 'groups.id of the associated group',
455 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id of the member assigned to the associated group',
457 INDEX `contactid` (`contact-id`),
458 UNIQUE INDEX `gid_contactid` (`gid`,`contact-id`)
459 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, member info';
464 CREATE TABLE IF NOT EXISTS `gserver` (
465 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
466 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
467 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
468 `version` varchar(255) NOT NULL DEFAULT '' COMMENT '',
469 `site_name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
470 `info` text COMMENT '',
471 `register_policy` tinyint NOT NULL DEFAULT 0 COMMENT '',
472 `registered-users` int unsigned NOT NULL DEFAULT 0 COMMENT 'Number of registered users',
473 `directory-type` tinyint DEFAULT 0 COMMENT 'Type of directory service (Poco, Mastodon)',
474 `poco` varchar(255) NOT NULL DEFAULT '' COMMENT '',
475 `noscrape` varchar(255) NOT NULL DEFAULT '' COMMENT '',
476 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
477 `platform` varchar(255) NOT NULL DEFAULT '' COMMENT '',
478 `relay-subscribe` boolean NOT NULL DEFAULT '0' COMMENT 'Has the server subscribed to the relay system',
479 `relay-scope` varchar(10) NOT NULL DEFAULT '' COMMENT 'The scope of messages that the server wants to get',
480 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
481 `last_poco_query` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
482 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
483 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
485 UNIQUE INDEX `nurl` (`nurl`(190))
486 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Global servers';
491 CREATE TABLE IF NOT EXISTS `gserver-tag` (
492 `gserver-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'The id of the gserver',
493 `tag` varchar(100) NOT NULL DEFAULT '' COMMENT 'Tag that the server has subscribed',
494 PRIMARY KEY(`gserver-id`,`tag`),
496 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Tags that the server has subscribed';
501 CREATE TABLE IF NOT EXISTS `hook` (
502 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
503 `hook` varbinary(100) NOT NULL DEFAULT '' COMMENT 'name of hook',
504 `file` varbinary(200) NOT NULL DEFAULT '' COMMENT 'relative filename of hook handler',
505 `function` varbinary(200) NOT NULL DEFAULT '' COMMENT 'function name of hook handler',
506 `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',
508 UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
509 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='addon hook registry';
512 -- TABLE inbox-status
514 CREATE TABLE IF NOT EXISTS `inbox-status` (
515 `url` varbinary(255) NOT NULL COMMENT 'URL of the inbox',
516 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date of this entry',
517 `success` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful delivery',
518 `failure` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed delivery',
519 `previous` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Previous delivery date',
520 `archive` boolean NOT NULL DEFAULT '0' COMMENT 'Is the inbox archived?',
521 `shared` boolean NOT NULL DEFAULT '0' COMMENT 'Is it a shared inbox?',
523 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Status of ActivityPub inboxes';
528 CREATE TABLE IF NOT EXISTS `intro` (
529 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
530 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
531 `fid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
532 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
533 `knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
534 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
535 `note` text COMMENT '',
536 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
537 `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
538 `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
539 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
541 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
546 CREATE TABLE IF NOT EXISTS `item` (
547 `id` int unsigned NOT NULL auto_increment,
548 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this item',
549 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
550 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
551 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
552 `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',
553 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT 'uri of the parent to this item',
554 `parent-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the parent uri',
555 `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',
556 `thr-parent-id` int unsigned COMMENT 'Id of the item-uri table that contains the thread parent uri',
557 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation timestamp.',
558 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last edit (default is created)',
559 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last comment/reply to this item',
560 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime',
561 `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',
562 `gravity` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
563 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network from where the item comes from',
564 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
565 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
566 `icid` int unsigned COMMENT 'Id of the item-content table entry that contains the whole item content',
567 `iaid` int unsigned COMMENT 'Id of the item-activity table entry that contains the activity data',
568 `extid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
569 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
570 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
571 `private` boolean NOT NULL DEFAULT '0' COMMENT 'distribution is restricted',
572 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
573 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
574 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'item has been deleted',
575 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id which owns this copy of the item',
576 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
577 `wall` boolean NOT NULL DEFAULT '0' COMMENT 'This item was posted to the wall of uid',
578 `origin` boolean NOT NULL DEFAULT '0' COMMENT 'item originated at this site',
579 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
580 `starred` boolean NOT NULL DEFAULT '0' COMMENT 'item has been favourited',
581 `unseen` boolean NOT NULL DEFAULT '1' COMMENT 'item has not been seen',
582 `mention` boolean NOT NULL DEFAULT '0' COMMENT 'The owner of this item was mentioned in it',
583 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
584 `psid` int unsigned COMMENT 'ID of the permission set of this post',
585 `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',
586 `event-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Used to link to the event.id',
587 `attach` mediumtext COMMENT 'JSON structure representing attachments to this item',
588 `allow_cid` mediumtext COMMENT 'Deprecated',
589 `allow_gid` mediumtext COMMENT 'Deprecated',
590 `deny_cid` mediumtext COMMENT 'Deprecated',
591 `deny_gid` mediumtext COMMENT 'Deprecated',
592 `postopts` text COMMENT 'Deprecated',
593 `inform` mediumtext COMMENT 'Deprecated',
594 `type` varchar(20) COMMENT 'Deprecated',
595 `bookmark` boolean COMMENT 'Deprecated',
596 `file` mediumtext COMMENT 'Deprecated',
597 `location` varchar(255) COMMENT 'Deprecated',
598 `coord` varchar(255) COMMENT 'Deprecated',
599 `tag` mediumtext COMMENT 'Deprecated',
600 `plink` varchar(255) COMMENT 'Deprecated',
601 `title` varchar(255) COMMENT 'Deprecated',
602 `content-warning` varchar(255) COMMENT 'Deprecated',
603 `body` mediumtext COMMENT 'Deprecated',
604 `app` varchar(255) COMMENT 'Deprecated',
605 `verb` varchar(100) COMMENT 'Deprecated',
606 `object-type` varchar(100) COMMENT 'Deprecated',
607 `object` text COMMENT 'Deprecated',
608 `target-type` varchar(100) COMMENT 'Deprecated',
609 `target` text COMMENT 'Deprecated',
610 `author-name` varchar(255) COMMENT 'Deprecated',
611 `author-link` varchar(255) COMMENT 'Deprecated',
612 `author-avatar` varchar(255) COMMENT 'Deprecated',
613 `owner-name` varchar(255) COMMENT 'Deprecated',
614 `owner-link` varchar(255) COMMENT 'Deprecated',
615 `owner-avatar` varchar(255) COMMENT 'Deprecated',
616 `rendered-hash` varchar(32) COMMENT 'Deprecated',
617 `rendered-html` mediumtext COMMENT 'Deprecated',
619 INDEX `guid` (`guid`(191)),
620 INDEX `uri` (`uri`(191)),
621 INDEX `parent` (`parent`),
622 INDEX `parent-uri` (`parent-uri`(191)),
623 INDEX `extid` (`extid`(191)),
624 INDEX `uid_id` (`uid`,`id`),
625 INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
626 INDEX `uid_received` (`uid`,`received`),
627 INDEX `uid_commented` (`uid`,`commented`),
628 INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
629 INDEX `uid_network_received` (`uid`,`network`,`received`),
630 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
631 INDEX `uid_thrparent` (`uid`,`thr-parent`(190)),
632 INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
633 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
634 INDEX `authorid_received` (`author-id`,`received`),
635 INDEX `ownerid` (`owner-id`),
636 INDEX `contact-id` (`contact-id`),
637 INDEX `uid_uri` (`uid`,`uri`(190)),
638 INDEX `resource-id` (`resource-id`),
639 INDEX `deleted_changed` (`deleted`,`changed`),
640 INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
641 INDEX `mention_uid_id` (`mention`,`uid`,`id`),
642 INDEX `uid_eventid` (`uid`,`event-id`),
643 INDEX `icid` (`icid`),
644 INDEX `iaid` (`iaid`),
645 INDEX `psid_wall` (`psid`,`wall`)
646 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
649 -- TABLE item-activity
651 CREATE TABLE IF NOT EXISTS `item-activity` (
652 `id` int unsigned NOT NULL auto_increment,
653 `uri` varchar(255) COMMENT '',
654 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
655 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
656 `activity` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
658 UNIQUE INDEX `uri-hash` (`uri-hash`),
659 INDEX `uri` (`uri`(191)),
660 INDEX `uri-id` (`uri-id`)
661 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activities for items';
664 -- TABLE item-content
666 CREATE TABLE IF NOT EXISTS `item-content` (
667 `id` int unsigned NOT NULL auto_increment,
668 `uri` varchar(255) COMMENT '',
669 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
670 `uri-plink-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
671 `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'item title',
672 `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
673 `body` mediumtext COMMENT 'item body content',
674 `location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
675 `coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
676 `language` text COMMENT 'Language information about this post',
677 `app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
678 `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
679 `rendered-html` mediumtext COMMENT 'item.body converted to html',
680 `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams object type',
681 `object` text COMMENT 'JSON encoded object structure unless it is an implied object (normal post)',
682 `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
683 `target` text COMMENT 'JSON encoded target structure if used',
684 `plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
685 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams verb',
687 UNIQUE INDEX `uri-plink-hash` (`uri-plink-hash`),
688 INDEX `uri` (`uri`(191)),
689 INDEX `plink` (`plink`(191)),
690 INDEX `uri-id` (`uri-id`)
691 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
694 -- TABLE item-delivery-data
696 CREATE TABLE IF NOT EXISTS `item-delivery-data` (
697 `iid` int unsigned NOT NULL COMMENT 'Item id',
698 `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',
699 `inform` mediumtext COMMENT 'Additional receivers of the linked item',
700 `queue_count` mediumint NOT NULL DEFAULT 0 COMMENT 'Initial number of delivery recipients, used as item.delivery_queue_count',
701 `queue_done` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries, used as item.delivery_queue_done',
702 `queue_failed` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of unsuccessful deliveries, used as item.delivery_queue_failed',
703 `activitypub` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via ActivityPub',
704 `dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via DFRN',
705 `legacy_dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via legacy DFRN',
706 `diaspora` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via Diaspora',
707 `ostatus` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via OStatus',
709 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items';
714 CREATE TABLE IF NOT EXISTS `item-uri` (
715 `id` int unsigned NOT NULL auto_increment,
716 `uri` varbinary(255) NOT NULL COMMENT 'URI of an item',
717 `guid` varbinary(255) COMMENT 'A unique identifier for an item',
719 UNIQUE INDEX `uri` (`uri`),
720 INDEX `guid` (`guid`)
721 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='URI and GUID for items';
726 CREATE TABLE IF NOT EXISTS `locks` (
727 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
728 `name` varchar(128) NOT NULL DEFAULT '' COMMENT '',
729 `locked` boolean NOT NULL DEFAULT '0' COMMENT '',
730 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process ID',
731 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
733 INDEX `name_expires` (`name`,`expires`)
734 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
739 CREATE TABLE IF NOT EXISTS `mail` (
740 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
741 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
742 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
743 `from-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the sender',
744 `from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
745 `from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
746 `contact-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact.id',
747 `convid` int unsigned NOT NULL DEFAULT 0 COMMENT 'conv.id',
748 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
749 `body` mediumtext COMMENT '',
750 `seen` boolean NOT NULL DEFAULT '0' COMMENT 'if message visited it is 1',
751 `reply` boolean NOT NULL DEFAULT '0' COMMENT '',
752 `replied` boolean NOT NULL DEFAULT '0' COMMENT '',
753 `unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
754 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
755 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
756 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
758 INDEX `uid_seen` (`uid`,`seen`),
759 INDEX `convid` (`convid`),
760 INDEX `uri` (`uri`(64)),
761 INDEX `parent-uri` (`parent-uri`(64)),
762 INDEX `contactid` (`contact-id`(32))
763 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
768 CREATE TABLE IF NOT EXISTS `mailacct` (
769 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
770 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
771 `server` varchar(255) NOT NULL DEFAULT '' COMMENT '',
772 `port` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
773 `ssltype` varchar(16) NOT NULL DEFAULT '' COMMENT '',
774 `mailbox` varchar(255) NOT NULL DEFAULT '' COMMENT '',
775 `user` varchar(255) NOT NULL DEFAULT '' COMMENT '',
776 `pass` text COMMENT '',
777 `reply_to` varchar(255) NOT NULL DEFAULT '' COMMENT '',
778 `action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
779 `movetofolder` varchar(255) NOT NULL DEFAULT '' COMMENT '',
780 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
781 `last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
783 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Mail account data for fetching mails';
788 CREATE TABLE IF NOT EXISTS `manage` (
789 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
790 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
791 `mid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
793 UNIQUE INDEX `uid_mid` (`uid`,`mid`)
794 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='table of accounts that can manage each other';
799 CREATE TABLE IF NOT EXISTS `notify` (
800 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
801 `type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
802 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
803 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
804 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
805 `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
806 `msg` mediumtext COMMENT '',
807 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
808 `link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
809 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
810 `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
811 `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
812 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
813 `otype` varchar(10) NOT NULL DEFAULT '' COMMENT '',
814 `name_cache` tinytext COMMENT 'Cached bbcode parsing of name',
815 `msg_cache` mediumtext COMMENT 'Cached bbcode parsing of msg',
817 INDEX `seen_uid_date` (`seen`,`uid`,`date`),
818 INDEX `uid_date` (`uid`,`date`),
819 INDEX `uid_type_link` (`uid`,`type`,`link`(190))
820 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='notifications';
823 -- TABLE notify-threads
825 CREATE TABLE IF NOT EXISTS `notify-threads` (
826 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
827 `notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
828 `master-parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
829 `parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
830 `receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
832 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
837 CREATE TABLE IF NOT EXISTS `oembed` (
838 `url` varbinary(255) NOT NULL COMMENT 'page url',
839 `maxwidth` mediumint unsigned NOT NULL COMMENT 'Maximum width passed to Oembed',
840 `content` mediumtext COMMENT 'OEmbed data of the page',
841 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
842 PRIMARY KEY(`url`,`maxwidth`),
843 INDEX `created` (`created`)
844 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for OEmbed queries';
847 -- TABLE openwebauth-token
849 CREATE TABLE IF NOT EXISTS `openwebauth-token` (
850 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
851 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
852 `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Verify type',
853 `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'A generated token',
854 `meta` varchar(255) NOT NULL DEFAULT '' COMMENT '',
855 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
857 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store OpenWebAuth token to verify contacts';
862 CREATE TABLE IF NOT EXISTS `parsed_url` (
863 `url` varbinary(255) NOT NULL COMMENT 'page url',
864 `guessing` boolean NOT NULL DEFAULT '0' COMMENT 'is the \'guessing\' mode active?',
865 `oembed` boolean NOT NULL DEFAULT '0' COMMENT 'is the data the result of oembed?',
866 `content` mediumtext COMMENT 'page data',
867 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
868 PRIMARY KEY(`url`,`guessing`,`oembed`),
869 INDEX `created` (`created`)
870 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for \'parse_url\' queries';
873 -- TABLE participation
875 CREATE TABLE IF NOT EXISTS `participation` (
876 `iid` int unsigned NOT NULL COMMENT '',
877 `server` varchar(60) NOT NULL COMMENT '',
878 `cid` int unsigned NOT NULL COMMENT '',
879 `fid` int unsigned NOT NULL COMMENT '',
880 PRIMARY KEY(`iid`,`server`),
883 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Storage for participation messages from Diaspora';
888 CREATE TABLE IF NOT EXISTS `pconfig` (
889 `id` int unsigned NOT NULL auto_increment COMMENT '',
890 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
891 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
892 `k` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
893 `v` mediumtext COMMENT '',
895 UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
896 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='personal (per user) configuration storage';
899 -- TABLE permissionset
901 CREATE TABLE IF NOT EXISTS `permissionset` (
902 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
903 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id of this permission set',
904 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
905 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
906 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
907 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
909 INDEX `uid_allow_cid_allow_gid_deny_cid_deny_gid` (`allow_cid`(50),`allow_gid`(30),`deny_cid`(50),`deny_gid`(30))
910 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
915 CREATE TABLE IF NOT EXISTS `photo` (
916 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
917 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
918 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
919 `guid` char(16) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this photo',
920 `resource-id` char(32) NOT NULL DEFAULT '' COMMENT '',
921 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation date',
922 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edited date',
923 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
924 `desc` text COMMENT '',
925 `album` varchar(255) NOT NULL DEFAULT '' COMMENT 'The name of the album to which the photo belongs',
926 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
927 `type` varchar(30) NOT NULL DEFAULT 'image/jpeg',
928 `height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
929 `width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
930 `datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
931 `data` mediumblob NOT NULL COMMENT '',
932 `scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
933 `profile` boolean NOT NULL DEFAULT '0' COMMENT '',
934 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
935 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
936 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
937 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
938 `backend-class` tinytext COMMENT 'Storage backend class',
939 `backend-ref` text COMMENT 'Storage backend data reference',
940 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
942 INDEX `contactid` (`contact-id`),
943 INDEX `uid_contactid` (`uid`,`contact-id`),
944 INDEX `uid_profile` (`uid`,`profile`),
945 INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
946 INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`,`created`),
947 INDEX `resource-id` (`resource-id`)
948 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='photo storage';
953 CREATE TABLE IF NOT EXISTS `poll` (
954 `id` int unsigned NOT NULL auto_increment COMMENT '',
955 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
956 `q0` text COMMENT '',
957 `q1` text COMMENT '',
958 `q2` text COMMENT '',
959 `q3` text COMMENT '',
960 `q4` text COMMENT '',
961 `q5` text COMMENT '',
962 `q6` text COMMENT '',
963 `q7` text COMMENT '',
964 `q8` text COMMENT '',
965 `q9` text COMMENT '',
968 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently unused table for storing poll results';
973 CREATE TABLE IF NOT EXISTS `poll_result` (
974 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
975 `poll_id` int unsigned NOT NULL DEFAULT 0,
976 `choice` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
978 INDEX `poll_id` (`poll_id`)
979 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='data for polls - currently unused';
984 CREATE TABLE IF NOT EXISTS `process` (
985 `pid` int unsigned NOT NULL COMMENT '',
986 `command` varbinary(32) NOT NULL DEFAULT '' COMMENT '',
987 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
989 INDEX `command` (`command`)
990 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently running system processes';
995 CREATE TABLE IF NOT EXISTS `profile` (
996 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
997 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
998 `profile-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name of the profile',
999 `is-default` boolean NOT NULL DEFAULT '0' COMMENT 'Mark this profile as default profile',
1000 `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT 'Hide friend list from viewers of this profile',
1001 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1002 `pdesc` varchar(255) NOT NULL DEFAULT '' COMMENT 'Title or description',
1003 `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT 'Day of birth',
1004 `address` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1005 `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1006 `region` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1007 `postal-code` varchar(32) NOT NULL DEFAULT '' COMMENT '',
1008 `country-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1009 `hometown` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1010 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
1011 `marital` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1012 `with` text COMMENT '',
1013 `howlong` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1014 `sexual` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1015 `politic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1016 `religion` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1017 `pub_keywords` text COMMENT '',
1018 `prv_keywords` text COMMENT '',
1019 `likes` text COMMENT '',
1020 `dislikes` text COMMENT '',
1021 `about` text COMMENT '',
1022 `summary` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1023 `music` text COMMENT '',
1024 `book` text COMMENT '',
1025 `tv` text COMMENT '',
1026 `film` text COMMENT '',
1027 `interest` text COMMENT '',
1028 `romance` text COMMENT '',
1029 `work` text COMMENT '',
1030 `education` text COMMENT '',
1031 `contact` text COMMENT '',
1032 `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1033 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1034 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1035 `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1036 `publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
1037 `net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
1039 INDEX `uid_is-default` (`uid`,`is-default`),
1040 FULLTEXT INDEX `pub_keywords` (`pub_keywords`)
1041 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
1044 -- TABLE profile_check
1046 CREATE TABLE IF NOT EXISTS `profile_check` (
1047 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1048 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1049 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
1050 `dfrn_id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1051 `sec` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1052 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1054 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='DFRN remote auth use';
1057 -- TABLE push_subscriber
1059 CREATE TABLE IF NOT EXISTS `push_subscriber` (
1060 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1061 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1062 `callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1063 `topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1064 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1065 `push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1066 `last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
1067 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1068 `renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
1069 `secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1071 INDEX `next_try` (`next_try`)
1072 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Used for OStatus: Contains feed subscribers';
1077 CREATE TABLE IF NOT EXISTS `register` (
1078 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1079 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1080 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1081 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1082 `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1083 `language` varchar(16) NOT NULL DEFAULT '' COMMENT '',
1084 `note` text COMMENT '',
1086 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
1091 CREATE TABLE IF NOT EXISTS `search` (
1092 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1093 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1094 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1097 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
1102 CREATE TABLE IF NOT EXISTS `session` (
1103 `id` bigint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1104 `sid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
1105 `data` text COMMENT '',
1106 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1108 INDEX `sid` (`sid`(64)),
1109 INDEX `expire` (`expire`)
1110 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='web session storage';
1115 CREATE TABLE IF NOT EXISTS `sign` (
1116 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1117 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
1118 `signed_text` mediumtext COMMENT '',
1119 `signature` text COMMENT '',
1120 `signer` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1122 UNIQUE INDEX `iid` (`iid`)
1123 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora signatures';
1128 CREATE TABLE IF NOT EXISTS `term` (
1129 `tid` int unsigned NOT NULL auto_increment COMMENT '',
1130 `oid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1131 `otype` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1132 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1133 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1134 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1135 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1136 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1137 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1138 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
1139 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1141 INDEX `term_type` (`term`(64),`type`),
1142 INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`(32)),
1143 INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
1144 INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
1145 INDEX `guid` (`guid`(64))
1146 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='item taxonomy (categories, tags, etc.) table';
1151 CREATE TABLE IF NOT EXISTS `thread` (
1152 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'sequential ID',
1153 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1154 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1155 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
1156 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item author',
1157 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1158 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1159 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1160 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1161 `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1162 `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
1163 `private` boolean NOT NULL DEFAULT '0' COMMENT '',
1164 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
1165 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
1166 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
1167 `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
1168 `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
1169 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
1170 `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
1171 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
1172 `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
1173 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1174 `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
1175 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
1176 `bookmark` boolean COMMENT '',
1178 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
1179 INDEX `uid_network_received` (`uid`,`network`,`received`),
1180 INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
1181 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
1182 INDEX `contactid` (`contact-id`),
1183 INDEX `ownerid` (`owner-id`),
1184 INDEX `authorid` (`author-id`),
1185 INDEX `uid_received` (`uid`,`received`),
1186 INDEX `uid_commented` (`uid`,`commented`),
1187 INDEX `uid_wall_received` (`uid`,`wall`,`received`),
1188 INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`)
1189 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Thread related data';
1194 CREATE TABLE IF NOT EXISTS `tokens` (
1195 `id` varchar(40) NOT NULL COMMENT '',
1196 `secret` text COMMENT '',
1197 `client_id` varchar(20) NOT NULL DEFAULT '',
1198 `expires` int NOT NULL DEFAULT 0 COMMENT '',
1199 `scope` varchar(200) NOT NULL DEFAULT '' COMMENT '',
1200 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1202 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
1207 CREATE TABLE IF NOT EXISTS `user` (
1208 `uid` mediumint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1209 `parent-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'The parent user that has full control about this user',
1210 `guid` varchar(64) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this user',
1211 `username` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this user is known by',
1212 `password` varchar(255) NOT NULL DEFAULT '' COMMENT 'encrypted password',
1213 `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?',
1214 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT 'nick- and user name',
1215 `email` varchar(255) NOT NULL DEFAULT '' COMMENT 'the users email address',
1216 `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1217 `timezone` varchar(128) NOT NULL DEFAULT '' COMMENT 'PHP-legal timezone',
1218 `language` varchar(32) NOT NULL DEFAULT 'en' COMMENT 'default language',
1219 `register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of registration',
1220 `login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last login',
1221 `default-location` varchar(255) NOT NULL DEFAULT '' COMMENT 'Default for item.location',
1222 `allow_location` boolean NOT NULL DEFAULT '0' COMMENT '1 allows to display the location',
1223 `theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
1224 `pubkey` text COMMENT 'RSA public key 4096 bit',
1225 `prvkey` text COMMENT 'RSA private key 4096 bit',
1226 `spubkey` text COMMENT '',
1227 `sprvkey` text COMMENT '',
1228 `verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
1229 `blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
1230 `blockwall` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to post to the profile page of the user',
1231 `hidewall` boolean NOT NULL DEFAULT '0' COMMENT 'Hide profile details from unkown viewers',
1232 `blocktags` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to tag the post of this user',
1233 `unkmail` boolean NOT NULL DEFAULT '0' COMMENT 'Permit unknown people to send private mails to this user',
1234 `cntunkmail` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1235 `notify-flags` smallint unsigned NOT NULL DEFAULT 65535 COMMENT 'email notification options',
1236 `page-flags` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'page/profile type',
1237 `account-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1238 `prvnets` boolean NOT NULL DEFAULT '0' COMMENT '',
1239 `pwdreset` varchar(255) COMMENT 'Password reset request token',
1240 `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
1241 `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1242 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1243 `account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed',
1244 `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
1245 `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted',
1246 `expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last warning of account expiration',
1247 `def_gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1248 `allow_cid` mediumtext COMMENT 'default permission for this user',
1249 `allow_gid` mediumtext COMMENT 'default permission for this user',
1250 `deny_cid` mediumtext COMMENT 'default permission for this user',
1251 `deny_gid` mediumtext COMMENT 'default permission for this user',
1252 `openidserver` text COMMENT '',
1254 INDEX `nickname` (`nickname`(32))
1255 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='The local users';
1260 CREATE TABLE IF NOT EXISTS `userd` (
1261 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1262 `username` varchar(255) NOT NULL COMMENT '',
1264 INDEX `username` (`username`(32))
1265 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Deleted usernames';
1268 -- TABLE user-contact
1270 CREATE TABLE IF NOT EXISTS `user-contact` (
1271 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the linked public contact',
1272 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1273 `blocked` boolean COMMENT 'Contact is completely blocked for this user',
1274 `ignored` boolean COMMENT 'Posts from this contact are ignored',
1275 `collapsed` boolean COMMENT 'Posts from this contact are collapsed',
1276 PRIMARY KEY(`uid`,`cid`)
1277 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific public contact data';
1282 CREATE TABLE IF NOT EXISTS `user-item` (
1283 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item id',
1284 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1285 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Marker to hide an item from the user',
1286 `ignored` boolean COMMENT 'Ignore this thread if set',
1287 `pinned` boolean COMMENT 'The item is pinned on the profile page',
1288 PRIMARY KEY(`uid`,`iid`),
1289 INDEX `uid_pinned` (`uid`,`pinned`)
1290 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
1295 CREATE TABLE IF NOT EXISTS `worker-ipc` (
1296 `key` int NOT NULL COMMENT '',
1297 `jobs` boolean COMMENT 'Flag for outstanding jobs',
1299 ) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Inter process communication between the frontend and the worker';
1302 -- TABLE workerqueue
1304 CREATE TABLE IF NOT EXISTS `workerqueue` (
1305 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id',
1306 `parameter` mediumtext COMMENT 'Task command',
1307 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority',
1308 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
1309 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
1310 `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
1311 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1312 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1313 `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
1315 INDEX `done_parameter` (`done`,`parameter`(64)),
1316 INDEX `done_executed` (`done`,`executed`),
1317 INDEX `done_priority_created` (`done`,`priority`,`created`),
1318 INDEX `done_priority_next_try` (`done`,`priority`,`next_try`),
1319 INDEX `done_pid_next_try` (`done`,`pid`,`next_try`),
1320 INDEX `done_pid_priority_created` (`done`,`pid`,`priority`,`created`)
1321 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
1326 CREATE TABLE IF NOT EXISTS `storage` (
1327 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented image data id',
1328 `data` longblob NOT NULL COMMENT 'file data',
1330 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Data stored by Database storage backend';