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.

1378 lines
65KB

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