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