Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1276 lines
59 KiB

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