Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1094 lines
43 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. -- ------------------------------------------
  2. -- Friendica 2018-05-dev (The Tazmans Flax-lily)
  3. -- DB_UPDATE_VERSION 1259
  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 '',
  11. `version` varchar(50) NOT NULL DEFAULT '' COMMENT '',
  12. `installed` boolean NOT NULL DEFAULT '0' COMMENT '',
  13. `hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
  14. `timestamp` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  15. `plugin_admin` boolean NOT NULL DEFAULT '0' COMMENT '',
  16. PRIMARY KEY(`id`),
  17. UNIQUE INDEX `name` (`name`)
  18. ) DEFAULT COLLATE utf8mb4_general_ci;
  19. --
  20. -- TABLE attach
  21. --
  22. CREATE TABLE IF NOT EXISTS `attach` (
  23. `id` int unsigned NOT NULL auto_increment COMMENT '',
  24. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  25. `hash` varchar(64) NOT NULL DEFAULT '' COMMENT '',
  26. `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  27. `filetype` varchar(64) NOT NULL DEFAULT '' COMMENT '',
  28. `filesize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  29. `data` longblob NOT NULL COMMENT '',
  30. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  31. `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  32. `allow_cid` mediumtext COMMENT '',
  33. `allow_gid` mediumtext COMMENT '',
  34. `deny_cid` mediumtext COMMENT '',
  35. `deny_gid` mediumtext COMMENT '',
  36. PRIMARY KEY(`id`)
  37. ) DEFAULT COLLATE utf8mb4_general_ci;
  38. --
  39. -- TABLE auth_codes
  40. --
  41. CREATE TABLE IF NOT EXISTS `auth_codes` (
  42. `id` varchar(40) NOT NULL COMMENT '',
  43. `client_id` varchar(20) NOT NULL DEFAULT '' COMMENT '',
  44. `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  45. `expires` int NOT NULL DEFAULT 0 COMMENT '',
  46. `scope` varchar(250) NOT NULL DEFAULT '' COMMENT '',
  47. PRIMARY KEY(`id`)
  48. ) DEFAULT COLLATE utf8mb4_general_ci;
  49. --
  50. -- TABLE cache
  51. --
  52. CREATE TABLE IF NOT EXISTS `cache` (
  53. `k` varbinary(255) NOT NULL COMMENT 'cache key',
  54. `v` mediumtext COMMENT 'cached serialized value',
  55. `expires` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache expiration',
  56. `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'datetime of cache insertion',
  57. PRIMARY KEY(`k`),
  58. INDEX `k_expires` (`k`,`expires`)
  59. ) DEFAULT COLLATE utf8mb4_general_ci;
  60. --
  61. -- TABLE challenge
  62. --
  63. CREATE TABLE IF NOT EXISTS `challenge` (
  64. `id` int unsigned NOT NULL auto_increment COMMENT '',
  65. `challenge` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  66. `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  67. `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  68. `type` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  69. `last_update` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  70. PRIMARY KEY(`id`)
  71. ) DEFAULT COLLATE utf8mb4_general_ci;
  72. --
  73. -- TABLE clients
  74. --
  75. CREATE TABLE IF NOT EXISTS `clients` (
  76. `client_id` varchar(20) NOT NULL COMMENT '',
  77. `pw` varchar(20) NOT NULL DEFAULT '' COMMENT '',
  78. `redirect_uri` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  79. `name` text COMMENT '',
  80. `icon` text COMMENT '',
  81. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  82. PRIMARY KEY(`client_id`)
  83. ) DEFAULT COLLATE utf8mb4_general_ci;
  84. --
  85. -- TABLE config
  86. --
  87. CREATE TABLE IF NOT EXISTS `config` (
  88. `id` int unsigned NOT NULL auto_increment COMMENT '',
  89. `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
  90. `k` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
  91. `v` mediumtext COMMENT '',
  92. PRIMARY KEY(`id`),
  93. UNIQUE INDEX `cat_k` (`cat`,`k`)
  94. ) DEFAULT COLLATE utf8mb4_general_ci;
  95. --
  96. -- TABLE contact
  97. --
  98. CREATE TABLE IF NOT EXISTS `contact` (
  99. `id` int unsigned NOT NULL auto_increment COMMENT '',
  100. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  101. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  102. `self` boolean NOT NULL DEFAULT '0' COMMENT '',
  103. `remote_self` boolean NOT NULL DEFAULT '0' COMMENT '',
  104. `rel` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  105. `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
  106. `network` char(4) NOT NULL DEFAULT '' COMMENT '',
  107. `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  108. `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  109. `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  110. `about` text COMMENT '',
  111. `keywords` text COMMENT '',
  112. `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
  113. `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  114. `attag` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  115. `avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  116. `photo` varchar(255) DEFAULT '' COMMENT '',
  117. `thumb` varchar(255) DEFAULT '' COMMENT '',
  118. `micro` varchar(255) DEFAULT '' COMMENT '',
  119. `site-pubkey` text COMMENT '',
  120. `issued-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  121. `dfrn-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  122. `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  123. `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  124. `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  125. `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  126. `pubkey` text COMMENT '',
  127. `prvkey` text COMMENT '',
  128. `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  129. `request` varchar(255) COMMENT '',
  130. `notify` varchar(255) COMMENT '',
  131. `poll` varchar(255) COMMENT '',
  132. `confirm` varchar(255) COMMENT '',
  133. `poco` varchar(255) COMMENT '',
  134. `aes_allow` boolean NOT NULL DEFAULT '0' COMMENT '',
  135. `ret-aes` boolean NOT NULL DEFAULT '0' COMMENT '',
  136. `usehub` boolean NOT NULL DEFAULT '0' COMMENT '',
  137. `subhub` boolean NOT NULL DEFAULT '0' COMMENT '',
  138. `hub-verify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  139. `last-update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  140. `success_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  141. `failure_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  142. `name-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  143. `uri-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  144. `avatar-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  145. `term-date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  146. `last-item` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  147. `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  148. `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
  149. `readonly` boolean NOT NULL DEFAULT '0' COMMENT '',
  150. `writable` boolean NOT NULL DEFAULT '0' COMMENT '',
  151. `forum` boolean NOT NULL DEFAULT '0' COMMENT '',
  152. `prv` boolean NOT NULL DEFAULT '0' COMMENT '',
  153. `contact-type` tinyint NOT NULL DEFAULT 0 COMMENT '',
  154. `hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
  155. `archive` boolean NOT NULL DEFAULT '0' COMMENT '',
  156. `pending` boolean NOT NULL DEFAULT '1' COMMENT '',
  157. `rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
  158. `reason` text COMMENT '',
  159. `closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
  160. `info` mediumtext COMMENT '',
  161. `profile-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  162. `bdyear` varchar(4) NOT NULL DEFAULT '' COMMENT '',
  163. `bd` date NOT NULL DEFAULT '0001-01-01' COMMENT '',
  164. `notify_new_posts` boolean NOT NULL DEFAULT '0' COMMENT '',
  165. `fetch_further_information` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  166. `ffi_keyword_blacklist` text COMMENT '',
  167. PRIMARY KEY(`id`),
  168. INDEX `uid_name` (`uid`,`name`(190)),
  169. INDEX `self_uid` (`self`,`uid`),
  170. INDEX `alias_uid` (`alias`(32),`uid`),
  171. INDEX `pending_uid` (`pending`,`uid`),
  172. INDEX `blocked_uid` (`blocked`,`uid`),
  173. INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
  174. INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
  175. INDEX `addr_uid` (`addr`(32),`uid`),
  176. INDEX `nurl_uid` (`nurl`(32),`uid`),
  177. INDEX `nick_uid` (`nick`(32),`uid`),
  178. INDEX `dfrn-id` (`dfrn-id`(64)),
  179. INDEX `issued-id` (`issued-id`(64))
  180. ) DEFAULT COLLATE utf8mb4_general_ci;
  181. --
  182. -- TABLE conv
  183. --
  184. CREATE TABLE IF NOT EXISTS `conv` (
  185. `id` int unsigned NOT NULL auto_increment COMMENT '',
  186. `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  187. `recips` text COMMENT '',
  188. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  189. `creator` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  190. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  191. `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  192. `subject` text COMMENT '',
  193. PRIMARY KEY(`id`),
  194. INDEX `uid` (`uid`)
  195. ) DEFAULT COLLATE utf8mb4_general_ci;
  196. --
  197. -- TABLE conversation
  198. --
  199. CREATE TABLE IF NOT EXISTS `conversation` (
  200. `item-uri` varbinary(255) NOT NULL COMMENT '',
  201. `reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
  202. `conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
  203. `conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
  204. `protocol` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  205. `source` mediumtext COMMENT '',
  206. `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  207. PRIMARY KEY(`item-uri`),
  208. INDEX `conversation-uri` (`conversation-uri`),
  209. INDEX `received` (`received`)
  210. ) DEFAULT COLLATE utf8mb4_general_ci;
  211. --
  212. -- TABLE event
  213. --
  214. CREATE TABLE IF NOT EXISTS `event` (
  215. `id` int unsigned NOT NULL auto_increment COMMENT '',
  216. `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  217. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  218. `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  219. `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  220. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  221. `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  222. `start` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  223. `finish` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  224. `summary` text COMMENT '',
  225. `desc` text COMMENT '',
  226. `location` text COMMENT '',
  227. `type` varchar(20) NOT NULL DEFAULT '' COMMENT '',
  228. `nofinish` boolean NOT NULL DEFAULT '0' COMMENT '',
  229. `adjust` boolean NOT NULL DEFAULT '1' COMMENT '',
  230. `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
  231. `allow_cid` mediumtext COMMENT '',
  232. `allow_gid` mediumtext COMMENT '',
  233. `deny_cid` mediumtext COMMENT '',
  234. `deny_gid` mediumtext COMMENT '',
  235. PRIMARY KEY(`id`),
  236. INDEX `uid_start` (`uid`,`start`)
  237. ) DEFAULT COLLATE utf8mb4_general_ci;
  238. --
  239. -- TABLE fcontact
  240. --
  241. CREATE TABLE IF NOT EXISTS `fcontact` (
  242. `id` int unsigned NOT NULL auto_increment COMMENT '',
  243. `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  244. `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  245. `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  246. `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  247. `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  248. `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  249. `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  250. `batch` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  251. `notify` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  252. `poll` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  253. `confirm` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  254. `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  255. `network` char(4) NOT NULL DEFAULT '' COMMENT '',
  256. `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  257. `pubkey` text COMMENT '',
  258. `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  259. PRIMARY KEY(`id`),
  260. INDEX `addr` (`addr`(32)),
  261. UNIQUE INDEX `url` (`url`(190))
  262. ) DEFAULT COLLATE utf8mb4_general_ci;
  263. --
  264. -- TABLE fsuggest
  265. --
  266. CREATE TABLE IF NOT EXISTS `fsuggest` (
  267. `id` int unsigned NOT NULL auto_increment COMMENT '',
  268. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  269. `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  270. `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  271. `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  272. `request` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  273. `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  274. `note` text COMMENT '',
  275. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  276. PRIMARY KEY(`id`)
  277. ) DEFAULT COLLATE utf8mb4_general_ci;
  278. --
  279. -- TABLE gcign
  280. --
  281. CREATE TABLE IF NOT EXISTS `gcign` (
  282. `id` int unsigned NOT NULL auto_increment COMMENT '',
  283. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  284. `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  285. PRIMARY KEY(`id`),
  286. INDEX `uid` (`uid`),
  287. INDEX `gcid` (`gcid`)
  288. ) DEFAULT COLLATE utf8mb4_general_ci;
  289. --
  290. -- TABLE gcontact
  291. --
  292. CREATE TABLE IF NOT EXISTS `gcontact` (
  293. `id` int unsigned NOT NULL auto_increment COMMENT '',
  294. `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  295. `nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  296. `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  297. `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  298. `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  299. `connect` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  300. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  301. `updated` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
  302. `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
  303. `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
  304. `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  305. `about` text COMMENT '',
  306. `keywords` text COMMENT '',
  307. `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
  308. `birthday` varchar(32) NOT NULL DEFAULT '0001-01-01' COMMENT '',
  309. `community` boolean NOT NULL DEFAULT '0' COMMENT '',
  310. `contact-type` tinyint NOT NULL DEFAULT -1 COMMENT '',
  311. `hide` boolean NOT NULL DEFAULT '0' COMMENT '',
  312. `nsfw` boolean NOT NULL DEFAULT '0' COMMENT '',
  313. `network` char(4) NOT NULL DEFAULT '' COMMENT '',
  314. `addr` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  315. `notify` varchar(255) COMMENT '',
  316. `alias` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  317. `generation` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  318. `server_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  319. PRIMARY KEY(`id`),
  320. UNIQUE INDEX `nurl` (`nurl`(190)),
  321. INDEX `name` (`name`(64)),
  322. INDEX `nick` (`nick`(32)),
  323. INDEX `addr` (`addr`(64)),
  324. INDEX `hide_network_updated` (`hide`,`network`,`updated`),
  325. INDEX `updated` (`updated`)
  326. ) DEFAULT COLLATE utf8mb4_general_ci;
  327. --
  328. -- TABLE glink
  329. --
  330. CREATE TABLE IF NOT EXISTS `glink` (
  331. `id` int unsigned NOT NULL auto_increment COMMENT '',
  332. `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  333. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  334. `gcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  335. `zcid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  336. `updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  337. PRIMARY KEY(`id`),
  338. UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
  339. INDEX `gcid` (`gcid`)
  340. ) DEFAULT COLLATE utf8mb4_general_ci;
  341. --
  342. -- TABLE group
  343. --
  344. CREATE TABLE IF NOT EXISTS `group` (
  345. `id` int unsigned NOT NULL auto_increment COMMENT '',
  346. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  347. `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
  348. `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
  349. `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  350. PRIMARY KEY(`id`),
  351. INDEX `uid` (`uid`)
  352. ) DEFAULT COLLATE utf8mb4_general_ci;
  353. --
  354. -- TABLE group_member
  355. --
  356. CREATE TABLE IF NOT EXISTS `group_member` (
  357. `id` int unsigned NOT NULL auto_increment COMMENT '',
  358. `gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  359. `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  360. PRIMARY KEY(`id`),
  361. INDEX `contactid` (`contact-id`),
  362. UNIQUE INDEX `gid_contactid` (`gid`,`contact-id`)
  363. ) DEFAULT COLLATE utf8mb4_general_ci;
  364. --
  365. -- TABLE gserver
  366. --
  367. CREATE TABLE IF NOT EXISTS `gserver` (
  368. `id` int unsigned NOT NULL auto_increment COMMENT '',
  369. `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  370. `nurl` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  371. `version` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  372. `site_name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  373. `info` text COMMENT '',
  374. `register_policy` tinyint NOT NULL DEFAULT 0 COMMENT '',
  375. `registered-users` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  376. `poco` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  377. `noscrape` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  378. `network` char(4) NOT NULL DEFAULT '' COMMENT '',
  379. `platform` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  380. `relay-subscribe` boolean NOT NULL DEFAULT '0' COMMENT 'Has the server subscribed to the relay system',
  381. `relay-scope` varchar(10) NOT NULL DEFAULT '' COMMENT 'The scope of messages that the server wants to get',
  382. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  383. `last_poco_query` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
  384. `last_contact` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
  385. `last_failure` datetime DEFAULT '0001-01-01 00:00:00' COMMENT '',
  386. PRIMARY KEY(`id`),
  387. UNIQUE INDEX `nurl` (`nurl`(190))
  388. ) DEFAULT COLLATE utf8mb4_general_ci;
  389. --
  390. -- TABLE gserver-tag
  391. --
  392. CREATE TABLE IF NOT EXISTS `gserver-tag` (
  393. `gserver-id` int unsigned NOT NULL DEFAULT 0 COMMENT 'The id of the gserver',
  394. `tag` varchar(100) NOT NULL DEFAULT '' COMMENT 'Tag that the server has subscribed',
  395. PRIMARY KEY(`gserver-id`,`tag`),
  396. INDEX `tag` (`tag`)
  397. ) DEFAULT COLLATE utf8mb4_general_ci;
  398. --
  399. -- TABLE hook
  400. --
  401. CREATE TABLE IF NOT EXISTS `hook` (
  402. `id` int unsigned NOT NULL auto_increment COMMENT '',
  403. `hook` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
  404. `file` varbinary(200) NOT NULL DEFAULT '' COMMENT '',
  405. `function` varbinary(200) NOT NULL DEFAULT '' COMMENT '',
  406. `priority` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
  407. PRIMARY KEY(`id`),
  408. UNIQUE INDEX `hook_file_function` (`hook`,`file`,`function`)
  409. ) DEFAULT COLLATE utf8mb4_general_ci;
  410. --
  411. -- TABLE intro
  412. --
  413. CREATE TABLE IF NOT EXISTS `intro` (
  414. `id` int unsigned NOT NULL auto_increment COMMENT '',
  415. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  416. `fid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  417. `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  418. `knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
  419. `duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
  420. `note` text COMMENT '',
  421. `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  422. `datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  423. `blocked` boolean NOT NULL DEFAULT '1' COMMENT '',
  424. `ignore` boolean NOT NULL DEFAULT '0' COMMENT '',
  425. PRIMARY KEY(`id`)
  426. ) DEFAULT COLLATE utf8mb4_general_ci;
  427. --
  428. -- TABLE item
  429. --
  430. CREATE TABLE IF NOT EXISTS `item` (
  431. `id` int unsigned NOT NULL auto_increment,
  432. `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  433. `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  434. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  435. `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  436. `type` varchar(20) NOT NULL DEFAULT '' COMMENT '',
  437. `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
  438. `gravity` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  439. `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  440. `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  441. `extid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  442. `thr-parent` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  443. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  444. `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  445. `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  446. `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  447. `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  448. `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  449. `owner-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  450. `owner-link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  451. `owner-avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  452. `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  453. `author-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  454. `author-link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  455. `author-avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  456. `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  457. `content-warning` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  458. `body` mediumtext COMMENT '',
  459. `app` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  460. `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
  461. `object-type` varchar(100) NOT NULL DEFAULT '' COMMENT '',
  462. `object` text COMMENT '',
  463. `target-type` varchar(100) NOT NULL DEFAULT '' COMMENT '',
  464. `target` text COMMENT '',
  465. `postopts` text COMMENT '',
  466. `plink` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  467. `resource-id` varchar(32) NOT NULL DEFAULT '' COMMENT '',
  468. `event-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  469. `tag` mediumtext COMMENT '',
  470. `attach` mediumtext COMMENT '',
  471. `inform` mediumtext COMMENT '',
  472. `file` mediumtext COMMENT '',
  473. `location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  474. `coord` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  475. `allow_cid` mediumtext COMMENT '',
  476. `allow_gid` mediumtext COMMENT '',
  477. `deny_cid` mediumtext COMMENT '',
  478. `deny_gid` mediumtext COMMENT '',
  479. `private` boolean NOT NULL DEFAULT '0' COMMENT '',
  480. `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
  481. `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
  482. `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
  483. `spam` boolean NOT NULL DEFAULT '0' COMMENT '',
  484. `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
  485. `bookmark` boolean NOT NULL DEFAULT '0' COMMENT '',
  486. `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
  487. `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
  488. `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
  489. `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  490. `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
  491. `network` char(4) NOT NULL DEFAULT '' COMMENT '',
  492. `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
  493. `rendered-html` mediumtext COMMENT '',
  494. `global` boolean NOT NULL DEFAULT '0' COMMENT '',
  495. PRIMARY KEY(`id`),
  496. INDEX `guid` (`guid`(191)),
  497. INDEX `uri` (`uri`(191)),
  498. INDEX `parent` (`parent`),
  499. INDEX `parent-uri` (`parent-uri`(191)),
  500. INDEX `extid` (`extid`(191)),
  501. INDEX `uid_id` (`uid`,`id`),
  502. INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
  503. INDEX `uid_created` (`uid`,`created`),
  504. INDEX `uid_commented` (`uid`,`commented`),
  505. INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
  506. INDEX `uid_network_received` (`uid`,`network`,`received`),
  507. INDEX `uid_network_commented` (`uid`,`network`,`commented`),
  508. INDEX `uid_thrparent` (`uid`,`thr-parent`(190)),
  509. INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
  510. INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
  511. INDEX `authorid_created` (`author-id`,`created`),
  512. INDEX `ownerid` (`owner-id`),
  513. INDEX `uid_uri` (`uid`,`uri`(190)),
  514. INDEX `resource-id` (`resource-id`),
  515. INDEX `contactid_allowcid_allowpid_denycid_denygid` (`contact-id`,`allow_cid`(10),`allow_gid`(10),`deny_cid`(10),`deny_gid`(10)),
  516. INDEX `uid_type_changed` (`uid`,`type`,`changed`),
  517. INDEX `contactid_verb` (`contact-id`,`verb`),
  518. INDEX `deleted_changed` (`deleted`,`changed`),
  519. INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
  520. INDEX `uid_eventid` (`uid`,`event-id`),
  521. INDEX `uid_authorlink` (`uid`,`author-link`(190)),
  522. INDEX `uid_ownerlink` (`uid`,`owner-link`(190))
  523. ) DEFAULT COLLATE utf8mb4_general_ci;
  524. --
  525. -- TABLE locks
  526. --
  527. CREATE TABLE IF NOT EXISTS `locks` (
  528. `id` int unsigned NOT NULL auto_increment COMMENT '',
  529. `name` varchar(128) NOT NULL DEFAULT '' COMMENT '',
  530. `locked` boolean NOT NULL DEFAULT '0' COMMENT '',
  531. `pid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  532. PRIMARY KEY(`id`)
  533. ) DEFAULT COLLATE utf8mb4_general_ci;
  534. --
  535. -- TABLE mail
  536. --
  537. CREATE TABLE IF NOT EXISTS `mail` (
  538. `id` int unsigned NOT NULL auto_increment COMMENT '',
  539. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  540. `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  541. `from-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  542. `from-photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  543. `from-url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  544. `contact-id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  545. `convid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  546. `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  547. `body` mediumtext COMMENT '',
  548. `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
  549. `reply` boolean NOT NULL DEFAULT '0' COMMENT '',
  550. `replied` boolean NOT NULL DEFAULT '0' COMMENT '',
  551. `unknown` boolean NOT NULL DEFAULT '0' COMMENT '',
  552. `uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  553. `parent-uri` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  554. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  555. PRIMARY KEY(`id`),
  556. INDEX `uid_seen` (`uid`,`seen`),
  557. INDEX `convid` (`convid`),
  558. INDEX `uri` (`uri`(64)),
  559. INDEX `parent-uri` (`parent-uri`(64)),
  560. INDEX `contactid` (`contact-id`(32))
  561. ) DEFAULT COLLATE utf8mb4_general_ci;
  562. --
  563. -- TABLE mailacct
  564. --
  565. CREATE TABLE IF NOT EXISTS `mailacct` (
  566. `id` int unsigned NOT NULL auto_increment COMMENT '',
  567. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  568. `server` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  569. `port` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
  570. `ssltype` varchar(16) NOT NULL DEFAULT '' COMMENT '',
  571. `mailbox` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  572. `user` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  573. `pass` text COMMENT '',
  574. `reply_to` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  575. `action` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  576. `movetofolder` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  577. `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
  578. `last_check` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  579. PRIMARY KEY(`id`)
  580. ) DEFAULT COLLATE utf8mb4_general_ci;
  581. --
  582. -- TABLE manage
  583. --
  584. CREATE TABLE IF NOT EXISTS `manage` (
  585. `id` int unsigned NOT NULL auto_increment COMMENT '',
  586. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  587. `mid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  588. PRIMARY KEY(`id`),
  589. UNIQUE INDEX `uid_mid` (`uid`,`mid`)
  590. ) DEFAULT COLLATE utf8mb4_general_ci;
  591. --
  592. -- TABLE notify
  593. --
  594. CREATE TABLE IF NOT EXISTS `notify` (
  595. `id` int unsigned NOT NULL auto_increment COMMENT '',
  596. `hash` varchar(64) NOT NULL DEFAULT '' COMMENT '',
  597. `type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
  598. `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  599. `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  600. `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  601. `date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  602. `msg` mediumtext COMMENT '',
  603. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  604. `link` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  605. `iid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  606. `parent` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  607. `seen` boolean NOT NULL DEFAULT '0' COMMENT '',
  608. `verb` varchar(100) NOT NULL DEFAULT '' COMMENT '',
  609. `otype` varchar(10) NOT NULL DEFAULT '' COMMENT '',
  610. `name_cache` tinytext COMMENT '',
  611. `msg_cache` mediumtext COMMENT '',
  612. PRIMARY KEY(`id`),
  613. INDEX `hash_uid` (`hash`,`uid`),
  614. INDEX `seen_uid_date` (`seen`,`uid`,`date`),
  615. INDEX `uid_date` (`uid`,`date`),
  616. INDEX `uid_type_link` (`uid`,`type`,`link`(190))
  617. ) DEFAULT COLLATE utf8mb4_general_ci;
  618. --
  619. -- TABLE notify-threads
  620. --
  621. CREATE TABLE IF NOT EXISTS `notify-threads` (
  622. `id` int unsigned NOT NULL auto_increment COMMENT '',
  623. `notify-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  624. `master-parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  625. `parent-item` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  626. `receiver-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  627. PRIMARY KEY(`id`)
  628. ) DEFAULT COLLATE utf8mb4_general_ci;
  629. --
  630. -- TABLE oembed
  631. --
  632. CREATE TABLE IF NOT EXISTS `oembed` (
  633. `url` varbinary(255) NOT NULL COMMENT '',
  634. `maxwidth` mediumint unsigned NOT NULL COMMENT '',
  635. `content` mediumtext COMMENT '',
  636. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  637. PRIMARY KEY(`url`,`maxwidth`),
  638. INDEX `created` (`created`)
  639. ) DEFAULT COLLATE utf8mb4_general_ci;
  640. --
  641. -- TABLE parsed_url
  642. --
  643. CREATE TABLE IF NOT EXISTS `parsed_url` (
  644. `url` varbinary(255) NOT NULL COMMENT '',
  645. `guessing` boolean NOT NULL DEFAULT '0' COMMENT '',
  646. `oembed` boolean NOT NULL DEFAULT '0' COMMENT '',
  647. `content` mediumtext COMMENT '',
  648. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  649. PRIMARY KEY(`url`,`guessing`,`oembed`),
  650. INDEX `created` (`created`)
  651. ) DEFAULT COLLATE utf8mb4_general_ci;
  652. --
  653. -- TABLE participation
  654. --
  655. CREATE TABLE IF NOT EXISTS `participation` (
  656. `iid` int unsigned NOT NULL COMMENT '',
  657. `server` varchar(60) NOT NULL COMMENT '',
  658. `cid` int unsigned NOT NULL COMMENT '',
  659. `fid` int unsigned NOT NULL COMMENT '',
  660. PRIMARY KEY(`iid`,`server`)
  661. ) DEFAULT COLLATE utf8mb4_general_ci;
  662. --
  663. -- TABLE pconfig
  664. --
  665. CREATE TABLE IF NOT EXISTS `pconfig` (
  666. `id` int unsigned NOT NULL auto_increment COMMENT '',
  667. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  668. `cat` varbinary(50) NOT NULL DEFAULT '' COMMENT '',
  669. `k` varbinary(100) NOT NULL DEFAULT '' COMMENT '',
  670. `v` mediumtext COMMENT '',
  671. PRIMARY KEY(`id`),
  672. UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
  673. ) DEFAULT COLLATE utf8mb4_general_ci;
  674. --
  675. -- TABLE photo
  676. --
  677. CREATE TABLE IF NOT EXISTS `photo` (
  678. `id` int unsigned NOT NULL auto_increment COMMENT '',
  679. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  680. `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  681. `guid` char(16) NOT NULL DEFAULT '' COMMENT '',
  682. `resource-id` char(32) NOT NULL DEFAULT '' COMMENT '',
  683. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  684. `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  685. `title` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  686. `desc` text COMMENT '',
  687. `album` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  688. `filename` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  689. `type` varchar(30) NOT NULL DEFAULT 'image/jpeg',
  690. `height` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
  691. `width` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
  692. `datasize` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  693. `data` mediumblob NOT NULL COMMENT '',
  694. `scale` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  695. `profile` boolean NOT NULL DEFAULT '0' COMMENT '',
  696. `allow_cid` mediumtext COMMENT '',
  697. `allow_gid` mediumtext COMMENT '',
  698. `deny_cid` mediumtext COMMENT '',
  699. `deny_gid` mediumtext COMMENT '',
  700. PRIMARY KEY(`id`),
  701. INDEX `contactid` (`contact-id`),
  702. INDEX `uid_contactid` (`uid`,`contact-id`),
  703. INDEX `uid_profile` (`uid`,`profile`),
  704. INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
  705. INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`,`created`),
  706. INDEX `resource-id` (`resource-id`)
  707. ) DEFAULT COLLATE utf8mb4_general_ci;
  708. --
  709. -- TABLE poll
  710. --
  711. CREATE TABLE IF NOT EXISTS `poll` (
  712. `id` int unsigned NOT NULL auto_increment COMMENT '',
  713. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  714. `q0` text COMMENT '',
  715. `q1` text COMMENT '',
  716. `q2` text COMMENT '',
  717. `q3` text COMMENT '',
  718. `q4` text COMMENT '',
  719. `q5` text COMMENT '',
  720. `q6` text COMMENT '',
  721. `q7` text COMMENT '',
  722. `q8` text COMMENT '',
  723. `q9` text COMMENT '',
  724. PRIMARY KEY(`id`),
  725. INDEX `uid` (`uid`)
  726. ) DEFAULT COLLATE utf8mb4_general_ci;
  727. --
  728. -- TABLE poll_result
  729. --
  730. CREATE TABLE IF NOT EXISTS `poll_result` (
  731. `id` int unsigned NOT NULL auto_increment COMMENT '',
  732. `poll_id` int unsigned NOT NULL DEFAULT 0,
  733. `choice` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  734. PRIMARY KEY(`id`),
  735. INDEX `poll_id` (`poll_id`)
  736. ) DEFAULT COLLATE utf8mb4_general_ci;
  737. --
  738. -- TABLE process
  739. --
  740. CREATE TABLE IF NOT EXISTS `process` (
  741. `pid` int unsigned NOT NULL COMMENT '',
  742. `command` varbinary(32) NOT NULL DEFAULT '' COMMENT '',
  743. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  744. PRIMARY KEY(`pid`),
  745. INDEX `command` (`command`)
  746. ) DEFAULT COLLATE utf8mb4_general_ci;
  747. --
  748. -- TABLE profile
  749. --
  750. CREATE TABLE IF NOT EXISTS `profile` (
  751. `id` int unsigned NOT NULL auto_increment COMMENT '',
  752. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  753. `profile-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  754. `is-default` boolean NOT NULL DEFAULT '0' COMMENT '',
  755. `hide-friends` boolean NOT NULL DEFAULT '0' COMMENT '',
  756. `name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  757. `pdesc` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  758. `dob` varchar(32) NOT NULL DEFAULT '0000-00-00' COMMENT '',
  759. `address` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  760. `locality` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  761. `region` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  762. `postal-code` varchar(32) NOT NULL DEFAULT '' COMMENT '',
  763. `country-name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  764. `hometown` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  765. `gender` varchar(32) NOT NULL DEFAULT '' COMMENT '',
  766. `marital` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  767. `with` text COMMENT '',
  768. `howlong` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  769. `sexual` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  770. `politic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  771. `religion` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  772. `pub_keywords` text COMMENT '',
  773. `prv_keywords` text COMMENT '',
  774. `likes` text COMMENT '',
  775. `dislikes` text COMMENT '',
  776. `about` text COMMENT '',
  777. `summary` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  778. `music` text COMMENT '',
  779. `book` text COMMENT '',
  780. `tv` text COMMENT '',
  781. `film` text COMMENT '',
  782. `interest` text COMMENT '',
  783. `romance` text COMMENT '',
  784. `work` text COMMENT '',
  785. `education` text COMMENT '',
  786. `contact` text COMMENT '',
  787. `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  788. `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  789. `photo` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  790. `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  791. `publish` boolean NOT NULL DEFAULT '0' COMMENT '',
  792. `net-publish` boolean NOT NULL DEFAULT '0' COMMENT '',
  793. PRIMARY KEY(`id`),
  794. INDEX `uid_is-default` (`uid`,`is-default`)
  795. ) DEFAULT COLLATE utf8mb4_general_ci;
  796. --
  797. -- TABLE profile_check
  798. --
  799. CREATE TABLE IF NOT EXISTS `profile_check` (
  800. `id` int unsigned NOT NULL auto_increment COMMENT '',
  801. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  802. `cid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  803. `dfrn_id` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  804. `sec` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  805. `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  806. PRIMARY KEY(`id`)
  807. ) DEFAULT COLLATE utf8mb4_general_ci;
  808. --
  809. -- TABLE push_subscriber
  810. --
  811. CREATE TABLE IF NOT EXISTS `push_subscriber` (
  812. `id` int unsigned NOT NULL auto_increment COMMENT '',
  813. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  814. `callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  815. `topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  816. `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  817. `push` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  818. `last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  819. `secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  820. PRIMARY KEY(`id`)
  821. ) DEFAULT COLLATE utf8mb4_general_ci;
  822. --
  823. -- TABLE queue
  824. --
  825. CREATE TABLE IF NOT EXISTS `queue` (
  826. `id` int unsigned NOT NULL auto_increment COMMENT '',
  827. `cid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Message receiver',
  828. `network` char(4) NOT NULL DEFAULT '' COMMENT 'Receiver\'s network',
  829. `guid` varchar(255) NOT NULL DEFAULT '' COMMENT 'Unique GUID of the message',
  830. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date, when the message was created',
  831. `last` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last trial',
  832. `next` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
  833. `retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
  834. `content` mediumtext COMMENT '',
  835. `batch` boolean NOT NULL DEFAULT '0' COMMENT '',
  836. PRIMARY KEY(`id`),
  837. INDEX `last` (`last`),
  838. INDEX `next` (`next`)
  839. ) DEFAULT COLLATE utf8mb4_general_ci;
  840. --
  841. -- TABLE register
  842. --
  843. CREATE TABLE IF NOT EXISTS `register` (
  844. `id` int unsigned NOT NULL auto_increment COMMENT '',
  845. `hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  846. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  847. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  848. `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  849. `language` varchar(16) NOT NULL DEFAULT '' COMMENT '',
  850. `note` text COMMENT '',
  851. PRIMARY KEY(`id`)
  852. ) DEFAULT COLLATE utf8mb4_general_ci;
  853. --
  854. -- TABLE search
  855. --
  856. CREATE TABLE IF NOT EXISTS `search` (
  857. `id` int unsigned NOT NULL auto_increment COMMENT '',
  858. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  859. `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  860. PRIMARY KEY(`id`),
  861. INDEX `uid` (`uid`)
  862. ) DEFAULT COLLATE utf8mb4_general_ci;
  863. --
  864. -- TABLE session
  865. --
  866. CREATE TABLE IF NOT EXISTS `session` (
  867. `id` bigint unsigned NOT NULL auto_increment COMMENT '',
  868. `sid` varbinary(255) NOT NULL DEFAULT '' COMMENT '',
  869. `data` text COMMENT '',
  870. `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  871. PRIMARY KEY(`id`),
  872. INDEX `sid` (`sid`(64)),
  873. INDEX `expire` (`expire`)
  874. ) DEFAULT COLLATE utf8mb4_general_ci;
  875. --
  876. -- TABLE sign
  877. --
  878. CREATE TABLE IF NOT EXISTS `sign` (
  879. `id` int unsigned NOT NULL auto_increment COMMENT '',
  880. `iid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  881. `signed_text` mediumtext COMMENT '',
  882. `signature` text COMMENT '',
  883. `signer` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  884. PRIMARY KEY(`id`),
  885. UNIQUE INDEX `iid` (`iid`)
  886. ) DEFAULT COLLATE utf8mb4_general_ci;
  887. --
  888. -- TABLE term
  889. --
  890. CREATE TABLE IF NOT EXISTS `term` (
  891. `tid` int unsigned NOT NULL auto_increment COMMENT '',
  892. `oid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  893. `otype` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  894. `type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  895. `term` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  896. `url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  897. `guid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  898. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  899. `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  900. `global` boolean NOT NULL DEFAULT '0' COMMENT '',
  901. `aid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  902. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  903. PRIMARY KEY(`tid`),
  904. INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`(32)),
  905. INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
  906. INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
  907. INDEX `guid` (`guid`(64))
  908. ) DEFAULT COLLATE utf8mb4_general_ci;
  909. --
  910. -- TABLE thread
  911. --
  912. CREATE TABLE IF NOT EXISTS `thread` (
  913. `iid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  914. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  915. `contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  916. `owner-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  917. `author-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  918. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  919. `edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  920. `commented` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  921. `received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  922. `changed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  923. `wall` boolean NOT NULL DEFAULT '0' COMMENT '',
  924. `private` boolean NOT NULL DEFAULT '0' COMMENT '',
  925. `pubmail` boolean NOT NULL DEFAULT '0' COMMENT '',
  926. `moderated` boolean NOT NULL DEFAULT '0' COMMENT '',
  927. `visible` boolean NOT NULL DEFAULT '0' COMMENT '',
  928. `spam` boolean NOT NULL DEFAULT '0' COMMENT '',
  929. `starred` boolean NOT NULL DEFAULT '0' COMMENT '',
  930. `ignored` boolean NOT NULL DEFAULT '0' COMMENT '',
  931. `bookmark` boolean NOT NULL DEFAULT '0' COMMENT '',
  932. `unseen` boolean NOT NULL DEFAULT '1' COMMENT '',
  933. `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
  934. `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
  935. `forum_mode` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  936. `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
  937. `network` char(4) NOT NULL DEFAULT '' COMMENT '',
  938. PRIMARY KEY(`iid`),
  939. INDEX `uid_network_commented` (`uid`,`network`,`commented`),
  940. INDEX `uid_network_created` (`uid`,`network`,`created`),
  941. INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
  942. INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
  943. INDEX `contactid` (`contact-id`),
  944. INDEX `ownerid` (`owner-id`),
  945. INDEX `authorid` (`author-id`),
  946. INDEX `uid_created` (`uid`,`created`),
  947. INDEX `uid_commented` (`uid`,`commented`),
  948. INDEX `uid_wall_created` (`uid`,`wall`,`created`),
  949. INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`)
  950. ) DEFAULT COLLATE utf8mb4_general_ci;
  951. --
  952. -- TABLE tokens
  953. --
  954. CREATE TABLE IF NOT EXISTS `tokens` (
  955. `id` varchar(40) NOT NULL COMMENT '',
  956. `secret` text COMMENT '',
  957. `client_id` varchar(20) NOT NULL DEFAULT '',
  958. `expires` int NOT NULL DEFAULT 0 COMMENT '',
  959. `scope` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  960. `uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
  961. PRIMARY KEY(`id`)
  962. ) DEFAULT COLLATE utf8mb4_general_ci;
  963. --
  964. -- TABLE user
  965. --
  966. CREATE TABLE IF NOT EXISTS `user` (
  967. `uid` mediumint unsigned NOT NULL auto_increment COMMENT '',
  968. `parent-uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'The parent user that has full control about this user',
  969. `guid` varchar(64) NOT NULL DEFAULT '' COMMENT '',
  970. `username` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  971. `password` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  972. `legacy_password` boolean NOT NULL DEFAULT '0' COMMENT 'Is the password hash double-hashed?',
  973. `nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  974. `email` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  975. `openid` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  976. `timezone` varchar(128) NOT NULL DEFAULT '' COMMENT '',
  977. `language` varchar(32) NOT NULL DEFAULT 'en' COMMENT '',
  978. `register_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  979. `login_date` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  980. `default-location` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  981. `allow_location` boolean NOT NULL DEFAULT '0' COMMENT '',
  982. `theme` varchar(255) NOT NULL DEFAULT '' COMMENT '',
  983. `pubkey` text COMMENT '',
  984. `prvkey` text COMMENT '',
  985. `spubkey` text COMMENT '',
  986. `sprvkey` text COMMENT '',
  987. `verified` boolean NOT NULL DEFAULT '0' COMMENT '',
  988. `blocked` boolean NOT NULL DEFAULT '0' COMMENT '',
  989. `blockwall` boolean NOT NULL DEFAULT '0' COMMENT '',
  990. `hidewall` boolean NOT NULL DEFAULT '0' COMMENT '',
  991. `blocktags` boolean NOT NULL DEFAULT '0' COMMENT '',
  992. `unkmail` boolean NOT NULL DEFAULT '0' COMMENT '',
  993. `cntunkmail` int unsigned NOT NULL DEFAULT 10 COMMENT '',
  994. `notify-flags` smallint unsigned NOT NULL DEFAULT 65535 COMMENT '',
  995. `page-flags` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  996. `account-type` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
  997. `prvnets` boolean NOT NULL DEFAULT '0' COMMENT '',
  998. `pwdreset` varchar(255) COMMENT 'Password reset request token',
  999. `pwdreset_time` datetime COMMENT 'Timestamp of the last password reset request',
  1000. `maxreq` int unsigned NOT NULL DEFAULT 10 COMMENT '',
  1001. `expire` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  1002. `account_removed` boolean NOT NULL DEFAULT '0' COMMENT '',
  1003. `account_expired` boolean NOT NULL DEFAULT '0' COMMENT '',
  1004. `account_expires_on` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  1005. `expire_notification_sent` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
  1006. `def_gid` int unsigned NOT NULL DEFAULT 0 COMMENT '',
  1007. `allow_cid` mediumtext COMMENT '',
  1008. `allow_gid` mediumtext COMMENT '',
  1009. `deny_cid` mediumtext COMMENT '',
  1010. `deny_gid` mediumtext COMMENT '',
  1011. `openidserver` text COMMENT '',
  1012. PRIMARY KEY(`uid`),
  1013. INDEX `nickname` (`nickname`(32))
  1014. ) DEFAULT COLLATE utf8mb4_general_ci;
  1015. --
  1016. -- TABLE userd
  1017. --
  1018. CREATE TABLE IF NOT EXISTS `userd` (
  1019. `id` int unsigned NOT NULL auto_increment COMMENT '',
  1020. `username` varchar(255) NOT NULL COMMENT '',
  1021. PRIMARY KEY(`id`),
  1022. INDEX `username` (`username`(32))
  1023. ) DEFAULT COLLATE utf8mb4_general_ci;
  1024. --
  1025. -- TABLE workerqueue
  1026. --
  1027. CREATE TABLE IF NOT EXISTS `workerqueue` (
  1028. `id` int unsigned NOT NULL auto_increment COMMENT 'Auto incremented worker task id',
  1029. `parameter` mediumblob COMMENT 'Task command',
  1030. `priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Task priority',
  1031. `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
  1032. `pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
  1033. `executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
  1034. `done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked when the task was done, will be deleted later',
  1035. PRIMARY KEY(`id`),
  1036. INDEX `pid` (`pid`),
  1037. INDEX `parameter` (`parameter`(64)),
  1038. INDEX `priority_created` (`priority`,`created`),
  1039. INDEX `executed` (`executed`)
  1040. ) DEFAULT COLLATE utf8mb4_general_ci;