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.
 
 
 
 
 
 

1276 lines
58 KiB

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