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;
192 if (!isset($database[$name])) {
193 $r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']);
194 if (!dbm::is_result($r)) {
195 $errors .= t('Errors encountered creating database tables.').$name.EOL;
197 $is_new_table = True;
202 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
203 if (isset($database[$name]["indexes"][$indexname])) {
204 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
206 $current_index_definition = "__NOT_SET__";
208 $new_index_definition = implode(",",$fieldnames);
209 if ($current_index_definition != $new_index_definition) {
210 if ($fieldnames[0] == "UNIQUE") {
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);
282 // Fetch the "group by" fields for unique indexes
283 if ($fieldnames[0] == "UNIQUE") {
284 $group_by = db_group_by($indexname, $fieldnames);
288 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
299 // Ensure index conversion to unique removes duplicates
302 echo "SET session old_alter_table=1;\n";
304 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
312 echo "SET session old_alter_table=0;\n";
314 echo "INSERT INTO `".$temp_name."` SELECT * FROM `".$name."`".$group_by.";\n";
315 echo "DROP TABLE `".$name."`;\n";
316 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
322 // Ensure index conversion to unique removes duplicates
325 $db->q("SET session old_alter_table=1;");
327 $r = $db->q("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
328 if (!dbm::is_result($r)) {
329 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
336 if (!dbm::is_result($r))
337 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
341 $db->q("SET session old_alter_table=0;");
343 $r = $db->q("INSERT INTO `".$temp_name."` SELECT * FROM `".$name."`".$group_by.";");
344 if (!dbm::is_result($r)) {
345 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
348 $r = $db->q("DROP TABLE `".$name."`;");
349 if (!dbm::is_result($r)) {
350 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
353 $r = $db->q("RENAME TABLE `".$temp_name."` TO `".$name."`;");
354 if (!dbm::is_result($r)) {
355 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
365 set_config('system', 'maintenance', 0);
370 function db_field_command($parameters, $create = true) {
371 $fieldstruct = $parameters["type"];
373 if ($parameters["not null"])
374 $fieldstruct .= " NOT NULL";
376 if (isset($parameters["default"])){
377 if (strpos(strtolower($parameters["type"]),"int")!==false) {
378 $fieldstruct .= " DEFAULT ".$parameters["default"];
380 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
383 if ($parameters["extra"] != "")
384 $fieldstruct .= " ".$parameters["extra"];
386 /*if (($parameters["primary"] != "") AND $create)
387 $fieldstruct .= " PRIMARY KEY";*/
389 return($fieldstruct);
392 function db_create_table($name, $fields, $charset, $verbose, $action, $indexes=null) {
400 $primary_keys = array();
401 foreach($fields AS $fieldname => $field) {
402 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
403 if (x($field,'primary') and $field['primary']!=''){
404 $primary_keys[] = $fieldname;
408 if (!is_null($indexes)) {
409 foreach ($indexes AS $indexname => $fieldnames) {
410 $sql_index = db_create_index($indexname, $fieldnames, "");
411 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
415 $sql = implode(",\n\t", $sql_rows);
417 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=".$charset;
427 function db_add_table_field($fieldname, $parameters) {
428 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
432 function db_modify_table_field($fieldname, $parameters) {
433 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
437 function db_drop_index($indexname) {
438 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
442 function db_create_index($indexname, $fieldnames, $method="ADD") {
444 $method = strtoupper(trim($method));
445 if ($method!="" && $method!="ADD") {
446 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
450 if ($fieldnames[0] == "UNIQUE") {
451 array_shift($fieldnames);
452 $method .= ' UNIQUE';
456 foreach ($fieldnames AS $fieldname) {
460 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
461 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
463 $names .= "`".dbesc($fieldname)."`";
467 if ($indexname == "PRIMARY") {
468 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
472 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
476 function db_group_by($indexname, $fieldnames) {
478 if ($fieldnames[0] != "UNIQUE") {
482 array_shift($fieldnames);
485 foreach ($fieldnames AS $fieldname) {
489 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
490 $names .= "`".dbesc($matches[1])."`";
492 $names .= "`".dbesc($fieldname)."`";
496 $sql = sprintf(" GROUP BY %s", $names);
500 function db_index_suffix($charset, $reduce = 0) {
501 if ($charset != "utf8mb4") {
505 // On utf8mb4 indexes can only have a length of 191
506 $indexlength = 191 - $reduce;
508 return "(".$indexlength.")";
511 function db_definition($charset) {
515 $database["addon"] = array(
517 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
518 "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
519 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
520 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
521 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
522 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
523 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
526 "PRIMARY" => array("id"),
527 "name" => array("UNIQUE", "name"),
530 $database["attach"] = array(
532 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
533 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
534 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
535 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
536 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
537 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
538 "data" => array("type" => "longblob", "not null" => "1"),
539 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
540 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
541 "allow_cid" => array("type" => "mediumtext"),
542 "allow_gid" => array("type" => "mediumtext"),
543 "deny_cid" => array("type" => "mediumtext"),
544 "deny_gid" => array("type" => "mediumtext"),
547 "PRIMARY" => array("id"),
550 $database["auth_codes"] = array(
552 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
553 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
554 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
555 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
556 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
559 "PRIMARY" => array("id"),
562 $database["cache"] = array(
564 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
565 "v" => array("type" => "mediumtext"),
566 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
567 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
570 "PRIMARY" => array("k"),
571 "expire_mode_updated" => array("expire_mode", "updated"),
574 $database["challenge"] = array(
576 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
577 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
578 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
579 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
580 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
581 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
584 "PRIMARY" => array("id"),
587 $database["clients"] = array(
589 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
590 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
591 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
592 "name" => array("type" => "text"),
593 "icon" => array("type" => "text"),
594 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
597 "PRIMARY" => array("client_id"),
600 $database["config"] = array(
602 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
603 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
604 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
605 "v" => array("type" => "mediumtext"),
608 "PRIMARY" => array("id"),
609 "cat_k" => array("UNIQUE", "cat", "k"),
612 $database["contact"] = array(
614 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
615 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
616 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
617 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
618 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
619 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
620 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
621 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
622 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
623 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
624 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
625 "about" => array("type" => "text"),
626 "keywords" => array("type" => "text"),
627 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
628 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
629 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
630 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
631 "photo" => array("type" => "text"),
632 "thumb" => array("type" => "text"),
633 "micro" => array("type" => "text"),
634 "site-pubkey" => array("type" => "text"),
635 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
636 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
637 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
638 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
639 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
640 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
641 "pubkey" => array("type" => "text"),
642 "prvkey" => array("type" => "text"),
643 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
644 "request" => array("type" => "text"),
645 "notify" => array("type" => "text"),
646 "poll" => array("type" => "text"),
647 "confirm" => array("type" => "text"),
648 "poco" => array("type" => "text"),
649 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
650 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
651 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
652 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
653 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
654 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
655 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
656 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
657 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
658 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
659 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
660 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
661 "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
662 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
663 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
664 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
665 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
666 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
667 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
668 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
669 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
670 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
671 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
672 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
673 "reason" => array("type" => "text"),
674 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
675 "info" => array("type" => "mediumtext"),
676 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
677 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
678 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
679 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
680 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
681 "ffi_keyword_blacklist" => array("type" => "text"),
684 "PRIMARY" => array("id"),
685 "uid_name" => array("uid", "name"),
686 "self_uid" => array("self", "uid"),
687 "alias_uid" => array("alias(32)", "uid"),
688 "pending_uid" => array("pending", "uid"),
689 "blocked_uid" => array("blocked", "uid"),
690 "uid_rel_network_poll" => array("uid", "rel", "network", "poll(64)", "archive"),
691 "uid_network_batch" => array("uid", "network", "batch(64)"),
692 "addr_uid" => array("addr(32)", "uid"),
693 "nurl_uid" => array("nurl(32)", "uid"),
694 "nick_uid" => array("nick(32)", "uid"),
695 "dfrn-id" => array("dfrn-id"),
696 "issued-id" => array("issued-id"),
699 $database["conv"] = array(
701 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
702 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
703 "recips" => array("type" => "text"),
704 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
705 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
706 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
707 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
708 "subject" => array("type" => "text"),
711 "PRIMARY" => array("id"),
712 "uid" => array("uid"),
715 $database["deliverq"] = array(
717 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
718 "cmd" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
719 "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
720 "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
723 "PRIMARY" => array("id"),
724 "cmd_item_contact" => array("UNIQUE", "cmd", "item", "contact"),
727 $database["event"] = array(
729 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
730 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
731 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
732 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
733 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
734 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
735 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
736 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
737 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
738 "summary" => array("type" => "text"),
739 "desc" => array("type" => "text"),
740 "location" => array("type" => "text"),
741 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
742 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
743 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
744 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
745 "allow_cid" => array("type" => "mediumtext"),
746 "allow_gid" => array("type" => "mediumtext"),
747 "deny_cid" => array("type" => "mediumtext"),
748 "deny_gid" => array("type" => "mediumtext"),
751 "PRIMARY" => array("id"),
752 "uid_start" => array("uid", "start"),
755 $database["fcontact"] = array(
757 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
758 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
759 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
760 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
761 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
762 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
763 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
764 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
765 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
766 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
767 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
768 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
769 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
770 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
771 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
772 "pubkey" => array("type" => "text"),
773 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
776 "PRIMARY" => array("id"),
777 "addr" => array("addr(32)"),
778 "url" => array("url"),
781 $database["ffinder"] = array(
783 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
784 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
785 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
786 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
789 "PRIMARY" => array("id"),
792 $database["fserver"] = array(
794 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
795 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
796 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
797 "key" => array("type" => "text"),
800 "PRIMARY" => array("id"),
801 "server" => array("server(32)"),
804 $database["fsuggest"] = array(
806 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
807 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
808 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
809 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
810 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
811 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
812 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
813 "note" => array("type" => "text"),
814 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
817 "PRIMARY" => array("id"),
820 $database["gcign"] = array(
822 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
823 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
824 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
827 "PRIMARY" => array("id"),
828 "uid" => array("uid"),
829 "gcid" => array("gcid"),
832 $database["gcontact"] = array(
834 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
835 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
836 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
837 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
838 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
839 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
840 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
841 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
842 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
843 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
844 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
845 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
846 "about" => array("type" => "text"),
847 "keywords" => array("type" => "text"),
848 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
849 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
850 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
851 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
852 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
853 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
854 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
855 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
856 "notify" => array("type" => "text"),
857 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
858 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
859 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
862 "PRIMARY" => array("id"),
863 "nurl" => array("nurl(64)"),
864 "name" => array("name(64)"),
865 "nick" => array("nick(32)"),
866 "addr" => array("addr(64)"),
867 "hide_network_updated" => array("hide", "network", "updated"),
868 "updated" => array("updated"),
871 $database["glink"] = array(
873 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
874 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
875 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
876 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
877 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
878 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
881 "PRIMARY" => array("id"),
882 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
883 "gcid" => array("gcid"),
886 $database["group"] = array(
888 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
889 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
890 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
891 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
892 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
895 "PRIMARY" => array("id"),
896 "uid" => array("uid"),
899 $database["group_member"] = array(
901 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
902 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
903 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
904 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
907 "PRIMARY" => array("id"),
908 "contactid" => array("contact-id"),
909 "gid_contactid" => array("gid", "contact-id"),
910 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
913 $database["gserver"] = array(
915 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
916 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
917 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
918 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
919 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
920 "info" => array("type" => "text"),
921 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
922 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
923 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
924 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
925 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
926 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
927 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
928 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
929 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
932 "PRIMARY" => array("id"),
933 "nurl" => array("nurl(32)"),
936 $database["hook"] = array(
938 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
939 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
940 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
941 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
942 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
945 "PRIMARY" => array("id"),
946 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
949 $database["intro"] = array(
951 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
952 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
953 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
954 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
955 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
956 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
957 "note" => array("type" => "text"),
958 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
959 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
960 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
961 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
964 "PRIMARY" => array("id"),
967 $database["item"] = array(
969 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
970 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
971 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
972 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
973 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
974 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
975 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
976 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
977 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
978 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
979 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
980 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
981 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
982 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
983 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
984 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
985 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
986 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
987 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
988 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
989 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
990 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
991 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
992 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
993 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
994 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
995 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
996 "body" => array("type" => "mediumtext"),
997 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
998 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
999 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1000 "object" => array("type" => "text"),
1001 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1002 "target" => array("type" => "text"),
1003 "postopts" => array("type" => "text"),
1004 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1005 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1006 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1007 "tag" => array("type" => "mediumtext"),
1008 "attach" => array("type" => "mediumtext"),
1009 "inform" => array("type" => "mediumtext"),
1010 "file" => array("type" => "mediumtext"),
1011 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1012 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1013 "allow_cid" => array("type" => "mediumtext"),
1014 "allow_gid" => array("type" => "mediumtext"),
1015 "deny_cid" => array("type" => "mediumtext"),
1016 "deny_gid" => array("type" => "mediumtext"),
1017 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1018 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1019 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1020 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1021 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1022 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1023 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1024 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1025 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1026 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1027 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1028 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1029 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1030 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1031 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1032 "rendered-html" => array("type" => "mediumtext"),
1033 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1036 "PRIMARY" => array("id"),
1037 "guid" => array("guid"),
1038 "uri" => array("uri"),
1039 "parent" => array("parent"),
1040 "parent-uri" => array("parent-uri"),
1041 "extid" => array("extid"),
1042 "uid_id" => array("uid","id"),
1043 "uid_contactid_id" => array("uid","contact-id","id"),
1044 "uid_created" => array("uid","created"),
1045 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1046 "uid_network_received" => array("uid","network","received"),
1047 "uid_network_commented" => array("uid","network","commented"),
1048 "uid_thrparent" => array("uid","thr-parent"),
1049 "uid_parenturi" => array("uid","parent-uri"),
1050 "uid_contactid_created" => array("uid","contact-id","created"),
1051 "authorid_created" => array("author-id","created"),
1052 "uid_uri" => array("uid", "uri"),
1053 "resource-id" => array("resource-id"),
1054 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1055 "uid_type_changed" => array("uid","type","changed"),
1056 "contactid_verb" => array("contact-id","verb"),
1057 "deleted_changed" => array("deleted","changed"),
1058 "uid_wall_changed" => array("uid","wall","changed"),
1059 "uid_eventid" => array("uid","event-id"),
1060 "uid_authorlink" => array("uid","author-link"),
1061 "uid_ownerlink" => array("uid","owner-link"),
1064 $database["item_id"] = array(
1066 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1067 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1068 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1069 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1070 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1073 "PRIMARY" => array("id"),
1074 "uid" => array("uid"),
1075 "sid" => array("sid"),
1076 "service" => array("service(32)"),
1077 "iid" => array("iid"),
1080 $database["locks"] = array(
1082 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1083 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1084 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1085 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
1088 "PRIMARY" => array("id"),
1091 $database["mail"] = array(
1093 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1094 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1095 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1096 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1097 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1098 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1099 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1100 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1101 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1102 "body" => array("type" => "mediumtext"),
1103 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1104 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1105 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1106 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1107 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1108 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1109 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1112 "PRIMARY" => array("id"),
1113 "uid_seen" => array("uid", "seen"),
1114 "convid" => array("convid"),
1115 "uri" => array("uri(64)"),
1116 "parent-uri" => array("parent-uri(64)"),
1119 $database["mailacct"] = array(
1121 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1122 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1123 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1124 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1125 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1126 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1127 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1128 "pass" => array("type" => "text"),
1129 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1130 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1131 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1132 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1133 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1136 "PRIMARY" => array("id"),
1139 $database["manage"] = array(
1141 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1142 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1143 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1146 "PRIMARY" => array("id"),
1147 "uid_mid" => array("UNIQUE", "uid","mid"),
1150 $database["notify"] = array(
1152 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1153 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1154 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1155 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1156 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1157 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1158 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1159 "msg" => array("type" => "mediumtext"),
1160 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1161 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1162 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1163 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1164 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1165 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1166 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1167 "name_cache" => array("type" => "tinytext"),
1168 "msg_cache" => array("type" => "mediumtext")
1171 "PRIMARY" => array("id"),
1172 "hash_uid" => array("hash", "uid"),
1173 "seen_uid_date" => array("seen", "uid", "date"),
1174 "uid_date" => array("uid", "date"),
1175 "uid_type_link" => array("uid", "type", "link"),
1178 $database["notify-threads"] = array(
1180 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1181 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1182 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1183 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1184 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1187 "PRIMARY" => array("id"),
1190 $database["oembed"] = array(
1192 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1193 "content" => array("type" => "mediumtext"),
1194 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1197 "PRIMARY" => array("url"),
1198 "created" => array("created"),
1201 $database["parsed_url"] = array(
1203 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1204 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1205 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1206 "content" => array("type" => "mediumtext"),
1207 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1210 "PRIMARY" => array("url", "guessing", "oembed"),
1211 "created" => array("created"),
1214 $database["pconfig"] = array(
1216 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1217 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1218 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1219 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1220 "v" => array("type" => "mediumtext"),
1223 "PRIMARY" => array("id"),
1224 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1227 $database["photo"] = array(
1229 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1230 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1231 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1232 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1233 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1234 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1235 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1236 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1237 "desc" => array("type" => "text"),
1238 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1239 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1240 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1241 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1242 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1243 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1244 "data" => array("type" => "mediumblob", "not null" => "1"),
1245 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1246 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1247 "allow_cid" => array("type" => "mediumtext"),
1248 "allow_gid" => array("type" => "mediumtext"),
1249 "deny_cid" => array("type" => "mediumtext"),
1250 "deny_gid" => array("type" => "mediumtext"),
1253 "PRIMARY" => array("id"),
1254 "uid_contactid" => array("uid", "contact-id"),
1255 "uid_profile" => array("uid", "profile"),
1256 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1257 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1258 "resource-id" => array("resource-id(64)"),
1261 $database["poll"] = array(
1263 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1264 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1265 "q0" => array("type" => "text"),
1266 "q1" => array("type" => "text"),
1267 "q2" => array("type" => "text"),
1268 "q3" => array("type" => "text"),
1269 "q4" => array("type" => "text"),
1270 "q5" => array("type" => "text"),
1271 "q6" => array("type" => "text"),
1272 "q7" => array("type" => "text"),
1273 "q8" => array("type" => "text"),
1274 "q9" => array("type" => "text"),
1277 "PRIMARY" => array("id"),
1278 "uid" => array("uid"),
1281 $database["poll_result"] = array(
1283 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1284 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1285 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1288 "PRIMARY" => array("id"),
1289 "poll_id" => array("poll_id"),
1290 "choice" => array("choice"),
1293 $database["process"] = array(
1295 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1296 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1297 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1300 "PRIMARY" => array("pid"),
1301 "command" => array("command"),
1304 $database["profile"] = array(
1306 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1307 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1308 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1309 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1310 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1311 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1312 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1313 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1314 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1315 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1316 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1317 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1318 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1319 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1320 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1321 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1322 "with" => array("type" => "text"),
1323 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1324 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1325 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1326 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1327 "pub_keywords" => array("type" => "text"),
1328 "prv_keywords" => array("type" => "text"),
1329 "likes" => array("type" => "text"),
1330 "dislikes" => array("type" => "text"),
1331 "about" => array("type" => "text"),
1332 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1333 "music" => array("type" => "text"),
1334 "book" => array("type" => "text"),
1335 "tv" => array("type" => "text"),
1336 "film" => array("type" => "text"),
1337 "interest" => array("type" => "text"),
1338 "romance" => array("type" => "text"),
1339 "work" => array("type" => "text"),
1340 "education" => array("type" => "text"),
1341 "contact" => array("type" => "text"),
1342 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1343 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1344 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1345 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1346 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1347 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1350 "PRIMARY" => array("id"),
1351 "uid_is-default" => array("uid", "is-default"),
1354 $database["profile_check"] = array(
1356 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1357 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1358 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1359 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1360 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1361 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1364 "PRIMARY" => array("id"),
1367 $database["push_subscriber"] = array(
1369 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1370 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1371 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1372 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1373 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1374 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1375 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1376 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1379 "PRIMARY" => array("id"),
1382 $database["queue"] = array(
1384 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1385 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1386 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1387 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1388 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1389 "content" => array("type" => "mediumtext"),
1390 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1393 "PRIMARY" => array("id"),
1394 "cid" => array("cid"),
1395 "created" => array("created"),
1396 "last" => array("last"),
1397 "network" => array("network"),
1398 "batch" => array("batch"),
1401 $database["register"] = array(
1403 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1404 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1405 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1406 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1407 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1408 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1409 "note" => array("type" => "text"),
1412 "PRIMARY" => array("id"),
1415 $database["search"] = array(
1417 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1418 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1419 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1422 "PRIMARY" => array("id"),
1423 "uid" => array("uid"),
1426 $database["session"] = array(
1428 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1429 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1430 "data" => array("type" => "text"),
1431 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1434 "PRIMARY" => array("id"),
1435 "sid" => array("sid(64)"),
1436 "expire" => array("expire"),
1439 $database["sign"] = array(
1441 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1442 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1443 "signed_text" => array("type" => "mediumtext"),
1444 "signature" => array("type" => "text"),
1445 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1448 "PRIMARY" => array("id"),
1449 "iid" => array("iid"),
1452 $database["spam"] = array(
1454 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1455 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1456 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1457 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1458 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1459 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1462 "PRIMARY" => array("id"),
1463 "uid" => array("uid"),
1464 "spam" => array("spam"),
1465 "ham" => array("ham"),
1466 "term" => array("term"),
1469 $database["term"] = array(
1471 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1472 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1473 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1474 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1475 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1476 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1477 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1478 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1479 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1480 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1481 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1482 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1485 "PRIMARY" => array("tid"),
1486 "oid_otype_type_term" => array("oid","otype","type","term"),
1487 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1488 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1489 "guid" => array("guid(64)"),
1492 $database["thread"] = array(
1494 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1495 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1496 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1497 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1498 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1499 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1500 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1501 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1502 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1503 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1504 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1505 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1506 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1507 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1508 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1509 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1510 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1511 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1512 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1513 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1514 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1515 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1516 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1517 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1518 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1519 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1522 "PRIMARY" => array("iid"),
1523 "uid_network_commented" => array("uid","network","commented"),
1524 "uid_network_created" => array("uid","network","created"),
1525 "uid_contactid_commented" => array("uid","contact-id","commented"),
1526 "uid_contactid_created" => array("uid","contact-id","created"),
1527 "uid_created" => array("uid","created"),
1528 "uid_commented" => array("uid","commented"),
1531 $database["tokens"] = array(
1533 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1534 "secret" => array("type" => "text"),
1535 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1536 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1537 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1538 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1541 "PRIMARY" => array("id"),
1544 $database["user"] = array(
1546 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1547 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1548 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1549 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1550 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1551 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1552 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1553 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1554 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1555 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1556 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1557 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1558 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1559 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1560 "pubkey" => array("type" => "text"),
1561 "prvkey" => array("type" => "text"),
1562 "spubkey" => array("type" => "text"),
1563 "sprvkey" => array("type" => "text"),
1564 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1565 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1566 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1567 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1568 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1569 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1570 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1571 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1572 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1573 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1574 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1575 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1576 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1577 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1578 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1579 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1580 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1581 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1582 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1583 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1584 "allow_cid" => array("type" => "mediumtext"),
1585 "allow_gid" => array("type" => "mediumtext"),
1586 "deny_cid" => array("type" => "mediumtext"),
1587 "deny_gid" => array("type" => "mediumtext"),
1588 "openidserver" => array("type" => "text"),
1591 "PRIMARY" => array("uid"),
1592 "nickname" => array("nickname(32)"),
1595 $database["userd"] = array(
1597 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1598 "username" => array("type" => "varchar(255)", "not null" => "1"),
1601 "PRIMARY" => array("id"),
1602 "username" => array("username(32)"),
1605 $database["workerqueue"] = array(
1607 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1608 "parameter" => array("type" => "text"),
1609 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1610 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1611 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1612 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1615 "PRIMARY" => array("id"),
1624 * run from command line
1626 function dbstructure_run(&$argv, &$argc) {
1634 @include(".htconfig.php");
1635 require_once("include/dba.php");
1636 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1637 unset($db_host, $db_user, $db_pass, $db_data);
1643 update_structure(true, false);
1646 update_structure(true, true);
1648 $build = get_config('system','build');
1650 set_config('system','build',DB_UPDATE_VERSION);
1651 $build = DB_UPDATE_VERSION;
1654 $stored = intval($build);
1655 $current = intval(DB_UPDATE_VERSION);
1657 // run any left update_nnnn functions in update.php
1658 for($x = $stored; $x < $current; $x ++) {
1659 $r = run_update_function($x);
1663 set_config('system','build',DB_UPDATE_VERSION);
1666 // For the dump that is used to create the database.sql we always assume utfmb4
1667 $charset = "utf8mb4";
1668 print_structure(db_definition($charset), $charset);
1675 echo $argv[0]." <command>\n";
1678 echo "dryrun show database update schema queries without running them\n";
1679 echo "update update database schema\n";
1680 echo "dumpsql dump database schema\n";
1685 if (array_search(__file__,get_included_files())===0){
1686 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);