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_created" => array("uid","created"),
1044 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1045 "uid_network_received" => array("uid","network","received"),
1046 "uid_network_commented" => array("uid","network","commented"),
1047 "uid_thrparent" => array("uid","thr-parent"),
1048 "uid_parenturi" => array("uid","parent-uri"),
1049 "uid_contactid_created" => array("uid","contact-id","created"),
1050 "authorid_created" => array("author-id","created"),
1051 "uid_uri" => array("uid", "uri"),
1052 "resource-id" => array("resource-id"),
1053 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1054 "uid_type_changed" => array("uid","type","changed"),
1055 "contactid_verb" => array("contact-id","verb"),
1056 "deleted_changed" => array("deleted","changed"),
1057 "uid_wall_changed" => array("uid","wall","changed"),
1058 "uid_eventid" => array("uid","event-id"),
1059 "uid_authorlink" => array("uid","author-link"),
1060 "uid_ownerlink" => array("uid","owner-link"),
1063 $database["item_id"] = array(
1065 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1066 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1067 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1068 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1069 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1072 "PRIMARY" => array("id"),
1073 "uid" => array("uid"),
1074 "sid" => array("sid"),
1075 "service" => array("service(32)"),
1076 "iid" => array("iid"),
1079 $database["locks"] = array(
1081 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1082 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1083 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1084 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
1087 "PRIMARY" => array("id"),
1090 $database["mail"] = array(
1092 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1093 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1094 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1095 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1096 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1097 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1098 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1099 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1100 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1101 "body" => array("type" => "mediumtext"),
1102 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1103 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1104 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1105 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1106 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1107 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1108 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1111 "PRIMARY" => array("id"),
1112 "uid_seen" => array("uid", "seen"),
1113 "convid" => array("convid"),
1114 "uri" => array("uri(64)"),
1115 "parent-uri" => array("parent-uri(64)"),
1118 $database["mailacct"] = array(
1120 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1121 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1122 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1123 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1124 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1125 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1126 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1127 "pass" => array("type" => "text"),
1128 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1129 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1130 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1131 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1132 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1135 "PRIMARY" => array("id"),
1138 $database["manage"] = array(
1140 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1141 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1142 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1145 "PRIMARY" => array("id"),
1146 "uid_mid" => array("UNIQUE", "uid","mid"),
1149 $database["notify"] = array(
1151 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1152 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1153 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1154 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1155 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1156 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1157 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1158 "msg" => array("type" => "mediumtext"),
1159 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1160 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1161 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1162 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1163 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1164 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1165 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1166 "name_cache" => array("type" => "tinytext"),
1167 "msg_cache" => array("type" => "mediumtext")
1170 "PRIMARY" => array("id"),
1171 "hash_uid" => array("hash", "uid"),
1172 "seen_uid_date" => array("seen", "uid", "date"),
1173 "uid_date" => array("uid", "date"),
1174 "uid_type_link" => array("uid", "type", "link"),
1177 $database["notify-threads"] = array(
1179 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1180 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1181 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1182 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1183 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1186 "PRIMARY" => array("id"),
1189 $database["oembed"] = array(
1191 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1192 "content" => array("type" => "mediumtext"),
1193 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1196 "PRIMARY" => array("url"),
1197 "created" => array("created"),
1200 $database["parsed_url"] = array(
1202 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1203 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1204 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1205 "content" => array("type" => "mediumtext"),
1206 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1209 "PRIMARY" => array("url", "guessing", "oembed"),
1210 "created" => array("created"),
1213 $database["pconfig"] = array(
1215 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1216 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1217 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1218 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1219 "v" => array("type" => "mediumtext"),
1222 "PRIMARY" => array("id"),
1223 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1226 $database["photo"] = array(
1228 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1229 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1230 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1231 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1232 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1233 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1234 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1235 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1236 "desc" => array("type" => "text"),
1237 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1238 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1239 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1240 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1241 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1242 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1243 "data" => array("type" => "mediumblob", "not null" => "1"),
1244 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1245 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1246 "allow_cid" => array("type" => "mediumtext"),
1247 "allow_gid" => array("type" => "mediumtext"),
1248 "deny_cid" => array("type" => "mediumtext"),
1249 "deny_gid" => array("type" => "mediumtext"),
1252 "PRIMARY" => array("id"),
1253 "uid_contactid" => array("uid", "contact-id"),
1254 "uid_profile" => array("uid", "profile"),
1255 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1256 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1257 "resource-id" => array("resource-id(64)"),
1260 $database["poll"] = array(
1262 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1263 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1264 "q0" => array("type" => "text"),
1265 "q1" => array("type" => "text"),
1266 "q2" => array("type" => "text"),
1267 "q3" => array("type" => "text"),
1268 "q4" => array("type" => "text"),
1269 "q5" => array("type" => "text"),
1270 "q6" => array("type" => "text"),
1271 "q7" => array("type" => "text"),
1272 "q8" => array("type" => "text"),
1273 "q9" => array("type" => "text"),
1276 "PRIMARY" => array("id"),
1277 "uid" => array("uid"),
1280 $database["poll_result"] = array(
1282 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1283 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1284 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1287 "PRIMARY" => array("id"),
1288 "poll_id" => array("poll_id"),
1289 "choice" => array("choice"),
1292 $database["process"] = array(
1294 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1295 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1296 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1299 "PRIMARY" => array("pid"),
1300 "command" => array("command"),
1303 $database["profile"] = array(
1305 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1306 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1307 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1308 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1309 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1310 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1311 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1312 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1313 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1314 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1315 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1316 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1317 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1318 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1319 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1320 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1321 "with" => array("type" => "text"),
1322 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1323 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1324 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1325 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1326 "pub_keywords" => array("type" => "text"),
1327 "prv_keywords" => array("type" => "text"),
1328 "likes" => array("type" => "text"),
1329 "dislikes" => array("type" => "text"),
1330 "about" => array("type" => "text"),
1331 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1332 "music" => array("type" => "text"),
1333 "book" => array("type" => "text"),
1334 "tv" => array("type" => "text"),
1335 "film" => array("type" => "text"),
1336 "interest" => array("type" => "text"),
1337 "romance" => array("type" => "text"),
1338 "work" => array("type" => "text"),
1339 "education" => array("type" => "text"),
1340 "contact" => array("type" => "text"),
1341 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1342 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1343 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1344 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1345 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1346 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1349 "PRIMARY" => array("id"),
1350 "uid_is-default" => array("uid", "is-default"),
1353 $database["profile_check"] = array(
1355 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1356 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1357 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1358 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1359 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1360 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1363 "PRIMARY" => array("id"),
1366 $database["push_subscriber"] = array(
1368 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1369 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1370 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1371 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1372 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1373 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1374 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1375 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1378 "PRIMARY" => array("id"),
1381 $database["queue"] = array(
1383 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1384 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1385 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1386 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1387 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1388 "content" => array("type" => "mediumtext"),
1389 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1392 "PRIMARY" => array("id"),
1393 "cid" => array("cid"),
1394 "created" => array("created"),
1395 "last" => array("last"),
1396 "network" => array("network"),
1397 "batch" => array("batch"),
1400 $database["register"] = array(
1402 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1403 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1404 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1405 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1406 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1407 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1408 "note" => array("type" => "text"),
1411 "PRIMARY" => array("id"),
1414 $database["search"] = array(
1416 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1417 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1418 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1421 "PRIMARY" => array("id"),
1422 "uid" => array("uid"),
1425 $database["session"] = array(
1427 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1428 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1429 "data" => array("type" => "text"),
1430 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1433 "PRIMARY" => array("id"),
1434 "sid" => array("sid(64)"),
1435 "expire" => array("expire"),
1438 $database["sign"] = array(
1440 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1441 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1442 "signed_text" => array("type" => "mediumtext"),
1443 "signature" => array("type" => "text"),
1444 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1447 "PRIMARY" => array("id"),
1448 "iid" => array("iid"),
1451 $database["spam"] = array(
1453 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1454 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1455 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1456 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1457 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1458 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1461 "PRIMARY" => array("id"),
1462 "uid" => array("uid"),
1463 "spam" => array("spam"),
1464 "ham" => array("ham"),
1465 "term" => array("term"),
1468 $database["term"] = array(
1470 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1471 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1472 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1473 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1474 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1475 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1476 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1477 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1478 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1479 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1480 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1481 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1484 "PRIMARY" => array("tid"),
1485 "oid_otype_type_term" => array("oid","otype","type","term"),
1486 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1487 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1488 "guid" => array("guid(64)"),
1491 $database["thread"] = array(
1493 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1494 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1495 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1496 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1497 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1498 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1499 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1500 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1501 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1502 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1503 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1504 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1505 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1506 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1507 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1508 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1509 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1510 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1511 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1512 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1513 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1514 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1515 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1516 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1517 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1518 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1521 "PRIMARY" => array("iid"),
1522 "uid_network_commented" => array("uid","network","commented"),
1523 "uid_network_created" => array("uid","network","created"),
1524 "uid_contactid_commented" => array("uid","contact-id","commented"),
1525 "uid_contactid_created" => array("uid","contact-id","created"),
1526 "uid_created" => array("uid","created"),
1527 "uid_commented" => array("uid","commented"),
1530 $database["tokens"] = array(
1532 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1533 "secret" => array("type" => "text"),
1534 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1535 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1536 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1537 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1540 "PRIMARY" => array("id"),
1543 $database["user"] = array(
1545 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1546 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1547 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1548 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1549 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1550 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1551 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1552 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1553 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1554 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1555 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1556 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1557 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1558 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1559 "pubkey" => array("type" => "text"),
1560 "prvkey" => array("type" => "text"),
1561 "spubkey" => array("type" => "text"),
1562 "sprvkey" => array("type" => "text"),
1563 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1564 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1565 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1566 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1567 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1568 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1569 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1570 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1571 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1572 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1573 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1574 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1575 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1576 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1577 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1578 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1579 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1580 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1581 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1582 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1583 "allow_cid" => array("type" => "mediumtext"),
1584 "allow_gid" => array("type" => "mediumtext"),
1585 "deny_cid" => array("type" => "mediumtext"),
1586 "deny_gid" => array("type" => "mediumtext"),
1587 "openidserver" => array("type" => "text"),
1590 "PRIMARY" => array("uid"),
1591 "nickname" => array("nickname(32)"),
1594 $database["userd"] = array(
1596 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1597 "username" => array("type" => "varchar(255)", "not null" => "1"),
1600 "PRIMARY" => array("id"),
1601 "username" => array("username(32)"),
1604 $database["workerqueue"] = array(
1606 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1607 "parameter" => array("type" => "text"),
1608 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1609 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1610 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1611 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1614 "PRIMARY" => array("id"),
1623 * run from command line
1625 function dbstructure_run(&$argv, &$argc) {
1633 @include(".htconfig.php");
1634 require_once("include/dba.php");
1635 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1636 unset($db_host, $db_user, $db_pass, $db_data);
1642 update_structure(true, false);
1645 update_structure(true, true);
1647 $build = get_config('system','build');
1649 set_config('system','build',DB_UPDATE_VERSION);
1650 $build = DB_UPDATE_VERSION;
1653 $stored = intval($build);
1654 $current = intval(DB_UPDATE_VERSION);
1656 // run any left update_nnnn functions in update.php
1657 for($x = $stored; $x < $current; $x ++) {
1658 $r = run_update_function($x);
1662 set_config('system','build',DB_UPDATE_VERSION);
1665 // For the dump that is used to create the database.sql we always assume utfmb4
1666 $charset = "utf8mb4";
1667 print_structure(db_definition($charset), $charset);
1674 echo $argv[0]." <command>\n";
1677 echo "dryrun show database update schema queries without running them\n";
1678 echo "update update database schema\n";
1679 echo "dumpsql dump database schema\n";
1684 if (array_search(__file__,get_included_files())===0){
1685 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);