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