2 require_once("boot.php");
3 require_once("include/text.php");
5 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
8 * send the email and do what is needed to do on update fails
10 * @param update_id (int) number of failed update
11 * @param error_message (str) error message
13 function update_fail($update_id, $error_message){
14 //send the administrators an e-mail
15 $admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
16 $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
20 // every admin could had different language
22 foreach ($adminlist as $admin) {
23 $lang = (($admin['language'])?$admin['language']:'en');
26 $preamble = deindent(t("
27 The friendica developers released update %s recently,
28 but when I tried to install it, something went terribly wrong.
29 This needs to be fixed soon and I can't do it alone. Please contact a
30 friendica developer if you can not help me on your own. My database might be invalid."));
31 $body = t("The error message is\n[pre]%s[/pre]");
32 $preamble = sprintf($preamble, $update_id);
33 $body = sprintf($body, $error_message);
36 'type' => "SYSTEM_EMAIL",
37 'to_email' => $admin['email'],
38 'preamble' => $preamble,
48 $email_tpl = get_intltext_template("update_fail_eml.tpl");
49 $email_msg = replace_macros($email_tpl, array(
50 '$sitename' => $a->config['sitename'],
51 '$siteurl' => $a->get_baseurl(),
52 '$update' => DB_UPDATE_VERSION,
53 '$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
55 $subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
56 require_once('include/email.php');
57 $subject = email_header_encode($subject,'UTF-8');
58 mail($a->config['admin_email'], $subject, $email_msg,
59 'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n"
60 .'Content-type: text/plain; charset=UTF-8'."\n"
61 .'Content-transfer-encoding: 8bit');
64 logger("CRITICAL: Database structure update failed: ".$retval);
68 function table_structure($table) {
69 $structures = q("DESCRIBE `%s`", $table);
71 $indexes = q("SHOW INDEX FROM `%s`", $table);
76 if (is_array($indexes))
77 foreach ($indexes AS $index) {
78 if ($index["Index_type"] == "FULLTEXT")
81 if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
82 $indexdata[$index["Key_name"]] = array('UNIQUE');
85 $column = $index["Column_name"];
86 // On utf8mb4 a varchar index can only have a length of 191
87 // To avoid the need to add this to every index definition we just ignore it here.
88 // Exception are primary indexes
89 // Since there are some combindex primary indexes we use the limit of 180 here.
90 if (($index["Sub_part"] != "") AND (($index["Sub_part"] < 180) OR ($index["Key_name"] == "PRIMARY")))
91 $column .= "(".$index["Sub_part"].")";
93 $indexdata[$index["Key_name"]][] = $column;
96 if (is_array($structures)) {
97 foreach($structures AS $field) {
98 $fielddata[$field["Field"]]["type"] = $field["Type"];
99 if ($field["Null"] == "NO")
100 $fielddata[$field["Field"]]["not null"] = true;
102 if (isset($field["Default"]))
103 $fielddata[$field["Field"]]["default"] = $field["Default"];
105 if ($field["Extra"] != "")
106 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
108 if ($field["Key"] == "PRI")
109 $fielddata[$field["Field"]]["primary"] = true;
112 return(array("fields"=>$fielddata, "indexes"=>$indexdata));
115 function print_structure($database, $charset) {
116 echo "-- ------------------------------------------\n";
117 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
118 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
119 echo "-- ------------------------------------------\n\n\n";
120 foreach ($database AS $name => $structure) {
122 echo "-- TABLE $name\n";
124 db_create_table($name, $structure['fields'], $charset, true, false, $structure["indexes"]);
130 function update_structure($verbose, $action, $tables=null, $definition=null) {
134 set_config('system', 'maintenance', 1);
136 if (isset($a->config["system"]["db_charset"]))
137 $charset = $a->config["system"]["db_charset"];
143 logger('updating structure', LOGGER_DEBUG);
145 // Get the current structure
148 if (is_null($tables))
149 $tables = q("show tables");
151 foreach ($tables AS $table) {
152 $table = current($table);
154 $database[$table] = table_structure($table);
157 // Get the definition
158 if (is_null($definition))
159 $definition = db_definition($charset);
161 // Ensure index conversion to unique removes duplicates
162 $sql_config = "SET session old_alter_table=1;";
164 echo $sql_config."\n";
166 @$db->q($sql_config);
168 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
169 if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
170 !(strpos($db->server_info(), 'MariaDB') !== false)) {
177 foreach ($definition AS $name => $structure) {
178 $is_new_table = False;
180 if (!isset($database[$name])) {
181 $r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']);
183 $errors .= t('Errors encountered creating database tables.').$name.EOL;
185 $is_new_table = True;
187 // Drop the index if it isn't present in the definition
188 // or the definition differ from current status
189 // and index name doesn't start with "local_"
190 foreach ($database[$name]["indexes"] AS $indexname => $fieldnames) {
191 $current_index_definition = implode(",",$fieldnames);
192 if (isset($structure["indexes"][$indexname])) {
193 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
195 $new_index_definition = "__NOT_SET__";
197 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
198 $sql2=db_drop_index($indexname);
200 $sql3 = "ALTER".$ignore." TABLE `".$name."` ".$sql2;
205 // Compare the field structure field by field
206 foreach ($structure["fields"] AS $fieldname => $parameters) {
207 if (!isset($database[$name]["fields"][$fieldname])) {
208 $sql2=db_add_table_field($fieldname, $parameters);
210 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
214 // Compare the field definition
215 $current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
216 $new_field_definition = implode(",",$parameters);
217 if ($current_field_definition != $new_field_definition) {
218 $sql2=db_modify_table_field($fieldname, $parameters);
220 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
229 // Create the index if the index don't exists in database
230 // or the definition differ from the current status.
231 // Don't create keys if table is new
232 if (!$is_new_table) {
233 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
234 if (isset($database[$name]["indexes"][$indexname])) {
235 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
237 $current_index_definition = "__NOT_SET__";
239 $new_index_definition = implode(",",$fieldnames);
240 if ($current_index_definition != $new_index_definition) {
241 $sql2=db_create_index($indexname, $fieldnames);
244 $sql3 = "ALTER" . $ignore . " TABLE `".$name."` ".$sql2;
260 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
266 set_config('system', 'maintenance', 0);
271 function db_field_command($parameters, $create = true) {
272 $fieldstruct = $parameters["type"];
274 if ($parameters["not null"])
275 $fieldstruct .= " NOT NULL";
277 if (isset($parameters["default"])){
278 if (strpos(strtolower($parameters["type"]),"int")!==false) {
279 $fieldstruct .= " DEFAULT ".$parameters["default"];
281 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
284 if ($parameters["extra"] != "")
285 $fieldstruct .= " ".$parameters["extra"];
287 /*if (($parameters["primary"] != "") AND $create)
288 $fieldstruct .= " PRIMARY KEY";*/
290 return($fieldstruct);
293 function db_create_table($name, $fields, $charset, $verbose, $action, $indexes=null) {
301 $primary_keys = array();
302 foreach($fields AS $fieldname => $field) {
303 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
304 if (x($field,'primary') and $field['primary']!=''){
305 $primary_keys[] = $fieldname;
309 if (!is_null($indexes)) {
310 foreach ($indexes AS $indexname => $fieldnames) {
311 $sql_index = db_create_index($indexname, $fieldnames, "");
312 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
316 $sql = implode(",\n\t", $sql_rows);
318 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=".$charset;
328 function db_add_table_field($fieldname, $parameters) {
329 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
333 function db_modify_table_field($fieldname, $parameters) {
334 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
338 function db_drop_index($indexname) {
339 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
343 function db_create_index($indexname, $fieldnames, $method="ADD") {
345 $method = strtoupper(trim($method));
346 if ($method!="" && $method!="ADD") {
347 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
351 if ($fieldnames[0] == "UNIQUE") {
352 array_shift($fieldnames);
353 $method .= ' UNIQUE';
357 foreach ($fieldnames AS $fieldname) {
361 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches))
362 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
364 $names .= "`".dbesc($fieldname)."`";
367 if ($indexname == "PRIMARY") {
368 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
372 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
376 function db_index_suffix($charset, $reduce = 0) {
377 if ($charset != "utf8mb4")
380 // On utf8mb4 indexes can only have a length of 191
381 $indexlength = 191 - $reduce;
383 return "(".$indexlength.")";
386 function db_definition($charset) {
390 $database["addon"] = array(
392 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
393 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
394 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
395 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
396 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
397 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
398 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
401 "PRIMARY" => array("id"),
404 $database["attach"] = array(
406 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
407 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
408 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
409 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
410 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
411 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
412 "data" => array("type" => "longblob", "not null" => "1"),
413 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
414 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
415 "allow_cid" => array("type" => "mediumtext"),
416 "allow_gid" => array("type" => "mediumtext"),
417 "deny_cid" => array("type" => "mediumtext"),
418 "deny_gid" => array("type" => "mediumtext"),
421 "PRIMARY" => array("id"),
424 $database["auth_codes"] = array(
426 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
427 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
428 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
429 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
430 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
433 "PRIMARY" => array("id"),
436 $database["cache"] = array(
438 "k" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
439 "v" => array("type" => "text"),
440 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
441 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
444 "PRIMARY" => array("k".db_index_suffix($charset)),
445 "updated" => array("updated"),
446 "expire_mode_updated" => array("expire_mode", "updated"),
449 $database["challenge"] = array(
451 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
452 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
453 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
454 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
455 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
456 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
459 "PRIMARY" => array("id"),
462 $database["clients"] = array(
464 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
465 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
466 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
467 "name" => array("type" => "text"),
468 "icon" => array("type" => "text"),
469 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
472 "PRIMARY" => array("client_id"),
475 $database["config"] = array(
477 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
478 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
479 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
480 "v" => array("type" => "text"),
483 "PRIMARY" => array("id"),
484 "cat_k" => array("UNIQUE", "cat(30)","k(30)"),
487 $database["contact"] = array(
489 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
490 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
491 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
492 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
493 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
494 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
495 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
496 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
497 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
498 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
499 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
500 "about" => array("type" => "text"),
501 "keywords" => array("type" => "text"),
502 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
503 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
504 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
505 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
506 "photo" => array("type" => "text"),
507 "thumb" => array("type" => "text"),
508 "micro" => array("type" => "text"),
509 "site-pubkey" => array("type" => "text"),
510 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
511 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
512 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
513 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
514 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
515 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
516 "pubkey" => array("type" => "text"),
517 "prvkey" => array("type" => "text"),
518 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
519 "request" => array("type" => "text"),
520 "notify" => array("type" => "text"),
521 "poll" => array("type" => "text"),
522 "confirm" => array("type" => "text"),
523 "poco" => array("type" => "text"),
524 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
525 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
526 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
527 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
528 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
529 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
530 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
531 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
532 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
533 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
534 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
535 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
536 "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
537 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
538 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
539 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
540 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
541 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
542 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
543 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
544 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
545 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
546 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
547 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
548 "reason" => array("type" => "text"),
549 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
550 "info" => array("type" => "mediumtext"),
551 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
552 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
553 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
554 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
555 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
556 "ffi_keyword_blacklist" => array("type" => "mediumtext"),
559 "PRIMARY" => array("id"),
560 "uid" => array("uid"),
561 "addr_uid" => array("addr", "uid"),
562 "nurl" => array("nurl"),
565 $database["conv"] = array(
567 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
568 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
569 "recips" => array("type" => "mediumtext"),
570 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
571 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
572 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
573 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
574 "subject" => array("type" => "mediumtext"),
577 "PRIMARY" => array("id"),
578 "uid" => array("uid"),
581 $database["deliverq"] = array(
583 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
584 "cmd" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
585 "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
586 "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
589 "PRIMARY" => array("id"),
590 "cmd_item_contact" => array("UNIQUE", "cmd", "item", "contact"),
593 $database["event"] = array(
595 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
596 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
597 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
598 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
599 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
600 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
601 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
602 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
603 "summary" => array("type" => "text"),
604 "desc" => array("type" => "text"),
605 "location" => array("type" => "text"),
606 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
607 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
608 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
609 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
610 "allow_cid" => array("type" => "mediumtext"),
611 "allow_gid" => array("type" => "mediumtext"),
612 "deny_cid" => array("type" => "mediumtext"),
613 "deny_gid" => array("type" => "mediumtext"),
616 "PRIMARY" => array("id"),
617 "uid" => array("uid"),
620 $database["fcontact"] = array(
622 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
623 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
624 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
625 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
626 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
627 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
628 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
629 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
630 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
631 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
632 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
633 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
634 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
635 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
636 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
637 "pubkey" => array("type" => "text"),
638 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
641 "PRIMARY" => array("id"),
642 "addr" => array("addr"),
645 $database["ffinder"] = array(
647 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
648 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
649 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
650 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
653 "PRIMARY" => array("id"),
656 $database["fserver"] = array(
658 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
659 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
660 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
661 "key" => array("type" => "text"),
664 "PRIMARY" => array("id"),
665 "server" => array("server"),
668 $database["fsuggest"] = array(
670 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
671 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
672 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
673 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
674 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
675 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
676 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
677 "note" => array("type" => "text"),
678 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
681 "PRIMARY" => array("id"),
684 $database["gcign"] = array(
686 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
687 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
688 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
691 "PRIMARY" => array("id"),
692 "uid" => array("uid"),
693 "gcid" => array("gcid"),
696 $database["gcontact"] = array(
698 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
699 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
700 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
701 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
702 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
703 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
704 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
705 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
706 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
707 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
708 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
709 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
710 "about" => array("type" => "text"),
711 "keywords" => array("type" => "text"),
712 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
713 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
714 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
715 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
716 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
717 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
718 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
719 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
720 "notify" => array("type" => "text"),
721 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
722 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
723 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
726 "PRIMARY" => array("id"),
727 "nurl" => array("nurl"),
728 "name" => array("name"),
729 "nick" => array("nick"),
730 "addr" => array("addr"),
731 "updated" => array("updated"),
734 $database["glink"] = array(
736 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
737 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
738 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
739 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
740 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
741 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
744 "PRIMARY" => array("id"),
745 "cid_uid_gcid_zcid" => array("cid","uid","gcid","zcid"),
746 "gcid" => array("gcid"),
747 "zcid" => array("zcid"),
750 $database["group"] = array(
752 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
753 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
754 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
755 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
756 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
759 "PRIMARY" => array("id"),
760 "uid" => array("uid"),
763 $database["group_member"] = array(
765 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
766 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
767 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
768 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
771 "PRIMARY" => array("id"),
772 "uid_gid_contactid" => array("uid","gid","contact-id"),
775 $database["gserver"] = array(
777 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
778 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
779 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
780 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
781 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
782 "info" => array("type" => "text"),
783 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
784 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
785 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
786 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
787 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
788 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
789 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
790 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
791 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
794 "PRIMARY" => array("id"),
795 "nurl" => array("nurl"),
798 $database["hook"] = array(
800 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
801 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
802 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
803 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
804 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
807 "PRIMARY" => array("id"),
808 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
811 $database["intro"] = array(
813 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
814 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
815 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
816 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
817 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
818 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
819 "note" => array("type" => "text"),
820 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
821 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
822 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
823 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
826 "PRIMARY" => array("id"),
829 $database["item"] = array(
831 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
832 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
833 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
834 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
835 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
836 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
837 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
838 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
839 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
840 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
841 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
842 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
843 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
844 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
845 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
846 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
847 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
848 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
849 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
850 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
851 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
852 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
853 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
854 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
855 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
856 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
857 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
858 "body" => array("type" => "mediumtext"),
859 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
860 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
861 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
862 "object" => array("type" => "text"),
863 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
864 "target" => array("type" => "text"),
865 "postopts" => array("type" => "text"),
866 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
867 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
868 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
869 "tag" => array("type" => "mediumtext"),
870 "attach" => array("type" => "mediumtext"),
871 "inform" => array("type" => "mediumtext"),
872 "file" => array("type" => "mediumtext"),
873 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
874 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
875 "allow_cid" => array("type" => "mediumtext"),
876 "allow_gid" => array("type" => "mediumtext"),
877 "deny_cid" => array("type" => "mediumtext"),
878 "deny_gid" => array("type" => "mediumtext"),
879 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
880 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
881 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
882 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
883 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
884 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
885 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
886 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
887 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
888 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
889 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
890 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
891 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
892 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
893 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
894 "rendered-html" => array("type" => "mediumtext"),
895 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
898 "PRIMARY" => array("id"),
899 "guid" => array("guid"),
900 "uri" => array("uri"),
901 "parent" => array("parent"),
902 "parent-uri" => array("parent-uri"),
903 "extid" => array("extid"),
904 "uid_id" => array("uid","id"),
905 "uid_created" => array("uid","created"),
906 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
907 "uid_network_received" => array("uid","network","received"),
908 "uid_received" => array("uid","received"),
909 "uid_network_commented" => array("uid","network","commented"),
910 "uid_commented" => array("uid","commented"),
911 "uid_title" => array("uid","title"),
912 "uid_thrparent" => array("uid","thr-parent"),
913 "uid_parenturi" => array("uid","parent-uri"),
914 "uid_contactid_id" => array("uid","contact-id","id"),
915 "uid_contactid_created" => array("uid","contact-id","created"),
916 "gcontactid_uid_created" => array("gcontact-id","uid","created"),
917 "authorid_created" => array("author-id","created"),
918 "ownerid_created" => array("owner-id","created"),
919 "wall_body" => array("wall","body(6)"),
920 "uid_visible_moderated_created" => array("uid","visible","moderated","created"),
921 "uid_uri" => array("uid","uri"),
922 "uid_wall_created" => array("uid","wall","created"),
923 "resource-id" => array("resource-id"),
924 "uid_type" => array("uid","type"),
925 "uid_starred_id" => array("uid","starred", "id"),
926 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
927 "uid_wall_parent_created" => array("uid","wall","parent","created"),
928 "uid_type_changed" => array("uid","type","changed"),
929 "contactid_verb" => array("contact-id","verb"),
930 "deleted_changed" => array("deleted","changed"),
931 "uid_wall_changed" => array("uid","wall","changed"),
932 "uid_eventid" => array("uid","event-id"),
933 "uid_authorlink" => array("uid","author-link"),
934 "uid_ownerlink" => array("uid","owner-link"),
937 $database["item_id"] = array(
939 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
940 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
941 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
942 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
943 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
946 "PRIMARY" => array("id"),
947 "uid" => array("uid"),
948 "sid" => array("sid"),
949 "service" => array("service"),
950 "iid" => array("iid"),
953 $database["locks"] = array(
955 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
956 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
957 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
958 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
961 "PRIMARY" => array("id"),
964 $database["mail"] = array(
966 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
967 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
968 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
969 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
970 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
971 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
972 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
973 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
974 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
975 "body" => array("type" => "mediumtext"),
976 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
977 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
978 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
979 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
980 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
981 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
982 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
985 "PRIMARY" => array("id"),
986 "uid" => array("uid"),
987 "guid" => array("guid"),
988 "convid" => array("convid"),
989 "reply" => array("reply"),
990 "uri" => array("uri"),
991 "parent-uri" => array("parent-uri"),
994 $database["mailacct"] = array(
996 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
997 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
998 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
999 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1000 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1001 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1002 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1003 "pass" => array("type" => "text"),
1004 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1005 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1006 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1007 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1008 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1011 "PRIMARY" => array("id"),
1014 $database["manage"] = array(
1016 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1017 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1018 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1021 "PRIMARY" => array("id"),
1022 "uid_mid" => array("uid","mid"),
1025 $database["notify"] = array(
1027 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1028 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1029 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1030 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1031 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1032 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1033 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1034 "msg" => array("type" => "mediumtext"),
1035 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1036 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1037 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1038 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1039 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1040 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1041 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1042 "name_cache" => array("type" => "tinytext"),
1043 "msg_cache" => array("type" => "mediumtext")
1046 "PRIMARY" => array("id"),
1047 "uid" => array("uid"),
1050 $database["notify-threads"] = array(
1052 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1053 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1054 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1055 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1056 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1059 "PRIMARY" => array("id"),
1060 "master-parent-item" => array("master-parent-item"),
1061 "receiver-uid" => array("receiver-uid"),
1064 $database["oembed"] = array(
1066 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1067 "content" => array("type" => "text"),
1068 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1071 "PRIMARY" => array("url".db_index_suffix($charset)),
1072 "created" => array("created"),
1075 $database["parsed_url"] = array(
1077 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1078 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1079 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1080 "content" => array("type" => "text"),
1081 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1084 "PRIMARY" => array("url".db_index_suffix($charset), "guessing", "oembed"),
1085 "created" => array("created"),
1088 $database["pconfig"] = array(
1090 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1091 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1092 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1093 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1094 "v" => array("type" => "mediumtext"),
1097 "PRIMARY" => array("id"),
1098 "uid_cat_k" => array("UNIQUE", "uid","cat(30)","k(30)"),
1101 $database["photo"] = array(
1103 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1104 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1105 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1106 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1107 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1108 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1109 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1110 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1111 "desc" => array("type" => "text"),
1112 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1113 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1114 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1115 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1116 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1117 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1118 "data" => array("type" => "mediumblob", "not null" => "1"),
1119 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1120 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1121 "allow_cid" => array("type" => "mediumtext"),
1122 "allow_gid" => array("type" => "mediumtext"),
1123 "deny_cid" => array("type" => "mediumtext"),
1124 "deny_gid" => array("type" => "mediumtext"),
1127 "PRIMARY" => array("id"),
1128 "uid_contactid" => array("uid", "contact-id"),
1129 "uid_profile" => array("uid", "profile"),
1130 "uid_album_created" => array("uid", "album", "created"),
1131 "resource-id" => array("resource-id"),
1132 "guid" => array("guid"),
1135 $database["poll"] = array(
1137 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1138 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1139 "q0" => array("type" => "mediumtext"),
1140 "q1" => array("type" => "mediumtext"),
1141 "q2" => array("type" => "mediumtext"),
1142 "q3" => array("type" => "mediumtext"),
1143 "q4" => array("type" => "mediumtext"),
1144 "q5" => array("type" => "mediumtext"),
1145 "q6" => array("type" => "mediumtext"),
1146 "q7" => array("type" => "mediumtext"),
1147 "q8" => array("type" => "mediumtext"),
1148 "q9" => array("type" => "mediumtext"),
1151 "PRIMARY" => array("id"),
1152 "uid" => array("uid"),
1155 $database["poll_result"] = array(
1157 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1158 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1159 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1162 "PRIMARY" => array("id"),
1163 "poll_id" => array("poll_id"),
1164 "choice" => array("choice"),
1167 $database["process"] = array(
1169 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1170 "command" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1171 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1174 "PRIMARY" => array("pid"),
1175 "command" => array("command"),
1178 $database["profile"] = array(
1180 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1181 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1182 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1183 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1184 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1185 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1186 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1187 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1188 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1189 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1190 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1191 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1192 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1193 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1194 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1195 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1196 "with" => array("type" => "text"),
1197 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1198 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1199 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1200 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1201 "pub_keywords" => array("type" => "text"),
1202 "prv_keywords" => array("type" => "text"),
1203 "likes" => array("type" => "text"),
1204 "dislikes" => array("type" => "text"),
1205 "about" => array("type" => "text"),
1206 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1207 "music" => array("type" => "text"),
1208 "book" => array("type" => "text"),
1209 "tv" => array("type" => "text"),
1210 "film" => array("type" => "text"),
1211 "interest" => array("type" => "text"),
1212 "romance" => array("type" => "text"),
1213 "work" => array("type" => "text"),
1214 "education" => array("type" => "text"),
1215 "contact" => array("type" => "text"),
1216 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1217 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1218 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1219 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1220 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1221 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1224 "PRIMARY" => array("id"),
1225 "hometown" => array("hometown"),
1228 $database["profile_check"] = array(
1230 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1231 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1232 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1233 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1234 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1235 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1238 "PRIMARY" => array("id"),
1241 $database["push_subscriber"] = array(
1243 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1244 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1245 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1246 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1247 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1248 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1249 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1250 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1253 "PRIMARY" => array("id"),
1256 $database["queue"] = array(
1258 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1259 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1260 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1261 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1262 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1263 "content" => array("type" => "mediumtext"),
1264 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1267 "PRIMARY" => array("id"),
1268 "cid" => array("cid"),
1269 "created" => array("created"),
1270 "last" => array("last"),
1271 "network" => array("network"),
1272 "batch" => array("batch"),
1275 $database["register"] = array(
1277 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1278 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1279 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1280 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1281 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1282 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1283 "note" => array("type" => "text"),
1286 "PRIMARY" => array("id"),
1289 $database["search"] = array(
1291 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1292 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1293 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1296 "PRIMARY" => array("id"),
1297 "uid" => array("uid"),
1298 "term" => array("term"),
1301 $database["session"] = array(
1303 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1304 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1305 "data" => array("type" => "text"),
1306 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1309 "PRIMARY" => array("id"),
1310 "sid" => array("sid"),
1311 "expire" => array("expire"),
1314 $database["sign"] = array(
1316 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1317 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1318 "signed_text" => array("type" => "mediumtext"),
1319 "signature" => array("type" => "text"),
1320 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1323 "PRIMARY" => array("id"),
1324 "iid" => array("iid"),
1327 $database["spam"] = array(
1329 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1330 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1331 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1332 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1333 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1334 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1337 "PRIMARY" => array("id"),
1338 "uid" => array("uid"),
1339 "spam" => array("spam"),
1340 "ham" => array("ham"),
1341 "term" => array("term"),
1344 $database["term"] = array(
1346 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1347 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1348 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1349 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1350 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1351 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1352 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1353 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1354 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1355 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1356 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1357 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1360 "PRIMARY" => array("tid"),
1361 "oid_otype_type_term" => array("oid","otype","type","term"),
1362 "uid_term_tid" => array("uid","term","tid"),
1363 "type_term" => array("type","term"),
1364 "uid_otype_type_term_global_created" => array("uid","otype","type","term","global","created"),
1365 "otype_type_term_tid" => array("otype","type","term","tid"),
1366 "uid_otype_type_url" => array("uid","otype","type","url"),
1367 "guid" => array("guid"),
1370 $database["thread"] = array(
1372 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1373 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1374 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1375 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1376 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1377 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1378 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1379 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1380 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1381 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1382 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1383 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1384 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1385 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1386 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1387 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1388 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1389 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1390 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1391 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1392 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1393 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1394 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1395 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1396 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1397 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1400 "PRIMARY" => array("iid"),
1401 "created" => array("created"),
1402 "commented" => array("commented"),
1403 "uid_network_commented" => array("uid","network","commented"),
1404 "uid_network_created" => array("uid","network","created"),
1405 "uid_contactid_commented" => array("uid","contact-id","commented"),
1406 "uid_contactid_created" => array("uid","contact-id","created"),
1407 "uid_gcontactid_commented" => array("uid","gcontact-id","commented"),
1408 "uid_gcontactid_created" => array("uid","gcontact-id","created"),
1409 "wall_private_received" => array("wall","private","received"),
1410 "uid_created" => array("uid","created"),
1411 "uid_commented" => array("uid","commented"),
1414 $database["tokens"] = array(
1416 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1417 "secret" => array("type" => "text"),
1418 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1419 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1420 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1421 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1424 "PRIMARY" => array("id"),
1427 $database["user"] = array(
1429 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1430 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1431 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1432 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1433 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1434 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1435 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1436 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1437 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1438 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1439 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1440 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1441 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1442 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1443 "pubkey" => array("type" => "text"),
1444 "prvkey" => array("type" => "text"),
1445 "spubkey" => array("type" => "text"),
1446 "sprvkey" => array("type" => "text"),
1447 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1448 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1449 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1450 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1451 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1452 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1453 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1454 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1455 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1456 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1457 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1458 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1459 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1460 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1461 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1462 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1463 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1464 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1465 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1466 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1467 "allow_cid" => array("type" => "mediumtext"),
1468 "allow_gid" => array("type" => "mediumtext"),
1469 "deny_cid" => array("type" => "mediumtext"),
1470 "deny_gid" => array("type" => "mediumtext"),
1471 "openidserver" => array("type" => "text"),
1474 "PRIMARY" => array("uid"),
1475 "nickname" => array("nickname"),
1478 $database["userd"] = array(
1480 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1481 "username" => array("type" => "varchar(255)", "not null" => "1"),
1484 "PRIMARY" => array("id"),
1485 "username" => array("username"),
1488 $database["workerqueue"] = array(
1490 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1491 "parameter" => array("type" => "text"),
1492 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1493 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1494 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1495 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1498 "PRIMARY" => array("id"),
1499 "created" => array("created"),
1508 * run from command line
1510 function dbstructure_run(&$argv, &$argc) {
1518 @include(".htconfig.php");
1519 require_once("include/dba.php");
1520 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1521 unset($db_host, $db_user, $db_pass, $db_data);
1527 update_structure(true, false);
1530 update_structure(true, true);
1532 $build = get_config('system','build');
1534 set_config('system','build',DB_UPDATE_VERSION);
1535 $build = DB_UPDATE_VERSION;
1538 $stored = intval($build);
1539 $current = intval(DB_UPDATE_VERSION);
1541 // run any left update_nnnn functions in update.php
1542 for($x = $stored; $x < $current; $x ++) {
1543 $r = run_update_function($x);
1547 set_config('system','build',DB_UPDATE_VERSION);
1550 // For the dump that is used to create the database.sql we always assume utfmb4
1551 $charset = "utf8mb4";
1552 print_structure(db_definition($charset), $charset);
1559 echo $argv[0]." <command>\n";
1562 echo "dryrun show database update schema queries without running them\n";
1563 echo "update update database schema\n";
1564 echo "dumpsql dump database schema\n";
1572 if (array_search(__file__,get_included_files())===0){
1573 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);