Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there)
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.

database.sql 62KB

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