3 use \Friendica\Core\Config;
5 require_once("boot.php");
6 require_once("include/text.php");
8 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
11 * send the email and do what is needed to do on update fails
13 * @param update_id (int) number of failed update
14 * @param error_message (str) error message
16 function update_fail($update_id, $error_message){
17 //send the administrators an e-mail
18 $admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
19 $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
24 if (!dbm::is_result($adminlist)) {
25 logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_WARNING);
31 // every admin could had different language
32 foreach ($adminlist as $admin) {
33 $lang = (($admin['language'])?$admin['language']:'en');
36 $preamble = deindent(t("
37 The friendica developers released update %s recently,
38 but when I tried to install it, something went terribly wrong.
39 This needs to be fixed soon and I can't do it alone. Please contact a
40 friendica developer if you can not help me on your own. My database might be invalid."));
41 $body = t("The error message is\n[pre]%s[/pre]");
42 $preamble = sprintf($preamble, $update_id);
43 $body = sprintf($body, $error_message);
46 'type' => "SYSTEM_EMAIL",
47 'to_email' => $admin['email'],
48 'preamble' => $preamble,
58 $email_tpl = get_intltext_template("update_fail_eml.tpl");
59 $email_msg = replace_macros($email_tpl, array(
60 '$sitename' => $a->config['sitename'],
61 '$siteurl' => App::get_baseurl(),
62 '$update' => DB_UPDATE_VERSION,
63 '$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
65 $subject=sprintf(t('Update Error at %s'), App::get_baseurl());
66 require_once('include/email.php');
67 $subject = email_header_encode($subject,'UTF-8');
68 mail($a->config['admin_email'], $subject, $email_msg,
69 'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n"
70 .'Content-type: text/plain; charset=UTF-8'."\n"
71 .'Content-transfer-encoding: 8bit');
74 logger("CRITICAL: Database structure update failed: ".$retval);
78 function table_structure($table) {
79 $structures = q("DESCRIBE `%s`", $table);
81 $full_columns = q("SHOW FULL COLUMNS FROM `%s`", $table);
83 $indexes = q("SHOW INDEX FROM `%s`", $table);
85 $table_status = q("SHOW TABLE STATUS WHERE `name` = '%s'", $table);
87 if (dbm::is_result($table_status)) {
88 $table_status = $table_status[0];
90 $table_status = array();
96 if (dbm::is_result($indexes))
97 foreach ($indexes AS $index) {
98 if ($index["Index_type"] == "FULLTEXT") {
102 if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
103 $indexdata[$index["Key_name"]] = array('UNIQUE');
106 $column = $index["Column_name"];
107 // On utf8mb4 a varchar index can only have a length of 191
108 // To avoid the need to add this to every index definition we just ignore it here.
109 // Exception are primary indexes
110 // Since there are some combindex primary indexes we use the limit of 180 here.
111 if (($index["Sub_part"] != "") AND (($index["Sub_part"] < 180) OR ($index["Key_name"] == "PRIMARY"))) {
112 $column .= "(".$index["Sub_part"].")";
115 $indexdata[$index["Key_name"]][] = $column;
117 if (dbm::is_result($structures)) {
118 foreach ($structures AS $field) {
119 $fielddata[$field["Field"]]["type"] = $field["Type"];
120 if ($field["Null"] == "NO") {
121 $fielddata[$field["Field"]]["not null"] = true;
124 if (isset($field["Default"])) {
125 $fielddata[$field["Field"]]["default"] = $field["Default"];
128 if ($field["Extra"] != "") {
129 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
132 if ($field["Key"] == "PRI") {
133 $fielddata[$field["Field"]]["primary"] = true;
137 if (dbm::is_result($full_columns)) {
138 foreach ($full_columns AS $column) {
139 $fielddata[$column["Field"]]["Collation"] = $column["Collation"];
143 return array("fields" => $fielddata, "indexes" => $indexdata, "table_status" => $table_status);
146 function print_structure($database) {
147 echo "-- ------------------------------------------\n";
148 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
149 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
150 echo "-- ------------------------------------------\n\n\n";
151 foreach ($database AS $name => $structure) {
153 echo "-- TABLE $name\n";
155 db_create_table($name, $structure['fields'], true, false, $structure["indexes"]);
161 function update_structure($verbose, $action, $tables=null, $definition=null) {
165 Config::set('system', 'maintenance', 1);
166 Config::set('system', 'maintenance_reason', 'Database update');
171 logger('updating structure', LOGGER_DEBUG);
173 // Get the current structure
176 if (is_null($tables)) {
177 $tables = q("SHOW TABLES");
180 if (dbm::is_result($tables)) {
181 foreach ($tables AS $table) {
182 $table = current($table);
184 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
185 $database[$table] = table_structure($table);
189 // Get the definition
190 if (is_null($definition)) {
191 $definition = db_definition();
194 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
195 if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
196 !(strpos($db->server_info(), 'MariaDB') !== false)) {
203 foreach ($definition AS $name => $structure) {
204 $is_new_table = False;
207 if (!isset($database[$name])) {
208 $r = db_create_table($name, $structure["fields"], $verbose, $action, $structure['indexes']);
209 if (!dbm::is_result($r)) {
210 $errors .= t('Errors encountered creating database tables.').$name.EOL;
212 $is_new_table = True;
217 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
218 if (isset($database[$name]["indexes"][$indexname])) {
219 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
221 $current_index_definition = "__NOT_SET__";
223 $new_index_definition = implode(",",$fieldnames);
224 if ($current_index_definition != $new_index_definition) {
225 if ($fieldnames[0] == "UNIQUE") {
228 $temp_name = "temp-".$name;
235 * Drop the index if it isn't present in the definition
236 * or the definition differ from current status
237 * and index name doesn't start with "local_"
239 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
240 $current_index_definition = implode(",",$fieldnames);
241 if (isset($structure["indexes"][$indexname])) {
242 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
244 $new_index_definition = "__NOT_SET__";
246 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
247 $sql2=db_drop_index($indexname);
249 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
255 // Compare the field structure field by field
256 foreach ($structure["fields"] AS $fieldname => $parameters) {
257 if (!isset($database[$name]["fields"][$fieldname])) {
258 $sql2=db_add_table_field($fieldname, $parameters);
260 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
265 // Compare the field definition
266 // At first remove the collation from the array that is about to be compared
267 $field_definition = $database[$name]["fields"][$fieldname];
268 $collation = $field_definition['Collation'];
269 unset($field_definition['Collation']);
271 $current_field_definition = implode(",", $field_definition);
272 $new_field_definition = implode(",", $parameters);
273 if (($current_field_definition != $new_field_definition) OR
274 (!is_null($collation) AND ($collation != 'utf8mb4_general_ci'))) {
275 $sql2 = db_modify_table_field($fieldname, $parameters, $collation);
277 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
287 * Create the index if the index don't exists in database
288 * or the definition differ from the current status.
289 * Don't create keys if table is new
291 if (!$is_new_table) {
292 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
293 if (isset($database[$name]["indexes"][$indexname])) {
294 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
296 $current_index_definition = "__NOT_SET__";
298 $new_index_definition = implode(",",$fieldnames);
299 if ($current_index_definition != $new_index_definition) {
300 $sql2 = db_create_index($indexname, $fieldnames);
302 // Fetch the "group by" fields for unique indexes
303 if ($fieldnames[0] == "UNIQUE") {
304 $group_by = db_group_by($indexname, $fieldnames);
308 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
316 if (isset($database[$name]["table_status"]["Collation"])) {
317 if ($database[$name]["table_status"]["Collation"] != 'utf8mb4_general_ci') {
318 $sql2 = "DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci";
321 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
332 // Ensure index conversion to unique removes duplicates
335 echo "SET session old_alter_table=1;\n";
337 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
345 echo "SET session old_alter_table=0;\n";
347 echo "INSERT INTO `".$temp_name."` SELECT * FROM `".$name."`".$group_by.";\n";
348 echo "DROP TABLE `".$name."`;\n";
349 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
355 // Ensure index conversion to unique removes duplicates
358 $db->q("SET session old_alter_table=1;");
360 $r = $db->q("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
361 if (!dbm::is_result($r)) {
362 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
369 if (!dbm::is_result($r))
370 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
374 $db->q("SET session old_alter_table=0;");
376 $r = $db->q("INSERT INTO `".$temp_name."` SELECT * FROM `".$name."`".$group_by.";");
377 if (!dbm::is_result($r)) {
378 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
381 $r = $db->q("DROP TABLE `".$name."`;");
382 if (!dbm::is_result($r)) {
383 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
386 $r = $db->q("RENAME TABLE `".$temp_name."` TO `".$name."`;");
387 if (!dbm::is_result($r)) {
388 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
398 Config::set('system', 'maintenance', 0);
399 Config::set('system', 'maintenance_reason', '');
405 function db_field_command($parameters, $create = true) {
406 $fieldstruct = $parameters["type"];
408 if ($parameters["not null"])
409 $fieldstruct .= " NOT NULL";
411 if (isset($parameters["default"])){
412 if (strpos(strtolower($parameters["type"]),"int")!==false) {
413 $fieldstruct .= " DEFAULT ".$parameters["default"];
415 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
418 if ($parameters["extra"] != "")
419 $fieldstruct .= " ".$parameters["extra"];
421 /*if (($parameters["primary"] != "") AND $create)
422 $fieldstruct .= " PRIMARY KEY";*/
424 return($fieldstruct);
427 function db_create_table($name, $fields, $verbose, $action, $indexes=null) {
435 $primary_keys = array();
436 foreach($fields AS $fieldname => $field) {
437 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
438 if (x($field,'primary') and $field['primary']!=''){
439 $primary_keys[] = $fieldname;
443 if (!is_null($indexes)) {
444 foreach ($indexes AS $indexname => $fieldnames) {
445 $sql_index = db_create_index($indexname, $fieldnames, "");
446 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
450 $sql = implode(",\n\t", $sql_rows);
452 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=utf8mb4";
462 function db_add_table_field($fieldname, $parameters) {
463 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
467 function db_modify_table_field($fieldname, $parameters, $collation) {
468 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
470 if (!is_null($collation) AND ($collation != 'utf8mb4_general_ci')) {
471 $sql .= " CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci";
477 function db_drop_index($indexname) {
478 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
482 function db_create_index($indexname, $fieldnames, $method="ADD") {
484 $method = strtoupper(trim($method));
485 if ($method!="" && $method!="ADD") {
486 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
490 if ($fieldnames[0] == "UNIQUE") {
491 array_shift($fieldnames);
492 $method .= ' UNIQUE';
496 foreach ($fieldnames AS $fieldname) {
500 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
501 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
503 $names .= "`".dbesc($fieldname)."`";
507 if ($indexname == "PRIMARY") {
508 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
512 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
516 function db_group_by($indexname, $fieldnames) {
518 if ($fieldnames[0] != "UNIQUE") {
522 array_shift($fieldnames);
525 foreach ($fieldnames AS $fieldname) {
529 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
530 $names .= "`".dbesc($matches[1])."`";
532 $names .= "`".dbesc($fieldname)."`";
536 $sql = sprintf(" GROUP BY %s", $names);
540 function db_definition() {
544 $database["addon"] = array(
546 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
547 "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
548 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
549 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
550 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
551 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
552 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
555 "PRIMARY" => array("id"),
556 "name" => array("UNIQUE", "name"),
559 $database["attach"] = array(
561 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
562 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
563 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
564 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
565 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
566 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
567 "data" => array("type" => "longblob", "not null" => "1"),
568 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
569 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
570 "allow_cid" => array("type" => "mediumtext"),
571 "allow_gid" => array("type" => "mediumtext"),
572 "deny_cid" => array("type" => "mediumtext"),
573 "deny_gid" => array("type" => "mediumtext"),
576 "PRIMARY" => array("id"),
579 $database["auth_codes"] = array(
581 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
582 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
583 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
584 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
585 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
588 "PRIMARY" => array("id"),
591 $database["cache"] = array(
593 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
594 "v" => array("type" => "mediumtext"),
595 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
596 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
599 "PRIMARY" => array("k"),
600 "expire_mode_updated" => array("expire_mode", "updated"),
603 $database["challenge"] = array(
605 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
606 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
607 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
608 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
609 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
610 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
613 "PRIMARY" => array("id"),
616 $database["clients"] = array(
618 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
619 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
620 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
621 "name" => array("type" => "text"),
622 "icon" => array("type" => "text"),
623 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
626 "PRIMARY" => array("client_id"),
629 $database["config"] = array(
631 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
632 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
633 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
634 "v" => array("type" => "mediumtext"),
637 "PRIMARY" => array("id"),
638 "cat_k" => array("UNIQUE", "cat", "k"),
641 $database["contact"] = array(
643 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
644 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
645 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
646 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
647 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
648 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
649 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
650 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
651 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
652 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
653 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
654 "about" => array("type" => "text"),
655 "keywords" => array("type" => "text"),
656 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
657 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
658 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
659 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
660 "photo" => array("type" => "text"),
661 "thumb" => array("type" => "text"),
662 "micro" => array("type" => "text"),
663 "site-pubkey" => array("type" => "text"),
664 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
665 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
666 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
667 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
668 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
669 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
670 "pubkey" => array("type" => "text"),
671 "prvkey" => array("type" => "text"),
672 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
673 "request" => array("type" => "text"),
674 "notify" => array("type" => "text"),
675 "poll" => array("type" => "text"),
676 "confirm" => array("type" => "text"),
677 "poco" => array("type" => "text"),
678 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
679 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
680 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
681 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
682 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
683 "last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
684 "success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
685 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
686 "name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
687 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
688 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
689 "term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
690 "last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
691 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
692 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
693 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
694 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
695 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
696 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
697 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
698 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
699 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
700 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
701 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
702 "reason" => array("type" => "text"),
703 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
704 "info" => array("type" => "mediumtext"),
705 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
706 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
707 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
708 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
709 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
710 "ffi_keyword_blacklist" => array("type" => "text"),
713 "PRIMARY" => array("id"),
714 "uid_name" => array("uid", "name"),
715 "self_uid" => array("self", "uid"),
716 "alias_uid" => array("alias(32)", "uid"),
717 "pending_uid" => array("pending", "uid"),
718 "blocked_uid" => array("blocked", "uid"),
719 "uid_rel_network_poll" => array("uid", "rel", "network", "poll(64)", "archive"),
720 "uid_network_batch" => array("uid", "network", "batch(64)"),
721 "addr_uid" => array("addr(32)", "uid"),
722 "nurl_uid" => array("nurl(32)", "uid"),
723 "nick_uid" => array("nick(32)", "uid"),
724 "dfrn-id" => array("dfrn-id"),
725 "issued-id" => array("issued-id"),
728 $database["conv"] = array(
730 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
731 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
732 "recips" => array("type" => "text"),
733 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
734 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
735 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
736 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
737 "subject" => array("type" => "text"),
740 "PRIMARY" => array("id"),
741 "uid" => array("uid"),
744 $database["event"] = array(
746 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
747 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
748 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
749 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
750 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
751 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
752 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
753 "start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
754 "finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
755 "summary" => array("type" => "text"),
756 "desc" => array("type" => "text"),
757 "location" => array("type" => "text"),
758 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
759 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
760 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
761 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
762 "allow_cid" => array("type" => "mediumtext"),
763 "allow_gid" => array("type" => "mediumtext"),
764 "deny_cid" => array("type" => "mediumtext"),
765 "deny_gid" => array("type" => "mediumtext"),
768 "PRIMARY" => array("id"),
769 "uid_start" => array("uid", "start"),
772 $database["fcontact"] = array(
774 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
775 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
776 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
777 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
778 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
779 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
780 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
781 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
782 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
783 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
784 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
785 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
786 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
787 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
788 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
789 "pubkey" => array("type" => "text"),
790 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
793 "PRIMARY" => array("id"),
794 "addr" => array("addr(32)"),
795 "url" => array("url"),
798 $database["ffinder"] = array(
800 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
801 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
802 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
803 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
806 "PRIMARY" => array("id"),
809 $database["fserver"] = array(
811 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
812 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
813 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
814 "key" => array("type" => "text"),
817 "PRIMARY" => array("id"),
818 "server" => array("server(32)"),
821 $database["fsuggest"] = array(
823 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
824 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
825 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
826 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
827 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
828 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
829 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
830 "note" => array("type" => "text"),
831 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
834 "PRIMARY" => array("id"),
837 $database["gcign"] = array(
839 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
840 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
841 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
844 "PRIMARY" => array("id"),
845 "uid" => array("uid"),
846 "gcid" => array("gcid"),
849 $database["gcontact"] = array(
851 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
852 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
853 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
854 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
855 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
856 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
857 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
858 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
859 "updated" => array("type" => "datetime", "default" => NULL_DATE),
860 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
861 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
862 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
863 "about" => array("type" => "text"),
864 "keywords" => array("type" => "text"),
865 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
866 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
867 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
868 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
869 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
870 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
871 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
872 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
873 "notify" => array("type" => "text"),
874 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
875 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
876 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
879 "PRIMARY" => array("id"),
880 "nurl" => array("nurl(64)"),
881 "name" => array("name(64)"),
882 "nick" => array("nick(32)"),
883 "addr" => array("addr(64)"),
884 "hide_network_updated" => array("hide", "network", "updated"),
885 "updated" => array("updated"),
888 $database["glink"] = array(
890 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
891 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
892 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
893 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
894 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
895 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
898 "PRIMARY" => array("id"),
899 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
900 "gcid" => array("gcid"),
903 $database["group"] = array(
905 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
906 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
907 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
908 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
909 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
912 "PRIMARY" => array("id"),
913 "uid" => array("uid"),
916 $database["group_member"] = array(
918 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
919 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
920 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
921 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
924 "PRIMARY" => array("id"),
925 "contactid" => array("contact-id"),
926 "gid_contactid" => array("gid", "contact-id"),
927 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
930 $database["gserver"] = array(
932 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
933 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
934 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
935 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
936 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
937 "info" => array("type" => "text"),
938 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
939 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
940 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
941 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
942 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
943 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
944 "last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
945 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
946 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
949 "PRIMARY" => array("id"),
950 "nurl" => array("nurl(32)"),
953 $database["hook"] = array(
955 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
956 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
957 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
958 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
959 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
962 "PRIMARY" => array("id"),
963 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
966 $database["intro"] = array(
968 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
969 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
970 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
971 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
972 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
973 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
974 "note" => array("type" => "text"),
975 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
976 "datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
977 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
978 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
981 "PRIMARY" => array("id"),
984 $database["item"] = array(
986 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
987 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
988 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
989 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
990 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
991 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
992 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
993 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
994 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
995 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
996 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
997 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
998 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
999 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1000 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1001 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1002 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1003 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1004 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1005 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1006 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1007 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1008 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1009 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1010 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1011 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1012 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1013 "body" => array("type" => "mediumtext"),
1014 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1015 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1016 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1017 "object" => array("type" => "text"),
1018 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1019 "target" => array("type" => "text"),
1020 "postopts" => array("type" => "text"),
1021 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1022 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1023 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1024 "tag" => array("type" => "mediumtext"),
1025 "attach" => array("type" => "mediumtext"),
1026 "inform" => array("type" => "mediumtext"),
1027 "file" => array("type" => "mediumtext"),
1028 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1029 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1030 "allow_cid" => array("type" => "mediumtext"),
1031 "allow_gid" => array("type" => "mediumtext"),
1032 "deny_cid" => array("type" => "mediumtext"),
1033 "deny_gid" => array("type" => "mediumtext"),
1034 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1035 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1036 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1037 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1038 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1039 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1040 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1041 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1042 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1043 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1044 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1045 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1046 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1047 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1048 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1049 "rendered-html" => array("type" => "mediumtext"),
1050 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1053 "PRIMARY" => array("id"),
1054 "guid" => array("guid"),
1055 "uri" => array("uri"),
1056 "parent" => array("parent"),
1057 "parent-uri" => array("parent-uri"),
1058 "extid" => array("extid"),
1059 "uid_id" => array("uid","id"),
1060 "uid_contactid_id" => array("uid","contact-id","id"),
1061 "uid_created" => array("uid","created"),
1062 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1063 "uid_network_received" => array("uid","network","received"),
1064 "uid_network_commented" => array("uid","network","commented"),
1065 "uid_thrparent" => array("uid","thr-parent"),
1066 "uid_parenturi" => array("uid","parent-uri"),
1067 "uid_contactid_created" => array("uid","contact-id","created"),
1068 "authorid_created" => array("author-id","created"),
1069 "uid_uri" => array("uid", "uri"),
1070 "resource-id" => array("resource-id"),
1071 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1072 "uid_type_changed" => array("uid","type","changed"),
1073 "contactid_verb" => array("contact-id","verb"),
1074 "deleted_changed" => array("deleted","changed"),
1075 "uid_wall_changed" => array("uid","wall","changed"),
1076 "uid_eventid" => array("uid","event-id"),
1077 "uid_authorlink" => array("uid","author-link"),
1078 "uid_ownerlink" => array("uid","owner-link"),
1081 $database["item_id"] = array(
1083 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1084 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1085 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1086 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1087 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1090 "PRIMARY" => array("id"),
1091 "uid" => array("uid"),
1092 "sid" => array("sid"),
1093 "service" => array("service(32)"),
1094 "iid" => array("iid"),
1097 $database["locks"] = array(
1099 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1100 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1101 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1102 "created" => array("type" => "datetime", "default" => NULL_DATE),
1105 "PRIMARY" => array("id"),
1108 $database["mail"] = array(
1110 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1111 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1112 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1113 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1114 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1115 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1116 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1117 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1118 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1119 "body" => array("type" => "mediumtext"),
1120 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1121 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1122 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1123 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1124 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1125 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1126 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1129 "PRIMARY" => array("id"),
1130 "uid_seen" => array("uid", "seen"),
1131 "convid" => array("convid"),
1132 "uri" => array("uri(64)"),
1133 "parent-uri" => array("parent-uri(64)"),
1136 $database["mailacct"] = array(
1138 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1139 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1140 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1141 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1142 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1143 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1144 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1145 "pass" => array("type" => "text"),
1146 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1147 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1148 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1149 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1150 "last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1153 "PRIMARY" => array("id"),
1156 $database["manage"] = array(
1158 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1159 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1160 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1163 "PRIMARY" => array("id"),
1164 "uid_mid" => array("UNIQUE", "uid","mid"),
1167 $database["notify"] = array(
1169 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1170 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1171 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1172 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1173 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1174 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1175 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1176 "msg" => array("type" => "mediumtext"),
1177 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1178 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1179 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1180 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1181 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1182 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1183 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1184 "name_cache" => array("type" => "tinytext"),
1185 "msg_cache" => array("type" => "mediumtext")
1188 "PRIMARY" => array("id"),
1189 "hash_uid" => array("hash", "uid"),
1190 "seen_uid_date" => array("seen", "uid", "date"),
1191 "uid_date" => array("uid", "date"),
1192 "uid_type_link" => array("uid", "type", "link"),
1195 $database["notify-threads"] = array(
1197 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1198 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1199 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1200 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1201 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1204 "PRIMARY" => array("id"),
1207 $database["oembed"] = array(
1209 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1210 "content" => array("type" => "mediumtext"),
1211 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1214 "PRIMARY" => array("url"),
1215 "created" => array("created"),
1218 $database["parsed_url"] = array(
1220 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1221 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1222 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1223 "content" => array("type" => "mediumtext"),
1224 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1227 "PRIMARY" => array("url", "guessing", "oembed"),
1228 "created" => array("created"),
1231 $database["pconfig"] = array(
1233 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1234 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1235 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1236 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1237 "v" => array("type" => "mediumtext"),
1240 "PRIMARY" => array("id"),
1241 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1244 $database["photo"] = array(
1246 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1247 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1248 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1249 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1250 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1251 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1252 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1253 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1254 "desc" => array("type" => "text"),
1255 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1256 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1257 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1258 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1259 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1260 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1261 "data" => array("type" => "mediumblob", "not null" => "1"),
1262 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1263 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1264 "allow_cid" => array("type" => "mediumtext"),
1265 "allow_gid" => array("type" => "mediumtext"),
1266 "deny_cid" => array("type" => "mediumtext"),
1267 "deny_gid" => array("type" => "mediumtext"),
1270 "PRIMARY" => array("id"),
1271 "uid_contactid" => array("uid", "contact-id"),
1272 "uid_profile" => array("uid", "profile"),
1273 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1274 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1275 "resource-id" => array("resource-id(64)"),
1278 $database["poll"] = 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 "q0" => array("type" => "text"),
1283 "q1" => array("type" => "text"),
1284 "q2" => array("type" => "text"),
1285 "q3" => array("type" => "text"),
1286 "q4" => array("type" => "text"),
1287 "q5" => array("type" => "text"),
1288 "q6" => array("type" => "text"),
1289 "q7" => array("type" => "text"),
1290 "q8" => array("type" => "text"),
1291 "q9" => array("type" => "text"),
1294 "PRIMARY" => array("id"),
1295 "uid" => array("uid"),
1298 $database["poll_result"] = array(
1300 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1301 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1302 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1305 "PRIMARY" => array("id"),
1306 "poll_id" => array("poll_id"),
1307 "choice" => array("choice"),
1310 $database["process"] = array(
1312 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1313 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1314 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1317 "PRIMARY" => array("pid"),
1318 "command" => array("command"),
1321 $database["profile"] = array(
1323 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1324 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1325 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1326 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1327 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1328 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1329 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1330 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1331 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1332 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1333 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1334 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1335 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1336 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1337 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1338 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1339 "with" => array("type" => "text"),
1340 "howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1341 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1342 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1343 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1344 "pub_keywords" => array("type" => "text"),
1345 "prv_keywords" => array("type" => "text"),
1346 "likes" => array("type" => "text"),
1347 "dislikes" => array("type" => "text"),
1348 "about" => array("type" => "text"),
1349 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1350 "music" => array("type" => "text"),
1351 "book" => array("type" => "text"),
1352 "tv" => array("type" => "text"),
1353 "film" => array("type" => "text"),
1354 "interest" => array("type" => "text"),
1355 "romance" => array("type" => "text"),
1356 "work" => array("type" => "text"),
1357 "education" => array("type" => "text"),
1358 "contact" => array("type" => "text"),
1359 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1360 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1361 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1362 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1363 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1364 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1367 "PRIMARY" => array("id"),
1368 "uid_is-default" => array("uid", "is-default"),
1371 $database["profile_check"] = array(
1373 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1374 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1375 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1376 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1377 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1378 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1381 "PRIMARY" => array("id"),
1384 $database["push_subscriber"] = array(
1386 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1387 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1388 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1389 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1390 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1391 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1392 "last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1393 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1396 "PRIMARY" => array("id"),
1399 $database["queue"] = array(
1401 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1402 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1403 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1404 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1405 "last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1406 "content" => array("type" => "mediumtext"),
1407 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1410 "PRIMARY" => array("id"),
1411 "cid" => array("cid"),
1412 "created" => array("created"),
1413 "last" => array("last"),
1414 "network" => array("network"),
1415 "batch" => array("batch"),
1418 $database["register"] = array(
1420 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1421 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1422 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1423 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1424 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1425 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1426 "note" => array("type" => "text"),
1429 "PRIMARY" => array("id"),
1432 $database["search"] = array(
1434 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1435 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1436 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1439 "PRIMARY" => array("id"),
1440 "uid" => array("uid"),
1443 $database["session"] = array(
1445 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1446 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1447 "data" => array("type" => "text"),
1448 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1451 "PRIMARY" => array("id"),
1452 "sid" => array("sid(64)"),
1453 "expire" => array("expire"),
1456 $database["sign"] = array(
1458 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1459 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1460 "signed_text" => array("type" => "mediumtext"),
1461 "signature" => array("type" => "text"),
1462 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1465 "PRIMARY" => array("id"),
1466 "iid" => array("iid"),
1469 $database["spam"] = array(
1471 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1472 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1473 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1474 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1475 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1476 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1479 "PRIMARY" => array("id"),
1480 "uid" => array("uid"),
1481 "spam" => array("spam"),
1482 "ham" => array("ham"),
1483 "term" => array("term"),
1486 $database["term"] = array(
1488 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1489 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1490 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1491 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1492 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1493 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1494 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1495 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1496 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1497 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1498 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1499 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1502 "PRIMARY" => array("tid"),
1503 "oid_otype_type_term" => array("oid","otype","type","term"),
1504 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1505 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1506 "guid" => array("guid(64)"),
1509 $database["thread"] = array(
1511 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1512 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1513 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1514 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1515 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1516 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1517 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1518 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1519 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1520 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1521 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1522 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1523 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1524 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1525 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1526 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1527 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1528 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1529 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1530 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1531 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1532 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1533 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1534 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1535 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1536 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1539 "PRIMARY" => array("iid"),
1540 "uid_network_commented" => array("uid","network","commented"),
1541 "uid_network_created" => array("uid","network","created"),
1542 "uid_contactid_commented" => array("uid","contact-id","commented"),
1543 "uid_contactid_created" => array("uid","contact-id","created"),
1544 "uid_created" => array("uid","created"),
1545 "uid_commented" => array("uid","commented"),
1546 "uid_wall_created" => array("uid","wall","created"),
1549 $database["tokens"] = array(
1551 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1552 "secret" => array("type" => "text"),
1553 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1554 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1555 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1556 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1559 "PRIMARY" => array("id"),
1562 $database["user"] = array(
1564 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1565 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1566 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1567 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1568 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1569 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1570 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1571 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1572 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1573 "register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1574 "login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1575 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1576 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1577 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1578 "pubkey" => array("type" => "text"),
1579 "prvkey" => array("type" => "text"),
1580 "spubkey" => array("type" => "text"),
1581 "sprvkey" => array("type" => "text"),
1582 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1583 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1584 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1585 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1586 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1587 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1588 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1589 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1590 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1591 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1592 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1593 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1594 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1595 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1596 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1597 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1598 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1599 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1600 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1601 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1602 "allow_cid" => array("type" => "mediumtext"),
1603 "allow_gid" => array("type" => "mediumtext"),
1604 "deny_cid" => array("type" => "mediumtext"),
1605 "deny_gid" => array("type" => "mediumtext"),
1606 "openidserver" => array("type" => "text"),
1609 "PRIMARY" => array("uid"),
1610 "nickname" => array("nickname(32)"),
1613 $database["userd"] = array(
1615 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1616 "username" => array("type" => "varchar(255)", "not null" => "1"),
1619 "PRIMARY" => array("id"),
1620 "username" => array("username(32)"),
1623 $database["workerqueue"] = array(
1625 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1626 "parameter" => array("type" => "text"),
1627 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1628 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1629 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1630 "executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1633 "PRIMARY" => array("id"),
1642 * run from command line
1644 function dbstructure_run(&$argv, &$argc) {
1652 @include(".htconfig.php");
1653 require_once("include/dba.php");
1654 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1655 unset($db_host, $db_user, $db_pass, $db_data);
1661 update_structure(true, false);
1664 update_structure(true, true);
1666 $build = get_config('system','build');
1668 set_config('system','build',DB_UPDATE_VERSION);
1669 $build = DB_UPDATE_VERSION;
1672 $stored = intval($build);
1673 $current = intval(DB_UPDATE_VERSION);
1675 // run any left update_nnnn functions in update.php
1676 for($x = $stored; $x < $current; $x ++) {
1677 $r = run_update_function($x);
1681 set_config('system','build',DB_UPDATE_VERSION);
1684 print_structure(db_definition());
1691 echo $argv[0]." <command>\n";
1694 echo "dryrun show database update schema queries without running them\n";
1695 echo "update update database schema\n";
1696 echo "dumpsql dump database schema\n";
1701 if (array_search(__file__,get_included_files())===0){
1702 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);