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.

database.sql 62KB

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