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"),
448 $database["challenge"] = array(
450 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
451 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
452 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
453 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
454 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
455 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
458 "PRIMARY" => array("id"),
461 $database["clients"] = array(
463 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
464 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
465 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
466 "name" => array("type" => "text"),
467 "icon" => array("type" => "text"),
468 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
471 "PRIMARY" => array("client_id"),
474 $database["config"] = array(
476 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
477 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
478 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
479 "v" => array("type" => "text"),
482 "PRIMARY" => array("id"),
483 "cat_k" => array("UNIQUE", "cat(30)","k(30)"),
486 $database["contact"] = array(
488 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
489 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
490 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
491 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
492 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
493 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
494 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
495 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
496 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
497 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
498 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
499 "about" => array("type" => "text"),
500 "keywords" => array("type" => "text"),
501 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
502 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
503 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
504 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
505 "photo" => array("type" => "text"),
506 "thumb" => array("type" => "text"),
507 "micro" => array("type" => "text"),
508 "site-pubkey" => array("type" => "text"),
509 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
510 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
511 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
512 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
513 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
514 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
515 "pubkey" => array("type" => "text"),
516 "prvkey" => array("type" => "text"),
517 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
518 "request" => array("type" => "text"),
519 "notify" => array("type" => "text"),
520 "poll" => array("type" => "text"),
521 "confirm" => array("type" => "text"),
522 "poco" => array("type" => "text"),
523 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
524 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
525 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
526 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
527 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
528 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
529 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
530 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
531 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
532 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
533 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
534 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
535 "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
536 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
537 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
538 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
539 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
540 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
541 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
542 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
543 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
544 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
545 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
546 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
547 "reason" => array("type" => "text"),
548 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
549 "info" => array("type" => "mediumtext"),
550 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
551 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
552 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
553 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
554 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
555 "ffi_keyword_blacklist" => array("type" => "mediumtext"),
558 "PRIMARY" => array("id"),
559 "uid" => array("uid"),
560 "nurl" => array("nurl"),
563 $database["conv"] = array(
565 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
566 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
567 "recips" => array("type" => "mediumtext"),
568 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
569 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
570 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
571 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
572 "subject" => array("type" => "mediumtext"),
575 "PRIMARY" => array("id"),
576 "uid" => array("uid"),
579 $database["deliverq"] = array(
581 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
582 "cmd" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
583 "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
584 "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
587 "PRIMARY" => array("id"),
590 $database["event"] = array(
592 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
593 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
594 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
595 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
596 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
597 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
598 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
599 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
600 "summary" => array("type" => "text"),
601 "desc" => array("type" => "text"),
602 "location" => array("type" => "text"),
603 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
604 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
605 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
606 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
607 "allow_cid" => array("type" => "mediumtext"),
608 "allow_gid" => array("type" => "mediumtext"),
609 "deny_cid" => array("type" => "mediumtext"),
610 "deny_gid" => array("type" => "mediumtext"),
613 "PRIMARY" => array("id"),
614 "uid" => array("uid"),
617 $database["fcontact"] = array(
619 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
620 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
621 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
622 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
623 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
624 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
625 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
626 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
627 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
628 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
629 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
630 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
631 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
632 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
633 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
634 "pubkey" => array("type" => "text"),
635 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
638 "PRIMARY" => array("id"),
639 "addr" => array("addr"),
642 $database["ffinder"] = array(
644 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
645 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
646 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
647 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
650 "PRIMARY" => array("id"),
653 $database["fserver"] = array(
655 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
656 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
657 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
658 "key" => array("type" => "text"),
661 "PRIMARY" => array("id"),
662 "server" => array("server"),
665 $database["fsuggest"] = array(
667 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
668 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
669 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
670 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
671 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
672 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
673 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
674 "note" => array("type" => "text"),
675 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
678 "PRIMARY" => array("id"),
681 $database["gcign"] = array(
683 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
684 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
685 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
688 "PRIMARY" => array("id"),
689 "uid" => array("uid"),
690 "gcid" => array("gcid"),
693 $database["gcontact"] = array(
695 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
696 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
697 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
698 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
699 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
700 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
701 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
702 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
703 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
704 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
705 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
706 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
707 "about" => array("type" => "text"),
708 "keywords" => array("type" => "text"),
709 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
710 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
711 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
712 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
713 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
714 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
715 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
716 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
717 "notify" => array("type" => "text"),
718 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
719 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
720 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
723 "PRIMARY" => array("id"),
724 "nurl" => array("nurl"),
725 "name" => array("name"),
726 "nick" => array("nick"),
727 "addr" => array("addr"),
728 "updated" => array("updated"),
731 $database["glink"] = array(
733 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
734 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
735 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
736 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
737 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
738 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
741 "PRIMARY" => array("id"),
742 "cid_uid_gcid_zcid" => array("cid","uid","gcid","zcid"),
743 "gcid" => array("gcid"),
744 "zcid" => array("zcid"),
747 $database["group"] = array(
749 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
750 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
751 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
752 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
753 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
756 "PRIMARY" => array("id"),
757 "uid" => array("uid"),
760 $database["group_member"] = array(
762 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
763 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
764 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
765 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
768 "PRIMARY" => array("id"),
769 "uid_gid_contactid" => array("uid","gid","contact-id"),
772 $database["gserver"] = array(
774 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
775 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
776 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
777 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
778 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
779 "info" => array("type" => "text"),
780 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
781 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
782 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
783 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
784 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
785 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
786 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
787 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
788 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
791 "PRIMARY" => array("id"),
792 "nurl" => array("nurl"),
795 $database["hook"] = array(
797 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
798 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
799 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
800 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
801 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
804 "PRIMARY" => array("id"),
805 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
808 $database["intro"] = array(
810 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
811 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
812 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
813 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
814 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
815 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
816 "note" => array("type" => "text"),
817 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
818 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
819 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
820 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
823 "PRIMARY" => array("id"),
826 $database["item"] = array(
828 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
829 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
830 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
831 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
832 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
833 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
834 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
835 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
836 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
837 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
838 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
839 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
840 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
841 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
842 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
843 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
844 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
845 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
846 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
847 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
848 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
849 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
850 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
851 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
852 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
853 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
854 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
855 "body" => array("type" => "mediumtext"),
856 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
857 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
858 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
859 "object" => array("type" => "text"),
860 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
861 "target" => array("type" => "text"),
862 "postopts" => array("type" => "text"),
863 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
864 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
865 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
866 "tag" => array("type" => "mediumtext"),
867 "attach" => array("type" => "mediumtext"),
868 "inform" => array("type" => "mediumtext"),
869 "file" => array("type" => "mediumtext"),
870 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
871 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
872 "allow_cid" => array("type" => "mediumtext"),
873 "allow_gid" => array("type" => "mediumtext"),
874 "deny_cid" => array("type" => "mediumtext"),
875 "deny_gid" => array("type" => "mediumtext"),
876 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
877 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
878 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
879 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
880 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
881 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
882 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
883 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
884 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
885 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
886 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
887 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
888 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
889 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
890 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
891 "rendered-html" => array("type" => "mediumtext"),
892 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
895 "PRIMARY" => array("id"),
896 "guid" => array("guid"),
897 "uri" => array("uri"),
898 "parent" => array("parent"),
899 "parent-uri" => array("parent-uri"),
900 "extid" => array("extid"),
901 "uid_id" => array("uid","id"),
902 "uid_created" => array("uid","created"),
903 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
904 "uid_network_received" => array("uid","network","received"),
905 "uid_received" => array("uid","received"),
906 "uid_network_commented" => array("uid","network","commented"),
907 "uid_commented" => array("uid","commented"),
908 "uid_title" => array("uid","title"),
909 "uid_thrparent" => array("uid","thr-parent"),
910 "uid_parenturi" => array("uid","parent-uri"),
911 "uid_contactid_id" => array("uid","contact-id","id"),
912 "uid_contactid_created" => array("uid","contact-id","created"),
913 "gcontactid_uid_created" => array("gcontact-id","uid","created"),
914 "authorid_created" => array("author-id","created"),
915 "ownerid_created" => array("owner-id","created"),
916 "wall_body" => array("wall","body(6)"),
917 "uid_visible_moderated_created" => array("uid","visible","moderated","created"),
918 "uid_uri" => array("uid","uri"),
919 "uid_wall_created" => array("uid","wall","created"),
920 "resource-id" => array("resource-id"),
921 "uid_type" => array("uid","type"),
922 "uid_starred_id" => array("uid","starred", "id"),
923 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
924 "uid_wall_parent_created" => array("uid","wall","parent","created"),
925 "uid_type_changed" => array("uid","type","changed"),
926 "contactid_verb" => array("contact-id","verb"),
927 "deleted_changed" => array("deleted","changed"),
928 "uid_wall_changed" => array("uid","wall","changed"),
929 "uid_eventid" => array("uid","event-id"),
930 "uid_authorlink" => array("uid","author-link"),
931 "uid_ownerlink" => array("uid","owner-link"),
934 $database["item_id"] = array(
936 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
937 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
938 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
939 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
940 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
943 "PRIMARY" => array("id"),
944 "uid" => array("uid"),
945 "sid" => array("sid"),
946 "service" => array("service"),
947 "iid" => array("iid"),
950 $database["locks"] = array(
952 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
953 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
954 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
955 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
958 "PRIMARY" => array("id"),
961 $database["mail"] = array(
963 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
964 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
965 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
966 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
967 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
968 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
969 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
970 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
971 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
972 "body" => array("type" => "mediumtext"),
973 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
974 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
975 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
976 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
977 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
978 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
979 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
982 "PRIMARY" => array("id"),
983 "uid" => array("uid"),
984 "guid" => array("guid"),
985 "convid" => array("convid"),
986 "reply" => array("reply"),
987 "uri" => array("uri"),
988 "parent-uri" => array("parent-uri"),
991 $database["mailacct"] = array(
993 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
994 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
995 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
996 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
997 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
998 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
999 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1000 "pass" => array("type" => "text"),
1001 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1002 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1003 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1004 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1005 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1008 "PRIMARY" => array("id"),
1011 $database["manage"] = array(
1013 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1014 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1015 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1018 "PRIMARY" => array("id"),
1019 "uid_mid" => array("uid","mid"),
1022 $database["notify"] = array(
1024 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1025 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1026 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1027 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1028 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1029 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1030 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1031 "msg" => array("type" => "mediumtext"),
1032 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1033 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1034 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1035 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1036 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1037 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1038 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1041 "PRIMARY" => array("id"),
1042 "uid" => array("uid"),
1045 $database["notify-threads"] = array(
1047 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1048 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1049 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1050 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1051 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1054 "PRIMARY" => array("id"),
1055 "master-parent-item" => array("master-parent-item"),
1056 "receiver-uid" => array("receiver-uid"),
1059 $database["oembed"] = array(
1061 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1062 "content" => array("type" => "text"),
1063 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1066 "PRIMARY" => array("url".db_index_suffix($charset)),
1067 "created" => array("created"),
1070 $database["parsed_url"] = array(
1072 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1073 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1074 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1075 "content" => array("type" => "text"),
1076 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1079 "PRIMARY" => array("url".db_index_suffix($charset), "guessing", "oembed"),
1080 "created" => array("created"),
1083 $database["pconfig"] = array(
1085 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1086 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1087 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1088 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1089 "v" => array("type" => "mediumtext"),
1092 "PRIMARY" => array("id"),
1093 "uid_cat_k" => array("UNIQUE", "uid","cat(30)","k(30)"),
1096 $database["photo"] = array(
1098 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1099 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1100 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1101 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1102 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1103 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1104 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1105 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1106 "desc" => array("type" => "text"),
1107 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1108 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1109 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1110 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1111 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1112 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1113 "data" => array("type" => "mediumblob", "not null" => "1"),
1114 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1115 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1116 "allow_cid" => array("type" => "mediumtext"),
1117 "allow_gid" => array("type" => "mediumtext"),
1118 "deny_cid" => array("type" => "mediumtext"),
1119 "deny_gid" => array("type" => "mediumtext"),
1122 "PRIMARY" => array("id"),
1123 "uid" => array("uid"),
1124 "resource-id" => array("resource-id"),
1125 "guid" => array("guid"),
1128 $database["poll"] = array(
1130 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1131 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1132 "q0" => array("type" => "mediumtext"),
1133 "q1" => array("type" => "mediumtext"),
1134 "q2" => array("type" => "mediumtext"),
1135 "q3" => array("type" => "mediumtext"),
1136 "q4" => array("type" => "mediumtext"),
1137 "q5" => array("type" => "mediumtext"),
1138 "q6" => array("type" => "mediumtext"),
1139 "q7" => array("type" => "mediumtext"),
1140 "q8" => array("type" => "mediumtext"),
1141 "q9" => array("type" => "mediumtext"),
1144 "PRIMARY" => array("id"),
1145 "uid" => array("uid"),
1148 $database["poll_result"] = array(
1150 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1151 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1152 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1155 "PRIMARY" => array("id"),
1156 "poll_id" => array("poll_id"),
1157 "choice" => array("choice"),
1160 $database["process"] = array(
1162 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1163 "command" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1164 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1167 "PRIMARY" => array("pid"),
1168 "command" => array("command"),
1171 $database["profile"] = array(
1173 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1174 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1175 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1176 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1177 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1178 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1179 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1180 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1181 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1182 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1183 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1184 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1185 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1186 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1187 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1188 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1189 "with" => array("type" => "text"),
1190 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1191 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1192 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1193 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1194 "pub_keywords" => array("type" => "text"),
1195 "prv_keywords" => array("type" => "text"),
1196 "likes" => array("type" => "text"),
1197 "dislikes" => array("type" => "text"),
1198 "about" => array("type" => "text"),
1199 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1200 "music" => array("type" => "text"),
1201 "book" => array("type" => "text"),
1202 "tv" => array("type" => "text"),
1203 "film" => array("type" => "text"),
1204 "interest" => array("type" => "text"),
1205 "romance" => array("type" => "text"),
1206 "work" => array("type" => "text"),
1207 "education" => array("type" => "text"),
1208 "contact" => array("type" => "text"),
1209 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1210 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1211 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1212 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1213 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1214 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1217 "PRIMARY" => array("id"),
1218 "hometown" => array("hometown"),
1221 $database["profile_check"] = array(
1223 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1224 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1225 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1226 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1227 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1228 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1231 "PRIMARY" => array("id"),
1234 $database["push_subscriber"] = array(
1236 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1237 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1238 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1239 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1240 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1241 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1242 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1243 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1246 "PRIMARY" => array("id"),
1249 $database["queue"] = array(
1251 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1252 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1253 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1254 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1255 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1256 "content" => array("type" => "mediumtext"),
1257 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1260 "PRIMARY" => array("id"),
1261 "cid" => array("cid"),
1262 "created" => array("created"),
1263 "last" => array("last"),
1264 "network" => array("network"),
1265 "batch" => array("batch"),
1268 $database["register"] = array(
1270 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1271 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1272 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1273 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1274 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1275 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1278 "PRIMARY" => array("id"),
1281 $database["search"] = array(
1283 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1284 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1285 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1288 "PRIMARY" => array("id"),
1289 "uid" => array("uid"),
1290 "term" => array("term"),
1293 $database["session"] = array(
1295 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1296 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1297 "data" => array("type" => "text"),
1298 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1301 "PRIMARY" => array("id"),
1302 "sid" => array("sid"),
1303 "expire" => array("expire"),
1306 $database["sign"] = array(
1308 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1309 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1310 "signed_text" => array("type" => "mediumtext"),
1311 "signature" => array("type" => "text"),
1312 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1315 "PRIMARY" => array("id"),
1316 "iid" => array("iid"),
1319 $database["spam"] = array(
1321 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1322 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1323 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1324 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1325 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1326 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1329 "PRIMARY" => array("id"),
1330 "uid" => array("uid"),
1331 "spam" => array("spam"),
1332 "ham" => array("ham"),
1333 "term" => array("term"),
1336 $database["term"] = array(
1338 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1339 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1340 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1341 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1342 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1343 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1344 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1345 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1346 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1347 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1348 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1349 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1352 "PRIMARY" => array("tid"),
1353 "oid_otype_type_term" => array("oid","otype","type","term"),
1354 "uid_term_tid" => array("uid","term","tid"),
1355 "type_term" => array("type","term"),
1356 "uid_otype_type_term_global_created" => array("uid","otype","type","term","global","created"),
1357 "otype_type_term_tid" => array("otype","type","term","tid"),
1358 "guid" => array("guid"),
1361 $database["thread"] = array(
1363 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1364 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1365 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1366 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1367 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1368 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1369 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1370 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1371 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1372 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1373 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1374 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1375 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1376 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1377 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1378 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1379 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1380 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1381 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1382 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1383 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1384 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1385 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1386 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1387 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1388 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1391 "PRIMARY" => array("iid"),
1392 "created" => array("created"),
1393 "commented" => array("commented"),
1394 "uid_network_commented" => array("uid","network","commented"),
1395 "uid_network_created" => array("uid","network","created"),
1396 "uid_contactid_commented" => array("uid","contact-id","commented"),
1397 "uid_contactid_created" => array("uid","contact-id","created"),
1398 "uid_gcontactid_commented" => array("uid","gcontact-id","commented"),
1399 "uid_gcontactid_created" => array("uid","gcontact-id","created"),
1400 "wall_private_received" => array("wall","private","received"),
1401 "uid_created" => array("uid","created"),
1402 "uid_commented" => array("uid","commented"),
1405 $database["tokens"] = array(
1407 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1408 "secret" => array("type" => "text"),
1409 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1410 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1411 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1412 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1415 "PRIMARY" => array("id"),
1418 $database["user"] = array(
1420 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1421 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1422 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1423 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1424 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1425 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1426 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1427 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1428 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1429 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1430 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1431 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1432 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1433 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1434 "pubkey" => array("type" => "text"),
1435 "prvkey" => array("type" => "text"),
1436 "spubkey" => array("type" => "text"),
1437 "sprvkey" => array("type" => "text"),
1438 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1439 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1440 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1441 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1442 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1443 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1444 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1445 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1446 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1447 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1448 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1449 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1450 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1451 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1452 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1453 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1454 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1455 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1456 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1457 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1458 "allow_cid" => array("type" => "mediumtext"),
1459 "allow_gid" => array("type" => "mediumtext"),
1460 "deny_cid" => array("type" => "mediumtext"),
1461 "deny_gid" => array("type" => "mediumtext"),
1462 "openidserver" => array("type" => "text"),
1465 "PRIMARY" => array("uid"),
1466 "nickname" => array("nickname"),
1469 $database["userd"] = array(
1471 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1472 "username" => array("type" => "varchar(255)", "not null" => "1"),
1475 "PRIMARY" => array("id"),
1476 "username" => array("username"),
1479 $database["workerqueue"] = array(
1481 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1482 "parameter" => array("type" => "text"),
1483 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1484 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1485 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1486 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1489 "PRIMARY" => array("id"),
1490 "created" => array("created"),
1499 * run from command line
1501 function dbstructure_run(&$argv, &$argc) {
1509 @include(".htconfig.php");
1510 require_once("include/dba.php");
1511 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1512 unset($db_host, $db_user, $db_pass, $db_data);
1518 update_structure(true, false);
1521 update_structure(true, true);
1523 $build = get_config('system','build');
1525 set_config('system','build',DB_UPDATE_VERSION);
1526 $build = DB_UPDATE_VERSION;
1529 $stored = intval($build);
1530 $current = intval(DB_UPDATE_VERSION);
1532 // run any left update_nnnn functions in update.php
1533 for($x = $stored; $x < $current; $x ++) {
1534 $r = run_update_function($x);
1538 set_config('system','build',DB_UPDATE_VERSION);
1541 // For the dump that is used to create the database.sql we always assume utfmb4
1542 $charset = "utf8mb4";
1543 print_structure(db_definition($charset), $charset);
1550 echo $argv[0]." <command>\n";
1553 echo "dryrun show database update schema queries without running them\n";
1554 echo "update update database schema\n";
1555 echo "dumpsql dump database schema\n";
1563 if (array_search(__file__,get_included_files())===0){
1564 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);