]> git.mxchange.org Git - friendica.git/blob - database.sql
Merge pull request #5331 from nupplaphil/lock_tests_fixings
[friendica.git] / database.sql
1 -- ------------------------------------------
2 -- Friendica 2018.08-dev (The Tazmans Flax-lily)
3 -- DB_UPDATE_VERSION 1274
4 -- ------------------------------------------
5
6
7 --
8 -- TABLE addon
9 --
10 CREATE TABLE IF NOT EXISTS `addon` (
11         `id` int unsigned NOT NULL auto_increment COMMENT '',
12         `name` varchar(50) NOT NULL DEFAULT '' COMMENT 'addon base (file)name',
13         `version` varchar(50) NOT NULL DEFAULT '' COMMENT 'currently unused',
14         `installed` boolean NOT NULL DEFAULT '0' COMMENT 'currently always 1',
15         `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'currently unused',
16         `timestamp` int unsigned NOT NULL DEFAULT 0 COMMENT 'file timestamp to check for reloads',
17         `plugin_admin` boolean NOT NULL DEFAULT '0' COMMENT '1 = has admin config, 0 = has no admin config',
18          PRIMARY KEY(`id`),
19          UNIQUE INDEX `name` (`name`)
20 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registered addons';
21
22 --
23 -- TABLE attach
24 --
25 CREATE TABLE IF NOT EXISTS `attach` (
26         `id` int unsigned NOT NULL auto_increment COMMENT 'generated index',
27         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
28         `hash` varchar(64) NOT NULL DEFAULT '' COMMENT 'hash',
29         `filename` varchar(255) NOT NULL DEFAULT '' COMMENT 'filename of original',
30         `filetype` varchar(64) NOT NULL DEFAULT '' COMMENT 'mimetype',
31         `filesize` int unsigned NOT NULL DEFAULT 0 COMMENT 'size in bytes',
32         `data` longblob NOT NULL COMMENT 'file data',
33         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
34         `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
35         `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>',
36         `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
37         `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
38         `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
39          PRIMARY KEY(`id`)
40 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='file attachments';
41
42 --
43 -- TABLE auth_codes
44 --
45 CREATE TABLE IF NOT EXISTS `auth_codes` (
46         `id` varchar(40) NOT NULL COMMENT '',
47         `client_id` varchar(20) NOT NULL DEFAULT '' COMMENT '',
48         `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
49         `expires` int NOT NULL DEFAULT 0 COMMENT '',
50         `scope` varchar(250) NOT NULL DEFAULT '' COMMENT '',
51          PRIMARY KEY(`id`)
52 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
53
54 --
55 -- TABLE cache
56 --
57 CREATE TABLE IF NOT EXISTS `cache` (
58         `k` varbinary(255) NOT NULL COMMENT 'cache key',
59         `v` mediumtext COMMENT 'cached serialized value',
60         `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
61         `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache insertion',
62          PRIMARY KEY(`k`),
63          INDEX `k_expires` (`k`,`expires`)
64 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Stores temporary data';
65
66 --
67 -- TABLE challenge
68 --
69 CREATE TABLE IF NOT EXISTS `challenge` (
70         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
71         `challenge` varchar(255) NOT NULL DEFAULT '' COMMENT '',
72         `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
73         `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
74         `type` varchar(255) NOT NULL DEFAULT '' COMMENT '',
75         `last_update` varchar(255) NOT NULL DEFAULT '' COMMENT '',
76          PRIMARY KEY(`id`)
77 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
78
79 --
80 -- TABLE clients
81 --
82 CREATE TABLE IF NOT EXISTS `clients` (
83         `client_id` varchar(20) NOT NULL COMMENT '',
84         `pw` varchar(20) NOT NULL DEFAULT '' COMMENT '',
85         `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
86         `name` text COMMENT '',
87         `icon` text COMMENT '',
88         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
89          PRIMARY KEY(`client_id`)
90 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
91
92 --
93 -- TABLE config
94 --
95 CREATE TABLE IF NOT EXISTS `config` (
96         `id` int unsigned NOT NULL auto_increment COMMENT '',
97         `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
98         `k` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
99         `v` mediumtext COMMENT '',
100          PRIMARY KEY(`id`),
101          UNIQUE INDEX `cat_k` (`cat`,`k`)
102 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='main configuration storage';
103
104 --
105 -- TABLE contact
106 --
107 CREATE TABLE IF NOT EXISTS `contact` (
108         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
109         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
110         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
111         `self` boolean NOT NULL DEFAULT '0' COMMENT '1 if the contact is the user him/her self',
112         `remote_self` boolean NOT NULL DEFAULT '0' COMMENT '',
113         `rel` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'The kind of the relation between the user and the contact',
114         `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
115         `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network protocol of the contact',
116         `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
117         `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
118         `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
119         `about` text COMMENT '',
120         `keywords` text COMMENT 'public keywords (interests) of the contact',
121         `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
122         `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
123         `attag` varchar(255) NOT NULL DEFAULT '' COMMENT '',
124         `avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
125         `photo` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo of the contact',
126         `thumb` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (thumb size)',
127         `micro` varchar(255) DEFAULT '' COMMENT 'Link to the profile photo (micro size)',
128         `site-pubkey` text COMMENT '',
129         `issued-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
130         `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
131         `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
132         `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
133         `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
134         `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
135         `pubkey` text COMMENT 'RSA public key 4096 bit',
136         `prvkey` text COMMENT 'RSA private key 4096 bit',
137         `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
138         `request` varchar(255) COMMENT '',
139         `notify` varchar(255) COMMENT '',
140         `poll` varchar(255) COMMENT '',
141         `confirm` varchar(255) COMMENT '',
142         `poco` varchar(255) COMMENT '',
143         `aes_allow` boolean NOT NULL DEFAULT '0' COMMENT '',
144         `ret-aes` boolean NOT NULL DEFAULT '0' COMMENT '',
145         `usehub` boolean NOT NULL DEFAULT '0' COMMENT '',
146         `subhub` boolean NOT NULL DEFAULT '0' COMMENT '',
147         `hub-verify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
148         `last-update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last try to update the contact info',
149         `success_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last successful contact update',
150         `failure_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of the last failed update',
151         `name-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
152         `uri-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
153         `avatar-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
154         `term-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
155         `last-item` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'date of the last post',
156         `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
157         `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
158         `readonly` boolean NOT NULL DEFAULT '0' COMMENT 'posts of the contact are readonly',
159         `writable` boolean NOT NULL DEFAULT '0' COMMENT '',
160         `forum` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a forum',
161         `prv` boolean NOT NULL DEFAULT '0' COMMENT 'contact is a private group',
162         `contact-type` tinyint NOT NULL DEFAULT 0 COMMENT '',
163         `hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
164         `archive` boolean NOT NULL DEFAULT '0' COMMENT '',
165         `pending` boolean NOT NULL DEFAULT '1' COMMENT '',
166         `rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
167         `reason` text COMMENT '',
168         `closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
169         `info` mediumtext COMMENT '',
170         `profile-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
171         `bdyear` varchar(4) NOT NULL DEFAULT '' COMMENT '',
172         `bd` date NOT NULL DEFAULT '0001-01-01' COMMENT '',
173         `notify_new_posts` boolean NOT NULL DEFAULT '0' COMMENT '',
174         `fetch_further_information` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
175         `ffi_keyword_blacklist` text COMMENT '',
176          PRIMARY KEY(`id`),
177          INDEX `uid_name` (`uid`,`name`(190)),
178          INDEX `self_uid` (`self`,`uid`),
179          INDEX `alias_uid` (`alias`(32),`uid`),
180          INDEX `pending_uid` (`pending`,`uid`),
181          INDEX `blocked_uid` (`blocked`,`uid`),
182          INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
183          INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
184          INDEX `addr_uid` (`addr`(32),`uid`),
185          INDEX `nurl_uid` (`nurl`(32),`uid`),
186          INDEX `nick_uid` (`nick`(32),`uid`),
187          INDEX `dfrn-id` (`dfrn-id`(64)),
188          INDEX `issued-id` (`issued-id`(64))
189 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contact table';
190
191 --
192 -- TABLE conv
193 --
194 CREATE TABLE IF NOT EXISTS `conv` (
195         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
196         `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this conversation',
197         `recips` text COMMENT 'sender_handle;recipient_handle',
198         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
199         `creator` varchar(255) NOT NULL DEFAULT '' COMMENT 'handle of creator',
200         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation timestamp',
201         `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'edited timestamp',
202         `subject` text COMMENT 'subject of initial message',
203          PRIMARY KEY(`id`),
204          INDEX `uid` (`uid`)
205 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
206
207 --
208 -- TABLE conversation
209 --
210 CREATE TABLE IF NOT EXISTS `conversation` (
211         `item-uri` varbinary(255) NOT NULL COMMENT 'URI of the item',
212         `reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'URI to which this item is a reply',
213         `conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
214         `conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
215         `protocol` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'The protocol of the item',
216         `source` mediumtext COMMENT 'Original source',
217         `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
218          PRIMARY KEY(`item-uri`),
219          INDEX `conversation-uri` (`conversation-uri`),
220          INDEX `received` (`received`)
221 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
222
223 --
224 -- TABLE event
225 --
226 CREATE TABLE IF NOT EXISTS `event` (
227         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
228         `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
229         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
230         `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact_id (ID of the contact in contact table)',
231         `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
232         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time',
233         `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edit time',
234         `start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event start time',
235         `finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'event end time',
236         `summary` text COMMENT 'short description or title of the event',
237         `desc` text COMMENT 'event description',
238         `location` text COMMENT 'event location',
239         `type` varchar(20) NOT NULL DEFAULT '' COMMENT 'event or birthday',
240         `nofinish` boolean NOT NULL DEFAULT '0' COMMENT 'if event does have no end this is 1',
241         `adjust` boolean NOT NULL DEFAULT '1' COMMENT 'adjust to timezone of the recipient (0 or 1)',
242         `ignore` boolean NOT NULL DEFAULT '0' COMMENT '0 or 1',
243         `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
244         `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
245         `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
246         `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
247          PRIMARY KEY(`id`),
248          INDEX `uid_start` (`uid`,`start`)
249 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Events';
250
251 --
252 -- TABLE fcontact
253 --
254 CREATE TABLE IF NOT EXISTS `fcontact` (
255         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
256         `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'unique id',
257         `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
258         `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
259         `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
260         `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
261         `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
262         `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
263         `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
264         `notify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
265         `poll` varchar(255) NOT NULL DEFAULT '' COMMENT '',
266         `confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '',
267         `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
268         `network` char(4) NOT NULL DEFAULT '' COMMENT '',
269         `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
270         `pubkey` text COMMENT '',
271         `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
272          PRIMARY KEY(`id`),
273          INDEX `addr` (`addr`(32)),
274          UNIQUE INDEX `url` (`url`(190))
275 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora compatible contacts - used in the Diaspora implementation';
276
277 --
278 -- TABLE fsuggest
279 --
280 CREATE TABLE IF NOT EXISTS `fsuggest` (
281         `id` int unsigned NOT NULL auto_increment COMMENT '',
282         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
283         `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
284         `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
285         `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
286         `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
287         `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
288         `note` text COMMENT '',
289         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
290          PRIMARY KEY(`id`)
291 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='friend suggestion stuff';
292
293 --
294 -- TABLE gcign
295 --
296 CREATE TABLE IF NOT EXISTS `gcign` (
297         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
298         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Local User id',
299         `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT 'gcontact.id of ignored contact',
300          PRIMARY KEY(`id`),
301          INDEX `uid` (`uid`),
302          INDEX `gcid` (`gcid`)
303 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='contacts ignored by friend suggestions';
304
305 --
306 -- TABLE gcontact
307 --
308 CREATE TABLE IF NOT EXISTS `gcontact` (
309         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
310         `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this contact is known by',
311         `nick` varchar(255) NOT NULL DEFAULT '' COMMENT 'Nick- and user name of the contact',
312         `url` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the contacts profile page',
313         `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
314         `photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the profile photo',
315         `connect` varchar(255) NOT NULL DEFAULT '' COMMENT '',
316         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
317         `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
318         `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
319         `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
320         `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
321         `about` text COMMENT '',
322         `keywords` text COMMENT 'puplic keywords (interests)',
323         `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
324         `birthday` varchar(32) NOT NULL DEFAULT '0001-01-01' COMMENT '',
325         `community` boolean NOT NULL DEFAULT '0' COMMENT '1 if contact is forum account',
326         `contact-type` tinyint NOT NULL DEFAULT -1 COMMENT '',
327         `hide` boolean NOT NULL DEFAULT '0' COMMENT '1 = should be hidden from search',
328         `nsfw` boolean NOT NULL DEFAULT '0' COMMENT '1 = contact posts nsfw content',
329         `network` char(4) NOT NULL DEFAULT '' COMMENT 'social network protocol',
330         `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
331         `notify` varchar(255) COMMENT '',
332         `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
333         `generation` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
334         `server_url` varchar(255) NOT NULL DEFAULT '' COMMENT 'baseurl of the contacts server',
335          PRIMARY KEY(`id`),
336          UNIQUE INDEX `nurl` (`nurl`(190)),
337          INDEX `name` (`name`(64)),
338          INDEX `nick` (`nick`(32)),
339          INDEX `addr` (`addr`(64)),
340          INDEX `hide_network_updated` (`hide`,`network`,`updated`),
341          INDEX `updated` (`updated`)
342 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='global contacts';
343
344 --
345 -- TABLE glink
346 --
347 CREATE TABLE IF NOT EXISTS `glink` (
348         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
349         `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
350         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
351         `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
352         `zcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
353         `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
354          PRIMARY KEY(`id`),
355          UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
356          INDEX `gcid` (`gcid`)
357 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='\'friends of friends\' linkages derived from poco';
358
359 --
360 -- TABLE group
361 --
362 CREATE TABLE IF NOT EXISTS `group` (
363         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
364         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
365         `visible` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the member list is not private',
366         `deleted` boolean NOT NULL DEFAULT '0' COMMENT '1 indicates the group has been deleted',
367         `name` varchar(255) NOT NULL DEFAULT '' COMMENT 'human readable name of group',
368          PRIMARY KEY(`id`),
369          INDEX `uid` (`uid`)
370 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, group info';
371
372 --
373 -- TABLE group_member
374 --
375 CREATE TABLE IF NOT EXISTS `group_member` (
376         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
377         `gid` int unsigned NOT NULL DEFAULT 0 COMMENT 'groups.id of the associated group',
378         `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id of the member assigned to the associated group',
379          PRIMARY KEY(`id`),
380          INDEX `contactid` (`contact-id`),
381          UNIQUE INDEX `gid_contactid` (`gid`,`contact-id`)
382 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='privacy groups, member info';
383
384 --
385 -- TABLE gserver
386 --
387 CREATE TABLE IF NOT EXISTS `gserver` (
388         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
389         `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
390         `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
391         `version` varchar(255) NOT NULL DEFAULT '' COMMENT '',
392         `site_name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
393         `info` text COMMENT '',
394         `register_policy` tinyint NOT NULL DEFAULT 0 COMMENT '',
395         `registered-users` int unsigned NOT NULL DEFAULT 0 COMMENT 'Number of registered users',
396         `poco` varchar(255) NOT NULL DEFAULT '' COMMENT '',
397         `noscrape` varchar(255) NOT NULL DEFAULT '' COMMENT '',
398         `network` char(4) NOT NULL DEFAULT '' COMMENT '',
399         `platform` varchar(255) NOT NULL DEFAULT '' COMMENT '',
400         `relay-subscribe` boolean NOT NULL DEFAULT '0' COMMENT 'Has the server subscribed to the relay system',
401         `relay-scope` varchar(10) NOT NULL DEFAULT '' COMMENT 'The scope of messages that the server wants to get',
402         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
403         `last_poco_query` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
404         `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
405         `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
406          PRIMARY KEY(`id`),
407          UNIQUE INDEX `nurl` (`nurl`(190))
408 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Global servers';
409
410 --
411 -- TABLE gserver-tag
412 --
413 CREATE TABLE IF NOT EXISTS `gserver-tag` (
414         `gserver-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'The id of the gserver',
415         `tag` varchar(100) NOT NULL DEFAULT '' COMMENT 'Tag that the server has subscribed',
416          PRIMARY KEY(`gserver-id`,`tag`),
417          INDEX `tag` (`tag`)
418 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Tags that the server has subscribed';
419
420 --
421 -- TABLE hook
422 --
423 CREATE TABLE IF NOT EXISTS `hook` (
424         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
425         `hook` varbinary(100) NOT NULL DEFAULT '' COMMENT 'name of hook',
426         `file` varbinary(200) NOT NULL DEFAULT '' COMMENT 'relative filename of hook handler',
427         `function` varbinary(200) NOT NULL DEFAULT '' COMMENT 'function name of hook handler',
428         `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',
429          PRIMARY KEY(`id`),
430          UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
431 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='addon hook registry';
432
433 --
434 -- TABLE intro
435 --
436 CREATE TABLE IF NOT EXISTS `intro` (
437         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
438         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
439         `fid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
440         `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
441         `knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
442         `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
443         `note` text COMMENT '',
444         `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
445         `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
446         `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
447         `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
448          PRIMARY KEY(`id`)
449 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
450
451 --
452 -- TABLE item
453 --
454 CREATE TABLE IF NOT EXISTS `item` (
455         `id` int unsigned NOT NULL auto_increment,
456         `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this item',
457         `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
458         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner id which owns this copy of the item',
459         `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
460         `type` varchar(20) NOT NULL DEFAULT '' COMMENT '',
461         `wall` boolean NOT NULL DEFAULT '0' COMMENT 'This item was posted to the wall of uid',
462         `gravity` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
463         `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',
464         `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT 'uri of the parent to this item',
465         `extid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
466         `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',
467         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation timestamp.',
468         `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last edit (default is created)',
469         `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last comment/reply to this item',
470         `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime',
471         `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',
472         `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the owner of this item',
473         `owner-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name of the owner of this item',
474         `owner-link` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the profile page of the owner of this item',
475         `owner-avatar` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the avatar picture of the owner of this item',
476         `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Link to the contact table with uid=0 of the author of this item',
477         `author-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name of the author of this item',
478         `author-link` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the profile page of the author of this item',
479         `author-avatar` varchar(255) NOT NULL DEFAULT '' COMMENT 'Link to the avatar picture of the author of this item',
480         `icid` int unsigned COMMENT 'Id of the item-content table entry that contains the whole item content',
481         `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'item title',
482         `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
483         `body` mediumtext COMMENT 'item body content',
484         `app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
485         `verb` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams verb',
486         `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams object type',
487         `object` text COMMENT 'JSON encoded object structure unless it is an implied object (normal post)',
488         `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
489         `target` text COMMENT 'JSON encoded target structure if used',
490         `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',
491         `plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
492         `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',
493         `event-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Used to link to the event.id',
494         `tag` mediumtext COMMENT '',
495         `attach` mediumtext COMMENT 'JSON structure representing attachments to this item',
496         `inform` mediumtext COMMENT '',
497         `file` mediumtext COMMENT '',
498         `location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
499         `coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
500         `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
501         `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
502         `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
503         `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
504         `private` boolean NOT NULL DEFAULT '0' COMMENT 'distribution is restricted',
505         `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
506         `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
507         `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
508         `starred` boolean NOT NULL DEFAULT '0' COMMENT 'item has been favourited',
509         `bookmark` boolean NOT NULL DEFAULT '0' COMMENT 'item has been bookmarked',
510         `unseen` boolean NOT NULL DEFAULT '1' COMMENT 'item has not been seen',
511         `deleted` boolean NOT NULL DEFAULT '0' COMMENT 'item has been deleted',
512         `origin` boolean NOT NULL DEFAULT '0' COMMENT 'item originated at this site',
513         `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
514         `mention` boolean NOT NULL DEFAULT '0' COMMENT 'The owner of this item was mentioned in it',
515         `network` char(4) NOT NULL DEFAULT '' COMMENT 'Network from where the item comes from',
516         `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
517         `rendered-html` mediumtext COMMENT 'item.body converted to html',
518         `global` boolean NOT NULL DEFAULT '0' COMMENT '',
519          PRIMARY KEY(`id`),
520          INDEX `guid` (`guid`(191)),
521          INDEX `uri` (`uri`(191)),
522          INDEX `parent` (`parent`),
523          INDEX `parent-uri` (`parent-uri`(191)),
524          INDEX `extid` (`extid`(191)),
525          INDEX `uid_id` (`uid`,`id`),
526          INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
527          INDEX `uid_created` (`uid`,`created`),
528          INDEX `uid_commented` (`uid`,`commented`),
529          INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
530          INDEX `uid_network_received` (`uid`,`network`,`received`),
531          INDEX `uid_network_commented` (`uid`,`network`,`commented`),
532          INDEX `uid_thrparent` (`uid`,`thr-parent`(190)),
533          INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
534          INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
535          INDEX `authorid_created` (`author-id`,`created`),
536          INDEX `ownerid` (`owner-id`),
537          INDEX `uid_uri` (`uid`,`uri`(190)),
538          INDEX `resource-id` (`resource-id`),
539          INDEX `deleted_changed` (`deleted`,`changed`),
540          INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
541          INDEX `uid_eventid` (`uid`,`event-id`),
542          INDEX `icid` (`icid`)
543 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
544
545 --
546 -- TABLE item-content
547 --
548 CREATE TABLE IF NOT EXISTS `item-content` (
549         `id` int unsigned NOT NULL auto_increment,
550         `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
551         `uri-plink-hash` char(80) NOT NULL DEFAULT '' COMMENT 'SHA-1 hash from uri and plink',
552         `title` varchar(255) NOT NULL DEFAULT '' COMMENT 'item title',
553         `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
554         `body` mediumtext COMMENT 'item body content',
555         `location` varchar(255) NOT NULL DEFAULT '' COMMENT 'text location where this item originated',
556         `coord` varchar(255) NOT NULL DEFAULT '' COMMENT 'longitude/latitude pair representing location where this item originated',
557         `language` text COMMENT 'Language information about this post',
558         `app` varchar(255) NOT NULL DEFAULT '' COMMENT 'application which generated this item',
559         `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
560         `rendered-html` mediumtext COMMENT 'item.body converted to html',
561         `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams object type',
562         `object` text COMMENT 'JSON encoded object structure unless it is an implied object (normal post)',
563         `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams target type if applicable (URI)',
564         `target` text COMMENT 'JSON encoded target structure if used',
565         `plink` varchar(255) NOT NULL DEFAULT '' COMMENT 'permalink or URL to a displayable copy of the message at its source',
566         `verb` varchar(100) NOT NULL DEFAULT '' COMMENT 'ActivityStreams verb',
567          PRIMARY KEY(`id`),
568          UNIQUE INDEX `uri-plink-hash` (`uri-plink-hash`),
569          INDEX `uri` (`uri`(191))
570 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Content for all posts';
571
572 --
573 -- TABLE locks
574 --
575 CREATE TABLE IF NOT EXISTS `locks` (
576         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
577         `name` varchar(128) NOT NULL DEFAULT '' COMMENT '',
578         `locked` boolean NOT NULL DEFAULT '0' COMMENT '',
579         `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of lock expiration',
580         `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process ID',
581          PRIMARY KEY(`id`),
582          INDEX `name_expires` (`name`,`expires`)
583 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
584
585 --
586 -- TABLE mail
587 --
588 CREATE TABLE IF NOT EXISTS `mail` (
589         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
590         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
591         `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this private message',
592         `from-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'name of the sender',
593         `from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact photo link of the sender',
594         `from-url` varchar(255) NOT NULL DEFAULT '' COMMENT 'profile linke of the sender',
595         `contact-id` varchar(255) NOT NULL DEFAULT '' COMMENT 'contact.id',
596         `convid` int unsigned NOT NULL DEFAULT 0 COMMENT 'conv.id',
597         `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
598         `body` mediumtext COMMENT '',
599         `seen` boolean NOT NULL DEFAULT '0' COMMENT 'if message visited it is 1',
600         `reply` boolean NOT NULL DEFAULT '0' COMMENT '',
601         `replied` boolean NOT NULL DEFAULT '0' COMMENT '',
602         `unknown` boolean NOT NULL DEFAULT '0' COMMENT 'if sender not in the contact table this is 1',
603         `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
604         `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
605         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation time of the private message',
606          PRIMARY KEY(`id`),
607          INDEX `uid_seen` (`uid`,`seen`),
608          INDEX `convid` (`convid`),
609          INDEX `uri` (`uri`(64)),
610          INDEX `parent-uri` (`parent-uri`(64)),
611          INDEX `contactid` (`contact-id`(32))
612 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='private messages';
613
614 --
615 -- TABLE mailacct
616 --
617 CREATE TABLE IF NOT EXISTS `mailacct` (
618         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
619         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
620         `server` varchar(255) NOT NULL DEFAULT '' COMMENT '',
621         `port` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
622         `ssltype` varchar(16) NOT NULL DEFAULT '' COMMENT '',
623         `mailbox` varchar(255) NOT NULL DEFAULT '' COMMENT '',
624         `user` varchar(255) NOT NULL DEFAULT '' COMMENT '',
625         `pass` text COMMENT '',
626         `reply_to` varchar(255) NOT NULL DEFAULT '' COMMENT '',
627         `action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
628         `movetofolder` varchar(255) NOT NULL DEFAULT '' COMMENT '',
629         `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
630         `last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
631          PRIMARY KEY(`id`)
632 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Mail account data for fetching mails';
633
634 --
635 -- TABLE manage
636 --
637 CREATE TABLE IF NOT EXISTS `manage` (
638         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
639         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
640         `mid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
641          PRIMARY KEY(`id`),
642          UNIQUE INDEX `uid_mid` (`uid`,`mid`)
643 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='table of accounts that can manage each other';
644
645 --
646 -- TABLE notify
647 --
648 CREATE TABLE IF NOT EXISTS `notify` (
649         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
650         `hash` varchar(64) NOT NULL DEFAULT '' COMMENT '',
651         `type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
652         `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
653         `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
654         `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
655         `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
656         `msg` mediumtext COMMENT '',
657         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
658         `link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
659         `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
660         `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
661         `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
662         `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
663         `otype` varchar(10) NOT NULL DEFAULT '' COMMENT '',
664         `name_cache` tinytext COMMENT 'Cached bbcode parsing of name',
665         `msg_cache` mediumtext COMMENT 'Cached bbcode parsing of msg',
666          PRIMARY KEY(`id`),
667          INDEX `hash_uid` (`hash`,`uid`),
668          INDEX `seen_uid_date` (`seen`,`uid`,`date`),
669          INDEX `uid_date` (`uid`,`date`),
670          INDEX `uid_type_link` (`uid`,`type`,`link`(190))
671 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='notifications';
672
673 --
674 -- TABLE notify-threads
675 --
676 CREATE TABLE IF NOT EXISTS `notify-threads` (
677         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
678         `notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
679         `master-parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
680         `parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
681         `receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
682          PRIMARY KEY(`id`)
683 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
684
685 --
686 -- TABLE oembed
687 --
688 CREATE TABLE IF NOT EXISTS `oembed` (
689         `url` varbinary(255) NOT NULL COMMENT 'page url',
690         `maxwidth` mediumint unsigned NOT NULL COMMENT 'Maximum width passed to Oembed',
691         `content` mediumtext COMMENT 'OEmbed data of the page',
692         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
693          PRIMARY KEY(`url`,`maxwidth`),
694          INDEX `created` (`created`)
695 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for OEmbed queries';
696
697 --
698 -- TABLE openwebauth-token
699 --
700 CREATE TABLE IF NOT EXISTS `openwebauth-token` (
701         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
702         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
703         `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Verify type',
704         `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'A generated token',
705         `meta` varchar(255) NOT NULL DEFAULT '' COMMENT '',
706         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
707          PRIMARY KEY(`id`)
708 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Store OpenWebAuth token to verify contacts';
709
710 --
711 -- TABLE parsed_url
712 --
713 CREATE TABLE IF NOT EXISTS `parsed_url` (
714         `url` varbinary(255) NOT NULL COMMENT 'page url',
715         `guessing` boolean NOT NULL DEFAULT '0' COMMENT 'is the \'guessing\' mode active?',
716         `oembed` boolean NOT NULL DEFAULT '0' COMMENT 'is the data the result of oembed?',
717         `content` mediumtext COMMENT 'page data',
718         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of creation',
719          PRIMARY KEY(`url`,`guessing`,`oembed`),
720          INDEX `created` (`created`)
721 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='cache for \'parse_url\' queries';
722
723 --
724 -- TABLE participation
725 --
726 CREATE TABLE IF NOT EXISTS `participation` (
727         `iid` int unsigned NOT NULL COMMENT '',
728         `server` varchar(60) NOT NULL COMMENT '',
729         `cid` int unsigned NOT NULL COMMENT '',
730         `fid` int unsigned NOT NULL COMMENT '',
731          PRIMARY KEY(`iid`,`server`)
732 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Storage for participation messages from Diaspora';
733
734 --
735 -- TABLE pconfig
736 --
737 CREATE TABLE IF NOT EXISTS `pconfig` (
738         `id` int unsigned NOT NULL auto_increment COMMENT '',
739         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
740         `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
741         `k` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
742         `v` mediumtext COMMENT '',
743          PRIMARY KEY(`id`),
744          UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
745 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='personal (per user) configuration storage';
746
747 --
748 -- TABLE photo
749 --
750 CREATE TABLE IF NOT EXISTS `photo` (
751         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
752         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
753         `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
754         `guid` char(16) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this photo',
755         `resource-id` char(32) NOT NULL DEFAULT '' COMMENT '',
756         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'creation date',
757         `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'last edited date',
758         `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
759         `desc` text COMMENT '',
760         `album` varchar(255) NOT NULL DEFAULT '' COMMENT 'The name of the album to which the photo belongs',
761         `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
762         `type` varchar(30) NOT NULL DEFAULT 'image/jpeg',
763         `height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
764         `width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
765         `datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
766         `data` mediumblob NOT NULL COMMENT '',
767         `scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
768         `profile` boolean NOT NULL DEFAULT '0' COMMENT '',
769         `allow_cid` mediumtext COMMENT 'Access Control - list of allowed contact.id \'<19><78>\'',
770         `allow_gid` mediumtext COMMENT 'Access Control - list of allowed groups',
771         `deny_cid` mediumtext COMMENT 'Access Control - list of denied contact.id',
772         `deny_gid` mediumtext COMMENT 'Access Control - list of denied groups',
773          PRIMARY KEY(`id`),
774          INDEX `contactid` (`contact-id`),
775          INDEX `uid_contactid` (`uid`,`contact-id`),
776          INDEX `uid_profile` (`uid`,`profile`),
777          INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
778          INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`,`created`),
779          INDEX `resource-id` (`resource-id`)
780 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='photo storage';
781
782 --
783 -- TABLE poll
784 --
785 CREATE TABLE IF NOT EXISTS `poll` (
786         `id` int unsigned NOT NULL auto_increment COMMENT '',
787         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
788         `q0` text COMMENT '',
789         `q1` text COMMENT '',
790         `q2` text COMMENT '',
791         `q3` text COMMENT '',
792         `q4` text COMMENT '',
793         `q5` text COMMENT '',
794         `q6` text COMMENT '',
795         `q7` text COMMENT '',
796         `q8` text COMMENT '',
797         `q9` text COMMENT '',
798          PRIMARY KEY(`id`),
799          INDEX `uid` (`uid`)
800 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently unused table for storing poll results';
801
802 --
803 -- TABLE poll_result
804 --
805 CREATE TABLE IF NOT EXISTS `poll_result` (
806         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
807         `poll_id` int unsigned NOT NULL DEFAULT 0,
808         `choice` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
809          PRIMARY KEY(`id`),
810          INDEX `poll_id` (`poll_id`)
811 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='data for polls - currently unused';
812
813 --
814 -- TABLE process
815 --
816 CREATE TABLE IF NOT EXISTS `process` (
817         `pid` int unsigned NOT NULL COMMENT '',
818         `command` varbinary(32) NOT NULL DEFAULT '' COMMENT '',
819         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
820          PRIMARY KEY(`pid`),
821          INDEX `command` (`command`)
822 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Currently running system processes';
823
824 --
825 -- TABLE profile
826 --
827 CREATE TABLE IF NOT EXISTS `profile` (
828         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
829         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'Owner User id',
830         `profile-name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name of the profile',
831         `is-default` boolean NOT NULL DEFAULT '0' COMMENT 'Mark this profile as default profile',
832         `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT 'Hide friend list from viewers of this profile',
833         `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
834         `pdesc` varchar(255) NOT NULL DEFAULT '' COMMENT 'Title or description',
835         `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT 'Day of birth',
836         `address` varchar(255) NOT NULL DEFAULT '' COMMENT '',
837         `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '',
838         `region` varchar(255) NOT NULL DEFAULT '' COMMENT '',
839         `postal-code` varchar(32) NOT NULL DEFAULT '' COMMENT '',
840         `country-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
841         `hometown` varchar(255) NOT NULL DEFAULT '' COMMENT '',
842         `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
843         `marital` varchar(255) NOT NULL DEFAULT '' COMMENT '',
844         `with` text COMMENT '',
845         `howlong` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
846         `sexual` varchar(255) NOT NULL DEFAULT '' COMMENT '',
847         `politic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
848         `religion` varchar(255) NOT NULL DEFAULT '' COMMENT '',
849         `pub_keywords` text COMMENT '',
850         `prv_keywords` text COMMENT '',
851         `likes` text COMMENT '',
852         `dislikes` text COMMENT '',
853         `about` text COMMENT '',
854         `summary` varchar(255) NOT NULL DEFAULT '' COMMENT '',
855         `music` text COMMENT '',
856         `book` text COMMENT '',
857         `tv` text COMMENT '',
858         `film` text COMMENT '',
859         `interest` text COMMENT '',
860         `romance` text COMMENT '',
861         `work` text COMMENT '',
862         `education` text COMMENT '',
863         `contact` text COMMENT '',
864         `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
865         `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
866         `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
867         `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
868         `publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish default profile in local directory',
869         `net-publish` boolean NOT NULL DEFAULT '0' COMMENT 'publish profile in global directory',
870          PRIMARY KEY(`id`),
871          INDEX `uid_is-default` (`uid`,`is-default`)
872 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='user profiles data';
873
874 --
875 -- TABLE profile_check
876 --
877 CREATE TABLE IF NOT EXISTS `profile_check` (
878         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
879         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
880         `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'contact.id',
881         `dfrn_id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
882         `sec` varchar(255) NOT NULL DEFAULT '' COMMENT '',
883         `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
884          PRIMARY KEY(`id`)
885 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='DFRN remote auth use';
886
887 --
888 -- TABLE push_subscriber
889 --
890 CREATE TABLE IF NOT EXISTS `push_subscriber` (
891         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
892         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
893         `callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
894         `topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
895         `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
896         `push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
897         `last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
898         `next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
899         `renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
900         `secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
901          PRIMARY KEY(`id`),
902          INDEX `next_try` (`next_try`)
903 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Used for OStatus: Contains feed subscribers';
904
905 --
906 -- TABLE queue
907 --
908 CREATE TABLE IF NOT EXISTS `queue` (
909         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
910         `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Message receiver',
911         `network` char(4) NOT NULL DEFAULT '' COMMENT 'Receiver\'s network',
912         `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'Unique GUID of the message',
913         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date, when the message was created',
914         `last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last trial',
915         `next` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
916         `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
917         `content` mediumtext COMMENT '',
918         `batch` boolean NOT NULL DEFAULT '0' COMMENT '',
919          PRIMARY KEY(`id`),
920          INDEX `last` (`last`),
921          INDEX `next` (`next`)
922 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Queue for messages that couldn\'t be delivered';
923
924 --
925 -- TABLE register
926 --
927 CREATE TABLE IF NOT EXISTS `register` (
928         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
929         `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
930         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
931         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
932         `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
933         `language` varchar(16) NOT NULL DEFAULT '' COMMENT '',
934         `note` text COMMENT '',
935          PRIMARY KEY(`id`)
936 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registrations requiring admin approval';
937
938 --
939 -- TABLE search
940 --
941 CREATE TABLE IF NOT EXISTS `search` (
942         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
943         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
944         `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
945          PRIMARY KEY(`id`),
946          INDEX `uid` (`uid`)
947 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='';
948
949 --
950 -- TABLE session
951 --
952 CREATE TABLE IF NOT EXISTS `session` (
953         `id` bigint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
954         `sid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
955         `data` text COMMENT '',
956         `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
957          PRIMARY KEY(`id`),
958          INDEX `sid` (`sid`(64)),
959          INDEX `expire` (`expire`)
960 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='web session storage';
961
962 --
963 -- TABLE sign
964 --
965 CREATE TABLE IF NOT EXISTS `sign` (
966         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
967         `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'item.id',
968         `signed_text` mediumtext COMMENT '',
969         `signature` text COMMENT '',
970         `signer` varchar(255) NOT NULL DEFAULT '' COMMENT '',
971          PRIMARY KEY(`id`),
972          UNIQUE INDEX `iid` (`iid`)
973 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Diaspora signatures';
974
975 --
976 -- TABLE term
977 --
978 CREATE TABLE IF NOT EXISTS `term` (
979         `tid` int unsigned NOT NULL auto_increment COMMENT '',
980         `oid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
981         `otype` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
982         `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
983         `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
984         `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
985         `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
986         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
987         `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
988         `global` boolean NOT NULL DEFAULT '0' COMMENT '',
989         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
990          PRIMARY KEY(`tid`),
991          INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`(32)),
992          INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
993          INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
994          INDEX `guid` (`guid`(64))
995 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='item taxonomy (categories, tags, etc.) table';
996
997 --
998 -- TABLE thread
999 --
1000 CREATE TABLE IF NOT EXISTS `thread` (
1001         `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'sequential ID',
1002         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1003         `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1004         `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item owner',
1005         `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item author',
1006         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1007         `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1008         `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1009         `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1010         `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
1011         `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
1012         `private` boolean NOT NULL DEFAULT '0' COMMENT '',
1013         `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
1014         `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
1015         `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
1016         `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
1017         `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
1018         `bookmark` boolean NOT NULL DEFAULT '0' COMMENT '',
1019         `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
1020         `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
1021         `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
1022         `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1023         `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
1024         `network` char(4) NOT NULL DEFAULT '' COMMENT '',
1025          PRIMARY KEY(`iid`),
1026          INDEX `uid_network_commented` (`uid`,`network`,`commented`),
1027          INDEX `uid_network_created` (`uid`,`network`,`created`),
1028          INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
1029          INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
1030          INDEX `contactid` (`contact-id`),
1031          INDEX `ownerid` (`owner-id`),
1032          INDEX `authorid` (`author-id`),
1033          INDEX `uid_created` (`uid`,`created`),
1034          INDEX `uid_commented` (`uid`,`commented`),
1035          INDEX `uid_wall_created` (`uid`,`wall`,`created`),
1036          INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`)
1037 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Thread related data';
1038
1039 --
1040 -- TABLE tokens
1041 --
1042 CREATE TABLE IF NOT EXISTS `tokens` (
1043         `id` varchar(40) NOT NULL COMMENT '',
1044         `secret` text COMMENT '',
1045         `client_id` varchar(20) NOT NULL DEFAULT '',
1046         `expires` int NOT NULL DEFAULT 0 COMMENT '',
1047         `scope` varchar(200) NOT NULL DEFAULT '' COMMENT '',
1048         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1049          PRIMARY KEY(`id`)
1050 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='OAuth usage';
1051
1052 --
1053 -- TABLE user
1054 --
1055 CREATE TABLE IF NOT EXISTS `user` (
1056         `uid` mediumint unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1057         `parent-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'The parent user that has full control about this user',
1058         `guid` varchar(64) NOT NULL DEFAULT '' COMMENT 'A unique identifier for this user',
1059         `username` varchar(255) NOT NULL DEFAULT '' COMMENT 'Name that this user is known by',
1060         `password` varchar(255) NOT NULL DEFAULT '' COMMENT 'encrypted password',
1061         `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?',
1062         `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT 'nick- and user name',
1063         `email` varchar(255) NOT NULL DEFAULT '' COMMENT 'the users email address',
1064         `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
1065         `timezone` varchar(128) NOT NULL DEFAULT '' COMMENT 'PHP-legal timezone',
1066         `language` varchar(32) NOT NULL DEFAULT 'en' COMMENT 'default language',
1067         `register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of registration',
1068         `login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last login',
1069         `default-location` varchar(255) NOT NULL DEFAULT '' COMMENT 'Default for item.location',
1070         `allow_location` boolean NOT NULL DEFAULT '0' COMMENT '1 allows to display the location',
1071         `theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
1072         `pubkey` text COMMENT 'RSA public key 4096 bit',
1073         `prvkey` text COMMENT 'RSA private key 4096 bit',
1074         `spubkey` text COMMENT '',
1075         `sprvkey` text COMMENT '',
1076         `verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
1077         `blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
1078         `blockwall` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to post to the profile page of the user',
1079         `hidewall` boolean NOT NULL DEFAULT '0' COMMENT 'Hide profile details from unkown viewers',
1080         `blocktags` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to tag the post of this user',
1081         `unkmail` boolean NOT NULL DEFAULT '0' COMMENT 'Permit unknown people to send private mails to this user',
1082         `cntunkmail` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1083         `notify-flags` smallint unsigned NOT NULL DEFAULT 65535 COMMENT 'email notification options',
1084         `page-flags` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'page/profile type',
1085         `account-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
1086         `prvnets` boolean NOT NULL DEFAULT '0' COMMENT '',
1087         `pwdreset` varchar(255) COMMENT 'Password reset request token',
1088         `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
1089         `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
1090         `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1091         `account_removed` boolean NOT NULL DEFAULT '0' COMMENT 'if 1 the account is removed',
1092         `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
1093         `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp when account expires and will be deleted',
1094         `expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'timestamp of last warning of account expiration',
1095         `def_gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
1096         `allow_cid` mediumtext COMMENT 'default permission for this user',
1097         `allow_gid` mediumtext COMMENT 'default permission for this user',
1098         `deny_cid` mediumtext COMMENT 'default permission for this user',
1099         `deny_gid` mediumtext COMMENT 'default permission for this user',
1100         `openidserver` text COMMENT '',
1101          PRIMARY KEY(`uid`),
1102          INDEX `nickname` (`nickname`(32))
1103 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='The local users';
1104
1105 --
1106 -- TABLE userd
1107 --
1108 CREATE TABLE IF NOT EXISTS `userd` (
1109         `id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
1110         `username` varchar(255) NOT NULL COMMENT '',
1111          PRIMARY KEY(`id`),
1112          INDEX `username` (`username`(32))
1113 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Deleted usernames';
1114
1115 --
1116 -- TABLE user-item
1117 --
1118 CREATE TABLE IF NOT EXISTS `user-item` (
1119         `iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item id',
1120         `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
1121         `hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Marker to hide an item from the user',
1122          PRIMARY KEY(`uid`,`iid`)
1123 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
1124
1125 --
1126 -- TABLE worker-ipc
1127 --
1128 CREATE TABLE IF NOT EXISTS `worker-ipc` (
1129         `key` int NOT NULL COMMENT '',
1130         `jobs` boolean COMMENT 'Flag for outstanding jobs',
1131          PRIMARY KEY(`key`)
1132 ) ENGINE=MEMORY DEFAULT COLLATE utf8mb4_general_ci COMMENT='Inter process communication between the frontend and the worker';
1133
1134 --
1135 -- TABLE workerqueue
1136 --
1137 CREATE TABLE IF NOT EXISTS `workerqueue` (
1138         `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id',
1139         `parameter` mediumblob COMMENT 'Task command',
1140         `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority',
1141         `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
1142         `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
1143         `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
1144         `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
1145          PRIMARY KEY(`id`),
1146          INDEX `pid` (`pid`),
1147          INDEX `parameter` (`parameter`(64)),
1148          INDEX `priority_created` (`priority`,`created`),
1149          INDEX `done_executed` (`done`,`executed`)
1150 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
1151
1152