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 doesn't support the IGNORE keyword in ALTER TABLE statements
169 if (version_compare($db->getdb()->server_info, '5.7') >= 0) {
176 foreach ($definition AS $name => $structure) {
177 $is_new_table = False;
179 if (!isset($database[$name])) {
180 $r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']);
182 $errors .= t('Errors encountered creating database tables.').$name.EOL;
184 $is_new_table = True;
186 // Drop the index if it isn't present in the definition
187 // or the definition differ from current status
188 // and index name doesn't start with "local_"
189 foreach ($database[$name]["indexes"] AS $indexname => $fieldnames) {
190 $current_index_definition = implode(",",$fieldnames);
191 if (isset($structure["indexes"][$indexname])) {
192 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
194 $new_index_definition = "__NOT_SET__";
196 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
197 $sql2=db_drop_index($indexname);
199 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
204 // Compare the field structure field by field
205 foreach ($structure["fields"] AS $fieldname => $parameters) {
206 if (!isset($database[$name]["fields"][$fieldname])) {
207 $sql2=db_add_table_field($fieldname, $parameters);
209 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
213 // Compare the field definition
214 $current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
215 $new_field_definition = implode(",",$parameters);
216 if ($current_field_definition != $new_field_definition) {
217 $sql2=db_modify_table_field($fieldname, $parameters);
219 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
228 // Create the index if the index don't exists in database
229 // or the definition differ from the current status.
230 // Don't create keys if table is new
231 if (!$is_new_table) {
232 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
233 if (isset($database[$name]["indexes"][$indexname])) {
234 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
236 $current_index_definition = "__NOT_SET__";
238 $new_index_definition = implode(",",$fieldnames);
239 if ($current_index_definition != $new_index_definition) {
240 $sql2=db_create_index($indexname, $fieldnames);
243 $sql3 = "ALTER" . $ignore . " TABLE `".$name."` ".$sql2;
259 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
265 set_config('system', 'maintenance', 0);
270 function db_field_command($parameters, $create = true) {
271 $fieldstruct = $parameters["type"];
273 if ($parameters["not null"])
274 $fieldstruct .= " NOT NULL";
276 if (isset($parameters["default"])){
277 if (strpos(strtolower($parameters["type"]),"int")!==false) {
278 $fieldstruct .= " DEFAULT ".$parameters["default"];
280 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
283 if ($parameters["extra"] != "")
284 $fieldstruct .= " ".$parameters["extra"];
286 /*if (($parameters["primary"] != "") AND $create)
287 $fieldstruct .= " PRIMARY KEY";*/
289 return($fieldstruct);
292 function db_create_table($name, $fields, $charset, $verbose, $action, $indexes=null) {
300 $primary_keys = array();
301 foreach($fields AS $fieldname => $field) {
302 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
303 if (x($field,'primary') and $field['primary']!=''){
304 $primary_keys[] = $fieldname;
308 if (!is_null($indexes)) {
309 foreach ($indexes AS $indexname => $fieldnames) {
310 $sql_index = db_create_index($indexname, $fieldnames, "");
311 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
315 $sql = implode(",\n\t", $sql_rows);
317 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=".$charset;
327 function db_add_table_field($fieldname, $parameters) {
328 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
332 function db_modify_table_field($fieldname, $parameters) {
333 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
337 function db_drop_index($indexname) {
338 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
342 function db_create_index($indexname, $fieldnames, $method="ADD") {
344 $method = strtoupper(trim($method));
345 if ($method!="" && $method!="ADD") {
346 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
350 if ($fieldnames[0] == "UNIQUE") {
351 array_shift($fieldnames);
352 $method .= ' UNIQUE';
356 foreach ($fieldnames AS $fieldname) {
360 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches))
361 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
363 $names .= "`".dbesc($fieldname)."`";
366 if ($indexname == "PRIMARY") {
367 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
371 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
375 function db_index_suffix($charset, $reduce = 0) {
376 if ($charset != "utf8mb4")
379 // On utf8mb4 indexes can only have a length of 191
380 $indexlength = 191 - $reduce;
382 return "(".$indexlength.")";
385 function db_definition($charset) {
389 $database["addon"] = array(
391 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
392 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
393 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
394 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
395 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
396 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
397 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
400 "PRIMARY" => array("id"),
403 $database["attach"] = array(
405 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
406 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
407 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
408 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
409 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
410 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
411 "data" => array("type" => "longblob", "not null" => "1"),
412 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
413 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
414 "allow_cid" => array("type" => "mediumtext"),
415 "allow_gid" => array("type" => "mediumtext"),
416 "deny_cid" => array("type" => "mediumtext"),
417 "deny_gid" => array("type" => "mediumtext"),
420 "PRIMARY" => array("id"),
423 $database["auth_codes"] = array(
425 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
426 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
427 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
428 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
429 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
432 "PRIMARY" => array("id"),
435 $database["cache"] = array(
437 "k" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
438 "v" => array("type" => "text"),
439 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
440 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
443 "PRIMARY" => array("k".db_index_suffix($charset)),
444 "updated" => array("updated"),
447 $database["challenge"] = array(
449 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
450 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
451 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
452 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
453 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
454 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
457 "PRIMARY" => array("id"),
460 $database["clients"] = array(
462 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
463 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
464 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
465 "name" => array("type" => "text"),
466 "icon" => array("type" => "text"),
467 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
470 "PRIMARY" => array("client_id"),
473 $database["config"] = array(
475 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
476 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
477 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
478 "v" => array("type" => "text"),
481 "PRIMARY" => array("id"),
482 "cat_k" => array("UNIQUE", "cat(30)","k(30)"),
485 $database["contact"] = array(
487 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
488 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
489 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
490 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
491 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
492 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
493 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
494 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
495 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
496 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
497 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
498 "about" => array("type" => "text"),
499 "keywords" => array("type" => "text"),
500 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
501 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
502 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
503 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
504 "photo" => array("type" => "text"),
505 "thumb" => array("type" => "text"),
506 "micro" => array("type" => "text"),
507 "site-pubkey" => array("type" => "text"),
508 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
509 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
510 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
511 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
512 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
513 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
514 "pubkey" => array("type" => "text"),
515 "prvkey" => array("type" => "text"),
516 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
517 "request" => array("type" => "text"),
518 "notify" => array("type" => "text"),
519 "poll" => array("type" => "text"),
520 "confirm" => array("type" => "text"),
521 "poco" => array("type" => "text"),
522 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
523 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
524 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
525 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
526 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
527 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
528 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
529 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
530 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
531 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
532 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
533 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
534 "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
535 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
536 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
537 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
538 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
539 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
540 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
541 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
542 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
543 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
544 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
545 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
546 "reason" => array("type" => "text"),
547 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
548 "info" => array("type" => "mediumtext"),
549 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
550 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
551 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
552 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
553 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
554 "ffi_keyword_blacklist" => array("type" => "mediumtext"),
557 "PRIMARY" => array("id"),
558 "uid" => array("uid"),
559 "nurl" => array("nurl"),
562 $database["conv"] = array(
564 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
565 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
566 "recips" => array("type" => "mediumtext"),
567 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
568 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
569 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
570 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
571 "subject" => array("type" => "mediumtext"),
574 "PRIMARY" => array("id"),
575 "uid" => array("uid"),
578 $database["deliverq"] = array(
580 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
581 "cmd" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
582 "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
583 "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
586 "PRIMARY" => array("id"),
589 $database["event"] = array(
591 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
592 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
593 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
594 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
595 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
596 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
597 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
598 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
599 "summary" => array("type" => "text"),
600 "desc" => array("type" => "text"),
601 "location" => array("type" => "text"),
602 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
603 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
604 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
605 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
606 "allow_cid" => array("type" => "mediumtext"),
607 "allow_gid" => array("type" => "mediumtext"),
608 "deny_cid" => array("type" => "mediumtext"),
609 "deny_gid" => array("type" => "mediumtext"),
612 "PRIMARY" => array("id"),
613 "uid" => array("uid"),
616 $database["fcontact"] = array(
618 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
619 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
620 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
621 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
622 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
623 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
624 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
625 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
626 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
627 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
628 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
629 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
630 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
631 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
632 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
633 "pubkey" => array("type" => "text"),
634 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
637 "PRIMARY" => array("id"),
638 "addr" => array("addr"),
641 $database["ffinder"] = array(
643 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
644 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
645 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
646 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
649 "PRIMARY" => array("id"),
652 $database["fserver"] = array(
654 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
655 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
656 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
657 "key" => array("type" => "text"),
660 "PRIMARY" => array("id"),
661 "server" => array("server"),
664 $database["fsuggest"] = array(
666 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
667 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
668 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
669 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
670 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
671 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
672 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
673 "note" => array("type" => "text"),
674 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
677 "PRIMARY" => array("id"),
680 $database["gcign"] = array(
682 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
683 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
684 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
687 "PRIMARY" => array("id"),
688 "uid" => array("uid"),
689 "gcid" => array("gcid"),
692 $database["gcontact"] = array(
694 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
695 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
696 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
697 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
698 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
699 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
700 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
701 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
702 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
703 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
704 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
705 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
706 "about" => array("type" => "text"),
707 "keywords" => array("type" => "text"),
708 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
709 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
710 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
711 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
712 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
713 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
714 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
715 "notify" => array("type" => "text"),
716 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
717 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
718 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
721 "PRIMARY" => array("id"),
722 "nurl" => array("nurl"),
723 "name" => array("name"),
724 "nick" => array("nick"),
725 "addr" => array("addr"),
726 "updated" => array("updated"),
729 $database["glink"] = array(
731 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
732 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
733 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
734 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
735 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
736 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
739 "PRIMARY" => array("id"),
740 "cid_uid_gcid_zcid" => array("cid","uid","gcid","zcid"),
741 "gcid" => array("gcid"),
742 "zcid" => array("zcid"),
745 $database["group"] = array(
747 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
748 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
749 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
750 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
751 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
754 "PRIMARY" => array("id"),
755 "uid" => array("uid"),
758 $database["group_member"] = array(
760 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
761 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
762 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
763 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
766 "PRIMARY" => array("id"),
767 "uid_gid_contactid" => array("uid","gid","contact-id"),
770 $database["gserver"] = array(
772 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
773 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
774 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
775 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
776 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
777 "info" => array("type" => "text"),
778 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
779 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
780 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
781 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
782 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
783 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
784 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
785 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
786 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
789 "PRIMARY" => array("id"),
790 "nurl" => array("nurl"),
793 $database["hook"] = array(
795 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
796 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
797 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
798 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
799 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
802 "PRIMARY" => array("id"),
803 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
806 $database["intro"] = array(
808 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
809 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
810 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
811 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
812 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
813 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
814 "note" => array("type" => "text"),
815 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
816 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
817 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
818 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
821 "PRIMARY" => array("id"),
824 $database["item"] = array(
826 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
827 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
828 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
829 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
830 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
831 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
832 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
833 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
834 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
835 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
836 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
837 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
838 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
839 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
840 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
841 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
842 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
843 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
844 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
845 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
846 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
847 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
848 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
849 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
850 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
851 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
852 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
853 "body" => array("type" => "mediumtext"),
854 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
855 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
856 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
857 "object" => array("type" => "text"),
858 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
859 "target" => array("type" => "text"),
860 "postopts" => array("type" => "text"),
861 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
862 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
863 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
864 "tag" => array("type" => "mediumtext"),
865 "attach" => array("type" => "mediumtext"),
866 "inform" => array("type" => "mediumtext"),
867 "file" => array("type" => "mediumtext"),
868 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
869 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
870 "allow_cid" => array("type" => "mediumtext"),
871 "allow_gid" => array("type" => "mediumtext"),
872 "deny_cid" => array("type" => "mediumtext"),
873 "deny_gid" => array("type" => "mediumtext"),
874 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
875 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
876 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
877 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
878 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
879 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
880 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
881 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
882 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
883 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
884 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
885 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
886 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
887 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
888 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
889 "rendered-html" => array("type" => "mediumtext"),
890 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
893 "PRIMARY" => array("id"),
894 "guid" => array("guid"),
895 "uri" => array("uri"),
896 "parent" => array("parent"),
897 "parent-uri" => array("parent-uri"),
898 "extid" => array("extid"),
899 "uid_id" => array("uid","id"),
900 "uid_created" => array("uid","created"),
901 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
902 "uid_network_received" => array("uid","network","received"),
903 "uid_received" => array("uid","received"),
904 "uid_network_commented" => array("uid","network","commented"),
905 "uid_commented" => array("uid","commented"),
906 "uid_title" => array("uid","title"),
907 "uid_thrparent" => array("uid","thr-parent"),
908 "uid_parenturi" => array("uid","parent-uri"),
909 "uid_contactid_id" => array("uid","contact-id","id"),
910 "uid_contactid_created" => array("uid","contact-id","created"),
911 "gcontactid_uid_created" => array("gcontact-id","uid","created"),
912 "authorid_created" => array("author-id","created"),
913 "ownerid_created" => array("owner-id","created"),
914 "wall_body" => array("wall","body(6)"),
915 "uid_visible_moderated_created" => array("uid","visible","moderated","created"),
916 "uid_uri" => array("uid","uri"),
917 "uid_wall_created" => array("uid","wall","created"),
918 "resource-id" => array("resource-id"),
919 "uid_type" => array("uid","type"),
920 "uid_starred_id" => array("uid","starred", "id"),
921 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
922 "uid_wall_parent_created" => array("uid","wall","parent","created"),
923 "uid_type_changed" => array("uid","type","changed"),
924 "contactid_verb" => array("contact-id","verb"),
925 "deleted_changed" => array("deleted","changed"),
926 "uid_wall_changed" => array("uid","wall","changed"),
927 "uid_eventid" => array("uid","event-id"),
928 "uid_authorlink" => array("uid","author-link"),
929 "uid_ownerlink" => array("uid","owner-link"),
932 $database["item_id"] = array(
934 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
935 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
936 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
937 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
938 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
941 "PRIMARY" => array("id"),
942 "uid" => array("uid"),
943 "sid" => array("sid"),
944 "service" => array("service"),
945 "iid" => array("iid"),
948 $database["locks"] = array(
950 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
951 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
952 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
953 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
956 "PRIMARY" => array("id"),
959 $database["mail"] = array(
961 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
962 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
963 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
964 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
965 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
966 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
967 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
968 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
969 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
970 "body" => array("type" => "mediumtext"),
971 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
972 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
973 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
974 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
975 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
976 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
977 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
980 "PRIMARY" => array("id"),
981 "uid" => array("uid"),
982 "guid" => array("guid"),
983 "convid" => array("convid"),
984 "reply" => array("reply"),
985 "uri" => array("uri"),
986 "parent-uri" => array("parent-uri"),
989 $database["mailacct"] = array(
991 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
992 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
993 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
994 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
995 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
996 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
997 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
998 "pass" => array("type" => "text"),
999 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1000 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1001 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1002 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1003 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1006 "PRIMARY" => array("id"),
1009 $database["manage"] = array(
1011 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1012 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1013 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1016 "PRIMARY" => array("id"),
1017 "uid_mid" => array("uid","mid"),
1020 $database["notify"] = array(
1022 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1023 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1024 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1025 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1026 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1027 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1028 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1029 "msg" => array("type" => "mediumtext"),
1030 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1031 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1032 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1033 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1034 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1035 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1036 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1039 "PRIMARY" => array("id"),
1040 "uid" => array("uid"),
1043 $database["notify-threads"] = array(
1045 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1046 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1047 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1048 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1049 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1052 "PRIMARY" => array("id"),
1053 "master-parent-item" => array("master-parent-item"),
1054 "receiver-uid" => array("receiver-uid"),
1057 $database["oembed"] = array(
1059 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1060 "content" => array("type" => "text"),
1061 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1064 "PRIMARY" => array("url".db_index_suffix($charset)),
1065 "created" => array("created"),
1068 $database["parsed_url"] = array(
1070 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1071 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1072 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1073 "content" => array("type" => "text"),
1074 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1077 "PRIMARY" => array("url".db_index_suffix($charset), "guessing", "oembed"),
1078 "created" => array("created"),
1081 $database["pconfig"] = array(
1083 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1084 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1085 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1086 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1087 "v" => array("type" => "mediumtext"),
1090 "PRIMARY" => array("id"),
1091 "uid_cat_k" => array("UNIQUE", "uid","cat(30)","k(30)"),
1094 $database["photo"] = array(
1096 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1097 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1098 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1099 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1100 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1101 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1102 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1103 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1104 "desc" => array("type" => "text"),
1105 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1106 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1107 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1108 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1109 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1110 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1111 "data" => array("type" => "mediumblob", "not null" => "1"),
1112 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1113 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1114 "allow_cid" => array("type" => "mediumtext"),
1115 "allow_gid" => array("type" => "mediumtext"),
1116 "deny_cid" => array("type" => "mediumtext"),
1117 "deny_gid" => array("type" => "mediumtext"),
1120 "PRIMARY" => array("id"),
1121 "uid" => array("uid"),
1122 "resource-id" => array("resource-id"),
1123 "guid" => array("guid"),
1126 $database["poll"] = array(
1128 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1129 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1130 "q0" => array("type" => "mediumtext"),
1131 "q1" => array("type" => "mediumtext"),
1132 "q2" => array("type" => "mediumtext"),
1133 "q3" => array("type" => "mediumtext"),
1134 "q4" => array("type" => "mediumtext"),
1135 "q5" => array("type" => "mediumtext"),
1136 "q6" => array("type" => "mediumtext"),
1137 "q7" => array("type" => "mediumtext"),
1138 "q8" => array("type" => "mediumtext"),
1139 "q9" => array("type" => "mediumtext"),
1142 "PRIMARY" => array("id"),
1143 "uid" => array("uid"),
1146 $database["poll_result"] = array(
1148 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1149 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1150 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1153 "PRIMARY" => array("id"),
1154 "poll_id" => array("poll_id"),
1155 "choice" => array("choice"),
1158 $database["process"] = array(
1160 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1161 "command" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1162 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1165 "PRIMARY" => array("pid"),
1166 "command" => array("command"),
1169 $database["profile"] = array(
1171 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1172 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1173 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1174 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1175 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1176 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1177 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1178 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1179 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1180 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1181 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1182 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1183 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1184 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1185 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1186 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1187 "with" => array("type" => "text"),
1188 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1189 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1190 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1191 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1192 "pub_keywords" => array("type" => "text"),
1193 "prv_keywords" => array("type" => "text"),
1194 "likes" => array("type" => "text"),
1195 "dislikes" => array("type" => "text"),
1196 "about" => array("type" => "text"),
1197 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1198 "music" => array("type" => "text"),
1199 "book" => array("type" => "text"),
1200 "tv" => array("type" => "text"),
1201 "film" => array("type" => "text"),
1202 "interest" => array("type" => "text"),
1203 "romance" => array("type" => "text"),
1204 "work" => array("type" => "text"),
1205 "education" => array("type" => "text"),
1206 "contact" => array("type" => "text"),
1207 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1208 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1209 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1210 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1211 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1212 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1215 "PRIMARY" => array("id"),
1216 "hometown" => array("hometown"),
1219 $database["profile_check"] = array(
1221 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1222 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1223 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1224 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1225 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1226 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1229 "PRIMARY" => array("id"),
1232 $database["push_subscriber"] = array(
1234 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1235 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1236 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1237 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1238 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1239 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1240 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1241 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1244 "PRIMARY" => array("id"),
1247 $database["queue"] = array(
1249 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1250 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1251 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1252 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1253 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1254 "content" => array("type" => "mediumtext"),
1255 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1258 "PRIMARY" => array("id"),
1259 "cid" => array("cid"),
1260 "created" => array("created"),
1261 "last" => array("last"),
1262 "network" => array("network"),
1263 "batch" => array("batch"),
1266 $database["register"] = array(
1268 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1269 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1270 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1271 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1272 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1273 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1276 "PRIMARY" => array("id"),
1279 $database["search"] = array(
1281 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1282 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1283 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1286 "PRIMARY" => array("id"),
1287 "uid" => array("uid"),
1288 "term" => array("term"),
1291 $database["session"] = array(
1293 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1294 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1295 "data" => array("type" => "text"),
1296 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1299 "PRIMARY" => array("id"),
1300 "sid" => array("sid"),
1301 "expire" => array("expire"),
1304 $database["sign"] = array(
1306 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1307 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1308 "signed_text" => array("type" => "mediumtext"),
1309 "signature" => array("type" => "text"),
1310 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1313 "PRIMARY" => array("id"),
1314 "iid" => array("iid"),
1317 $database["spam"] = array(
1319 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1320 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1321 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1322 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1323 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1324 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1327 "PRIMARY" => array("id"),
1328 "uid" => array("uid"),
1329 "spam" => array("spam"),
1330 "ham" => array("ham"),
1331 "term" => array("term"),
1334 $database["term"] = array(
1336 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1337 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1338 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1339 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1340 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1341 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1342 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1343 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1344 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1345 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1346 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1347 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1350 "PRIMARY" => array("tid"),
1351 "oid_otype_type_term" => array("oid","otype","type","term"),
1352 "uid_term_tid" => array("uid","term","tid"),
1353 "type_term" => array("type","term"),
1354 "uid_otype_type_term_global_created" => array("uid","otype","type","term","global","created"),
1355 "otype_type_term_tid" => array("otype","type","term","tid"),
1356 "guid" => array("guid"),
1359 $database["thread"] = array(
1361 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1362 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1363 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1364 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1365 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1366 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1367 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1368 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1369 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1370 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1371 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1372 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1373 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1374 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1375 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1376 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1377 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1378 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1379 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1380 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1381 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1382 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1383 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1384 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1385 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1386 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1389 "PRIMARY" => array("iid"),
1390 "created" => array("created"),
1391 "commented" => array("commented"),
1392 "uid_network_commented" => array("uid","network","commented"),
1393 "uid_network_created" => array("uid","network","created"),
1394 "uid_contactid_commented" => array("uid","contact-id","commented"),
1395 "uid_contactid_created" => array("uid","contact-id","created"),
1396 "uid_gcontactid_commented" => array("uid","gcontact-id","commented"),
1397 "uid_gcontactid_created" => array("uid","gcontact-id","created"),
1398 "wall_private_received" => array("wall","private","received"),
1399 "uid_created" => array("uid","created"),
1400 "uid_commented" => array("uid","commented"),
1403 $database["tokens"] = array(
1405 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1406 "secret" => array("type" => "text"),
1407 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1408 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1409 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1410 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1413 "PRIMARY" => array("id"),
1416 $database["user"] = array(
1418 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1419 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1420 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1421 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1422 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1423 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1424 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1425 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1426 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1427 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1428 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1429 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1430 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1431 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1432 "pubkey" => array("type" => "text"),
1433 "prvkey" => array("type" => "text"),
1434 "spubkey" => array("type" => "text"),
1435 "sprvkey" => array("type" => "text"),
1436 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1437 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1438 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1439 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1440 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1441 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1442 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1443 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1444 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1445 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1446 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1447 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1448 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1449 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1450 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1451 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1452 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1453 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1454 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1455 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1456 "allow_cid" => array("type" => "mediumtext"),
1457 "allow_gid" => array("type" => "mediumtext"),
1458 "deny_cid" => array("type" => "mediumtext"),
1459 "deny_gid" => array("type" => "mediumtext"),
1460 "openidserver" => array("type" => "text"),
1463 "PRIMARY" => array("uid"),
1464 "nickname" => array("nickname"),
1467 $database["userd"] = array(
1469 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1470 "username" => array("type" => "varchar(255)", "not null" => "1"),
1473 "PRIMARY" => array("id"),
1474 "username" => array("username"),
1477 $database["workerqueue"] = array(
1479 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1480 "parameter" => array("type" => "text"),
1481 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1482 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1483 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1484 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1487 "PRIMARY" => array("id"),
1488 "created" => array("created"),
1497 * run from command line
1499 function dbstructure_run(&$argv, &$argc) {
1507 @include(".htconfig.php");
1508 require_once("include/dba.php");
1509 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1510 unset($db_host, $db_user, $db_pass, $db_data);
1516 update_structure(true, false);
1519 update_structure(true, true);
1520 set_config('system','build',DB_UPDATE_VERSION);
1523 // For the dump that is used to create the database.sql we always assume utfmb4
1524 $charset = "utf8mb4";
1525 print_structure(db_definition($charset), $charset);
1532 echo $argv[0]." <command>\n";
1535 echo "dryrun show database update schema queries without running them\n";
1536 echo "update update database schema\n";
1537 echo "dumpsql dump database schema\n";
1545 if (array_search(__file__,get_included_files())===0){
1546 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);