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) {
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 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
712 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
713 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
714 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
715 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
716 "notify" => array("type" => "text"),
717 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
718 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
719 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
722 "PRIMARY" => array("id"),
723 "nurl" => array("nurl"),
724 "name" => array("name"),
725 "nick" => array("nick"),
726 "addr" => array("addr"),
727 "updated" => array("updated"),
730 $database["glink"] = array(
732 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
733 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
734 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
735 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
736 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
737 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
740 "PRIMARY" => array("id"),
741 "cid_uid_gcid_zcid" => array("cid","uid","gcid","zcid"),
742 "gcid" => array("gcid"),
743 "zcid" => array("zcid"),
746 $database["group"] = array(
748 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
749 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
750 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
751 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
752 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
755 "PRIMARY" => array("id"),
756 "uid" => array("uid"),
759 $database["group_member"] = array(
761 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
762 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
763 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
764 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
767 "PRIMARY" => array("id"),
768 "uid_gid_contactid" => array("uid","gid","contact-id"),
771 $database["gserver"] = array(
773 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
774 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
775 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
776 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
777 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
778 "info" => array("type" => "text"),
779 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
780 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
781 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
782 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
783 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
784 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
785 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
786 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
787 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
790 "PRIMARY" => array("id"),
791 "nurl" => array("nurl"),
794 $database["hook"] = array(
796 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
797 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
798 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
799 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
800 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
803 "PRIMARY" => array("id"),
804 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
807 $database["intro"] = array(
809 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
810 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
811 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
812 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
813 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
814 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
815 "note" => array("type" => "text"),
816 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
817 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
818 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
819 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
822 "PRIMARY" => array("id"),
825 $database["item"] = array(
827 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
828 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
829 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
830 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
831 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
832 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
833 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
834 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
835 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
836 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
837 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
838 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
839 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
840 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
841 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
842 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
843 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
844 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
845 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
846 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
847 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
848 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
849 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
850 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
851 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
852 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
853 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
854 "body" => array("type" => "mediumtext"),
855 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
856 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
857 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
858 "object" => array("type" => "text"),
859 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
860 "target" => array("type" => "text"),
861 "postopts" => array("type" => "text"),
862 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
863 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
864 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
865 "tag" => array("type" => "mediumtext"),
866 "attach" => array("type" => "mediumtext"),
867 "inform" => array("type" => "mediumtext"),
868 "file" => array("type" => "mediumtext"),
869 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
870 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
871 "allow_cid" => array("type" => "mediumtext"),
872 "allow_gid" => array("type" => "mediumtext"),
873 "deny_cid" => array("type" => "mediumtext"),
874 "deny_gid" => array("type" => "mediumtext"),
875 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
876 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
877 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
878 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
879 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
880 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
881 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
882 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
883 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
884 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
885 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
886 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
887 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
888 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
889 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
890 "rendered-html" => array("type" => "mediumtext"),
891 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
894 "PRIMARY" => array("id"),
895 "guid" => array("guid"),
896 "uri" => array("uri"),
897 "parent" => array("parent"),
898 "parent-uri" => array("parent-uri"),
899 "extid" => array("extid"),
900 "uid_id" => array("uid","id"),
901 "uid_created" => array("uid","created"),
902 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
903 "uid_network_received" => array("uid","network","received"),
904 "uid_received" => array("uid","received"),
905 "uid_network_commented" => array("uid","network","commented"),
906 "uid_commented" => array("uid","commented"),
907 "uid_title" => array("uid","title"),
908 "uid_thrparent" => array("uid","thr-parent"),
909 "uid_parenturi" => array("uid","parent-uri"),
910 "uid_contactid_id" => array("uid","contact-id","id"),
911 "uid_contactid_created" => array("uid","contact-id","created"),
912 "gcontactid_uid_created" => array("gcontact-id","uid","created"),
913 "authorid_created" => array("author-id","created"),
914 "ownerid_created" => array("owner-id","created"),
915 "wall_body" => array("wall","body(6)"),
916 "uid_visible_moderated_created" => array("uid","visible","moderated","created"),
917 "uid_uri" => array("uid","uri"),
918 "uid_wall_created" => array("uid","wall","created"),
919 "resource-id" => array("resource-id"),
920 "uid_type" => array("uid","type"),
921 "uid_starred_id" => array("uid","starred", "id"),
922 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
923 "uid_wall_parent_created" => array("uid","wall","parent","created"),
924 "uid_type_changed" => array("uid","type","changed"),
925 "contactid_verb" => array("contact-id","verb"),
926 "deleted_changed" => array("deleted","changed"),
927 "uid_wall_changed" => array("uid","wall","changed"),
928 "uid_eventid" => array("uid","event-id"),
929 "uid_authorlink" => array("uid","author-link"),
930 "uid_ownerlink" => array("uid","owner-link"),
933 $database["item_id"] = array(
935 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
936 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
937 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
938 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
939 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
942 "PRIMARY" => array("id"),
943 "uid" => array("uid"),
944 "sid" => array("sid"),
945 "service" => array("service"),
946 "iid" => array("iid"),
949 $database["locks"] = array(
951 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
952 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
953 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
954 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
957 "PRIMARY" => array("id"),
960 $database["mail"] = array(
962 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
963 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
964 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
965 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
966 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
967 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
968 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
969 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
970 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
971 "body" => array("type" => "mediumtext"),
972 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
973 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
974 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
975 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
976 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
977 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
978 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
981 "PRIMARY" => array("id"),
982 "uid" => array("uid"),
983 "guid" => array("guid"),
984 "convid" => array("convid"),
985 "reply" => array("reply"),
986 "uri" => array("uri"),
987 "parent-uri" => array("parent-uri"),
990 $database["mailacct"] = array(
992 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
993 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
994 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
995 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
996 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
997 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
998 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
999 "pass" => array("type" => "text"),
1000 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1001 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1002 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1003 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1004 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1007 "PRIMARY" => array("id"),
1010 $database["manage"] = array(
1012 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1013 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1014 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1017 "PRIMARY" => array("id"),
1018 "uid_mid" => array("uid","mid"),
1021 $database["notify"] = array(
1023 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1024 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1025 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1026 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1027 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1028 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1029 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1030 "msg" => array("type" => "mediumtext"),
1031 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1032 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1033 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1034 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1035 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1036 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1037 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1040 "PRIMARY" => array("id"),
1041 "uid" => array("uid"),
1044 $database["notify-threads"] = array(
1046 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1047 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1048 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1049 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1050 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1053 "PRIMARY" => array("id"),
1054 "master-parent-item" => array("master-parent-item"),
1055 "receiver-uid" => array("receiver-uid"),
1058 $database["oembed"] = array(
1060 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1061 "content" => array("type" => "text"),
1062 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1065 "PRIMARY" => array("url".db_index_suffix($charset)),
1066 "created" => array("created"),
1069 $database["parsed_url"] = array(
1071 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1072 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1073 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1074 "content" => array("type" => "text"),
1075 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1078 "PRIMARY" => array("url".db_index_suffix($charset), "guessing", "oembed"),
1079 "created" => array("created"),
1082 $database["pconfig"] = array(
1084 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1085 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1086 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1087 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1088 "v" => array("type" => "mediumtext"),
1091 "PRIMARY" => array("id"),
1092 "uid_cat_k" => array("UNIQUE", "uid","cat(30)","k(30)"),
1095 $database["photo"] = array(
1097 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1098 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1099 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1100 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1101 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1102 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1103 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1104 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1105 "desc" => array("type" => "text"),
1106 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1107 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1108 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1109 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1110 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1111 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1112 "data" => array("type" => "mediumblob", "not null" => "1"),
1113 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1114 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1115 "allow_cid" => array("type" => "mediumtext"),
1116 "allow_gid" => array("type" => "mediumtext"),
1117 "deny_cid" => array("type" => "mediumtext"),
1118 "deny_gid" => array("type" => "mediumtext"),
1121 "PRIMARY" => array("id"),
1122 "uid" => array("uid"),
1123 "resource-id" => array("resource-id"),
1124 "guid" => array("guid"),
1127 $database["poll"] = array(
1129 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1130 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1131 "q0" => array("type" => "mediumtext"),
1132 "q1" => array("type" => "mediumtext"),
1133 "q2" => array("type" => "mediumtext"),
1134 "q3" => array("type" => "mediumtext"),
1135 "q4" => array("type" => "mediumtext"),
1136 "q5" => array("type" => "mediumtext"),
1137 "q6" => array("type" => "mediumtext"),
1138 "q7" => array("type" => "mediumtext"),
1139 "q8" => array("type" => "mediumtext"),
1140 "q9" => array("type" => "mediumtext"),
1143 "PRIMARY" => array("id"),
1144 "uid" => array("uid"),
1147 $database["poll_result"] = array(
1149 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1150 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1151 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1154 "PRIMARY" => array("id"),
1155 "poll_id" => array("poll_id"),
1156 "choice" => array("choice"),
1159 $database["process"] = array(
1161 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1162 "command" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1163 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1166 "PRIMARY" => array("pid"),
1167 "command" => array("command"),
1170 $database["profile"] = array(
1172 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1173 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1174 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1175 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1176 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1177 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1178 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1179 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1180 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1181 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1182 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1183 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1184 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1185 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1186 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1187 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1188 "with" => array("type" => "text"),
1189 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1190 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1191 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1192 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1193 "pub_keywords" => array("type" => "text"),
1194 "prv_keywords" => array("type" => "text"),
1195 "likes" => array("type" => "text"),
1196 "dislikes" => array("type" => "text"),
1197 "about" => array("type" => "text"),
1198 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1199 "music" => array("type" => "text"),
1200 "book" => array("type" => "text"),
1201 "tv" => array("type" => "text"),
1202 "film" => array("type" => "text"),
1203 "interest" => array("type" => "text"),
1204 "romance" => array("type" => "text"),
1205 "work" => array("type" => "text"),
1206 "education" => array("type" => "text"),
1207 "contact" => array("type" => "text"),
1208 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1209 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1210 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1211 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1212 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1213 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1216 "PRIMARY" => array("id"),
1217 "hometown" => array("hometown"),
1220 $database["profile_check"] = array(
1222 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1223 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1224 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1225 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1226 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1227 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1230 "PRIMARY" => array("id"),
1233 $database["push_subscriber"] = array(
1235 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1236 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1237 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1238 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1239 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1240 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1241 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1242 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1245 "PRIMARY" => array("id"),
1248 $database["queue"] = array(
1250 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1251 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1252 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1253 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1254 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1255 "content" => array("type" => "mediumtext"),
1256 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1259 "PRIMARY" => array("id"),
1260 "cid" => array("cid"),
1261 "created" => array("created"),
1262 "last" => array("last"),
1263 "network" => array("network"),
1264 "batch" => array("batch"),
1267 $database["register"] = array(
1269 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1270 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1271 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1272 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1273 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1274 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1277 "PRIMARY" => array("id"),
1280 $database["search"] = array(
1282 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1283 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1284 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1287 "PRIMARY" => array("id"),
1288 "uid" => array("uid"),
1289 "term" => array("term"),
1292 $database["session"] = array(
1294 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1295 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1296 "data" => array("type" => "text"),
1297 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1300 "PRIMARY" => array("id"),
1301 "sid" => array("sid"),
1302 "expire" => array("expire"),
1305 $database["sign"] = array(
1307 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1308 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1309 "signed_text" => array("type" => "mediumtext"),
1310 "signature" => array("type" => "text"),
1311 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1314 "PRIMARY" => array("id"),
1315 "iid" => array("iid"),
1318 $database["spam"] = array(
1320 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1321 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1322 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1323 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1324 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1325 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1328 "PRIMARY" => array("id"),
1329 "uid" => array("uid"),
1330 "spam" => array("spam"),
1331 "ham" => array("ham"),
1332 "term" => array("term"),
1335 $database["term"] = array(
1337 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1338 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1339 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1340 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1341 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1342 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1343 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1344 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1345 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1346 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1347 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1348 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1351 "PRIMARY" => array("tid"),
1352 "oid_otype_type_term" => array("oid","otype","type","term"),
1353 "uid_term_tid" => array("uid","term","tid"),
1354 "type_term" => array("type","term"),
1355 "uid_otype_type_term_global_created" => array("uid","otype","type","term","global","created"),
1356 "otype_type_term_tid" => array("otype","type","term","tid"),
1357 "guid" => array("guid"),
1360 $database["thread"] = array(
1362 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1363 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1364 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1365 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1366 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1367 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1368 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1369 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1370 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1371 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1372 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1373 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1374 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1375 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1376 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1377 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1378 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1379 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1380 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1381 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1382 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1383 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1384 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1385 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1386 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1387 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1390 "PRIMARY" => array("iid"),
1391 "created" => array("created"),
1392 "commented" => array("commented"),
1393 "uid_network_commented" => array("uid","network","commented"),
1394 "uid_network_created" => array("uid","network","created"),
1395 "uid_contactid_commented" => array("uid","contact-id","commented"),
1396 "uid_contactid_created" => array("uid","contact-id","created"),
1397 "uid_gcontactid_commented" => array("uid","gcontact-id","commented"),
1398 "uid_gcontactid_created" => array("uid","gcontact-id","created"),
1399 "wall_private_received" => array("wall","private","received"),
1400 "uid_created" => array("uid","created"),
1401 "uid_commented" => array("uid","commented"),
1404 $database["tokens"] = array(
1406 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1407 "secret" => array("type" => "text"),
1408 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1409 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1410 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1411 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1414 "PRIMARY" => array("id"),
1417 $database["user"] = array(
1419 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1420 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1421 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1422 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1423 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1424 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1425 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1426 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1427 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1428 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1429 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1430 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1431 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1432 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1433 "pubkey" => array("type" => "text"),
1434 "prvkey" => array("type" => "text"),
1435 "spubkey" => array("type" => "text"),
1436 "sprvkey" => array("type" => "text"),
1437 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1438 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1439 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1440 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1441 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1442 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1443 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1444 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1445 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1446 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1447 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1448 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1449 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1450 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1451 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1452 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1453 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1454 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1455 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1456 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1457 "allow_cid" => array("type" => "mediumtext"),
1458 "allow_gid" => array("type" => "mediumtext"),
1459 "deny_cid" => array("type" => "mediumtext"),
1460 "deny_gid" => array("type" => "mediumtext"),
1461 "openidserver" => array("type" => "text"),
1464 "PRIMARY" => array("uid"),
1465 "nickname" => array("nickname"),
1468 $database["userd"] = array(
1470 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1471 "username" => array("type" => "varchar(255)", "not null" => "1"),
1474 "PRIMARY" => array("id"),
1475 "username" => array("username"),
1478 $database["workerqueue"] = array(
1480 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1481 "parameter" => array("type" => "text"),
1482 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1483 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1484 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1485 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1488 "PRIMARY" => array("id"),
1489 "created" => array("created"),
1498 * run from command line
1500 function dbstructure_run(&$argv, &$argc) {
1508 @include(".htconfig.php");
1509 require_once("include/dba.php");
1510 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1511 unset($db_host, $db_user, $db_pass, $db_data);
1517 update_structure(true, false);
1520 update_structure(true, true);
1522 $build = get_config('system','build');
1524 set_config('system','build',DB_UPDATE_VERSION);
1525 $build = DB_UPDATE_VERSION;
1528 $stored = intval($build);
1529 $current = intval(DB_UPDATE_VERSION);
1531 // run any left update_nnnn functions in update.php
1532 for($x = $stored; $x < $current; $x ++) {
1533 $r = run_update_function($x);
1537 set_config('system','build',DB_UPDATE_VERSION);
1540 // For the dump that is used to create the database.sql we always assume utfmb4
1541 $charset = "utf8mb4";
1542 print_structure(db_definition($charset), $charset);
1549 echo $argv[0]." <command>\n";
1552 echo "dryrun show database update schema queries without running them\n";
1553 echo "update update database schema\n";
1554 echo "dumpsql dump database schema\n";
1562 if (array_search(__file__,get_included_files())===0){
1563 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);