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 60KB

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