4 use Friendica\Core\System;
5 use Friendica\Core\Config;
6 use Friendica\Database\DBM;
8 require_once "boot.php";
9 require_once "include/text.php";
11 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
13 const DB_UPDATE_NOT_CHECKED = 0; // Database check wasn't executed before
14 const DB_UPDATE_SUCCESSFUL = 1; // Database check was successful
15 const DB_UPDATE_FAILED = 2; // Database check failed
18 * Converts all tables from MyISAM to InnoDB
20 function convert_to_innodb() {
21 $r = q("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `engine` = 'MyISAM' AND `table_schema` = '%s'",
22 dbesc(dba::database_name()));
24 if (!DBM::is_result($r)) {
25 echo t('There are no tables on MyISAM.')."\n";
29 foreach ($r AS $table) {
30 $sql = sprintf("ALTER TABLE `%s` engine=InnoDB;", dbesc($table['TABLE_NAME']));
33 $result = dba::e($sql);
34 if (!DBM::is_result($result)) {
35 print_update_error($sql);
41 * send the email and do what is needed to do on update fails
43 * @param update_id (int) number of failed update
44 * @param error_message (str) error message
46 function update_fail($update_id, $error_message) {
47 //send the administrators an e-mail
48 $admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
49 $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
54 if (!DBM::is_result($adminlist)) {
55 logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_NORMAL);
61 // every admin could had different language
62 foreach ($adminlist as $admin) {
63 $lang = (($admin['language'])?$admin['language']:'en');
66 $preamble = deindent(t("
67 The friendica developers released update %s recently,
68 but when I tried to install it, something went terribly wrong.
69 This needs to be fixed soon and I can't do it alone. Please contact a
70 friendica developer if you can not help me on your own. My database might be invalid."));
71 $body = t("The error message is\n[pre]%s[/pre]");
72 $preamble = sprintf($preamble, $update_id);
73 $body = sprintf($body, $error_message);
76 'type' => SYSTEM_EMAIL,
77 'to_email' => $admin['email'],
78 'preamble' => $preamble,
88 @TODO deprecated code?
89 $email_tpl = get_intltext_template("update_fail_eml.tpl");
90 $email_msg = replace_macros($email_tpl, array(
91 '$sitename' => $a->config['sitename'],
92 '$siteurl' => System::baseUrl(),
93 '$update' => DB_UPDATE_VERSION,
94 '$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
96 $subject=sprintf(t('Update Error at %s'), System::baseUrl());
97 require_once('include/email.php');
98 $subject = email_header_encode($subject,'UTF-8');
99 mail($a->config['admin_email'], $subject, $email_msg,
100 'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n"
101 .'Content-type: text/plain; charset=UTF-8'."\n"
102 .'Content-transfer-encoding: 8bit');
105 logger("CRITICAL: Database structure update failed: ".$retval);
109 function table_structure($table) {
110 $structures = q("DESCRIBE `%s`", $table);
112 $full_columns = q("SHOW FULL COLUMNS FROM `%s`", $table);
114 $indexes = q("SHOW INDEX FROM `%s`", $table);
116 $table_status = q("SHOW TABLE STATUS WHERE `name` = '%s'", $table);
118 if (DBM::is_result($table_status)) {
119 $table_status = $table_status[0];
121 $table_status = array();
124 $fielddata = array();
125 $indexdata = array();
127 if (DBM::is_result($indexes))
128 foreach ($indexes AS $index) {
129 if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
130 $indexdata[$index["Key_name"]] = array('UNIQUE');
133 $column = $index["Column_name"];
135 if (($index["Sub_part"] != "")) {
136 $column .= "(".$index["Sub_part"].")";
139 $indexdata[$index["Key_name"]][] = $column;
141 if (DBM::is_result($structures)) {
142 foreach ($structures AS $field) {
143 $fielddata[$field["Field"]]["type"] = $field["Type"];
144 if ($field["Null"] == "NO") {
145 $fielddata[$field["Field"]]["not null"] = true;
148 if (isset($field["Default"])) {
149 $fielddata[$field["Field"]]["default"] = $field["Default"];
152 if ($field["Extra"] != "") {
153 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
156 if ($field["Key"] == "PRI") {
157 $fielddata[$field["Field"]]["primary"] = true;
161 if (DBM::is_result($full_columns)) {
162 foreach ($full_columns AS $column) {
163 $fielddata[$column["Field"]]["Collation"] = $column["Collation"];
167 return array("fields" => $fielddata, "indexes" => $indexdata, "table_status" => $table_status);
170 function print_structure($database) {
171 echo "-- ------------------------------------------\n";
172 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
173 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
174 echo "-- ------------------------------------------\n\n\n";
175 foreach ($database AS $name => $structure) {
177 echo "-- TABLE $name\n";
179 db_create_table($name, $structure['fields'], true, false, $structure["indexes"]);
186 * @brief Print out database error messages
188 * @param string $message Message to be added to the error message
190 * @return string Error message
192 function print_update_error($message) {
193 echo sprintf(t("\nError %d occurred during database update:\n%s\n"),
194 dba::errorNo(), dba::errorMessage());
196 return t('Errors encountered performing database changes: ').$message.EOL;
199 function update_structure($verbose, $action, $tables=null, $definition=null) {
203 Config::set('system', 'maintenance', 1);
204 Config::set('system', 'maintenance_reason', sprintf(t(': Database update'), DBM::date().' '.date('e')));
209 logger('updating structure', LOGGER_DEBUG);
211 // Get the current structure
214 if (is_null($tables)) {
215 $tables = q("SHOW TABLES");
218 if (DBM::is_result($tables)) {
219 foreach ($tables AS $table) {
220 $table = current($table);
222 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
223 $database[$table] = table_structure($table);
227 // Get the definition
228 if (is_null($definition)) {
229 $definition = db_definition();
232 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
233 if ((version_compare(dba::server_info(), '5.7.4') >= 0) &&
234 !(strpos(dba::server_info(), 'MariaDB') !== false)) {
241 foreach ($definition AS $name => $structure) {
242 $is_new_table = False;
245 if (!isset($database[$name])) {
246 $r = db_create_table($name, $structure["fields"], $verbose, $action, $structure['indexes']);
247 if (!DBM::is_result($r)) {
248 $errors .= print_update_error($name);
250 $is_new_table = True;
255 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
256 if (isset($database[$name]["indexes"][$indexname])) {
257 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
259 $current_index_definition = "__NOT_SET__";
261 $new_index_definition = implode(",",$fieldnames);
262 if ($current_index_definition != $new_index_definition) {
263 if ($fieldnames[0] == "UNIQUE") {
266 $temp_name = "temp-".$name;
273 * Drop the index if it isn't present in the definition
274 * or the definition differ from current status
275 * and index name doesn't start with "local_"
277 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
278 $current_index_definition = implode(",",$fieldnames);
279 if (isset($structure["indexes"][$indexname])) {
280 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
282 $new_index_definition = "__NOT_SET__";
284 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
285 $sql2=db_drop_index($indexname);
287 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
293 // Compare the field structure field by field
294 foreach ($structure["fields"] AS $fieldname => $parameters) {
295 if (!isset($database[$name]["fields"][$fieldname])) {
296 $sql2=db_add_table_field($fieldname, $parameters);
298 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
303 // Compare the field definition
304 $field_definition = $database[$name]["fields"][$fieldname];
306 // Remove the relation data that is used for the referential integrity
307 unset($parameters['relation']);
309 // We change the collation after the indexes had been changed.
310 // This is done to avoid index length problems.
311 // So here we always ensure that there is no need to change it.
312 unset($parameters['Collation']);
313 unset($field_definition['Collation']);
315 $current_field_definition = implode(",", $field_definition);
316 $new_field_definition = implode(",", $parameters);
317 if ($current_field_definition != $new_field_definition) {
318 $sql2 = db_modify_table_field($fieldname, $parameters);
320 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
330 * Create the index if the index don't exists in database
331 * or the definition differ from the current status.
332 * Don't create keys if table is new
334 if (!$is_new_table) {
335 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
336 if (isset($database[$name]["indexes"][$indexname])) {
337 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
339 $current_index_definition = "__NOT_SET__";
341 $new_index_definition = implode(",",$fieldnames);
342 if ($current_index_definition != $new_index_definition) {
343 $sql2 = db_create_index($indexname, $fieldnames);
345 // Fetch the "group by" fields for unique indexes
346 if ($fieldnames[0] == "UNIQUE") {
347 $group_by = db_group_by($indexname, $fieldnames);
351 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
359 if (isset($database[$name]["table_status"]["Collation"])) {
360 if ($database[$name]["table_status"]["Collation"] != 'utf8mb4_general_ci') {
361 $sql2 = "DEFAULT COLLATE utf8mb4_general_ci";
364 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
375 // Now have a look at the field collations
376 // Compare the field structure field by field
377 foreach ($structure["fields"] AS $fieldname => $parameters) {
378 // Compare the field definition
379 $field_definition = $database[$name]["fields"][$fieldname];
381 // Define the default collation if not given
382 if (!isset($parameters['Collation']) && !is_null($field_definition['Collation'])) {
383 $parameters['Collation'] = 'utf8mb4_general_ci';
385 $parameters['Collation'] = null;
388 if ($field_definition['Collation'] != $parameters['Collation']) {
389 $sql2 = db_modify_table_field($fieldname, $parameters);
390 if (($sql3 == "") || (substr($sql3, -2, 2) == "; ")) {
391 $sql3 .= "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
400 if (substr($sql3, -2, 2) != "; ") {
405 if ($is_unique && $ignore == '') {
406 foreach ($structure['fields'] AS $fieldname => $parameters) {
407 $field_list .= 'ANY_VALUE(`' . $fieldname . '`),';
409 $field_list = rtrim($field_list, ',');
413 // Ensure index conversion to unique removes duplicates
414 if ($is_unique && ($temp_name != $name)) {
416 echo "SET session old_alter_table=1;\n";
418 echo "DROP TABLE IF EXISTS `".$temp_name."`;\n";
419 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
425 if ($is_unique && ($temp_name != $name)) {
427 echo "SET session old_alter_table=0;\n";
429 echo "INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";\n";
430 echo "DROP TABLE `".$name."`;\n";
431 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
437 Config::set('system', 'maintenance_reason', sprintf(t('%s: updating %s table.'), DBM::date().' '.date('e'), $name));
439 // Ensure index conversion to unique removes duplicates
440 if ($is_unique && ($temp_name != $name)) {
442 dba::e("SET session old_alter_table=1;");
444 dba::e("DROP TABLE IF EXISTS `".$temp_name."`;");
445 if (!DBM::is_result($r)) {
446 $errors .= print_update_error($sql3);
450 $r = dba::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
451 if (!DBM::is_result($r)) {
452 $errors .= print_update_error($sql3);
459 if (!DBM::is_result($r)) {
460 $errors .= print_update_error($sql3);
462 if ($is_unique && ($temp_name != $name)) {
464 dba::e("SET session old_alter_table=0;");
466 $r = dba::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
467 if (!DBM::is_result($r)) {
468 $errors .= print_update_error($sql3);
471 $r = dba::e("DROP TABLE `".$name."`;");
472 if (!DBM::is_result($r)) {
473 $errors .= print_update_error($sql3);
476 $r = dba::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
477 if (!DBM::is_result($r)) {
478 $errors .= print_update_error($sql3);
488 Config::set('system', 'maintenance', 0);
489 Config::set('system', 'maintenance_reason', '');
493 Config::set('system', 'dbupdate', DB_UPDATE_FAILED);
495 Config::set('system', 'dbupdate', DB_UPDATE_SUCCESSFUL);
501 function db_field_command($parameters, $create = true) {
502 $fieldstruct = $parameters["type"];
504 if (!is_null($parameters["Collation"])) {
505 $fieldstruct .= " COLLATE ".$parameters["Collation"];
508 if ($parameters["not null"])
509 $fieldstruct .= " NOT NULL";
511 if (isset($parameters["default"])) {
512 if (strpos(strtolower($parameters["type"]),"int")!==false) {
513 $fieldstruct .= " DEFAULT ".$parameters["default"];
515 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
518 if ($parameters["extra"] != "")
519 $fieldstruct .= " ".$parameters["extra"];
521 /*if (($parameters["primary"] != "") && $create)
522 $fieldstruct .= " PRIMARY KEY";*/
524 return($fieldstruct);
527 function db_create_table($name, $fields, $verbose, $action, $indexes=null) {
535 $primary_keys = array();
536 foreach ($fields AS $fieldname => $field) {
537 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
538 if (x($field,'primary') && $field['primary']!='') {
539 $primary_keys[] = $fieldname;
543 if (!is_null($indexes)) {
544 foreach ($indexes AS $indexname => $fieldnames) {
545 $sql_index = db_create_index($indexname, $fieldnames, "");
546 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
550 $sql = implode(",\n\t", $sql_rows);
552 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT COLLATE utf8mb4_general_ci";
562 function db_add_table_field($fieldname, $parameters) {
563 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
567 function db_modify_table_field($fieldname, $parameters) {
568 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
572 function db_drop_index($indexname) {
573 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
577 function db_create_index($indexname, $fieldnames, $method="ADD") {
579 $method = strtoupper(trim($method));
580 if ($method!="" && $method!="ADD") {
581 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
585 if ($fieldnames[0] == "UNIQUE") {
586 array_shift($fieldnames);
587 $method .= ' UNIQUE';
591 foreach ($fieldnames AS $fieldname) {
595 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
596 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
598 $names .= "`".dbesc($fieldname)."`";
602 if ($indexname == "PRIMARY") {
603 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
607 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
611 function db_group_by($indexname, $fieldnames) {
613 if ($fieldnames[0] != "UNIQUE") {
617 array_shift($fieldnames);
620 foreach ($fieldnames AS $fieldname) {
624 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
625 $names .= "`".dbesc($matches[1])."`";
627 $names .= "`".dbesc($fieldname)."`";
631 $sql = sprintf(" GROUP BY %s", $names);
635 function db_definition() {
639 $database["addon"] = array(
641 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
642 "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
643 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
644 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
645 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
646 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
647 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
650 "PRIMARY" => array("id"),
651 "name" => array("UNIQUE", "name"),
654 $database["attach"] = array(
656 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
657 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
658 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
659 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
660 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
661 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
662 "data" => array("type" => "longblob", "not null" => "1"),
663 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
664 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
665 "allow_cid" => array("type" => "mediumtext"),
666 "allow_gid" => array("type" => "mediumtext"),
667 "deny_cid" => array("type" => "mediumtext"),
668 "deny_gid" => array("type" => "mediumtext"),
671 "PRIMARY" => array("id"),
674 $database["auth_codes"] = array(
676 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
677 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
678 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
679 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
680 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
683 "PRIMARY" => array("id"),
686 $database["cache"] = array(
688 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
689 "v" => array("type" => "mediumtext"),
690 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
691 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
694 "PRIMARY" => array("k"),
695 "expire_mode_updated" => array("expire_mode", "updated"),
698 $database["challenge"] = array(
700 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
701 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
702 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
703 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
704 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
705 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
708 "PRIMARY" => array("id"),
711 $database["clients"] = array(
713 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
714 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
715 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
716 "name" => array("type" => "text"),
717 "icon" => array("type" => "text"),
718 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
721 "PRIMARY" => array("client_id"),
724 $database["config"] = array(
726 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
727 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
728 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
729 "v" => array("type" => "mediumtext"),
732 "PRIMARY" => array("id"),
733 "cat_k" => array("UNIQUE", "cat", "k"),
736 $database["contact"] = array(
738 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
739 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
740 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
741 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
742 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
743 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
744 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
745 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
746 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
747 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
748 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
749 "about" => array("type" => "text"),
750 "keywords" => array("type" => "text"),
751 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
752 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
753 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
754 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
755 "photo" => array("type" => "text"),
756 "thumb" => array("type" => "text"),
757 "micro" => array("type" => "text"),
758 "site-pubkey" => array("type" => "text"),
759 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
760 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
761 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
762 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
763 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
764 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
765 "pubkey" => array("type" => "text"),
766 "prvkey" => array("type" => "text"),
767 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
768 "request" => array("type" => "text"),
769 "notify" => array("type" => "text"),
770 "poll" => array("type" => "text"),
771 "confirm" => array("type" => "text"),
772 "poco" => array("type" => "text"),
773 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
774 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
775 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
776 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
777 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
778 "last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
779 "success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
780 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
781 "name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
782 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
783 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
784 "term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
785 "last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
786 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
787 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
788 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
789 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
790 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
791 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
792 "contact-type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
793 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
794 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
795 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
796 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
797 "reason" => array("type" => "text"),
798 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
799 "info" => array("type" => "mediumtext"),
800 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
801 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
802 "bd" => array("type" => "date", "not null" => "1", "default" => "0001-01-01"),
803 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
804 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
805 "ffi_keyword_blacklist" => array("type" => "text"),
808 "PRIMARY" => array("id"),
809 "uid_name" => array("uid", "name(190)"),
810 "self_uid" => array("self", "uid"),
811 "alias_uid" => array("alias(32)", "uid"),
812 "pending_uid" => array("pending", "uid"),
813 "blocked_uid" => array("blocked", "uid"),
814 "uid_rel_network_poll" => array("uid", "rel", "network(4)", "poll(64)", "archive"),
815 "uid_network_batch" => array("uid", "network(4)", "batch(64)"),
816 "addr_uid" => array("addr(32)", "uid"),
817 "nurl_uid" => array("nurl(32)", "uid"),
818 "nick_uid" => array("nick(32)", "uid"),
819 "dfrn-id" => array("dfrn-id(64)"),
820 "issued-id" => array("issued-id(64)"),
823 $database["conv"] = array(
825 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
826 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
827 "recips" => array("type" => "text"),
828 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
829 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
830 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
831 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
832 "subject" => array("type" => "text"),
835 "PRIMARY" => array("id"),
836 "uid" => array("uid"),
839 $database["conversation"] = array(
841 "item-uri" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
842 "reply-to-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
843 "conversation-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
844 "conversation-href" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
845 "protocol" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
846 "source" => array("type" => "mediumtext"),
847 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
850 "PRIMARY" => array("item-uri"),
851 "conversation-uri" => array("conversation-uri"),
854 $database["event"] = array(
856 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
857 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
858 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
859 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
860 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
861 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
862 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
863 "start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
864 "finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
865 "summary" => array("type" => "text"),
866 "desc" => array("type" => "text"),
867 "location" => array("type" => "text"),
868 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
869 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
870 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
871 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
872 "allow_cid" => array("type" => "mediumtext"),
873 "allow_gid" => array("type" => "mediumtext"),
874 "deny_cid" => array("type" => "mediumtext"),
875 "deny_gid" => array("type" => "mediumtext"),
878 "PRIMARY" => array("id"),
879 "uid_start" => array("uid", "start"),
882 $database["fcontact"] = array(
884 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
885 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
886 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
887 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
888 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
889 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
890 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
891 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
892 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
893 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
894 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
895 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
896 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
897 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
898 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
899 "pubkey" => array("type" => "text"),
900 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
903 "PRIMARY" => array("id"),
904 "addr" => array("addr(32)"),
905 "url" => array("UNIQUE", "url(190)"),
908 $database["ffinder"] = array(
910 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
911 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
912 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
913 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("fcontact" => "id")),
916 "PRIMARY" => array("id"),
919 $database["fserver"] = array(
921 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
922 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
923 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
924 "key" => array("type" => "text"),
927 "PRIMARY" => array("id"),
928 "server" => array("server(32)"),
931 $database["fsuggest"] = array(
933 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
934 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
935 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
936 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
937 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
938 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
939 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
940 "note" => array("type" => "text"),
941 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
944 "PRIMARY" => array("id"),
947 $database["gcign"] = array(
949 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
950 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
951 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
954 "PRIMARY" => array("id"),
955 "uid" => array("uid"),
956 "gcid" => array("gcid"),
959 $database["gcontact"] = array(
961 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
962 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
963 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
964 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
965 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
966 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
967 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
968 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
969 "updated" => array("type" => "datetime", "default" => NULL_DATE),
970 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
971 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
972 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
973 "about" => array("type" => "text"),
974 "keywords" => array("type" => "text"),
975 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
976 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
977 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
978 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
979 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
980 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
981 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
982 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
983 "notify" => array("type" => "text"),
984 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
985 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
986 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
989 "PRIMARY" => array("id"),
990 "nurl" => array("UNIQUE", "nurl(190)"),
991 "name" => array("name(64)"),
992 "nick" => array("nick(32)"),
993 "addr" => array("addr(64)"),
994 "hide_network_updated" => array("hide", "network(4)", "updated"),
995 "updated" => array("updated"),
998 $database["glink"] = array(
1000 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1001 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1002 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1003 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1004 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1005 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1008 "PRIMARY" => array("id"),
1009 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
1010 "gcid" => array("gcid"),
1013 $database["group"] = array(
1015 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1016 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1017 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1018 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1019 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1022 "PRIMARY" => array("id"),
1023 "uid" => array("uid"),
1026 $database["group_member"] = array(
1028 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1029 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1030 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("group" => "id")),
1031 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1034 "PRIMARY" => array("id"),
1035 "contactid" => array("contact-id"),
1036 "gid_contactid" => array("gid", "contact-id"),
1037 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
1040 $database["gserver"] = array(
1042 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1043 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1044 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1045 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1046 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1047 "info" => array("type" => "text"),
1048 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1049 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1050 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1051 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1052 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1053 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1054 "last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
1055 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
1056 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
1059 "PRIMARY" => array("id"),
1060 "nurl" => array("UNIQUE", "nurl(190)"),
1063 $database["hook"] = array(
1065 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1066 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1067 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1068 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1069 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1072 "PRIMARY" => array("id"),
1073 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
1076 $database["intro"] = array(
1078 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1079 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1080 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("fcontact" => "id")),
1081 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1082 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1083 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1084 "note" => array("type" => "text"),
1085 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1086 "datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1087 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1088 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1091 "PRIMARY" => array("id"),
1094 $database["item"] = array(
1096 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "relation" => array("thread" => "iid")),
1097 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1098 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1099 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1100 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1101 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1102 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1103 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1104 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1105 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1106 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1107 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1108 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1109 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1110 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1111 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1112 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1113 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1114 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1115 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1116 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1117 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1118 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1119 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1120 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1121 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1122 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1123 "body" => array("type" => "mediumtext"),
1124 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1125 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1126 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1127 "object" => array("type" => "text"),
1128 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1129 "target" => array("type" => "text"),
1130 "postopts" => array("type" => "text"),
1131 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1132 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1133 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("event" => "id")),
1134 "tag" => array("type" => "mediumtext"),
1135 "attach" => array("type" => "mediumtext"),
1136 "inform" => array("type" => "mediumtext"),
1137 "file" => array("type" => "mediumtext"),
1138 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1139 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1140 "allow_cid" => array("type" => "mediumtext"),
1141 "allow_gid" => array("type" => "mediumtext"),
1142 "deny_cid" => array("type" => "mediumtext"),
1143 "deny_gid" => array("type" => "mediumtext"),
1144 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1145 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1146 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1147 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1148 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1149 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1150 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1151 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1152 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1153 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1154 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1155 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1156 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1157 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1158 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1159 "rendered-html" => array("type" => "mediumtext"),
1160 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1163 "PRIMARY" => array("id"),
1164 "guid" => array("guid(191)"),
1165 "uri" => array("uri(191)"),
1166 "parent" => array("parent"),
1167 "parent-uri" => array("parent-uri(191)"),
1168 "extid" => array("extid(191)"),
1169 "uid_id" => array("uid","id"),
1170 "uid_contactid_id" => array("uid","contact-id","id"),
1171 "uid_created" => array("uid","created"),
1172 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1173 "uid_network_received" => array("uid","network(4)","received"),
1174 "uid_network_commented" => array("uid","network(4)","commented"),
1175 "uid_thrparent" => array("uid","thr-parent(190)"),
1176 "uid_parenturi" => array("uid","parent-uri(190)"),
1177 "uid_contactid_created" => array("uid","contact-id","created"),
1178 "authorid_created" => array("author-id","created"),
1179 "ownerid" => array("owner-id"),
1180 "uid_uri" => array("uid", "uri(190)"),
1181 "resource-id" => array("resource-id(191)"),
1182 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1183 "uid_type_changed" => array("uid","type(190)","changed"),
1184 "contactid_verb" => array("contact-id","verb(190)"),
1185 "deleted_changed" => array("deleted","changed"),
1186 "uid_wall_changed" => array("uid","wall","changed"),
1187 "uid_eventid" => array("uid","event-id"),
1188 "uid_authorlink" => array("uid","author-link(190)"),
1189 "uid_ownerlink" => array("uid","owner-link(190)"),
1192 $database["item_id"] = array(
1194 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1195 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1196 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1197 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1198 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1201 "PRIMARY" => array("id"),
1202 "uid" => array("uid"),
1203 "sid" => array("sid(32)"),
1204 "service" => array("service(32)"),
1205 "iid" => array("iid"),
1208 $database["locks"] = array(
1210 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1211 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1212 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1213 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1216 "PRIMARY" => array("id"),
1219 $database["mail"] = array(
1221 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1222 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1223 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1224 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1225 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1226 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1227 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => array("contact" => "id")),
1228 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("conv" => "id")),
1229 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1230 "body" => array("type" => "mediumtext"),
1231 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1232 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1233 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1234 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1235 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1236 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1237 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1240 "PRIMARY" => array("id"),
1241 "uid_seen" => array("uid", "seen"),
1242 "convid" => array("convid"),
1243 "uri" => array("uri(64)"),
1244 "parent-uri" => array("parent-uri(64)"),
1245 "contactid" => array("contact-id(32)"),
1248 $database["mailacct"] = array(
1250 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1251 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1252 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1253 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1254 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1255 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1256 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1257 "pass" => array("type" => "text"),
1258 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1259 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1260 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1261 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1262 "last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1265 "PRIMARY" => array("id"),
1268 $database["manage"] = array(
1270 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1271 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1272 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1275 "PRIMARY" => array("id"),
1276 "uid_mid" => array("UNIQUE", "uid","mid"),
1279 $database["notify"] = array(
1281 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1282 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1283 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1284 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1285 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1286 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1287 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1288 "msg" => array("type" => "mediumtext"),
1289 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1290 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1291 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1292 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1293 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1294 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1295 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1296 "name_cache" => array("type" => "tinytext"),
1297 "msg_cache" => array("type" => "mediumtext")
1300 "PRIMARY" => array("id"),
1301 "hash_uid" => array("hash", "uid"),
1302 "seen_uid_date" => array("seen", "uid", "date"),
1303 "uid_date" => array("uid", "date"),
1304 "uid_type_link" => array("uid", "type", "link(190)"),
1307 $database["notify-threads"] = array(
1309 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1310 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("notify" => "id")),
1311 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1312 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1313 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1316 "PRIMARY" => array("id"),
1319 $database["oembed"] = array(
1321 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1322 "content" => array("type" => "mediumtext"),
1323 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1326 "PRIMARY" => array("url"),
1327 "created" => array("created"),
1330 $database["parsed_url"] = array(
1332 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1333 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1334 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1335 "content" => array("type" => "mediumtext"),
1336 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1339 "PRIMARY" => array("url", "guessing", "oembed"),
1340 "created" => array("created"),
1343 $database["pconfig"] = array(
1345 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1346 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1347 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1348 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1349 "v" => array("type" => "mediumtext"),
1352 "PRIMARY" => array("id"),
1353 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1356 $database["photo"] = array(
1358 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1359 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1360 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1361 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1362 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1363 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1364 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1365 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1366 "desc" => array("type" => "text"),
1367 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1368 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1369 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1370 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1371 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1372 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1373 "data" => array("type" => "mediumblob", "not null" => "1"),
1374 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1375 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1376 "allow_cid" => array("type" => "mediumtext"),
1377 "allow_gid" => array("type" => "mediumtext"),
1378 "deny_cid" => array("type" => "mediumtext"),
1379 "deny_gid" => array("type" => "mediumtext"),
1382 "PRIMARY" => array("id"),
1383 "contactid" => array("contact-id"),
1384 "uid_contactid" => array("uid", "contact-id"),
1385 "uid_profile" => array("uid", "profile"),
1386 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1387 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1388 "resource-id" => array("resource-id(64)"),
1391 $database["poll"] = array(
1393 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1394 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1395 "q0" => array("type" => "text"),
1396 "q1" => array("type" => "text"),
1397 "q2" => array("type" => "text"),
1398 "q3" => array("type" => "text"),
1399 "q4" => array("type" => "text"),
1400 "q5" => array("type" => "text"),
1401 "q6" => array("type" => "text"),
1402 "q7" => array("type" => "text"),
1403 "q8" => array("type" => "text"),
1404 "q9" => array("type" => "text"),
1407 "PRIMARY" => array("id"),
1408 "uid" => array("uid"),
1411 $database["poll_result"] = array(
1413 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1414 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("poll" => "id")),
1415 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1418 "PRIMARY" => array("id"),
1419 "poll_id" => array("poll_id"),
1420 "choice" => array("choice"),
1423 $database["process"] = array(
1425 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1426 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1427 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1430 "PRIMARY" => array("pid"),
1431 "command" => array("command"),
1434 $database["profile"] = array(
1436 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1437 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1438 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1439 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1440 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1441 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1442 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1443 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
1444 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1445 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1446 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1447 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1448 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1449 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1450 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1451 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1452 "with" => array("type" => "text"),
1453 "howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1454 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1455 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1456 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1457 "pub_keywords" => array("type" => "text"),
1458 "prv_keywords" => array("type" => "text"),
1459 "likes" => array("type" => "text"),
1460 "dislikes" => array("type" => "text"),
1461 "about" => array("type" => "text"),
1462 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1463 "music" => array("type" => "text"),
1464 "book" => array("type" => "text"),
1465 "tv" => array("type" => "text"),
1466 "film" => array("type" => "text"),
1467 "interest" => array("type" => "text"),
1468 "romance" => array("type" => "text"),
1469 "work" => array("type" => "text"),
1470 "education" => array("type" => "text"),
1471 "contact" => array("type" => "text"),
1472 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1473 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1474 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1475 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1476 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1477 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1480 "PRIMARY" => array("id"),
1481 "uid_is-default" => array("uid", "is-default"),
1484 $database["profile_check"] = array(
1486 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1487 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1488 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1489 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1490 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1491 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1494 "PRIMARY" => array("id"),
1497 $database["push_subscriber"] = array(
1499 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1500 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1501 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1502 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1503 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1504 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1505 "last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1506 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1509 "PRIMARY" => array("id"),
1512 $database["queue"] = array(
1514 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1515 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1516 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1517 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1518 "last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1519 "content" => array("type" => "mediumtext"),
1520 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1523 "PRIMARY" => array("id"),
1524 "cid" => array("cid"),
1525 "created" => array("created"),
1526 "last" => array("last"),
1527 "network" => array("network"),
1528 "batch" => array("batch"),
1531 $database["register"] = array(
1533 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1534 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1535 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1536 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1537 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1538 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1539 "note" => array("type" => "text"),
1542 "PRIMARY" => array("id"),
1545 $database["search"] = array(
1547 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1548 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1549 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1552 "PRIMARY" => array("id"),
1553 "uid" => array("uid"),
1556 $database["session"] = array(
1558 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1559 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1560 "data" => array("type" => "text"),
1561 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1564 "PRIMARY" => array("id"),
1565 "sid" => array("sid(64)"),
1566 "expire" => array("expire"),
1569 $database["sign"] = array(
1571 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1572 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1573 "signed_text" => array("type" => "mediumtext"),
1574 "signature" => array("type" => "text"),
1575 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1578 "PRIMARY" => array("id"),
1579 "iid" => array("UNIQUE", "iid"),
1582 $database["spam"] = array(
1584 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1585 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1586 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1587 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1588 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1589 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1592 "PRIMARY" => array("id"),
1593 "uid" => array("uid"),
1594 "spam" => array("spam"),
1595 "ham" => array("ham"),
1596 "term" => array("term(32)"),
1599 $database["term"] = array(
1601 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1602 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1603 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1604 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1605 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1606 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1607 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1608 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1609 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1610 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1611 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1612 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1615 "PRIMARY" => array("tid"),
1616 "oid_otype_type_term" => array("oid","otype","type","term(32)"),
1617 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1618 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1619 "guid" => array("guid(64)"),
1622 $database["thread"] = array(
1624 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => array("item" => "id")),
1625 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1626 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1627 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1628 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1629 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1630 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1631 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1632 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1633 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1634 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1635 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1636 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1637 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1638 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1639 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1640 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1641 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1642 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1643 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1644 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1645 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1646 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1647 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1648 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1649 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1652 "PRIMARY" => array("iid"),
1653 "uid_network_commented" => array("uid","network","commented"),
1654 "uid_network_created" => array("uid","network","created"),
1655 "uid_contactid_commented" => array("uid","contact-id","commented"),
1656 "uid_contactid_created" => array("uid","contact-id","created"),
1657 "contactid" => array("contact-id"),
1658 "ownerid" => array("owner-id"),
1659 "authorid" => array("author-id"),
1660 "uid_created" => array("uid","created"),
1661 "uid_commented" => array("uid","commented"),
1662 "uid_wall_created" => array("uid","wall","created"),
1663 "private_wall_received" => array("private","wall","received"),
1666 $database["tokens"] = array(
1668 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1669 "secret" => array("type" => "text"),
1670 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
1671 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1672 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1673 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1676 "PRIMARY" => array("id"),
1679 $database["user"] = array(
1681 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1682 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1683 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1684 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1685 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1686 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1687 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1688 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1689 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1690 "register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1691 "login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1692 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1693 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1694 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1695 "pubkey" => array("type" => "text"),
1696 "prvkey" => array("type" => "text"),
1697 "spubkey" => array("type" => "text"),
1698 "sprvkey" => array("type" => "text"),
1699 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1700 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1701 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1702 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1703 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1704 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1705 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1706 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1707 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1708 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1709 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1710 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1711 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1712 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1713 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1714 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1715 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1716 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1717 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1718 "allow_cid" => array("type" => "mediumtext"),
1719 "allow_gid" => array("type" => "mediumtext"),
1720 "deny_cid" => array("type" => "mediumtext"),
1721 "deny_gid" => array("type" => "mediumtext"),
1722 "openidserver" => array("type" => "text"),
1725 "PRIMARY" => array("uid"),
1726 "nickname" => array("nickname(32)"),
1729 $database["userd"] = array(
1731 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1732 "username" => array("type" => "varchar(255)", "not null" => "1"),
1735 "PRIMARY" => array("id"),
1736 "username" => array("username(32)"),
1739 $database["workerqueue"] = array(
1741 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1742 "parameter" => array("type" => "text"),
1743 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1744 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1745 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1746 "executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1747 "done" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1750 "PRIMARY" => array("id"),
1751 "pid" => array("pid"),
1752 "parameter" => array("parameter(64)"),
1753 "priority_created" => array("priority", "created"),
1754 "executed" => array("executed"),