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