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)",
21 if (!dbm::is_result($adminlist)) {
22 logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_WARNING);
28 // every admin could had different language
29 foreach ($adminlist as $admin) {
30 $lang = (($admin['language'])?$admin['language']:'en');
33 $preamble = deindent(t("
34 The friendica developers released update %s recently,
35 but when I tried to install it, something went terribly wrong.
36 This needs to be fixed soon and I can't do it alone. Please contact a
37 friendica developer if you can not help me on your own. My database might be invalid."));
38 $body = t("The error message is\n[pre]%s[/pre]");
39 $preamble = sprintf($preamble, $update_id);
40 $body = sprintf($body, $error_message);
43 'type' => "SYSTEM_EMAIL",
44 'to_email' => $admin['email'],
45 'preamble' => $preamble,
55 $email_tpl = get_intltext_template("update_fail_eml.tpl");
56 $email_msg = replace_macros($email_tpl, array(
57 '$sitename' => $a->config['sitename'],
58 '$siteurl' => App::get_baseurl(),
59 '$update' => DB_UPDATE_VERSION,
60 '$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
62 $subject=sprintf(t('Update Error at %s'), App::get_baseurl());
63 require_once('include/email.php');
64 $subject = email_header_encode($subject,'UTF-8');
65 mail($a->config['admin_email'], $subject, $email_msg,
66 'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n"
67 .'Content-type: text/plain; charset=UTF-8'."\n"
68 .'Content-transfer-encoding: 8bit');
71 logger("CRITICAL: Database structure update failed: ".$retval);
75 function table_structure($table) {
76 $structures = q("DESCRIBE `%s`", $table);
78 $indexes = q("SHOW INDEX FROM `%s`", $table);
83 if (dbm::is_result($indexes))
84 foreach ($indexes AS $index) {
85 if ($index["Index_type"] == "FULLTEXT") {
89 if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
90 $indexdata[$index["Key_name"]] = array('UNIQUE');
93 $column = $index["Column_name"];
94 // On utf8mb4 a varchar index can only have a length of 191
95 // To avoid the need to add this to every index definition we just ignore it here.
96 // Exception are primary indexes
97 // Since there are some combindex primary indexes we use the limit of 180 here.
98 if (($index["Sub_part"] != "") AND (($index["Sub_part"] < 180) OR ($index["Key_name"] == "PRIMARY"))) {
99 $column .= "(".$index["Sub_part"].")";
102 $indexdata[$index["Key_name"]][] = $column;
105 if (dbm::is_result($structures)) {
106 foreach ($structures AS $field) {
107 $fielddata[$field["Field"]]["type"] = $field["Type"];
108 if ($field["Null"] == "NO") {
109 $fielddata[$field["Field"]]["not null"] = true;
112 if (isset($field["Default"])) {
113 $fielddata[$field["Field"]]["default"] = $field["Default"];
116 if ($field["Extra"] != "") {
117 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
120 if ($field["Key"] == "PRI") {
121 $fielddata[$field["Field"]]["primary"] = true;
125 return(array("fields"=>$fielddata, "indexes"=>$indexdata));
128 function print_structure($database, $charset) {
129 echo "-- ------------------------------------------\n";
130 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
131 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
132 echo "-- ------------------------------------------\n\n\n";
133 foreach ($database AS $name => $structure) {
135 echo "-- TABLE $name\n";
137 db_create_table($name, $structure['fields'], $charset, true, false, $structure["indexes"]);
143 function update_structure($verbose, $action, $tables=null, $definition=null) {
147 set_config('system', 'maintenance', 1);
150 if (isset($a->config["system"]["db_charset"])) {
151 $charset = $a->config["system"]["db_charset"];
158 logger('updating structure', LOGGER_DEBUG);
160 // Get the current structure
163 if (is_null($tables)) {
164 $tables = q("SHOW TABLES");
167 foreach ($tables AS $table) {
168 $table = current($table);
170 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
171 $database[$table] = table_structure($table);
174 // Get the definition
175 if (is_null($definition)) {
176 $definition = db_definition($charset);
179 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
180 if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
181 !(strpos($db->server_info(), 'MariaDB') !== false)) {
188 foreach ($definition AS $name => $structure) {
189 $is_new_table = False;
191 if (!isset($database[$name])) {
192 $r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']);
193 if (!dbm::is_result($r)) {
194 $errors .= t('Errors encountered creating database tables.').$name.EOL;
196 $is_new_table = True;
201 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
202 if (isset($database[$name]["indexes"][$indexname])) {
203 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
205 $current_index_definition = "__NOT_SET__";
207 $new_index_definition = implode(",",$fieldnames);
208 if ($current_index_definition != $new_index_definition) {
209 if ($fieldnames[0] == "UNIQUE") {
211 // Deactivated. See below for the reason
212 //if ($ignore == "") {
213 // $temp_name = "temp-".$name;
220 * Drop the index if it isn't present in the definition
221 * or the definition differ from current status
222 * and index name doesn't start with "local_"
224 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
225 $current_index_definition = implode(",",$fieldnames);
226 if (isset($structure["indexes"][$indexname])) {
227 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
229 $new_index_definition = "__NOT_SET__";
231 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
232 $sql2=db_drop_index($indexname);
234 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
240 // Compare the field structure field by field
241 foreach ($structure["fields"] AS $fieldname => $parameters) {
242 if (!isset($database[$name]["fields"][$fieldname])) {
243 $sql2=db_add_table_field($fieldname, $parameters);
245 $sql3 = "ALTER TABLE `".$temp_name."` ".$sql2;
250 // Compare the field definition
251 $current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
252 $new_field_definition = implode(",",$parameters);
253 if ($current_field_definition != $new_field_definition) {
254 $sql2=db_modify_table_field($fieldname, $parameters);
256 $sql3 = "ALTER TABLE `".$temp_name."` ".$sql2;
267 * Create the index if the index don't exists in database
268 * or the definition differ from the current status.
269 * Don't create keys if table is new
271 if (!$is_new_table) {
272 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
273 if (isset($database[$name]["indexes"][$indexname])) {
274 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
276 $current_index_definition = "__NOT_SET__";
278 $new_index_definition = implode(",",$fieldnames);
279 if ($current_index_definition != $new_index_definition) {
280 $sql2=db_create_index($indexname, $fieldnames);
283 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
294 // Ensure index conversion to unique removes duplicates
296 // By now the alternative is commented out.
297 // This is a preparation for the time when we found a good SQL routine.
298 //if ($ignore != "") {
299 echo "SET session old_alter_table=1;\n";
301 // echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
308 // By now the alternative is commented out.
309 // This is a preparation for the time when we found a good SQL routine.
310 //if ($ignore != "") {
311 echo "SET session old_alter_table=0;\n";
313 // echo "INSERT IGNORE INTO `".$temp_name."` SELECT * FROM `".$name."`;\n";
314 // echo "DROP TABLE `".$name."`;\n";
315 // echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
321 // Ensure index conversion to unique removes duplicates
323 // By now the alternative is commented out.
324 // This is a preparation for the time when we found a good SQL routine.
325 //if ($ignore != "") {
326 $db->q("SET session old_alter_table=1;");
328 // $r = $db->q("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
329 // if (!dbm::is_result($r)) {
330 // $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
337 if (!dbm::is_result($r))
338 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
341 // By now the alternative is commented out.
342 // This is a preparation for the time when we found a good SQL routine.
343 //if ($ignore != "") {
344 $db->q("SET session old_alter_table=0;");
346 // We have to check if "INSERT IGNORE" will work on newer MySQL versions
347 // $r = $db->q("INSERT IGNORE INTO `".$temp_name."` SELECT * FROM `".$name."`;");
348 // if (!dbm::is_result($r)) {
349 // $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
352 // $r = $db->q("DROP TABLE `".$name."`;");
353 // if (!dbm::is_result($r)) {
354 // $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
357 // $r = $db->q("RENAME TABLE `".$temp_name."` TO `".$name."`;");
358 // if (!dbm::is_result($r)) {
359 // $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
369 set_config('system', 'maintenance', 0);
374 function db_field_command($parameters, $create = true) {
375 $fieldstruct = $parameters["type"];
377 if ($parameters["not null"])
378 $fieldstruct .= " NOT NULL";
380 if (isset($parameters["default"])){
381 if (strpos(strtolower($parameters["type"]),"int")!==false) {
382 $fieldstruct .= " DEFAULT ".$parameters["default"];
384 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
387 if ($parameters["extra"] != "")
388 $fieldstruct .= " ".$parameters["extra"];
390 /*if (($parameters["primary"] != "") AND $create)
391 $fieldstruct .= " PRIMARY KEY";*/
393 return($fieldstruct);
396 function db_create_table($name, $fields, $charset, $verbose, $action, $indexes=null) {
404 $primary_keys = array();
405 foreach($fields AS $fieldname => $field) {
406 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
407 if (x($field,'primary') and $field['primary']!=''){
408 $primary_keys[] = $fieldname;
412 if (!is_null($indexes)) {
413 foreach ($indexes AS $indexname => $fieldnames) {
414 $sql_index = db_create_index($indexname, $fieldnames, "");
415 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
419 $sql = implode(",\n\t", $sql_rows);
421 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=".$charset;
431 function db_add_table_field($fieldname, $parameters) {
432 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
436 function db_modify_table_field($fieldname, $parameters) {
437 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
441 function db_drop_index($indexname) {
442 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
446 function db_create_index($indexname, $fieldnames, $method="ADD") {
448 $method = strtoupper(trim($method));
449 if ($method!="" && $method!="ADD") {
450 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
454 if ($fieldnames[0] == "UNIQUE") {
455 array_shift($fieldnames);
456 $method .= ' UNIQUE';
460 foreach ($fieldnames AS $fieldname) {
464 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
465 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
467 $names .= "`".dbesc($fieldname)."`";
471 if ($indexname == "PRIMARY") {
472 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
476 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
480 function db_index_suffix($charset, $reduce = 0) {
481 if ($charset != "utf8mb4") {
485 // On utf8mb4 indexes can only have a length of 191
486 $indexlength = 191 - $reduce;
488 return "(".$indexlength.")";
491 function db_definition($charset) {
495 $database["addon"] = array(
497 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
498 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
499 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
500 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
501 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
502 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
503 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
506 "PRIMARY" => array("id"),
509 $database["attach"] = array(
511 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
512 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
513 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
514 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
515 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
516 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
517 "data" => array("type" => "longblob", "not null" => "1"),
518 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
519 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
520 "allow_cid" => array("type" => "mediumtext"),
521 "allow_gid" => array("type" => "medium_text"),
522 "deny_cid" => array("type" => "medium_text"),
523 "deny_gid" => array("type" => "medium_text"),
526 "PRIMARY" => array("id"),
529 $database["auth_codes"] = array(
531 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
532 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
533 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
534 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
535 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
538 "PRIMARY" => array("id"),
541 $database["cache"] = array(
543 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
544 "v" => array("type" => "mediumtext"),
545 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
546 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
549 "PRIMARY" => array("k"),
550 "expire_mode_updated" => array("expire_mode", "updated"),
553 $database["challenge"] = array(
555 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
556 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
557 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
558 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
559 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
560 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
563 "PRIMARY" => array("id"),
566 $database["clients"] = array(
568 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
569 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
570 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
571 "name" => array("type" => "text"),
572 "icon" => array("type" => "text"),
573 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
576 "PRIMARY" => array("client_id"),
579 $database["config"] = array(
581 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
582 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
583 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
584 "v" => array("type" => "mediumtext"),
587 "PRIMARY" => array("id"),
588 "cat_k" => array("UNIQUE", "cat", "k"),
591 $database["contact"] = array(
593 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
594 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
595 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
596 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
597 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
598 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
599 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
600 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
601 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
602 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
603 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
604 "about" => array("type" => "text"),
605 "keywords" => array("type" => "text"),
606 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
607 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
608 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
609 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
610 "photo" => array("type" => "text"),
611 "thumb" => array("type" => "text"),
612 "micro" => array("type" => "text"),
613 "site-pubkey" => array("type" => "text"),
614 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
615 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
616 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
617 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
618 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
619 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
620 "pubkey" => array("type" => "text"),
621 "prvkey" => array("type" => "text"),
622 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
623 "request" => array("type" => "text"),
624 "notify" => array("type" => "text"),
625 "poll" => array("type" => "text"),
626 "confirm" => array("type" => "text"),
627 "poco" => array("type" => "text"),
628 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
629 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
630 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
631 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
632 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
633 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
634 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
635 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
636 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
637 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
638 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
639 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
640 "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
641 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
642 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
643 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
644 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
645 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
646 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
647 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
648 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
649 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
650 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
651 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
652 "reason" => array("type" => "text"),
653 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
654 "info" => array("type" => "mediumtext"),
655 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
656 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
657 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
658 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
659 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
660 "ffi_keyword_blacklist" => array("type" => "text"),
663 "PRIMARY" => array("id"),
664 "uid_name" => array("uid", "name"),
665 "self_uid" => array("self", "uid"),
666 "alias_uid" => array("alias(32)", "uid"),
667 "pending_uid" => array("pending", "uid"),
668 "blocked_uid" => array("blocked", "uid"),
669 "uid_rel_network_poll" => array("uid", "rel", "network", "poll(64)", "archive"),
670 "uid_network_batch" => array("uid", "network", "batch(64)"),
671 "addr_uid" => array("addr(32)", "uid"),
672 "nurl_uid" => array("nurl(32)", "uid"),
673 "nick_uid" => array("nick(32)", "uid"),
674 "dfrn-id" => array("dfrn-id"),
675 "issued-id" => array("issued-id"),
678 $database["conv"] = array(
680 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
681 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
682 "recips" => array("type" => "text"),
683 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
684 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
685 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
686 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
687 "subject" => array("type" => "text"),
690 "PRIMARY" => array("id"),
691 "uid" => array("uid"),
694 $database["deliverq"] = array(
696 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
697 "cmd" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
698 "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
699 "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
702 "PRIMARY" => array("id"),
703 "cmd_item_contact" => array("UNIQUE", "cmd", "item", "contact"),
706 $database["event"] = array(
708 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
709 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
710 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
711 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
712 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
713 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
714 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
715 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
716 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
717 "summary" => array("type" => "text"),
718 "desc" => array("type" => "text"),
719 "location" => array("type" => "text"),
720 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
721 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
722 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
723 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
724 "allow_cid" => array("type" => "medium_text"),
725 "allow_gid" => array("type" => "medium_text"),
726 "deny_cid" => array("type" => "medium_text"),
727 "deny_gid" => array("type" => "medium_text"),
730 "PRIMARY" => array("id"),
731 "uid_start" => array("uid", "start"),
734 $database["fcontact"] = array(
736 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
737 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
738 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
739 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
740 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
741 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
742 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
743 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
744 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
745 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
746 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
747 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
748 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
749 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
750 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
751 "pubkey" => array("type" => "text"),
752 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
755 "PRIMARY" => array("id"),
756 "addr" => array("addr(32)"),
757 "url" => array("url"),
760 $database["ffinder"] = array(
762 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
763 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
764 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
765 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
768 "PRIMARY" => array("id"),
771 $database["fserver"] = array(
773 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
774 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
775 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
776 "key" => array("type" => "text"),
779 "PRIMARY" => array("id"),
780 "server" => array("server(32)"),
783 $database["fsuggest"] = array(
785 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
786 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
787 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
788 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
789 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
790 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
791 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
792 "note" => array("type" => "text"),
793 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
796 "PRIMARY" => array("id"),
799 $database["gcign"] = array(
801 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
802 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
803 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
806 "PRIMARY" => array("id"),
807 "uid" => array("uid"),
808 "gcid" => array("gcid"),
811 $database["gcontact"] = array(
813 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
814 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
815 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
816 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
817 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
818 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
819 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
820 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
821 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
822 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
823 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
824 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
825 "about" => array("type" => "text"),
826 "keywords" => array("type" => "text"),
827 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
828 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
829 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
830 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
831 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
832 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
833 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
834 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
835 "notify" => array("type" => "text"),
836 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
837 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
838 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
841 "PRIMARY" => array("id"),
842 "nurl" => array("nurl(32)"),
843 "name" => array("name(32)"),
844 "nick" => array("nick(32)"),
845 "addr" => array("addr(32)"),
846 "hide_network_updated" => array("hide", "network", "updated"),
847 "updated" => array("updated"),
850 $database["glink"] = array(
852 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
853 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
854 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
855 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
856 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
857 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
860 "PRIMARY" => array("id"),
861 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
862 "gcid" => array("gcid"),
865 $database["group"] = array(
867 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
868 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
869 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
870 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
871 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
874 "PRIMARY" => array("id"),
875 "uid" => array("uid"),
878 $database["group_member"] = array(
880 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
881 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
882 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
883 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
886 "PRIMARY" => array("id"),
887 "contactid" => array("contact-id"),
888 "gid_contactid" => array("gid", "contact-id"),
889 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
892 $database["gserver"] = array(
894 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
895 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
896 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
897 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
898 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
899 "info" => array("type" => "text"),
900 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
901 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
902 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
903 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
904 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
905 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
906 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
907 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
908 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
911 "PRIMARY" => array("id"),
912 "nurl" => array("nurl(32)"),
915 $database["hook"] = array(
917 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
918 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
919 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
920 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
921 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
924 "PRIMARY" => array("id"),
925 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
928 $database["intro"] = array(
930 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
931 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
932 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
933 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
934 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
935 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
936 "note" => array("type" => "text"),
937 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
938 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
939 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
940 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
943 "PRIMARY" => array("id"),
946 $database["item"] = array(
948 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
949 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
950 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
951 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
952 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
953 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
954 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
955 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
956 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
957 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
958 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
959 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
960 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
961 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
962 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
963 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
964 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
965 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
966 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
967 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
968 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
969 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
970 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
971 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
972 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
973 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
974 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
975 "body" => array("type" => "mediumtext"),
976 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
977 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
978 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
979 "object" => array("type" => "text"),
980 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
981 "target" => array("type" => "text"),
982 "postopts" => array("type" => "text"),
983 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
984 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
985 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
986 "tag" => array("type" => "mediumtext"),
987 "attach" => array("type" => "mediumtext"),
988 "inform" => array("type" => "mediumtext"),
989 "file" => array("type" => "mediumtext"),
990 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
991 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
992 "allow_cid" => array("type" => "mediumtext"),
993 "allow_gid" => array("type" => "mediumtext"),
994 "deny_cid" => array("type" => "mediumtext"),
995 "deny_gid" => array("type" => "mediumtext"),
996 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
997 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
998 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
999 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1000 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1001 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1002 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1003 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1004 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1005 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1006 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1007 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1008 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1009 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1010 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1011 "rendered-html" => array("type" => "mediumtext"),
1012 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1015 "PRIMARY" => array("id"),
1016 "guid" => array("guid"),
1017 "uri" => array("uri"),
1018 "parent" => array("parent"),
1019 "parent-uri" => array("parent-uri"),
1020 "extid" => array("extid"),
1021 "uid_id" => array("uid","id"),
1022 "uid_created" => array("uid","created"),
1023 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1024 "uid_network_received" => array("uid","network","received"),
1025 "uid_network_commented" => array("uid","network","commented"),
1026 "uid_thrparent" => array("uid","thr-parent"),
1027 "uid_parenturi" => array("uid","parent-uri"),
1028 "uid_contactid_created" => array("uid","contact-id","created"),
1029 "authorid_created" => array("author-id","created"),
1030 "uid_uri" => array("uid", "uri"),
1031 "resource-id" => array("resource-id"),
1032 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1033 "uid_type_changed" => array("uid","type","changed"),
1034 "contactid_verb" => array("contact-id","verb"),
1035 "deleted_changed" => array("deleted","changed"),
1036 "uid_wall_changed" => array("uid","wall","changed"),
1037 "uid_eventid" => array("uid","event-id"),
1038 "uid_authorlink" => array("uid","author-link"),
1039 "uid_ownerlink" => array("uid","owner-link"),
1042 $database["item_id"] = array(
1044 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1045 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1046 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1047 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1048 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1051 "PRIMARY" => array("id"),
1052 "uid" => array("uid"),
1053 "sid" => array("sid"),
1054 "service" => array("service(32)"),
1055 "iid" => array("iid"),
1058 $database["locks"] = array(
1060 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1061 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1062 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1063 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
1066 "PRIMARY" => array("id"),
1069 $database["mail"] = array(
1071 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1072 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1073 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1074 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1075 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1076 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1077 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1078 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1079 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1080 "body" => array("type" => "mediumtext"),
1081 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1082 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1083 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1084 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1085 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1086 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1087 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1090 "PRIMARY" => array("id"),
1091 "uid_seen" => array("uid", "seen"),
1092 "convid" => array("convid"),
1093 "uri" => array("uri(64)"),
1094 "parent-uri" => array("parent-uri(64)"),
1097 $database["mailacct"] = array(
1099 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1100 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1101 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1102 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1103 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1104 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1105 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1106 "pass" => array("type" => "text"),
1107 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1108 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1109 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1110 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1111 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1114 "PRIMARY" => array("id"),
1117 $database["manage"] = array(
1119 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1120 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1121 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1124 "PRIMARY" => array("id"),
1125 "uid_mid" => array("UNIQUE", "uid","mid"),
1128 $database["notify"] = array(
1130 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1131 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1132 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1133 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1134 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1135 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1136 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1137 "msg" => array("type" => "mediumtext"),
1138 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1139 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1140 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1141 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1142 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1143 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1144 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1145 "name_cache" => array("type" => "tinytext"),
1146 "msg_cache" => array("type" => "mediumtext")
1149 "PRIMARY" => array("id"),
1150 "hash_uid" => array("hash", "uid"),
1151 "seen_uid_date" => array("seen", "uid", "date"),
1152 "uid_date" => array("uid", "date"),
1153 "uid_type_link" => array("uid", "type", "link"),
1156 $database["notify-threads"] = array(
1158 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1159 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1160 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1161 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1162 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1165 "PRIMARY" => array("id"),
1168 $database["oembed"] = array(
1170 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1171 "content" => array("type" => "mediumtext"),
1172 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1175 "PRIMARY" => array("url"),
1176 "created" => array("created"),
1179 $database["parsed_url"] = array(
1181 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1182 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1183 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1184 "content" => array("type" => "mediumtext"),
1185 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1188 "PRIMARY" => array("url", "guessing", "oembed"),
1189 "created" => array("created"),
1192 $database["pconfig"] = array(
1194 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1195 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1196 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1197 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1198 "v" => array("type" => "mediumtext"),
1201 "PRIMARY" => array("id"),
1202 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1205 $database["photo"] = array(
1207 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1208 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1209 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1210 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1211 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1212 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1213 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1214 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1215 "desc" => array("type" => "text"),
1216 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1217 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1218 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1219 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1220 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1221 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1222 "data" => array("type" => "mediumblob", "not null" => "1"),
1223 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1224 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1225 "allow_cid" => array("type" => "mediumtext"),
1226 "allow_gid" => array("type" => "mediumtext"),
1227 "deny_cid" => array("type" => "mediumtext"),
1228 "deny_gid" => array("type" => "mediumtext"),
1231 "PRIMARY" => array("id"),
1232 "uid_contactid" => array("uid", "contact-id"),
1233 "uid_profile" => array("uid", "profile"),
1234 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1235 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1236 "resource-id" => array("resource-id(64)"),
1239 $database["poll"] = array(
1241 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1242 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1243 "q0" => array("type" => "text"),
1244 "q1" => array("type" => "text"),
1245 "q2" => array("type" => "text"),
1246 "q3" => array("type" => "text"),
1247 "q4" => array("type" => "text"),
1248 "q5" => array("type" => "text"),
1249 "q6" => array("type" => "text"),
1250 "q7" => array("type" => "text"),
1251 "q8" => array("type" => "text"),
1252 "q9" => array("type" => "text"),
1255 "PRIMARY" => array("id"),
1256 "uid" => array("uid"),
1259 $database["poll_result"] = array(
1261 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1262 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1263 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1266 "PRIMARY" => array("id"),
1267 "poll_id" => array("poll_id"),
1268 "choice" => array("choice"),
1271 $database["process"] = array(
1273 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1274 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1275 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1278 "PRIMARY" => array("pid"),
1279 "command" => array("command"),
1282 $database["profile"] = array(
1284 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1285 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1286 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1287 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1288 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1289 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1290 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1291 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1292 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1293 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1294 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1295 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1296 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1297 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1298 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1299 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1300 "with" => array("type" => "text"),
1301 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1302 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1303 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1304 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1305 "pub_keywords" => array("type" => "text"),
1306 "prv_keywords" => array("type" => "text"),
1307 "likes" => array("type" => "text"),
1308 "dislikes" => array("type" => "text"),
1309 "about" => array("type" => "text"),
1310 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1311 "music" => array("type" => "text"),
1312 "book" => array("type" => "text"),
1313 "tv" => array("type" => "text"),
1314 "film" => array("type" => "text"),
1315 "interest" => array("type" => "text"),
1316 "romance" => array("type" => "text"),
1317 "work" => array("type" => "text"),
1318 "education" => array("type" => "text"),
1319 "contact" => array("type" => "text"),
1320 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1321 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1322 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1323 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1324 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1325 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1328 "PRIMARY" => array("id"),
1329 "uid_is-default" => array("uid", "is-default"),
1332 $database["profile_check"] = array(
1334 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1335 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1336 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1337 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1338 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1339 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1342 "PRIMARY" => array("id"),
1345 $database["push_subscriber"] = array(
1347 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1348 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1349 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1350 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1351 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1352 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1353 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1354 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1357 "PRIMARY" => array("id"),
1360 $database["queue"] = array(
1362 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1363 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1364 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1365 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1366 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1367 "content" => array("type" => "mediumtext"),
1368 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1371 "PRIMARY" => array("id"),
1372 "cid" => array("cid"),
1373 "created" => array("created"),
1374 "last" => array("last"),
1375 "network" => array("network"),
1376 "batch" => array("batch"),
1379 $database["register"] = array(
1381 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1382 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1383 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1384 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1385 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1386 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1387 "note" => array("type" => "text"),
1390 "PRIMARY" => array("id"),
1393 $database["search"] = array(
1395 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1396 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1397 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1400 "PRIMARY" => array("id"),
1401 "uid" => array("uid"),
1404 $database["session"] = array(
1406 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1407 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1408 "data" => array("type" => "text"),
1409 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1412 "PRIMARY" => array("id"),
1413 "sid" => array("sid(64)"),
1414 "expire" => array("expire"),
1417 $database["sign"] = array(
1419 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1420 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1421 "signed_text" => array("type" => "mediumtext"),
1422 "signature" => array("type" => "text"),
1423 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1426 "PRIMARY" => array("id"),
1427 "iid" => array("iid"),
1430 $database["spam"] = array(
1432 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1433 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1434 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1435 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1436 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1437 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1440 "PRIMARY" => array("id"),
1441 "uid" => array("uid"),
1442 "spam" => array("spam"),
1443 "ham" => array("ham"),
1444 "term" => array("term"),
1447 $database["term"] = array(
1449 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1450 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1451 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1452 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1453 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1454 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1455 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1456 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1457 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1458 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1459 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1460 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1463 "PRIMARY" => array("tid"),
1464 "oid_otype_type_term" => array("oid","otype","type","term"),
1465 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1466 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1467 "guid" => array("guid(64)"),
1470 $database["thread"] = array(
1472 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1473 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1474 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1475 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1476 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1477 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1478 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1479 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1480 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1481 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1482 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1483 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1484 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1485 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1486 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1487 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1488 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1489 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1490 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1491 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1492 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1493 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1494 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1495 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1496 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1497 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1500 "PRIMARY" => array("iid"),
1501 "uid_network_commented" => array("uid","network","commented"),
1502 "uid_network_created" => array("uid","network","created"),
1503 "uid_contactid_commented" => array("uid","contact-id","commented"),
1504 "uid_contactid_created" => array("uid","contact-id","created"),
1505 "uid_created" => array("uid","created"),
1506 "uid_commented" => array("uid","commented"),
1509 $database["tokens"] = array(
1511 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1512 "secret" => array("type" => "text"),
1513 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1514 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1515 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1516 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1519 "PRIMARY" => array("id"),
1522 $database["user"] = array(
1524 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1525 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1526 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1527 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1528 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1529 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1530 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1531 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1532 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1533 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1534 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1535 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1536 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1537 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1538 "pubkey" => array("type" => "text"),
1539 "prvkey" => array("type" => "text"),
1540 "spubkey" => array("type" => "text"),
1541 "sprvkey" => array("type" => "text"),
1542 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1543 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1544 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1545 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1546 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1547 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1548 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1549 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1550 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1551 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1552 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1553 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1554 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1555 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1556 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1557 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1558 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1559 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1560 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1561 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1562 "allow_cid" => array("type" => "medium_text"),
1563 "allow_gid" => array("type" => "medium_text"),
1564 "deny_cid" => array("type" => "medium_text"),
1565 "deny_gid" => array("type" => "medium_text"),
1566 "openidserver" => array("type" => "text"),
1569 "PRIMARY" => array("uid"),
1570 "nickname" => array("nickname(32)"),
1573 $database["userd"] = array(
1575 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1576 "username" => array("type" => "varchar(255)", "not null" => "1"),
1579 "PRIMARY" => array("id"),
1580 "username" => array("username(32)"),
1583 $database["workerqueue"] = array(
1585 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1586 "parameter" => array("type" => "text"),
1587 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1588 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1589 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1590 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1593 "PRIMARY" => array("id"),
1602 * run from command line
1604 function dbstructure_run(&$argv, &$argc) {
1612 @include(".htconfig.php");
1613 require_once("include/dba.php");
1614 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1615 unset($db_host, $db_user, $db_pass, $db_data);
1621 update_structure(true, false);
1624 update_structure(true, true);
1626 $build = get_config('system','build');
1628 set_config('system','build',DB_UPDATE_VERSION);
1629 $build = DB_UPDATE_VERSION;
1632 $stored = intval($build);
1633 $current = intval(DB_UPDATE_VERSION);
1635 // run any left update_nnnn functions in update.php
1636 for($x = $stored; $x < $current; $x ++) {
1637 $r = run_update_function($x);
1641 set_config('system','build',DB_UPDATE_VERSION);
1644 // For the dump that is used to create the database.sql we always assume utfmb4
1645 $charset = "utf8mb4";
1646 print_structure(db_definition($charset), $charset);
1653 echo $argv[0]." <command>\n";
1656 echo "dryrun show database update schema queries without running them\n";
1657 echo "update update database schema\n";
1658 echo "dumpsql dump database schema\n";
1663 if (array_search(__file__,get_included_files())===0){
1664 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);