1 -- ------------------------------------------
2 -- Friendica 2020.06-dev (Red Hot Poker)
3 -- DB_UPDATE_VERSION 1347
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 'Deprecated',
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 COMMENT 'Deprecated',
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';
258 -- TABLE contact-relation
260 CREATE TABLE IF NOT EXISTS `contact-relation` (
261 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact the related contact had interacted with',
262 `relation-cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'related contact who had interacted with the contact',
263 `last-interaction` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last interaction',
264 PRIMARY KEY(`cid`,`relation-cid`),
265 INDEX `relation-cid` (`relation-cid`)
266 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Contact relations';
271 CREATE TABLE IF NOT EXISTS `conv` (
272 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
273 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this conversation',
274 `recips` text COMMENT 'sender_handle;recipient_handle',
275 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
276 `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'handle of creator',
277 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation timestamp',
278 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'edited timestamp',
279 `subject` text COMMENT 'subject of initial message',
282 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
285 -- TABLE conversation
287 CREATE TABLE IF NOT EXISTS `conversation` (
288 `item-uri` varbinary(255) NOT NULL COMMENT 'Original URI of the item - unrelated to the table with the same name',
289 `reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'URI to which this item is a reply',
290 `conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
291 `conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
292 `protocol` tinyint unsigned NOT NULL DEFAULT 255 COMMENT 'The protocol of the item',
293 `direction` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'How the message arrived here: 1=push, 2=pull',
294 `source` mediumtext COMMENT 'Original source',
295 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
296 PRIMARY KEY(`item-uri`),
297 INDEX `conversation-uri` (`conversation-uri`),
298 INDEX `received` (`received`)
299 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
302 -- TABLE diaspora-interaction
304 CREATE TABLE IF NOT EXISTS `diaspora-interaction` (
305 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
306 `interaction` mediumtext COMMENT 'The Diaspora interaction',
307 PRIMARY KEY(`uri-id`)
308 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Signed Diaspora Interaction';
313 CREATE TABLE IF NOT EXISTS `event` (
314 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
315 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
316 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
317 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact_id (ID of the contact in contact table)',
318 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
319 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
320 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
321 `start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event start time',
322 `finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event end time',
323 `summary` text COMMENT 'short description or title of the event',
324 `desc` text COMMENT 'event description',
325 `location` text COMMENT 'event location',
326 `type` varchar(20) NOT NULL DEFAULT '' COMMENT 'event or birthday',
327 `nofinish` boolean NOT NULL DEFAULT '0' COMMENT 'if event does have no end this is 1',
328 `adjust` boolean NOT NULL DEFAULT '1' COMMENT 'adjust to timezone of the recipient (0 or 1)',
329 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '0 or 1',
330 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
331 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
332 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
333 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
335 INDEX `uid_start` (`uid`,`start`)
336 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Events';
341 CREATE TABLE IF NOT EXISTS `fcontact` (
342 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
343 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'unique id',
344 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
345 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
346 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
347 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
348 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
349 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
350 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
351 `notify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
352 `poll` varchar(255) NOT NULL DEFAULT '' COMMENT '',
353 `confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '',
354 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
355 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
356 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
357 `pubkey` text COMMENT '',
358 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
360 INDEX `addr` (`addr`(32)),
361 UNIQUE INDEX `url` (`url`(190))
362 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora compatible contacts - used in the Diaspora implementation';
367 CREATE TABLE IF NOT EXISTS `fsuggest` (
368 `id` int unsigned NOT NULL auto_increment COMMENT '',
369 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
370 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
371 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
372 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
373 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
374 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
375 `note` text COMMENT '',
376 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
378 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='friend suggestion stuff';
383 CREATE TABLE IF NOT EXISTS `gcign` (
384 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
385 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Local User id',
386 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'gcontact.id of ignored contact',
389 INDEX `gcid` (`gcid`)
390 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contacts ignored by friend suggestions';
395 CREATE TABLE IF NOT EXISTS `gcontact` (
396 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
397 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
398 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
399 `url` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the contacts profile page',
400 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
401 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the profile photo',
402 `connect` varchar(255) NOT NULL DEFAULT '' COMMENT '',
403 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
404 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
405 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
406 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
407 `last_discovery` datetime DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last contact discovery',
408 `archive_date` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
409 `archived` boolean NOT NULL DEFAULT '0' COMMENT '',
410 `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
411 `about` text COMMENT '',
412 `keywords` text COMMENT 'puplic keywords (interests)',
413 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT 'Deprecated',
414 `birthday` varchar(32) NOT NULL DEFAULT '0001-01-01' COMMENT '',
415 `community` boolean NOT NULL DEFAULT '0' COMMENT '1 if contact is forum account',
416 `contact-type` tinyint NOT NULL DEFAULT -1 COMMENT '',
417 `hide` boolean NOT NULL DEFAULT '0' COMMENT '1 = should be hidden from search',
418 `nsfw` boolean NOT NULL DEFAULT '0' COMMENT '1 = contact posts nsfw content',
419 `network` char(4) NOT NULL DEFAULT '' COMMENT 'social network protocol',
420 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
421 `notify` varchar(255) COMMENT '',
422 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
423 `generation` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
424 `server_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'baseurl of the contacts server',
426 UNIQUE INDEX `nurl` (`nurl`(190)),
427 INDEX `name` (`name`(64)),
428 INDEX `nick` (`nick`(32)),
429 INDEX `addr` (`addr`(64)),
430 INDEX `hide_network_updated` (`hide`,`network`,`updated`),
431 INDEX `updated` (`updated`)
432 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='global contacts';
437 CREATE TABLE IF NOT EXISTS `gfollower` (
438 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'global contact',
439 `follower-gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'global contact of the follower',
440 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates that the connection has been deleted',
441 PRIMARY KEY(`gcid`,`follower-gcid`),
442 INDEX `follower-gcid` (`follower-gcid`)
443 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Followers of global contacts';
448 CREATE TABLE IF NOT EXISTS `glink` (
449 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
450 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
451 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
452 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
453 `zcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
454 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
456 UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
457 INDEX `gcid` (`gcid`)
458 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='\'friends of friends\' linkages derived from poco';
463 CREATE TABLE IF NOT EXISTS `group` (
464 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
465 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
466 `visible` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the member list is not private',
467 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the group has been deleted',
468 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'human readable name of group',
471 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, group info';
474 -- TABLE group_member
476 CREATE TABLE IF NOT EXISTS `group_member` (
477 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
478 `gid` int unsigned NOT NULL DEFAULT 0 COMMENT 'groups.id of the associated group',
479 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id of the member assigned to the associated group',
481 INDEX `contactid` (`contact-id`),
482 UNIQUE INDEX `gid_contactid` (`gid`,`contact-id`)
483 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, member info';
488 CREATE TABLE IF NOT EXISTS `gserver` (
489 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
490 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
491 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
492 `version` varchar(255) NOT NULL DEFAULT '' COMMENT '',
493 `site_name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
494 `info` text COMMENT '',
495 `register_policy` tinyint NOT NULL DEFAULT 0 COMMENT '',
496 `registered-users` int unsigned NOT NULL DEFAULT 0 COMMENT 'Number of registered users',
497 `directory-type` tinyint DEFAULT 0 COMMENT 'Type of directory service (Poco, Mastodon)',
498 `poco` varchar(255) NOT NULL DEFAULT '' COMMENT '',
499 `noscrape` varchar(255) NOT NULL DEFAULT '' COMMENT '',
500 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
501 `platform` varchar(255) NOT NULL DEFAULT '' COMMENT '',
502 `relay-subscribe` boolean NOT NULL DEFAULT '0' COMMENT 'Has the server subscribed to the relay system',
503 `relay-scope` varchar(10) NOT NULL DEFAULT '' COMMENT 'The scope of messages that the server wants to get',
504 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
505 `last_poco_query` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
506 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
507 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
509 UNIQUE INDEX `nurl` (`nurl`(190))
510 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Global servers';
515 CREATE TABLE IF NOT EXISTS `gserver-tag` (
516 `gserver-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'The id of the gserver',
517 `tag` varchar(100) NOT NULL DEFAULT '' COMMENT 'Tag that the server has subscribed',
518 PRIMARY KEY(`gserver-id`,`tag`),
520 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Tags that the server has subscribed';
525 CREATE TABLE IF NOT EXISTS `hook` (
526 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
527 `hook` varbinary(100) NOT NULL DEFAULT '' COMMENT 'name of hook',
528 `file` varbinary(200) NOT NULL DEFAULT '' COMMENT 'relative filename of hook handler',
529 `function` varbinary(200) NOT NULL DEFAULT '' COMMENT 'function name of hook handler',
530 `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',
532 UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
533 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='addon hook registry';
536 -- TABLE inbox-status
538 CREATE TABLE IF NOT EXISTS `inbox-status` (
539 `url` varbinary(255) NOT NULL COMMENT 'URL of the inbox',
540 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date of this entry',
541 `success` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful delivery',
542 `failure` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed delivery',
543 `previous` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Previous delivery date',
544 `archive` boolean NOT NULL DEFAULT '0' COMMENT 'Is the inbox archived?',
545 `shared` boolean NOT NULL DEFAULT '0' COMMENT 'Is it a shared inbox?',
547 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Status of ActivityPub inboxes';
552 CREATE TABLE IF NOT EXISTS `intro` (
553 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
554 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
555 `fid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
556 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
557 `knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
558 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
559 `note` text COMMENT '',
560 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
561 `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
562 `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
563 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
565 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
570 CREATE TABLE IF NOT EXISTS `item` (
571 `id` int unsigned NOT NULL auto_increment,
572 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this item',
573 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
574 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
575 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
576 `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',
577 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT 'uri of the parent to this item',
578 `parent-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the parent uri',
579 `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',
580 `thr-parent-id` int unsigned COMMENT 'Id of the item-uri table that contains the thread parent uri',
581 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation timestamp.',
582 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last edit (default is created)',
583 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last comment/reply to this item',
584 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime',
585 `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',
586 `gravity` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
587 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network from where the item comes from',
588 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
589 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
590 `icid` int unsigned COMMENT 'Id of the item-content table entry that contains the whole item content',
591 `iaid` int unsigned COMMENT 'Id of the item-activity table entry that contains the activity data',
592 `vid` smallint unsigned COMMENT 'Id of the verb table entry that contains the activity verbs',
593 `extid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
594 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
595 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
596 `private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
597 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
598 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
599 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'item has been deleted',
600 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id which owns this copy of the item',
601 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
602 `wall` boolean NOT NULL DEFAULT '0' COMMENT 'This item was posted to the wall of uid',
603 `origin` boolean NOT NULL DEFAULT '0' COMMENT 'item originated at this site',
604 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
605 `starred` boolean NOT NULL DEFAULT '0' COMMENT 'item has been favourited',
606 `unseen` boolean NOT NULL DEFAULT '1' COMMENT 'item has not been seen',
607 `mention` boolean NOT NULL DEFAULT '0' COMMENT 'The owner of this item was mentioned in it',
608 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
609 `psid` int unsigned COMMENT 'ID of the permission set of this post',
610 `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',
611 `event-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Used to link to the event.id',
612 `attach` mediumtext COMMENT 'JSON structure representing attachments to this item',
613 `allow_cid` mediumtext COMMENT 'Deprecated',
614 `allow_gid` mediumtext COMMENT 'Deprecated',
615 `deny_cid` mediumtext COMMENT 'Deprecated',
616 `deny_gid` mediumtext COMMENT 'Deprecated',
617 `postopts` text COMMENT 'Deprecated',
618 `inform` mediumtext COMMENT 'Deprecated',
619 `type` varchar(20) COMMENT 'Deprecated',
620 `bookmark` boolean COMMENT 'Deprecated',
621 `file` mediumtext COMMENT 'Deprecated',
622 `location` varchar(255) COMMENT 'Deprecated',
623 `coord` varchar(255) COMMENT 'Deprecated',
624 `tag` mediumtext COMMENT 'Deprecated',
625 `plink` varchar(255) COMMENT 'Deprecated',
626 `title` varchar(255) COMMENT 'Deprecated',
627 `content-warning` varchar(255) COMMENT 'Deprecated',
628 `body` mediumtext COMMENT 'Deprecated',
629 `app` varchar(255) COMMENT 'Deprecated',
630 `verb` varchar(100) COMMENT 'Deprecated',
631 `object-type` varchar(100) COMMENT 'Deprecated',
632 `object` text COMMENT 'Deprecated',
633 `target-type` varchar(100) COMMENT 'Deprecated',
634 `target` text COMMENT 'Deprecated',
635 `author-name` varchar(255) COMMENT 'Deprecated',
636 `author-link` varchar(255) COMMENT 'Deprecated',
637 `author-avatar` varchar(255) COMMENT 'Deprecated',
638 `owner-name` varchar(255) COMMENT 'Deprecated',
639 `owner-link` varchar(255) COMMENT 'Deprecated',
640 `owner-avatar` varchar(255) COMMENT 'Deprecated',
641 `rendered-hash` varchar(32) COMMENT 'Deprecated',
642 `rendered-html` mediumtext COMMENT 'Deprecated',
644 INDEX `guid` (`guid`(191)),
645 INDEX `uri` (`uri`(191)),
646 INDEX `parent` (`parent`),
647 INDEX `parent-uri` (`parent-uri`(191)),
648 INDEX `extid` (`extid`(191)),
649 INDEX `uid_id` (`uid`,`id`),
650 INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
651 INDEX `uid_received` (`uid`,`received`),
652 INDEX `uid_commented` (`uid`,`commented`),
653 INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
654 INDEX `uid_network_received` (`uid`,`network`,`received`),
655 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
656 INDEX `uid_thrparent` (`uid`,`thr-parent`(190)),
657 INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
658 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
659 INDEX `authorid_received` (`author-id`,`received`),
660 INDEX `ownerid` (`owner-id`),
661 INDEX `contact-id` (`contact-id`),
662 INDEX `uid_uri` (`uid`,`uri`(190)),
663 INDEX `resource-id` (`resource-id`),
664 INDEX `deleted_changed` (`deleted`,`changed`),
665 INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
666 INDEX `mention_uid_id` (`mention`,`uid`,`id`),
667 INDEX `uid_eventid` (`uid`,`event-id`),
668 INDEX `icid` (`icid`),
669 INDEX `iaid` (`iaid`),
670 INDEX `psid_wall` (`psid`,`wall`),
671 INDEX `uri-id` (`uri-id`)
672 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
675 -- TABLE item-activity
677 CREATE TABLE IF NOT EXISTS `item-activity` (
678 `id` int unsigned NOT NULL auto_increment,
679 `uri` varchar(255) COMMENT '',
680 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
681 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
682 `activity` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
684 UNIQUE INDEX `uri-hash` (`uri-hash`),
685 INDEX `uri` (`uri`(191)),
686 INDEX `uri-id` (`uri-id`)
687 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activities for items';
690 -- TABLE item-content
692 CREATE TABLE IF NOT EXISTS `item-content` (
693 `id` int unsigned NOT NULL auto_increment,
694 `uri` varchar(255) COMMENT '',
695 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
696 `uri-plink-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
697 `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'item title',
698 `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
699 `body` mediumtext COMMENT 'item body content',
700 `location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
701 `coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
702 `language` text COMMENT 'Language information about this post',
703 `app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
704 `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
705 `rendered-html` mediumtext COMMENT 'item.body converted to html',
706 `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams object type',
707 `object` text COMMENT 'JSON encoded object structure unless it is an implied object (normal post)',
708 `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
709 `target` text COMMENT 'JSON encoded target structure if used',
710 `plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
711 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams verb',
713 UNIQUE INDEX `uri-plink-hash` (`uri-plink-hash`),
714 INDEX `uri` (`uri`(191)),
715 INDEX `plink` (`plink`(191)),
716 INDEX `uri-id` (`uri-id`)
717 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
722 CREATE TABLE IF NOT EXISTS `item-uri` (
723 `id` int unsigned NOT NULL auto_increment,
724 `uri` varbinary(255) NOT NULL COMMENT 'URI of an item',
725 `guid` varbinary(255) COMMENT 'A unique identifier for an item',
727 UNIQUE INDEX `uri` (`uri`),
728 INDEX `guid` (`guid`)
729 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='URI and GUID for items';
734 CREATE TABLE IF NOT EXISTS `locks` (
735 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
736 `name` varchar(128) NOT NULL DEFAULT '' COMMENT '',
737 `locked` boolean NOT NULL DEFAULT '0' COMMENT '',
738 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process ID',
739 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
741 INDEX `name_expires` (`name`,`expires`)
742 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
747 CREATE TABLE IF NOT EXISTS `mail` (
748 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
749 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
750 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
751 `from-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the sender',
752 `from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
753 `from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
754 `contact-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact.id',
755 `convid` int unsigned NOT NULL DEFAULT 0 COMMENT 'conv.id',
756 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
757 `body` mediumtext COMMENT '',
758 `seen` boolean NOT NULL DEFAULT '0' COMMENT 'if message visited it is 1',
759 `reply` boolean NOT NULL DEFAULT '0' COMMENT '',
760 `replied` boolean NOT NULL DEFAULT '0' COMMENT '',
761 `unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
762 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
763 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
764 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
766 INDEX `uid_seen` (`uid`,`seen`),
767 INDEX `convid` (`convid`),
768 INDEX `uri` (`uri`(64)),
769 INDEX `parent-uri` (`parent-uri`(64)),
770 INDEX `contactid` (`contact-id`(32))
771 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
776 CREATE TABLE IF NOT EXISTS `mailacct` (
777 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
778 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
779 `server` varchar(255) NOT NULL DEFAULT '' COMMENT '',
780 `port` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
781 `ssltype` varchar(16) NOT NULL DEFAULT '' COMMENT '',
782 `mailbox` varchar(255) NOT NULL DEFAULT '' COMMENT '',
783 `user` varchar(255) NOT NULL DEFAULT '' COMMENT '',
784 `pass` text COMMENT '',
785 `reply_to` varchar(255) NOT NULL DEFAULT '' COMMENT '',
786 `action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
787 `movetofolder` varchar(255) NOT NULL DEFAULT '' COMMENT '',
788 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
789 `last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
791 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Mail account data for fetching mails';
796 CREATE TABLE IF NOT EXISTS `manage` (
797 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
798 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
799 `mid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
801 UNIQUE INDEX `uid_mid` (`uid`,`mid`)
802 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='table of accounts that can manage each other';
807 CREATE TABLE IF NOT EXISTS `notify` (
808 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
809 `type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
810 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
811 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
812 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
813 `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
814 `msg` mediumtext COMMENT '',
815 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
816 `link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
817 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
818 `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
819 `uri-id` int unsigned COMMENT 'Item-uri id of the related post',
820 `parent-uri-id` int unsigned COMMENT 'Item-uri id of the parent of the related post',
821 `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
822 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
823 `otype` varchar(10) NOT NULL DEFAULT '' COMMENT '',
824 `name_cache` tinytext COMMENT 'Cached bbcode parsing of name',
825 `msg_cache` mediumtext COMMENT 'Cached bbcode parsing of msg',
827 INDEX `seen_uid_date` (`seen`,`uid`,`date`),
828 INDEX `uid_date` (`uid`,`date`),
829 INDEX `uid_type_link` (`uid`,`type`,`link`(190))
830 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='notifications';
833 -- TABLE notify-threads
835 CREATE TABLE IF NOT EXISTS `notify-threads` (
836 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
837 `notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
838 `master-parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
839 `master-parent-uri-id` int unsigned COMMENT 'Item-uri id of the parent of the related post',
840 `parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
841 `receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
843 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
848 CREATE TABLE IF NOT EXISTS `oembed` (
849 `url` varbinary(255) NOT NULL COMMENT 'page url',
850 `maxwidth` mediumint unsigned NOT NULL COMMENT 'Maximum width passed to Oembed',
851 `content` mediumtext COMMENT 'OEmbed data of the page',
852 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
853 PRIMARY KEY(`url`,`maxwidth`),
854 INDEX `created` (`created`)
855 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for OEmbed queries';
858 -- TABLE openwebauth-token
860 CREATE TABLE IF NOT EXISTS `openwebauth-token` (
861 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
862 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
863 `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Verify type',
864 `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'A generated token',
865 `meta` varchar(255) NOT NULL DEFAULT '' COMMENT '',
866 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
868 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store OpenWebAuth token to verify contacts';
873 CREATE TABLE IF NOT EXISTS `parsed_url` (
874 `url` varbinary(255) NOT NULL COMMENT 'page url',
875 `guessing` boolean NOT NULL DEFAULT '0' COMMENT 'is the \'guessing\' mode active?',
876 `oembed` boolean NOT NULL DEFAULT '0' COMMENT 'is the data the result of oembed?',
877 `content` mediumtext COMMENT 'page data',
878 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
879 PRIMARY KEY(`url`,`guessing`,`oembed`),
880 INDEX `created` (`created`)
881 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for \'parse_url\' queries';
884 -- TABLE participation
886 CREATE TABLE IF NOT EXISTS `participation` (
887 `iid` int unsigned NOT NULL COMMENT '',
888 `server` varchar(60) NOT NULL COMMENT '',
889 `cid` int unsigned NOT NULL COMMENT '',
890 `fid` int unsigned NOT NULL COMMENT '',
891 PRIMARY KEY(`iid`,`server`),
894 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Storage for participation messages from Diaspora';
899 CREATE TABLE IF NOT EXISTS `pconfig` (
900 `id` int unsigned NOT NULL auto_increment COMMENT '',
901 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
902 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
903 `k` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
904 `v` mediumtext COMMENT '',
906 UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
907 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='personal (per user) configuration storage';
910 -- TABLE permissionset
912 CREATE TABLE IF NOT EXISTS `permissionset` (
913 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
914 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id of this permission set',
915 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
916 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
917 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
918 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
920 INDEX `uid_allow_cid_allow_gid_deny_cid_deny_gid` (`allow_cid`(50),`allow_gid`(30),`deny_cid`(50),`deny_gid`(30))
921 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
926 CREATE TABLE IF NOT EXISTS `photo` (
927 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
928 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
929 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
930 `guid` char(16) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this photo',
931 `resource-id` char(32) NOT NULL DEFAULT '' COMMENT '',
932 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation date',
933 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edited date',
934 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
935 `desc` text COMMENT '',
936 `album` varchar(255) NOT NULL DEFAULT '' COMMENT 'The name of the album to which the photo belongs',
937 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
938 `type` varchar(30) NOT NULL DEFAULT 'image/jpeg',
939 `height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
940 `width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
941 `datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
942 `data` mediumblob NOT NULL COMMENT '',
943 `scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
944 `profile` boolean NOT NULL DEFAULT '0' COMMENT '',
945 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
946 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
947 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
948 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
949 `accessible` boolean NOT NULL DEFAULT '0' COMMENT 'Make photo publicly accessible, ignoring permissions',
950 `backend-class` tinytext COMMENT 'Storage backend class',
951 `backend-ref` text COMMENT 'Storage backend data reference',
952 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
954 INDEX `contactid` (`contact-id`),
955 INDEX `uid_contactid` (`uid`,`contact-id`),
956 INDEX `uid_profile` (`uid`,`profile`),
957 INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
958 INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`,`created`),
959 INDEX `resource-id` (`resource-id`)
960 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='photo storage';
965 CREATE TABLE IF NOT EXISTS `poll` (
966 `id` int unsigned NOT NULL auto_increment COMMENT '',
967 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
968 `q0` text COMMENT '',
969 `q1` text COMMENT '',
970 `q2` text COMMENT '',
971 `q3` text COMMENT '',
972 `q4` text COMMENT '',
973 `q5` text COMMENT '',
974 `q6` text COMMENT '',
975 `q7` text COMMENT '',
976 `q8` text COMMENT '',
977 `q9` text COMMENT '',
980 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently unused table for storing poll results';
985 CREATE TABLE IF NOT EXISTS `poll_result` (
986 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
987 `poll_id` int unsigned NOT NULL DEFAULT 0,
988 `choice` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
990 INDEX `poll_id` (`poll_id`)
991 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='data for polls - currently unused';
996 CREATE TABLE IF NOT EXISTS `process` (
997 `pid` int unsigned NOT NULL COMMENT '',
998 `command` varbinary(32) NOT NULL DEFAULT '' COMMENT '',
999 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1001 INDEX `command` (`command`)
1002 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently running system processes';
1007 CREATE TABLE IF NOT EXISTS `profile` (
1008 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1009 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
1010 `profile-name` varchar(255) COMMENT 'Deprecated',
1011 `is-default` boolean COMMENT 'Deprecated',
1012 `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT 'Hide friend list from viewers of this profile',
1013 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1014 `pdesc` varchar(255) COMMENT 'Deprecated',
1015 `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT 'Day of birth',
1016 `address` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1017 `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1018 `region` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1019 `postal-code` varchar(32) NOT NULL DEFAULT '' COMMENT '',
1020 `country-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1021 `hometown` varchar(255) COMMENT 'Deprecated',
1022 `gender` varchar(32) COMMENT 'Deprecated',
1023 `marital` varchar(255) COMMENT 'Deprecated',
1024 `with` text COMMENT 'Deprecated',
1025 `howlong` datetime COMMENT 'Deprecated',
1026 `sexual` varchar(255) COMMENT 'Deprecated',
1027 `politic` varchar(255) COMMENT 'Deprecated',
1028 `religion` varchar(255) COMMENT 'Deprecated',
1029 `pub_keywords` text COMMENT '',
1030 `prv_keywords` text COMMENT '',
1031 `likes` text COMMENT 'Deprecated',
1032 `dislikes` text COMMENT 'Deprecated',
1033 `about` text COMMENT 'Profile description',
1034 `summary` varchar(255) COMMENT 'Deprecated',
1035 `music` text COMMENT 'Deprecated',
1036 `book` text COMMENT 'Deprecated',
1037 `tv` text COMMENT 'Deprecated',
1038 `film` text COMMENT 'Deprecated',
1039 `interest` text COMMENT 'Deprecated',
1040 `romance` text COMMENT 'Deprecated',
1041 `work` text COMMENT 'Deprecated',
1042 `education` text COMMENT 'Deprecated',
1043 `contact` text COMMENT 'Deprecated',
1044 `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1045 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1046 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1047 `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1048 `publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
1049 `net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
1051 INDEX `uid_is-default` (`uid`,`is-default`),
1052 FULLTEXT INDEX `pub_keywords` (`pub_keywords`)
1053 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
1056 -- TABLE profile_check
1058 CREATE TABLE IF NOT EXISTS `profile_check` (
1059 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1060 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1061 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
1062 `dfrn_id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1063 `sec` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1064 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1066 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='DFRN remote auth use';
1069 -- TABLE profile_field
1071 CREATE TABLE IF NOT EXISTS `profile_field` (
1072 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1073 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner user id',
1074 `order` mediumint unsigned NOT NULL DEFAULT 1 COMMENT 'Field ordering per user',
1075 `psid` int unsigned COMMENT 'ID of the permission set of this profile field - 0 = public',
1076 `label` varchar(255) NOT NULL DEFAULT '' COMMENT 'Label of the field',
1077 `value` text COMMENT 'Value of the field',
1078 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
1079 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
1081 INDEX `uid` (`uid`),
1082 INDEX `order` (`order`),
1083 INDEX `psid` (`psid`)
1084 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Custom profile fields';
1087 -- TABLE push_subscriber
1089 CREATE TABLE IF NOT EXISTS `push_subscriber` (
1090 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1091 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1092 `callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1093 `topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1094 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1095 `push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1096 `last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
1097 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1098 `renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
1099 `secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1101 INDEX `next_try` (`next_try`)
1102 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Used for OStatus: Contains feed subscribers';
1107 CREATE TABLE IF NOT EXISTS `register` (
1108 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1109 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1110 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1111 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1112 `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1113 `language` varchar(16) NOT NULL DEFAULT '' COMMENT '',
1114 `note` text COMMENT '',
1116 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
1121 CREATE TABLE IF NOT EXISTS `search` (
1122 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1123 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1124 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1127 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
1132 CREATE TABLE IF NOT EXISTS `session` (
1133 `id` bigint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1134 `sid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
1135 `data` text COMMENT '',
1136 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1138 INDEX `sid` (`sid`(64)),
1139 INDEX `expire` (`expire`)
1140 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='web session storage';
1145 CREATE TABLE IF NOT EXISTS `term` (
1146 `tid` int unsigned NOT NULL auto_increment COMMENT '',
1147 `oid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1148 `otype` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1149 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1150 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1151 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1152 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1153 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1154 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1155 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
1156 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1158 INDEX `term_type` (`term`(64),`type`),
1159 INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`(32)),
1160 INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
1161 INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
1162 INDEX `guid` (`guid`(64))
1163 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='item taxonomy (categories, tags, etc.) table';
1168 CREATE TABLE IF NOT EXISTS `tag` (
1169 `id` int unsigned NOT NULL auto_increment COMMENT '',
1170 `name` varchar(96) NOT NULL DEFAULT '' COMMENT '',
1171 `url` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
1173 UNIQUE INDEX `type_name_url` (`name`,`url`),
1175 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='tags and mentions';
1178 -- TABLE post-category
1180 CREATE TABLE IF NOT EXISTS `post-category` (
1181 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
1182 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1183 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1184 `tid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1185 PRIMARY KEY(`uri-id`,`uid`,`type`,`tid`),
1186 INDEX `uri-id` (`tid`)
1187 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='post relation to categories';
1190 -- TABLE post-delivery-data
1192 CREATE TABLE IF NOT EXISTS `post-delivery-data` (
1193 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
1194 `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',
1195 `inform` mediumtext COMMENT 'Additional receivers of the linked item',
1196 `queue_count` mediumint NOT NULL DEFAULT 0 COMMENT 'Initial number of delivery recipients, used as item.delivery_queue_count',
1197 `queue_done` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries, used as item.delivery_queue_done',
1198 `queue_failed` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of unsuccessful deliveries, used as item.delivery_queue_failed',
1199 `activitypub` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via ActivityPub',
1200 `dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via DFRN',
1201 `legacy_dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via legacy DFRN',
1202 `diaspora` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via Diaspora',
1203 `ostatus` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via OStatus',
1204 PRIMARY KEY(`uri-id`)
1205 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items';
1210 CREATE TABLE IF NOT EXISTS `post-tag` (
1211 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
1212 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1213 `tid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1214 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the mentioned public contact',
1215 PRIMARY KEY(`uri-id`,`type`,`tid`,`cid`),
1216 INDEX `uri-id` (`tid`),
1218 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='post relation to tags';
1223 CREATE TABLE IF NOT EXISTS `thread` (
1224 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'sequential ID',
1225 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1226 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1227 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
1228 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item author',
1229 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1230 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1231 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1232 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1233 `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1234 `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
1235 `private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
1236 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
1237 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
1238 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
1239 `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
1240 `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
1241 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
1242 `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
1243 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
1244 `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
1245 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1246 `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
1247 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
1248 `bookmark` boolean COMMENT '',
1250 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
1251 INDEX `uid_network_received` (`uid`,`network`,`received`),
1252 INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
1253 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
1254 INDEX `contactid` (`contact-id`),
1255 INDEX `ownerid` (`owner-id`),
1256 INDEX `authorid` (`author-id`),
1257 INDEX `uid_received` (`uid`,`received`),
1258 INDEX `uid_commented` (`uid`,`commented`),
1259 INDEX `uid_wall_received` (`uid`,`wall`,`received`),
1260 INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`)
1261 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Thread related data';
1266 CREATE TABLE IF NOT EXISTS `tokens` (
1267 `id` varchar(40) NOT NULL COMMENT '',
1268 `secret` text COMMENT '',
1269 `client_id` varchar(20) NOT NULL DEFAULT '',
1270 `expires` int NOT NULL DEFAULT 0 COMMENT '',
1271 `scope` varchar(200) NOT NULL DEFAULT '' COMMENT '',
1272 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1274 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
1279 CREATE TABLE IF NOT EXISTS `user` (
1280 `uid` mediumint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1281 `parent-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'The parent user that has full control about this user',
1282 `guid` varchar(64) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this user',
1283 `username` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this user is known by',
1284 `password` varchar(255) NOT NULL DEFAULT '' COMMENT 'encrypted password',
1285 `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?',
1286 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT 'nick- and user name',
1287 `email` varchar(255) NOT NULL DEFAULT '' COMMENT 'the users email address',
1288 `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1289 `timezone` varchar(128) NOT NULL DEFAULT '' COMMENT 'PHP-legal timezone',
1290 `language` varchar(32) NOT NULL DEFAULT 'en' COMMENT 'default language',
1291 `register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of registration',
1292 `login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last login',
1293 `default-location` varchar(255) NOT NULL DEFAULT '' COMMENT 'Default for item.location',
1294 `allow_location` boolean NOT NULL DEFAULT '0' COMMENT '1 allows to display the location',
1295 `theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
1296 `pubkey` text COMMENT 'RSA public key 4096 bit',
1297 `prvkey` text COMMENT 'RSA private key 4096 bit',
1298 `spubkey` text COMMENT '',
1299 `sprvkey` text COMMENT '',
1300 `verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
1301 `blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
1302 `blockwall` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to post to the profile page of the user',
1303 `hidewall` boolean NOT NULL DEFAULT '0' COMMENT 'Hide profile details from unkown viewers',
1304 `blocktags` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to tag the post of this user',
1305 `unkmail` boolean NOT NULL DEFAULT '0' COMMENT 'Permit unknown people to send private mails to this user',
1306 `cntunkmail` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1307 `notify-flags` smallint unsigned NOT NULL DEFAULT 65535 COMMENT 'email notification options',
1308 `page-flags` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'page/profile type',
1309 `account-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1310 `prvnets` boolean NOT NULL DEFAULT '0' COMMENT '',
1311 `pwdreset` varchar(255) COMMENT 'Password reset request token',
1312 `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
1313 `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1314 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1315 `account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed',
1316 `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
1317 `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted',
1318 `expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last warning of account expiration',
1319 `def_gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1320 `allow_cid` mediumtext COMMENT 'default permission for this user',
1321 `allow_gid` mediumtext COMMENT 'default permission for this user',
1322 `deny_cid` mediumtext COMMENT 'default permission for this user',
1323 `deny_gid` mediumtext COMMENT 'default permission for this user',
1324 `openidserver` text COMMENT '',
1326 INDEX `nickname` (`nickname`(32))
1327 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='The local users';
1332 CREATE TABLE IF NOT EXISTS `userd` (
1333 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1334 `username` varchar(255) NOT NULL COMMENT '',
1336 INDEX `username` (`username`(32))
1337 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Deleted usernames';
1340 -- TABLE user-contact
1342 CREATE TABLE IF NOT EXISTS `user-contact` (
1343 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the linked public contact',
1344 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1345 `blocked` boolean COMMENT 'Contact is completely blocked for this user',
1346 `ignored` boolean COMMENT 'Posts from this contact are ignored',
1347 `collapsed` boolean COMMENT 'Posts from this contact are collapsed',
1348 PRIMARY KEY(`uid`,`cid`)
1349 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific public contact data';
1354 CREATE TABLE IF NOT EXISTS `user-item` (
1355 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item id',
1356 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1357 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Marker to hide an item from the user',
1358 `ignored` boolean COMMENT 'Ignore this thread if set',
1359 `pinned` boolean COMMENT 'The item is pinned on the profile page',
1360 `notification-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1361 PRIMARY KEY(`uid`,`iid`),
1362 INDEX `uid_pinned` (`uid`,`pinned`),
1363 INDEX `iid_uid` (`iid`,`uid`)
1364 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
1369 CREATE TABLE IF NOT EXISTS `verb` (
1370 `id` int unsigned NOT NULL auto_increment,
1371 `name` varchar(100) NOT NULL DEFAULT '' COMMENT '',
1373 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activity Verbs';
1378 CREATE TABLE IF NOT EXISTS `worker-ipc` (
1379 `key` int NOT NULL COMMENT '',
1380 `jobs` boolean COMMENT 'Flag for outstanding jobs',
1382 ) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Inter process communication between the frontend and the worker';
1385 -- TABLE workerqueue
1387 CREATE TABLE IF NOT EXISTS `workerqueue` (
1388 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id',
1389 `parameter` mediumtext COMMENT 'Task command',
1390 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority',
1391 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
1392 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
1393 `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
1394 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1395 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1396 `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
1398 INDEX `done_parameter` (`done`,`parameter`(64)),
1399 INDEX `done_executed` (`done`,`executed`),
1400 INDEX `done_priority_created` (`done`,`priority`,`created`),
1401 INDEX `done_priority_next_try` (`done`,`priority`,`next_try`),
1402 INDEX `done_pid_next_try` (`done`,`pid`,`next_try`),
1403 INDEX `done_pid_priority_created` (`done`,`pid`,`priority`,`created`)
1404 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
1409 CREATE TABLE IF NOT EXISTS `storage` (
1410 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented image data id',
1411 `data` longblob NOT NULL COMMENT 'file data',
1413 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Data stored by Database storage backend';
1416 -- VIEW category-view
1418 DROP VIEW IF EXISTS `category-view`;
1419 CREATE VIEW `category-view` AS SELECT
1420 `post-category`.`uri-id` AS `uri-id`,
1421 `post-category`.`uid` AS `uid`,
1422 `item-uri`.`uri` AS `uri`,
1423 `item-uri`.`guid` AS `guid`,
1424 `post-category`.`type` AS `type`,
1425 `post-category`.`tid` AS `tid`,
1426 `tag`.`name` AS `name`,
1427 `tag`.`url` AS `url`
1428 FROM `post-category`
1429 INNER JOIN `item-uri` ON `item-uri`.id = `post-category`.`uri-id`
1430 LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`;
1435 DROP VIEW IF EXISTS `tag-view`;
1436 CREATE VIEW `tag-view` AS SELECT
1437 `post-tag`.`uri-id` AS `uri-id`,
1438 `item-uri`.`uri` AS `uri`,
1439 `item-uri`.`guid` AS `guid`,
1440 `post-tag`.`type` AS `type`,
1441 `post-tag`.`tid` AS `tid`,
1442 `post-tag`.`cid` AS `cid`,
1443 CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END AS `name`,
1444 CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END AS `url`
1446 INNER JOIN `item-uri` ON `item-uri`.id = `post-tag`.`uri-id`
1447 LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
1448 LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`;
1453 DROP VIEW IF EXISTS `owner-view`;
1454 CREATE VIEW `owner-view` AS SELECT
1455 `contact`.`id` AS `id`,
1456 `contact`.`uid` AS `uid`,
1457 `contact`.`created` AS `created`,
1458 `contact`.`updated` AS `updated`,
1459 `contact`.`self` AS `self`,
1460 `contact`.`remote_self` AS `remote_self`,
1461 `contact`.`rel` AS `rel`,
1462 `contact`.`duplex` AS `duplex`,
1463 `contact`.`network` AS `network`,
1464 `contact`.`protocol` AS `protocol`,
1465 `contact`.`name` AS `name`,
1466 `contact`.`nick` AS `nick`,
1467 `contact`.`location` AS `location`,
1468 `contact`.`about` AS `about`,
1469 `contact`.`keywords` AS `keywords`,
1470 `contact`.`gender` AS `gender`,
1471 `contact`.`xmpp` AS `xmpp`,
1472 `contact`.`attag` AS `attag`,
1473 `contact`.`avatar` AS `avatar`,
1474 `contact`.`photo` AS `photo`,
1475 `contact`.`thumb` AS `thumb`,
1476 `contact`.`micro` AS `micro`,
1477 `contact`.`site-pubkey` AS `site-pubkey`,
1478 `contact`.`issued-id` AS `issued-id`,
1479 `contact`.`dfrn-id` AS `dfrn-id`,
1480 `contact`.`url` AS `url`,
1481 `contact`.`nurl` AS `nurl`,
1482 `contact`.`addr` AS `addr`,
1483 `contact`.`alias` AS `alias`,
1484 `contact`.`pubkey` AS `pubkey`,
1485 `contact`.`prvkey` AS `prvkey`,
1486 `contact`.`batch` AS `batch`,
1487 `contact`.`request` AS `request`,
1488 `contact`.`notify` AS `notify`,
1489 `contact`.`poll` AS `poll`,
1490 `contact`.`confirm` AS `confirm`,
1491 `contact`.`poco` AS `poco`,
1492 `contact`.`aes_allow` AS `aes_allow`,
1493 `contact`.`ret-aes` AS `ret-aes`,
1494 `contact`.`usehub` AS `usehub`,
1495 `contact`.`subhub` AS `subhub`,
1496 `contact`.`hub-verify` AS `hub-verify`,
1497 `contact`.`last-update` AS `last-update`,
1498 `contact`.`success_update` AS `success_update`,
1499 `contact`.`failure_update` AS `failure_update`,
1500 `contact`.`name-date` AS `name-date`,
1501 `contact`.`uri-date` AS `uri-date`,
1502 `contact`.`avatar-date` AS `avatar-date`,
1503 `contact`.`avatar-date` AS `picdate`,
1504 `contact`.`term-date` AS `term-date`,
1505 `contact`.`last-item` AS `last-item`,
1506 `contact`.`priority` AS `priority`,
1507 `contact`.`blocked` AS `blocked`,
1508 `contact`.`block_reason` AS `block_reason`,
1509 `contact`.`readonly` AS `readonly`,
1510 `contact`.`writable` AS `writable`,
1511 `contact`.`forum` AS `forum`,
1512 `contact`.`prv` AS `prv`,
1513 `contact`.`contact-type` AS `contact-type`,
1514 `contact`.`hidden` AS `hidden`,
1515 `contact`.`archive` AS `archive`,
1516 `contact`.`pending` AS `pending`,
1517 `contact`.`deleted` AS `deleted`,
1518 `contact`.`rating` AS `rating`,
1519 `contact`.`unsearchable` AS `unsearchable`,
1520 `contact`.`sensitive` AS `sensitive`,
1521 `contact`.`baseurl` AS `baseurl`,
1522 `contact`.`reason` AS `reason`,
1523 `contact`.`closeness` AS `closeness`,
1524 `contact`.`info` AS `info`,
1525 `contact`.`profile-id` AS `profile-id`,
1526 `contact`.`bdyear` AS `bdyear`,
1527 `contact`.`bd` AS `bd`,
1528 `contact`.`notify_new_posts` AS `notify_new_posts`,
1529 `contact`.`fetch_further_information` AS `fetch_further_information`,
1530 `contact`.`ffi_keyword_blacklist` AS `ffi_keyword_blacklist`,
1531 `user`.`parent-uid` AS `parent-uid`,
1532 `user`.`guid` AS `guid`,
1533 `user`.`nickname` AS `nickname`,
1534 `user`.`email` AS `email`,
1535 `user`.`openid` AS `openid`,
1536 `user`.`timezone` AS `timezone`,
1537 `user`.`language` AS `language`,
1538 `user`.`register_date` AS `register_date`,
1539 `user`.`login_date` AS `login_date`,
1540 `user`.`default-location` AS `default-location`,
1541 `user`.`allow_location` AS `allow_location`,
1542 `user`.`theme` AS `theme`,
1543 `user`.`pubkey` AS `upubkey`,
1544 `user`.`prvkey` AS `uprvkey`,
1545 `user`.`sprvkey` AS `sprvkey`,
1546 `user`.`spubkey` AS `spubkey`,
1547 `user`.`verified` AS `verified`,
1548 `user`.`blockwall` AS `blockwall`,
1549 `user`.`hidewall` AS `hidewall`,
1550 `user`.`blocktags` AS `blocktags`,
1551 `user`.`unkmail` AS `unkmail`,
1552 `user`.`cntunkmail` AS `cntunkmail`,
1553 `user`.`notify-flags` AS `notify-flags`,
1554 `user`.`page-flags` AS `page-flags`,
1555 `user`.`account-type` AS `account-type`,
1556 `user`.`prvnets` AS `prvnets`,
1557 `user`.`maxreq` AS `maxreq`,
1558 `user`.`expire` AS `expire`,
1559 `user`.`account_removed` AS `account_removed`,
1560 `user`.`account_expired` AS `account_expired`,
1561 `user`.`account_expires_on` AS `account_expires_on`,
1562 `user`.`expire_notification_sent` AS `expire_notification_sent`,
1563 `user`.`def_gid` AS `def_gid`,
1564 `user`.`allow_cid` AS `allow_cid`,
1565 `user`.`allow_gid` AS `allow_gid`,
1566 `user`.`deny_cid` AS `deny_cid`,
1567 `user`.`deny_gid` AS `deny_gid`,
1568 `user`.`openidserver` AS `openidserver`,
1569 `profile`.`publish` AS `publish`,
1570 `profile`.`net-publish` AS `net-publish`,
1571 `profile`.`hide-friends` AS `hide-friends`,
1572 `profile`.`prv_keywords` AS `prv_keywords`,
1573 `profile`.`pub_keywords` AS `pub_keywords`,
1574 `profile`.`address` AS `address`,
1575 `profile`.`locality` AS `locality`,
1576 `profile`.`region` AS `region`,
1577 `profile`.`postal-code` AS `postal-code`,
1578 `profile`.`country-name` AS `country-name`,
1579 `profile`.`homepage` AS `homepage`,
1580 `profile`.`dob` AS `dob`
1582 INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
1583 INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`;
1586 -- VIEW pending-view
1588 DROP VIEW IF EXISTS `pending-view`;
1589 CREATE VIEW `pending-view` AS SELECT
1590 `register`.`id` AS `id`,
1591 `register`.`hash` AS `hash`,
1592 `register`.`created` AS `created`,
1593 `register`.`uid` AS `uid`,
1594 `register`.`password` AS `password`,
1595 `register`.`language` AS `language`,
1596 `register`.`note` AS `note`,
1597 `contact`.`self` AS `self`,
1598 `contact`.`name` AS `name`,
1599 `contact`.`url` AS `url`,
1600 `contact`.`micro` AS `micro`,
1601 `user`.`email` AS `email`,
1602 `contact`.`nick` AS `nick`
1604 INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
1605 INNER JOIN `user` ON `register`.`uid` = `user`.`uid`;
1608 -- VIEW tag-search-view
1610 DROP VIEW IF EXISTS `tag-search-view`;
1611 CREATE VIEW `tag-search-view` AS SELECT
1612 `post-tag`.`uri-id` AS `uri-id`,
1613 `item`.`id` AS `iid`,
1614 `item`.`uri` AS `uri`,
1615 `item`.`guid` AS `guid`,
1616 `item`.`uid` AS `uid`,
1617 `item`.`private` AS `private`,
1618 `item`.`wall` AS `wall`,
1619 `item`.`origin` AS `origin`,
1620 `item`.`gravity` AS `gravity`,
1621 `item`.`received` AS `received`,
1622 `tag`.`name` AS `name`
1624 INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
1625 INNER JOIN `item` ON `item`.`uri-id` = `post-tag`.`uri-id`
1626 WHERE `post-tag`.`type` = 1;
1629 -- VIEW workerqueue-view
1631 DROP VIEW IF EXISTS `workerqueue-view`;
1632 CREATE VIEW `workerqueue-view` AS SELECT
1633 `process`.`pid` AS `pid`,
1634 `workerqueue`.`priority` AS `priority`
1636 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
1637 WHERE NOT `workerqueue`.`done`;