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.

1480 lines
72 KiB

  1. <?php
  2. require_once("boot.php");
  3. require_once("include/text.php");
  4. define('NEW_UPDATE_ROUTINE_VERSION', 1170);
  5. /*
  6. * send the email and do what is needed to do on update fails
  7. *
  8. * @param update_id (int) number of failed update
  9. * @param error_message (str) error message
  10. */
  11. function update_fail($update_id, $error_message){
  12. //send the administrators an e-mail
  13. $admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
  14. $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
  15. $admin_mail_list
  16. );
  17. // every admin could had different language
  18. foreach ($adminlist as $admin) {
  19. $lang = (($admin['language'])?$admin['language']:'en');
  20. push_lang($lang);
  21. $preamble = deindent(t("
  22. The friendica developers released update %s recently,
  23. but when I tried to install it, something went terribly wrong.
  24. This needs to be fixed soon and I can't do it alone. Please contact a
  25. friendica developer if you can not help me on your own. My database might be invalid."));
  26. $body = t("The error message is\n[pre]%s[/pre]");
  27. $preamble = sprintf($preamble, $update_id);
  28. $body = sprintf($body, $error_message);
  29. notification(array(
  30. 'type' => "SYSTEM_EMAIL",
  31. 'to_email' => $admin['email'],
  32. 'preamble' => $preamble,
  33. 'body' => $body,
  34. 'language' => $lang,
  35. ));
  36. }
  37. /*
  38. $email_tpl = get_intltext_template("update_fail_eml.tpl");
  39. $email_msg = replace_macros($email_tpl, array(
  40. '$sitename' => $a->config['sitename'],
  41. '$siteurl' => $a->get_baseurl(),
  42. '$update' => DB_UPDATE_VERSION,
  43. '$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
  44. ));
  45. $subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
  46. require_once('include/email.php');
  47. $subject = email_header_encode($subject,'UTF-8');
  48. mail($a->config['admin_email'], $subject, $email_msg,
  49. 'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n"
  50. .'Content-type: text/plain; charset=UTF-8'."\n"
  51. .'Content-transfer-encoding: 8bit');
  52. */
  53. //try the logger
  54. logger("CRITICAL: Database structure update failed: ".$retval);
  55. }
  56. function table_structure($table) {
  57. $structures = q("DESCRIBE `%s`", $table);
  58. $indexes = q("SHOW INDEX FROM `%s`", $table);
  59. $fielddata = array();
  60. $indexdata = array();
  61. if (is_array($indexes))
  62. foreach ($indexes AS $index) {
  63. if ($index["Index_type"] == "FULLTEXT")
  64. continue;
  65. $column = $index["Column_name"];
  66. if ($index["Sub_part"] != "")
  67. $column .= "(".$index["Sub_part"].")";
  68. $indexdata[$index["Key_name"]][] = $column;
  69. }
  70. if (is_array($structures)) {
  71. foreach($structures AS $field) {
  72. $fielddata[$field["Field"]]["type"] = $field["Type"];
  73. if ($field["Null"] == "NO")
  74. $fielddata[$field["Field"]]["not null"] = true;
  75. if (isset($field["Default"]))
  76. $fielddata[$field["Field"]]["default"] = $field["Default"];
  77. if ($field["Extra"] != "")
  78. $fielddata[$field["Field"]]["extra"] = $field["Extra"];
  79. if ($field["Key"] == "PRI")
  80. $fielddata[$field["Field"]]["primary"] = true;
  81. }
  82. }
  83. return(array("fields"=>$fielddata, "indexes"=>$indexdata));
  84. }
  85. function print_structure($database) {
  86. echo "-- ------------------------------------------\n";
  87. echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
  88. echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
  89. echo "-- ------------------------------------------\n\n\n";
  90. foreach ($database AS $name => $structure) {
  91. echo "--\n";
  92. echo "-- TABLE $name\n";
  93. echo "--\n";
  94. db_create_table($name, $structure['fields'], true, false, $structure["indexes"]);
  95. echo "\n";
  96. }
  97. }
  98. function update_structure($verbose, $action, $tables=null, $definition=null) {
  99. global $a, $db;
  100. $errors = false;
  101. logger('updating structure', LOGGER_DEBUG);
  102. // Get the current structure
  103. $database = array();
  104. if (is_null($tables))
  105. $tables = q("show tables");
  106. foreach ($tables AS $table) {
  107. $table = current($table);
  108. $database[$table] = table_structure($table);
  109. }
  110. // Get the definition
  111. if (is_null($definition))
  112. $definition = db_definition();
  113. // Compare it
  114. foreach ($definition AS $name => $structure) {
  115. $is_new_table = False;
  116. $sql3="";
  117. if (!isset($database[$name])) {
  118. $r = db_create_table($name, $structure["fields"], $verbose, $action, $structure['indexes']);
  119. if(false === $r) {
  120. $errors .= t('Errors encountered creating database tables.').$name.EOL;
  121. }
  122. $is_new_table = True;
  123. } else {
  124. // Drop the index if it isn't present in the definition
  125. // or the definition differ from current status
  126. // and index name doesn't start with "local_"
  127. foreach ($database[$name]["indexes"] AS $indexname => $fieldnames) {
  128. $current_index_definition = implode(",",$fieldnames);
  129. if (isset($structure["indexes"][$indexname])) {
  130. $new_index_definition = implode(",",$structure["indexes"][$indexname]);
  131. } else {
  132. $new_index_definition = "__NOT_SET__";
  133. }
  134. if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
  135. $sql2=db_drop_index($indexname);
  136. if ($sql3 == "")
  137. $sql3 = "ALTER TABLE `".$name."` ".$sql2;
  138. else
  139. $sql3 .= ", ".$sql2;
  140. }
  141. }
  142. // Compare the field structure field by field
  143. foreach ($structure["fields"] AS $fieldname => $parameters) {
  144. if (!isset($database[$name]["fields"][$fieldname])) {
  145. $sql2=db_add_table_field($fieldname, $parameters);
  146. if ($sql3 == "")
  147. $sql3 = "ALTER TABLE `".$name."` ".$sql2;
  148. else
  149. $sql3 .= ", ".$sql2;
  150. } else {
  151. // Compare the field definition
  152. $current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
  153. $new_field_definition = implode(",",$parameters);
  154. if ($current_field_definition != $new_field_definition) {
  155. $sql2=db_modify_table_field($fieldname, $parameters);
  156. if ($sql3 == "")
  157. $sql3 = "ALTER TABLE `".$name."` ".$sql2;
  158. else
  159. $sql3 .= ", ".$sql2;
  160. }
  161. }
  162. }
  163. }
  164. // Create the index if the index don't exists in database
  165. // or the definition differ from the current status.
  166. // Don't create keys if table is new
  167. if (!$is_new_table) {
  168. foreach ($structure["indexes"] AS $indexname => $fieldnames) {
  169. if (isset($database[$name]["indexes"][$indexname])) {
  170. $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
  171. } else {
  172. $current_index_definition = "__NOT_SET__";
  173. }
  174. $new_index_definition = implode(",",$fieldnames);
  175. if ($current_index_definition != $new_index_definition) {
  176. $sql2=db_create_index($indexname, $fieldnames);
  177. if ($sql2 != "") {
  178. if ($sql3 == "")
  179. $sql3 = "ALTER TABLE `".$name."` ".$sql2;
  180. else
  181. $sql3 .= ", ".$sql2;
  182. }
  183. }
  184. }
  185. }
  186. if ($sql3 != "") {
  187. $sql3 .= ";";
  188. if ($verbose)
  189. echo $sql3."\n";
  190. if ($action) {
  191. $r = @$db->q($sql3);
  192. if(false === $r)
  193. $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
  194. }
  195. }
  196. }
  197. return $errors;
  198. }
  199. function db_field_command($parameters, $create = true) {
  200. $fieldstruct = $parameters["type"];
  201. if ($parameters["not null"])
  202. $fieldstruct .= " NOT NULL";
  203. if (isset($parameters["default"])){
  204. if (strpos(strtolower($parameters["type"]),"int")!==false) {
  205. $fieldstruct .= " DEFAULT ".$parameters["default"];
  206. } else {
  207. $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
  208. }
  209. }
  210. if ($parameters["extra"] != "")
  211. $fieldstruct .= " ".$parameters["extra"];
  212. /*if (($parameters["primary"] != "") AND $create)
  213. $fieldstruct .= " PRIMARY KEY";*/
  214. return($fieldstruct);
  215. }
  216. function db_create_table($name, $fields, $verbose, $action, $indexes=null) {
  217. global $a, $db;
  218. $r = true;
  219. $sql = "";
  220. $sql_rows = array();
  221. $primary_keys = array();
  222. foreach($fields AS $fieldname => $field) {
  223. $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
  224. if (x($field,'primary') and $field['primary']!=''){
  225. $primary_keys[] = $fieldname;
  226. }
  227. }
  228. if (!is_null($indexes)) {
  229. foreach ($indexes AS $indexname => $fieldnames) {
  230. $sql_index = db_create_index($indexname, $fieldnames, "");
  231. if (!is_null($sql_index)) $sql_rows[] = $sql_index;
  232. }
  233. }
  234. $sql = implode(",\n\t", $sql_rows);
  235. $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=utf8";
  236. if ($verbose)
  237. echo $sql.";\n";
  238. if ($action)
  239. $r = @$db->q($sql);
  240. return $r;
  241. }
  242. function db_add_table_field($fieldname, $parameters) {
  243. $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
  244. return($sql);
  245. }
  246. function db_modify_table_field($fieldname, $parameters) {
  247. $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
  248. return($sql);
  249. }
  250. function db_drop_index($indexname) {
  251. $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
  252. return($sql);
  253. }
  254. function db_create_index($indexname, $fieldnames, $method="ADD") {
  255. $method = strtoupper(trim($method));
  256. if ($method!="" && $method!="ADD") {
  257. throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
  258. killme();
  259. }
  260. if ($indexname == "PRIMARY") {
  261. return sprintf("%s PRIMARY KEY(`%s`)", $method, implode("`,`", $fieldnames));
  262. }
  263. $names = "";
  264. foreach ($fieldnames AS $fieldname) {
  265. if ($names != "")
  266. $names .= ",";
  267. if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches))
  268. $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
  269. else
  270. $names .= "`".dbesc($fieldname)."`";
  271. }
  272. $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
  273. return($sql);
  274. }
  275. function db_definition() {
  276. $database = array();
  277. $database["addon"] = array(
  278. "fields" => array(
  279. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  280. "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  281. "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  282. "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  283. "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  284. "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
  285. "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  286. ),
  287. "indexes" => array(
  288. "PRIMARY" => array("id"),
  289. )
  290. );
  291. $database["attach"] = array(
  292. "fields" => array(
  293. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  294. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  295. "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
  296. "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  297. "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
  298. "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  299. "data" => array("type" => "longblob", "not null" => "1"),
  300. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  301. "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  302. "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
  303. "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
  304. "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
  305. "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
  306. ),
  307. "indexes" => array(
  308. "PRIMARY" => array("id"),
  309. )
  310. );
  311. $database["auth_codes"] = array(
  312. "fields" => array(
  313. "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
  314. "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
  315. "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
  316. "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  317. "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
  318. ),
  319. "indexes" => array(
  320. "PRIMARY" => array("id"),
  321. )
  322. );
  323. $database["cache"] = array(
  324. "fields" => array(
  325. "k" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
  326. "v" => array("type" => "text", "not null" => "1"),
  327. "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  328. "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  329. ),
  330. "indexes" => array(
  331. "PRIMARY" => array("k"),
  332. "updated" => array("updated"),
  333. )
  334. );
  335. $database["challenge"] = array(
  336. "fields" => array(
  337. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  338. "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  339. "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  340. "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  341. "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  342. "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  343. ),
  344. "indexes" => array(
  345. "PRIMARY" => array("id"),
  346. )
  347. );
  348. $database["clients"] = array(
  349. "fields" => array(
  350. "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
  351. "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
  352. "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
  353. "name" => array("type" => "text"),
  354. "icon" => array("type" => "text"),
  355. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  356. ),
  357. "indexes" => array(
  358. "PRIMARY" => array("client_id"),
  359. )
  360. );
  361. $database["config"] = array(
  362. "fields" => array(
  363. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  364. "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  365. "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  366. "v" => array("type" => "text", "not null" => "1"),
  367. ),
  368. "indexes" => array(
  369. "PRIMARY" => array("id"),
  370. "cat_k" => array("cat(30)","k(30)"),
  371. )
  372. );
  373. $database["contact"] = array(
  374. "fields" => array(
  375. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  376. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  377. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  378. "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  379. "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  380. "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  381. "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  382. "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  383. "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  384. "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  385. "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  386. "about" => array("type" => "text", "not null" => "1"),
  387. "keywords" => array("type" => "text", "not null" => "1"),
  388. "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
  389. "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  390. "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  391. "photo" => array("type" => "text", "not null" => "1"),
  392. "thumb" => array("type" => "text", "not null" => "1"),
  393. "micro" => array("type" => "text", "not null" => "1"),
  394. "site-pubkey" => array("type" => "text", "not null" => "1"),
  395. "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  396. "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  397. "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  398. "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  399. "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  400. "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  401. "pubkey" => array("type" => "text", "not null" => "1"),
  402. "prvkey" => array("type" => "text", "not null" => "1"),
  403. "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  404. "request" => array("type" => "text", "not null" => "1"),
  405. "notify" => array("type" => "text", "not null" => "1"),
  406. "poll" => array("type" => "text", "not null" => "1"),
  407. "confirm" => array("type" => "text", "not null" => "1"),
  408. "poco" => array("type" => "text", "not null" => "1"),
  409. "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  410. "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  411. "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  412. "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  413. "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  414. "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  415. "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  416. "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  417. "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  418. "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  419. "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  420. "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  421. "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  422. "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
  423. "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
  424. "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  425. "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  426. "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  427. "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  428. "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  429. "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  430. "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
  431. "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  432. "reason" => array("type" => "text", "not null" => "1"),
  433. "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
  434. "info" => array("type" => "mediumtext", "not null" => "1"),
  435. "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  436. "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
  437. "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
  438. "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  439. "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  440. "ffi_keyword_blacklist" => array("type" => "mediumtext", "not null" => "1"),
  441. ),
  442. "indexes" => array(
  443. "PRIMARY" => array("id"),
  444. "uid" => array("uid"),
  445. "nurl" => array("nurl"),
  446. )
  447. );
  448. $database["conv"] = array(
  449. "fields" => array(
  450. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  451. "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
  452. "recips" => array("type" => "mediumtext", "not null" => "1"),
  453. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  454. "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  455. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  456. "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  457. "subject" => array("type" => "mediumtext", "not null" => "1"),
  458. ),
  459. "indexes" => array(
  460. "PRIMARY" => array("id"),
  461. "uid" => array("uid"),
  462. )
  463. );
  464. $database["deliverq"] = array(
  465. "fields" => array(
  466. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  467. "cmd" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
  468. "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  469. "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  470. ),
  471. "indexes" => array(
  472. "PRIMARY" => array("id"),
  473. )
  474. );
  475. $database["event"] = array(
  476. "fields" => array(
  477. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  478. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  479. "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  480. "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  481. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  482. "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  483. "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  484. "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  485. "summary" => array("type" => "text", "not null" => "1"),
  486. "desc" => array("type" => "text", "not null" => "1"),
  487. "location" => array("type" => "text", "not null" => "1"),
  488. "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  489. "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  490. "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
  491. "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
  492. "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
  493. "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
  494. "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
  495. "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
  496. ),
  497. "indexes" => array(
  498. "PRIMARY" => array("id"),
  499. "uid" => array("uid"),
  500. )
  501. );
  502. $database["fcontact"] = array(
  503. "fields" => array(
  504. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  505. "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  506. "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  507. "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  508. "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  509. "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  510. "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  511. "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  512. "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  513. "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  514. "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  515. "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  516. "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  517. "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
  518. "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  519. "pubkey" => array("type" => "text", "not null" => "1"),
  520. "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  521. ),
  522. "indexes" => array(
  523. "PRIMARY" => array("id"),
  524. "addr" => array("addr"),
  525. )
  526. );
  527. $database["ffinder"] = array(
  528. "fields" => array(
  529. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  530. "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  531. "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  532. "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  533. ),
  534. "indexes" => array(
  535. "PRIMARY" => array("id"),
  536. )
  537. );
  538. $database["fserver"] = array(
  539. "fields" => array(
  540. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  541. "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  542. "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  543. "key" => array("type" => "text", "not null" => "1"),
  544. ),
  545. "indexes" => array(
  546. "PRIMARY" => array("id"),
  547. "server" => array("server"),
  548. )
  549. );
  550. $database["fsuggest"] = array(
  551. "fields" => array(
  552. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  553. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  554. "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  555. "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  556. "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  557. "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  558. "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  559. "note" => array("type" => "text", "not null" => "1"),
  560. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  561. ),
  562. "indexes" => array(
  563. "PRIMARY" => array("id"),
  564. )
  565. );
  566. $database["gcign"] = array(
  567. "fields" => array(
  568. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  569. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  570. "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  571. ),
  572. "indexes" => array(
  573. "PRIMARY" => array("id"),
  574. "uid" => array("uid"),
  575. "gcid" => array("gcid"),
  576. )
  577. );
  578. $database["gcontact"] = array(
  579. "fields" => array(
  580. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  581. "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  582. "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  583. "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  584. "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  585. "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  586. "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  587. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  588. "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
  589. "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
  590. "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
  591. "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  592. "about" => array("type" => "text", "not null" => "1"),
  593. "keywords" => array("type" => "text", "not null" => "1"),
  594. "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
  595. "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
  596. "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  597. "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  598. "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  599. "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  600. "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  601. "notify" => array("type" => "text", "not null" => "1"),
  602. "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  603. "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
  604. "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  605. ),
  606. "indexes" => array(
  607. "PRIMARY" => array("id"),
  608. "nurl" => array("nurl"),
  609. "name" => array("name"),
  610. "nick" => array("nick"),
  611. "addr" => array("addr"),
  612. "updated" => array("updated"),
  613. )
  614. );
  615. $database["glink"] = array(
  616. "fields" => array(
  617. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  618. "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  619. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  620. "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  621. "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  622. "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  623. ),
  624. "indexes" => array(
  625. "PRIMARY" => array("id"),
  626. "cid_uid_gcid_zcid" => array("cid","uid","gcid","zcid"),
  627. "gcid" => array("gcid"),
  628. "zcid" => array("zcid"),
  629. )
  630. );
  631. $database["group"] = array(
  632. "fields" => array(
  633. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  634. "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  635. "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  636. "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  637. "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  638. ),
  639. "indexes" => array(
  640. "PRIMARY" => array("id"),
  641. "uid" => array("uid"),
  642. )
  643. );
  644. $database["group_member"] = array(
  645. "fields" => array(
  646. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  647. "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  648. "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  649. "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  650. ),
  651. "indexes" => array(
  652. "PRIMARY" => array("id"),
  653. "uid_gid_contactid" => array("uid","gid","contact-id"),
  654. )
  655. );
  656. $database["gserver"] = array(
  657. "fields" => array(
  658. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  659. "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  660. "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  661. "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  662. "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  663. "info" => array("type" => "text", "not null" => "1"),
  664. "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  665. "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  666. "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  667. "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
  668. "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  669. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  670. "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
  671. "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
  672. "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
  673. ),
  674. "indexes" => array(
  675. "PRIMARY" => array("id"),
  676. "nurl" => array("nurl"),
  677. )
  678. );
  679. $database["hook"] = array(
  680. "fields" => array(
  681. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  682. "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  683. "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  684. "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  685. "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
  686. ),
  687. "indexes" => array(
  688. "PRIMARY" => array("id"),
  689. "hook_file_function" => array("hook(30)","file(60)","function(30)"),
  690. )
  691. );
  692. $database["intro"] = array(
  693. "fields" => array(
  694. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  695. "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  696. "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  697. "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  698. "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  699. "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  700. "note" => array("type" => "text", "not null" => "1"),
  701. "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  702. "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  703. "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
  704. "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  705. ),
  706. "indexes" => array(
  707. "PRIMARY" => array("id"),
  708. )
  709. );
  710. $database["item"] = array(
  711. "fields" => array(
  712. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  713. "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  714. "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  715. "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  716. "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  717. "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
  718. "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  719. "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  720. "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  721. "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  722. "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  723. "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  724. "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  725. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  726. "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  727. "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  728. "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  729. "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  730. "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  731. "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  732. "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  733. "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  734. "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  735. "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  736. "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  737. "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  738. "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  739. "body" => array("type" => "mediumtext", "not null" => "1"),
  740. "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  741. "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  742. "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  743. "object" => array("type" => "text", "not null" => "1"),
  744. "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  745. "target" => array("type" => "text", "not null" => "1"),
  746. "postopts" => array("type" => "text", "not null" => "1"),
  747. "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  748. "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  749. "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  750. "tag" => array("type" => "mediumtext", "not null" => "1"),
  751. "attach" => array("type" => "mediumtext", "not null" => "1"),
  752. "inform" => array("type" => "mediumtext", "not null" => "1"),
  753. "file" => array("type" => "mediumtext", "not null" => "1"),
  754. "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  755. "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  756. "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
  757. "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
  758. "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
  759. "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
  760. "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  761. "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  762. "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  763. "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  764. "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  765. "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  766. "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  767. "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
  768. "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  769. "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  770. "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  771. "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
  772. "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  773. "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
  774. "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
  775. "rendered-html" => array("type" => "mediumtext", "not null" => "1"),
  776. "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  777. ),
  778. "indexes" => array(
  779. "PRIMARY" => array("id"),
  780. "guid" => array("guid"),
  781. "uri" => array("uri"),
  782. "parent" => array("parent"),
  783. "parent-uri" => array("parent-uri"),
  784. "extid" => array("extid"),
  785. "uid_id" => array("uid","id"),
  786. "uid_created" => array("uid","created"),
  787. "uid_unseen_contactid" => array("uid","unseen","contact-id"),
  788. "uid_network_received" => array("uid","network","received"),
  789. "uid_received" => array("uid","received"),
  790. "uid_network_commented" => array("uid","network","commented"),
  791. "uid_commented" => array("uid","commented"),
  792. "uid_title" => array("uid","title"),
  793. "uid_thrparent" => array("uid","thr-parent"),
  794. "uid_parenturi" => array("uid","parent-uri"),
  795. "uid_contactid_id" => array("uid","contact-id","id"),
  796. "uid_contactid_created" => array("uid","contact-id","created"),
  797. "gcontactid_uid_created" => array("gcontact-id","uid","created"),
  798. "authorid_created" => array("author-id","created"),
  799. "ownerid_created" => array("owner-id","created"),
  800. "wall_body" => array("wall","body(6)"),
  801. "uid_visible_moderated_created" => array("uid","visible","moderated","created"),
  802. "uid_uri" => array("uid","uri"),
  803. "uid_wall_created" => array("uid","wall","created"),
  804. "resource-id" => array("resource-id"),
  805. "uid_type" => array("uid","type"),
  806. "uid_starred_id" => array("uid","starred", "id"),
  807. "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
  808. "uid_wall_parent_created" => array("uid","wall","parent","created"),
  809. "uid_type_changed" => array("uid","type","changed"),
  810. "contactid_verb" => array("contact-id","verb"),
  811. "deleted_changed" => array("deleted","changed"),
  812. "uid_wall_changed" => array("uid","wall","changed"),
  813. "uid_eventid" => array("uid","event-id"),
  814. "uid_authorlink" => array("uid","author-link"),
  815. "uid_ownerlink" => array("uid","owner-link"),
  816. )
  817. );
  818. $database["item_id"] = array(
  819. "fields" => array(
  820. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  821. "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  822. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  823. "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  824. "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  825. ),
  826. "indexes" => array(
  827. "PRIMARY" => array("id"),
  828. "uid" => array("uid"),
  829. "sid" => array("sid"),
  830. "service" => array("service"),
  831. "iid" => array("iid"),
  832. )
  833. );
  834. $database["locks"] = array(
  835. "fields" => array(
  836. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  837. "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
  838. "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  839. "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
  840. ),
  841. "indexes" => array(
  842. "PRIMARY" => array("id"),
  843. )
  844. );
  845. $database["mail"] = array(
  846. "fields" => array(
  847. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  848. "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  849. "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
  850. "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  851. "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  852. "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  853. "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  854. "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
  855. "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  856. "body" => array("type" => "mediumtext", "not null" => "1"),
  857. "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  858. "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  859. "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  860. "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  861. "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  862. "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  863. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  864. ),
  865. "indexes" => array(
  866. "PRIMARY" => array("id"),
  867. "uid" => array("uid"),
  868. "guid" => array("guid"),
  869. "convid" => array("convid"),
  870. "reply" => array("reply"),
  871. "uri" => array("uri"),
  872. "parent-uri" => array("parent-uri"),
  873. )
  874. );
  875. $database["mailacct"] = array(
  876. "fields" => array(
  877. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  878. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  879. "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  880. "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  881. "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
  882. "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  883. "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  884. "pass" => array("type" => "text", "not null" => "1"),
  885. "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  886. "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  887. "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  888. "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  889. "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  890. ),
  891. "indexes" => array(
  892. "PRIMARY" => array("id"),
  893. )
  894. );
  895. $database["manage"] = array(
  896. "fields" => array(
  897. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  898. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  899. "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  900. ),
  901. "indexes" => array(
  902. "PRIMARY" => array("id"),
  903. "uid_mid" => array("uid","mid"),
  904. )
  905. );
  906. $database["notify"] = array(
  907. "fields" => array(
  908. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  909. "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
  910. "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  911. "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  912. "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  913. "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  914. "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  915. "msg" => array("type" => "mediumtext", "not null" => "1"),
  916. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  917. "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  918. "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  919. "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  920. "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  921. "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  922. "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
  923. ),
  924. "indexes" => array(
  925. "PRIMARY" => array("id"),
  926. "uid" => array("uid"),
  927. )
  928. );
  929. $database["notify-threads"] = array(
  930. "fields" => array(
  931. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  932. "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  933. "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  934. "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  935. "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  936. ),
  937. "indexes" => array(
  938. "PRIMARY" => array("id"),
  939. "master-parent-item" => array("master-parent-item"),
  940. "receiver-uid" => array("receiver-uid"),
  941. )
  942. );
  943. $database["oembed"] = array(
  944. "fields" => array(
  945. "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
  946. "content" => array("type" => "text", "not null" => "1"),
  947. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  948. ),
  949. "indexes" => array(
  950. "PRIMARY" => array("url"),
  951. "created" => array("created"),
  952. )
  953. );
  954. $database["parsed_url"] = array(
  955. "fields" => array(
  956. "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
  957. "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
  958. "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
  959. "content" => array("type" => "text", "not null" => "1"),
  960. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  961. ),
  962. "indexes" => array(
  963. "PRIMARY" => array("url", "guessing", "oembed"),
  964. "created" => array("created"),
  965. )
  966. );
  967. $database["pconfig"] = array(
  968. "fields" => array(
  969. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  970. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  971. "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  972. "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  973. "v" => array("type" => "mediumtext", "not null" => "1"),
  974. ),
  975. "indexes" => array(
  976. "PRIMARY" => array("id"),
  977. "uid_cat_k" => array("uid","cat(30)","k(30)"),
  978. )
  979. );
  980. $database["photo"] = array(
  981. "fields" => array(
  982. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  983. "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  984. "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  985. "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
  986. "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  987. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  988. "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  989. "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  990. "desc" => array("type" => "text", "not null" => "1"),
  991. "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  992. "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  993. "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
  994. "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
  995. "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
  996. "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  997. "data" => array("type" => "mediumblob", "not null" => "1"),
  998. "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
  999. "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  1000. "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
  1001. "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
  1002. "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
  1003. "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
  1004. ),
  1005. "indexes" => array(
  1006. "PRIMARY" => array("id"),
  1007. "uid" => array("uid"),
  1008. "resource-id" => array("resource-id"),
  1009. "guid" => array("guid"),
  1010. )
  1011. );
  1012. $database["poll"] = array(
  1013. "fields" => array(
  1014. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  1015. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  1016. "q0" => array("type" => "mediumtext", "not null" => "1"),
  1017. "q1" => array("type" => "mediumtext", "not null" => "1"),
  1018. "q2" => array("type" => "mediumtext", "not null" => "1"),
  1019. "q3" => array("type" => "mediumtext", "not null" => "1"),
  1020. "q4" => array("type" => "mediumtext", "not null" => "1"),
  1021. "q5" => array("type" => "mediumtext", "not null" => "1"),
  1022. "q6" => array("type" => "mediumtext", "not null" => "1"),
  1023. "q7" => array("type" => "mediumtext", "not null" => "1"),
  1024. "q8" => array("type" => "mediumtext", "not null" => "1"),
  1025. "q9" => array("type" => "mediumtext", "not null" => "1"),
  1026. ),
  1027. "indexes" => array(
  1028. "PRIMARY" => array("id"),
  1029. "uid" => array("uid"),
  1030. )
  1031. );
  1032. $database["poll_result"] = array(
  1033. "fields" => array(
  1034. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  1035. "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  1036. "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  1037. ),
  1038. "indexes" => array(
  1039. "PRIMARY" => array("id"),
  1040. "poll_id" => array("poll_id"),
  1041. "choice" => array("choice"),
  1042. )
  1043. );
  1044. $database["profile"] = array(
  1045. "fields" => array(
  1046. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  1047. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  1048. "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1049. "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  1050. "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  1051. "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1052. "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1053. "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
  1054. "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1055. "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1056. "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1057. "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
  1058. "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1059. "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1060. "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
  1061. "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1062. "with" => array("type" => "text", "not null" => "1"),
  1063. "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  1064. "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1065. "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1066. "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1067. "pub_keywords" => array("type" => "text", "not null" => "1"),
  1068. "prv_keywords" => array("type" => "text", "not null" => "1"),
  1069. "likes" => array("type" => "text", "not null" => "1"),
  1070. "dislikes" => array("type" => "text", "not null" => "1"),
  1071. "about" => array("type" => "text", "not null" => "1"),
  1072. "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1073. "music" => array("type" => "text", "not null" => "1"),
  1074. "book" => array("type" => "text", "not null" => "1"),
  1075. "tv" => array("type" => "text", "not null" => "1"),
  1076. "film" => array("type" => "text", "not null" => "1"),
  1077. "interest" => array("type" => "text", "not null" => "1"),
  1078. "romance" => array("type" => "text", "not null" => "1"),
  1079. "work" => array("type" => "text", "not null" => "1"),
  1080. "education" => array("type" => "text", "not null" => "1"),
  1081. "contact" => array("type" => "text", "not null" => "1"),
  1082. "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1083. "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1084. "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1085. "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  1086. "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  1087. ),
  1088. "indexes" => array(
  1089. "PRIMARY" => array("id"),
  1090. "hometown" => array("hometown"),
  1091. )
  1092. );
  1093. $database["profile_check"] = array(
  1094. "fields" => array(
  1095. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  1096. "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  1097. "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  1098. "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1099. "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1100. "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  1101. ),
  1102. "indexes" => array(
  1103. "PRIMARY" => array("id"),
  1104. )
  1105. );
  1106. $database["push_subscriber"] = array(
  1107. "fields" => array(
  1108. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  1109. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  1110. "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1111. "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1112. "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1113. "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  1114. "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  1115. "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1116. ),
  1117. "indexes" => array(
  1118. "PRIMARY" => array("id"),
  1119. )
  1120. );
  1121. $database["queue"] = array(
  1122. "fields" => array(
  1123. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  1124. "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  1125. "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
  1126. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  1127. "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  1128. "content" => array("type" => "mediumtext", "not null" => "1"),
  1129. "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  1130. ),
  1131. "indexes" => array(
  1132. "PRIMARY" => array("id"),
  1133. "cid" => array("cid"),
  1134. "created" => array("created"),
  1135. "last" => array("last"),
  1136. "network" => array("network"),
  1137. "batch" => array("batch"),
  1138. )
  1139. );
  1140. $database["register"] = array(
  1141. "fields" => array(
  1142. "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  1143. "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1144. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  1145. "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
  1146. "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1147. "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
  1148. ),
  1149. "indexes" => array(
  1150. "PRIMARY" => array("id"),
  1151. )
  1152. );
  1153. $database["search"] = array(
  1154. "fields" => array(
  1155. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  1156. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  1157. "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1158. ),
  1159. "indexes" => array(
  1160. "PRIMARY" => array("id"),
  1161. "uid" => array("uid"),
  1162. "term" => array("term"),
  1163. )
  1164. );
  1165. $database["session"] = array(
  1166. "fields" => array(
  1167. "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  1168. "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1169. "data" => array("type" => "text", "not null" => "1"),
  1170. "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  1171. ),
  1172. "indexes" => array(
  1173. "PRIMARY" => array("id"),
  1174. "sid" => array("sid"),
  1175. "expire" => array("expire"),
  1176. )
  1177. );
  1178. $database["sign"] = array(
  1179. "fields" => array(
  1180. "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  1181. "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  1182. "signed_text" => array("type" => "mediumtext", "not null" => "1"),
  1183. "signature" => array("type" => "text", "not null" => "1"),
  1184. "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1185. ),
  1186. "indexes" => array(
  1187. "PRIMARY" => array("id"),
  1188. "iid" => array("iid"),
  1189. )
  1190. );
  1191. $database["spam"] = array(
  1192. "fields" => array(
  1193. "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  1194. "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  1195. "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  1196. "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
  1197. "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1198. "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  1199. ),
  1200. "indexes" => array(
  1201. "PRIMARY" => array("id"),
  1202. "uid" => array("uid"),
  1203. "spam" => array("spam"),
  1204. "ham" => array("ham"),
  1205. "term" => array("term"),
  1206. )
  1207. );
  1208. $database["term"] = array(
  1209. "fields" => array(
  1210. "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
  1211. "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  1212. "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
  1213. "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
  1214. "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1215. "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1216. "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
  1217. "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  1218. "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
  1219. "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
  1220. "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  1221. "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
  1222. ),
  1223. "indexes" => array(
  1224. "PRIMARY" => array("tid"),
  1225. "oid_otype_type_term" => array("oid","otype","type","term"),
  1226. "uid_term_tid" => array("uid","term","tid"),
  1227. "type_term" => array("type","</