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

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