1 -- ------------------------------------------
2 -- Friendica 2019.09-dev (Dalmatian Bellflower)
3 -- DB_UPDATE_VERSION 1319
4 -- ------------------------------------------
8 -- TABLE 2fa_recovery_codes
10 CREATE TABLE IF NOT EXISTS `2fa_recovery_codes` (
11 `uid` mediumint unsigned NOT NULL COMMENT 'User ID',
12 `code` varchar(50) NOT NULL COMMENT 'Recovery code string',
13 `generated` datetime NOT NULL COMMENT 'Datetime the code was generated',
14 `used` datetime COMMENT 'Datetime the code was used',
15 PRIMARY KEY(`uid`,`code`)
16 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor authentication recovery codes';
21 CREATE TABLE IF NOT EXISTS `addon` (
22 `id` int unsigned NOT NULL auto_increment COMMENT '',
23 `name` varchar(50) NOT NULL DEFAULT '' COMMENT 'addon base (file)name',
24 `version` varchar(50) NOT NULL DEFAULT '' COMMENT 'currently unused',
25 `installed` boolean NOT NULL DEFAULT '0' COMMENT 'currently always 1',
26 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'currently unused',
27 `timestamp` int unsigned NOT NULL DEFAULT 0 COMMENT 'file timestamp to check for reloads',
28 `plugin_admin` boolean NOT NULL DEFAULT '0' COMMENT '1 = has admin config, 0 = has no admin config',
30 UNIQUE INDEX `name` (`name`)
31 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registered addons';
36 CREATE TABLE IF NOT EXISTS `apcontact` (
37 `url` varbinary(255) NOT NULL COMMENT 'URL of the contact',
38 `uuid` varchar(255) COMMENT '',
39 `type` varchar(20) NOT NULL COMMENT '',
40 `following` varchar(255) COMMENT '',
41 `followers` varchar(255) COMMENT '',
42 `inbox` varchar(255) NOT NULL COMMENT '',
43 `outbox` varchar(255) COMMENT '',
44 `sharedinbox` varchar(255) COMMENT '',
45 `manually-approve` boolean COMMENT '',
46 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
47 `name` varchar(255) COMMENT '',
48 `about` text COMMENT '',
49 `photo` varchar(255) COMMENT '',
50 `addr` varchar(255) COMMENT '',
51 `alias` varchar(255) COMMENT '',
52 `pubkey` text COMMENT '',
53 `baseurl` varchar(255) COMMENT 'baseurl of the ap contact',
54 `generator` varchar(255) COMMENT 'Name of the contact\'s system',
55 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
57 INDEX `addr` (`addr`(32)),
58 INDEX `alias` (`alias`(190)),
59 INDEX `url` (`followers`(190))
60 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='ActivityPub compatible contacts - used in the ActivityPub implementation';
65 CREATE TABLE IF NOT EXISTS `attach` (
66 `id` int unsigned NOT NULL auto_increment COMMENT 'generated index',
67 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
68 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT 'hash',
69 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT 'filename of original',
70 `filetype` varchar(64) NOT NULL DEFAULT '' COMMENT 'mimetype',
71 `filesize` int unsigned NOT NULL DEFAULT 0 COMMENT 'size in bytes',
72 `data` longblob NOT NULL COMMENT 'file data',
73 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
74 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
75 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>',
76 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
77 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
78 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
79 `backend-class` tinytext COMMENT 'Storage backend class',
80 `backend-ref` text COMMENT 'Storage backend data reference',
82 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='file attachments';
87 CREATE TABLE IF NOT EXISTS `auth_codes` (
88 `id` varchar(40) NOT NULL COMMENT '',
89 `client_id` varchar(20) NOT NULL DEFAULT '' COMMENT '',
90 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
91 `expires` int NOT NULL DEFAULT 0 COMMENT '',
92 `scope` varchar(250) NOT NULL DEFAULT '' COMMENT '',
94 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
99 CREATE TABLE IF NOT EXISTS `cache` (
100 `k` varbinary(255) NOT NULL COMMENT 'cache key',
101 `v` mediumtext COMMENT 'cached serialized value',
102 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
103 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache insertion',
105 INDEX `k_expires` (`k`,`expires`)
106 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Stores temporary data';
111 CREATE TABLE IF NOT EXISTS `challenge` (
112 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
113 `challenge` varchar(255) NOT NULL DEFAULT '' COMMENT '',
114 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
115 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
116 `type` varchar(255) NOT NULL DEFAULT '' COMMENT '',
117 `last_update` varchar(255) NOT NULL DEFAULT '' COMMENT '',
119 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
124 CREATE TABLE IF NOT EXISTS `clients` (
125 `client_id` varchar(20) NOT NULL COMMENT '',
126 `pw` varchar(20) NOT NULL DEFAULT '' COMMENT '',
127 `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
128 `name` text COMMENT '',
129 `icon` text COMMENT '',
130 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
131 PRIMARY KEY(`client_id`)
132 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
137 CREATE TABLE IF NOT EXISTS `config` (
138 `id` int unsigned NOT NULL auto_increment COMMENT '',
139 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
140 `k` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
141 `v` mediumtext COMMENT '',
143 UNIQUE INDEX `cat_k` (`cat`,`k`)
144 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='main configuration storage';
149 CREATE TABLE IF NOT EXISTS `contact` (
150 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
151 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
152 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
153 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last contact update',
154 `self` boolean NOT NULL DEFAULT '0' COMMENT '1 if the contact is the user him/her self',
155 `remote_self` boolean NOT NULL DEFAULT '0' COMMENT '',
156 `rel` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'The kind of the relation between the user and the contact',
157 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
158 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network of the contact',
159 `protocol` char(4) NOT NULL DEFAULT '' COMMENT 'Protocol of the contact',
160 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
161 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
162 `location` varchar(255) DEFAULT '' COMMENT '',
163 `about` text COMMENT '',
164 `keywords` text COMMENT 'public keywords (interests) of the contact',
165 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
166 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
167 `attag` varchar(255) NOT NULL DEFAULT '' COMMENT '',
168 `avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
169 `photo` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo of the contact',
170 `thumb` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (thumb size)',
171 `micro` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (micro size)',
172 `site-pubkey` text COMMENT '',
173 `issued-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
174 `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
175 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
176 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
177 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
178 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
179 `pubkey` text COMMENT 'RSA public key 4096 bit',
180 `prvkey` text COMMENT 'RSA private key 4096 bit',
181 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
182 `request` varchar(255) COMMENT '',
183 `notify` varchar(255) COMMENT '',
184 `poll` varchar(255) COMMENT '',
185 `confirm` varchar(255) COMMENT '',
186 `poco` varchar(255) COMMENT '',
187 `aes_allow` boolean NOT NULL DEFAULT '0' COMMENT '',
188 `ret-aes` boolean NOT NULL DEFAULT '0' COMMENT '',
189 `usehub` boolean NOT NULL DEFAULT '0' COMMENT '',
190 `subhub` boolean NOT NULL DEFAULT '0' COMMENT '',
191 `hub-verify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
192 `last-update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last try to update the contact info',
193 `success_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful contact update',
194 `failure_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed update',
195 `name-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
196 `uri-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
197 `avatar-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
198 `term-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
199 `last-item` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'date of the last post',
200 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
201 `blocked` boolean NOT NULL DEFAULT '1' COMMENT 'Node-wide block status',
202 `block_reason` text COMMENT 'Node-wide block reason',
203 `readonly` boolean NOT NULL DEFAULT '0' COMMENT 'posts of the contact are readonly',
204 `writable` boolean NOT NULL DEFAULT '0' COMMENT '',
205 `forum` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a forum',
206 `prv` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a private group',
207 `contact-type` tinyint NOT NULL DEFAULT 0 COMMENT '',
208 `hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
209 `archive` boolean NOT NULL DEFAULT '0' COMMENT '',
210 `pending` boolean NOT NULL DEFAULT '1' COMMENT '',
211 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'Contact has been deleted',
212 `rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
213 `unsearchable` boolean NOT NULL DEFAULT '0' COMMENT 'Contact prefers to not be searchable',
214 `sensitive` boolean NOT NULL DEFAULT '0' COMMENT 'Contact posts sensitive content',
215 `baseurl` varchar(255) DEFAULT '' COMMENT 'baseurl of the contact',
216 `reason` text COMMENT '',
217 `closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
218 `info` mediumtext COMMENT '',
219 `profile-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
220 `bdyear` varchar(4) NOT NULL DEFAULT '' COMMENT '',
221 `bd` date NOT NULL DEFAULT '0001-01-01' COMMENT '',
222 `notify_new_posts` boolean NOT NULL DEFAULT '0' COMMENT '',
223 `fetch_further_information` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
224 `ffi_keyword_blacklist` text COMMENT '',
226 INDEX `uid_name` (`uid`,`name`(190)),
227 INDEX `self_uid` (`self`,`uid`),
228 INDEX `alias_uid` (`alias`(32),`uid`),
229 INDEX `pending_uid` (`pending`,`uid`),
230 INDEX `blocked_uid` (`blocked`,`uid`),
231 INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
232 INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
233 INDEX `addr_uid` (`addr`(32),`uid`),
234 INDEX `nurl_uid` (`nurl`(32),`uid`),
235 INDEX `nick_uid` (`nick`(32),`uid`),
236 INDEX `dfrn-id` (`dfrn-id`(64)),
237 INDEX `issued-id` (`issued-id`(64))
238 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contact table';
243 CREATE TABLE IF NOT EXISTS `conv` (
244 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
245 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this conversation',
246 `recips` text COMMENT 'sender_handle;recipient_handle',
247 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
248 `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'handle of creator',
249 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation timestamp',
250 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'edited timestamp',
251 `subject` text COMMENT 'subject of initial message',
254 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
257 -- TABLE conversation
259 CREATE TABLE IF NOT EXISTS `conversation` (
260 `item-uri` varbinary(255) NOT NULL COMMENT 'Original URI of the item - unrelated to the table with the same name',
261 `reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'URI to which this item is a reply',
262 `conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
263 `conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
264 `protocol` tinyint unsigned NOT NULL DEFAULT 255 COMMENT 'The protocol of the item',
265 `source` mediumtext COMMENT 'Original source',
266 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
267 PRIMARY KEY(`item-uri`),
268 INDEX `conversation-uri` (`conversation-uri`),
269 INDEX `received` (`received`)
270 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
273 -- TABLE diaspora-interaction
275 CREATE TABLE IF NOT EXISTS `diaspora-interaction` (
276 `uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
277 `interaction` mediumtext COMMENT 'The Diaspora interaction',
278 PRIMARY KEY(`uri-id`)
279 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Signed Diaspora Interaction';
284 CREATE TABLE IF NOT EXISTS `event` (
285 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
286 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
287 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
288 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact_id (ID of the contact in contact table)',
289 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
290 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
291 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
292 `start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event start time',
293 `finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event end time',
294 `summary` text COMMENT 'short description or title of the event',
295 `desc` text COMMENT 'event description',
296 `location` text COMMENT 'event location',
297 `type` varchar(20) NOT NULL DEFAULT '' COMMENT 'event or birthday',
298 `nofinish` boolean NOT NULL DEFAULT '0' COMMENT 'if event does have no end this is 1',
299 `adjust` boolean NOT NULL DEFAULT '1' COMMENT 'adjust to timezone of the recipient (0 or 1)',
300 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '0 or 1',
301 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
302 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
303 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
304 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
306 INDEX `uid_start` (`uid`,`start`)
307 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Events';
312 CREATE TABLE IF NOT EXISTS `fcontact` (
313 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
314 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'unique id',
315 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
316 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
317 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
318 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
319 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
320 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
321 `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
322 `notify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
323 `poll` varchar(255) NOT NULL DEFAULT '' COMMENT '',
324 `confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '',
325 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
326 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
327 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
328 `pubkey` text COMMENT '',
329 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
331 INDEX `addr` (`addr`(32)),
332 UNIQUE INDEX `url` (`url`(190))
333 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora compatible contacts - used in the Diaspora implementation';
338 CREATE TABLE IF NOT EXISTS `fsuggest` (
339 `id` int unsigned NOT NULL auto_increment COMMENT '',
340 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
341 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
342 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
343 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
344 `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
345 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
346 `note` text COMMENT '',
347 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
349 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='friend suggestion stuff';
354 CREATE TABLE IF NOT EXISTS `gcign` (
355 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
356 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Local User id',
357 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'gcontact.id of ignored contact',
360 INDEX `gcid` (`gcid`)
361 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contacts ignored by friend suggestions';
366 CREATE TABLE IF NOT EXISTS `gcontact` (
367 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
368 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
369 `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
370 `url` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the contacts profile page',
371 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
372 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the profile photo',
373 `connect` varchar(255) NOT NULL DEFAULT '' COMMENT '',
374 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
375 `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
376 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
377 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
378 `archive_date` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
379 `archived` boolean NOT NULL DEFAULT '0' COMMENT '',
380 `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
381 `about` text COMMENT '',
382 `keywords` text COMMENT 'puplic keywords (interests)',
383 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
384 `birthday` varchar(32) NOT NULL DEFAULT '0001-01-01' COMMENT '',
385 `community` boolean NOT NULL DEFAULT '0' COMMENT '1 if contact is forum account',
386 `contact-type` tinyint NOT NULL DEFAULT -1 COMMENT '',
387 `hide` boolean NOT NULL DEFAULT '0' COMMENT '1 = should be hidden from search',
388 `nsfw` boolean NOT NULL DEFAULT '0' COMMENT '1 = contact posts nsfw content',
389 `network` char(4) NOT NULL DEFAULT '' COMMENT 'social network protocol',
390 `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
391 `notify` varchar(255) COMMENT '',
392 `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
393 `generation` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
394 `server_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'baseurl of the contacts server',
396 UNIQUE INDEX `nurl` (`nurl`(190)),
397 INDEX `name` (`name`(64)),
398 INDEX `nick` (`nick`(32)),
399 INDEX `addr` (`addr`(64)),
400 INDEX `hide_network_updated` (`hide`,`network`,`updated`),
401 INDEX `updated` (`updated`)
402 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='global contacts';
407 CREATE TABLE IF NOT EXISTS `glink` (
408 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
409 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
410 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
411 `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
412 `zcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
413 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
415 UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
416 INDEX `gcid` (`gcid`)
417 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='\'friends of friends\' linkages derived from poco';
422 CREATE TABLE IF NOT EXISTS `group` (
423 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
424 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
425 `visible` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the member list is not private',
426 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the group has been deleted',
427 `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'human readable name of group',
430 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, group info';
433 -- TABLE group_member
435 CREATE TABLE IF NOT EXISTS `group_member` (
436 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
437 `gid` int unsigned NOT NULL DEFAULT 0 COMMENT 'groups.id of the associated group',
438 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id of the member assigned to the associated group',
440 INDEX `contactid` (`contact-id`),
441 UNIQUE INDEX `gid_contactid` (`gid`,`contact-id`)
442 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, member info';
447 CREATE TABLE IF NOT EXISTS `gserver` (
448 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
449 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
450 `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
451 `version` varchar(255) NOT NULL DEFAULT '' COMMENT '',
452 `site_name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
453 `info` text COMMENT '',
454 `register_policy` tinyint NOT NULL DEFAULT 0 COMMENT '',
455 `registered-users` int unsigned NOT NULL DEFAULT 0 COMMENT 'Number of registered users',
456 `poco` varchar(255) NOT NULL DEFAULT '' COMMENT '',
457 `noscrape` varchar(255) NOT NULL DEFAULT '' COMMENT '',
458 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
459 `platform` varchar(255) NOT NULL DEFAULT '' COMMENT '',
460 `relay-subscribe` boolean NOT NULL DEFAULT '0' COMMENT 'Has the server subscribed to the relay system',
461 `relay-scope` varchar(10) NOT NULL DEFAULT '' COMMENT 'The scope of messages that the server wants to get',
462 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
463 `last_poco_query` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
464 `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
465 `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
467 UNIQUE INDEX `nurl` (`nurl`(190))
468 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Global servers';
473 CREATE TABLE IF NOT EXISTS `gserver-tag` (
474 `gserver-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'The id of the gserver',
475 `tag` varchar(100) NOT NULL DEFAULT '' COMMENT 'Tag that the server has subscribed',
476 PRIMARY KEY(`gserver-id`,`tag`),
478 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Tags that the server has subscribed';
483 CREATE TABLE IF NOT EXISTS `hook` (
484 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
485 `hook` varbinary(100) NOT NULL DEFAULT '' COMMENT 'name of hook',
486 `file` varbinary(200) NOT NULL DEFAULT '' COMMENT 'relative filename of hook handler',
487 `function` varbinary(200) NOT NULL DEFAULT '' COMMENT 'function name of hook handler',
488 `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',
490 UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
491 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='addon hook registry';
494 -- TABLE inbox-status
496 CREATE TABLE IF NOT EXISTS `inbox-status` (
497 `url` varbinary(255) NOT NULL COMMENT 'URL of the inbox',
498 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date of this entry',
499 `success` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful delivery',
500 `failure` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed delivery',
501 `previous` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Previous delivery date',
502 `archive` boolean NOT NULL DEFAULT '0' COMMENT 'Is the inbox archived?',
503 `shared` boolean NOT NULL DEFAULT '0' COMMENT 'Is it a shared inbox?',
505 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Status of ActivityPub inboxes';
510 CREATE TABLE IF NOT EXISTS `intro` (
511 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
512 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
513 `fid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
514 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
515 `knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
516 `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
517 `note` text COMMENT '',
518 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
519 `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
520 `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
521 `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
523 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
528 CREATE TABLE IF NOT EXISTS `item` (
529 `id` int unsigned NOT NULL auto_increment,
530 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this item',
531 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
532 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
533 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
534 `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',
535 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT 'uri of the parent to this item',
536 `parent-uri-id` int unsigned COMMENT 'Id of the item-uri table that contains the parent uri',
537 `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',
538 `thr-parent-id` int unsigned COMMENT 'Id of the item-uri table that contains the thread parent uri',
539 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation timestamp.',
540 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last edit (default is created)',
541 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last comment/reply to this item',
542 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime',
543 `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',
544 `gravity` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
545 `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network from where the item comes from',
546 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
547 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
548 `icid` int unsigned COMMENT 'Id of the item-content table entry that contains the whole item content',
549 `iaid` int unsigned COMMENT 'Id of the item-activity table entry that contains the activity data',
550 `extid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
551 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
552 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
553 `private` boolean NOT NULL DEFAULT '0' COMMENT 'distribution is restricted',
554 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
555 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
556 `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'item has been deleted',
557 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id which owns this copy of the item',
558 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
559 `wall` boolean NOT NULL DEFAULT '0' COMMENT 'This item was posted to the wall of uid',
560 `origin` boolean NOT NULL DEFAULT '0' COMMENT 'item originated at this site',
561 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
562 `starred` boolean NOT NULL DEFAULT '0' COMMENT 'item has been favourited',
563 `unseen` boolean NOT NULL DEFAULT '1' COMMENT 'item has not been seen',
564 `mention` boolean NOT NULL DEFAULT '0' COMMENT 'The owner of this item was mentioned in it',
565 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
566 `psid` int unsigned COMMENT 'ID of the permission set of this post',
567 `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',
568 `event-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Used to link to the event.id',
569 `attach` mediumtext COMMENT 'JSON structure representing attachments to this item',
570 `allow_cid` mediumtext COMMENT 'Deprecated',
571 `allow_gid` mediumtext COMMENT 'Deprecated',
572 `deny_cid` mediumtext COMMENT 'Deprecated',
573 `deny_gid` mediumtext COMMENT 'Deprecated',
574 `postopts` text COMMENT 'Deprecated',
575 `inform` mediumtext COMMENT 'Deprecated',
576 `type` varchar(20) COMMENT 'Deprecated',
577 `bookmark` boolean COMMENT 'Deprecated',
578 `file` mediumtext COMMENT 'Deprecated',
579 `location` varchar(255) COMMENT 'Deprecated',
580 `coord` varchar(255) COMMENT 'Deprecated',
581 `tag` mediumtext COMMENT 'Deprecated',
582 `plink` varchar(255) COMMENT 'Deprecated',
583 `title` varchar(255) COMMENT 'Deprecated',
584 `content-warning` varchar(255) COMMENT 'Deprecated',
585 `body` mediumtext COMMENT 'Deprecated',
586 `app` varchar(255) COMMENT 'Deprecated',
587 `verb` varchar(100) COMMENT 'Deprecated',
588 `object-type` varchar(100) COMMENT 'Deprecated',
589 `object` text COMMENT 'Deprecated',
590 `target-type` varchar(100) COMMENT 'Deprecated',
591 `target` text COMMENT 'Deprecated',
592 `author-name` varchar(255) COMMENT 'Deprecated',
593 `author-link` varchar(255) COMMENT 'Deprecated',
594 `author-avatar` varchar(255) COMMENT 'Deprecated',
595 `owner-name` varchar(255) COMMENT 'Deprecated',
596 `owner-link` varchar(255) COMMENT 'Deprecated',
597 `owner-avatar` varchar(255) COMMENT 'Deprecated',
598 `rendered-hash` varchar(32) COMMENT 'Deprecated',
599 `rendered-html` mediumtext COMMENT 'Deprecated',
601 INDEX `guid` (`guid`(191)),
602 INDEX `uri` (`uri`(191)),
603 INDEX `parent` (`parent`),
604 INDEX `parent-uri` (`parent-uri`(191)),
605 INDEX `extid` (`extid`(191)),
606 INDEX `uid_id` (`uid`,`id`),
607 INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
608 INDEX `uid_received` (`uid`,`received`),
609 INDEX `uid_commented` (`uid`,`commented`),
610 INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
611 INDEX `uid_network_received` (`uid`,`network`,`received`),
612 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
613 INDEX `uid_thrparent` (`uid`,`thr-parent`(190)),
614 INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
615 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
616 INDEX `authorid_received` (`author-id`,`received`),
617 INDEX `ownerid` (`owner-id`),
618 INDEX `contact-id` (`contact-id`),
619 INDEX `uid_uri` (`uid`,`uri`(190)),
620 INDEX `resource-id` (`resource-id`),
621 INDEX `deleted_changed` (`deleted`,`changed`),
622 INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
623 INDEX `uid_eventid` (`uid`,`event-id`),
624 INDEX `icid` (`icid`),
625 INDEX `iaid` (`iaid`),
626 INDEX `psid_wall` (`psid`,`wall`)
627 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
630 -- TABLE item-activity
632 CREATE TABLE IF NOT EXISTS `item-activity` (
633 `id` int unsigned NOT NULL auto_increment,
634 `uri` varchar(255) COMMENT '',
635 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
636 `uri-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
637 `activity` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
639 UNIQUE INDEX `uri-hash` (`uri-hash`),
640 INDEX `uri` (`uri`(191)),
641 INDEX `uri-id` (`uri-id`)
642 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Activities for items';
645 -- TABLE item-content
647 CREATE TABLE IF NOT EXISTS `item-content` (
648 `id` int unsigned NOT NULL auto_increment,
649 `uri` varchar(255) COMMENT '',
650 `uri-id` int unsigned COMMENT 'Id of the item-uri table entry that contains the item uri',
651 `uri-plink-hash` varchar(80) NOT NULL DEFAULT '' COMMENT 'RIPEMD-128 hash from uri',
652 `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'item title',
653 `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
654 `body` mediumtext COMMENT 'item body content',
655 `location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
656 `coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
657 `language` text COMMENT 'Language information about this post',
658 `app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
659 `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
660 `rendered-html` mediumtext COMMENT 'item.body converted to html',
661 `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams object type',
662 `object` text COMMENT 'JSON encoded object structure unless it is an implied object (normal post)',
663 `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
664 `target` text COMMENT 'JSON encoded target structure if used',
665 `plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
666 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams verb',
668 UNIQUE INDEX `uri-plink-hash` (`uri-plink-hash`),
669 INDEX `uri` (`uri`(191)),
670 INDEX `plink` (`plink`(191)),
671 INDEX `uri-id` (`uri-id`)
672 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
675 -- TABLE item-delivery-data
677 CREATE TABLE IF NOT EXISTS `item-delivery-data` (
678 `iid` int unsigned NOT NULL COMMENT 'Item id',
679 `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',
680 `inform` mediumtext COMMENT 'Additional receivers of the linked item',
681 `queue_count` mediumint NOT NULL DEFAULT 0 COMMENT 'Initial number of delivery recipients, used as item.delivery_queue_count',
682 `queue_done` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries, used as item.delivery_queue_done',
683 `activitypub` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via ActivityPub',
684 `dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via DFRN',
685 `legacy_dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via legacy DFRN',
686 `diaspora` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via Diaspora',
687 `ostatus` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via OStatus',
689 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items';
694 CREATE TABLE IF NOT EXISTS `item-uri` (
695 `id` int unsigned NOT NULL auto_increment,
696 `uri` varbinary(255) NOT NULL COMMENT 'URI of an item',
697 `guid` varbinary(255) COMMENT 'A unique identifier for an item',
699 UNIQUE INDEX `uri` (`uri`),
700 INDEX `guid` (`guid`)
701 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='URI and GUID for items';
706 CREATE TABLE IF NOT EXISTS `locks` (
707 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
708 `name` varchar(128) NOT NULL DEFAULT '' COMMENT '',
709 `locked` boolean NOT NULL DEFAULT '0' COMMENT '',
710 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process ID',
711 `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
713 INDEX `name_expires` (`name`,`expires`)
714 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
719 CREATE TABLE IF NOT EXISTS `mail` (
720 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
721 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
722 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
723 `from-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the sender',
724 `from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
725 `from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
726 `contact-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact.id',
727 `convid` int unsigned NOT NULL DEFAULT 0 COMMENT 'conv.id',
728 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
729 `body` mediumtext COMMENT '',
730 `seen` boolean NOT NULL DEFAULT '0' COMMENT 'if message visited it is 1',
731 `reply` boolean NOT NULL DEFAULT '0' COMMENT '',
732 `replied` boolean NOT NULL DEFAULT '0' COMMENT '',
733 `unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
734 `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
735 `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
736 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
738 INDEX `uid_seen` (`uid`,`seen`),
739 INDEX `convid` (`convid`),
740 INDEX `uri` (`uri`(64)),
741 INDEX `parent-uri` (`parent-uri`(64)),
742 INDEX `contactid` (`contact-id`(32))
743 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
748 CREATE TABLE IF NOT EXISTS `mailacct` (
749 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
750 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
751 `server` varchar(255) NOT NULL DEFAULT '' COMMENT '',
752 `port` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
753 `ssltype` varchar(16) NOT NULL DEFAULT '' COMMENT '',
754 `mailbox` varchar(255) NOT NULL DEFAULT '' COMMENT '',
755 `user` varchar(255) NOT NULL DEFAULT '' COMMENT '',
756 `pass` text COMMENT '',
757 `reply_to` varchar(255) NOT NULL DEFAULT '' COMMENT '',
758 `action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
759 `movetofolder` varchar(255) NOT NULL DEFAULT '' COMMENT '',
760 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
761 `last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
763 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Mail account data for fetching mails';
768 CREATE TABLE IF NOT EXISTS `manage` (
769 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
770 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
771 `mid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
773 UNIQUE INDEX `uid_mid` (`uid`,`mid`)
774 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='table of accounts that can manage each other';
779 CREATE TABLE IF NOT EXISTS `notify` (
780 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
781 `hash` varchar(64) NOT NULL DEFAULT '' COMMENT '',
782 `type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
783 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
784 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
785 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
786 `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
787 `msg` mediumtext COMMENT '',
788 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
789 `link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
790 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
791 `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
792 `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
793 `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
794 `otype` varchar(10) NOT NULL DEFAULT '' COMMENT '',
795 `name_cache` tinytext COMMENT 'Cached bbcode parsing of name',
796 `msg_cache` mediumtext COMMENT 'Cached bbcode parsing of msg',
798 INDEX `hash_uid` (`hash`,`uid`),
799 INDEX `seen_uid_date` (`seen`,`uid`,`date`),
800 INDEX `uid_date` (`uid`,`date`),
801 INDEX `uid_type_link` (`uid`,`type`,`link`(190))
802 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='notifications';
805 -- TABLE notify-threads
807 CREATE TABLE IF NOT EXISTS `notify-threads` (
808 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
809 `notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
810 `master-parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
811 `parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
812 `receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
814 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
819 CREATE TABLE IF NOT EXISTS `oembed` (
820 `url` varbinary(255) NOT NULL COMMENT 'page url',
821 `maxwidth` mediumint unsigned NOT NULL COMMENT 'Maximum width passed to Oembed',
822 `content` mediumtext COMMENT 'OEmbed data of the page',
823 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
824 PRIMARY KEY(`url`,`maxwidth`),
825 INDEX `created` (`created`)
826 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for OEmbed queries';
829 -- TABLE openwebauth-token
831 CREATE TABLE IF NOT EXISTS `openwebauth-token` (
832 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
833 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
834 `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Verify type',
835 `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'A generated token',
836 `meta` varchar(255) NOT NULL DEFAULT '' COMMENT '',
837 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
839 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store OpenWebAuth token to verify contacts';
844 CREATE TABLE IF NOT EXISTS `parsed_url` (
845 `url` varbinary(255) NOT NULL COMMENT 'page url',
846 `guessing` boolean NOT NULL DEFAULT '0' COMMENT 'is the \'guessing\' mode active?',
847 `oembed` boolean NOT NULL DEFAULT '0' COMMENT 'is the data the result of oembed?',
848 `content` mediumtext COMMENT 'page data',
849 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
850 PRIMARY KEY(`url`,`guessing`,`oembed`),
851 INDEX `created` (`created`)
852 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for \'parse_url\' queries';
855 -- TABLE participation
857 CREATE TABLE IF NOT EXISTS `participation` (
858 `iid` int unsigned NOT NULL COMMENT '',
859 `server` varchar(60) NOT NULL COMMENT '',
860 `cid` int unsigned NOT NULL COMMENT '',
861 `fid` int unsigned NOT NULL COMMENT '',
862 PRIMARY KEY(`iid`,`server`),
865 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Storage for participation messages from Diaspora';
870 CREATE TABLE IF NOT EXISTS `pconfig` (
871 `id` int unsigned NOT NULL auto_increment COMMENT '',
872 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
873 `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
874 `k` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
875 `v` mediumtext COMMENT '',
877 UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
878 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='personal (per user) configuration storage';
881 -- TABLE permissionset
883 CREATE TABLE IF NOT EXISTS `permissionset` (
884 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
885 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id of this permission set',
886 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
887 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
888 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
889 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
891 INDEX `uid_allow_cid_allow_gid_deny_cid_deny_gid` (`allow_cid`(50),`allow_gid`(30),`deny_cid`(50),`deny_gid`(30))
892 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
897 CREATE TABLE IF NOT EXISTS `photo` (
898 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
899 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
900 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
901 `guid` char(16) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this photo',
902 `resource-id` char(32) NOT NULL DEFAULT '' COMMENT '',
903 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation date',
904 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edited date',
905 `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
906 `desc` text COMMENT '',
907 `album` varchar(255) NOT NULL DEFAULT '' COMMENT 'The name of the album to which the photo belongs',
908 `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
909 `type` varchar(30) NOT NULL DEFAULT 'image/jpeg',
910 `height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
911 `width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
912 `datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
913 `data` mediumblob NOT NULL COMMENT '',
914 `scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
915 `profile` boolean NOT NULL DEFAULT '0' COMMENT '',
916 `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
917 `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
918 `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
919 `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
920 `backend-class` tinytext COMMENT 'Storage backend class',
921 `backend-ref` text COMMENT 'Storage backend data reference',
922 `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
924 INDEX `contactid` (`contact-id`),
925 INDEX `uid_contactid` (`uid`,`contact-id`),
926 INDEX `uid_profile` (`uid`,`profile`),
927 INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
928 INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`,`created`),
929 INDEX `resource-id` (`resource-id`)
930 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='photo storage';
935 CREATE TABLE IF NOT EXISTS `poll` (
936 `id` int unsigned NOT NULL auto_increment COMMENT '',
937 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
938 `q0` text COMMENT '',
939 `q1` text COMMENT '',
940 `q2` text COMMENT '',
941 `q3` text COMMENT '',
942 `q4` text COMMENT '',
943 `q5` text COMMENT '',
944 `q6` text COMMENT '',
945 `q7` text COMMENT '',
946 `q8` text COMMENT '',
947 `q9` text COMMENT '',
950 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently unused table for storing poll results';
955 CREATE TABLE IF NOT EXISTS `poll_result` (
956 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
957 `poll_id` int unsigned NOT NULL DEFAULT 0,
958 `choice` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
960 INDEX `poll_id` (`poll_id`)
961 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='data for polls - currently unused';
966 CREATE TABLE IF NOT EXISTS `process` (
967 `pid` int unsigned NOT NULL COMMENT '',
968 `command` varbinary(32) NOT NULL DEFAULT '' COMMENT '',
969 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
971 INDEX `command` (`command`)
972 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently running system processes';
977 CREATE TABLE IF NOT EXISTS `profile` (
978 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
979 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
980 `profile-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name of the profile',
981 `is-default` boolean NOT NULL DEFAULT '0' COMMENT 'Mark this profile as default profile',
982 `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT 'Hide friend list from viewers of this profile',
983 `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
984 `pdesc` varchar(255) NOT NULL DEFAULT '' COMMENT 'Title or description',
985 `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT 'Day of birth',
986 `address` varchar(255) NOT NULL DEFAULT '' COMMENT '',
987 `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '',
988 `region` varchar(255) NOT NULL DEFAULT '' COMMENT '',
989 `postal-code` varchar(32) NOT NULL DEFAULT '' COMMENT '',
990 `country-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
991 `hometown` varchar(255) NOT NULL DEFAULT '' COMMENT '',
992 `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
993 `marital` varchar(255) NOT NULL DEFAULT '' COMMENT '',
994 `with` text COMMENT '',
995 `howlong` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
996 `sexual` varchar(255) NOT NULL DEFAULT '' COMMENT '',
997 `politic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
998 `religion` varchar(255) NOT NULL DEFAULT '' COMMENT '',
999 `pub_keywords` text COMMENT '',
1000 `prv_keywords` text COMMENT '',
1001 `likes` text COMMENT '',
1002 `dislikes` text COMMENT '',
1003 `about` text COMMENT '',
1004 `summary` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1005 `music` text COMMENT '',
1006 `book` text COMMENT '',
1007 `tv` text COMMENT '',
1008 `film` text COMMENT '',
1009 `interest` text COMMENT '',
1010 `romance` text COMMENT '',
1011 `work` text COMMENT '',
1012 `education` text COMMENT '',
1013 `contact` text COMMENT '',
1014 `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1015 `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1016 `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1017 `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1018 `publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
1019 `net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
1021 INDEX `uid_is-default` (`uid`,`is-default`),
1022 FULLTEXT INDEX `pub_keywords` (`pub_keywords`)
1023 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
1026 -- TABLE profile_check
1028 CREATE TABLE IF NOT EXISTS `profile_check` (
1029 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1030 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1031 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
1032 `dfrn_id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1033 `sec` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1034 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1036 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='DFRN remote auth use';
1039 -- TABLE push_subscriber
1041 CREATE TABLE IF NOT EXISTS `push_subscriber` (
1042 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1043 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1044 `callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1045 `topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1046 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1047 `push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1048 `last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
1049 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1050 `renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
1051 `secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1053 INDEX `next_try` (`next_try`)
1054 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Used for OStatus: Contains feed subscribers';
1059 CREATE TABLE IF NOT EXISTS `register` (
1060 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1061 `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1062 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1063 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1064 `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1065 `language` varchar(16) NOT NULL DEFAULT '' COMMENT '',
1066 `note` text COMMENT '',
1068 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
1073 CREATE TABLE IF NOT EXISTS `search` (
1074 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1075 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1076 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1079 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
1084 CREATE TABLE IF NOT EXISTS `session` (
1085 `id` bigint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1086 `sid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
1087 `data` text COMMENT '',
1088 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1090 INDEX `sid` (`sid`(64)),
1091 INDEX `expire` (`expire`)
1092 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='web session storage';
1097 CREATE TABLE IF NOT EXISTS `sign` (
1098 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1099 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
1100 `signed_text` mediumtext COMMENT '',
1101 `signature` text COMMENT '',
1102 `signer` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1104 UNIQUE INDEX `iid` (`iid`)
1105 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora signatures';
1110 CREATE TABLE IF NOT EXISTS `term` (
1111 `tid` int unsigned NOT NULL auto_increment COMMENT '',
1112 `oid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1113 `otype` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1114 `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1115 `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1116 `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1117 `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1118 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1119 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1120 `global` boolean NOT NULL DEFAULT '0' COMMENT '',
1121 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1123 INDEX `term_type` (`term`(64),`type`),
1124 INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`(32)),
1125 INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
1126 INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
1127 INDEX `guid` (`guid`(64))
1128 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='item taxonomy (categories, tags, etc.) table';
1133 CREATE TABLE IF NOT EXISTS `thread` (
1134 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'sequential ID',
1135 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1136 `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1137 `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
1138 `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item author',
1139 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1140 `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1141 `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1142 `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1143 `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1144 `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
1145 `private` boolean NOT NULL DEFAULT '0' COMMENT '',
1146 `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
1147 `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
1148 `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
1149 `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
1150 `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
1151 `post-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Post type (personal note, bookmark, ...)',
1152 `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
1153 `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
1154 `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
1155 `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1156 `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
1157 `network` char(4) NOT NULL DEFAULT '' COMMENT '',
1158 `bookmark` boolean COMMENT '',
1160 INDEX `uid_network_commented` (`uid`,`network`,`commented`),
1161 INDEX `uid_network_received` (`uid`,`network`,`received`),
1162 INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
1163 INDEX `uid_contactid_received` (`uid`,`contact-id`,`received`),
1164 INDEX `contactid` (`contact-id`),
1165 INDEX `ownerid` (`owner-id`),
1166 INDEX `authorid` (`author-id`),
1167 INDEX `uid_received` (`uid`,`received`),
1168 INDEX `uid_commented` (`uid`,`commented`),
1169 INDEX `uid_wall_received` (`uid`,`wall`,`received`),
1170 INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`)
1171 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Thread related data';
1176 CREATE TABLE IF NOT EXISTS `tokens` (
1177 `id` varchar(40) NOT NULL COMMENT '',
1178 `secret` text COMMENT '',
1179 `client_id` varchar(20) NOT NULL DEFAULT '',
1180 `expires` int NOT NULL DEFAULT 0 COMMENT '',
1181 `scope` varchar(200) NOT NULL DEFAULT '' COMMENT '',
1182 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1184 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
1189 CREATE TABLE IF NOT EXISTS `user` (
1190 `uid` mediumint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1191 `parent-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'The parent user that has full control about this user',
1192 `guid` varchar(64) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this user',
1193 `username` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this user is known by',
1194 `password` varchar(255) NOT NULL DEFAULT '' COMMENT 'encrypted password',
1195 `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?',
1196 `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT 'nick- and user name',
1197 `email` varchar(255) NOT NULL DEFAULT '' COMMENT 'the users email address',
1198 `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1199 `timezone` varchar(128) NOT NULL DEFAULT '' COMMENT 'PHP-legal timezone',
1200 `language` varchar(32) NOT NULL DEFAULT 'en' COMMENT 'default language',
1201 `register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of registration',
1202 `login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last login',
1203 `default-location` varchar(255) NOT NULL DEFAULT '' COMMENT 'Default for item.location',
1204 `allow_location` boolean NOT NULL DEFAULT '0' COMMENT '1 allows to display the location',
1205 `theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
1206 `pubkey` text COMMENT 'RSA public key 4096 bit',
1207 `prvkey` text COMMENT 'RSA private key 4096 bit',
1208 `spubkey` text COMMENT '',
1209 `sprvkey` text COMMENT '',
1210 `verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
1211 `blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
1212 `blockwall` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to post to the profile page of the user',
1213 `hidewall` boolean NOT NULL DEFAULT '0' COMMENT 'Hide profile details from unkown viewers',
1214 `blocktags` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to tag the post of this user',
1215 `unkmail` boolean NOT NULL DEFAULT '0' COMMENT 'Permit unknown people to send private mails to this user',
1216 `cntunkmail` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1217 `notify-flags` smallint unsigned NOT NULL DEFAULT 65535 COMMENT 'email notification options',
1218 `page-flags` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'page/profile type',
1219 `account-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1220 `prvnets` boolean NOT NULL DEFAULT '0' COMMENT '',
1221 `pwdreset` varchar(255) COMMENT 'Password reset request token',
1222 `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
1223 `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1224 `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1225 `account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed',
1226 `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
1227 `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted',
1228 `expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last warning of account expiration',
1229 `def_gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1230 `allow_cid` mediumtext COMMENT 'default permission for this user',
1231 `allow_gid` mediumtext COMMENT 'default permission for this user',
1232 `deny_cid` mediumtext COMMENT 'default permission for this user',
1233 `deny_gid` mediumtext COMMENT 'default permission for this user',
1234 `openidserver` text COMMENT '',
1236 INDEX `nickname` (`nickname`(32))
1237 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='The local users';
1242 CREATE TABLE IF NOT EXISTS `userd` (
1243 `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1244 `username` varchar(255) NOT NULL COMMENT '',
1246 INDEX `username` (`username`(32))
1247 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Deleted usernames';
1250 -- TABLE user-contact
1252 CREATE TABLE IF NOT EXISTS `user-contact` (
1253 `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Contact id of the linked public contact',
1254 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1255 `blocked` boolean COMMENT 'Contact is completely blocked for this user',
1256 `ignored` boolean COMMENT 'Posts from this contact are ignored',
1257 `collapsed` boolean COMMENT 'Posts from this contact are collapsed',
1258 PRIMARY KEY(`uid`,`cid`)
1259 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific public contact data';
1264 CREATE TABLE IF NOT EXISTS `user-item` (
1265 `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item id',
1266 `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1267 `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Marker to hide an item from the user',
1268 `ignored` boolean COMMENT 'Ignore this thread if set',
1269 PRIMARY KEY(`uid`,`iid`)
1270 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
1275 CREATE TABLE IF NOT EXISTS `worker-ipc` (
1276 `key` int NOT NULL COMMENT '',
1277 `jobs` boolean COMMENT 'Flag for outstanding jobs',
1279 ) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Inter process communication between the frontend and the worker';
1282 -- TABLE workerqueue
1284 CREATE TABLE IF NOT EXISTS `workerqueue` (
1285 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id',
1286 `parameter` mediumtext COMMENT 'Task command',
1287 `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority',
1288 `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
1289 `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
1290 `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
1291 `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
1292 `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
1293 `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
1295 INDEX `done_parameter` (`done`,`parameter`(64)),
1296 INDEX `done_executed` (`done`,`executed`),
1297 INDEX `done_priority_created` (`done`,`priority`,`created`),
1298 INDEX `done_priority_next_try` (`done`,`priority`,`next_try`),
1299 INDEX `done_pid_next_try` (`done`,`pid`,`next_try`),
1300 INDEX `done_pid_priority_created` (`done`,`pid`,`priority`,`created`)
1301 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
1306 CREATE TABLE IF NOT EXISTS `storage` (
1307 `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented image data id',
1308 `data` longblob NOT NULL COMMENT 'file data',
1310 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Data stored by Database storage backend';