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.

1467 lines
94 KiB

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