3 * @file include/dbstructure.php
6 use Friendica\Core\System;
7 use Friendica\Core\Config;
8 use Friendica\Database\DBM;
10 require_once "boot.php";
11 require_once "include/text.php";
13 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
15 const DB_UPDATE_NOT_CHECKED = 0; // Database check wasn't executed before
16 const DB_UPDATE_SUCCESSFUL = 1; // Database check was successful
17 const DB_UPDATE_FAILED = 2; // Database check failed
20 * Converts all tables from MyISAM to InnoDB
22 function convert_to_innodb() {
23 $r = q("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `engine` = 'MyISAM' AND `table_schema` = '%s'",
24 dbesc(dba::database_name()));
26 if (!DBM::is_result($r)) {
27 echo t('There are no tables on MyISAM.')."\n";
31 foreach ($r AS $table) {
32 $sql = sprintf("ALTER TABLE `%s` engine=InnoDB;", dbesc($table['TABLE_NAME']));
35 $result = dba::e($sql);
36 if (!DBM::is_result($result)) {
37 print_update_error($sql);
43 * send the email and do what is needed to do on update fails
45 * @param update_id (int) number of failed update
46 * @param error_message (str) error message
48 function update_fail($update_id, $error_message) {
49 //send the administrators an e-mail
50 $admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
51 $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
56 if (!DBM::is_result($adminlist)) {
57 logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_NORMAL);
63 // every admin could had different language
64 foreach ($adminlist as $admin) {
65 $lang = (($admin['language'])?$admin['language']:'en');
68 $preamble = deindent(t("
69 The friendica developers released update %s recently,
70 but when I tried to install it, something went terribly wrong.
71 This needs to be fixed soon and I can't do it alone. Please contact a
72 friendica developer if you can not help me on your own. My database might be invalid."));
73 $body = t("The error message is\n[pre]%s[/pre]");
74 $preamble = sprintf($preamble, $update_id);
75 $body = sprintf($body, $error_message);
78 'type' => SYSTEM_EMAIL,
79 'to_email' => $admin['email'],
80 'preamble' => $preamble,
87 logger("CRITICAL: Database structure update failed: ".$retval);
91 function table_structure($table) {
92 $structures = q("DESCRIBE `%s`", $table);
94 $full_columns = q("SHOW FULL COLUMNS FROM `%s`", $table);
96 $indexes = q("SHOW INDEX FROM `%s`", $table);
98 $table_status = q("SHOW TABLE STATUS WHERE `name` = '%s'", $table);
100 if (DBM::is_result($table_status)) {
101 $table_status = $table_status[0];
103 $table_status = array();
106 $fielddata = array();
107 $indexdata = array();
109 if (DBM::is_result($indexes))
110 foreach ($indexes AS $index) {
111 if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
112 $indexdata[$index["Key_name"]] = array('UNIQUE');
115 $column = $index["Column_name"];
117 if (($index["Sub_part"] != "")) {
118 $column .= "(".$index["Sub_part"].")";
121 $indexdata[$index["Key_name"]][] = $column;
123 if (DBM::is_result($structures)) {
124 foreach ($structures AS $field) {
125 $fielddata[$field["Field"]]["type"] = $field["Type"];
126 if ($field["Null"] == "NO") {
127 $fielddata[$field["Field"]]["not null"] = true;
130 if (isset($field["Default"])) {
131 $fielddata[$field["Field"]]["default"] = $field["Default"];
134 if ($field["Extra"] != "") {
135 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
138 if ($field["Key"] == "PRI") {
139 $fielddata[$field["Field"]]["primary"] = true;
143 if (DBM::is_result($full_columns)) {
144 foreach ($full_columns AS $column) {
145 $fielddata[$column["Field"]]["Collation"] = $column["Collation"];
149 return array("fields" => $fielddata, "indexes" => $indexdata, "table_status" => $table_status);
152 function print_structure($database) {
153 echo "-- ------------------------------------------\n";
154 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
155 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
156 echo "-- ------------------------------------------\n\n\n";
157 foreach ($database AS $name => $structure) {
159 echo "-- TABLE $name\n";
161 db_create_table($name, $structure['fields'], true, false, $structure["indexes"]);
168 * @brief Print out database error messages
170 * @param string $message Message to be added to the error message
172 * @return string Error message
174 function print_update_error($message) {
175 echo sprintf(t("\nError %d occurred during database update:\n%s\n"),
176 dba::errorNo(), dba::errorMessage());
178 return t('Errors encountered performing database changes: ').$message.EOL;
181 function update_structure($verbose, $action, $tables=null, $definition=null) {
185 Config::set('system', 'maintenance', 1);
186 Config::set('system', 'maintenance_reason', sprintf(t(': Database update'), DBM::date().' '.date('e')));
191 logger('updating structure', LOGGER_DEBUG);
193 // Get the current structure
196 if (is_null($tables)) {
197 $tables = q("SHOW TABLES");
200 if (DBM::is_result($tables)) {
201 foreach ($tables AS $table) {
202 $table = current($table);
204 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
205 $database[$table] = table_structure($table);
209 // Get the definition
210 if (is_null($definition)) {
211 $definition = db_definition();
214 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
215 if ((version_compare(dba::server_info(), '5.7.4') >= 0) &&
216 !(strpos(dba::server_info(), 'MariaDB') !== false)) {
223 foreach ($definition AS $name => $structure) {
224 $is_new_table = False;
227 if (!isset($database[$name])) {
228 $r = db_create_table($name, $structure["fields"], $verbose, $action, $structure['indexes']);
229 if (!DBM::is_result($r)) {
230 $errors .= print_update_error($name);
232 $is_new_table = True;
237 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
238 if (isset($database[$name]["indexes"][$indexname])) {
239 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
241 $current_index_definition = "__NOT_SET__";
243 $new_index_definition = implode(",",$fieldnames);
244 if ($current_index_definition != $new_index_definition) {
245 if ($fieldnames[0] == "UNIQUE") {
248 $temp_name = "temp-".$name;
255 * Drop the index if it isn't present in the definition
256 * or the definition differ from current status
257 * and index name doesn't start with "local_"
259 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
260 $current_index_definition = implode(",",$fieldnames);
261 if (isset($structure["indexes"][$indexname])) {
262 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
264 $new_index_definition = "__NOT_SET__";
266 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
267 $sql2=db_drop_index($indexname);
269 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
275 // Compare the field structure field by field
276 foreach ($structure["fields"] AS $fieldname => $parameters) {
277 if (!isset($database[$name]["fields"][$fieldname])) {
278 $sql2=db_add_table_field($fieldname, $parameters);
280 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
285 // Compare the field definition
286 $field_definition = $database[$name]["fields"][$fieldname];
288 // Remove the relation data that is used for the referential integrity
289 unset($parameters['relation']);
291 // We change the collation after the indexes had been changed.
292 // This is done to avoid index length problems.
293 // So here we always ensure that there is no need to change it.
294 unset($parameters['Collation']);
295 unset($field_definition['Collation']);
297 $current_field_definition = implode(",", $field_definition);
298 $new_field_definition = implode(",", $parameters);
299 if ($current_field_definition != $new_field_definition) {
300 $sql2 = db_modify_table_field($fieldname, $parameters);
302 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
312 * Create the index if the index don't exists in database
313 * or the definition differ from the current status.
314 * Don't create keys if table is new
316 if (!$is_new_table) {
317 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
318 if (isset($database[$name]["indexes"][$indexname])) {
319 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
321 $current_index_definition = "__NOT_SET__";
323 $new_index_definition = implode(",",$fieldnames);
324 if ($current_index_definition != $new_index_definition) {
325 $sql2 = db_create_index($indexname, $fieldnames);
327 // Fetch the "group by" fields for unique indexes
328 if ($fieldnames[0] == "UNIQUE") {
329 $group_by = db_group_by($indexname, $fieldnames);
333 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
341 if (isset($database[$name]["table_status"]["Collation"])) {
342 if ($database[$name]["table_status"]["Collation"] != 'utf8mb4_general_ci') {
343 $sql2 = "DEFAULT COLLATE utf8mb4_general_ci";
346 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
357 // Now have a look at the field collations
358 // Compare the field structure field by field
359 foreach ($structure["fields"] AS $fieldname => $parameters) {
360 // Compare the field definition
361 $field_definition = $database[$name]["fields"][$fieldname];
363 // Define the default collation if not given
364 if (!isset($parameters['Collation']) && !is_null($field_definition['Collation'])) {
365 $parameters['Collation'] = 'utf8mb4_general_ci';
367 $parameters['Collation'] = null;
370 if ($field_definition['Collation'] != $parameters['Collation']) {
371 $sql2 = db_modify_table_field($fieldname, $parameters);
372 if (($sql3 == "") || (substr($sql3, -2, 2) == "; ")) {
373 $sql3 .= "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
382 if (substr($sql3, -2, 2) != "; ") {
387 if ($is_unique && $ignore == '') {
388 foreach ($structure['fields'] AS $fieldname => $parameters) {
389 $field_list .= 'ANY_VALUE(`' . $fieldname . '`),';
391 $field_list = rtrim($field_list, ',');
395 // Ensure index conversion to unique removes duplicates
396 if ($is_unique && ($temp_name != $name)) {
398 echo "SET session old_alter_table=1;\n";
400 echo "DROP TABLE IF EXISTS `".$temp_name."`;\n";
401 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
407 if ($is_unique && ($temp_name != $name)) {
409 echo "SET session old_alter_table=0;\n";
411 echo "INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";\n";
412 echo "DROP TABLE `".$name."`;\n";
413 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
419 Config::set('system', 'maintenance_reason', sprintf(t('%s: updating %s table.'), DBM::date().' '.date('e'), $name));
421 // Ensure index conversion to unique removes duplicates
422 if ($is_unique && ($temp_name != $name)) {
424 dba::e("SET session old_alter_table=1;");
426 dba::e("DROP TABLE IF EXISTS `".$temp_name."`;");
427 if (!DBM::is_result($r)) {
428 $errors .= print_update_error($sql3);
432 $r = dba::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
433 if (!DBM::is_result($r)) {
434 $errors .= print_update_error($sql3);
441 if (!DBM::is_result($r)) {
442 $errors .= print_update_error($sql3);
444 if ($is_unique && ($temp_name != $name)) {
446 dba::e("SET session old_alter_table=0;");
448 $r = dba::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
449 if (!DBM::is_result($r)) {
450 $errors .= print_update_error($sql3);
453 $r = dba::e("DROP TABLE `".$name."`;");
454 if (!DBM::is_result($r)) {
455 $errors .= print_update_error($sql3);
458 $r = dba::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
459 if (!DBM::is_result($r)) {
460 $errors .= print_update_error($sql3);
470 Config::set('system', 'maintenance', 0);
471 Config::set('system', 'maintenance_reason', '');
475 Config::set('system', 'dbupdate', DB_UPDATE_FAILED);
477 Config::set('system', 'dbupdate', DB_UPDATE_SUCCESSFUL);
483 function db_field_command($parameters, $create = true) {
484 $fieldstruct = $parameters["type"];
486 if (!is_null($parameters["Collation"])) {
487 $fieldstruct .= " COLLATE ".$parameters["Collation"];
490 if ($parameters["not null"])
491 $fieldstruct .= " NOT NULL";
493 if (isset($parameters["default"])) {
494 if (strpos(strtolower($parameters["type"]),"int")!==false) {
495 $fieldstruct .= " DEFAULT ".$parameters["default"];
497 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
500 if ($parameters["extra"] != "")
501 $fieldstruct .= " ".$parameters["extra"];
503 /*if (($parameters["primary"] != "") && $create)
504 $fieldstruct .= " PRIMARY KEY";*/
506 return($fieldstruct);
509 function db_create_table($name, $fields, $verbose, $action, $indexes=null) {
517 $primary_keys = array();
518 foreach ($fields AS $fieldname => $field) {
519 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
520 if (x($field,'primary') && $field['primary']!='') {
521 $primary_keys[] = $fieldname;
525 if (!is_null($indexes)) {
526 foreach ($indexes AS $indexname => $fieldnames) {
527 $sql_index = db_create_index($indexname, $fieldnames, "");
528 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
532 $sql = implode(",\n\t", $sql_rows);
534 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT COLLATE utf8mb4_general_ci";
544 function db_add_table_field($fieldname, $parameters) {
545 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
549 function db_modify_table_field($fieldname, $parameters) {
550 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
554 function db_drop_index($indexname) {
555 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
559 function db_create_index($indexname, $fieldnames, $method="ADD") {
561 $method = strtoupper(trim($method));
562 if ($method!="" && $method!="ADD") {
563 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
567 if ($fieldnames[0] == "UNIQUE") {
568 array_shift($fieldnames);
569 $method .= ' UNIQUE';
573 foreach ($fieldnames AS $fieldname) {
577 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
578 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
580 $names .= "`".dbesc($fieldname)."`";
584 if ($indexname == "PRIMARY") {
585 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
589 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
593 function db_group_by($indexname, $fieldnames) {
595 if ($fieldnames[0] != "UNIQUE") {
599 array_shift($fieldnames);
602 foreach ($fieldnames AS $fieldname) {
606 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
607 $names .= "`".dbesc($matches[1])."`";
609 $names .= "`".dbesc($fieldname)."`";
613 $sql = sprintf(" GROUP BY %s", $names);
617 function db_definition() {
621 $database["addon"] = array(
623 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
624 "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
625 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
626 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
627 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
628 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
629 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
632 "PRIMARY" => array("id"),
633 "name" => array("UNIQUE", "name"),
636 $database["attach"] = array(
638 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
639 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
640 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
641 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
642 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
643 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
644 "data" => array("type" => "longblob", "not null" => "1"),
645 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
646 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
647 "allow_cid" => array("type" => "mediumtext"),
648 "allow_gid" => array("type" => "mediumtext"),
649 "deny_cid" => array("type" => "mediumtext"),
650 "deny_gid" => array("type" => "mediumtext"),
653 "PRIMARY" => array("id"),
656 $database["auth_codes"] = array(
658 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
659 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
660 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
661 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
662 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
665 "PRIMARY" => array("id"),
668 $database["cache"] = array(
670 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
671 "v" => array("type" => "mediumtext"),
672 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
673 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
676 "PRIMARY" => array("k"),
677 "expire_mode_updated" => array("expire_mode", "updated"),
680 $database["challenge"] = array(
682 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
683 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
684 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
685 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
686 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
687 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
690 "PRIMARY" => array("id"),
693 $database["clients"] = array(
695 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
696 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
697 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
698 "name" => array("type" => "text"),
699 "icon" => array("type" => "text"),
700 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
703 "PRIMARY" => array("client_id"),
706 $database["config"] = array(
708 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
709 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
710 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
711 "v" => array("type" => "mediumtext"),
714 "PRIMARY" => array("id"),
715 "cat_k" => array("UNIQUE", "cat", "k"),
718 $database["contact"] = array(
720 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
721 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
722 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
723 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
724 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
725 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
726 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
727 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
728 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
729 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
730 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
731 "about" => array("type" => "text"),
732 "keywords" => array("type" => "text"),
733 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
734 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
735 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
736 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
737 "photo" => array("type" => "text"),
738 "thumb" => array("type" => "text"),
739 "micro" => array("type" => "text"),
740 "site-pubkey" => array("type" => "text"),
741 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
742 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
743 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
744 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
745 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
746 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
747 "pubkey" => array("type" => "text"),
748 "prvkey" => array("type" => "text"),
749 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
750 "request" => array("type" => "text"),
751 "notify" => array("type" => "text"),
752 "poll" => array("type" => "text"),
753 "confirm" => array("type" => "text"),
754 "poco" => array("type" => "text"),
755 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
756 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
757 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
758 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
759 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
760 "last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
761 "success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
762 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
763 "name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
764 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
765 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
766 "term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
767 "last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
768 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
769 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
770 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
771 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
772 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
773 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
774 "contact-type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
775 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
776 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
777 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
778 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
779 "reason" => array("type" => "text"),
780 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
781 "info" => array("type" => "mediumtext"),
782 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
783 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
784 "bd" => array("type" => "date", "not null" => "1", "default" => "0001-01-01"),
785 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
786 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
787 "ffi_keyword_blacklist" => array("type" => "text"),
790 "PRIMARY" => array("id"),
791 "uid_name" => array("uid", "name(190)"),
792 "self_uid" => array("self", "uid"),
793 "alias_uid" => array("alias(32)", "uid"),
794 "pending_uid" => array("pending", "uid"),
795 "blocked_uid" => array("blocked", "uid"),
796 "uid_rel_network_poll" => array("uid", "rel", "network(4)", "poll(64)", "archive"),
797 "uid_network_batch" => array("uid", "network(4)", "batch(64)"),
798 "addr_uid" => array("addr(32)", "uid"),
799 "nurl_uid" => array("nurl(32)", "uid"),
800 "nick_uid" => array("nick(32)", "uid"),
801 "dfrn-id" => array("dfrn-id(64)"),
802 "issued-id" => array("issued-id(64)"),
805 $database["conv"] = array(
807 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
808 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
809 "recips" => array("type" => "text"),
810 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
811 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
812 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
813 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
814 "subject" => array("type" => "text"),
817 "PRIMARY" => array("id"),
818 "uid" => array("uid"),
821 $database["conversation"] = array(
823 "item-uri" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
824 "reply-to-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
825 "conversation-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
826 "conversation-href" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
827 "protocol" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
828 "source" => array("type" => "mediumtext"),
829 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
832 "PRIMARY" => array("item-uri"),
833 "conversation-uri" => array("conversation-uri"),
836 $database["event"] = array(
838 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
839 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
840 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
841 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
842 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
843 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
844 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
845 "start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
846 "finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
847 "summary" => array("type" => "text"),
848 "desc" => array("type" => "text"),
849 "location" => array("type" => "text"),
850 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
851 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
852 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
853 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
854 "allow_cid" => array("type" => "mediumtext"),
855 "allow_gid" => array("type" => "mediumtext"),
856 "deny_cid" => array("type" => "mediumtext"),
857 "deny_gid" => array("type" => "mediumtext"),
860 "PRIMARY" => array("id"),
861 "uid_start" => array("uid", "start"),
864 $database["fcontact"] = array(
866 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
867 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
868 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
869 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
870 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
871 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
872 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
873 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
874 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
875 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
876 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
877 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
878 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
879 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
880 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
881 "pubkey" => array("type" => "text"),
882 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
885 "PRIMARY" => array("id"),
886 "addr" => array("addr(32)"),
887 "url" => array("UNIQUE", "url(190)"),
890 $database["ffinder"] = array(
892 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
893 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
894 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
895 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("fcontact" => "id")),
898 "PRIMARY" => array("id"),
901 $database["fserver"] = array(
903 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
904 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
905 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
906 "key" => array("type" => "text"),
909 "PRIMARY" => array("id"),
910 "server" => array("server(32)"),
913 $database["fsuggest"] = array(
915 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
916 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
917 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
918 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
919 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
920 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
921 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
922 "note" => array("type" => "text"),
923 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
926 "PRIMARY" => array("id"),
929 $database["gcign"] = array(
931 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
932 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
933 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
936 "PRIMARY" => array("id"),
937 "uid" => array("uid"),
938 "gcid" => array("gcid"),
941 $database["gcontact"] = array(
943 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
944 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
945 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
946 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
947 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
948 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
949 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
950 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
951 "updated" => array("type" => "datetime", "default" => NULL_DATE),
952 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
953 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
954 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
955 "about" => array("type" => "text"),
956 "keywords" => array("type" => "text"),
957 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
958 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
959 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
960 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
961 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
962 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
963 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
964 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
965 "notify" => array("type" => "text"),
966 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
967 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
968 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
971 "PRIMARY" => array("id"),
972 "nurl" => array("UNIQUE", "nurl(190)"),
973 "name" => array("name(64)"),
974 "nick" => array("nick(32)"),
975 "addr" => array("addr(64)"),
976 "hide_network_updated" => array("hide", "network(4)", "updated"),
977 "updated" => array("updated"),
980 $database["glink"] = array(
982 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
983 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
984 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
985 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
986 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
987 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
990 "PRIMARY" => array("id"),
991 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
992 "gcid" => array("gcid"),
995 $database["group"] = array(
997 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
998 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
999 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1000 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1001 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1004 "PRIMARY" => array("id"),
1005 "uid" => array("uid"),
1008 $database["group_member"] = array(
1010 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1011 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1012 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("group" => "id")),
1013 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1016 "PRIMARY" => array("id"),
1017 "contactid" => array("contact-id"),
1018 "gid_contactid" => array("gid", "contact-id"),
1019 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
1022 $database["gserver"] = array(
1024 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1025 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1026 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1027 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1028 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1029 "info" => array("type" => "text"),
1030 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1031 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1032 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1033 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1034 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1035 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1036 "last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
1037 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
1038 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
1041 "PRIMARY" => array("id"),
1042 "nurl" => array("UNIQUE", "nurl(190)"),
1045 $database["hook"] = array(
1047 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1048 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1049 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1050 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1051 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1054 "PRIMARY" => array("id"),
1055 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
1058 $database["intro"] = array(
1060 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1061 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1062 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("fcontact" => "id")),
1063 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1064 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1065 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1066 "note" => array("type" => "text"),
1067 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1068 "datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1069 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1070 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1073 "PRIMARY" => array("id"),
1076 $database["item"] = array(
1078 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "relation" => array("thread" => "iid")),
1079 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1080 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1081 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1082 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1083 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1084 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1085 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1086 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1087 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1088 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1089 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1090 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1091 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1092 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1093 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1094 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1095 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1096 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1097 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1098 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1099 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1100 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1101 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1102 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1103 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1104 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1105 "body" => array("type" => "mediumtext"),
1106 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1107 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1108 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1109 "object" => array("type" => "text"),
1110 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1111 "target" => array("type" => "text"),
1112 "postopts" => array("type" => "text"),
1113 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1114 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1115 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("event" => "id")),
1116 "tag" => array("type" => "mediumtext"),
1117 "attach" => array("type" => "mediumtext"),
1118 "inform" => array("type" => "mediumtext"),
1119 "file" => array("type" => "mediumtext"),
1120 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1121 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1122 "allow_cid" => array("type" => "mediumtext"),
1123 "allow_gid" => array("type" => "mediumtext"),
1124 "deny_cid" => array("type" => "mediumtext"),
1125 "deny_gid" => array("type" => "mediumtext"),
1126 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1127 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1128 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1129 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1130 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1131 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1132 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1133 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1134 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1135 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1136 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1137 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1138 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1139 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1140 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1141 "rendered-html" => array("type" => "mediumtext"),
1142 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1145 "PRIMARY" => array("id"),
1146 "guid" => array("guid(191)"),
1147 "uri" => array("uri(191)"),
1148 "parent" => array("parent"),
1149 "parent-uri" => array("parent-uri(191)"),
1150 "extid" => array("extid(191)"),
1151 "uid_id" => array("uid","id"),
1152 "uid_contactid_id" => array("uid","contact-id","id"),
1153 "uid_created" => array("uid","created"),
1154 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1155 "uid_network_received" => array("uid","network(4)","received"),
1156 "uid_network_commented" => array("uid","network(4)","commented"),
1157 "uid_thrparent" => array("uid","thr-parent(190)"),
1158 "uid_parenturi" => array("uid","parent-uri(190)"),
1159 "uid_contactid_created" => array("uid","contact-id","created"),
1160 "authorid_created" => array("author-id","created"),
1161 "ownerid" => array("owner-id"),
1162 "uid_uri" => array("uid", "uri(190)"),
1163 "resource-id" => array("resource-id(191)"),
1164 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1165 "uid_type_changed" => array("uid","type(190)","changed"),
1166 "contactid_verb" => array("contact-id","verb(190)"),
1167 "deleted_changed" => array("deleted","changed"),
1168 "uid_wall_changed" => array("uid","wall","changed"),
1169 "uid_eventid" => array("uid","event-id"),
1170 "uid_authorlink" => array("uid","author-link(190)"),
1171 "uid_ownerlink" => array("uid","owner-link(190)"),
1174 $database["item_id"] = array(
1176 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1177 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1178 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1179 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1180 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1183 "PRIMARY" => array("id"),
1184 "uid" => array("uid"),
1185 "sid" => array("sid(32)"),
1186 "service" => array("service(32)"),
1187 "iid" => array("iid"),
1190 $database["locks"] = array(
1192 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1193 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1194 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1195 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1198 "PRIMARY" => array("id"),
1201 $database["mail"] = array(
1203 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1204 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1205 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1206 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1207 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1208 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1209 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => array("contact" => "id")),
1210 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("conv" => "id")),
1211 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1212 "body" => array("type" => "mediumtext"),
1213 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1214 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1215 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1216 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1217 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1218 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1219 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1222 "PRIMARY" => array("id"),
1223 "uid_seen" => array("uid", "seen"),
1224 "convid" => array("convid"),
1225 "uri" => array("uri(64)"),
1226 "parent-uri" => array("parent-uri(64)"),
1227 "contactid" => array("contact-id(32)"),
1230 $database["mailacct"] = array(
1232 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1233 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1234 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1235 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1236 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1237 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1238 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1239 "pass" => array("type" => "text"),
1240 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1241 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1242 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1243 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1244 "last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1247 "PRIMARY" => array("id"),
1250 $database["manage"] = array(
1252 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1253 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1254 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1257 "PRIMARY" => array("id"),
1258 "uid_mid" => array("UNIQUE", "uid","mid"),
1261 $database["notify"] = array(
1263 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1264 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1265 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1266 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1267 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1268 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1269 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1270 "msg" => array("type" => "mediumtext"),
1271 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1272 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1273 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1274 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1275 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1276 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1277 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1278 "name_cache" => array("type" => "tinytext"),
1279 "msg_cache" => array("type" => "mediumtext")
1282 "PRIMARY" => array("id"),
1283 "hash_uid" => array("hash", "uid"),
1284 "seen_uid_date" => array("seen", "uid", "date"),
1285 "uid_date" => array("uid", "date"),
1286 "uid_type_link" => array("uid", "type", "link(190)"),
1289 $database["notify-threads"] = array(
1291 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1292 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("notify" => "id")),
1293 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1294 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1295 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1298 "PRIMARY" => array("id"),
1301 $database["oembed"] = array(
1303 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1304 "content" => array("type" => "mediumtext"),
1305 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1308 "PRIMARY" => array("url"),
1309 "created" => array("created"),
1312 $database["parsed_url"] = array(
1314 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1315 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1316 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1317 "content" => array("type" => "mediumtext"),
1318 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1321 "PRIMARY" => array("url", "guessing", "oembed"),
1322 "created" => array("created"),
1325 $database["pconfig"] = array(
1327 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1328 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1329 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1330 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1331 "v" => array("type" => "mediumtext"),
1334 "PRIMARY" => array("id"),
1335 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1338 $database["photo"] = array(
1340 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1341 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1342 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1343 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1344 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1345 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1346 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1347 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1348 "desc" => array("type" => "text"),
1349 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1350 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1351 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1352 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1353 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1354 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1355 "data" => array("type" => "mediumblob", "not null" => "1"),
1356 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1357 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1358 "allow_cid" => array("type" => "mediumtext"),
1359 "allow_gid" => array("type" => "mediumtext"),
1360 "deny_cid" => array("type" => "mediumtext"),
1361 "deny_gid" => array("type" => "mediumtext"),
1364 "PRIMARY" => array("id"),
1365 "contactid" => array("contact-id"),
1366 "uid_contactid" => array("uid", "contact-id"),
1367 "uid_profile" => array("uid", "profile"),
1368 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1369 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1370 "resource-id" => array("resource-id(64)"),
1373 $database["poll"] = array(
1375 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1376 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1377 "q0" => array("type" => "text"),
1378 "q1" => array("type" => "text"),
1379 "q2" => array("type" => "text"),
1380 "q3" => array("type" => "text"),
1381 "q4" => array("type" => "text"),
1382 "q5" => array("type" => "text"),
1383 "q6" => array("type" => "text"),
1384 "q7" => array("type" => "text"),
1385 "q8" => array("type" => "text"),
1386 "q9" => array("type" => "text"),
1389 "PRIMARY" => array("id"),
1390 "uid" => array("uid"),
1393 $database["poll_result"] = array(
1395 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1396 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("poll" => "id")),
1397 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1400 "PRIMARY" => array("id"),
1401 "poll_id" => array("poll_id"),
1402 "choice" => array("choice"),
1405 $database["process"] = array(
1407 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1408 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1409 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1412 "PRIMARY" => array("pid"),
1413 "command" => array("command"),
1416 $database["profile"] = array(
1418 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1419 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1420 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1421 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1422 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1423 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1424 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1425 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
1426 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1427 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1428 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1429 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1430 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1431 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1432 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1433 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1434 "with" => array("type" => "text"),
1435 "howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1436 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1437 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1438 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1439 "pub_keywords" => array("type" => "text"),
1440 "prv_keywords" => array("type" => "text"),
1441 "likes" => array("type" => "text"),
1442 "dislikes" => array("type" => "text"),
1443 "about" => array("type" => "text"),
1444 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1445 "music" => array("type" => "text"),
1446 "book" => array("type" => "text"),
1447 "tv" => array("type" => "text"),
1448 "film" => array("type" => "text"),
1449 "interest" => array("type" => "text"),
1450 "romance" => array("type" => "text"),
1451 "work" => array("type" => "text"),
1452 "education" => array("type" => "text"),
1453 "contact" => array("type" => "text"),
1454 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1455 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1456 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1457 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1458 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1459 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1462 "PRIMARY" => array("id"),
1463 "uid_is-default" => array("uid", "is-default"),
1466 $database["profile_check"] = array(
1468 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1469 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1470 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1471 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1472 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1473 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1476 "PRIMARY" => array("id"),
1479 $database["push_subscriber"] = array(
1481 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1482 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1483 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1484 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1485 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1486 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1487 "last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1488 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1491 "PRIMARY" => array("id"),
1494 $database["queue"] = array(
1496 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1497 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1498 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1499 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1500 "last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1501 "content" => array("type" => "mediumtext"),
1502 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1505 "PRIMARY" => array("id"),
1506 "cid" => array("cid"),
1507 "created" => array("created"),
1508 "last" => array("last"),
1509 "network" => array("network"),
1510 "batch" => array("batch"),
1513 $database["register"] = array(
1515 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1516 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1517 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1518 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1519 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1520 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1521 "note" => array("type" => "text"),
1524 "PRIMARY" => array("id"),
1527 $database["search"] = array(
1529 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1530 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1531 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1534 "PRIMARY" => array("id"),
1535 "uid" => array("uid"),
1538 $database["session"] = array(
1540 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1541 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1542 "data" => array("type" => "text"),
1543 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1546 "PRIMARY" => array("id"),
1547 "sid" => array("sid(64)"),
1548 "expire" => array("expire"),
1551 $database["sign"] = array(
1553 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1554 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1555 "signed_text" => array("type" => "mediumtext"),
1556 "signature" => array("type" => "text"),
1557 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1560 "PRIMARY" => array("id"),
1561 "iid" => array("UNIQUE", "iid"),
1564 $database["spam"] = array(
1566 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1567 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1568 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1569 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1570 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1571 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1574 "PRIMARY" => array("id"),
1575 "uid" => array("uid"),
1576 "spam" => array("spam"),
1577 "ham" => array("ham"),
1578 "term" => array("term(32)"),
1581 $database["term"] = array(
1583 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1584 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1585 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1586 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1587 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1588 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1589 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1590 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1591 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1592 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1593 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1594 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1597 "PRIMARY" => array("tid"),
1598 "oid_otype_type_term" => array("oid","otype","type","term(32)"),
1599 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1600 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1601 "guid" => array("guid(64)"),
1604 $database["thread"] = array(
1606 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => array("item" => "id")),
1607 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1608 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1609 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1610 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1611 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1612 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1613 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1614 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1615 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1616 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1617 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1618 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1619 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1620 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1621 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1622 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1623 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1624 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1625 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1626 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1627 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1628 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1629 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1630 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1631 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1634 "PRIMARY" => array("iid"),
1635 "uid_network_commented" => array("uid","network","commented"),
1636 "uid_network_created" => array("uid","network","created"),
1637 "uid_contactid_commented" => array("uid","contact-id","commented"),
1638 "uid_contactid_created" => array("uid","contact-id","created"),
1639 "contactid" => array("contact-id"),
1640 "ownerid" => array("owner-id"),
1641 "authorid" => array("author-id"),
1642 "uid_created" => array("uid","created"),
1643 "uid_commented" => array("uid","commented"),
1644 "uid_wall_created" => array("uid","wall","created"),
1645 "private_wall_received" => array("private","wall","received"),
1648 $database["tokens"] = array(
1650 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1651 "secret" => array("type" => "text"),
1652 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
1653 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1654 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1655 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1658 "PRIMARY" => array("id"),
1661 $database["user"] = array(
1663 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1664 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1665 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1666 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1667 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1668 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1669 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1670 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1671 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1672 "register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1673 "login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1674 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1675 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1676 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1677 "pubkey" => array("type" => "text"),
1678 "prvkey" => array("type" => "text"),
1679 "spubkey" => array("type" => "text"),
1680 "sprvkey" => array("type" => "text"),
1681 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1682 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1683 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1684 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1685 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1686 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1687 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1688 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1689 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1690 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1691 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1692 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1693 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1694 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1695 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1696 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1697 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1698 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1699 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1700 "allow_cid" => array("type" => "mediumtext"),
1701 "allow_gid" => array("type" => "mediumtext"),
1702 "deny_cid" => array("type" => "mediumtext"),
1703 "deny_gid" => array("type" => "mediumtext"),
1704 "openidserver" => array("type" => "text"),
1707 "PRIMARY" => array("uid"),
1708 "nickname" => array("nickname(32)"),
1711 $database["userd"] = array(
1713 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1714 "username" => array("type" => "varchar(255)", "not null" => "1"),
1717 "PRIMARY" => array("id"),
1718 "username" => array("username(32)"),
1721 $database["workerqueue"] = array(
1723 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1724 "parameter" => array("type" => "text"),
1725 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1726 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1727 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1728 "executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1729 "done" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1732 "PRIMARY" => array("id"),
1733 "pid" => array("pid"),
1734 "parameter" => array("parameter(64)"),
1735 "priority_created" => array("priority", "created"),
1736 "executed" => array("executed"),