1 -- ------------------------------------------
2 -- Friendica 2020.09-dev (Red Hot Poker)
3 -- DB_UPDATE_VERSION 1358
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 '',
31 `failed` boolean COMMENT 'Connection failed',
33 UNIQUE INDEX `nurl` (`nurl`(190))
34 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Global servers';
39 CREATE TABLE IF NOT EXISTS `clients` (
40 `client_id` varchar(20) NOT NULL COMMENT '',
41 `pw` varchar(20) NOT NULL DEFAULT '' COMMENT '',
42 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
43 `name` text COMMENT '',
44 `icon` text COMMENT '',
45 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
46 PRIMARY KEY(`client_id`)
47 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
52 CREATE TABLE IF NOT EXISTS `contact` (
53 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
54 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
55 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
56 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last contact update',
57 `self` boolean NOT NULL DEFAULT '0' COMMENT '1 if the contact is the user him/her self',
58 `remote_self` boolean NOT NULL DEFAULT '0' COMMENT '',
59 `rel` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'The kind of the relation between the user and the contact',
60 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
61 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network of the contact',
62 `protocol` char(4) NOT NULL DEFAULT '' COMMENT 'Protocol of the contact',
63 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
64 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
65 `location` varchar(255) DEFAULT '' COMMENT '',
66 `about` text COMMENT '',
67 `keywords` text COMMENT 'public keywords (interests) of the contact',
68 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT 'Deprecated',
69 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
70 `attag` varchar(255) NOT NULL DEFAULT '' COMMENT '',
71 `avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
72 `photo` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo of the contact',
73 `thumb` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (thumb size)',
74 `micro` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (micro size)',
75 `site-pubkey` text COMMENT '',
76 `issued-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
77 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
78 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
79 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
80 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
81 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
82 `pubkey` text COMMENT 'RSA public key 4096 bit',
83 `prvkey` text COMMENT 'RSA private key 4096 bit',
84 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
85 `request` varchar(255) COMMENT '',
86 `notify` varchar(255) COMMENT '',
87 `poll` varchar(255) COMMENT '',
88 `confirm` varchar(255) COMMENT '',
89 `subscribe` varchar(255) COMMENT '',
90 `poco` varchar(255) COMMENT '',
91 `aes_allow` boolean NOT NULL DEFAULT '0' COMMENT '',
92 `ret-aes` boolean NOT NULL DEFAULT '0' COMMENT '',
93 `usehub` boolean NOT NULL DEFAULT '0' COMMENT '',
94 `subhub` boolean NOT NULL DEFAULT '0' COMMENT '',
95 `hub-verify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
96 `last-update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last try to update the contact info',
97 `success_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful contact update',
98 `failure_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed update',
99 `failed` boolean COMMENT 'Connection failed',
100 `name-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
101 `uri-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
102 `avatar-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
103 `term-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
104 `last-item` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'date of the last post',
105 `last-discovery` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'date of the last follower discovery',
106 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
107 `blocked` boolean NOT NULL DEFAULT '1' COMMENT 'Node-wide block status',
108 `block_reason` text COMMENT 'Node-wide block reason',
109 `readonly` boolean NOT NULL DEFAULT '0' COMMENT 'posts of the contact are readonly',
110 `writable` boolean NOT NULL DEFAULT '0' COMMENT '',
111 `forum` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a forum',
112 `prv` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a private group',
113 `contact-type` tinyint NOT NULL DEFAULT 0 COMMENT '',
114 `hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
115 `archive` boolean NOT NULL DEFAULT '0' COMMENT '',
116 `pending` boolean NOT NULL DEFAULT '1' COMMENT '',
117 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'Contact has been deleted',
118 `rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
119 `unsearchable` boolean NOT NULL DEFAULT '0' COMMENT 'Contact prefers to not be searchable',
120 `sensitive` boolean NOT NULL DEFAULT '0' COMMENT 'Contact posts sensitive content',
121 `baseurl` varchar(255) DEFAULT '' COMMENT 'baseurl of the contact',
122 `gsid` int unsigned COMMENT 'Global Server ID',
123 `reason` text COMMENT '',
124 `closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
125 `info` mediumtext COMMENT '',
126 `profile-id` int unsigned COMMENT 'Deprecated',
127 `bdyear` varchar(4) NOT NULL DEFAULT '' COMMENT '',
128 `bd` date NOT NULL DEFAULT '0001-01-01' COMMENT '',
129 `notify_new_posts` boolean NOT NULL DEFAULT '0' COMMENT '',
130 `fetch_further_information` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
131 `ffi_keyword_denylist` text COMMENT '',
133 INDEX `uid_name` (`uid`,`name`(190)),
134 INDEX `self_uid` (`self`,`uid`),
135 INDEX `alias_uid` (`alias`(32),`uid`),
136 INDEX `pending_uid` (`pending`,`uid`),
137 INDEX `blocked_uid` (`blocked`,`uid`),
138 INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
139 INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
140 INDEX `addr_uid` (`addr`(32),`uid`),
141 INDEX `nurl_uid` (`nurl`(32),`uid`),
142 INDEX `nick_uid` (`nick`(32),`uid`),
143 INDEX `attag_uid` (`attag`(32),`uid`),
144 INDEX `dfrn-id` (`dfrn-id`(64)),
145 INDEX `issued-id` (`issued-id`(64)),
146 INDEX `network_uid_lastupdate` (`network`,`uid`,`last-update`),
147 INDEX `uid_lastitem` (`uid`,`last-item`),
148 INDEX `gsid` (`gsid`),
149 FOREIGN KEY (`gsid`) REFERENCES `gserver` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
150 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contact table';
155 CREATE TABLE IF NOT EXISTS `item-uri` (
156 `id` int unsigned NOT NULL auto_increment,
157 `uri` varbinary(255) NOT NULL COMMENT 'URI of an item',
158 `guid` varbinary(255) COMMENT 'A unique identifier for an item',
160 UNIQUE INDEX `uri` (`uri`),
161 INDEX `guid` (`guid`)
162 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='URI and GUID for items';
165 -- TABLE permissionset
167 CREATE TABLE IF NOT EXISTS `permissionset` (
168 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
169 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id of this permission set',
170 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
171 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
172 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
173 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
175 INDEX `uid_allow_cid_allow_gid_deny_cid_deny_gid` (`allow_cid`(50),`allow_gid`(30),`deny_cid`(50),`deny_gid`(30))
176 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
181 CREATE TABLE IF NOT EXISTS `tag` (
182 `id` int unsigned NOT NULL auto_increment COMMENT '',
183 `name` varchar(96) NOT NULL DEFAULT '' COMMENT '',
184 `url` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
186 UNIQUE INDEX `type_name_url` (`name`,`url`),
188 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='tags and mentions';
191 -- TABLE 2fa_app_specific_password
193 CREATE TABLE IF NOT EXISTS `2fa_app_specific_password` (
194 `id` mediumint unsigned NOT NULL auto_increment COMMENT 'Password ID for revocation',
195 `uid` mediumint unsigned NOT NULL COMMENT 'User ID',
196 `description` varchar(255) COMMENT 'Description of the usage of the password',
197 `hashed_password` varchar(255) NOT NULL COMMENT 'Hashed password',
198 `generated` datetime NOT NULL COMMENT 'Datetime the password was generated',
199 `last_used` datetime COMMENT 'Datetime the password was last used',
201 INDEX `uid_description` (`uid`,`description`(190))
202 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor app-specific _password';
205 -- TABLE 2fa_recovery_codes
207 CREATE TABLE IF NOT EXISTS `2fa_recovery_codes` (
208 `uid` mediumint unsigned NOT NULL COMMENT 'User ID',
209 `code` varchar(50) NOT NULL COMMENT 'Recovery code string',
210 `generated` datetime NOT NULL COMMENT 'Datetime the code was generated',
211 `used` datetime COMMENT 'Datetime the code was used',
212 PRIMARY KEY(`uid`,`code`)
213 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor authentication recovery codes';
218 CREATE TABLE IF NOT EXISTS `addon` (
219 `id` int unsigned NOT NULL auto_increment COMMENT '',
220 `name` varchar(50) NOT NULL DEFAULT '' COMMENT 'addon base (file)name',
221 `version` varchar(50) NOT NULL DEFAULT '' COMMENT 'currently unused',
222 `installed` boolean NOT NULL DEFAULT '0' COMMENT 'currently always 1',
223 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'currently unused',
224 `timestamp` int unsigned NOT NULL DEFAULT 0 COMMENT 'file timestamp to check for reloads',
225 `plugin_admin` boolean NOT NULL DEFAULT '0' COMMENT '1 = has admin config, 0 = has no admin config',
227 UNIQUE INDEX `name` (`name`)
228 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registered addons';
233 CREATE TABLE IF NOT EXISTS `apcontact` (
234 `url` varbinary(255) NOT NULL COMMENT 'URL of the contact',
235 `uuid` varchar(255) COMMENT '',
236 `type` varchar(20) NOT NULL COMMENT '',
237 `following` varchar(255) COMMENT '',
238 `followers` varchar(255) COMMENT '',
239 `inbox` varchar(255) NOT NULL COMMENT '',
240 `outbox` varchar(255) COMMENT '',
241 `sharedinbox` varchar(255) COMMENT '',
242 `manually-approve` boolean COMMENT '',
243 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
244 `name` varchar(255) COMMENT '',
245 `about` text COMMENT '',
246 `photo` varchar(255) COMMENT '',
247 `addr` varchar(255) COMMENT '',
248 `alias` varchar(255) COMMENT '',
249 `pubkey` text COMMENT '',
250 `subscribe` varchar(255) COMMENT '',
251 `baseurl` varchar(255) COMMENT 'baseurl of the ap contact',
252 `gsid` int unsigned COMMENT 'Global Server ID',
253 `generator` varchar(255) COMMENT 'Name of the contact\'s system',
254 `following_count` int unsigned DEFAULT 0 COMMENT 'Number of following contacts',
255 `followers_count` int unsigned DEFAULT 0 COMMENT 'Number of followers',
256 `statuses_count` int unsigned DEFAULT 0 COMMENT 'Number of posts',
257 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
259 INDEX `addr` (`addr`(32)),
260 INDEX `alias` (`alias`(190)),
261 INDEX `followers` (`followers`(190)),
262 INDEX `baseurl` (`baseurl`(190)),
263 INDEX `gsid` (`gsid`),
264 FOREIGN KEY (`gsid`) REFERENCES `gserver` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
265 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='ActivityPub compatible contacts - used in the ActivityPub implementation';
270 CREATE TABLE IF NOT EXISTS `attach` (
271 `id` int unsigned NOT NULL auto_increment COMMENT 'generated index',
272 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
273 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT 'hash',
274 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT 'filename of original',
275 `filetype` varchar(64) NOT NULL DEFAULT '' COMMENT 'mimetype',
276 `filesize` int unsigned NOT NULL DEFAULT 0 COMMENT 'size in bytes',
277 `data` longblob NOT NULL COMMENT 'file data',
278 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
279 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
280 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>',
281 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
282 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
283 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
284 `backend-class` tinytext COMMENT 'Storage backend class',
285 `backend-ref` text COMMENT 'Storage backend data reference',
287 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='file attachments';
292 CREATE TABLE IF NOT EXISTS `auth_codes` (
293 `id` varchar(40) NOT NULL COMMENT '',
294 `client_id` varchar(20) NOT NULL DEFAULT '' COMMENT '',
295 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
296 `expires` int NOT NULL DEFAULT 0 COMMENT '',
297 `scope` varchar(250) NOT NULL DEFAULT '' COMMENT '',
299 INDEX `client_id` (`client_id`),
300 FOREIGN KEY (`client_id`) REFERENCES `clients` (`client_id`) ON UPDATE RESTRICT ON DELETE CASCADE
301 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
306 CREATE TABLE IF NOT EXISTS `cache` (
307 `k` varbinary(255) NOT NULL COMMENT 'cache key',
308 `v` mediumtext COMMENT 'cached serialized value',
309 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
310 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache insertion',
312 INDEX `k_expires` (`k`,`expires`)
313 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Stores temporary data';
318 CREATE TABLE IF NOT EXISTS `challenge` (
319 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
320 `challenge` varchar(255) NOT NULL DEFAULT '' COMMENT '',
321 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
322 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
323 `type` varchar(255) NOT NULL DEFAULT '' COMMENT '',
324 `last_update` varchar(255) NOT NULL DEFAULT '' COMMENT '',
326 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
331 CREATE TABLE IF NOT EXISTS `config` (
332 `id` int unsigned NOT NULL auto_increment COMMENT '',
333 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
334 `k` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
335 `v` mediumtext COMMENT '',
337 UNIQUE INDEX `cat_k` (`cat`,`k`)
338 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='main configuration storage';
341 -- TABLE contact-relation
343 CREATE TABLE IF NOT EXISTS `contact-relation` (
344 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact the related contact had interacted with',
345 `relation-cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'related contact who had interacted with the contact',
346 `last-interaction` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last interaction',
347 `follow-updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last update of the contact relationship',
348 `follows` boolean NOT NULL DEFAULT '0' COMMENT '',
349 PRIMARY KEY(`cid`,`relation-cid`),
350 INDEX `relation-cid` (`relation-cid`),
351 FOREIGN KEY (`cid`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
352 FOREIGN KEY (`relation-cid`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
353 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Contact relations';
358 CREATE TABLE IF NOT EXISTS `conv` (
359 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
360 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this conversation',
361 `recips` text COMMENT 'sender_handle;recipient_handle',
362 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
363 `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'handle of creator',
364 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation timestamp',
365 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'edited timestamp',
366 `subject` text COMMENT 'subject of initial message',
369 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
372 -- TABLE conversation
374 CREATE TABLE IF NOT EXISTS `conversation` (
375 `item-uri` varbinary(255) NOT NULL COMMENT 'Original URI of the item - unrelated to the table with the same name',
376 `reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'URI to which this item is a reply',
377 `conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
378 `conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
379 `protocol` tinyint unsigned NOT NULL DEFAULT 255 COMMENT 'The protocol of the item',
380 `direction` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'How the message arrived here: 1=push, 2=pull',
381 `source` mediumtext COMMENT 'Original source',
382 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
383 PRIMARY KEY(`item-uri`),
384 INDEX `conversation-uri` (`conversation-uri`),
385 INDEX `received` (`received`)
386 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
389 -- TABLE diaspora-interaction
391 CREATE TABLE IF NOT EXISTS `diaspora-interaction` (
392 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
393 `interaction` mediumtext COMMENT 'The Diaspora interaction',
394 PRIMARY KEY(`uri-id`),
395 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
396 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Signed Diaspora Interaction';
401 CREATE TABLE IF NOT EXISTS `event` (
402 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
403 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
404 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
405 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact_id (ID of the contact in contact table)',
406 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
407 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
408 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
409 `start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event start time',
410 `finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event end time',
411 `summary` text COMMENT 'short description or title of the event',
412 `desc` text COMMENT 'event description',
413 `location` text COMMENT 'event location',
414 `type` varchar(20) NOT NULL DEFAULT '' COMMENT 'event or birthday',
415 `nofinish` boolean NOT NULL DEFAULT '0' COMMENT 'if event does have no end this is 1',
416 `adjust` boolean NOT NULL DEFAULT '1' COMMENT 'adjust to timezone of the recipient (0 or 1)',
417 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '0 or 1',
418 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
419 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
420 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
421 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
423 INDEX `uid_start` (`uid`,`start`)
424 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Events';
429 CREATE TABLE IF NOT EXISTS `fcontact` (
430 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
431 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'unique id',
432 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
433 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
434 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
435 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
436 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
437 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
438 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
439 `notify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
440 `poll` varchar(255) NOT NULL DEFAULT '' COMMENT '',
441 `confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '',
442 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
443 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
444 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
445 `pubkey` text COMMENT '',
446 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
448 INDEX `addr` (`addr`(32)),
449 UNIQUE INDEX `url` (`url`(190))
450 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora compatible contacts - used in the Diaspora implementation';
455 CREATE TABLE IF NOT EXISTS `fsuggest` (
456 `id` int unsigned NOT NULL auto_increment COMMENT '',
457 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
458 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
459 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
460 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
461 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
462 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
463 `note` text COMMENT '',
464 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
466 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='friend suggestion stuff';
471 CREATE TABLE IF NOT EXISTS `gcontact` (
472 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
473 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
474 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
475 `url` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the contacts profile page',
476 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
477 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the profile photo',
478 `connect` varchar(255) NOT NULL DEFAULT '' COMMENT '',
479 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
480 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
481 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
482 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
483 `last_discovery` datetime DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last contact discovery',
484 `failed` boolean COMMENT 'Connection failed',
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 `glink` (
518 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
519 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
520 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
521 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
522 `zcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
523 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
525 UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
526 INDEX `gcid` (`gcid`)
527 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='\'friends of friends\' linkages derived from poco';
532 CREATE TABLE IF NOT EXISTS `group` (
533 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
534 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
535 `visible` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the member list is not private',
536 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the group has been deleted',
537 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'human readable name of group',
540 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, group info';
543 -- TABLE group_member
545 CREATE TABLE IF NOT EXISTS `group_member` (
546 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
547 `gid` int unsigned NOT NULL DEFAULT 0 COMMENT 'groups.id of the associated group',
548 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id of the member assigned to the associated group',
550 INDEX `contactid` (`contact-id`),
551 UNIQUE INDEX `gid_contactid` (`gid`,`contact-id`)
552 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, member info';
557 CREATE TABLE IF NOT EXISTS `gserver-tag` (
558 `gserver-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'The id of the gserver',
559 `tag` varchar(100) NOT NULL DEFAULT '' COMMENT 'Tag that the server has subscribed',
560 PRIMARY KEY(`gserver-id`,`tag`),
562 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Tags that the server has subscribed';
567 CREATE TABLE IF NOT EXISTS `hook` (
568 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
569 `hook` varbinary(100) NOT NULL DEFAULT '' COMMENT 'name of hook',
570 `file` varbinary(200) NOT NULL DEFAULT '' COMMENT 'relative filename of hook handler',
571 `function` varbinary(200) NOT NULL DEFAULT '' COMMENT 'function name of hook handler',
572 `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',
574 UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
575 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='addon hook registry';
578 -- TABLE inbox-status
580 CREATE TABLE IF NOT EXISTS `inbox-status` (
581 `url` varbinary(255) NOT NULL COMMENT 'URL of the inbox',
582 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date of this entry',
583 `success` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful delivery',
584 `failure` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed delivery',
585 `previous` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Previous delivery date',
586 `archive` boolean NOT NULL DEFAULT '0' COMMENT 'Is the inbox archived?',
587 `shared` boolean NOT NULL DEFAULT '0' COMMENT 'Is it a shared inbox?',
589 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Status of ActivityPub inboxes';
594 CREATE TABLE IF NOT EXISTS `intro` (
595 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
596 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
597 `fid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
598 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
599 `knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
600 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
601 `note` text COMMENT '',
602 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
603 `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
604 `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
605 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
607 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
612 CREATE TABLE IF NOT EXISTS `item` (
613 `id` int unsigned NOT NULL auto_increment,
614 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this item',
615 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
616 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
617 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
618 `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',
619 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT 'uri of the parent to this item',
620 `parent-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the parent uri',
621 `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',
622 `thr-parent-id` int unsigned COMMENT 'Id of the item-uri table that contains the thread parent uri',
623 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation timestamp.',
624 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last edit (default is created)',
625 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last comment/reply to this item',
626 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime',
627 `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',
628 `gravity` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
629 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network from where the item comes from',
630 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
631 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
632 `icid` int unsigned COMMENT 'Id of the item-content table entry that contains the whole item content',
633 `iaid` int unsigned COMMENT 'Id of the item-activity table entry that contains the activity data',
634 `vid` smallint unsigned COMMENT 'Id of the verb table entry that contains the activity verbs',
635 `extid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
636 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
637 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
638 `private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
639 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
640 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
641 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'item has been deleted',
642 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id which owns this copy of the item',
643 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
644 `wall` boolean NOT NULL DEFAULT '0' COMMENT 'This item was posted to the wall of uid',
645 `origin` boolean NOT NULL DEFAULT '0' COMMENT 'item originated at this site',
646 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
647 `starred` boolean NOT NULL DEFAULT '0' COMMENT 'item has been favourited',
648 `unseen` boolean NOT NULL DEFAULT '1' COMMENT 'item has not been seen',
649 `mention` boolean NOT NULL DEFAULT '0' COMMENT 'The owner of this item was mentioned in it',
650 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
651 `psid` int unsigned COMMENT 'ID of the permission set of this post',
652 `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',
653 `event-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Used to link to the event.id',
654 `attach` mediumtext COMMENT 'JSON structure representing attachments to this item',
655 `allow_cid` mediumtext COMMENT 'Deprecated',
656 `allow_gid` mediumtext COMMENT 'Deprecated',
657 `deny_cid` mediumtext COMMENT 'Deprecated',
658 `deny_gid` mediumtext COMMENT 'Deprecated',
659 `postopts` text COMMENT 'Deprecated',
660 `inform` mediumtext COMMENT 'Deprecated',
661 `type` varchar(20) COMMENT 'Deprecated',
662 `bookmark` boolean COMMENT 'Deprecated',
663 `file` mediumtext COMMENT 'Deprecated',
664 `location` varchar(255) COMMENT 'Deprecated',
665 `coord` varchar(255) COMMENT 'Deprecated',
666 `tag` mediumtext COMMENT 'Deprecated',
667 `plink` varchar(255) COMMENT 'Deprecated',
668 `title` varchar(255) COMMENT 'Deprecated',
669 `content-warning` varchar(255) COMMENT 'Deprecated',
670 `body` mediumtext COMMENT 'Deprecated',
671 `app` varchar(255) COMMENT 'Deprecated',
672 `verb` varchar(100) COMMENT 'Deprecated',
673 `object-type` varchar(100) COMMENT 'Deprecated',
674 `object` text COMMENT 'Deprecated',
675 `target-type` varchar(100) COMMENT 'Deprecated',
676 `target` text COMMENT 'Deprecated',
677 `author-name` varchar(255) COMMENT 'Deprecated',
678 `author-link` varchar(255) COMMENT 'Deprecated',
679 `author-avatar` varchar(255) COMMENT 'Deprecated',
680 `owner-name` varchar(255) COMMENT 'Deprecated',
681 `owner-link` varchar(255) COMMENT 'Deprecated',
682 `owner-avatar` varchar(255) COMMENT 'Deprecated',
683 `rendered-hash` varchar(32) COMMENT 'Deprecated',
684 `rendered-html` mediumtext COMMENT 'Deprecated',
686 INDEX `guid` (`guid`(191)),
687 INDEX `uri` (`uri`(191)),
688 INDEX `parent` (`parent`),
689 INDEX `parent-uri` (`parent-uri`(191)),
690 INDEX `extid` (`extid`(191)),
691 INDEX `uid_id` (`uid`,`id`),
692 INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
693 INDEX `uid_received` (`uid`,`received`),
694 INDEX `uid_commented` (`uid`,`commented`),
695 INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
696 INDEX `uid_network_received` (`uid`,`network`,`received`),
697 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
698 INDEX `uid_thrparent` (`uid`,`thr-parent`(190)),
699 INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
700 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
701 INDEX `authorid_received` (`author-id`,`received`),
702 INDEX `ownerid` (`owner-id`),
703 INDEX `contact-id` (`contact-id`),
704 INDEX `uid_uri` (`uid`,`uri`(190)),
705 INDEX `resource-id` (`resource-id`),
706 INDEX `deleted_changed` (`deleted`,`changed`),
707 INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
708 INDEX `mention_uid_id` (`mention`,`uid`,`id`),
709 INDEX `uid_eventid` (`uid`,`event-id`),
710 INDEX `icid` (`icid`),
711 INDEX `iaid` (`iaid`),
712 INDEX `psid_wall` (`psid`,`wall`),
713 INDEX `uri-id` (`uri-id`),
714 INDEX `parent-uri-id` (`parent-uri-id`),
715 INDEX `thr-parent-id` (`thr-parent-id`),
716 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
717 FOREIGN KEY (`parent-uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
718 FOREIGN KEY (`thr-parent-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
719 FOREIGN KEY (`psid`) REFERENCES `permissionset` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
720 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
723 -- TABLE item-activity
725 CREATE TABLE IF NOT EXISTS `item-activity` (
726 `id` int unsigned NOT NULL auto_increment,
727 `uri` varchar(255) COMMENT '',
728 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
729 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
730 `activity` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
732 UNIQUE INDEX `uri-hash` (`uri-hash`),
733 INDEX `uri` (`uri`(191)),
734 INDEX `uri-id` (`uri-id`),
735 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
736 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activities for items';
739 -- TABLE item-content
741 CREATE TABLE IF NOT EXISTS `item-content` (
742 `id` int unsigned NOT NULL auto_increment,
743 `uri` varchar(255) COMMENT '',
744 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
745 `uri-plink-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
746 `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'item title',
747 `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
748 `body` mediumtext COMMENT 'item body content',
749 `location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
750 `coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
751 `language` text COMMENT 'Language information about this post',
752 `app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
753 `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
754 `rendered-html` mediumtext COMMENT 'item.body converted to html',
755 `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams object type',
756 `object` text COMMENT 'JSON encoded object structure unless it is an implied object (normal post)',
757 `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
758 `target` text COMMENT 'JSON encoded target structure if used',
759 `plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
760 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams verb',
762 UNIQUE INDEX `uri-plink-hash` (`uri-plink-hash`),
763 INDEX `uri` (`uri`(191)),
764 INDEX `plink` (`plink`(191)),
765 INDEX `uri-id` (`uri-id`),
766 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
767 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
772 CREATE TABLE IF NOT EXISTS `locks` (
773 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
774 `name` varchar(128) NOT NULL DEFAULT '' COMMENT '',
775 `locked` boolean NOT NULL DEFAULT '0' COMMENT '',
776 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process ID',
777 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
779 INDEX `name_expires` (`name`,`expires`)
780 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
785 CREATE TABLE IF NOT EXISTS `mail` (
786 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
787 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
788 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
789 `from-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the sender',
790 `from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
791 `from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
792 `contact-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact.id',
793 `convid` int unsigned NOT NULL DEFAULT 0 COMMENT 'conv.id',
794 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
795 `body` mediumtext COMMENT '',
796 `seen` boolean NOT NULL DEFAULT '0' COMMENT 'if message visited it is 1',
797 `reply` boolean NOT NULL DEFAULT '0' COMMENT '',
798 `replied` boolean NOT NULL DEFAULT '0' COMMENT '',
799 `unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
800 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
801 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
802 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
804 INDEX `uid_seen` (`uid`,`seen`),
805 INDEX `convid` (`convid`),
806 INDEX `uri` (`uri`(64)),
807 INDEX `parent-uri` (`parent-uri`(64)),
808 INDEX `contactid` (`contact-id`(32))
809 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
814 CREATE TABLE IF NOT EXISTS `mailacct` (
815 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
816 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
817 `server` varchar(255) NOT NULL DEFAULT '' COMMENT '',
818 `port` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
819 `ssltype` varchar(16) NOT NULL DEFAULT '' COMMENT '',
820 `mailbox` varchar(255) NOT NULL DEFAULT '' COMMENT '',
821 `user` varchar(255) NOT NULL DEFAULT '' COMMENT '',
822 `pass` text COMMENT '',
823 `reply_to` varchar(255) NOT NULL DEFAULT '' COMMENT '',
824 `action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
825 `movetofolder` varchar(255) NOT NULL DEFAULT '' COMMENT '',
826 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
827 `last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
829 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Mail account data for fetching mails';
834 CREATE TABLE IF NOT EXISTS `manage` (
835 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
836 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
837 `mid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
839 UNIQUE INDEX `uid_mid` (`uid`,`mid`)
840 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='table of accounts that can manage each other';
845 CREATE TABLE IF NOT EXISTS `notify` (
846 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
847 `type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
848 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
849 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
850 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
851 `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
852 `msg` mediumtext COMMENT '',
853 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
854 `link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
855 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
856 `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
857 `uri-id` int unsigned COMMENT 'Item-uri id of the related post',
858 `parent-uri-id` int unsigned COMMENT 'Item-uri id of the parent of the related post',
859 `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
860 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
861 `otype` varchar(10) NOT NULL DEFAULT '' COMMENT '',
862 `name_cache` tinytext COMMENT 'Cached bbcode parsing of name',
863 `msg_cache` mediumtext COMMENT 'Cached bbcode parsing of msg',
865 INDEX `seen_uid_date` (`seen`,`uid`,`date`),
866 INDEX `uid_date` (`uid`,`date`),
867 INDEX `uid_type_link` (`uid`,`type`,`link`(190))
868 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='notifications';
871 -- TABLE notify-threads
873 CREATE TABLE IF NOT EXISTS `notify-threads` (
874 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
875 `notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
876 `master-parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
877 `master-parent-uri-id` int unsigned COMMENT 'Item-uri id of the parent of the related post',
878 `parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
879 `receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
881 INDEX `master-parent-uri-id` (`master-parent-uri-id`)
882 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
887 CREATE TABLE IF NOT EXISTS `oembed` (
888 `url` varbinary(255) NOT NULL COMMENT 'page url',
889 `maxwidth` mediumint unsigned NOT NULL COMMENT 'Maximum width passed to Oembed',
890 `content` mediumtext COMMENT 'OEmbed data of the page',
891 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
892 PRIMARY KEY(`url`,`maxwidth`),
893 INDEX `created` (`created`)
894 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for OEmbed queries';
897 -- TABLE openwebauth-token
899 CREATE TABLE IF NOT EXISTS `openwebauth-token` (
900 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
901 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
902 `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Verify type',
903 `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'A generated token',
904 `meta` varchar(255) NOT NULL DEFAULT '' COMMENT '',
905 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
907 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store OpenWebAuth token to verify contacts';
912 CREATE TABLE IF NOT EXISTS `parsed_url` (
913 `url` varbinary(255) NOT NULL COMMENT 'page url',
914 `guessing` boolean NOT NULL DEFAULT '0' COMMENT 'is the \'guessing\' mode active?',
915 `oembed` boolean NOT NULL DEFAULT '0' COMMENT 'is the data the result of oembed?',
916 `content` mediumtext COMMENT 'page data',
917 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
918 PRIMARY KEY(`url`,`guessing`,`oembed`),
919 INDEX `created` (`created`)
920 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for \'parse_url\' queries';
923 -- TABLE participation
925 CREATE TABLE IF NOT EXISTS `participation` (
926 `iid` int unsigned NOT NULL COMMENT '',
927 `server` varchar(60) NOT NULL COMMENT '',
928 `cid` int unsigned NOT NULL COMMENT '',
929 `fid` int unsigned NOT NULL COMMENT '',
930 PRIMARY KEY(`iid`,`server`),
933 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Storage for participation messages from Diaspora';
938 CREATE TABLE IF NOT EXISTS `pconfig` (
939 `id` int unsigned NOT NULL auto_increment COMMENT '',
940 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
941 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
942 `k` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
943 `v` mediumtext COMMENT '',
945 UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
946 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='personal (per user) configuration storage';
951 CREATE TABLE IF NOT EXISTS `photo` (
952 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
953 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
954 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
955 `guid` char(16) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this photo',
956 `resource-id` char(32) NOT NULL DEFAULT '' COMMENT '',
957 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation date',
958 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edited date',
959 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
960 `desc` text COMMENT '',
961 `album` varchar(255) NOT NULL DEFAULT '' COMMENT 'The name of the album to which the photo belongs',
962 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
963 `type` varchar(30) NOT NULL DEFAULT 'image/jpeg',
964 `height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
965 `width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
966 `datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
967 `data` mediumblob NOT NULL COMMENT '',
968 `scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
969 `profile` boolean NOT NULL DEFAULT '0' COMMENT '',
970 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
971 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
972 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
973 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
974 `accessible` boolean NOT NULL DEFAULT '0' COMMENT 'Make photo publicly accessible, ignoring permissions',
975 `backend-class` tinytext COMMENT 'Storage backend class',
976 `backend-ref` text COMMENT 'Storage backend data reference',
977 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
979 INDEX `contactid` (`contact-id`),
980 INDEX `uid_contactid` (`uid`,`contact-id`),
981 INDEX `uid_profile` (`uid`,`profile`),
982 INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
983 INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`,`created`),
984 INDEX `resource-id` (`resource-id`)
985 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='photo storage';
990 CREATE TABLE IF NOT EXISTS `poll` (
991 `id` int unsigned NOT NULL auto_increment COMMENT '',
992 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
993 `q0` text COMMENT '',
994 `q1` text COMMENT '',
995 `q2` text COMMENT '',
996 `q3` text COMMENT '',
997 `q4` text COMMENT '',
998 `q5` text COMMENT '',
999 `q6` text COMMENT '',
1000 `q7` text COMMENT '',
1001 `q8` text COMMENT '',
1002 `q9` text COMMENT '',
1005 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently unused table for storing poll results';
1008 -- TABLE poll_result
1010 CREATE TABLE IF NOT EXISTS `poll_result` (
1011 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1012 `poll_id` int unsigned NOT NULL DEFAULT 0,
1013 `choice` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1015 INDEX `poll_id` (`poll_id`)
1016 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='data for polls - currently unused';
1019 -- TABLE post-category
1021 CREATE TABLE IF NOT EXISTS `post-category` (
1022 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
1023 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1024 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1025 `tid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1026 PRIMARY KEY(`uri-id`,`uid`,`type`,`tid`),
1027 INDEX `uri-id` (`tid`),
1028 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
1029 FOREIGN KEY (`tid`) REFERENCES `tag` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
1030 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='post relation to categories';
1033 -- TABLE post-delivery-data
1035 CREATE TABLE IF NOT EXISTS `post-delivery-data` (
1036 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
1037 `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',
1038 `inform` mediumtext COMMENT 'Additional receivers of the linked item',
1039 `queue_count` mediumint NOT NULL DEFAULT 0 COMMENT 'Initial number of delivery recipients, used as item.delivery_queue_count',
1040 `queue_done` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries, used as item.delivery_queue_done',
1041 `queue_failed` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of unsuccessful deliveries, used as item.delivery_queue_failed',
1042 `activitypub` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via ActivityPub',
1043 `dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via DFRN',
1044 `legacy_dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via legacy DFRN',
1045 `diaspora` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via Diaspora',
1046 `ostatus` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via OStatus',
1047 PRIMARY KEY(`uri-id`),
1048 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
1049 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items';
1054 CREATE TABLE IF NOT EXISTS `post-tag` (
1055 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
1056 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1057 `tid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1058 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the mentioned public contact',
1059 PRIMARY KEY(`uri-id`,`type`,`tid`,`cid`),
1060 INDEX `tid` (`tid`),
1061 INDEX `cid` (`cid`),
1062 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE,
1063 FOREIGN KEY (`tid`) REFERENCES `tag` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT,
1064 FOREIGN KEY (`cid`) REFERENCES `contact` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
1065 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='post relation to tags';
1070 CREATE TABLE IF NOT EXISTS `process` (
1071 `pid` int unsigned NOT NULL COMMENT '',
1072 `command` varbinary(32) NOT NULL DEFAULT '' COMMENT '',
1073 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1075 INDEX `command` (`command`)
1076 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently running system processes';
1081 CREATE TABLE IF NOT EXISTS `profile` (
1082 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1083 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
1084 `profile-name` varchar(255) COMMENT 'Deprecated',
1085 `is-default` boolean COMMENT 'Deprecated',
1086 `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT 'Hide friend list from viewers of this profile',
1087 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1088 `pdesc` varchar(255) COMMENT 'Deprecated',
1089 `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT 'Day of birth',
1090 `address` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1091 `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1092 `region` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1093 `postal-code` varchar(32) NOT NULL DEFAULT '' COMMENT '',
1094 `country-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1095 `hometown` varchar(255) COMMENT 'Deprecated',
1096 `gender` varchar(32) COMMENT 'Deprecated',
1097 `marital` varchar(255) COMMENT 'Deprecated',
1098 `with` text COMMENT 'Deprecated',
1099 `howlong` datetime COMMENT 'Deprecated',
1100 `sexual` varchar(255) COMMENT 'Deprecated',
1101 `politic` varchar(255) COMMENT 'Deprecated',
1102 `religion` varchar(255) COMMENT 'Deprecated',
1103 `pub_keywords` text COMMENT '',
1104 `prv_keywords` text COMMENT '',
1105 `likes` text COMMENT 'Deprecated',
1106 `dislikes` text COMMENT 'Deprecated',
1107 `about` text COMMENT 'Profile description',
1108 `summary` varchar(255) COMMENT 'Deprecated',
1109 `music` text COMMENT 'Deprecated',
1110 `book` text COMMENT 'Deprecated',
1111 `tv` text COMMENT 'Deprecated',
1112 `film` text COMMENT 'Deprecated',
1113 `interest` text COMMENT 'Deprecated',
1114 `romance` text COMMENT 'Deprecated',
1115 `work` text COMMENT 'Deprecated',
1116 `education` text COMMENT 'Deprecated',
1117 `contact` text COMMENT 'Deprecated',
1118 `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1119 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1120 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1121 `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1122 `publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
1123 `net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
1125 INDEX `uid_is-default` (`uid`,`is-default`),
1126 FULLTEXT INDEX `pub_keywords` (`pub_keywords`)
1127 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
1130 -- TABLE profile_check
1132 CREATE TABLE IF NOT EXISTS `profile_check` (
1133 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1134 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1135 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
1136 `dfrn_id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1137 `sec` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1138 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1140 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='DFRN remote auth use';
1143 -- TABLE profile_field
1145 CREATE TABLE IF NOT EXISTS `profile_field` (
1146 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1147 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner user id',
1148 `order` mediumint unsigned NOT NULL DEFAULT 1 COMMENT 'Field ordering per user',
1149 `psid` int unsigned COMMENT 'ID of the permission set of this profile field - 0 = public',
1150 `label` varchar(255) NOT NULL DEFAULT '' COMMENT 'Label of the field',
1151 `value` text COMMENT 'Value of the field',
1152 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
1153 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
1155 INDEX `uid` (`uid`),
1156 INDEX `order` (`order`),
1157 INDEX `psid` (`psid`),
1158 FOREIGN KEY (`psid`) REFERENCES `permissionset` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
1159 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Custom profile fields';
1162 -- TABLE push_subscriber
1164 CREATE TABLE IF NOT EXISTS `push_subscriber` (
1165 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1166 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1167 `callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1168 `topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1169 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1170 `push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1171 `last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
1172 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1173 `renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
1174 `secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1176 INDEX `next_try` (`next_try`)
1177 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Used for OStatus: Contains feed subscribers';
1182 CREATE TABLE IF NOT EXISTS `register` (
1183 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1184 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1185 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1186 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1187 `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1188 `language` varchar(16) NOT NULL DEFAULT '' COMMENT '',
1189 `note` text COMMENT '',
1191 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
1196 CREATE TABLE IF NOT EXISTS `search` (
1197 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1198 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1199 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1202 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
1207 CREATE TABLE IF NOT EXISTS `session` (
1208 `id` bigint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1209 `sid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
1210 `data` text COMMENT '',
1211 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1213 INDEX `sid` (`sid`(64)),
1214 INDEX `expire` (`expire`)
1215 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='web session storage';
1220 CREATE TABLE IF NOT EXISTS `storage` (
1221 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented image data id',
1222 `data` longblob NOT NULL COMMENT 'file data',
1224 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Data stored by Database storage backend';
1229 CREATE TABLE IF NOT EXISTS `thread` (
1230 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'sequential ID',
1231 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
1232 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1233 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1234 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
1235 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item author',
1236 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1237 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1238 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1239 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1240 `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1241 `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
1242 `private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
1243 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
1244 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
1245 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
1246 `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
1247 `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
1248 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
1249 `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
1250 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
1251 `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
1252 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1253 `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
1254 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
1255 `bookmark` boolean COMMENT '',
1257 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
1258 INDEX `uid_network_received` (`uid`,`network`,`received`),
1259 INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
1260 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
1261 INDEX `contactid` (`contact-id`),
1262 INDEX `ownerid` (`owner-id`),
1263 INDEX `authorid` (`author-id`),
1264 INDEX `uid_received` (`uid`,`received`),
1265 INDEX `uid_commented` (`uid`,`commented`),
1266 INDEX `uid_wall_received` (`uid`,`wall`,`received`),
1267 INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`),
1268 INDEX `uri-id` (`uri-id`),
1269 FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
1270 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Thread related data';
1275 CREATE TABLE IF NOT EXISTS `tokens` (
1276 `id` varchar(40) NOT NULL COMMENT '',
1277 `secret` text COMMENT '',
1278 `client_id` varchar(20) NOT NULL DEFAULT '',
1279 `expires` int NOT NULL DEFAULT 0 COMMENT '',
1280 `scope` varchar(200) NOT NULL DEFAULT '' COMMENT '',
1281 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1283 INDEX `client_id` (`client_id`),
1284 FOREIGN KEY (`client_id`) REFERENCES `clients` (`client_id`) ON UPDATE RESTRICT ON DELETE CASCADE
1285 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
1290 CREATE TABLE IF NOT EXISTS `user` (
1291 `uid` mediumint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1292 `parent-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'The parent user that has full control about this user',
1293 `guid` varchar(64) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this user',
1294 `username` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this user is known by',
1295 `password` varchar(255) NOT NULL DEFAULT '' COMMENT 'encrypted password',
1296 `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?',
1297 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT 'nick- and user name',
1298 `email` varchar(255) NOT NULL DEFAULT '' COMMENT 'the users email address',
1299 `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1300 `timezone` varchar(128) NOT NULL DEFAULT '' COMMENT 'PHP-legal timezone',
1301 `language` varchar(32) NOT NULL DEFAULT 'en' COMMENT 'default language',
1302 `register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of registration',
1303 `login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last login',
1304 `default-location` varchar(255) NOT NULL DEFAULT '' COMMENT 'Default for item.location',
1305 `allow_location` boolean NOT NULL DEFAULT '0' COMMENT '1 allows to display the location',
1306 `theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
1307 `pubkey` text COMMENT 'RSA public key 4096 bit',
1308 `prvkey` text COMMENT 'RSA private key 4096 bit',
1309 `spubkey` text COMMENT '',
1310 `sprvkey` text COMMENT '',
1311 `verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
1312 `blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
1313 `blockwall` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to post to the profile page of the user',
1314 `hidewall` boolean NOT NULL DEFAULT '0' COMMENT 'Hide profile details from unkown viewers',
1315 `blocktags` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to tag the post of this user',
1316 `unkmail` boolean NOT NULL DEFAULT '0' COMMENT 'Permit unknown people to send private mails to this user',
1317 `cntunkmail` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1318 `notify-flags` smallint unsigned NOT NULL DEFAULT 65535 COMMENT 'email notification options',
1319 `page-flags` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'page/profile type',
1320 `account-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1321 `prvnets` boolean NOT NULL DEFAULT '0' COMMENT '',
1322 `pwdreset` varchar(255) COMMENT 'Password reset request token',
1323 `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
1324 `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1325 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1326 `account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed',
1327 `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
1328 `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted',
1329 `expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last warning of account expiration',
1330 `def_gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1331 `allow_cid` mediumtext COMMENT 'default permission for this user',
1332 `allow_gid` mediumtext COMMENT 'default permission for this user',
1333 `deny_cid` mediumtext COMMENT 'default permission for this user',
1334 `deny_gid` mediumtext COMMENT 'default permission for this user',
1335 `openidserver` text COMMENT '',
1337 INDEX `nickname` (`nickname`(32))
1338 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='The local users';
1343 CREATE TABLE IF NOT EXISTS `userd` (
1344 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1345 `username` varchar(255) NOT NULL COMMENT '',
1347 INDEX `username` (`username`(32))
1348 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Deleted usernames';
1351 -- TABLE user-contact
1353 CREATE TABLE IF NOT EXISTS `user-contact` (
1354 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the linked public contact',
1355 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1356 `blocked` boolean COMMENT 'Contact is completely blocked for this user',
1357 `ignored` boolean COMMENT 'Posts from this contact are ignored',
1358 `collapsed` boolean COMMENT 'Posts from this contact are collapsed',
1359 PRIMARY KEY(`uid`,`cid`)
1360 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific public contact data';
1365 CREATE TABLE IF NOT EXISTS `user-item` (
1366 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item id',
1367 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1368 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Marker to hide an item from the user',
1369 `ignored` boolean COMMENT 'Ignore this thread if set',
1370 `pinned` boolean COMMENT 'The item is pinned on the profile page',
1371 `notification-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1372 PRIMARY KEY(`uid`,`iid`),
1373 INDEX `uid_pinned` (`uid`,`pinned`),
1374 INDEX `iid_uid` (`iid`,`uid`)
1375 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
1380 CREATE TABLE IF NOT EXISTS `verb` (
1381 `id` smallint unsigned NOT NULL auto_increment,
1382 `name` varchar(100) NOT NULL DEFAULT '' COMMENT '',
1384 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activity Verbs';
1389 CREATE TABLE IF NOT EXISTS `worker-ipc` (
1390 `key` int NOT NULL COMMENT '',
1391 `jobs` boolean COMMENT 'Flag for outstanding jobs',
1393 ) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Inter process communication between the frontend and the worker';
1396 -- TABLE workerqueue
1398 CREATE TABLE IF NOT EXISTS `workerqueue` (
1399 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id',
1400 `parameter` mediumtext COMMENT 'Task command',
1401 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority',
1402 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
1403 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
1404 `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
1405 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1406 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1407 `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
1409 INDEX `done_parameter` (`done`,`parameter`(64)),
1410 INDEX `done_executed` (`done`,`executed`),
1411 INDEX `done_priority_created` (`done`,`priority`,`created`),
1412 INDEX `done_priority_next_try` (`done`,`priority`,`next_try`),
1413 INDEX `done_pid_next_try` (`done`,`pid`,`next_try`),
1414 INDEX `done_pid_priority_created` (`done`,`pid`,`priority`,`created`)
1415 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
1418 -- VIEW category-view
1420 DROP VIEW IF EXISTS `category-view`;
1421 CREATE VIEW `category-view` AS SELECT
1422 `post-category`.`uri-id` AS `uri-id`,
1423 `post-category`.`uid` AS `uid`,
1424 `item-uri`.`uri` AS `uri`,
1425 `item-uri`.`guid` AS `guid`,
1426 `post-category`.`type` AS `type`,
1427 `post-category`.`tid` AS `tid`,
1428 `tag`.`name` AS `name`,
1429 `tag`.`url` AS `url`
1430 FROM `post-category`
1431 INNER JOIN `item-uri` ON `item-uri`.id = `post-category`.`uri-id`
1432 LEFT JOIN `tag` ON `post-category`.`tid` = `tag`.`id`;
1437 DROP VIEW IF EXISTS `tag-view`;
1438 CREATE VIEW `tag-view` AS SELECT
1439 `post-tag`.`uri-id` AS `uri-id`,
1440 `item-uri`.`uri` AS `uri`,
1441 `item-uri`.`guid` AS `guid`,
1442 `post-tag`.`type` AS `type`,
1443 `post-tag`.`tid` AS `tid`,
1444 `post-tag`.`cid` AS `cid`,
1445 CASE `cid` WHEN 0 THEN `tag`.`name` ELSE `contact`.`name` END AS `name`,
1446 CASE `cid` WHEN 0 THEN `tag`.`url` ELSE `contact`.`url` END AS `url`
1448 INNER JOIN `item-uri` ON `item-uri`.id = `post-tag`.`uri-id`
1449 LEFT JOIN `tag` ON `post-tag`.`tid` = `tag`.`id`
1450 LEFT JOIN `contact` ON `post-tag`.`cid` = `contact`.`id`;
1455 DROP VIEW IF EXISTS `owner-view`;
1456 CREATE VIEW `owner-view` AS SELECT
1457 `contact`.`id` AS `id`,
1458 `contact`.`uid` AS `uid`,
1459 `contact`.`created` AS `created`,
1460 `contact`.`updated` AS `updated`,
1461 `contact`.`self` AS `self`,
1462 `contact`.`remote_self` AS `remote_self`,
1463 `contact`.`rel` AS `rel`,
1464 `contact`.`duplex` AS `duplex`,
1465 `contact`.`network` AS `network`,
1466 `contact`.`protocol` AS `protocol`,
1467 `contact`.`name` AS `name`,
1468 `contact`.`nick` AS `nick`,
1469 `contact`.`location` AS `location`,
1470 `contact`.`about` AS `about`,
1471 `contact`.`keywords` AS `keywords`,
1472 `contact`.`gender` AS `gender`,
1473 `contact`.`xmpp` AS `xmpp`,
1474 `contact`.`attag` AS `attag`,
1475 `contact`.`avatar` AS `avatar`,
1476 `contact`.`photo` AS `photo`,
1477 `contact`.`thumb` AS `thumb`,
1478 `contact`.`micro` AS `micro`,
1479 `contact`.`site-pubkey` AS `site-pubkey`,
1480 `contact`.`issued-id` AS `issued-id`,
1481 `contact`.`dfrn-id` AS `dfrn-id`,
1482 `contact`.`url` AS `url`,
1483 `contact`.`nurl` AS `nurl`,
1484 `contact`.`addr` AS `addr`,
1485 `contact`.`alias` AS `alias`,
1486 `contact`.`pubkey` AS `pubkey`,
1487 `contact`.`prvkey` AS `prvkey`,
1488 `contact`.`batch` AS `batch`,
1489 `contact`.`request` AS `request`,
1490 `contact`.`notify` AS `notify`,
1491 `contact`.`poll` AS `poll`,
1492 `contact`.`confirm` AS `confirm`,
1493 `contact`.`poco` AS `poco`,
1494 `contact`.`aes_allow` AS `aes_allow`,
1495 `contact`.`ret-aes` AS `ret-aes`,
1496 `contact`.`usehub` AS `usehub`,
1497 `contact`.`subhub` AS `subhub`,
1498 `contact`.`hub-verify` AS `hub-verify`,
1499 `contact`.`last-update` AS `last-update`,
1500 `contact`.`success_update` AS `success_update`,
1501 `contact`.`failure_update` AS `failure_update`,
1502 `contact`.`name-date` AS `name-date`,
1503 `contact`.`uri-date` AS `uri-date`,
1504 `contact`.`avatar-date` AS `avatar-date`,
1505 `contact`.`avatar-date` AS `picdate`,
1506 `contact`.`term-date` AS `term-date`,
1507 `contact`.`last-item` AS `last-item`,
1508 `contact`.`priority` AS `priority`,
1509 `contact`.`blocked` AS `blocked`,
1510 `contact`.`block_reason` AS `block_reason`,
1511 `contact`.`readonly` AS `readonly`,
1512 `contact`.`writable` AS `writable`,
1513 `contact`.`forum` AS `forum`,
1514 `contact`.`prv` AS `prv`,
1515 `contact`.`contact-type` AS `contact-type`,
1516 `contact`.`hidden` AS `hidden`,
1517 `contact`.`archive` AS `archive`,
1518 `contact`.`pending` AS `pending`,
1519 `contact`.`deleted` AS `deleted`,
1520 `contact`.`rating` AS `rating`,
1521 `contact`.`unsearchable` AS `unsearchable`,
1522 `contact`.`sensitive` AS `sensitive`,
1523 `contact`.`baseurl` AS `baseurl`,
1524 `contact`.`reason` AS `reason`,
1525 `contact`.`closeness` AS `closeness`,
1526 `contact`.`info` AS `info`,
1527 `contact`.`profile-id` AS `profile-id`,
1528 `contact`.`bdyear` AS `bdyear`,
1529 `contact`.`bd` AS `bd`,
1530 `contact`.`notify_new_posts` AS `notify_new_posts`,
1531 `contact`.`fetch_further_information` AS `fetch_further_information`,
1532 `contact`.`ffi_keyword_denylist` AS `ffi_keyword_denylist`,
1533 `user`.`parent-uid` AS `parent-uid`,
1534 `user`.`guid` AS `guid`,
1535 `user`.`nickname` AS `nickname`,
1536 `user`.`email` AS `email`,
1537 `user`.`openid` AS `openid`,
1538 `user`.`timezone` AS `timezone`,
1539 `user`.`language` AS `language`,
1540 `user`.`register_date` AS `register_date`,
1541 `user`.`login_date` AS `login_date`,
1542 `user`.`default-location` AS `default-location`,
1543 `user`.`allow_location` AS `allow_location`,
1544 `user`.`theme` AS `theme`,
1545 `user`.`pubkey` AS `upubkey`,
1546 `user`.`prvkey` AS `uprvkey`,
1547 `user`.`sprvkey` AS `sprvkey`,
1548 `user`.`spubkey` AS `spubkey`,
1549 `user`.`verified` AS `verified`,
1550 `user`.`blockwall` AS `blockwall`,
1551 `user`.`hidewall` AS `hidewall`,
1552 `user`.`blocktags` AS `blocktags`,
1553 `user`.`unkmail` AS `unkmail`,
1554 `user`.`cntunkmail` AS `cntunkmail`,
1555 `user`.`notify-flags` AS `notify-flags`,
1556 `user`.`page-flags` AS `page-flags`,
1557 `user`.`account-type` AS `account-type`,
1558 `user`.`prvnets` AS `prvnets`,
1559 `user`.`maxreq` AS `maxreq`,
1560 `user`.`expire` AS `expire`,
1561 `user`.`account_removed` AS `account_removed`,
1562 `user`.`account_expired` AS `account_expired`,
1563 `user`.`account_expires_on` AS `account_expires_on`,
1564 `user`.`expire_notification_sent` AS `expire_notification_sent`,
1565 `user`.`def_gid` AS `def_gid`,
1566 `user`.`allow_cid` AS `allow_cid`,
1567 `user`.`allow_gid` AS `allow_gid`,
1568 `user`.`deny_cid` AS `deny_cid`,
1569 `user`.`deny_gid` AS `deny_gid`,
1570 `user`.`openidserver` AS `openidserver`,
1571 `profile`.`publish` AS `publish`,
1572 `profile`.`net-publish` AS `net-publish`,
1573 `profile`.`hide-friends` AS `hide-friends`,
1574 `profile`.`prv_keywords` AS `prv_keywords`,
1575 `profile`.`pub_keywords` AS `pub_keywords`,
1576 `profile`.`address` AS `address`,
1577 `profile`.`locality` AS `locality`,
1578 `profile`.`region` AS `region`,
1579 `profile`.`postal-code` AS `postal-code`,
1580 `profile`.`country-name` AS `country-name`,
1581 `profile`.`homepage` AS `homepage`,
1582 `profile`.`dob` AS `dob`
1584 INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self`
1585 INNER JOIN `profile` ON `profile`.`uid` = `user`.`uid`;
1588 -- VIEW pending-view
1590 DROP VIEW IF EXISTS `pending-view`;
1591 CREATE VIEW `pending-view` AS SELECT
1592 `register`.`id` AS `id`,
1593 `register`.`hash` AS `hash`,
1594 `register`.`created` AS `created`,
1595 `register`.`uid` AS `uid`,
1596 `register`.`password` AS `password`,
1597 `register`.`language` AS `language`,
1598 `register`.`note` AS `note`,
1599 `contact`.`self` AS `self`,
1600 `contact`.`name` AS `name`,
1601 `contact`.`url` AS `url`,
1602 `contact`.`micro` AS `micro`,
1603 `user`.`email` AS `email`,
1604 `contact`.`nick` AS `nick`
1606 INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
1607 INNER JOIN `user` ON `register`.`uid` = `user`.`uid`;
1610 -- VIEW tag-search-view
1612 DROP VIEW IF EXISTS `tag-search-view`;
1613 CREATE VIEW `tag-search-view` AS SELECT
1614 `post-tag`.`uri-id` AS `uri-id`,
1615 `item`.`id` AS `iid`,
1616 `item`.`uri` AS `uri`,
1617 `item`.`guid` AS `guid`,
1618 `item`.`uid` AS `uid`,
1619 `item`.`private` AS `private`,
1620 `item`.`wall` AS `wall`,
1621 `item`.`origin` AS `origin`,
1622 `item`.`gravity` AS `gravity`,
1623 `item`.`received` AS `received`,
1624 `tag`.`name` AS `name`
1626 INNER JOIN `tag` ON `tag`.`id` = `post-tag`.`tid`
1627 INNER JOIN `item` ON `item`.`uri-id` = `post-tag`.`uri-id`
1628 WHERE `post-tag`.`type` = 1;
1631 -- VIEW workerqueue-view
1633 DROP VIEW IF EXISTS `workerqueue-view`;
1634 CREATE VIEW `workerqueue-view` AS SELECT
1635 `process`.`pid` AS `pid`,
1636 `workerqueue`.`priority` AS `priority`
1638 INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`
1639 WHERE NOT `workerqueue`.`done`;