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 Config::set('system', 'maintenance', 1);
148 Config::set('system', 'maintenance_reason', 'Database update');
151 if (isset($a->config["system"]["db_charset"])) {
152 $charset = $a->config["system"]["db_charset"];
159 logger('updating structure', LOGGER_DEBUG);
161 // Get the current structure
164 if (is_null($tables)) {
165 $tables = q("SHOW TABLES");
168 foreach ($tables AS $table) {
169 $table = current($table);
171 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
172 $database[$table] = table_structure($table);
175 // Get the definition
176 if (is_null($definition)) {
177 $definition = db_definition($charset);
180 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
181 if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
182 !(strpos($db->server_info(), 'MariaDB') !== false)) {
189 foreach ($definition AS $name => $structure) {
190 $is_new_table = False;
193 if (!isset($database[$name])) {
194 $r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']);
195 if (!dbm::is_result($r)) {
196 $errors .= t('Errors encountered creating database tables.').$name.EOL;
198 $is_new_table = True;
203 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
204 if (isset($database[$name]["indexes"][$indexname])) {
205 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
207 $current_index_definition = "__NOT_SET__";
209 $new_index_definition = implode(",",$fieldnames);
210 if ($current_index_definition != $new_index_definition) {
211 if ($fieldnames[0] == "UNIQUE") {
214 $temp_name = "temp-".$name;
221 * Drop the index if it isn't present in the definition
222 * or the definition differ from current status
223 * and index name doesn't start with "local_"
225 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
226 $current_index_definition = implode(",",$fieldnames);
227 if (isset($structure["indexes"][$indexname])) {
228 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
230 $new_index_definition = "__NOT_SET__";
232 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
233 $sql2=db_drop_index($indexname);
235 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
241 // Compare the field structure field by field
242 foreach ($structure["fields"] AS $fieldname => $parameters) {
243 if (!isset($database[$name]["fields"][$fieldname])) {
244 $sql2=db_add_table_field($fieldname, $parameters);
246 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
251 // Compare the field definition
252 $current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
253 $new_field_definition = implode(",",$parameters);
254 if ($current_field_definition != $new_field_definition) {
255 $sql2=db_modify_table_field($fieldname, $parameters);
257 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
268 * Create the index if the index don't exists in database
269 * or the definition differ from the current status.
270 * Don't create keys if table is new
272 if (!$is_new_table) {
273 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
274 if (isset($database[$name]["indexes"][$indexname])) {
275 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
277 $current_index_definition = "__NOT_SET__";
279 $new_index_definition = implode(",",$fieldnames);
280 if ($current_index_definition != $new_index_definition) {
281 $sql2 = db_create_index($indexname, $fieldnames);
283 // Fetch the "group by" fields for unique indexes
284 if ($fieldnames[0] == "UNIQUE") {
285 $group_by = db_group_by($indexname, $fieldnames);
289 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
300 // Ensure index conversion to unique removes duplicates
303 echo "SET session old_alter_table=1;\n";
305 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
313 echo "SET session old_alter_table=0;\n";
315 echo "INSERT INTO `".$temp_name."` SELECT * FROM `".$name."`".$group_by.";\n";
316 echo "DROP TABLE `".$name."`;\n";
317 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
323 // Ensure index conversion to unique removes duplicates
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;
342 $db->q("SET session old_alter_table=0;");
344 $r = $db->q("INSERT INTO `".$temp_name."` SELECT * FROM `".$name."`".$group_by.";");
345 if (!dbm::is_result($r)) {
346 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
349 $r = $db->q("DROP TABLE `".$name."`;");
350 if (!dbm::is_result($r)) {
351 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
354 $r = $db->q("RENAME TABLE `".$temp_name."` TO `".$name."`;");
355 if (!dbm::is_result($r)) {
356 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
366 Config::set('system', 'maintenance', 0);
367 Config::set('system', 'maintenance_reason', '');
373 function db_field_command($parameters, $create = true) {
374 $fieldstruct = $parameters["type"];
376 if ($parameters["not null"])
377 $fieldstruct .= " NOT NULL";
379 if (isset($parameters["default"])){
380 if (strpos(strtolower($parameters["type"]),"int")!==false) {
381 $fieldstruct .= " DEFAULT ".$parameters["default"];
383 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
386 if ($parameters["extra"] != "")
387 $fieldstruct .= " ".$parameters["extra"];
389 /*if (($parameters["primary"] != "") AND $create)
390 $fieldstruct .= " PRIMARY KEY";*/
392 return($fieldstruct);
395 function db_create_table($name, $fields, $charset, $verbose, $action, $indexes=null) {
403 $primary_keys = array();
404 foreach($fields AS $fieldname => $field) {
405 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
406 if (x($field,'primary') and $field['primary']!=''){
407 $primary_keys[] = $fieldname;
411 if (!is_null($indexes)) {
412 foreach ($indexes AS $indexname => $fieldnames) {
413 $sql_index = db_create_index($indexname, $fieldnames, "");
414 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
418 $sql = implode(",\n\t", $sql_rows);
420 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=".$charset;
430 function db_add_table_field($fieldname, $parameters) {
431 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
435 function db_modify_table_field($fieldname, $parameters) {
436 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
440 function db_drop_index($indexname) {
441 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
445 function db_create_index($indexname, $fieldnames, $method="ADD") {
447 $method = strtoupper(trim($method));
448 if ($method!="" && $method!="ADD") {
449 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
453 if ($fieldnames[0] == "UNIQUE") {
454 array_shift($fieldnames);
455 $method .= ' UNIQUE';
459 foreach ($fieldnames AS $fieldname) {
463 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
464 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
466 $names .= "`".dbesc($fieldname)."`";
470 if ($indexname == "PRIMARY") {
471 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
475 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
479 function db_group_by($indexname, $fieldnames) {
481 if ($fieldnames[0] != "UNIQUE") {
485 array_shift($fieldnames);
488 foreach ($fieldnames AS $fieldname) {
492 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
493 $names .= "`".dbesc($matches[1])."`";
495 $names .= "`".dbesc($fieldname)."`";
499 $sql = sprintf(" GROUP BY %s", $names);
503 function db_index_suffix($charset, $reduce = 0) {
504 if ($charset != "utf8mb4") {
508 // On utf8mb4 indexes can only have a length of 191
509 $indexlength = 191 - $reduce;
511 return "(".$indexlength.")";
514 function db_definition($charset) {
518 $database["addon"] = array(
520 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
521 "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
522 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
523 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
524 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
525 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
526 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
529 "PRIMARY" => array("id"),
530 "name" => array("UNIQUE", "name"),
533 $database["attach"] = array(
535 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
536 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
537 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
538 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
539 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
540 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
541 "data" => array("type" => "longblob", "not null" => "1"),
542 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
543 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
544 "allow_cid" => array("type" => "mediumtext"),
545 "allow_gid" => array("type" => "mediumtext"),
546 "deny_cid" => array("type" => "mediumtext"),
547 "deny_gid" => array("type" => "mediumtext"),
550 "PRIMARY" => array("id"),
553 $database["auth_codes"] = array(
555 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
556 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
557 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
558 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
559 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
562 "PRIMARY" => array("id"),
565 $database["cache"] = array(
567 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
568 "v" => array("type" => "mediumtext"),
569 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
570 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
573 "PRIMARY" => array("k"),
574 "expire_mode_updated" => array("expire_mode", "updated"),
577 $database["challenge"] = array(
579 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
580 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
581 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
582 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
583 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
584 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
587 "PRIMARY" => array("id"),
590 $database["clients"] = array(
592 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
593 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
594 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
595 "name" => array("type" => "text"),
596 "icon" => array("type" => "text"),
597 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
600 "PRIMARY" => array("client_id"),
603 $database["config"] = array(
605 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
606 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
607 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
608 "v" => array("type" => "mediumtext"),
611 "PRIMARY" => array("id"),
612 "cat_k" => array("UNIQUE", "cat", "k"),
615 $database["contact"] = array(
617 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
618 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
619 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
620 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
621 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
622 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
623 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
624 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
625 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
626 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
627 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
628 "about" => array("type" => "text"),
629 "keywords" => array("type" => "text"),
630 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
631 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
632 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
633 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
634 "photo" => array("type" => "text"),
635 "thumb" => array("type" => "text"),
636 "micro" => array("type" => "text"),
637 "site-pubkey" => array("type" => "text"),
638 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
639 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
640 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
641 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
642 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
643 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
644 "pubkey" => array("type" => "text"),
645 "prvkey" => array("type" => "text"),
646 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
647 "request" => array("type" => "text"),
648 "notify" => array("type" => "text"),
649 "poll" => array("type" => "text"),
650 "confirm" => array("type" => "text"),
651 "poco" => array("type" => "text"),
652 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
653 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
654 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
655 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
656 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
657 "last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
658 "success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
659 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
660 "name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
661 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
662 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
663 "term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
664 "last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
665 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
666 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
667 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
668 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
669 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
670 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
671 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
672 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
673 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
674 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
675 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
676 "reason" => array("type" => "text"),
677 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
678 "info" => array("type" => "mediumtext"),
679 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
680 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
681 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
682 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
683 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
684 "ffi_keyword_blacklist" => array("type" => "text"),
687 "PRIMARY" => array("id"),
688 "uid_name" => array("uid", "name"),
689 "self_uid" => array("self", "uid"),
690 "alias_uid" => array("alias(32)", "uid"),
691 "pending_uid" => array("pending", "uid"),
692 "blocked_uid" => array("blocked", "uid"),
693 "uid_rel_network_poll" => array("uid", "rel", "network", "poll(64)", "archive"),
694 "uid_network_batch" => array("uid", "network", "batch(64)"),
695 "addr_uid" => array("addr(32)", "uid"),
696 "nurl_uid" => array("nurl(32)", "uid"),
697 "nick_uid" => array("nick(32)", "uid"),
698 "dfrn-id" => array("dfrn-id"),
699 "issued-id" => array("issued-id"),
702 $database["conv"] = array(
704 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
705 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
706 "recips" => array("type" => "text"),
707 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
708 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
709 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
710 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
711 "subject" => array("type" => "text"),
714 "PRIMARY" => array("id"),
715 "uid" => array("uid"),
718 $database["event"] = array(
720 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
721 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
722 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
723 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
724 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
725 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
726 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
727 "start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
728 "finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
729 "summary" => array("type" => "text"),
730 "desc" => array("type" => "text"),
731 "location" => array("type" => "text"),
732 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
733 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
734 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
735 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
736 "allow_cid" => array("type" => "mediumtext"),
737 "allow_gid" => array("type" => "mediumtext"),
738 "deny_cid" => array("type" => "mediumtext"),
739 "deny_gid" => array("type" => "mediumtext"),
742 "PRIMARY" => array("id"),
743 "uid_start" => array("uid", "start"),
746 $database["fcontact"] = array(
748 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
749 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
750 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
751 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
752 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
753 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
754 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
755 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
756 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
757 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
758 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
759 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
760 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
761 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
762 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
763 "pubkey" => array("type" => "text"),
764 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
767 "PRIMARY" => array("id"),
768 "addr" => array("addr(32)"),
769 "url" => array("url"),
772 $database["ffinder"] = array(
774 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
775 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
776 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
777 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
780 "PRIMARY" => array("id"),
783 $database["fserver"] = array(
785 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
786 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
787 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
788 "key" => array("type" => "text"),
791 "PRIMARY" => array("id"),
792 "server" => array("server(32)"),
795 $database["fsuggest"] = 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 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
800 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
801 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
802 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
803 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
804 "note" => array("type" => "text"),
805 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
808 "PRIMARY" => array("id"),
811 $database["gcign"] = array(
813 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
814 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
815 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
818 "PRIMARY" => array("id"),
819 "uid" => array("uid"),
820 "gcid" => array("gcid"),
823 $database["gcontact"] = array(
825 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
826 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
827 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
828 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
829 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
830 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
831 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
832 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
833 "updated" => array("type" => "datetime", "default" => NULL_DATE),
834 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
835 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
836 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
837 "about" => array("type" => "text"),
838 "keywords" => array("type" => "text"),
839 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
840 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
841 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
842 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
843 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
844 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
845 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
846 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
847 "notify" => array("type" => "text"),
848 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
849 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
850 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
853 "PRIMARY" => array("id"),
854 "nurl" => array("nurl(64)"),
855 "name" => array("name(64)"),
856 "nick" => array("nick(32)"),
857 "addr" => array("addr(64)"),
858 "hide_network_updated" => array("hide", "network", "updated"),
859 "updated" => array("updated"),
862 $database["glink"] = array(
864 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
865 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
866 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
867 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
868 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
869 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
872 "PRIMARY" => array("id"),
873 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
874 "gcid" => array("gcid"),
877 $database["group"] = array(
879 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
880 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
881 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
882 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
883 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
886 "PRIMARY" => array("id"),
887 "uid" => array("uid"),
890 $database["group_member"] = array(
892 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
893 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
894 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
895 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
898 "PRIMARY" => array("id"),
899 "contactid" => array("contact-id"),
900 "gid_contactid" => array("gid", "contact-id"),
901 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
904 $database["gserver"] = array(
906 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
907 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
908 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
909 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
910 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
911 "info" => array("type" => "text"),
912 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
913 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
914 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
915 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
916 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
917 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
918 "last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
919 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
920 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
923 "PRIMARY" => array("id"),
924 "nurl" => array("nurl(32)"),
927 $database["hook"] = array(
929 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
930 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
931 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
932 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
933 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
936 "PRIMARY" => array("id"),
937 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
940 $database["intro"] = array(
942 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
943 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
944 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
945 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
946 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
947 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
948 "note" => array("type" => "text"),
949 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
950 "datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
951 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
952 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
955 "PRIMARY" => array("id"),
958 $database["item"] = array(
960 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
961 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
962 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
963 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
964 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
965 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
966 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
967 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
968 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
969 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
970 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
971 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
972 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
973 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
974 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
975 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
976 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
977 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
978 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
979 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
980 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
981 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
982 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
983 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
984 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
985 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
986 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
987 "body" => array("type" => "mediumtext"),
988 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
989 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
990 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
991 "object" => array("type" => "text"),
992 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
993 "target" => array("type" => "text"),
994 "postopts" => array("type" => "text"),
995 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
996 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
997 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
998 "tag" => array("type" => "mediumtext"),
999 "attach" => array("type" => "mediumtext"),
1000 "inform" => array("type" => "mediumtext"),
1001 "file" => array("type" => "mediumtext"),
1002 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1003 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1004 "allow_cid" => array("type" => "mediumtext"),
1005 "allow_gid" => array("type" => "mediumtext"),
1006 "deny_cid" => array("type" => "mediumtext"),
1007 "deny_gid" => array("type" => "mediumtext"),
1008 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1009 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1010 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1011 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1012 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1013 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1014 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1015 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1016 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1017 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1018 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1019 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1020 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1021 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1022 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1023 "rendered-html" => array("type" => "mediumtext"),
1024 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1027 "PRIMARY" => array("id"),
1028 "guid" => array("guid"),
1029 "uri" => array("uri"),
1030 "parent" => array("parent"),
1031 "parent-uri" => array("parent-uri"),
1032 "extid" => array("extid"),
1033 "uid_id" => array("uid","id"),
1034 "uid_contactid_id" => array("uid","contact-id","id"),
1035 "uid_created" => array("uid","created"),
1036 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1037 "uid_network_received" => array("uid","network","received"),
1038 "uid_network_commented" => array("uid","network","commented"),
1039 "uid_thrparent" => array("uid","thr-parent"),
1040 "uid_parenturi" => array("uid","parent-uri"),
1041 "uid_contactid_created" => array("uid","contact-id","created"),
1042 "authorid_created" => array("author-id","created"),
1043 "uid_uri" => array("uid", "uri"),
1044 "resource-id" => array("resource-id"),
1045 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1046 "uid_type_changed" => array("uid","type","changed"),
1047 "contactid_verb" => array("contact-id","verb"),
1048 "deleted_changed" => array("deleted","changed"),
1049 "uid_wall_changed" => array("uid","wall","changed"),
1050 "uid_eventid" => array("uid","event-id"),
1051 "uid_authorlink" => array("uid","author-link"),
1052 "uid_ownerlink" => array("uid","owner-link"),
1055 $database["item_id"] = array(
1057 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1058 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1059 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1060 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1061 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1064 "PRIMARY" => array("id"),
1065 "uid" => array("uid"),
1066 "sid" => array("sid"),
1067 "service" => array("service(32)"),
1068 "iid" => array("iid"),
1071 $database["locks"] = array(
1073 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1074 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1075 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1076 "created" => array("type" => "datetime", "default" => NULL_DATE),
1079 "PRIMARY" => array("id"),
1082 $database["mail"] = array(
1084 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1085 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1086 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1087 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1088 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1089 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1090 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1091 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1092 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1093 "body" => array("type" => "mediumtext"),
1094 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1095 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1096 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1097 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1098 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1099 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1100 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1103 "PRIMARY" => array("id"),
1104 "uid_seen" => array("uid", "seen"),
1105 "convid" => array("convid"),
1106 "uri" => array("uri(64)"),
1107 "parent-uri" => array("parent-uri(64)"),
1110 $database["mailacct"] = array(
1112 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1113 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1114 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1115 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1116 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1117 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1118 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1119 "pass" => array("type" => "text"),
1120 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1121 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1122 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1123 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1124 "last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1127 "PRIMARY" => array("id"),
1130 $database["manage"] = array(
1132 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1133 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1134 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1137 "PRIMARY" => array("id"),
1138 "uid_mid" => array("UNIQUE", "uid","mid"),
1141 $database["notify"] = array(
1143 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1144 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1145 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1146 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1147 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1148 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1149 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1150 "msg" => array("type" => "mediumtext"),
1151 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1152 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1153 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1154 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1155 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1156 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1157 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1158 "name_cache" => array("type" => "tinytext"),
1159 "msg_cache" => array("type" => "mediumtext")
1162 "PRIMARY" => array("id"),
1163 "hash_uid" => array("hash", "uid"),
1164 "seen_uid_date" => array("seen", "uid", "date"),
1165 "uid_date" => array("uid", "date"),
1166 "uid_type_link" => array("uid", "type", "link"),
1169 $database["notify-threads"] = array(
1171 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1172 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1173 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1174 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1175 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1178 "PRIMARY" => array("id"),
1181 $database["oembed"] = array(
1183 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1184 "content" => array("type" => "mediumtext"),
1185 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1188 "PRIMARY" => array("url"),
1189 "created" => array("created"),
1192 $database["parsed_url"] = array(
1194 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1195 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1196 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1197 "content" => array("type" => "mediumtext"),
1198 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1201 "PRIMARY" => array("url", "guessing", "oembed"),
1202 "created" => array("created"),
1205 $database["pconfig"] = array(
1207 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1208 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1209 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1210 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1211 "v" => array("type" => "mediumtext"),
1214 "PRIMARY" => array("id"),
1215 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1218 $database["photo"] = array(
1220 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1221 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1222 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1223 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1224 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1225 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1226 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1227 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1228 "desc" => array("type" => "text"),
1229 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1230 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1231 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1232 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1233 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1234 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1235 "data" => array("type" => "mediumblob", "not null" => "1"),
1236 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1237 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1238 "allow_cid" => array("type" => "mediumtext"),
1239 "allow_gid" => array("type" => "mediumtext"),
1240 "deny_cid" => array("type" => "mediumtext"),
1241 "deny_gid" => array("type" => "mediumtext"),
1244 "PRIMARY" => array("id"),
1245 "uid_contactid" => array("uid", "contact-id"),
1246 "uid_profile" => array("uid", "profile"),
1247 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1248 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1249 "resource-id" => array("resource-id(64)"),
1252 $database["poll"] = array(
1254 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1255 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1256 "q0" => array("type" => "text"),
1257 "q1" => array("type" => "text"),
1258 "q2" => array("type" => "text"),
1259 "q3" => array("type" => "text"),
1260 "q4" => array("type" => "text"),
1261 "q5" => array("type" => "text"),
1262 "q6" => array("type" => "text"),
1263 "q7" => array("type" => "text"),
1264 "q8" => array("type" => "text"),
1265 "q9" => array("type" => "text"),
1268 "PRIMARY" => array("id"),
1269 "uid" => array("uid"),
1272 $database["poll_result"] = array(
1274 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1275 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1276 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1279 "PRIMARY" => array("id"),
1280 "poll_id" => array("poll_id"),
1281 "choice" => array("choice"),
1284 $database["process"] = array(
1286 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1287 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1288 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1291 "PRIMARY" => array("pid"),
1292 "command" => array("command"),
1295 $database["profile"] = array(
1297 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1298 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1299 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1300 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1301 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1302 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1303 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1304 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1305 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1306 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1307 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1308 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1309 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1310 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1311 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1312 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1313 "with" => array("type" => "text"),
1314 "howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1315 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1316 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1317 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1318 "pub_keywords" => array("type" => "text"),
1319 "prv_keywords" => array("type" => "text"),
1320 "likes" => array("type" => "text"),
1321 "dislikes" => array("type" => "text"),
1322 "about" => array("type" => "text"),
1323 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1324 "music" => array("type" => "text"),
1325 "book" => array("type" => "text"),
1326 "tv" => array("type" => "text"),
1327 "film" => array("type" => "text"),
1328 "interest" => array("type" => "text"),
1329 "romance" => array("type" => "text"),
1330 "work" => array("type" => "text"),
1331 "education" => array("type" => "text"),
1332 "contact" => array("type" => "text"),
1333 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1334 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1335 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1336 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1337 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1338 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1341 "PRIMARY" => array("id"),
1342 "uid_is-default" => array("uid", "is-default"),
1345 $database["profile_check"] = array(
1347 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1348 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1349 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1350 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1351 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1352 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1355 "PRIMARY" => array("id"),
1358 $database["push_subscriber"] = array(
1360 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1361 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1362 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1363 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1364 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1365 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1366 "last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1367 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1370 "PRIMARY" => array("id"),
1373 $database["queue"] = array(
1375 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1376 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1377 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1378 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1379 "last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1380 "content" => array("type" => "mediumtext"),
1381 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1384 "PRIMARY" => array("id"),
1385 "cid" => array("cid"),
1386 "created" => array("created"),
1387 "last" => array("last"),
1388 "network" => array("network"),
1389 "batch" => array("batch"),
1392 $database["register"] = array(
1394 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1395 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1396 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1397 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1398 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1399 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1400 "note" => array("type" => "text"),
1403 "PRIMARY" => array("id"),
1406 $database["search"] = array(
1408 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1409 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1410 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1413 "PRIMARY" => array("id"),
1414 "uid" => array("uid"),
1417 $database["session"] = array(
1419 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1420 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1421 "data" => array("type" => "text"),
1422 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1425 "PRIMARY" => array("id"),
1426 "sid" => array("sid(64)"),
1427 "expire" => array("expire"),
1430 $database["sign"] = array(
1432 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1433 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1434 "signed_text" => array("type" => "mediumtext"),
1435 "signature" => array("type" => "text"),
1436 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1439 "PRIMARY" => array("id"),
1440 "iid" => array("iid"),
1443 $database["spam"] = array(
1445 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1446 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1447 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1448 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1449 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1450 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1453 "PRIMARY" => array("id"),
1454 "uid" => array("uid"),
1455 "spam" => array("spam"),
1456 "ham" => array("ham"),
1457 "term" => array("term"),
1460 $database["term"] = array(
1462 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1463 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1464 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1465 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1466 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1467 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1468 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1469 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1470 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1471 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1472 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1473 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1476 "PRIMARY" => array("tid"),
1477 "oid_otype_type_term" => array("oid","otype","type","term"),
1478 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1479 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1480 "guid" => array("guid(64)"),
1483 $database["thread"] = array(
1485 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1486 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1487 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1488 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1489 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1490 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1491 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1492 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1493 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1494 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1495 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1496 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1497 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1498 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1499 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1500 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1501 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1502 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1503 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1504 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1505 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1506 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1507 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1508 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1509 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1510 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1513 "PRIMARY" => array("iid"),
1514 "uid_network_commented" => array("uid","network","commented"),
1515 "uid_network_created" => array("uid","network","created"),
1516 "uid_contactid_commented" => array("uid","contact-id","commented"),
1517 "uid_contactid_created" => array("uid","contact-id","created"),
1518 "uid_created" => array("uid","created"),
1519 "uid_commented" => array("uid","commented"),
1520 "uid_wall_created" => array("uid","wall","created"),
1523 $database["tokens"] = array(
1525 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1526 "secret" => array("type" => "text"),
1527 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1528 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1529 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1530 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1533 "PRIMARY" => array("id"),
1536 $database["user"] = array(
1538 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1539 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1540 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1541 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1542 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1543 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1544 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1545 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1546 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1547 "register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1548 "login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1549 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1550 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1551 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1552 "pubkey" => array("type" => "text"),
1553 "prvkey" => array("type" => "text"),
1554 "spubkey" => array("type" => "text"),
1555 "sprvkey" => array("type" => "text"),
1556 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1557 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1558 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1559 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1560 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1561 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1562 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1563 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1564 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1565 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1566 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1567 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1568 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1569 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1570 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1571 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1572 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1573 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1574 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1575 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1576 "allow_cid" => array("type" => "mediumtext"),
1577 "allow_gid" => array("type" => "mediumtext"),
1578 "deny_cid" => array("type" => "mediumtext"),
1579 "deny_gid" => array("type" => "mediumtext"),
1580 "openidserver" => array("type" => "text"),
1583 "PRIMARY" => array("uid"),
1584 "nickname" => array("nickname(32)"),
1587 $database["userd"] = array(
1589 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1590 "username" => array("type" => "varchar(255)", "not null" => "1"),
1593 "PRIMARY" => array("id"),
1594 "username" => array("username(32)"),
1597 $database["workerqueue"] = array(
1599 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1600 "parameter" => array("type" => "text"),
1601 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1602 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1603 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1604 "executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1607 "PRIMARY" => array("id"),
1616 * run from command line
1618 function dbstructure_run(&$argv, &$argc) {
1626 @include(".htconfig.php");
1627 require_once("include/dba.php");
1628 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1629 unset($db_host, $db_user, $db_pass, $db_data);
1635 update_structure(true, false);
1638 update_structure(true, true);
1640 $build = get_config('system','build');
1642 set_config('system','build',DB_UPDATE_VERSION);
1643 $build = DB_UPDATE_VERSION;
1646 $stored = intval($build);
1647 $current = intval(DB_UPDATE_VERSION);
1649 // run any left update_nnnn functions in update.php
1650 for($x = $stored; $x < $current; $x ++) {
1651 $r = run_update_function($x);
1655 set_config('system','build',DB_UPDATE_VERSION);
1658 // For the dump that is used to create the database.sql we always assume utfmb4
1659 $charset = "utf8mb4";
1660 print_structure(db_definition($charset), $charset);
1667 echo $argv[0]." <command>\n";
1670 echo "dryrun show database update schema queries without running them\n";
1671 echo "update update database schema\n";
1672 echo "dumpsql dump database schema\n";
1677 if (array_search(__file__,get_included_files())===0){
1678 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);