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.

1264 lines
59 KiB

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