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") {
212 $temp_name = "temp-".$name;
219 * Drop the index if it isn't present in the definition
220 * or the definition differ from current status
221 * and index name doesn't start with "local_"
223 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
224 $current_index_definition = implode(",",$fieldnames);
225 if (isset($structure["indexes"][$indexname])) {
226 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
228 $new_index_definition = "__NOT_SET__";
230 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
231 $sql2=db_drop_index($indexname);
233 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
239 // Compare the field structure field by field
240 foreach ($structure["fields"] AS $fieldname => $parameters) {
241 if (!isset($database[$name]["fields"][$fieldname])) {
242 $sql2=db_add_table_field($fieldname, $parameters);
244 $sql3 = "ALTER TABLE `".$temp_name."` ".$sql2;
249 // Compare the field definition
250 $current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
251 $new_field_definition = implode(",",$parameters);
252 if ($current_field_definition != $new_field_definition) {
253 $sql2=db_modify_table_field($fieldname, $parameters);
255 $sql3 = "ALTER TABLE `".$temp_name."` ".$sql2;
266 * Create the index if the index don't exists in database
267 * or the definition differ from the current status.
268 * Don't create keys if table is new
270 if (!$is_new_table) {
271 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
272 if (isset($database[$name]["indexes"][$indexname])) {
273 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
275 $current_index_definition = "__NOT_SET__";
277 $new_index_definition = implode(",",$fieldnames);
278 if ($current_index_definition != $new_index_definition) {
279 $sql2=db_create_index($indexname, $fieldnames);
282 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
293 // Ensure index conversion to unique removes duplicates
296 echo "SET session old_alter_table=1;\n";
298 echo "DROP TABLE IF EXISTS `".$temp_name."`;\n";
299 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
307 echo "SET session old_alter_table=0;\n";
309 echo "INSERT IGNORE INTO `".$temp_name."` SELECT * FROM `".$name."`;\n";
310 echo "DROP TABLE `".$name."`;\n";
311 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
317 // Ensure index conversion to unique removes duplicates
320 $db->q("SET session old_alter_table=1;");
322 $r = $db->q("DROP TABLE IF EXISTS `".$temp_name."`;");
323 if (!dbm::is_result($r)) {
324 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
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 IGNORE INTO `".$temp_name."` SELECT * FROM `".$name."`;");
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_index_suffix($charset, $reduce = 0) {
477 if ($charset != "utf8mb4") {
481 // On utf8mb4 indexes can only have a length of 191
482 $indexlength = 191 - $reduce;
484 return "(".$indexlength.")";
487 function db_definition($charset) {
491 $database["addon"] = array(
493 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
494 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
495 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
496 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
497 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
498 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
499 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
502 "PRIMARY" => array("id"),
505 $database["attach"] = array(
507 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
508 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
509 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
510 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
511 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
512 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
513 "data" => array("type" => "longblob", "not null" => "1"),
514 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
515 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
516 "allow_cid" => array("type" => "text"),
517 "allow_gid" => array("type" => "text"),
518 "deny_cid" => array("type" => "text"),
519 "deny_gid" => array("type" => "text"),
522 "PRIMARY" => array("id"),
525 $database["auth_codes"] = array(
527 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
528 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
529 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
530 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
531 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
534 "PRIMARY" => array("id"),
537 $database["cache"] = array(
539 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
540 "v" => array("type" => "mediumtext"),
541 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
542 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
545 "PRIMARY" => array("k"),
546 "expire_mode_updated" => array("expire_mode", "updated"),
549 $database["challenge"] = array(
551 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
552 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
553 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
554 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
555 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
556 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
559 "PRIMARY" => array("id"),
562 $database["clients"] = array(
564 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
565 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
566 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
567 "name" => array("type" => "text"),
568 "icon" => array("type" => "text"),
569 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
572 "PRIMARY" => array("client_id"),
575 $database["config"] = array(
577 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
578 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
579 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
580 "v" => array("type" => "mediumtext"),
583 "PRIMARY" => array("id"),
584 "cat_k" => array("UNIQUE", "cat", "k"),
587 $database["contact"] = array(
589 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
590 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
591 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
592 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
593 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
594 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
595 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
596 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
597 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
598 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
599 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
600 "about" => array("type" => "text"),
601 "keywords" => array("type" => "text"),
602 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
603 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
604 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
605 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
606 "photo" => array("type" => "text"),
607 "thumb" => array("type" => "text"),
608 "micro" => array("type" => "text"),
609 "site-pubkey" => array("type" => "text"),
610 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
611 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
612 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
613 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
614 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
615 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
616 "pubkey" => array("type" => "text"),
617 "prvkey" => array("type" => "text"),
618 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
619 "request" => array("type" => "text"),
620 "notify" => array("type" => "text"),
621 "poll" => array("type" => "text"),
622 "confirm" => array("type" => "text"),
623 "poco" => array("type" => "text"),
624 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
625 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
626 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
627 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
628 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
629 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
630 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
631 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
632 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
633 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
634 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
635 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
636 "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
637 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
638 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
639 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
640 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
641 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
642 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
643 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
644 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
645 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
646 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
647 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
648 "reason" => array("type" => "text"),
649 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
650 "info" => array("type" => "mediumtext"),
651 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
652 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
653 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
654 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
655 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
656 "ffi_keyword_blacklist" => array("type" => "text"),
659 "PRIMARY" => array("id"),
660 "uid_name" => array("uid", "name"),
661 "self_uid" => array("self", "uid"),
662 "alias_uid" => array("alias(32)", "uid"),
663 "pending_uid" => array("pending", "uid"),
664 "blocked_uid" => array("blocked", "uid"),
665 "uid_rel_network_poll" => array("uid", "rel", "network", "poll(64)", "archive"),
666 "uid_network_batch" => array("uid", "network", "batch(64)"),
667 "addr_uid" => array("addr(32)", "uid"),
668 "nurl_uid" => array("nurl(32)", "uid"),
669 "nick_uid" => array("nick(32)", "uid"),
670 "dfrn-id" => array("dfrn-id"),
671 "issued-id" => array("issued-id"),
674 $database["conv"] = array(
676 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
677 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
678 "recips" => array("type" => "text"),
679 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
680 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
681 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
682 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
683 "subject" => array("type" => "text"),
686 "PRIMARY" => array("id"),
687 "uid" => array("uid"),
690 $database["deliverq"] = array(
692 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
693 "cmd" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
694 "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
695 "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
698 "PRIMARY" => array("id"),
699 "cmd_item_contact" => array("UNIQUE", "cmd", "item", "contact"),
702 $database["event"] = array(
704 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
705 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
706 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
707 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
708 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
709 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
710 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
711 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
712 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
713 "summary" => array("type" => "text"),
714 "desc" => array("type" => "text"),
715 "location" => array("type" => "text"),
716 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
717 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
718 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
719 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
720 "allow_cid" => array("type" => "text"),
721 "allow_gid" => array("type" => "text"),
722 "deny_cid" => array("type" => "text"),
723 "deny_gid" => array("type" => "text"),
726 "PRIMARY" => array("id"),
727 "uid_start" => array("uid", "start"),
730 $database["fcontact"] = array(
732 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
733 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
734 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
735 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
736 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
737 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
738 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
739 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
740 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
741 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
742 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
743 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
744 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
745 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
746 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
747 "pubkey" => array("type" => "text"),
748 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
751 "PRIMARY" => array("id"),
752 "addr" => array("addr(32)"),
753 "url" => array("url"),
756 $database["ffinder"] = array(
758 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
759 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
760 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
761 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
764 "PRIMARY" => array("id"),
767 $database["fserver"] = array(
769 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
770 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
771 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
772 "key" => array("type" => "text"),
775 "PRIMARY" => array("id"),
776 "server" => array("server(32)"),
779 $database["fsuggest"] = array(
781 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
782 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
783 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
784 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
785 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
786 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
787 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
788 "note" => array("type" => "text"),
789 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
792 "PRIMARY" => array("id"),
795 $database["gcign"] = array(
797 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
798 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
799 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
802 "PRIMARY" => array("id"),
803 "uid" => array("uid"),
804 "gcid" => array("gcid"),
807 $database["gcontact"] = array(
809 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
810 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
811 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
812 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
813 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
814 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
815 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
816 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
817 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
818 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
819 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
820 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
821 "about" => array("type" => "text"),
822 "keywords" => array("type" => "text"),
823 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
824 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
825 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
826 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
827 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
828 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
829 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
830 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
831 "notify" => array("type" => "text"),
832 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
833 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
834 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
837 "PRIMARY" => array("id"),
838 "nurl" => array("nurl(32)"),
839 "name" => array("name(32)"),
840 "nick" => array("nick(32)"),
841 "addr" => array("addr(32)"),
842 "hide_network_updated" => array("hide", "network", "updated"),
843 "updated" => array("updated"),
846 $database["glink"] = array(
848 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
849 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
850 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
851 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
852 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
853 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
856 "PRIMARY" => array("id"),
857 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
858 "gcid" => array("gcid"),
861 $database["group"] = array(
863 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
864 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
865 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
866 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
867 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
870 "PRIMARY" => array("id"),
871 "uid" => array("uid"),
874 $database["group_member"] = 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 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
879 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
882 "PRIMARY" => array("id"),
883 "contactid" => array("contact-id"),
884 "gid_contactid" => array("gid", "contact-id"),
885 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
888 $database["gserver"] = array(
890 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
891 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
892 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
893 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
894 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
895 "info" => array("type" => "text"),
896 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
897 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
898 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
899 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
900 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
901 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
902 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
903 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
904 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
907 "PRIMARY" => array("id"),
908 "nurl" => array("nurl(32)"),
911 $database["hook"] = array(
913 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
914 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
915 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
916 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
917 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
920 "PRIMARY" => array("id"),
921 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
924 $database["intro"] = array(
926 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
927 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
928 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
929 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
930 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
931 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
932 "note" => array("type" => "text"),
933 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
934 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
935 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
936 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
939 "PRIMARY" => array("id"),
942 $database["item"] = array(
944 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
945 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
946 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
947 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
948 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
949 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
950 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
951 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
952 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
953 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
954 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
955 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
956 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
957 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
958 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
959 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
960 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
961 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
962 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
963 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
964 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
965 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
966 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
967 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
968 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
969 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
970 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
971 "body" => array("type" => "mediumtext"),
972 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
973 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
974 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
975 "object" => array("type" => "text"),
976 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
977 "target" => array("type" => "text"),
978 "postopts" => array("type" => "text"),
979 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
980 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
981 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
982 "tag" => array("type" => "mediumtext"),
983 "attach" => array("type" => "mediumtext"),
984 "inform" => array("type" => "mediumtext"),
985 "file" => array("type" => "mediumtext"),
986 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
987 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
988 "allow_cid" => array("type" => "mediumtext"),
989 "allow_gid" => array("type" => "mediumtext"),
990 "deny_cid" => array("type" => "mediumtext"),
991 "deny_gid" => array("type" => "mediumtext"),
992 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
993 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
994 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
995 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
996 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
997 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
998 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
999 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1000 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1001 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1002 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1003 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1004 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1005 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1006 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1007 "rendered-html" => array("type" => "mediumtext"),
1008 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1011 "PRIMARY" => array("id"),
1012 "guid" => array("guid"),
1013 "uri" => array("uri"),
1014 "parent" => array("parent"),
1015 "parent-uri" => array("parent-uri"),
1016 "extid" => array("extid"),
1017 "uid_id" => array("uid","id"),
1018 "uid_created" => array("uid","created"),
1019 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1020 "uid_network_received" => array("uid","network","received"),
1021 "uid_network_commented" => array("uid","network","commented"),
1022 "uid_thrparent" => array("uid","thr-parent"),
1023 "uid_parenturi" => array("uid","parent-uri"),
1024 "uid_contactid_created" => array("uid","contact-id","created"),
1025 "authorid_created" => array("author-id","created"),
1026 "uid_uri" => array("uid", "uri"),
1027 "resource-id" => array("resource-id"),
1028 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1029 "uid_type_changed" => array("uid","type","changed"),
1030 "contactid_verb" => array("contact-id","verb"),
1031 "deleted_changed" => array("deleted","changed"),
1032 "uid_wall_changed" => array("uid","wall","changed"),
1033 "uid_eventid" => array("uid","event-id"),
1034 "uid_authorlink" => array("uid","author-link"),
1035 "uid_ownerlink" => array("uid","owner-link"),
1038 $database["item_id"] = array(
1040 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1041 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1042 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1043 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1044 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1047 "PRIMARY" => array("id"),
1048 "uid" => array("uid"),
1049 "sid" => array("sid"),
1050 "service" => array("service(32)"),
1051 "iid" => array("iid"),
1054 $database["locks"] = array(
1056 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1057 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1058 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1059 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
1062 "PRIMARY" => array("id"),
1065 $database["mail"] = array(
1067 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1068 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1069 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1070 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1071 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1072 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1073 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1074 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1075 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1076 "body" => array("type" => "mediumtext"),
1077 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1078 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1079 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1080 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1081 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1082 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1083 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1086 "PRIMARY" => array("id"),
1087 "uid_seen" => array("uid", "seen"),
1088 "convid" => array("convid"),
1089 "uri" => array("uri(64)"),
1090 "parent-uri" => array("parent-uri(64)"),
1093 $database["mailacct"] = array(
1095 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1096 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1097 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1098 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1099 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1100 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1101 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1102 "pass" => array("type" => "text"),
1103 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1104 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1105 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1106 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1107 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1110 "PRIMARY" => array("id"),
1113 $database["manage"] = array(
1115 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1116 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1117 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1120 "PRIMARY" => array("id"),
1121 "uid_mid" => array("UNIQUE", "uid","mid"),
1124 $database["notify"] = array(
1126 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1127 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1128 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1129 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1130 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1131 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1132 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1133 "msg" => array("type" => "mediumtext"),
1134 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1135 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1136 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1137 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1138 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1139 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1140 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1141 "name_cache" => array("type" => "tinytext"),
1142 "msg_cache" => array("type" => "mediumtext")
1145 "PRIMARY" => array("id"),
1146 "hash_uid" => array("hash", "uid"),
1147 "seen_uid_date" => array("seen", "uid", "date"),
1148 "uid_date" => array("uid", "date"),
1149 "uid_type_link" => array("uid", "type", "link"),
1152 $database["notify-threads"] = array(
1154 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1155 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1156 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1157 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1158 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1161 "PRIMARY" => array("id"),
1164 $database["oembed"] = array(
1166 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1167 "content" => array("type" => "mediumtext"),
1168 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1171 "PRIMARY" => array("url"),
1172 "created" => array("created"),
1175 $database["parsed_url"] = array(
1177 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1178 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1179 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1180 "content" => array("type" => "mediumtext"),
1181 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1184 "PRIMARY" => array("url", "guessing", "oembed"),
1185 "created" => array("created"),
1188 $database["pconfig"] = array(
1190 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1191 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1192 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1193 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1194 "v" => array("type" => "mediumtext"),
1197 "PRIMARY" => array("id"),
1198 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1201 $database["photo"] = array(
1203 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1204 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1205 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1206 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1207 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1208 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1209 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1210 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1211 "desc" => array("type" => "text"),
1212 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1213 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1214 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1215 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1216 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1217 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1218 "data" => array("type" => "mediumblob", "not null" => "1"),
1219 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1220 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1221 "allow_cid" => array("type" => "mediumtext"),
1222 "allow_gid" => array("type" => "mediumtext"),
1223 "deny_cid" => array("type" => "mediumtext"),
1224 "deny_gid" => array("type" => "mediumtext"),
1227 "PRIMARY" => array("id"),
1228 "uid_contactid" => array("uid", "contact-id"),
1229 "uid_profile" => array("uid", "profile"),
1230 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1231 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1232 "resource-id" => array("resource-id(64)"),
1235 $database["poll"] = array(
1237 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1238 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1239 "q0" => array("type" => "text"),
1240 "q1" => array("type" => "text"),
1241 "q2" => array("type" => "text"),
1242 "q3" => array("type" => "text"),
1243 "q4" => array("type" => "text"),
1244 "q5" => array("type" => "text"),
1245 "q6" => array("type" => "text"),
1246 "q7" => array("type" => "text"),
1247 "q8" => array("type" => "text"),
1248 "q9" => array("type" => "text"),
1251 "PRIMARY" => array("id"),
1252 "uid" => array("uid"),
1255 $database["poll_result"] = array(
1257 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1258 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1259 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1262 "PRIMARY" => array("id"),
1263 "poll_id" => array("poll_id"),
1264 "choice" => array("choice"),
1267 $database["process"] = array(
1269 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1270 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1271 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1274 "PRIMARY" => array("pid"),
1275 "command" => array("command"),
1278 $database["profile"] = array(
1280 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1281 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1282 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1283 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1284 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1285 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1286 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1287 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1288 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1289 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1290 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1291 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1292 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1293 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1294 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1295 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1296 "with" => array("type" => "text"),
1297 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1298 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1299 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1300 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1301 "pub_keywords" => array("type" => "text"),
1302 "prv_keywords" => array("type" => "text"),
1303 "likes" => array("type" => "text"),
1304 "dislikes" => array("type" => "text"),
1305 "about" => array("type" => "text"),
1306 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1307 "music" => array("type" => "text"),
1308 "book" => array("type" => "text"),
1309 "tv" => array("type" => "text"),
1310 "film" => array("type" => "text"),
1311 "interest" => array("type" => "text"),
1312 "romance" => array("type" => "text"),
1313 "work" => array("type" => "text"),
1314 "education" => array("type" => "text"),
1315 "contact" => array("type" => "text"),
1316 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1317 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1318 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1319 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1320 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1321 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1324 "PRIMARY" => array("id"),
1325 "uid_is-default" => array("uid", "is-default"),
1328 $database["profile_check"] = array(
1330 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1331 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1332 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1333 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1334 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1335 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1338 "PRIMARY" => array("id"),
1341 $database["push_subscriber"] = array(
1343 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1344 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1345 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1346 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1347 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1348 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1349 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1350 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1353 "PRIMARY" => array("id"),
1356 $database["queue"] = array(
1358 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1359 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1360 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1361 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1362 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1363 "content" => array("type" => "mediumtext"),
1364 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1367 "PRIMARY" => array("id"),
1368 "cid" => array("cid"),
1369 "created" => array("created"),
1370 "last" => array("last"),
1371 "network" => array("network"),
1372 "batch" => array("batch"),
1375 $database["register"] = array(
1377 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1378 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1379 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1380 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1381 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1382 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1383 "note" => array("type" => "text"),
1386 "PRIMARY" => array("id"),
1389 $database["search"] = array(
1391 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1392 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1393 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1396 "PRIMARY" => array("id"),
1397 "uid" => array("uid"),
1400 $database["session"] = array(
1402 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1403 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1404 "data" => array("type" => "text"),
1405 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1408 "PRIMARY" => array("id"),
1409 "sid" => array("sid(64)"),
1410 "expire" => array("expire"),
1413 $database["sign"] = array(
1415 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1416 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1417 "signed_text" => array("type" => "mediumtext"),
1418 "signature" => array("type" => "text"),
1419 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1422 "PRIMARY" => array("id"),
1423 "iid" => array("iid"),
1426 $database["spam"] = array(
1428 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1429 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1430 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1431 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1432 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1433 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1436 "PRIMARY" => array("id"),
1437 "uid" => array("uid"),
1438 "spam" => array("spam"),
1439 "ham" => array("ham"),
1440 "term" => array("term"),
1443 $database["term"] = array(
1445 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1446 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1447 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1448 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1449 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1450 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1451 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1452 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1453 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1454 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1455 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1456 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1459 "PRIMARY" => array("tid"),
1460 "oid_otype_type_term" => array("oid","otype","type","term"),
1461 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1462 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1463 "guid" => array("guid(64)"),
1466 $database["thread"] = array(
1468 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1469 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1470 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1471 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1472 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1473 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1474 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1475 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1476 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1477 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1478 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1479 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1480 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1481 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1482 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1483 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1484 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1485 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1486 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1487 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1488 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1489 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1490 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1491 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1492 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1493 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1496 "PRIMARY" => array("iid"),
1497 "uid_network_commented" => array("uid","network","commented"),
1498 "uid_network_created" => array("uid","network","created"),
1499 "uid_contactid_commented" => array("uid","contact-id","commented"),
1500 "uid_contactid_created" => array("uid","contact-id","created"),
1501 "uid_created" => array("uid","created"),
1502 "uid_commented" => array("uid","commented"),
1505 $database["tokens"] = array(
1507 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1508 "secret" => array("type" => "text"),
1509 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1510 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1511 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1512 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1515 "PRIMARY" => array("id"),
1518 $database["user"] = array(
1520 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1521 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1522 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1523 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1524 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1525 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1526 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1527 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1528 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1529 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1530 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1531 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1532 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1533 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1534 "pubkey" => array("type" => "text"),
1535 "prvkey" => array("type" => "text"),
1536 "spubkey" => array("type" => "text"),
1537 "sprvkey" => array("type" => "text"),
1538 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1539 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1540 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1541 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1542 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1543 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1544 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1545 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1546 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1547 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1548 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1549 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1550 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1551 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1552 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1553 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1554 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1555 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1556 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1557 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1558 "allow_cid" => array("type" => "text"),
1559 "allow_gid" => array("type" => "text"),
1560 "deny_cid" => array("type" => "text"),
1561 "deny_gid" => array("type" => "text"),
1562 "openidserver" => array("type" => "text"),
1565 "PRIMARY" => array("uid"),
1566 "nickname" => array("nickname(32)"),
1569 $database["userd"] = array(
1571 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1572 "username" => array("type" => "varchar(255)", "not null" => "1"),
1575 "PRIMARY" => array("id"),
1576 "username" => array("username(32)"),
1579 $database["workerqueue"] = array(
1581 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1582 "parameter" => array("type" => "text"),
1583 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1584 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1585 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1586 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1589 "PRIMARY" => array("id"),
1598 * run from command line
1600 function dbstructure_run(&$argv, &$argc) {
1608 @include(".htconfig.php");
1609 require_once("include/dba.php");
1610 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1611 unset($db_host, $db_user, $db_pass, $db_data);
1617 update_structure(true, false);
1620 update_structure(true, true);
1622 $build = get_config('system','build');
1624 set_config('system','build',DB_UPDATE_VERSION);
1625 $build = DB_UPDATE_VERSION;
1628 $stored = intval($build);
1629 $current = intval(DB_UPDATE_VERSION);
1631 // run any left update_nnnn functions in update.php
1632 for($x = $stored; $x < $current; $x ++) {
1633 $r = run_update_function($x);
1637 set_config('system','build',DB_UPDATE_VERSION);
1640 // For the dump that is used to create the database.sql we always assume utfmb4
1641 $charset = "utf8mb4";
1642 print_structure(db_definition($charset), $charset);
1649 echo $argv[0]." <command>\n";
1652 echo "dryrun show database update schema queries without running them\n";
1653 echo "update update database schema\n";
1654 echo "dumpsql dump database schema\n";
1659 if (array_search(__file__,get_included_files())===0){
1660 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);