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" . $ignore . " 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" . $ignore . " 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["event"] = array(
717 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
718 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
719 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
720 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
721 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
722 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
723 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
724 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
725 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
726 "summary" => array("type" => "text"),
727 "desc" => array("type" => "text"),
728 "location" => array("type" => "text"),
729 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
730 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
731 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
732 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
733 "allow_cid" => array("type" => "mediumtext"),
734 "allow_gid" => array("type" => "mediumtext"),
735 "deny_cid" => array("type" => "mediumtext"),
736 "deny_gid" => array("type" => "mediumtext"),
739 "PRIMARY" => array("id"),
740 "uid_start" => array("uid", "start"),
743 $database["fcontact"] = array(
745 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
746 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
747 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
748 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
749 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
750 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
751 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
752 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
753 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
754 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
755 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
756 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
757 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
758 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
759 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
760 "pubkey" => array("type" => "text"),
761 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
764 "PRIMARY" => array("id"),
765 "addr" => array("addr(32)"),
766 "url" => array("url"),
769 $database["ffinder"] = array(
771 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
772 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
773 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
774 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
777 "PRIMARY" => array("id"),
780 $database["fserver"] = array(
782 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
783 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
784 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
785 "key" => array("type" => "text"),
788 "PRIMARY" => array("id"),
789 "server" => array("server(32)"),
792 $database["fsuggest"] = array(
794 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
795 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
796 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
797 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
798 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
799 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
800 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
801 "note" => array("type" => "text"),
802 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
805 "PRIMARY" => array("id"),
808 $database["gcign"] = array(
810 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
811 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
812 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
815 "PRIMARY" => array("id"),
816 "uid" => array("uid"),
817 "gcid" => array("gcid"),
820 $database["gcontact"] = array(
822 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
823 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
824 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
825 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
826 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
827 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
828 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
829 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
830 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
831 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
832 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
833 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
834 "about" => array("type" => "text"),
835 "keywords" => array("type" => "text"),
836 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
837 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
838 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
839 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
840 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
841 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
842 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
843 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
844 "notify" => array("type" => "text"),
845 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
846 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
847 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
850 "PRIMARY" => array("id"),
851 "nurl" => array("nurl(64)"),
852 "name" => array("name(64)"),
853 "nick" => array("nick(32)"),
854 "addr" => array("addr(64)"),
855 "hide_network_updated" => array("hide", "network", "updated"),
856 "updated" => array("updated"),
859 $database["glink"] = array(
861 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
862 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
863 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
864 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
865 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
866 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
869 "PRIMARY" => array("id"),
870 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
871 "gcid" => array("gcid"),
874 $database["group"] = array(
876 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
877 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
878 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
879 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
880 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
883 "PRIMARY" => array("id"),
884 "uid" => array("uid"),
887 $database["group_member"] = array(
889 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
890 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
891 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
892 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
895 "PRIMARY" => array("id"),
896 "contactid" => array("contact-id"),
897 "gid_contactid" => array("gid", "contact-id"),
898 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
901 $database["gserver"] = array(
903 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
904 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
905 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
906 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
907 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
908 "info" => array("type" => "text"),
909 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
910 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
911 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
912 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
913 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
914 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
915 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
916 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
917 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
920 "PRIMARY" => array("id"),
921 "nurl" => array("nurl(32)"),
924 $database["hook"] = array(
926 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
927 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
928 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
929 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
930 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
933 "PRIMARY" => array("id"),
934 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
937 $database["intro"] = array(
939 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
940 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
941 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
942 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
943 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
944 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
945 "note" => array("type" => "text"),
946 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
947 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
948 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
949 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
952 "PRIMARY" => array("id"),
955 $database["item"] = array(
957 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
958 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
959 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
960 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
961 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
962 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
963 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
964 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
965 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
966 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
967 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
968 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
969 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
970 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
971 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
972 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
973 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
974 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
975 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
976 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
977 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
978 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
979 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
980 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
981 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
982 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
983 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
984 "body" => array("type" => "mediumtext"),
985 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
986 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
987 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
988 "object" => array("type" => "text"),
989 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
990 "target" => array("type" => "text"),
991 "postopts" => array("type" => "text"),
992 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
993 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
994 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
995 "tag" => array("type" => "mediumtext"),
996 "attach" => array("type" => "mediumtext"),
997 "inform" => array("type" => "mediumtext"),
998 "file" => array("type" => "mediumtext"),
999 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1000 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1001 "allow_cid" => array("type" => "mediumtext"),
1002 "allow_gid" => array("type" => "mediumtext"),
1003 "deny_cid" => array("type" => "mediumtext"),
1004 "deny_gid" => array("type" => "mediumtext"),
1005 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1006 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1007 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1008 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1009 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1010 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1011 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1012 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1013 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1014 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1015 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1016 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1017 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1018 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1019 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1020 "rendered-html" => array("type" => "mediumtext"),
1021 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1024 "PRIMARY" => array("id"),
1025 "guid" => array("guid"),
1026 "uri" => array("uri"),
1027 "parent" => array("parent"),
1028 "parent-uri" => array("parent-uri"),
1029 "extid" => array("extid"),
1030 "uid_id" => array("uid","id"),
1031 "uid_contactid_id" => array("uid","contact-id","id"),
1032 "uid_created" => array("uid","created"),
1033 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1034 "uid_network_received" => array("uid","network","received"),
1035 "uid_network_commented" => array("uid","network","commented"),
1036 "uid_thrparent" => array("uid","thr-parent"),
1037 "uid_parenturi" => array("uid","parent-uri"),
1038 "uid_contactid_created" => array("uid","contact-id","created"),
1039 "authorid_created" => array("author-id","created"),
1040 "uid_uri" => array("uid", "uri"),
1041 "resource-id" => array("resource-id"),
1042 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1043 "uid_type_changed" => array("uid","type","changed"),
1044 "contactid_verb" => array("contact-id","verb"),
1045 "deleted_changed" => array("deleted","changed"),
1046 "uid_wall_changed" => array("uid","wall","changed"),
1047 "uid_eventid" => array("uid","event-id"),
1048 "uid_authorlink" => array("uid","author-link"),
1049 "uid_ownerlink" => array("uid","owner-link"),
1052 $database["item_id"] = array(
1054 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1055 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1056 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1057 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1058 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1061 "PRIMARY" => array("id"),
1062 "uid" => array("uid"),
1063 "sid" => array("sid"),
1064 "service" => array("service(32)"),
1065 "iid" => array("iid"),
1068 $database["locks"] = array(
1070 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1071 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1072 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1073 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
1076 "PRIMARY" => array("id"),
1079 $database["mail"] = array(
1081 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1082 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1083 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1084 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1085 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1086 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1087 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1088 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1089 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1090 "body" => array("type" => "mediumtext"),
1091 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1092 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1093 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1094 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1095 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1096 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1097 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1100 "PRIMARY" => array("id"),
1101 "uid_seen" => array("uid", "seen"),
1102 "convid" => array("convid"),
1103 "uri" => array("uri(64)"),
1104 "parent-uri" => array("parent-uri(64)"),
1107 $database["mailacct"] = array(
1109 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1110 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1111 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1112 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1113 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1114 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1115 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1116 "pass" => array("type" => "text"),
1117 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1118 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1119 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1120 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1121 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1124 "PRIMARY" => array("id"),
1127 $database["manage"] = array(
1129 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1130 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1131 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1134 "PRIMARY" => array("id"),
1135 "uid_mid" => array("UNIQUE", "uid","mid"),
1138 $database["notify"] = array(
1140 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1141 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1142 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1143 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1144 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1145 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1146 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1147 "msg" => array("type" => "mediumtext"),
1148 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1149 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1150 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1151 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1152 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1153 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1154 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1155 "name_cache" => array("type" => "tinytext"),
1156 "msg_cache" => array("type" => "mediumtext")
1159 "PRIMARY" => array("id"),
1160 "hash_uid" => array("hash", "uid"),
1161 "seen_uid_date" => array("seen", "uid", "date"),
1162 "uid_date" => array("uid", "date"),
1163 "uid_type_link" => array("uid", "type", "link"),
1166 $database["notify-threads"] = array(
1168 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1169 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1170 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1171 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1172 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1175 "PRIMARY" => array("id"),
1178 $database["oembed"] = array(
1180 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1181 "content" => array("type" => "mediumtext"),
1182 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1185 "PRIMARY" => array("url"),
1186 "created" => array("created"),
1189 $database["parsed_url"] = array(
1191 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1192 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1193 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1194 "content" => array("type" => "mediumtext"),
1195 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1198 "PRIMARY" => array("url", "guessing", "oembed"),
1199 "created" => array("created"),
1202 $database["pconfig"] = array(
1204 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1205 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1206 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1207 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1208 "v" => array("type" => "mediumtext"),
1211 "PRIMARY" => array("id"),
1212 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1215 $database["photo"] = array(
1217 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1218 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1219 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1220 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1221 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1222 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1223 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1224 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1225 "desc" => array("type" => "text"),
1226 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1227 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1228 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1229 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1230 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1231 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1232 "data" => array("type" => "mediumblob", "not null" => "1"),
1233 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1234 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1235 "allow_cid" => array("type" => "mediumtext"),
1236 "allow_gid" => array("type" => "mediumtext"),
1237 "deny_cid" => array("type" => "mediumtext"),
1238 "deny_gid" => array("type" => "mediumtext"),
1241 "PRIMARY" => array("id"),
1242 "uid_contactid" => array("uid", "contact-id"),
1243 "uid_profile" => array("uid", "profile"),
1244 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1245 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1246 "resource-id" => array("resource-id(64)"),
1249 $database["poll"] = array(
1251 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1252 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1253 "q0" => array("type" => "text"),
1254 "q1" => array("type" => "text"),
1255 "q2" => array("type" => "text"),
1256 "q3" => array("type" => "text"),
1257 "q4" => array("type" => "text"),
1258 "q5" => array("type" => "text"),
1259 "q6" => array("type" => "text"),
1260 "q7" => array("type" => "text"),
1261 "q8" => array("type" => "text"),
1262 "q9" => array("type" => "text"),
1265 "PRIMARY" => array("id"),
1266 "uid" => array("uid"),
1269 $database["poll_result"] = array(
1271 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1272 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1273 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1276 "PRIMARY" => array("id"),
1277 "poll_id" => array("poll_id"),
1278 "choice" => array("choice"),
1281 $database["process"] = array(
1283 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1284 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1285 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1288 "PRIMARY" => array("pid"),
1289 "command" => array("command"),
1292 $database["profile"] = array(
1294 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1295 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1296 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1297 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1298 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1299 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1300 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1301 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1302 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1303 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1304 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1305 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1306 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1307 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1308 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1309 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1310 "with" => array("type" => "text"),
1311 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1312 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1313 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1314 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1315 "pub_keywords" => array("type" => "text"),
1316 "prv_keywords" => array("type" => "text"),
1317 "likes" => array("type" => "text"),
1318 "dislikes" => array("type" => "text"),
1319 "about" => array("type" => "text"),
1320 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1321 "music" => array("type" => "text"),
1322 "book" => array("type" => "text"),
1323 "tv" => array("type" => "text"),
1324 "film" => array("type" => "text"),
1325 "interest" => array("type" => "text"),
1326 "romance" => array("type" => "text"),
1327 "work" => array("type" => "text"),
1328 "education" => array("type" => "text"),
1329 "contact" => array("type" => "text"),
1330 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1331 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1332 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1333 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1334 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1335 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1338 "PRIMARY" => array("id"),
1339 "uid_is-default" => array("uid", "is-default"),
1342 $database["profile_check"] = array(
1344 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1345 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1346 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1347 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1348 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1349 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1352 "PRIMARY" => array("id"),
1355 $database["push_subscriber"] = array(
1357 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1358 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1359 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1360 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1361 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1362 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1363 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1364 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1367 "PRIMARY" => array("id"),
1370 $database["queue"] = array(
1372 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1373 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1374 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1375 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1376 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1377 "content" => array("type" => "mediumtext"),
1378 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1381 "PRIMARY" => array("id"),
1382 "cid" => array("cid"),
1383 "created" => array("created"),
1384 "last" => array("last"),
1385 "network" => array("network"),
1386 "batch" => array("batch"),
1389 $database["register"] = array(
1391 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1392 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1393 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1394 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1395 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1396 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1397 "note" => array("type" => "text"),
1400 "PRIMARY" => array("id"),
1403 $database["search"] = array(
1405 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1406 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1407 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1410 "PRIMARY" => array("id"),
1411 "uid" => array("uid"),
1414 $database["session"] = array(
1416 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1417 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1418 "data" => array("type" => "text"),
1419 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1422 "PRIMARY" => array("id"),
1423 "sid" => array("sid(64)"),
1424 "expire" => array("expire"),
1427 $database["sign"] = array(
1429 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1430 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1431 "signed_text" => array("type" => "mediumtext"),
1432 "signature" => array("type" => "text"),
1433 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1436 "PRIMARY" => array("id"),
1437 "iid" => array("iid"),
1440 $database["spam"] = array(
1442 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1443 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1444 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1445 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1446 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1447 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1450 "PRIMARY" => array("id"),
1451 "uid" => array("uid"),
1452 "spam" => array("spam"),
1453 "ham" => array("ham"),
1454 "term" => array("term"),
1457 $database["term"] = array(
1459 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1460 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1461 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1462 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1463 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1464 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1465 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1466 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1467 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1468 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1469 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1470 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1473 "PRIMARY" => array("tid"),
1474 "oid_otype_type_term" => array("oid","otype","type","term"),
1475 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1476 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1477 "guid" => array("guid(64)"),
1480 $database["thread"] = array(
1482 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1483 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1484 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1485 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1486 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1487 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1488 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1489 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1490 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1491 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1492 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1493 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1494 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1495 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1496 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1497 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1498 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1499 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1500 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1501 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1502 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1503 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1504 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1505 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1506 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1507 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1510 "PRIMARY" => array("iid"),
1511 "uid_network_commented" => array("uid","network","commented"),
1512 "uid_network_created" => array("uid","network","created"),
1513 "uid_contactid_commented" => array("uid","contact-id","commented"),
1514 "uid_contactid_created" => array("uid","contact-id","created"),
1515 "uid_created" => array("uid","created"),
1516 "uid_commented" => array("uid","commented"),
1517 "uid_wall_created" => array("uid","wall","created"),
1520 $database["tokens"] = array(
1522 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1523 "secret" => array("type" => "text"),
1524 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1525 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1526 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1527 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1530 "PRIMARY" => array("id"),
1533 $database["user"] = array(
1535 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1536 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1537 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1538 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1539 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1540 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1541 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1542 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1543 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1544 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1545 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1546 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1547 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1548 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1549 "pubkey" => array("type" => "text"),
1550 "prvkey" => array("type" => "text"),
1551 "spubkey" => array("type" => "text"),
1552 "sprvkey" => array("type" => "text"),
1553 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1554 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1555 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1556 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1557 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1558 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1559 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1560 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1561 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1562 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1563 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1564 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1565 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1566 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1567 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1568 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1569 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1570 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1571 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1572 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1573 "allow_cid" => array("type" => "mediumtext"),
1574 "allow_gid" => array("type" => "mediumtext"),
1575 "deny_cid" => array("type" => "mediumtext"),
1576 "deny_gid" => array("type" => "mediumtext"),
1577 "openidserver" => array("type" => "text"),
1580 "PRIMARY" => array("uid"),
1581 "nickname" => array("nickname(32)"),
1584 $database["userd"] = array(
1586 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1587 "username" => array("type" => "varchar(255)", "not null" => "1"),
1590 "PRIMARY" => array("id"),
1591 "username" => array("username(32)"),
1594 $database["workerqueue"] = array(
1596 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1597 "parameter" => array("type" => "text"),
1598 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1599 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1600 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1601 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1604 "PRIMARY" => array("id"),
1613 * run from command line
1615 function dbstructure_run(&$argv, &$argc) {
1623 @include(".htconfig.php");
1624 require_once("include/dba.php");
1625 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1626 unset($db_host, $db_user, $db_pass, $db_data);
1632 update_structure(true, false);
1635 update_structure(true, true);
1637 $build = get_config('system','build');
1639 set_config('system','build',DB_UPDATE_VERSION);
1640 $build = DB_UPDATE_VERSION;
1643 $stored = intval($build);
1644 $current = intval(DB_UPDATE_VERSION);
1646 // run any left update_nnnn functions in update.php
1647 for($x = $stored; $x < $current; $x ++) {
1648 $r = run_update_function($x);
1652 set_config('system','build',DB_UPDATE_VERSION);
1655 // For the dump that is used to create the database.sql we always assume utfmb4
1656 $charset = "utf8mb4";
1657 print_structure(db_definition($charset), $charset);
1664 echo $argv[0]." <command>\n";
1667 echo "dryrun show database update schema queries without running them\n";
1668 echo "update update database schema\n";
1669 echo "dumpsql dump database schema\n";
1674 if (array_search(__file__,get_included_files())===0){
1675 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);