1 -- ------------------------------------------
2 -- Friendica 2020.03-dev (Dalmatian Bellflower)
3 -- DB_UPDATE_VERSION 1336
4 -- ------------------------------------------
8 -- TABLE 2fa_app_specific_password
10 CREATE TABLE IF NOT EXISTS `2fa_app_specific_password` (
11 `id` mediumint unsigned NOT NULL auto_increment COMMENT 'Password ID for revocation',
12 `uid` mediumint unsigned NOT NULL COMMENT 'User ID',
13 `description` varchar(255) COMMENT 'Description of the usage of the password',
14 `hashed_password` varchar(255) NOT NULL COMMENT 'Hashed password',
15 `generated` datetime NOT NULL COMMENT 'Datetime the password was generated',
16 `last_used` datetime COMMENT 'Datetime the password was last used',
18 INDEX `uid_description` (`uid`,`description`(190))
19 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor app-specific _password';
22 -- TABLE 2fa_recovery_codes
24 CREATE TABLE IF NOT EXISTS `2fa_recovery_codes` (
25 `uid` mediumint unsigned NOT NULL COMMENT 'User ID',
26 `code` varchar(50) NOT NULL COMMENT 'Recovery code string',
27 `generated` datetime NOT NULL COMMENT 'Datetime the code was generated',
28 `used` datetime COMMENT 'Datetime the code was used',
29 PRIMARY KEY(`uid`,`code`)
30 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor authentication recovery codes';
35 CREATE TABLE IF NOT EXISTS `addon` (
36 `id` int unsigned NOT NULL auto_increment COMMENT '',
37 `name` varchar(50) NOT NULL DEFAULT '' COMMENT 'addon base (file)name',
38 `version` varchar(50) NOT NULL DEFAULT '' COMMENT 'currently unused',
39 `installed` boolean NOT NULL DEFAULT '0' COMMENT 'currently always 1',
40 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'currently unused',
41 `timestamp` int unsigned NOT NULL DEFAULT 0 COMMENT 'file timestamp to check for reloads',
42 `plugin_admin` boolean NOT NULL DEFAULT '0' COMMENT '1 = has admin config, 0 = has no admin config',
44 UNIQUE INDEX `name` (`name`)
45 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registered addons';
50 CREATE TABLE IF NOT EXISTS `apcontact` (
51 `url` varbinary(255) NOT NULL COMMENT 'URL of the contact',
52 `uuid` varchar(255) COMMENT '',
53 `type` varchar(20) NOT NULL COMMENT '',
54 `following` varchar(255) COMMENT '',
55 `followers` varchar(255) COMMENT '',
56 `inbox` varchar(255) NOT NULL COMMENT '',
57 `outbox` varchar(255) COMMENT '',
58 `sharedinbox` varchar(255) COMMENT '',
59 `manually-approve` boolean COMMENT '',
60 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
61 `name` varchar(255) COMMENT '',
62 `about` text COMMENT '',
63 `photo` varchar(255) COMMENT '',
64 `addr` varchar(255) COMMENT '',
65 `alias` varchar(255) COMMENT '',
66 `pubkey` text COMMENT '',
67 `baseurl` varchar(255) COMMENT 'baseurl of the ap contact',
68 `generator` varchar(255) COMMENT 'Name of the contact\'s system',
69 `following_count` int unsigned DEFAULT 0 COMMENT 'Number of following contacts',
70 `followers_count` int unsigned DEFAULT 0 COMMENT 'Number of followers',
71 `statuses_count` int unsigned DEFAULT 0 COMMENT 'Number of posts',
72 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
74 INDEX `addr` (`addr`(32)),
75 INDEX `alias` (`alias`(190)),
76 INDEX `url` (`followers`(190))
77 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='ActivityPub compatible contacts - used in the ActivityPub implementation';
82 CREATE TABLE IF NOT EXISTS `attach` (
83 `id` int unsigned NOT NULL auto_increment COMMENT 'generated index',
84 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
85 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT 'hash',
86 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT 'filename of original',
87 `filetype` varchar(64) NOT NULL DEFAULT '' COMMENT 'mimetype',
88 `filesize` int unsigned NOT NULL DEFAULT 0 COMMENT 'size in bytes',
89 `data` longblob NOT NULL COMMENT 'file data',
90 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
91 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
92 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>',
93 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
94 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
95 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
96 `backend-class` tinytext COMMENT 'Storage backend class',
97 `backend-ref` text COMMENT 'Storage backend data reference',
99 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='file attachments';
104 CREATE TABLE IF NOT EXISTS `auth_codes` (
105 `id` varchar(40) NOT NULL COMMENT '',
106 `client_id` varchar(20) NOT NULL DEFAULT '' COMMENT '',
107 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
108 `expires` int NOT NULL DEFAULT 0 COMMENT '',
109 `scope` varchar(250) NOT NULL DEFAULT '' COMMENT '',
111 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
116 CREATE TABLE IF NOT EXISTS `cache` (
117 `k` varbinary(255) NOT NULL COMMENT 'cache key',
118 `v` mediumtext COMMENT 'cached serialized value',
119 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
120 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache insertion',
122 INDEX `k_expires` (`k`,`expires`)
123 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Stores temporary data';
128 CREATE TABLE IF NOT EXISTS `challenge` (
129 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
130 `challenge` varchar(255) NOT NULL DEFAULT '' COMMENT '',
131 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
132 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
133 `type` varchar(255) NOT NULL DEFAULT '' COMMENT '',
134 `last_update` varchar(255) NOT NULL DEFAULT '' COMMENT '',
136 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
141 CREATE TABLE IF NOT EXISTS `clients` (
142 `client_id` varchar(20) NOT NULL COMMENT '',
143 `pw` varchar(20) NOT NULL DEFAULT '' COMMENT '',
144 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
145 `name` text COMMENT '',
146 `icon` text COMMENT '',
147 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
148 PRIMARY KEY(`client_id`)
149 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
154 CREATE TABLE IF NOT EXISTS `config` (
155 `id` int unsigned NOT NULL auto_increment COMMENT '',
156 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
157 `k` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
158 `v` mediumtext COMMENT '',
160 UNIQUE INDEX `cat_k` (`cat`,`k`)
161 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='main configuration storage';
166 CREATE TABLE IF NOT EXISTS `contact` (
167 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
168 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
169 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
170 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last contact update',
171 `self` boolean NOT NULL DEFAULT '0' COMMENT '1 if the contact is the user him/her self',
172 `remote_self` boolean NOT NULL DEFAULT '0' COMMENT '',
173 `rel` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'The kind of the relation between the user and the contact',
174 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
175 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network of the contact',
176 `protocol` char(4) NOT NULL DEFAULT '' COMMENT 'Protocol of the contact',
177 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
178 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
179 `location` varchar(255) DEFAULT '' COMMENT '',
180 `about` text COMMENT '',
181 `keywords` text COMMENT 'public keywords (interests) of the contact',
182 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT 'Deprecated',
183 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
184 `attag` varchar(255) NOT NULL DEFAULT '' COMMENT '',
185 `avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
186 `photo` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo of the contact',
187 `thumb` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (thumb size)',
188 `micro` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (micro size)',
189 `site-pubkey` text COMMENT '',
190 `issued-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
191 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
192 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
193 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
194 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
195 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
196 `pubkey` text COMMENT 'RSA public key 4096 bit',
197 `prvkey` text COMMENT 'RSA private key 4096 bit',
198 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
199 `request` varchar(255) COMMENT '',
200 `notify` varchar(255) COMMENT '',
201 `poll` varchar(255) COMMENT '',
202 `confirm` varchar(255) COMMENT '',
203 `poco` varchar(255) COMMENT '',
204 `aes_allow` boolean NOT NULL DEFAULT '0' COMMENT '',
205 `ret-aes` boolean NOT NULL DEFAULT '0' COMMENT '',
206 `usehub` boolean NOT NULL DEFAULT '0' COMMENT '',
207 `subhub` boolean NOT NULL DEFAULT '0' COMMENT '',
208 `hub-verify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
209 `last-update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last try to update the contact info',
210 `success_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful contact update',
211 `failure_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed update',
212 `name-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
213 `uri-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
214 `avatar-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
215 `term-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
216 `last-item` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'date of the last post',
217 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
218 `blocked` boolean NOT NULL DEFAULT '1' COMMENT 'Node-wide block status',
219 `block_reason` text COMMENT 'Node-wide block reason',
220 `readonly` boolean NOT NULL DEFAULT '0' COMMENT 'posts of the contact are readonly',
221 `writable` boolean NOT NULL DEFAULT '0' COMMENT '',
222 `forum` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a forum',
223 `prv` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a private group',
224 `contact-type` tinyint NOT NULL DEFAULT 0 COMMENT '',
225 `hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
226 `archive` boolean NOT NULL DEFAULT '0' COMMENT '',
227 `pending` boolean NOT NULL DEFAULT '1' COMMENT '',
228 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'Contact has been deleted',
229 `rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
230 `unsearchable` boolean NOT NULL DEFAULT '0' COMMENT 'Contact prefers to not be searchable',
231 `sensitive` boolean NOT NULL DEFAULT '0' COMMENT 'Contact posts sensitive content',
232 `baseurl` varchar(255) DEFAULT '' COMMENT 'baseurl of the contact',
233 `reason` text COMMENT '',
234 `closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
235 `info` mediumtext COMMENT '',
236 `profile-id` int unsigned COMMENT 'Deprecated',
237 `bdyear` varchar(4) NOT NULL DEFAULT '' COMMENT '',
238 `bd` date NOT NULL DEFAULT '0001-01-01' COMMENT '',
239 `notify_new_posts` boolean NOT NULL DEFAULT '0' COMMENT '',
240 `fetch_further_information` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
241 `ffi_keyword_blacklist` text COMMENT '',
243 INDEX `uid_name` (`uid`,`name`(190)),
244 INDEX `self_uid` (`self`,`uid`),
245 INDEX `alias_uid` (`alias`(32),`uid`),
246 INDEX `pending_uid` (`pending`,`uid`),
247 INDEX `blocked_uid` (`blocked`,`uid`),
248 INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
249 INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
250 INDEX `addr_uid` (`addr`(32),`uid`),
251 INDEX `nurl_uid` (`nurl`(32),`uid`),
252 INDEX `nick_uid` (`nick`(32),`uid`),
253 INDEX `dfrn-id` (`dfrn-id`(64)),
254 INDEX `issued-id` (`issued-id`(64))
255 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contact table';
260 CREATE TABLE IF NOT EXISTS `conv` (
261 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
262 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this conversation',
263 `recips` text COMMENT 'sender_handle;recipient_handle',
264 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
265 `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'handle of creator',
266 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation timestamp',
267 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'edited timestamp',
268 `subject` text COMMENT 'subject of initial message',
271 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
274 -- TABLE conversation
276 CREATE TABLE IF NOT EXISTS `conversation` (
277 `item-uri` varbinary(255) NOT NULL COMMENT 'Original URI of the item - unrelated to the table with the same name',
278 `reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'URI to which this item is a reply',
279 `conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
280 `conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
281 `protocol` tinyint unsigned NOT NULL DEFAULT 255 COMMENT 'The protocol of the item',
282 `direction` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'How the message arrived here: 1=push, 2=pull',
283 `source` mediumtext COMMENT 'Original source',
284 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
285 PRIMARY KEY(`item-uri`),
286 INDEX `conversation-uri` (`conversation-uri`),
287 INDEX `received` (`received`)
288 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
291 -- TABLE diaspora-interaction
293 CREATE TABLE IF NOT EXISTS `diaspora-interaction` (
294 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
295 `interaction` mediumtext COMMENT 'The Diaspora interaction',
296 PRIMARY KEY(`uri-id`)
297 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Signed Diaspora Interaction';
302 CREATE TABLE IF NOT EXISTS `event` (
303 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
304 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
305 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
306 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact_id (ID of the contact in contact table)',
307 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
308 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
309 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
310 `start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event start time',
311 `finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event end time',
312 `summary` text COMMENT 'short description or title of the event',
313 `desc` text COMMENT 'event description',
314 `location` text COMMENT 'event location',
315 `type` varchar(20) NOT NULL DEFAULT '' COMMENT 'event or birthday',
316 `nofinish` boolean NOT NULL DEFAULT '0' COMMENT 'if event does have no end this is 1',
317 `adjust` boolean NOT NULL DEFAULT '1' COMMENT 'adjust to timezone of the recipient (0 or 1)',
318 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '0 or 1',
319 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
320 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
321 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
322 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
324 INDEX `uid_start` (`uid`,`start`)
325 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Events';
330 CREATE TABLE IF NOT EXISTS `fcontact` (
331 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
332 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'unique id',
333 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
334 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
335 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
336 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
337 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
338 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
339 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
340 `notify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
341 `poll` varchar(255) NOT NULL DEFAULT '' COMMENT '',
342 `confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '',
343 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
344 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
345 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
346 `pubkey` text COMMENT '',
347 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
349 INDEX `addr` (`addr`(32)),
350 UNIQUE INDEX `url` (`url`(190))
351 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora compatible contacts - used in the Diaspora implementation';
356 CREATE TABLE IF NOT EXISTS `fsuggest` (
357 `id` int unsigned NOT NULL auto_increment COMMENT '',
358 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
359 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
360 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
361 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
362 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
363 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
364 `note` text COMMENT '',
365 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
367 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='friend suggestion stuff';
372 CREATE TABLE IF NOT EXISTS `gcign` (
373 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
374 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Local User id',
375 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'gcontact.id of ignored contact',
378 INDEX `gcid` (`gcid`)
379 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contacts ignored by friend suggestions';
384 CREATE TABLE IF NOT EXISTS `gcontact` (
385 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
386 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
387 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
388 `url` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the contacts profile page',
389 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
390 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the profile photo',
391 `connect` varchar(255) NOT NULL DEFAULT '' COMMENT '',
392 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
393 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
394 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
395 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
396 `last_discovery` datetime DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last contact discovery',
397 `archive_date` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
398 `archived` boolean NOT NULL DEFAULT '0' COMMENT '',
399 `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
400 `about` text COMMENT '',
401 `keywords` text COMMENT 'puplic keywords (interests)',
402 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT 'Deprecated',
403 `birthday` varchar(32) NOT NULL DEFAULT '0001-01-01' COMMENT '',
404 `community` boolean NOT NULL DEFAULT '0' COMMENT '1 if contact is forum account',
405 `contact-type` tinyint NOT NULL DEFAULT -1 COMMENT '',
406 `hide` boolean NOT NULL DEFAULT '0' COMMENT '1 = should be hidden from search',
407 `nsfw` boolean NOT NULL DEFAULT '0' COMMENT '1 = contact posts nsfw content',
408 `network` char(4) NOT NULL DEFAULT '' COMMENT 'social network protocol',
409 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
410 `notify` varchar(255) COMMENT '',
411 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
412 `generation` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
413 `server_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'baseurl of the contacts server',
415 UNIQUE INDEX `nurl` (`nurl`(190)),
416 INDEX `name` (`name`(64)),
417 INDEX `nick` (`nick`(32)),
418 INDEX `addr` (`addr`(64)),
419 INDEX `hide_network_updated` (`hide`,`network`,`updated`),
420 INDEX `updated` (`updated`)
421 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='global contacts';
426 CREATE TABLE IF NOT EXISTS `gfollower` (
427 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'global contact',
428 `follower-gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'global contact of the follower',
429 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates that the connection has been deleted',
430 PRIMARY KEY(`gcid`,`follower-gcid`),
431 INDEX `follower-gcid` (`follower-gcid`)
432 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Followers of global contacts';
437 CREATE TABLE IF NOT EXISTS `glink` (
438 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
439 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
440 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
441 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
442 `zcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
443 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
445 UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
446 INDEX `gcid` (`gcid`)
447 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='\'friends of friends\' linkages derived from poco';
452 CREATE TABLE IF NOT EXISTS `group` (
453 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
454 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
455 `visible` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the member list is not private',
456 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the group has been deleted',
457 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'human readable name of group',
460 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, group info';
463 -- TABLE group_member
465 CREATE TABLE IF NOT EXISTS `group_member` (
466 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
467 `gid` int unsigned NOT NULL DEFAULT 0 COMMENT 'groups.id of the associated group',
468 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id of the member assigned to the associated group',
470 INDEX `contactid` (`contact-id`),
471 UNIQUE INDEX `gid_contactid` (`gid`,`contact-id`)
472 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, member info';
477 CREATE TABLE IF NOT EXISTS `gserver` (
478 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
479 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
480 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
481 `version` varchar(255) NOT NULL DEFAULT '' COMMENT '',
482 `site_name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
483 `info` text COMMENT '',
484 `register_policy` tinyint NOT NULL DEFAULT 0 COMMENT '',
485 `registered-users` int unsigned NOT NULL DEFAULT 0 COMMENT 'Number of registered users',
486 `directory-type` tinyint DEFAULT 0 COMMENT 'Type of directory service (Poco, Mastodon)',
487 `poco` varchar(255) NOT NULL DEFAULT '' COMMENT '',
488 `noscrape` varchar(255) NOT NULL DEFAULT '' COMMENT '',
489 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
490 `platform` varchar(255) NOT NULL DEFAULT '' COMMENT '',
491 `relay-subscribe` boolean NOT NULL DEFAULT '0' COMMENT 'Has the server subscribed to the relay system',
492 `relay-scope` varchar(10) NOT NULL DEFAULT '' COMMENT 'The scope of messages that the server wants to get',
493 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
494 `last_poco_query` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
495 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
496 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
498 UNIQUE INDEX `nurl` (`nurl`(190))
499 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Global servers';
504 CREATE TABLE IF NOT EXISTS `gserver-tag` (
505 `gserver-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'The id of the gserver',
506 `tag` varchar(100) NOT NULL DEFAULT '' COMMENT 'Tag that the server has subscribed',
507 PRIMARY KEY(`gserver-id`,`tag`),
509 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Tags that the server has subscribed';
514 CREATE TABLE IF NOT EXISTS `hook` (
515 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
516 `hook` varbinary(100) NOT NULL DEFAULT '' COMMENT 'name of hook',
517 `file` varbinary(200) NOT NULL DEFAULT '' COMMENT 'relative filename of hook handler',
518 `function` varbinary(200) NOT NULL DEFAULT '' COMMENT 'function name of hook handler',
519 `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',
521 UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
522 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='addon hook registry';
525 -- TABLE inbox-status
527 CREATE TABLE IF NOT EXISTS `inbox-status` (
528 `url` varbinary(255) NOT NULL COMMENT 'URL of the inbox',
529 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date of this entry',
530 `success` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful delivery',
531 `failure` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed delivery',
532 `previous` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Previous delivery date',
533 `archive` boolean NOT NULL DEFAULT '0' COMMENT 'Is the inbox archived?',
534 `shared` boolean NOT NULL DEFAULT '0' COMMENT 'Is it a shared inbox?',
536 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Status of ActivityPub inboxes';
541 CREATE TABLE IF NOT EXISTS `intro` (
542 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
543 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
544 `fid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
545 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
546 `knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
547 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
548 `note` text COMMENT '',
549 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
550 `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
551 `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
552 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
554 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
559 CREATE TABLE IF NOT EXISTS `item` (
560 `id` int unsigned NOT NULL auto_increment,
561 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this item',
562 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
563 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
564 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
565 `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',
566 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT 'uri of the parent to this item',
567 `parent-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the parent uri',
568 `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',
569 `thr-parent-id` int unsigned COMMENT 'Id of the item-uri table that contains the thread parent uri',
570 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation timestamp.',
571 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last edit (default is created)',
572 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last comment/reply to this item',
573 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime',
574 `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',
575 `gravity` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
576 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network from where the item comes from',
577 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
578 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
579 `icid` int unsigned COMMENT 'Id of the item-content table entry that contains the whole item content',
580 `iaid` int unsigned COMMENT 'Id of the item-activity table entry that contains the activity data',
581 `extid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
582 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
583 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
584 `private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
585 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
586 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
587 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'item has been deleted',
588 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id which owns this copy of the item',
589 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
590 `wall` boolean NOT NULL DEFAULT '0' COMMENT 'This item was posted to the wall of uid',
591 `origin` boolean NOT NULL DEFAULT '0' COMMENT 'item originated at this site',
592 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
593 `starred` boolean NOT NULL DEFAULT '0' COMMENT 'item has been favourited',
594 `unseen` boolean NOT NULL DEFAULT '1' COMMENT 'item has not been seen',
595 `mention` boolean NOT NULL DEFAULT '0' COMMENT 'The owner of this item was mentioned in it',
596 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
597 `psid` int unsigned COMMENT 'ID of the permission set of this post',
598 `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',
599 `event-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Used to link to the event.id',
600 `attach` mediumtext COMMENT 'JSON structure representing attachments to this item',
601 `allow_cid` mediumtext COMMENT 'Deprecated',
602 `allow_gid` mediumtext COMMENT 'Deprecated',
603 `deny_cid` mediumtext COMMENT 'Deprecated',
604 `deny_gid` mediumtext COMMENT 'Deprecated',
605 `postopts` text COMMENT 'Deprecated',
606 `inform` mediumtext COMMENT 'Deprecated',
607 `type` varchar(20) COMMENT 'Deprecated',
608 `bookmark` boolean COMMENT 'Deprecated',
609 `file` mediumtext COMMENT 'Deprecated',
610 `location` varchar(255) COMMENT 'Deprecated',
611 `coord` varchar(255) COMMENT 'Deprecated',
612 `tag` mediumtext COMMENT 'Deprecated',
613 `plink` varchar(255) COMMENT 'Deprecated',
614 `title` varchar(255) COMMENT 'Deprecated',
615 `content-warning` varchar(255) COMMENT 'Deprecated',
616 `body` mediumtext COMMENT 'Deprecated',
617 `app` varchar(255) COMMENT 'Deprecated',
618 `verb` varchar(100) COMMENT 'Deprecated',
619 `object-type` varchar(100) COMMENT 'Deprecated',
620 `object` text COMMENT 'Deprecated',
621 `target-type` varchar(100) COMMENT 'Deprecated',
622 `target` text COMMENT 'Deprecated',
623 `author-name` varchar(255) COMMENT 'Deprecated',
624 `author-link` varchar(255) COMMENT 'Deprecated',
625 `author-avatar` varchar(255) COMMENT 'Deprecated',
626 `owner-name` varchar(255) COMMENT 'Deprecated',
627 `owner-link` varchar(255) COMMENT 'Deprecated',
628 `owner-avatar` varchar(255) COMMENT 'Deprecated',
629 `rendered-hash` varchar(32) COMMENT 'Deprecated',
630 `rendered-html` mediumtext COMMENT 'Deprecated',
632 INDEX `guid` (`guid`(191)),
633 INDEX `uri` (`uri`(191)),
634 INDEX `parent` (`parent`),
635 INDEX `parent-uri` (`parent-uri`(191)),
636 INDEX `extid` (`extid`(191)),
637 INDEX `uid_id` (`uid`,`id`),
638 INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
639 INDEX `uid_received` (`uid`,`received`),
640 INDEX `uid_commented` (`uid`,`commented`),
641 INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
642 INDEX `uid_network_received` (`uid`,`network`,`received`),
643 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
644 INDEX `uid_thrparent` (`uid`,`thr-parent`(190)),
645 INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
646 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
647 INDEX `authorid_received` (`author-id`,`received`),
648 INDEX `ownerid` (`owner-id`),
649 INDEX `contact-id` (`contact-id`),
650 INDEX `uid_uri` (`uid`,`uri`(190)),
651 INDEX `resource-id` (`resource-id`),
652 INDEX `deleted_changed` (`deleted`,`changed`),
653 INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
654 INDEX `mention_uid_id` (`mention`,`uid`,`id`),
655 INDEX `uid_eventid` (`uid`,`event-id`),
656 INDEX `icid` (`icid`),
657 INDEX `iaid` (`iaid`),
658 INDEX `psid_wall` (`psid`,`wall`)
659 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
662 -- TABLE item-activity
664 CREATE TABLE IF NOT EXISTS `item-activity` (
665 `id` int unsigned NOT NULL auto_increment,
666 `uri` varchar(255) COMMENT '',
667 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
668 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
669 `activity` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
671 UNIQUE INDEX `uri-hash` (`uri-hash`),
672 INDEX `uri` (`uri`(191)),
673 INDEX `uri-id` (`uri-id`)
674 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activities for items';
677 -- TABLE item-content
679 CREATE TABLE IF NOT EXISTS `item-content` (
680 `id` int unsigned NOT NULL auto_increment,
681 `uri` varchar(255) COMMENT '',
682 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
683 `uri-plink-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
684 `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'item title',
685 `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
686 `body` mediumtext COMMENT 'item body content',
687 `location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
688 `coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
689 `language` text COMMENT 'Language information about this post',
690 `app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
691 `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
692 `rendered-html` mediumtext COMMENT 'item.body converted to html',
693 `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams object type',
694 `object` text COMMENT 'JSON encoded object structure unless it is an implied object (normal post)',
695 `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
696 `target` text COMMENT 'JSON encoded target structure if used',
697 `plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
698 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams verb',
700 UNIQUE INDEX `uri-plink-hash` (`uri-plink-hash`),
701 INDEX `uri` (`uri`(191)),
702 INDEX `plink` (`plink`(191)),
703 INDEX `uri-id` (`uri-id`)
704 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
707 -- TABLE item-delivery-data
709 CREATE TABLE IF NOT EXISTS `item-delivery-data` (
710 `iid` int unsigned NOT NULL COMMENT 'Item id',
711 `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',
712 `inform` mediumtext COMMENT 'Additional receivers of the linked item',
713 `queue_count` mediumint NOT NULL DEFAULT 0 COMMENT 'Initial number of delivery recipients, used as item.delivery_queue_count',
714 `queue_done` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries, used as item.delivery_queue_done',
715 `queue_failed` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of unsuccessful deliveries, used as item.delivery_queue_failed',
716 `activitypub` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via ActivityPub',
717 `dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via DFRN',
718 `legacy_dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via legacy DFRN',
719 `diaspora` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via Diaspora',
720 `ostatus` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via OStatus',
722 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items';
727 CREATE TABLE IF NOT EXISTS `item-uri` (
728 `id` int unsigned NOT NULL auto_increment,
729 `uri` varbinary(255) NOT NULL COMMENT 'URI of an item',
730 `guid` varbinary(255) COMMENT 'A unique identifier for an item',
732 UNIQUE INDEX `uri` (`uri`),
733 INDEX `guid` (`guid`)
734 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='URI and GUID for items';
739 CREATE TABLE IF NOT EXISTS `locks` (
740 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
741 `name` varchar(128) NOT NULL DEFAULT '' COMMENT '',
742 `locked` boolean NOT NULL DEFAULT '0' COMMENT '',
743 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process ID',
744 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
746 INDEX `name_expires` (`name`,`expires`)
747 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
752 CREATE TABLE IF NOT EXISTS `mail` (
753 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
754 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
755 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
756 `from-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the sender',
757 `from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
758 `from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
759 `contact-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact.id',
760 `convid` int unsigned NOT NULL DEFAULT 0 COMMENT 'conv.id',
761 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
762 `body` mediumtext COMMENT '',
763 `seen` boolean NOT NULL DEFAULT '0' COMMENT 'if message visited it is 1',
764 `reply` boolean NOT NULL DEFAULT '0' COMMENT '',
765 `replied` boolean NOT NULL DEFAULT '0' COMMENT '',
766 `unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
767 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
768 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
769 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
771 INDEX `uid_seen` (`uid`,`seen`),
772 INDEX `convid` (`convid`),
773 INDEX `uri` (`uri`(64)),
774 INDEX `parent-uri` (`parent-uri`(64)),
775 INDEX `contactid` (`contact-id`(32))
776 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
781 CREATE TABLE IF NOT EXISTS `mailacct` (
782 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
783 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
784 `server` varchar(255) NOT NULL DEFAULT '' COMMENT '',
785 `port` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
786 `ssltype` varchar(16) NOT NULL DEFAULT '' COMMENT '',
787 `mailbox` varchar(255) NOT NULL DEFAULT '' COMMENT '',
788 `user` varchar(255) NOT NULL DEFAULT '' COMMENT '',
789 `pass` text COMMENT '',
790 `reply_to` varchar(255) NOT NULL DEFAULT '' COMMENT '',
791 `action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
792 `movetofolder` varchar(255) NOT NULL DEFAULT '' COMMENT '',
793 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
794 `last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
796 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Mail account data for fetching mails';
801 CREATE TABLE IF NOT EXISTS `manage` (
802 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
803 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
804 `mid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
806 UNIQUE INDEX `uid_mid` (`uid`,`mid`)
807 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='table of accounts that can manage each other';
812 CREATE TABLE IF NOT EXISTS `notify` (
813 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
814 `type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
815 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
816 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
817 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
818 `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
819 `msg` mediumtext COMMENT '',
820 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
821 `link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
822 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
823 `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
824 `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
825 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
826 `otype` varchar(10) NOT NULL DEFAULT '' COMMENT '',
827 `name_cache` tinytext COMMENT 'Cached bbcode parsing of name',
828 `msg_cache` mediumtext COMMENT 'Cached bbcode parsing of msg',
830 INDEX `seen_uid_date` (`seen`,`uid`,`date`),
831 INDEX `uid_date` (`uid`,`date`),
832 INDEX `uid_type_link` (`uid`,`type`,`link`(190))
833 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='notifications';
836 -- TABLE notify-threads
838 CREATE TABLE IF NOT EXISTS `notify-threads` (
839 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
840 `notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
841 `master-parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
842 `parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
843 `receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
845 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
850 CREATE TABLE IF NOT EXISTS `oembed` (
851 `url` varbinary(255) NOT NULL COMMENT 'page url',
852 `maxwidth` mediumint unsigned NOT NULL COMMENT 'Maximum width passed to Oembed',
853 `content` mediumtext COMMENT 'OEmbed data of the page',
854 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
855 PRIMARY KEY(`url`,`maxwidth`),
856 INDEX `created` (`created`)
857 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for OEmbed queries';
860 -- TABLE openwebauth-token
862 CREATE TABLE IF NOT EXISTS `openwebauth-token` (
863 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
864 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
865 `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Verify type',
866 `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'A generated token',
867 `meta` varchar(255) NOT NULL DEFAULT '' COMMENT '',
868 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
870 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store OpenWebAuth token to verify contacts';
875 CREATE TABLE IF NOT EXISTS `parsed_url` (
876 `url` varbinary(255) NOT NULL COMMENT 'page url',
877 `guessing` boolean NOT NULL DEFAULT '0' COMMENT 'is the \'guessing\' mode active?',
878 `oembed` boolean NOT NULL DEFAULT '0' COMMENT 'is the data the result of oembed?',
879 `content` mediumtext COMMENT 'page data',
880 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
881 PRIMARY KEY(`url`,`guessing`,`oembed`),
882 INDEX `created` (`created`)
883 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for \'parse_url\' queries';
886 -- TABLE participation
888 CREATE TABLE IF NOT EXISTS `participation` (
889 `iid` int unsigned NOT NULL COMMENT '',
890 `server` varchar(60) NOT NULL COMMENT '',
891 `cid` int unsigned NOT NULL COMMENT '',
892 `fid` int unsigned NOT NULL COMMENT '',
893 PRIMARY KEY(`iid`,`server`),
896 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Storage for participation messages from Diaspora';
901 CREATE TABLE IF NOT EXISTS `pconfig` (
902 `id` int unsigned NOT NULL auto_increment COMMENT '',
903 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
904 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
905 `k` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
906 `v` mediumtext COMMENT '',
908 UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
909 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='personal (per user) configuration storage';
912 -- TABLE permissionset
914 CREATE TABLE IF NOT EXISTS `permissionset` (
915 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
916 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id of this permission set',
917 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
918 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
919 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
920 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
922 INDEX `uid_allow_cid_allow_gid_deny_cid_deny_gid` (`allow_cid`(50),`allow_gid`(30),`deny_cid`(50),`deny_gid`(30))
923 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
928 CREATE TABLE IF NOT EXISTS `photo` (
929 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
930 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
931 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
932 `guid` char(16) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this photo',
933 `resource-id` char(32) NOT NULL DEFAULT '' COMMENT '',
934 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation date',
935 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edited date',
936 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
937 `desc` text COMMENT '',
938 `album` varchar(255) NOT NULL DEFAULT '' COMMENT 'The name of the album to which the photo belongs',
939 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
940 `type` varchar(30) NOT NULL DEFAULT 'image/jpeg',
941 `height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
942 `width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
943 `datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
944 `data` mediumblob NOT NULL COMMENT '',
945 `scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
946 `profile` boolean NOT NULL DEFAULT '0' COMMENT '',
947 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
948 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
949 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
950 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
951 `backend-class` tinytext COMMENT 'Storage backend class',
952 `backend-ref` text COMMENT 'Storage backend data reference',
953 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
955 INDEX `contactid` (`contact-id`),
956 INDEX `uid_contactid` (`uid`,`contact-id`),
957 INDEX `uid_profile` (`uid`,`profile`),
958 INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
959 INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`,`created`),
960 INDEX `resource-id` (`resource-id`)
961 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='photo storage';
966 CREATE TABLE IF NOT EXISTS `poll` (
967 `id` int unsigned NOT NULL auto_increment COMMENT '',
968 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
969 `q0` text COMMENT '',
970 `q1` text COMMENT '',
971 `q2` text COMMENT '',
972 `q3` text COMMENT '',
973 `q4` text COMMENT '',
974 `q5` text COMMENT '',
975 `q6` text COMMENT '',
976 `q7` text COMMENT '',
977 `q8` text COMMENT '',
978 `q9` text COMMENT '',
981 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently unused table for storing poll results';
986 CREATE TABLE IF NOT EXISTS `poll_result` (
987 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
988 `poll_id` int unsigned NOT NULL DEFAULT 0,
989 `choice` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
991 INDEX `poll_id` (`poll_id`)
992 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='data for polls - currently unused';
997 CREATE TABLE IF NOT EXISTS `process` (
998 `pid` int unsigned NOT NULL COMMENT '',
999 `command` varbinary(32) NOT NULL DEFAULT '' COMMENT '',
1000 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1002 INDEX `command` (`command`)
1003 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently running system processes';
1008 CREATE TABLE IF NOT EXISTS `profile` (
1009 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1010 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
1011 `profile-name` varchar(255) COMMENT 'Deprecated',
1012 `is-default` boolean COMMENT 'Deprecated',
1013 `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT 'Hide friend list from viewers of this profile',
1014 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1015 `pdesc` varchar(255) COMMENT 'Deprecated',
1016 `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT 'Day of birth',
1017 `address` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1018 `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1019 `region` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1020 `postal-code` varchar(32) NOT NULL DEFAULT '' COMMENT '',
1021 `country-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1022 `hometown` varchar(255) COMMENT 'Deprecated',
1023 `gender` varchar(32) COMMENT 'Deprecated',
1024 `marital` varchar(255) COMMENT 'Deprecated',
1025 `with` text COMMENT 'Deprecated',
1026 `howlong` datetime COMMENT 'Deprecated',
1027 `sexual` varchar(255) COMMENT 'Deprecated',
1028 `politic` varchar(255) COMMENT 'Deprecated',
1029 `religion` varchar(255) COMMENT 'Deprecated',
1030 `pub_keywords` text COMMENT '',
1031 `prv_keywords` text COMMENT '',
1032 `likes` text COMMENT 'Deprecated',
1033 `dislikes` text COMMENT 'Deprecated',
1034 `about` text COMMENT 'Profile description',
1035 `summary` varchar(255) COMMENT 'Deprecated',
1036 `music` text COMMENT 'Deprecated',
1037 `book` text COMMENT 'Deprecated',
1038 `tv` text COMMENT 'Deprecated',
1039 `film` text COMMENT 'Deprecated',
1040 `interest` text COMMENT 'Deprecated',
1041 `romance` text COMMENT 'Deprecated',
1042 `work` text COMMENT 'Deprecated',
1043 `education` text COMMENT 'Deprecated',
1044 `contact` text COMMENT 'Deprecated',
1045 `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1046 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1047 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1048 `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1049 `publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
1050 `net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
1052 INDEX `uid_is-default` (`uid`,`is-default`),
1053 FULLTEXT INDEX `pub_keywords` (`pub_keywords`)
1054 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
1057 -- TABLE profile_check
1059 CREATE TABLE IF NOT EXISTS `profile_check` (
1060 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1061 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1062 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
1063 `dfrn_id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1064 `sec` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1065 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1067 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='DFRN remote auth use';
1070 -- TABLE profile_field
1072 CREATE TABLE IF NOT EXISTS `profile_field` (
1073 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1074 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner user id',
1075 `order` mediumint unsigned NOT NULL DEFAULT 1 COMMENT 'Field ordering per user',
1076 `psid` int unsigned COMMENT 'ID of the permission set of this profile field - 0 = public',
1077 `label` varchar(255) NOT NULL DEFAULT '' COMMENT 'Label of the field',
1078 `value` text COMMENT 'Value of the field',
1079 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
1080 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
1082 INDEX `uid` (`uid`),
1083 INDEX `order` (`order`),
1084 INDEX `psid` (`psid`)
1085 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Custom profile fields';
1088 -- TABLE push_subscriber
1090 CREATE TABLE IF NOT EXISTS `push_subscriber` (
1091 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1092 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1093 `callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1094 `topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1095 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1096 `push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1097 `last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
1098 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1099 `renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
1100 `secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1102 INDEX `next_try` (`next_try`)
1103 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Used for OStatus: Contains feed subscribers';
1108 CREATE TABLE IF NOT EXISTS `register` (
1109 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1110 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1111 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1112 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1113 `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1114 `language` varchar(16) NOT NULL DEFAULT '' COMMENT '',
1115 `note` text COMMENT '',
1117 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
1122 CREATE TABLE IF NOT EXISTS `search` (
1123 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1124 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1125 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1128 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
1133 CREATE TABLE IF NOT EXISTS `session` (
1134 `id` bigint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1135 `sid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
1136 `data` text COMMENT '',
1137 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1139 INDEX `sid` (`sid`(64)),
1140 INDEX `expire` (`expire`)
1141 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='web session storage';
1146 CREATE TABLE IF NOT EXISTS `sign` (
1147 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1148 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
1149 `signed_text` mediumtext COMMENT '',
1150 `signature` text COMMENT '',
1151 `signer` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1153 UNIQUE INDEX `iid` (`iid`)
1154 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora signatures';
1159 CREATE TABLE IF NOT EXISTS `term` (
1160 `tid` int unsigned NOT NULL auto_increment COMMENT '',
1161 `oid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1162 `otype` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1163 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1164 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1165 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1166 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1167 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1168 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1169 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
1170 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1172 INDEX `term_type` (`term`(64),`type`),
1173 INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`(32)),
1174 INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
1175 INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
1176 INDEX `guid` (`guid`(64))
1177 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='item taxonomy (categories, tags, etc.) table';
1182 CREATE TABLE IF NOT EXISTS `thread` (
1183 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'sequential ID',
1184 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1185 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1186 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
1187 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item author',
1188 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1189 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1190 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1191 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1192 `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1193 `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
1194 `private` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '0=public, 1=private, 2=unlisted',
1195 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
1196 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
1197 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
1198 `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
1199 `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
1200 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
1201 `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
1202 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
1203 `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
1204 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1205 `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
1206 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
1207 `bookmark` boolean COMMENT '',
1209 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
1210 INDEX `uid_network_received` (`uid`,`network`,`received`),
1211 INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
1212 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
1213 INDEX `contactid` (`contact-id`),
1214 INDEX `ownerid` (`owner-id`),
1215 INDEX `authorid` (`author-id`),
1216 INDEX `uid_received` (`uid`,`received`),
1217 INDEX `uid_commented` (`uid`,`commented`),
1218 INDEX `uid_wall_received` (`uid`,`wall`,`received`),
1219 INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`)
1220 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Thread related data';
1225 CREATE TABLE IF NOT EXISTS `tokens` (
1226 `id` varchar(40) NOT NULL COMMENT '',
1227 `secret` text COMMENT '',
1228 `client_id` varchar(20) NOT NULL DEFAULT '',
1229 `expires` int NOT NULL DEFAULT 0 COMMENT '',
1230 `scope` varchar(200) NOT NULL DEFAULT '' COMMENT '',
1231 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1233 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
1238 CREATE TABLE IF NOT EXISTS `user` (
1239 `uid` mediumint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1240 `parent-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'The parent user that has full control about this user',
1241 `guid` varchar(64) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this user',
1242 `username` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this user is known by',
1243 `password` varchar(255) NOT NULL DEFAULT '' COMMENT 'encrypted password',
1244 `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?',
1245 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT 'nick- and user name',
1246 `email` varchar(255) NOT NULL DEFAULT '' COMMENT 'the users email address',
1247 `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1248 `timezone` varchar(128) NOT NULL DEFAULT '' COMMENT 'PHP-legal timezone',
1249 `language` varchar(32) NOT NULL DEFAULT 'en' COMMENT 'default language',
1250 `register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of registration',
1251 `login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last login',
1252 `default-location` varchar(255) NOT NULL DEFAULT '' COMMENT 'Default for item.location',
1253 `allow_location` boolean NOT NULL DEFAULT '0' COMMENT '1 allows to display the location',
1254 `theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
1255 `pubkey` text COMMENT 'RSA public key 4096 bit',
1256 `prvkey` text COMMENT 'RSA private key 4096 bit',
1257 `spubkey` text COMMENT '',
1258 `sprvkey` text COMMENT '',
1259 `verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
1260 `blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
1261 `blockwall` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to post to the profile page of the user',
1262 `hidewall` boolean NOT NULL DEFAULT '0' COMMENT 'Hide profile details from unkown viewers',
1263 `blocktags` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to tag the post of this user',
1264 `unkmail` boolean NOT NULL DEFAULT '0' COMMENT 'Permit unknown people to send private mails to this user',
1265 `cntunkmail` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1266 `notify-flags` smallint unsigned NOT NULL DEFAULT 65535 COMMENT 'email notification options',
1267 `page-flags` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'page/profile type',
1268 `account-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1269 `prvnets` boolean NOT NULL DEFAULT '0' COMMENT '',
1270 `pwdreset` varchar(255) COMMENT 'Password reset request token',
1271 `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
1272 `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1273 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1274 `account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed',
1275 `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
1276 `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted',
1277 `expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last warning of account expiration',
1278 `def_gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1279 `allow_cid` mediumtext COMMENT 'default permission for this user',
1280 `allow_gid` mediumtext COMMENT 'default permission for this user',
1281 `deny_cid` mediumtext COMMENT 'default permission for this user',
1282 `deny_gid` mediumtext COMMENT 'default permission for this user',
1283 `openidserver` text COMMENT '',
1285 INDEX `nickname` (`nickname`(32))
1286 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='The local users';
1291 CREATE TABLE IF NOT EXISTS `userd` (
1292 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1293 `username` varchar(255) NOT NULL COMMENT '',
1295 INDEX `username` (`username`(32))
1296 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Deleted usernames';
1299 -- TABLE user-contact
1301 CREATE TABLE IF NOT EXISTS `user-contact` (
1302 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the linked public contact',
1303 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1304 `blocked` boolean COMMENT 'Contact is completely blocked for this user',
1305 `ignored` boolean COMMENT 'Posts from this contact are ignored',
1306 `collapsed` boolean COMMENT 'Posts from this contact are collapsed',
1307 PRIMARY KEY(`uid`,`cid`)
1308 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific public contact data';
1313 CREATE TABLE IF NOT EXISTS `user-item` (
1314 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item id',
1315 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1316 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Marker to hide an item from the user',
1317 `ignored` boolean COMMENT 'Ignore this thread if set',
1318 `pinned` boolean COMMENT 'The item is pinned on the profile page',
1319 `notification-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1320 PRIMARY KEY(`uid`,`iid`),
1321 INDEX `uid_pinned` (`uid`,`pinned`),
1322 INDEX `iid_uid` (`iid`,`uid`)
1323 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
1328 CREATE TABLE IF NOT EXISTS `worker-ipc` (
1329 `key` int NOT NULL COMMENT '',
1330 `jobs` boolean COMMENT 'Flag for outstanding jobs',
1332 ) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Inter process communication between the frontend and the worker';
1335 -- TABLE workerqueue
1337 CREATE TABLE IF NOT EXISTS `workerqueue` (
1338 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id',
1339 `parameter` mediumtext COMMENT 'Task command',
1340 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority',
1341 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
1342 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
1343 `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
1344 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1345 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1346 `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
1348 INDEX `done_parameter` (`done`,`parameter`(64)),
1349 INDEX `done_executed` (`done`,`executed`),
1350 INDEX `done_priority_created` (`done`,`priority`,`created`),
1351 INDEX `done_priority_next_try` (`done`,`priority`,`next_try`),
1352 INDEX `done_pid_next_try` (`done`,`pid`,`next_try`),
1353 INDEX `done_pid_priority_created` (`done`,`pid`,`priority`,`created`)
1354 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
1359 CREATE TABLE IF NOT EXISTS `storage` (
1360 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented image data id',
1361 `data` longblob NOT NULL COMMENT 'file data',
1363 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Data stored by Database storage backend';