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 ($database[$name]["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 ".dba::any_value_fallback($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"),
834 "received" => array("received"),
837 $database["event"] = array(
839 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
840 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
841 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
842 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
843 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
844 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
845 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
846 "start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
847 "finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
848 "summary" => array("type" => "text"),
849 "desc" => array("type" => "text"),
850 "location" => array("type" => "text"),
851 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
852 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
853 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
854 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
855 "allow_cid" => array("type" => "mediumtext"),
856 "allow_gid" => array("type" => "mediumtext"),
857 "deny_cid" => array("type" => "mediumtext"),
858 "deny_gid" => array("type" => "mediumtext"),
861 "PRIMARY" => array("id"),
862 "uid_start" => array("uid", "start"),
865 $database["fcontact"] = array(
867 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
868 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
869 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
870 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
871 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
872 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
873 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
874 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
875 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
876 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
877 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
878 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
879 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
880 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
881 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
882 "pubkey" => array("type" => "text"),
883 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
886 "PRIMARY" => array("id"),
887 "addr" => array("addr(32)"),
888 "url" => array("UNIQUE", "url(190)"),
891 $database["fsuggest"] = array(
893 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
894 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
895 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
896 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
897 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
898 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
899 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
900 "note" => array("type" => "text"),
901 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
904 "PRIMARY" => array("id"),
907 $database["gcign"] = array(
909 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
910 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
911 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
914 "PRIMARY" => array("id"),
915 "uid" => array("uid"),
916 "gcid" => array("gcid"),
919 $database["gcontact"] = array(
921 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
922 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
923 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
924 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
925 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
926 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
927 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
928 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
929 "updated" => array("type" => "datetime", "default" => NULL_DATE),
930 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
931 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
932 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
933 "about" => array("type" => "text"),
934 "keywords" => array("type" => "text"),
935 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
936 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
937 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
938 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
939 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
940 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
941 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
942 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
943 "notify" => array("type" => "text"),
944 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
945 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
946 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
949 "PRIMARY" => array("id"),
950 "nurl" => array("UNIQUE", "nurl(190)"),
951 "name" => array("name(64)"),
952 "nick" => array("nick(32)"),
953 "addr" => array("addr(64)"),
954 "hide_network_updated" => array("hide", "network(4)", "updated"),
955 "updated" => array("updated"),
958 $database["glink"] = array(
960 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
961 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
962 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
963 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
964 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
965 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
968 "PRIMARY" => array("id"),
969 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
970 "gcid" => array("gcid"),
973 $database["group"] = array(
975 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
976 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
977 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
978 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
979 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
982 "PRIMARY" => array("id"),
983 "uid" => array("uid"),
986 $database["group_member"] = array(
988 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
989 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
990 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("group" => "id")),
991 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
994 "PRIMARY" => array("id"),
995 "contactid" => array("contact-id"),
996 "gid_contactid" => array("gid", "contact-id"),
997 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
1000 $database["gserver"] = array(
1002 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1003 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1004 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1005 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1006 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1007 "info" => array("type" => "text"),
1008 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1009 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1010 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1011 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1012 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1013 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1014 "last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
1015 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
1016 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
1019 "PRIMARY" => array("id"),
1020 "nurl" => array("UNIQUE", "nurl(190)"),
1023 $database["hook"] = array(
1025 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1026 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1027 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1028 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1029 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1032 "PRIMARY" => array("id"),
1033 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
1036 $database["intro"] = array(
1038 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1039 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1040 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("fcontact" => "id")),
1041 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1042 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1043 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1044 "note" => array("type" => "text"),
1045 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1046 "datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1047 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1048 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1051 "PRIMARY" => array("id"),
1054 $database["item"] = array(
1056 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "relation" => array("thread" => "iid")),
1057 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1058 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1059 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1060 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1061 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1062 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1063 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1064 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1065 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1066 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1067 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1068 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1069 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1070 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1071 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1072 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1073 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1074 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1075 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1076 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1077 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1078 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1079 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1080 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1081 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1082 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1083 "body" => array("type" => "mediumtext"),
1084 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1085 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1086 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1087 "object" => array("type" => "text"),
1088 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1089 "target" => array("type" => "text"),
1090 "postopts" => array("type" => "text"),
1091 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1092 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1093 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("event" => "id")),
1094 "tag" => array("type" => "mediumtext"),
1095 "attach" => array("type" => "mediumtext"),
1096 "inform" => array("type" => "mediumtext"),
1097 "file" => array("type" => "mediumtext"),
1098 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1099 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1100 "allow_cid" => array("type" => "mediumtext"),
1101 "allow_gid" => array("type" => "mediumtext"),
1102 "deny_cid" => array("type" => "mediumtext"),
1103 "deny_gid" => array("type" => "mediumtext"),
1104 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1105 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1106 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1107 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1108 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1109 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1110 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1111 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1112 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1113 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1114 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1115 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1116 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1117 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1118 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1119 "rendered-html" => array("type" => "mediumtext"),
1120 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1123 "PRIMARY" => array("id"),
1124 "guid" => array("guid(191)"),
1125 "uri" => array("uri(191)"),
1126 "parent" => array("parent"),
1127 "parent-uri" => array("parent-uri(191)"),
1128 "extid" => array("extid(191)"),
1129 "uid_id" => array("uid","id"),
1130 "uid_contactid_id" => array("uid","contact-id","id"),
1131 "uid_created" => array("uid","created"),
1132 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1133 "uid_network_received" => array("uid","network(4)","received"),
1134 "uid_network_commented" => array("uid","network(4)","commented"),
1135 "uid_thrparent" => array("uid","thr-parent(190)"),
1136 "uid_parenturi" => array("uid","parent-uri(190)"),
1137 "uid_contactid_created" => array("uid","contact-id","created"),
1138 "authorid_created" => array("author-id","created"),
1139 "ownerid" => array("owner-id"),
1140 "uid_uri" => array("uid", "uri(190)"),
1141 "resource-id" => array("resource-id(191)"),
1142 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1143 "uid_type_changed" => array("uid","type(190)","changed"),
1144 "contactid_verb" => array("contact-id","verb(190)"),
1145 "deleted_changed" => array("deleted","changed"),
1146 "uid_wall_changed" => array("uid","wall","changed"),
1147 "uid_eventid" => array("uid","event-id"),
1148 "uid_authorlink" => array("uid","author-link(190)"),
1149 "uid_ownerlink" => array("uid","owner-link(190)"),
1152 $database["locks"] = array(
1154 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1155 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1156 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1157 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1160 "PRIMARY" => array("id"),
1163 $database["mail"] = array(
1165 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1166 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1167 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1168 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1169 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1170 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1171 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => array("contact" => "id")),
1172 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("conv" => "id")),
1173 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1174 "body" => array("type" => "mediumtext"),
1175 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1176 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1177 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1178 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1179 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1180 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1181 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1184 "PRIMARY" => array("id"),
1185 "uid_seen" => array("uid", "seen"),
1186 "convid" => array("convid"),
1187 "uri" => array("uri(64)"),
1188 "parent-uri" => array("parent-uri(64)"),
1189 "contactid" => array("contact-id(32)"),
1192 $database["mailacct"] = array(
1194 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1195 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1196 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1197 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1198 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1199 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1200 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1201 "pass" => array("type" => "text"),
1202 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1203 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1204 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1205 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1206 "last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1209 "PRIMARY" => array("id"),
1212 $database["manage"] = array(
1214 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1215 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1216 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1219 "PRIMARY" => array("id"),
1220 "uid_mid" => array("UNIQUE", "uid","mid"),
1223 $database["notify"] = array(
1225 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1226 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1227 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1228 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1229 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1230 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1231 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1232 "msg" => array("type" => "mediumtext"),
1233 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1234 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1235 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1236 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1237 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1238 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1239 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1240 "name_cache" => array("type" => "tinytext"),
1241 "msg_cache" => array("type" => "mediumtext")
1244 "PRIMARY" => array("id"),
1245 "hash_uid" => array("hash", "uid"),
1246 "seen_uid_date" => array("seen", "uid", "date"),
1247 "uid_date" => array("uid", "date"),
1248 "uid_type_link" => array("uid", "type", "link(190)"),
1251 $database["notify-threads"] = array(
1253 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1254 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("notify" => "id")),
1255 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1256 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1257 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1260 "PRIMARY" => array("id"),
1263 $database["oembed"] = array(
1265 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1266 "content" => array("type" => "mediumtext"),
1267 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1270 "PRIMARY" => array("url"),
1271 "created" => array("created"),
1274 $database["parsed_url"] = array(
1276 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1277 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1278 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1279 "content" => array("type" => "mediumtext"),
1280 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1283 "PRIMARY" => array("url", "guessing", "oembed"),
1284 "created" => array("created"),
1287 $database["pconfig"] = array(
1289 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1290 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1291 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1292 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1293 "v" => array("type" => "mediumtext"),
1296 "PRIMARY" => array("id"),
1297 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1300 $database["photo"] = array(
1302 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1303 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1304 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1305 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1306 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1307 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1308 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1309 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1310 "desc" => array("type" => "text"),
1311 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1312 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1313 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1314 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1315 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1316 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1317 "data" => array("type" => "mediumblob", "not null" => "1"),
1318 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1319 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1320 "allow_cid" => array("type" => "mediumtext"),
1321 "allow_gid" => array("type" => "mediumtext"),
1322 "deny_cid" => array("type" => "mediumtext"),
1323 "deny_gid" => array("type" => "mediumtext"),
1326 "PRIMARY" => array("id"),
1327 "contactid" => array("contact-id"),
1328 "uid_contactid" => array("uid", "contact-id"),
1329 "uid_profile" => array("uid", "profile"),
1330 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1331 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1332 "resource-id" => array("resource-id(64)"),
1335 $database["poll"] = array(
1337 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1338 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1339 "q0" => array("type" => "text"),
1340 "q1" => array("type" => "text"),
1341 "q2" => array("type" => "text"),
1342 "q3" => array("type" => "text"),
1343 "q4" => array("type" => "text"),
1344 "q5" => array("type" => "text"),
1345 "q6" => array("type" => "text"),
1346 "q7" => array("type" => "text"),
1347 "q8" => array("type" => "text"),
1348 "q9" => array("type" => "text"),
1351 "PRIMARY" => array("id"),
1352 "uid" => array("uid"),
1355 $database["poll_result"] = array(
1357 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1358 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("poll" => "id")),
1359 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1362 "PRIMARY" => array("id"),
1363 "poll_id" => array("poll_id"),
1364 "choice" => array("choice"),
1367 $database["process"] = array(
1369 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1370 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1371 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1374 "PRIMARY" => array("pid"),
1375 "command" => array("command"),
1378 $database["profile"] = array(
1380 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1381 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1382 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1383 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1384 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1385 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1386 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1387 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
1388 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1389 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1390 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1391 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1392 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1393 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1394 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1395 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1396 "with" => array("type" => "text"),
1397 "howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1398 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1399 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1400 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1401 "pub_keywords" => array("type" => "text"),
1402 "prv_keywords" => array("type" => "text"),
1403 "likes" => array("type" => "text"),
1404 "dislikes" => array("type" => "text"),
1405 "about" => array("type" => "text"),
1406 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1407 "music" => array("type" => "text"),
1408 "book" => array("type" => "text"),
1409 "tv" => array("type" => "text"),
1410 "film" => array("type" => "text"),
1411 "interest" => array("type" => "text"),
1412 "romance" => array("type" => "text"),
1413 "work" => array("type" => "text"),
1414 "education" => array("type" => "text"),
1415 "contact" => array("type" => "text"),
1416 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1417 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1418 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1419 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1420 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1421 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1424 "PRIMARY" => array("id"),
1425 "uid_is-default" => array("uid", "is-default"),
1428 $database["profile_check"] = array(
1430 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1431 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1432 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1433 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1434 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1435 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1438 "PRIMARY" => array("id"),
1441 $database["push_subscriber"] = array(
1443 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1444 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1445 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1446 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1447 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1448 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1449 "last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1450 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1453 "PRIMARY" => array("id"),
1456 $database["queue"] = array(
1458 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1459 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1460 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1461 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1462 "last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1463 "content" => array("type" => "mediumtext"),
1464 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1467 "PRIMARY" => array("id"),
1468 "cid" => array("cid"),
1469 "created" => array("created"),
1470 "last" => array("last"),
1471 "network" => array("network"),
1472 "batch" => array("batch"),
1475 $database["register"] = array(
1477 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1478 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1479 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1480 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1481 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1482 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1483 "note" => array("type" => "text"),
1486 "PRIMARY" => array("id"),
1489 $database["search"] = array(
1491 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1492 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1493 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1496 "PRIMARY" => array("id"),
1497 "uid" => array("uid"),
1500 $database["session"] = array(
1502 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1503 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1504 "data" => array("type" => "text"),
1505 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1508 "PRIMARY" => array("id"),
1509 "sid" => array("sid(64)"),
1510 "expire" => array("expire"),
1513 $database["sign"] = array(
1515 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1516 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1517 "signed_text" => array("type" => "mediumtext"),
1518 "signature" => array("type" => "text"),
1519 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1522 "PRIMARY" => array("id"),
1523 "iid" => array("UNIQUE", "iid"),
1526 $database["term"] = array(
1528 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1529 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1530 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1531 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1532 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1533 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1534 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1535 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1536 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1537 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1538 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1539 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1542 "PRIMARY" => array("tid"),
1543 "oid_otype_type_term" => array("oid","otype","type","term(32)"),
1544 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1545 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1546 "guid" => array("guid(64)"),
1549 $database["thread"] = array(
1551 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => array("item" => "id")),
1552 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1553 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1554 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1555 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1556 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1557 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1558 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1559 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1560 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1561 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1562 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1563 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1564 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1565 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1566 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1567 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1568 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1569 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1570 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1571 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1572 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1573 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1574 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1575 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1576 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1579 "PRIMARY" => array("iid"),
1580 "uid_network_commented" => array("uid","network","commented"),
1581 "uid_network_created" => array("uid","network","created"),
1582 "uid_contactid_commented" => array("uid","contact-id","commented"),
1583 "uid_contactid_created" => array("uid","contact-id","created"),
1584 "contactid" => array("contact-id"),
1585 "ownerid" => array("owner-id"),
1586 "authorid" => array("author-id"),
1587 "uid_created" => array("uid","created"),
1588 "uid_commented" => array("uid","commented"),
1589 "uid_wall_created" => array("uid","wall","created"),
1590 "private_wall_received" => array("private","wall","received"),
1593 $database["tokens"] = array(
1595 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1596 "secret" => array("type" => "text"),
1597 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
1598 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1599 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1600 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1603 "PRIMARY" => array("id"),
1606 $database["user"] = array(
1608 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1609 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1610 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1611 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1612 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1613 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1614 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1615 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1616 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1617 "register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1618 "login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1619 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1620 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1621 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1622 "pubkey" => array("type" => "text"),
1623 "prvkey" => array("type" => "text"),
1624 "spubkey" => array("type" => "text"),
1625 "sprvkey" => array("type" => "text"),
1626 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1627 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1628 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1629 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1630 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1631 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1632 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1633 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1634 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1635 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1636 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1637 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1638 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1639 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1640 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1641 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1642 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1643 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1644 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1645 "allow_cid" => array("type" => "mediumtext"),
1646 "allow_gid" => array("type" => "mediumtext"),
1647 "deny_cid" => array("type" => "mediumtext"),
1648 "deny_gid" => array("type" => "mediumtext"),
1649 "openidserver" => array("type" => "text"),
1652 "PRIMARY" => array("uid"),
1653 "nickname" => array("nickname(32)"),
1656 $database["userd"] = array(
1658 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1659 "username" => array("type" => "varchar(255)", "not null" => "1"),
1662 "PRIMARY" => array("id"),
1663 "username" => array("username(32)"),
1666 $database["workerqueue"] = array(
1668 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1669 "parameter" => array("type" => "text"),
1670 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1671 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1672 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1673 "executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1674 "done" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1677 "PRIMARY" => array("id"),
1678 "pid" => array("pid"),
1679 "parameter" => array("parameter(64)"),
1680 "priority_created" => array("priority", "created"),
1681 "executed" => array("executed"),