1 -- ------------------------------------------
2 -- Friendica 2020.06-dev (Red Hot Poker)
3 -- DB_UPDATE_VERSION 1348
4 -- ------------------------------------------
10 CREATE TABLE IF NOT EXISTS `clients` (
11 `client_id` varchar(20) NOT NULL COMMENT '',
12 `pw` varchar(20) NOT NULL DEFAULT '' COMMENT '',
13 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
14 `name` text COMMENT '',
15 `icon` text COMMENT '',
16 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
17 PRIMARY KEY(`client_id`)
18 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
23 CREATE TABLE IF NOT EXISTS `contact` (
24 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
25 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
26 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
27 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last contact update',
28 `self` boolean NOT NULL DEFAULT '0' COMMENT '1 if the contact is the user him/her self',
29 `remote_self` boolean NOT NULL DEFAULT '0' COMMENT '',
30 `rel` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'The kind of the relation between the user and the contact',
31 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
32 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network of the contact',
33 `protocol` char(4) NOT NULL DEFAULT '' COMMENT 'Protocol of the contact',
34 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
35 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
36 `location` varchar(255) DEFAULT '' COMMENT '',
37 `about` text COMMENT '',
38 `keywords` text COMMENT 'public keywords (interests) of the contact',
39 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT 'Deprecated',
40 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
41 `attag` varchar(255) NOT NULL DEFAULT '' COMMENT '',
42 `avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
43 `photo` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo of the contact',
44 `thumb` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (thumb size)',
45 `micro` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (micro size)',
46 `site-pubkey` text COMMENT '',
47 `issued-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
48 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
49 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
50 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
51 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
52 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
53 `pubkey` text COMMENT 'RSA public key 4096 bit',
54 `prvkey` text COMMENT 'RSA private key 4096 bit',
55 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
56 `request` varchar(255) COMMENT '',
57 `notify` varchar(255) COMMENT '',
58 `poll` varchar(255) COMMENT '',
59 `confirm` varchar(255) COMMENT '',
60 `poco` varchar(255) COMMENT '',
61 `aes_allow` boolean NOT NULL DEFAULT '0' COMMENT '',
62 `ret-aes` boolean NOT NULL DEFAULT '0' COMMENT '',
63 `usehub` boolean NOT NULL DEFAULT '0' COMMENT '',
64 `subhub` boolean NOT NULL DEFAULT '0' COMMENT '',
65 `hub-verify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
66 `last-update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last try to update the contact info',
67 `success_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful contact update',
68 `failure_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed update',
69 `name-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
70 `uri-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
71 `avatar-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
72 `term-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
73 `last-item` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'date of the last post',
74 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
75 `blocked` boolean NOT NULL DEFAULT '1' COMMENT 'Node-wide block status',
76 `block_reason` text COMMENT 'Node-wide block reason',
77 `readonly` boolean NOT NULL DEFAULT '0' COMMENT 'posts of the contact are readonly',
78 `writable` boolean NOT NULL DEFAULT '0' COMMENT '',
79 `forum` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a forum',
80 `prv` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a private group',
81 `contact-type` tinyint NOT NULL DEFAULT 0 COMMENT '',
82 `hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
83 `archive` boolean NOT NULL DEFAULT '0' COMMENT '',
84 `pending` boolean NOT NULL DEFAULT '1' COMMENT '',
85 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'Contact has been deleted',
86 `rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
87 `unsearchable` boolean NOT NULL DEFAULT '0' COMMENT 'Contact prefers to not be searchable',
88 `sensitive` boolean NOT NULL DEFAULT '0' COMMENT 'Contact posts sensitive content',
89 `baseurl` varchar(255) DEFAULT '' COMMENT 'baseurl of the contact',
90 `reason` text COMMENT '',
91 `closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
92 `info` mediumtext COMMENT '',
93 `profile-id` int unsigned COMMENT 'Deprecated',
94 `bdyear` varchar(4) NOT NULL DEFAULT '' COMMENT '',
95 `bd` date NOT NULL DEFAULT '0001-01-01' COMMENT '',
96 `notify_new_posts` boolean NOT NULL DEFAULT '0' COMMENT '',
97 `fetch_further_information` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
98 `ffi_keyword_blacklist` text COMMENT '',
100 INDEX `uid_name` (`uid`,`name`(190)),
101 INDEX `self_uid` (`self`,`uid`),
102 INDEX `alias_uid` (`alias`(32),`uid`),
103 INDEX `pending_uid` (`pending`,`uid`),
104 INDEX `blocked_uid` (`blocked`,`uid`),
105 INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
106 INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
107 INDEX `addr_uid` (`addr`(32),`uid`),
108 INDEX `nurl_uid` (`nurl`(32),`uid`),
109 INDEX `nick_uid` (`nick`(32),`uid`),
110 INDEX `dfrn-id` (`dfrn-id`(64)),
111 INDEX `issued-id` (`issued-id`(64))
112 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contact table';
117 CREATE TABLE IF NOT EXISTS `item-uri` (
118 `id` int unsigned NOT NULL auto_increment,
119 `uri` varbinary(255) NOT NULL COMMENT 'URI of an item',
120 `guid` varbinary(255) COMMENT 'A unique identifier for an item',
122 UNIQUE INDEX `uri` (`uri`),
123 INDEX `guid` (`guid`)
124 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='URI and GUID for items';
127 -- TABLE permissionset
129 CREATE TABLE IF NOT EXISTS `permissionset` (
130 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
131 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id of this permission set',
132 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
133 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
134 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
135 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
137 INDEX `uid_allow_cid_allow_gid_deny_cid_deny_gid` (`allow_cid`(50),`allow_gid`(30),`deny_cid`(50),`deny_gid`(30))
138 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
143 CREATE TABLE IF NOT EXISTS `tag` (
144 `id` int unsigned NOT NULL auto_increment COMMENT '',
145 `name` varchar(96) NOT NULL DEFAULT '' COMMENT '',
146 `url` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
148 UNIQUE INDEX `type_name_url` (`name`,`url`),
150 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='tags and mentions';
153 -- TABLE 2fa_app_specific_password
155 CREATE TABLE IF NOT EXISTS `2fa_app_specific_password` (
156 `id` mediumint unsigned NOT NULL auto_increment COMMENT 'Password ID for revocation',
157 `uid` mediumint unsigned NOT NULL COMMENT 'User ID',
158 `description` varchar(255) COMMENT 'Description of the usage of the password',
159 `hashed_password` varchar(255) NOT NULL COMMENT 'Hashed password',
160 `generated` datetime NOT NULL COMMENT 'Datetime the password was generated',
161 `last_used` datetime COMMENT 'Datetime the password was last used',
163 INDEX `uid_description` (`uid`,`description`(190))
164 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor app-specific _password';
167 -- TABLE 2fa_recovery_codes
169 CREATE TABLE IF NOT EXISTS `2fa_recovery_codes` (
170 `uid` mediumint unsigned NOT NULL COMMENT 'User ID',
171 `code` varchar(50) NOT NULL COMMENT 'Recovery code string',
172 `generated` datetime NOT NULL COMMENT 'Datetime the code was generated',
173 `used` datetime COMMENT 'Datetime the code was used',
174 PRIMARY KEY(`uid`,`code`)
175 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor authentication recovery codes';
180 CREATE TABLE IF NOT EXISTS `addon` (
181 `id` int unsigned NOT NULL auto_increment COMMENT '',
182 `name` varchar(50) NOT NULL DEFAULT '' COMMENT 'addon base (file)name',
183 `version` varchar(50) NOT NULL DEFAULT '' COMMENT 'currently unused',
184 `installed` boolean NOT NULL DEFAULT '0' COMMENT 'currently always 1',
185 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'currently unused',
186 `timestamp` int unsigned NOT NULL DEFAULT 0 COMMENT 'file timestamp to check for reloads',
187 `plugin_admin` boolean NOT NULL DEFAULT '0' COMMENT '1 = has admin config, 0 = has no admin config',
189 UNIQUE INDEX `name` (`name`)
190 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registered addons';
195 CREATE TABLE IF NOT EXISTS `apcontact` (
196 `url` varbinary(255) NOT NULL COMMENT 'URL of the contact',
197 `uuid` varchar(255) COMMENT '',
198 `type` varchar(20) NOT NULL COMMENT '',
199 `following` varchar(255) COMMENT '',
200 `followers` varchar(255) COMMENT '',
201 `inbox` varchar(255) NOT NULL COMMENT '',
202 `outbox` varchar(255) COMMENT '',
203 `sharedinbox` varchar(255) COMMENT '',
204 `manually-approve` boolean COMMENT '',
205 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
206 `name` varchar(255) COMMENT '',
207 `about` text COMMENT '',
208 `photo` varchar(255) COMMENT '',
209 `addr` varchar(255) COMMENT '',
210 `alias` varchar(255) COMMENT '',
211 `pubkey` text COMMENT '',
212 `baseurl` varchar(255) COMMENT 'baseurl of the ap contact',
213 `generator` varchar(255) COMMENT 'Name of the contact\'s system',
214 `following_count` int unsigned DEFAULT 0 COMMENT 'Number of following contacts',
215 `followers_count` int unsigned DEFAULT 0 COMMENT 'Number of followers',
216 `statuses_count` int unsigned DEFAULT 0 COMMENT 'Number of posts',
217 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
219 INDEX `addr` (`addr`(32)),
220 INDEX `alias` (`alias`(190)),
221 INDEX `url` (`followers`(190))
222 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='ActivityPub compatible contacts - used in the ActivityPub implementation';
227 CREATE TABLE IF NOT EXISTS `attach` (
228 `id` int unsigned NOT NULL auto_increment COMMENT 'generated index',
229 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
230 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT 'hash',
231 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT 'filename of original',
232 `filetype` varchar(64) NOT NULL DEFAULT '' COMMENT 'mimetype',
233 `filesize` int unsigned NOT NULL DEFAULT 0 COMMENT 'size in bytes',
234 `data` longblob NOT NULL COMMENT 'file data',
235 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
236 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
237 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>',
238 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
239 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
240 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
241 `backend-class` tinytext COMMENT 'Storage backend class',
242 `backend-ref` text COMMENT 'Storage backend data reference',
244 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='file attachments';
249 CREATE TABLE IF NOT EXISTS `auth_codes` (
250 `id` varchar(40) NOT NULL COMMENT '',
251 `client_id` varchar(20) NOT NULL DEFAULT '' COMMENT '',
252 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
253 `expires` int NOT NULL DEFAULT 0 COMMENT '',
254 `scope` varchar(250) NOT NULL DEFAULT '' COMMENT '',
256 INDEX `client_id` (`client_id`),
257 FOREIGN KEY (`client_id`) REFERENCES `clients` (`client_id`) ON UPDATE RESTRICT ON DELETE CASCADE
258 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
263 CREATE TABLE IF NOT EXISTS `cache` (
264 `k` varbinary(255) NOT NULL COMMENT 'cache key',
265 `v` mediumtext COMMENT 'cached serialized value',
266 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
267 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache insertion',
269 INDEX `k_expires` (`k`,`expires`)
270 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Stores temporary data';
275 CREATE TABLE IF NOT EXISTS `challenge` (
276 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
277 `challenge` varchar(255) NOT NULL DEFAULT '' COMMENT '',
278 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
279 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
280 `type` varchar(255) NOT NULL DEFAULT '' COMMENT '',
281 `last_update` varchar(255) NOT NULL DEFAULT '' COMMENT '',
283 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
288 CREATE TABLE IF NOT EXISTS `config` (
289 `id` int unsigned NOT NULL auto_increment COMMENT '',
290 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
291 `k` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
292 `v` mediumtext COMMENT '',
294 UNIQUE INDEX `cat_k` (`cat`,`k`)
295 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='main configuration storage';
298 -- TABLE contact-relation
300 CREATE TABLE IF NOT EXISTS `contact-relation` (
301 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact the related contact had interacted with',
302 `relation-cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'related contact who had interacted with the contact',
303 `last-interaction` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last interaction',
304 PRIMARY KEY(`cid`,`relation-cid`),
305 INDEX `relation-cid` (`relation-cid`)
306 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Contact relations';
311 CREATE TABLE IF NOT EXISTS `conv` (
312 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
313 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this conversation',
314 `recips` text COMMENT 'sender_handle;recipient_handle',
315 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
316 `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'handle of creator',
317 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation timestamp',
318 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'edited timestamp',
319 `subject` text COMMENT 'subject of initial message',
322 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
325 -- TABLE conversation
327 CREATE TABLE IF NOT EXISTS `conversation` (
328 `item-uri` varbinary(255) NOT NULL COMMENT 'Original URI of the item - unrelated to the table with the same name',
329 `reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'URI to which this item is a reply',
330 `conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
331 `conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
332 `protocol` tinyint unsigned NOT NULL DEFAULT 255 COMMENT 'The protocol of the item',
333 `direction` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'How the message arrived here: 1=push, 2=pull',
334 `source` mediumtext COMMENT 'Original source',
335 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
336 PRIMARY KEY(`item-uri`),
337 INDEX `conversation-uri` (`conversation-uri`),
338 INDEX `received` (`received`)
339 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
342 -- TABLE diaspora-interaction
344 CREATE TABLE IF NOT EXISTS `diaspora-interaction` (
345 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
346 `interaction` mediumtext COMMENT 'The Diaspora interaction',
347 PRIMARY KEY(`uri-id`),
348 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
349 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Signed Diaspora Interaction';
354 CREATE TABLE IF NOT EXISTS `event` (
355 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
356 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
357 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
358 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact_id (ID of the contact in contact table)',
359 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
360 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
361 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
362 `start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event start time',
363 `finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event end time',
364 `summary` text COMMENT 'short description or title of the event',
365 `desc` text COMMENT 'event description',
366 `location` text COMMENT 'event location',
367 `type` varchar(20) NOT NULL DEFAULT '' COMMENT 'event or birthday',
368 `nofinish` boolean NOT NULL DEFAULT '0' COMMENT 'if event does have no end this is 1',
369 `adjust` boolean NOT NULL DEFAULT '1' COMMENT 'adjust to timezone of the recipient (0 or 1)',
370 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '0 or 1',
371 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
372 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
373 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
374 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
376 INDEX `uid_start` (`uid`,`start`)
377 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Events';
382 CREATE TABLE IF NOT EXISTS `fcontact` (
383 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
384 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'unique id',
385 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
386 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
387 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
388 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
389 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
390 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
391 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
392 `notify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
393 `poll` varchar(255) NOT NULL DEFAULT '' COMMENT '',
394 `confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '',
395 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
396 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
397 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
398 `pubkey` text COMMENT '',
399 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
401 INDEX `addr` (`addr`(32)),
402 UNIQUE INDEX `url` (`url`(190))
403 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora compatible contacts - used in the Diaspora implementation';
408 CREATE TABLE IF NOT EXISTS `fsuggest` (
409 `id` int unsigned NOT NULL auto_increment COMMENT '',
410 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
411 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
412 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
413 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
414 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
415 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
416 `note` text COMMENT '',
417 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
419 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='friend suggestion stuff';
424 CREATE TABLE IF NOT EXISTS `gcign` (
425 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
426 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Local User id',
427 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'gcontact.id of ignored contact',
430 INDEX `gcid` (`gcid`)
431 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contacts ignored by friend suggestions';
436 CREATE TABLE IF NOT EXISTS `gcontact` (
437 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
438 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
439 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
440 `url` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the contacts profile page',
441 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
442 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the profile photo',
443 `connect` varchar(255) NOT NULL DEFAULT '' COMMENT '',
444 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
445 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
446 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
447 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
448 `last_discovery` datetime DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last contact discovery',
449 `archive_date` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
450 `archived` boolean NOT NULL DEFAULT '0' COMMENT '',
451 `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
452 `about` text COMMENT '',
453 `keywords` text COMMENT 'puplic keywords (interests)',
454 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT 'Deprecated',
455 `birthday` varchar(32) NOT NULL DEFAULT '0001-01-01' COMMENT '',
456 `community` boolean NOT NULL DEFAULT '0' COMMENT '1 if contact is forum account',
457 `contact-type` tinyint NOT NULL DEFAULT -1 COMMENT '',
458 `hide` boolean NOT NULL DEFAULT '0' COMMENT '1 = should be hidden from search',
459 `nsfw` boolean NOT NULL DEFAULT '0' COMMENT '1 = contact posts nsfw content',
460 `network` char(4) NOT NULL DEFAULT '' COMMENT 'social network protocol',
461 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
462 `notify` varchar(255) COMMENT '',
463 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
464 `generation` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
465 `server_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'baseurl of the contacts server',
467 UNIQUE INDEX `nurl` (`nurl`(190)),
468 INDEX `name` (`name`(64)),
469 INDEX `nick` (`nick`(32)),
470 INDEX `addr` (`addr`(64)),
471 INDEX `hide_network_updated` (`hide`,`network`,`updated`),
472 INDEX `updated` (`updated`)
473 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='global contacts';
478 CREATE TABLE IF NOT EXISTS `gfollower` (
479 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'global contact',
480 `follower-gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'global contact of the follower',
481 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates that the connection has been deleted',
482 PRIMARY KEY(`gcid`,`follower-gcid`),
483 INDEX `follower-gcid` (`follower-gcid`)
484 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Followers of global contacts';
489 CREATE TABLE IF NOT EXISTS `glink` (
490 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
491 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
492 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
493 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
494 `zcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
495 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
497 UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
498 INDEX `gcid` (`gcid`)
499 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='\'friends of friends\' linkages derived from poco';
504 CREATE TABLE IF NOT EXISTS `group` (
505 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
506 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
507 `visible` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the member list is not private',
508 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the group has been deleted',
509 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'human readable name of group',
512 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, group info';
515 -- TABLE group_member
517 CREATE TABLE IF NOT EXISTS `group_member` (
518 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
519 `gid` int unsigned NOT NULL DEFAULT 0 COMMENT 'groups.id of the associated group',
520 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id of the member assigned to the associated group',
522 INDEX `contactid` (`contact-id`),
523 UNIQUE INDEX `gid_contactid` (`gid`,`contact-id`)
524 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, member info';
529 CREATE TABLE IF NOT EXISTS `gserver` (
530 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
531 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
532 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
533 `version` varchar(255) NOT NULL DEFAULT '' COMMENT '',
534 `site_name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
535 `info` text COMMENT '',
536 `register_policy` tinyint NOT NULL DEFAULT 0 COMMENT '',
537 `registered-users` int unsigned NOT NULL DEFAULT 0 COMMENT 'Number of registered users',
538 `directory-type` tinyint DEFAULT 0 COMMENT 'Type of directory service (Poco, Mastodon)',
539 `poco` varchar(255) NOT NULL DEFAULT '' COMMENT '',
540 `noscrape` varchar(255) NOT NULL DEFAULT '' COMMENT '',
541 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
542 `platform` varchar(255) NOT NULL DEFAULT '' COMMENT '',
543 `relay-subscribe` boolean NOT NULL DEFAULT '0' COMMENT 'Has the server subscribed to the relay system',
544 `relay-scope` varchar(10) NOT NULL DEFAULT '' COMMENT 'The scope of messages that the server wants to get',
545 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
546 `last_poco_query` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
547 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
548 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
550 UNIQUE INDEX `nurl` (`nurl`(190))
551 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Global servers';
556 CREATE TABLE IF NOT EXISTS `gserver-tag` (
557 `gserver-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'The id of the gserver',
558 `tag` varchar(100) NOT NULL DEFAULT '' COMMENT 'Tag that the server has subscribed',
559 PRIMARY KEY(`gserver-id`,`tag`),
561 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Tags that the server has subscribed';
566 CREATE TABLE IF NOT EXISTS `hook` (
567 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
568 `hook` varbinary(100) NOT NULL DEFAULT '' COMMENT 'name of hook',
569 `file` varbinary(200) NOT NULL DEFAULT '' COMMENT 'relative filename of hook handler',
570 `function` varbinary(200) NOT NULL DEFAULT '' COMMENT 'function name of hook handler',
571 `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',
573 UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
574 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='addon hook registry';
577 -- TABLE inbox-status
579 CREATE TABLE IF NOT EXISTS `inbox-status` (
580 `url` varbinary(255) NOT NULL COMMENT 'URL of the inbox',
581 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date of this entry',
582 `success` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful delivery',
583 `failure` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed delivery',
584 `previous` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Previous delivery date',
585 `archive` boolean NOT NULL DEFAULT '0' COMMENT 'Is the inbox archived?',
586 `shared` boolean NOT NULL DEFAULT '0' COMMENT 'Is it a shared inbox?',
588 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Status of ActivityPub inboxes';
593 CREATE TABLE IF NOT EXISTS `intro` (
594 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
595 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
596 `fid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
597 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
598 `knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
599 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
600 `note` text COMMENT '',
601 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
602 `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
603 `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
604 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
606 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
611 CREATE TABLE IF NOT EXISTS `item` (
612 `id` int unsigned NOT NULL auto_increment,
613 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this item',
614 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
615 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
616 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
617 `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',
618 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT 'uri of the parent to this item',
619 `parent-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the parent uri',
620 `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',
621 `thr-parent-id` int unsigned COMMENT 'Id of the item-uri table that contains the thread parent uri',
622 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation timestamp.',
623 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last edit (default is created)',
624 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last comment/reply to this item',
625 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime',
626 `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',
627 `gravity` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
628 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network from where the item comes from',
629 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
630 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
631 `icid` int unsigned COMMENT 'Id of the item-content table entry that contains the whole item content',
632 `iaid` int unsigned COMMENT 'Id of the item-activity table entry that contains the activity data',
633 `vid` smallint unsigned COMMENT 'Id of the verb table entry that contains the activity verbs',
634 `extid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
635 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
636 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
637 `private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
638 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
639 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
640 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'item has been deleted',
641 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id which owns this copy of the item',
642 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
643 `wall` boolean NOT NULL DEFAULT '0' COMMENT 'This item was posted to the wall of uid',
644 `origin` boolean NOT NULL DEFAULT '0' COMMENT 'item originated at this site',
645 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
646 `starred` boolean NOT NULL DEFAULT '0' COMMENT 'item has been favourited',
647 `unseen` boolean NOT NULL DEFAULT '1' COMMENT 'item has not been seen',
648 `mention` boolean NOT NULL DEFAULT '0' COMMENT 'The owner of this item was mentioned in it',
649 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
650 `psid` int unsigned COMMENT 'ID of the permission set of this post',
651 `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',
652 `event-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Used to link to the event.id',
653 `attach` mediumtext COMMENT 'JSON structure representing attachments to this item',
654 `allow_cid` mediumtext COMMENT 'Deprecated',
655 `allow_gid` mediumtext COMMENT 'Deprecated',
656 `deny_cid` mediumtext COMMENT 'Deprecated',
657 `deny_gid` mediumtext COMMENT 'Deprecated',
658 `postopts` text COMMENT 'Deprecated',
659 `inform` mediumtext COMMENT 'Deprecated',
660 `type` varchar(20) COMMENT 'Deprecated',
661 `bookmark` boolean COMMENT 'Deprecated',
662 `file` mediumtext COMMENT 'Deprecated',
663 `location` varchar(255) COMMENT 'Deprecated',
664 `coord` varchar(255) COMMENT 'Deprecated',
665 `tag` mediumtext COMMENT 'Deprecated',
666 `plink` varchar(255) COMMENT 'Deprecated',
667 `title` varchar(255) COMMENT 'Deprecated',
668 `content-warning` varchar(255) COMMENT 'Deprecated',
669 `body` mediumtext COMMENT 'Deprecated',
670 `app` varchar(255) COMMENT 'Deprecated',
671 `verb` varchar(100) COMMENT 'Deprecated',
672 `object-type` varchar(100) COMMENT 'Deprecated',
673 `object` text COMMENT 'Deprecated',
674 `target-type` varchar(100) COMMENT 'Deprecated',
675 `target` text COMMENT 'Deprecated',
676 `author-name` varchar(255) COMMENT 'Deprecated',
677 `author-link` varchar(255) COMMENT 'Deprecated',
678 `author-avatar` varchar(255) COMMENT 'Deprecated',
679 `owner-name` varchar(255) COMMENT 'Deprecated',
680 `owner-link` varchar(255) COMMENT 'Deprecated',
681 `owner-avatar` varchar(255) COMMENT 'Deprecated',
682 `rendered-hash` varchar(32) COMMENT 'Deprecated',
683 `rendered-html` mediumtext COMMENT 'Deprecated',
685 INDEX `guid` (`guid`(191)),
686 INDEX `uri` (`uri`(191)),
687 INDEX `parent` (`parent`),
688 INDEX `parent-uri` (`parent-uri`(191)),
689 INDEX `extid` (`extid`(191)),
690 INDEX `uid_id` (`uid`,`id`),
691 INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
692 INDEX `uid_received` (`uid`,`received`),
693 INDEX `uid_commented` (`uid`,`commented`),
694 INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
695 INDEX `uid_network_received` (`uid`,`network`,`received`),
696 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
697 INDEX `uid_thrparent` (`uid`,`thr-parent`(190)),
698 INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
699 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
700 INDEX `authorid_received` (`author-id`,`received`),
701 INDEX `ownerid` (`owner-id`),
702 INDEX `contact-id` (`contact-id`),
703 INDEX `uid_uri` (`uid`,`uri`(190)),
704 INDEX `resource-id` (`resource-id`),
705 INDEX `deleted_changed` (`deleted`,`changed`),
706 INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
707 INDEX `mention_uid_id` (`mention`,`uid`,`id`),
708 INDEX `uid_eventid` (`uid`,`event-id`),
709 INDEX `icid` (`icid`),
710 INDEX `iaid` (`iaid`),
711 INDEX `psid_wall` (`psid`,`wall`),
712 INDEX `uri-id` (`uri-id`),
713 INDEX `parent-uri-id` (`parent-uri-id`),
714 INDEX `thr-parent-id` (`thr-parent-id`),
715 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
716 FOREIGN KEY (`parent-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
717 FOREIGN KEY (`thr-parent-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
718 FOREIGN KEY (`psid`) REFERENCES `permissionset` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
719 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
722 -- TABLE item-activity
724 CREATE TABLE IF NOT EXISTS `item-activity` (
725 `id` int unsigned NOT NULL auto_increment,
726 `uri` varchar(255) COMMENT '',
727 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
728 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
729 `activity` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
731 UNIQUE INDEX `uri-hash` (`uri-hash`),
732 INDEX `uri` (`uri`(191)),
733 INDEX `uri-id` (`uri-id`),
734 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
735 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activities for items';
738 -- TABLE item-content
740 CREATE TABLE IF NOT EXISTS `item-content` (
741 `id` int unsigned NOT NULL auto_increment,
742 `uri` varchar(255) COMMENT '',
743 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
744 `uri-plink-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
745 `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'item title',
746 `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
747 `body` mediumtext COMMENT 'item body content',
748 `location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
749 `coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
750 `language` text COMMENT 'Language information about this post',
751 `app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
752 `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
753 `rendered-html` mediumtext COMMENT 'item.body converted to html',
754 `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams object type',
755 `object` text COMMENT 'JSON encoded object structure unless it is an implied object (normal post)',
756 `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
757 `target` text COMMENT 'JSON encoded target structure if used',
758 `plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
759 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams verb',
761 UNIQUE INDEX `uri-plink-hash` (`uri-plink-hash`),
762 INDEX `uri` (`uri`(191)),
763 INDEX `plink` (`plink`(191)),
764 INDEX `uri-id` (`uri-id`),
765 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
766 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
771 CREATE TABLE IF NOT EXISTS `locks` (
772 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
773 `name` varchar(128) NOT NULL DEFAULT '' COMMENT '',
774 `locked` boolean NOT NULL DEFAULT '0' COMMENT '',
775 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process ID',
776 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
778 INDEX `name_expires` (`name`,`expires`)
779 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
784 CREATE TABLE IF NOT EXISTS `mail` (
785 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
786 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
787 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
788 `from-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the sender',
789 `from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
790 `from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
791 `contact-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact.id',
792 `convid` int unsigned NOT NULL DEFAULT 0 COMMENT 'conv.id',
793 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
794 `body` mediumtext COMMENT '',
795 `seen` boolean NOT NULL DEFAULT '0' COMMENT 'if message visited it is 1',
796 `reply` boolean NOT NULL DEFAULT '0' COMMENT '',
797 `replied` boolean NOT NULL DEFAULT '0' COMMENT '',
798 `unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
799 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
800 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
801 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
803 INDEX `uid_seen` (`uid`,`seen`),
804 INDEX `convid` (`convid`),
805 INDEX `uri` (`uri`(64)),
806 INDEX `parent-uri` (`parent-uri`(64)),
807 INDEX `contactid` (`contact-id`(32))
808 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
813 CREATE TABLE IF NOT EXISTS `mailacct` (
814 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
815 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
816 `server` varchar(255) NOT NULL DEFAULT '' COMMENT '',
817 `port` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
818 `ssltype` varchar(16) NOT NULL DEFAULT '' COMMENT '',
819 `mailbox` varchar(255) NOT NULL DEFAULT '' COMMENT '',
820 `user` varchar(255) NOT NULL DEFAULT '' COMMENT '',
821 `pass` text COMMENT '',
822 `reply_to` varchar(255) NOT NULL DEFAULT '' COMMENT '',
823 `action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
824 `movetofolder` varchar(255) NOT NULL DEFAULT '' COMMENT '',
825 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
826 `last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
828 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Mail account data for fetching mails';
833 CREATE TABLE IF NOT EXISTS `manage` (
834 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
835 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
836 `mid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
838 UNIQUE INDEX `uid_mid` (`uid`,`mid`)
839 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='table of accounts that can manage each other';
844 CREATE TABLE IF NOT EXISTS `notify` (
845 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
846 `type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
847 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
848 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
849 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
850 `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
851 `msg` mediumtext COMMENT '',
852 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
853 `link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
854 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
855 `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
856 `uri-id` int unsigned COMMENT 'Item-uri id of the related post',
857 `parent-uri-id` int unsigned COMMENT 'Item-uri id of the parent of the related post',
858 `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
859 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
860 `otype` varchar(10) NOT NULL DEFAULT '' COMMENT '',
861 `name_cache` tinytext COMMENT 'Cached bbcode parsing of name',
862 `msg_cache` mediumtext COMMENT 'Cached bbcode parsing of msg',
864 INDEX `seen_uid_date` (`seen`,`uid`,`date`),
865 INDEX `uid_date` (`uid`,`date`),
866 INDEX `uid_type_link` (`uid`,`type`,`link`(190))
867 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='notifications';
870 -- TABLE notify-threads
872 CREATE TABLE IF NOT EXISTS `notify-threads` (
873 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
874 `notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
875 `master-parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
876 `master-parent-uri-id` int unsigned COMMENT 'Item-uri id of the parent of the related post',
877 `parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
878 `receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
880 INDEX `master-parent-uri-id` (`master-parent-uri-id`)
881 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
886 CREATE TABLE IF NOT EXISTS `oembed` (
887 `url` varbinary(255) NOT NULL COMMENT 'page url',
888 `maxwidth` mediumint unsigned NOT NULL COMMENT 'Maximum width passed to Oembed',
889 `content` mediumtext COMMENT 'OEmbed data of the page',
890 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
891 PRIMARY KEY(`url`,`maxwidth`),
892 INDEX `created` (`created`)
893 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for OEmbed queries';
896 -- TABLE openwebauth-token
898 CREATE TABLE IF NOT EXISTS `openwebauth-token` (
899 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
900 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
901 `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Verify type',
902 `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'A generated token',
903 `meta` varchar(255) NOT NULL DEFAULT '' COMMENT '',
904 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
906 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store OpenWebAuth token to verify contacts';
911 CREATE TABLE IF NOT EXISTS `parsed_url` (
912 `url` varbinary(255) NOT NULL COMMENT 'page url',
913 `guessing` boolean NOT NULL DEFAULT '0' COMMENT 'is the \'guessing\' mode active?',
914 `oembed` boolean NOT NULL DEFAULT '0' COMMENT 'is the data the result of oembed?',
915 `content` mediumtext COMMENT 'page data',
916 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
917 PRIMARY KEY(`url`,`guessing`,`oembed`),
918 INDEX `created` (`created`)
919 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for \'parse_url\' queries';
922 -- TABLE participation
924 CREATE TABLE IF NOT EXISTS `participation` (
925 `iid` int unsigned NOT NULL COMMENT '',
926 `server` varchar(60) NOT NULL COMMENT '',
927 `cid` int unsigned NOT NULL COMMENT '',
928 `fid` int unsigned NOT NULL COMMENT '',
929 PRIMARY KEY(`iid`,`server`),
932 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Storage for participation messages from Diaspora';
937 CREATE TABLE IF NOT EXISTS `pconfig` (
938 `id` int unsigned NOT NULL auto_increment COMMENT '',
939 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
940 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
941 `k` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
942 `v` mediumtext COMMENT '',
944 UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
945 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='personal (per user) configuration storage';
950 CREATE TABLE IF NOT EXISTS `photo` (
951 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
952 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
953 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
954 `guid` char(16) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this photo',
955 `resource-id` char(32) NOT NULL DEFAULT '' COMMENT '',
956 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation date',
957 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edited date',
958 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
959 `desc` text COMMENT '',
960 `album` varchar(255) NOT NULL DEFAULT '' COMMENT 'The name of the album to which the photo belongs',
961 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
962 `type` varchar(30) NOT NULL DEFAULT 'image/jpeg',
963 `height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
964 `width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
965 `datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
966 `data` mediumblob NOT NULL COMMENT '',
967 `scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
968 `profile` boolean NOT NULL DEFAULT '0' COMMENT '',
969 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
970 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
971 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
972 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
973 `accessible` boolean NOT NULL DEFAULT '0' COMMENT 'Make photo publicly accessible, ignoring permissions',
974 `backend-class` tinytext COMMENT 'Storage backend class',
975 `backend-ref` text COMMENT 'Storage backend data reference',
976 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
978 INDEX `contactid` (`contact-id`),
979 INDEX `uid_contactid` (`uid`,`contact-id`),
980 INDEX `uid_profile` (`uid`,`profile`),
981 INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
982 INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`,`created`),
983 INDEX `resource-id` (`resource-id`)
984 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='photo storage';
989 CREATE TABLE IF NOT EXISTS `poll` (
990 `id` int unsigned NOT NULL auto_increment COMMENT '',
991 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
992 `q0` text COMMENT '',
993 `q1` text COMMENT '',
994 `q2` text COMMENT '',
995 `q3` text COMMENT '',
996 `q4` text COMMENT '',
997 `q5` text COMMENT '',
998 `q6` text COMMENT '',
999 `q7` text COMMENT '',
1000 `q8` text COMMENT '',
1001 `q9` text COMMENT '',
1004 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently unused table for storing poll results';
1007 -- TABLE poll_result
1009 CREATE TABLE IF NOT EXISTS `poll_result` (
1010 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1011 `poll_id` int unsigned NOT NULL DEFAULT 0,
1012 `choice` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1014 INDEX `poll_id` (`poll_id`)
1015 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='data for polls - currently unused';
1018 -- TABLE post-category
1020 CREATE TABLE IF NOT EXISTS `post-category` (
1021 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
1022 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1023 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1024 `tid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1025 PRIMARY KEY(`uri-id`,`uid`,`type`,`tid`),
1026 INDEX `uri-id` (`tid`),
1027 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
1028 FOREIGN KEY (`tid`) REFERENCES `tag` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
1029 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='post relation to categories';
1032 -- TABLE post-delivery-data
1034 CREATE TABLE IF NOT EXISTS `post-delivery-data` (
1035 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
1036 `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',
1037 `inform` mediumtext COMMENT 'Additional receivers of the linked item',
1038 `queue_count` mediumint NOT NULL DEFAULT 0 COMMENT 'Initial number of delivery recipients, used as item.delivery_queue_count',
1039 `queue_done` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries, used as item.delivery_queue_done',
1040 `queue_failed` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of unsuccessful deliveries, used as item.delivery_queue_failed',
1041 `activitypub` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via ActivityPub',
1042 `dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via DFRN',
1043 `legacy_dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via legacy DFRN',
1044 `diaspora` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via Diaspora',
1045 `ostatus` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via OStatus',
1046 PRIMARY KEY(`uri-id`),
1047 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
1048 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items';
1053 CREATE TABLE IF NOT EXISTS `post-tag` (
1054 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
1055 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1056 `tid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1057 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the mentioned public contact',
1058 PRIMARY KEY(`uri-id`,`type`,`tid`,`cid`),
1059 INDEX `tid` (`tid`),
1060 INDEX `cid` (`cid`),
1061 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
1062 FOREIGN KEY (`tid`) REFERENCES `tag` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT,
1063 FOREIGN KEY (`cid`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
1064 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='post relation to tags';
1069 CREATE TABLE IF NOT EXISTS `process` (
1070 `pid` int unsigned NOT NULL COMMENT '',
1071 `command` varbinary(32) NOT NULL DEFAULT '' COMMENT '',
1072 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1074 INDEX `command` (`command`)
1075 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently running system processes';
1080 CREATE TABLE IF NOT EXISTS `profile` (
1081 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1082 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
1083 `profile-name` varchar(255) COMMENT 'Deprecated',
1084 `is-default` boolean COMMENT 'Deprecated',
1085 `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT 'Hide friend list from viewers of this profile',
1086 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1087 `pdesc` varchar(255) COMMENT 'Deprecated',
1088 `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT 'Day of birth',
1089 `address` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1090 `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1091 `region` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1092 `postal-code` varchar(32) NOT NULL DEFAULT '' COMMENT '',
1093 `country-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1094 `hometown` varchar(255) COMMENT 'Deprecated',
1095 `gender` varchar(32) COMMENT 'Deprecated',
1096 `marital` varchar(255) COMMENT 'Deprecated',
1097 `with` text COMMENT 'Deprecated',
1098 `howlong` datetime COMMENT 'Deprecated',
1099 `sexual` varchar(255) COMMENT 'Deprecated',
1100 `politic` varchar(255) COMMENT 'Deprecated',
1101 `religion` varchar(255) COMMENT 'Deprecated',
1102 `pub_keywords` text COMMENT '',
1103 `prv_keywords` text COMMENT '',
1104 `likes` text COMMENT 'Deprecated',
1105 `dislikes` text COMMENT 'Deprecated',
1106 `about` text COMMENT 'Profile description',
1107 `summary` varchar(255) COMMENT 'Deprecated',
1108 `music` text COMMENT 'Deprecated',
1109 `book` text COMMENT 'Deprecated',
1110 `tv` text COMMENT 'Deprecated',
1111 `film` text COMMENT 'Deprecated',
1112 `interest` text COMMENT 'Deprecated',
1113 `romance` text COMMENT 'Deprecated',
1114 `work` text COMMENT 'Deprecated',
1115 `education` text COMMENT 'Deprecated',
1116 `contact` text COMMENT 'Deprecated',
1117 `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1118 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1119 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1120 `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1121 `publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
1122 `net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
1124 INDEX `uid_is-default` (`uid`,`is-default`),
1125 FULLTEXT INDEX `pub_keywords` (`pub_keywords`)
1126 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
1129 -- TABLE profile_check
1131 CREATE TABLE IF NOT EXISTS `profile_check` (
1132 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1133 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1134 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
1135 `dfrn_id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1136 `sec` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1137 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1139 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='DFRN remote auth use';
1142 -- TABLE profile_field
1144 CREATE TABLE IF NOT EXISTS `profile_field` (
1145 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1146 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner user id',
1147 `order` mediumint unsigned NOT NULL DEFAULT 1 COMMENT 'Field ordering per user',
1148 `psid` int unsigned COMMENT 'ID of the permission set of this profile field - 0 = public',
1149 `label` varchar(255) NOT NULL DEFAULT '' COMMENT 'Label of the field',
1150 `value` text COMMENT 'Value of the field',
1151 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
1152 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
1154 INDEX `uid` (`uid`),
1155 INDEX `order` (`order`),
1156 INDEX `psid` (`psid`),
1157 FOREIGN KEY (`psid`) REFERENCES `permissionset` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
1158 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Custom profile fields';
1161 -- TABLE push_subscriber
1163 CREATE TABLE IF NOT EXISTS `push_subscriber` (
1164 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1165 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1166 `callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1167 `topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1168 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1169 `push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1170 `last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
1171 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1172 `renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
1173 `secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1175 INDEX `next_try` (`next_try`)
1176 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Used for OStatus: Contains feed subscribers';
1181 CREATE TABLE IF NOT EXISTS `register` (
1182 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1183 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1184 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1185 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1186 `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1187 `language` varchar(16) NOT NULL DEFAULT '' COMMENT '',
1188 `note` text COMMENT '',
1190 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
1195 CREATE TABLE IF NOT EXISTS `search` (
1196 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1197 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1198 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1201 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
1206 CREATE TABLE IF NOT EXISTS `session` (
1207 `id` bigint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1208 `sid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
1209 `data` text COMMENT '',
1210 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1212 INDEX `sid` (`sid`(64)),
1213 INDEX `expire` (`expire`)
1214 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='web session storage';
1219 CREATE TABLE IF NOT EXISTS `storage` (
1220 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented image data id',
1221 `data` longblob NOT NULL COMMENT 'file data',
1223 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Data stored by Database storage backend';
1228 CREATE TABLE IF NOT EXISTS `thread` (
1229 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'sequential ID',
1230 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1231 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1232 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
1233 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item author',
1234 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1235 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1236 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1237 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1238 `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1239 `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
1240 `private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
1241 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
1242 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
1243 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
1244 `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
1245 `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
1246 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
1247 `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
1248 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
1249 `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
1250 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1251 `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
1252 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
1253 `bookmark` boolean COMMENT '',
1255 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
1256 INDEX `uid_network_received` (`uid`,`network`,`received`),
1257 INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
1258 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
1259 INDEX `contactid` (`contact-id`),
1260 INDEX `ownerid` (`owner-id`),
1261 INDEX `authorid` (`author-id`),
1262 INDEX `uid_received` (`uid`,`received`),
1263 INDEX `uid_commented` (`uid`,`commented`),
1264 INDEX `uid_wall_received` (`uid`,`wall`,`received`),
1265 INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`)
1266 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Thread related data';
1271 CREATE TABLE IF NOT EXISTS `tokens` (
1272 `id` varchar(40) NOT NULL COMMENT '',
1273 `secret` text COMMENT '',
1274 `client_id` varchar(20) NOT NULL DEFAULT '',
1275 `expires` int NOT NULL DEFAULT 0 COMMENT '',
1276 `scope` varchar(200) NOT NULL DEFAULT '' COMMENT '',
1277 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1279 INDEX `client_id` (`client_id`),
1280 FOREIGN KEY (`client_id`) REFERENCES `clients` (`client_id`) ON UPDATE RESTRICT ON DELETE CASCADE
1281 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
1286 CREATE TABLE IF NOT EXISTS `user` (
1287 `uid` mediumint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1288 `parent-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'The parent user that has full control about this user',
1289 `guid` varchar(64) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this user',
1290 `username` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this user is known by',
1291 `password` varchar(255) NOT NULL DEFAULT '' COMMENT 'encrypted password',
1292 `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?',
1293 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT 'nick- and user name',
1294 `email` varchar(255) NOT NULL DEFAULT '' COMMENT 'the users email address',
1295 `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1296 `timezone` varchar(128) NOT NULL DEFAULT '' COMMENT 'PHP-legal timezone',
1297 `language` varchar(32) NOT NULL DEFAULT 'en' COMMENT 'default language',
1298 `register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of registration',
1299 `login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last login',
1300 `default-location` varchar(255) NOT NULL DEFAULT '' COMMENT 'Default for item.location',
1301 `allow_location` boolean NOT NULL DEFAULT '0' COMMENT '1 allows to display the location',
1302 `theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
1303 `pubkey` text COMMENT 'RSA public key 4096 bit',
1304 `prvkey` text COMMENT 'RSA private key 4096 bit',
1305 `spubkey` text COMMENT '',
1306 `sprvkey` text COMMENT '',
1307 `verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
1308 `blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
1309 `blockwall` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to post to the profile page of the user',
1310 `hidewall` boolean NOT NULL DEFAULT '0' COMMENT 'Hide profile details from unkown viewers',
1311 `blocktags` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to tag the post of this user',
1312 `unkmail` boolean NOT NULL DEFAULT '0' COMMENT 'Permit unknown people to send private mails to this user',
1313 `cntunkmail` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1314 `notify-flags` smallint unsigned NOT NULL DEFAULT 65535 COMMENT 'email notification options',
1315 `page-flags` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'page/profile type',
1316 `account-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1317 `prvnets` boolean NOT NULL DEFAULT '0' COMMENT '',
1318 `pwdreset` varchar(255) COMMENT 'Password reset request token',
1319 `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
1320 `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1321 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1322 `account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed',
1323 `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
1324 `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted',
1325 `expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last warning of account expiration',
1326 `def_gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1327 `allow_cid` mediumtext COMMENT 'default permission for this user',
1328 `allow_gid` mediumtext COMMENT 'default permission for this user',
1329 `deny_cid` mediumtext COMMENT 'default permission for this user',
1330 `deny_gid` mediumtext COMMENT 'default permission for this user',
1331 `openidserver` text COMMENT '',
1333 INDEX `nickname` (`nickname`(32))
1334 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='The local users';
1339 CREATE TABLE IF NOT EXISTS `userd` (
1340 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1341 `username` varchar(255) NOT NULL COMMENT '',
1343 INDEX `username` (`username`(32))
1344 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Deleted usernames';
1347 -- TABLE user-contact
1349 CREATE TABLE IF NOT EXISTS `user-contact` (
1350 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the linked public contact',
1351 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1352 `blocked` boolean COMMENT 'Contact is completely blocked for this user',
1353 `ignored` boolean COMMENT 'Posts from this contact are ignored',
1354 `collapsed` boolean COMMENT 'Posts from this contact are collapsed',
1355 PRIMARY KEY(`uid`,`cid`)
1356 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific public contact data';
1361 CREATE TABLE IF NOT EXISTS `user-item` (
1362 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item id',
1363 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1364 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Marker to hide an item from the user',
1365 `ignored` boolean COMMENT 'Ignore this thread if set',
1366 `pinned` boolean COMMENT 'The item is pinned on the profile page',
1367 `notification-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1368 PRIMARY KEY(`uid`,`iid`),
1369 INDEX `uid_pinned` (`uid`,`pinned`),
1370 INDEX `iid_uid` (`iid`,`uid`)
1371 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
1376 CREATE TABLE IF NOT EXISTS `verb` (
1377 `id` smallint unsigned NOT NULL auto_increment,
1378 `name` varchar(100) NOT NULL DEFAULT '' COMMENT '',
1380 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activity Verbs';
1385 CREATE TABLE IF NOT EXISTS `worker-ipc` (
1386 `key` int NOT NULL COMMENT '',
1387 `jobs` boolean COMMENT 'Flag for outstanding jobs',
1389 ) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Inter process communication between the frontend and the worker';
1392 -- TABLE workerqueue
1394 CREATE TABLE IF NOT EXISTS `workerqueue` (
1395 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id',
1396 `parameter` mediumtext COMMENT 'Task command',
1397 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority',
1398 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
1399 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
1400 `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
1401 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1402 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1403 `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
1405 INDEX `done_parameter` (`done`,`parameter`(64)),
1406 INDEX `done_executed` (`done`,`executed`),
1407 INDEX `done_priority_created` (`done`,`priority`,`created`),
1408 INDEX `done_priority_next_try` (`done`,`priority`,`next_try`),
1409 INDEX `done_pid_next_try` (`done`,`pid`,`next_try`),
1410 INDEX `done_pid_priority_created` (`done`,`pid`,`priority`,`created`)
1411 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
1414 -- VIEW category-view
1416 DROP VIEW IF EXISTS `category-view`;
1417 CREATE VIEW `category-view` AS SELECT
1418 `post-category`.`uri-id` AS `uri-id`,
1419 `post-category`.`uid` AS `uid`,
1420 `item-uri`.`uri` AS `uri`,
1421 `item-uri`.`guid` AS `guid`,
1422 `post-category`.`type` AS `type`,
1423 `post-category`.`tid` AS `tid`,
1424 `tag`.`name` AS `name`,
1425 `tag`.`url` AS `url`
1426 FROM `post-category`
1427 INNER JOIN `item-uri` ON `item-uri`.id = `post-category`.`uri-id`
1428 LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`;
1433 DROP VIEW IF EXISTS `tag-view`;
1434 CREATE VIEW `tag-view` AS SELECT
1435 `post-tag`.`uri-id` AS `uri-id`,
1436 `item-uri`.`uri` AS `uri`,
1437 `item-uri`.`guid` AS `guid`,
1438 `post-tag`.`type` AS `type`,
1439 `post-tag`.`tid` AS `tid`,
1440 `post-tag`.`cid` AS `cid`,
1441 CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END AS `name`,
1442 CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END AS `url`
1444 INNER JOIN `item-uri` ON `item-uri`.id = `post-tag`.`uri-id`
1445 LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
1446 LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`;
1451 DROP VIEW IF EXISTS `owner-view`;
1452 CREATE VIEW `owner-view` AS SELECT
1453 `contact`.`id` AS `id`,
1454 `contact`.`uid` AS `uid`,
1455 `contact`.`created` AS `created`,
1456 `contact`.`updated` AS `updated`,
1457 `contact`.`self` AS `self`,
1458 `contact`.`remote_self` AS `remote_self`,
1459 `contact`.`rel` AS `rel`,
1460 `contact`.`duplex` AS `duplex`,
1461 `contact`.`network` AS `network`,
1462 `contact`.`protocol` AS `protocol`,
1463 `contact`.`name` AS `name`,
1464 `contact`.`nick` AS `nick`,
1465 `contact`.`location` AS `location`,
1466 `contact`.`about` AS `about`,
1467 `contact`.`keywords` AS `keywords`,
1468 `contact`.`gender` AS `gender`,
1469 `contact`.`xmpp` AS `xmpp`,
1470 `contact`.`attag` AS `attag`,
1471 `contact`.`avatar` AS `avatar`,
1472 `contact`.`photo` AS `photo`,
1473 `contact`.`thumb` AS `thumb`,
1474 `contact`.`micro` AS `micro`,
1475 `contact`.`site-pubkey` AS `site-pubkey`,
1476 `contact`.`issued-id` AS `issued-id`,
1477 `contact`.`dfrn-id` AS `dfrn-id`,
1478 `contact`.`url` AS `url`,
1479 `contact`.`nurl` AS `nurl`,
1480 `contact`.`addr` AS `addr`,
1481 `contact`.`alias` AS `alias`,
1482 `contact`.`pubkey` AS `pubkey`,
1483 `contact`.`prvkey` AS `prvkey`,
1484 `contact`.`batch` AS `batch`,
1485 `contact`.`request` AS `request`,
1486 `contact`.`notify` AS `notify`,
1487 `contact`.`poll` AS `poll`,
1488 `contact`.`confirm` AS `confirm`,
1489 `contact`.`poco` AS `poco`,
1490 `contact`.`aes_allow` AS `aes_allow`,
1491 `contact`.`ret-aes` AS `ret-aes`,
1492 `contact`.`usehub` AS `usehub`,
1493 `contact`.`subhub` AS `subhub`,
1494 `contact`.`hub-verify` AS `hub-verify`,
1495 `contact`.`last-update` AS `last-update`,
1496 `contact`.`success_update` AS `success_update`,
1497 `contact`.`failure_update` AS `failure_update`,
1498 `contact`.`name-date` AS `name-date`,
1499 `contact`.`uri-date` AS `uri-date`,
1500 `contact`.`avatar-date` AS `avatar-date`,
1501 `contact`.`avatar-date` AS `picdate`,
1502 `contact`.`term-date` AS `term-date`,
1503 `contact`.`last-item` AS `last-item`,
1504 `contact`.`priority` AS `priority`,
1505 `contact`.`blocked` AS `blocked`,
1506 `contact`.`block_reason` AS `block_reason`,
1507 `contact`.`readonly` AS `readonly`,
1508 `contact`.`writable` AS `writable`,
1509 `contact`.`forum` AS `forum`,
1510 `contact`.`prv` AS `prv`,
1511 `contact`.`contact-type` AS `contact-type`,
1512 `contact`.`hidden` AS `hidden`,
1513 `contact`.`archive` AS `archive`,
1514 `contact`.`pending` AS `pending`,
1515 `contact`.`deleted` AS `deleted`,
1516 `contact`.`rating` AS `rating`,
1517 `contact`.`unsearchable` AS `unsearchable`,
1518 `contact`.`sensitive` AS `sensitive`,
1519 `contact`.`baseurl` AS `baseurl`,
1520 `contact`.`reason` AS `reason`,
1521 `contact`.`closeness` AS `closeness`,
1522 `contact`.`info` AS `info`,
1523 `contact`.`profile-id` AS `profile-id`,
1524 `contact`.`bdyear` AS `bdyear`,
1525 `contact`.`bd` AS `bd`,
1526 `contact`.`notify_new_posts` AS `notify_new_posts`,
1527 `contact`.`fetch_further_information` AS `fetch_further_information`,
1528 `contact`.`ffi_keyword_blacklist` AS `ffi_keyword_blacklist`,
1529 `user`.`parent-uid` AS `parent-uid`,
1530 `user`.`guid` AS `guid`,
1531 `user`.`nickname` AS `nickname`,
1532 `user`.`email` AS `email`,
1533 `user`.`openid` AS `openid`,
1534 `user`.`timezone` AS `timezone`,
1535 `user`.`language` AS `language`,
1536 `user`.`register_date` AS `register_date`,
1537 `user`.`login_date` AS `login_date`,
1538 `user`.`default-location` AS `default-location`,
1539 `user`.`allow_location` AS `allow_location`,
1540 `user`.`theme` AS `theme`,
1541 `user`.`pubkey` AS `upubkey`,
1542 `user`.`prvkey` AS `uprvkey`,
1543 `user`.`sprvkey` AS `sprvkey`,
1544 `user`.`spubkey` AS `spubkey`,
1545 `user`.`verified` AS `verified`,
1546 `user`.`blockwall` AS `blockwall`,
1547 `user`.`hidewall` AS `hidewall`,
1548 `user`.`blocktags` AS `blocktags`,
1549 `user`.`unkmail` AS `unkmail`,
1550 `user`.`cntunkmail` AS `cntunkmail`,
1551 `user`.`notify-flags` AS `notify-flags`,
1552 `user`.`page-flags` AS `page-flags`,
1553 `user`.`account-type` AS `account-type`,
1554 `user`.`prvnets` AS `prvnets`,
1555 `user`.`maxreq` AS `maxreq`,
1556 `user`.`expire` AS `expire`,
1557 `user`.`account_removed` AS `account_removed`,
1558 `user`.`account_expired` AS `account_expired`,
1559 `user`.`account_expires_on` AS `account_expires_on`,
1560 `user`.`expire_notification_sent` AS `expire_notification_sent`,
1561 `user`.`def_gid` AS `def_gid`,
1562 `user`.`allow_cid` AS `allow_cid`,
1563 `user`.`allow_gid` AS `allow_gid`,
1564 `user`.`deny_cid` AS `deny_cid`,
1565 `user`.`deny_gid` AS `deny_gid`,
1566 `user`.`openidserver` AS `openidserver`,
1567 `profile`.`publish` AS `publish`,
1568 `profile`.`net-publish` AS `net-publish`,
1569 `profile`.`hide-friends` AS `hide-friends`,
1570 `profile`.`prv_keywords` AS `prv_keywords`,
1571 `profile`.`pub_keywords` AS `pub_keywords`,
1572 `profile`.`address` AS `address`,
1573 `profile`.`locality` AS `locality`,
1574 `profile`.`region` AS `region`,
1575 `profile`.`postal-code` AS `postal-code`,
1576 `profile`.`country-name` AS `country-name`,
1577 `profile`.`homepage` AS `homepage`,
1578 `profile`.`dob` AS `dob`
1580 INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
1581 INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`;
1584 -- VIEW pending-view
1586 DROP VIEW IF EXISTS `pending-view`;
1587 CREATE VIEW `pending-view` AS SELECT
1588 `register`.`id` AS `id`,
1589 `register`.`hash` AS `hash`,
1590 `register`.`created` AS `created`,
1591 `register`.`uid` AS `uid`,
1592 `register`.`password` AS `password`,
1593 `register`.`language` AS `language`,
1594 `register`.`note` AS `note`,
1595 `contact`.`self` AS `self`,
1596 `contact`.`name` AS `name`,
1597 `contact`.`url` AS `url`,
1598 `contact`.`micro` AS `micro`,
1599 `user`.`email` AS `email`,
1600 `contact`.`nick` AS `nick`
1602 INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
1603 INNER JOIN `user` ON `register`.`uid` = `user`.`uid`;
1606 -- VIEW tag-search-view
1608 DROP VIEW IF EXISTS `tag-search-view`;
1609 CREATE VIEW `tag-search-view` AS SELECT
1610 `post-tag`.`uri-id` AS `uri-id`,
1611 `item`.`id` AS `iid`,
1612 `item`.`uri` AS `uri`,
1613 `item`.`guid` AS `guid`,
1614 `item`.`uid` AS `uid`,
1615 `item`.`private` AS `private`,
1616 `item`.`wall` AS `wall`,
1617 `item`.`origin` AS `origin`,
1618 `item`.`gravity` AS `gravity`,
1619 `item`.`received` AS `received`,
1620 `tag`.`name` AS `name`
1622 INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
1623 INNER JOIN `item` ON `item`.`uri-id` = `post-tag`.`uri-id`
1624 WHERE `post-tag`.`type` = 1;
1627 -- VIEW workerqueue-view
1629 DROP VIEW IF EXISTS `workerqueue-view`;
1630 CREATE VIEW `workerqueue-view` AS SELECT
1631 `process`.`pid` AS `pid`,
1632 `workerqueue`.`priority` AS `priority`
1634 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
1635 WHERE NOT `workerqueue`.`done`;