3 * @file src/Database/DBStructure.php
5 namespace Friendica\Database;
7 use Friendica\Core\Config;
8 use Friendica\Database\DBM;
11 require_once "boot.php";
12 require_once "include/text.php";
15 * @brief This class contain functions for the database management
17 * This class contains functions that doesn't need to know if pdo, mysqli or whatever is used.
21 * Converts all tables from MyISAM to InnoDB
23 public static function convertToInnoDB() {
24 $r = q("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `engine` = 'MyISAM' AND `table_schema` = '%s'",
25 dbesc(dba::database_name()));
27 if (!DBM::is_result($r)) {
28 echo t('There are no tables on MyISAM.')."\n";
32 foreach ($r AS $table) {
33 $sql = sprintf("ALTER TABLE `%s` engine=InnoDB;", dbesc($table['TABLE_NAME']));
36 $result = dba::e($sql);
37 if (!DBM::is_result($result)) {
38 self::printUpdateError($sql);
44 * send the email and do what is needed to do on update fails
46 * @param update_id (int) number of failed update
47 * @param error_message (str) error message
49 public static function updateFail($update_id, $error_message) {
52 //send the administrators an e-mail
53 $admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
54 $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
59 if (!DBM::is_result($adminlist)) {
60 logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_NORMAL);
66 // every admin could had different language
67 foreach ($adminlist as $admin) {
68 $lang = (($admin['language'])?$admin['language']:'en');
71 $preamble = deindent(t("
72 The friendica developers released update %s recently,
73 but when I tried to install it, something went terribly wrong.
74 This needs to be fixed soon and I can't do it alone. Please contact a
75 friendica developer if you can not help me on your own. My database might be invalid."));
76 $body = t("The error message is\n[pre]%s[/pre]");
77 $preamble = sprintf($preamble, $update_id);
78 $body = sprintf($body, $error_message);
81 'type' => SYSTEM_EMAIL,
82 'to_email' => $admin['email'],
83 'preamble' => $preamble,
90 logger("CRITICAL: Database structure update failed: ".$error_message);
94 private static function tableStructure($table) {
95 $structures = q("DESCRIBE `%s`", $table);
97 $full_columns = q("SHOW FULL COLUMNS FROM `%s`", $table);
99 $indexes = q("SHOW INDEX FROM `%s`", $table);
101 $table_status = q("SHOW TABLE STATUS WHERE `name` = '%s'", $table);
103 if (DBM::is_result($table_status)) {
104 $table_status = $table_status[0];
106 $table_status = array();
109 $fielddata = array();
110 $indexdata = array();
112 if (DBM::is_result($indexes)) {
113 foreach ($indexes AS $index) {
114 if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
115 $indexdata[$index["Key_name"]] = array('UNIQUE');
118 $column = $index["Column_name"];
120 if ($index["Sub_part"] != "") {
121 $column .= "(".$index["Sub_part"].")";
124 $indexdata[$index["Key_name"]][] = $column;
127 if (DBM::is_result($structures)) {
128 foreach ($structures AS $field) {
129 $fielddata[$field["Field"]]["type"] = $field["Type"];
130 if ($field["Null"] == "NO") {
131 $fielddata[$field["Field"]]["not null"] = true;
134 if (isset($field["Default"])) {
135 $fielddata[$field["Field"]]["default"] = $field["Default"];
138 if ($field["Extra"] != "") {
139 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
142 if ($field["Key"] == "PRI") {
143 $fielddata[$field["Field"]]["primary"] = true;
147 if (DBM::is_result($full_columns)) {
148 foreach ($full_columns AS $column) {
149 $fielddata[$column["Field"]]["Collation"] = $column["Collation"];
153 return array("fields" => $fielddata, "indexes" => $indexdata, "table_status" => $table_status);
156 public static function printStructure($database) {
157 echo "-- ------------------------------------------\n";
158 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
159 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
160 echo "-- ------------------------------------------\n\n\n";
161 foreach ($database AS $name => $structure) {
163 echo "-- TABLE $name\n";
165 self::createTable($name, $structure['fields'], true, false, $structure["indexes"]);
172 * @brief Print out database error messages
174 * @param string $message Message to be added to the error message
176 * @return string Error message
178 private static function printUpdateError($message) {
179 echo sprintf(t("\nError %d occurred during database update:\n%s\n"),
180 dba::errorNo(), dba::errorMessage());
182 return t('Errors encountered performing database changes: ').$message.EOL;
185 public static function updateStructure($verbose, $action, $tables = null, $definition = null) {
187 Config::set('system', 'maintenance', 1);
188 Config::set('system', 'maintenance_reason', sprintf(t(': Database update'), DBM::date().' '.date('e')));
193 logger('updating structure', LOGGER_DEBUG);
195 // Get the current structure
198 if (is_null($tables)) {
199 $tables = q("SHOW TABLES");
202 if (DBM::is_result($tables)) {
203 foreach ($tables AS $table) {
204 $table = current($table);
206 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
207 $database[$table] = self::tableStructure($table);
211 // Get the definition
212 if (is_null($definition)) {
213 $definition = self::definition();
216 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
217 if ((version_compare(dba::server_info(), '5.7.4') >= 0) &&
218 !(strpos(dba::server_info(), 'MariaDB') !== false)) {
225 foreach ($definition AS $name => $structure) {
226 $is_new_table = False;
229 if (!isset($database[$name])) {
230 $r = self::createTable($name, $structure["fields"], $verbose, $action, $structure['indexes']);
231 if (!DBM::is_result($r)) {
232 $errors .= self::printUpdateError($name);
234 $is_new_table = True;
239 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
240 if (isset($database[$name]["indexes"][$indexname])) {
241 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
243 $current_index_definition = "__NOT_SET__";
245 $new_index_definition = implode(",",$fieldnames);
246 if ($current_index_definition != $new_index_definition) {
247 if ($fieldnames[0] == "UNIQUE") {
250 $temp_name = "temp-".$name;
257 * Drop the index if it isn't present in the definition
258 * or the definition differ from current status
259 * and index name doesn't start with "local_"
261 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
262 $current_index_definition = implode(",",$fieldnames);
263 if (isset($structure["indexes"][$indexname])) {
264 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
266 $new_index_definition = "__NOT_SET__";
268 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
269 $sql2=self::dropIndex($indexname);
271 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
277 // Compare the field structure field by field
278 foreach ($structure["fields"] AS $fieldname => $parameters) {
279 if (!isset($database[$name]["fields"][$fieldname])) {
280 $sql2=self::addTableField($fieldname, $parameters);
282 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
287 // Compare the field definition
288 $field_definition = $database[$name]["fields"][$fieldname];
290 // Remove the relation data that is used for the referential integrity
291 unset($parameters['relation']);
293 // We change the collation after the indexes had been changed.
294 // This is done to avoid index length problems.
295 // So here we always ensure that there is no need to change it.
296 unset($parameters['Collation']);
297 unset($field_definition['Collation']);
299 $current_field_definition = implode(",", $field_definition);
300 $new_field_definition = implode(",", $parameters);
301 if ($current_field_definition != $new_field_definition) {
302 $sql2 = self::modifyTableField($fieldname, $parameters);
304 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
314 * Create the index if the index don't exists in database
315 * or the definition differ from the current status.
316 * Don't create keys if table is new
318 if (!$is_new_table) {
319 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
320 if (isset($database[$name]["indexes"][$indexname])) {
321 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
323 $current_index_definition = "__NOT_SET__";
325 $new_index_definition = implode(",",$fieldnames);
326 if ($current_index_definition != $new_index_definition) {
327 $sql2 = self::createIndex($indexname, $fieldnames);
329 // Fetch the "group by" fields for unique indexes
330 if ($fieldnames[0] == "UNIQUE") {
331 $group_by = self::groupBy($indexname, $fieldnames);
335 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
343 if (isset($database[$name]["table_status"]["Collation"])) {
344 if ($database[$name]["table_status"]["Collation"] != 'utf8mb4_general_ci') {
345 $sql2 = "DEFAULT COLLATE utf8mb4_general_ci";
348 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
359 // Now have a look at the field collations
360 // Compare the field structure field by field
361 foreach ($structure["fields"] AS $fieldname => $parameters) {
362 // Compare the field definition
363 $field_definition = $database[$name]["fields"][$fieldname];
365 // Define the default collation if not given
366 if (!isset($parameters['Collation']) && !is_null($field_definition['Collation'])) {
367 $parameters['Collation'] = 'utf8mb4_general_ci';
369 $parameters['Collation'] = null;
372 if ($field_definition['Collation'] != $parameters['Collation']) {
373 $sql2 = self::modifyTableField($fieldname, $parameters);
374 if (($sql3 == "") || (substr($sql3, -2, 2) == "; ")) {
375 $sql3 .= "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
384 if (substr($sql3, -2, 2) != "; ") {
389 if ($is_unique && $ignore == '') {
390 foreach ($database[$name]["fields"] AS $fieldname => $parameters) {
391 $field_list .= 'ANY_VALUE(`' . $fieldname . '`),';
393 $field_list = rtrim($field_list, ',');
397 // Ensure index conversion to unique removes duplicates
398 if ($is_unique && ($temp_name != $name)) {
400 echo "SET session old_alter_table=1;\n";
402 echo "DROP TABLE IF EXISTS `".$temp_name."`;\n";
403 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
409 if ($is_unique && ($temp_name != $name)) {
411 echo "SET session old_alter_table=0;\n";
413 echo "INSERT INTO `".$temp_name."` SELECT ".dba::any_value_fallback($field_list)." FROM `".$name."`".$group_by.";\n";
414 echo "DROP TABLE `".$name."`;\n";
415 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
421 Config::set('system', 'maintenance_reason', sprintf(t('%s: updating %s table.'), DBM::date().' '.date('e'), $name));
423 // Ensure index conversion to unique removes duplicates
424 if ($is_unique && ($temp_name != $name)) {
426 dba::e("SET session old_alter_table=1;");
428 dba::e("DROP TABLE IF EXISTS `".$temp_name."`;");
429 if (!DBM::is_result($r)) {
430 $errors .= self::printUpdateError($sql3);
434 $r = dba::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
435 if (!DBM::is_result($r)) {
436 $errors .= self::printUpdateError($sql3);
443 if (!DBM::is_result($r)) {
444 $errors .= self::printUpdateError($sql3);
446 if ($is_unique && ($temp_name != $name)) {
448 dba::e("SET session old_alter_table=0;");
450 $r = dba::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
451 if (!DBM::is_result($r)) {
452 $errors .= self::printUpdateError($sql3);
455 $r = dba::e("DROP TABLE `".$name."`;");
456 if (!DBM::is_result($r)) {
457 $errors .= self::printUpdateError($sql3);
460 $r = dba::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
461 if (!DBM::is_result($r)) {
462 $errors .= self::printUpdateError($sql3);
472 Config::set('system', 'maintenance', 0);
473 Config::set('system', 'maintenance_reason', '');
477 Config::set('system', 'dbupdate', DB_UPDATE_FAILED);
479 Config::set('system', 'dbupdate', DB_UPDATE_SUCCESSFUL);
485 private static function FieldCommand($parameters, $create = true) {
486 $fieldstruct = $parameters["type"];
488 if (!is_null($parameters["Collation"])) {
489 $fieldstruct .= " COLLATE ".$parameters["Collation"];
492 if ($parameters["not null"]) {
493 $fieldstruct .= " NOT NULL";
496 if (isset($parameters["default"])) {
497 if (strpos(strtolower($parameters["type"]),"int")!==false) {
498 $fieldstruct .= " DEFAULT ".$parameters["default"];
500 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
503 if ($parameters["extra"] != "") {
504 $fieldstruct .= " ".$parameters["extra"];
507 /*if (($parameters["primary"] != "") && $create)
508 $fieldstruct .= " PRIMARY KEY";*/
510 return($fieldstruct);
513 private static function createTable($name, $fields, $verbose, $action, $indexes=null) {
517 $primary_keys = array();
518 foreach ($fields AS $fieldname => $field) {
519 $sql_rows[] = "`".dbesc($fieldname)."` ".self::FieldCommand($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 = self::createIndex($indexname, $fieldnames, "");
528 if (!is_null($sql_index)) {
529 $sql_rows[] = $sql_index;
534 $sql = implode(",\n\t", $sql_rows);
536 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT COLLATE utf8mb4_general_ci";
548 private static function addTableField($fieldname, $parameters) {
549 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), self::FieldCommand($parameters));
553 private static function modifyTableField($fieldname, $parameters) {
554 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), self::FieldCommand($parameters, false));
558 private static function dropIndex($indexname) {
559 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
563 private static function createIndex($indexname, $fieldnames, $method = "ADD") {
564 $method = strtoupper(trim($method));
565 if ($method!="" && $method!="ADD") {
566 throw new Exception("Invalid parameter 'method' in self::createIndex(): '$method'");
569 if ($fieldnames[0] == "UNIQUE") {
570 array_shift($fieldnames);
571 $method .= ' UNIQUE';
575 foreach ($fieldnames AS $fieldname) {
580 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
581 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
583 $names .= "`".dbesc($fieldname)."`";
587 if ($indexname == "PRIMARY") {
588 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
592 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
596 private static function groupBy($indexname, $fieldnames) {
597 if ($fieldnames[0] != "UNIQUE") {
601 array_shift($fieldnames);
604 foreach ($fieldnames AS $fieldname) {
609 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
610 $names .= "`".dbesc($matches[1])."`";
612 $names .= "`".dbesc($fieldname)."`";
616 $sql = sprintf(" GROUP BY %s", $names);
620 public static function definition() {
623 $database["addon"] = array(
625 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
626 "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
627 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
628 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
629 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
630 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
631 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
634 "PRIMARY" => array("id"),
635 "name" => array("UNIQUE", "name"),
638 $database["attach"] = array(
640 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
641 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
642 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
643 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
644 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
645 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
646 "data" => array("type" => "longblob", "not null" => "1"),
647 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
648 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
649 "allow_cid" => array("type" => "mediumtext"),
650 "allow_gid" => array("type" => "mediumtext"),
651 "deny_cid" => array("type" => "mediumtext"),
652 "deny_gid" => array("type" => "mediumtext"),
655 "PRIMARY" => array("id"),
658 $database["auth_codes"] = array(
660 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
661 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
662 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
663 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
664 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
667 "PRIMARY" => array("id"),
670 $database["cache"] = array(
672 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
673 "v" => array("type" => "mediumtext"),
674 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
675 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
678 "PRIMARY" => array("k"),
679 "expire_mode_updated" => array("expire_mode", "updated"),
682 $database["challenge"] = array(
684 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
685 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
686 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
687 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
688 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
689 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
692 "PRIMARY" => array("id"),
695 $database["clients"] = array(
697 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
698 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
699 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
700 "name" => array("type" => "text"),
701 "icon" => array("type" => "text"),
702 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
705 "PRIMARY" => array("client_id"),
708 $database["config"] = array(
710 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
711 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
712 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
713 "v" => array("type" => "mediumtext"),
716 "PRIMARY" => array("id"),
717 "cat_k" => array("UNIQUE", "cat", "k"),
720 $database["contact"] = array(
722 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
723 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
724 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
725 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
726 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
727 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
728 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
729 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
730 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
731 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
732 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
733 "about" => array("type" => "text"),
734 "keywords" => array("type" => "text"),
735 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
736 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
737 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
738 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
739 "photo" => array("type" => "text"),
740 "thumb" => array("type" => "text"),
741 "micro" => array("type" => "text"),
742 "site-pubkey" => array("type" => "text"),
743 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
744 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
745 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
746 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
747 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
748 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
749 "pubkey" => array("type" => "text"),
750 "prvkey" => array("type" => "text"),
751 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
752 "request" => array("type" => "text"),
753 "notify" => array("type" => "text"),
754 "poll" => array("type" => "text"),
755 "confirm" => array("type" => "text"),
756 "poco" => array("type" => "text"),
757 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
758 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
759 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
760 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
761 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
762 "last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
763 "success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
764 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
765 "name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
766 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
767 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
768 "term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
769 "last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
770 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
771 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
772 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
773 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
774 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
775 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
776 "contact-type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
777 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
778 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
779 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
780 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
781 "reason" => array("type" => "text"),
782 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
783 "info" => array("type" => "mediumtext"),
784 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
785 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
786 "bd" => array("type" => "date", "not null" => "1", "default" => "0001-01-01"),
787 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
788 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
789 "ffi_keyword_blacklist" => array("type" => "text"),
792 "PRIMARY" => array("id"),
793 "uid_name" => array("uid", "name(190)"),
794 "self_uid" => array("self", "uid"),
795 "alias_uid" => array("alias(32)", "uid"),
796 "pending_uid" => array("pending", "uid"),
797 "blocked_uid" => array("blocked", "uid"),
798 "uid_rel_network_poll" => array("uid", "rel", "network(4)", "poll(64)", "archive"),
799 "uid_network_batch" => array("uid", "network(4)", "batch(64)"),
800 "addr_uid" => array("addr(32)", "uid"),
801 "nurl_uid" => array("nurl(32)", "uid"),
802 "nick_uid" => array("nick(32)", "uid"),
803 "dfrn-id" => array("dfrn-id(64)"),
804 "issued-id" => array("issued-id(64)"),
807 $database["conv"] = array(
809 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
810 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
811 "recips" => array("type" => "text"),
812 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
813 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
814 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
815 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
816 "subject" => array("type" => "text"),
819 "PRIMARY" => array("id"),
820 "uid" => array("uid"),
823 $database["conversation"] = array(
825 "item-uri" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
826 "reply-to-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
827 "conversation-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
828 "conversation-href" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
829 "protocol" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
830 "source" => array("type" => "mediumtext"),
831 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
834 "PRIMARY" => array("item-uri"),
835 "conversation-uri" => array("conversation-uri"),
836 "received" => array("received"),
839 $database["event"] = array(
841 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
842 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
843 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
844 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
845 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
846 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
847 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
848 "start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
849 "finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
850 "summary" => array("type" => "text"),
851 "desc" => array("type" => "text"),
852 "location" => array("type" => "text"),
853 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
854 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
855 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
856 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
857 "allow_cid" => array("type" => "mediumtext"),
858 "allow_gid" => array("type" => "mediumtext"),
859 "deny_cid" => array("type" => "mediumtext"),
860 "deny_gid" => array("type" => "mediumtext"),
863 "PRIMARY" => array("id"),
864 "uid_start" => array("uid", "start"),
867 $database["fcontact"] = array(
869 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
870 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
871 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
872 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
873 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
874 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
875 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
876 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
877 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
878 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
879 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
880 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
881 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
882 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
883 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
884 "pubkey" => array("type" => "text"),
885 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
888 "PRIMARY" => array("id"),
889 "addr" => array("addr(32)"),
890 "url" => array("UNIQUE", "url(190)"),
893 $database["fsuggest"] = array(
895 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
896 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
897 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
898 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
899 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
900 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
901 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
902 "note" => array("type" => "text"),
903 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
906 "PRIMARY" => array("id"),
909 $database["gcign"] = array(
911 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
912 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
913 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
916 "PRIMARY" => array("id"),
917 "uid" => array("uid"),
918 "gcid" => array("gcid"),
921 $database["gcontact"] = array(
923 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
924 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
925 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
926 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
927 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
928 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
929 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
930 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
931 "updated" => array("type" => "datetime", "default" => NULL_DATE),
932 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
933 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
934 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
935 "about" => array("type" => "text"),
936 "keywords" => array("type" => "text"),
937 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
938 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
939 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
940 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
941 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
942 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
943 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
944 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
945 "notify" => array("type" => "text"),
946 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
947 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
948 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
951 "PRIMARY" => array("id"),
952 "nurl" => array("UNIQUE", "nurl(190)"),
953 "name" => array("name(64)"),
954 "nick" => array("nick(32)"),
955 "addr" => array("addr(64)"),
956 "hide_network_updated" => array("hide", "network(4)", "updated"),
957 "updated" => array("updated"),
960 $database["glink"] = array(
962 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
963 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
964 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
965 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
966 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
967 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
970 "PRIMARY" => array("id"),
971 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
972 "gcid" => array("gcid"),
975 $database["group"] = array(
977 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
978 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
979 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
980 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
981 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
984 "PRIMARY" => array("id"),
985 "uid" => array("uid"),
988 $database["group_member"] = array(
990 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
991 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
992 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("group" => "id")),
993 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
996 "PRIMARY" => array("id"),
997 "contactid" => array("contact-id"),
998 "gid_contactid" => array("gid", "contact-id"),
999 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
1002 $database["gserver"] = array(
1004 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1005 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1006 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1007 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1008 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1009 "info" => array("type" => "text"),
1010 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1011 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1012 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1013 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1014 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1015 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1016 "last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
1017 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
1018 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
1021 "PRIMARY" => array("id"),
1022 "nurl" => array("UNIQUE", "nurl(190)"),
1025 $database["hook"] = array(
1027 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1028 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1029 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1030 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1031 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1034 "PRIMARY" => array("id"),
1035 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
1038 $database["intro"] = array(
1040 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1041 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1042 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("fcontact" => "id")),
1043 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1044 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1045 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1046 "note" => array("type" => "text"),
1047 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1048 "datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1049 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1050 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1053 "PRIMARY" => array("id"),
1056 $database["item"] = array(
1058 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "relation" => array("thread" => "iid")),
1059 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1060 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1061 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1062 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1063 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1064 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1065 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1066 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1067 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1068 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1069 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1070 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1071 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1072 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1073 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1074 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1075 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1076 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1077 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1078 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1079 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1080 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1081 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1082 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1083 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1084 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1085 "body" => array("type" => "mediumtext"),
1086 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1087 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1088 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1089 "object" => array("type" => "text"),
1090 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1091 "target" => array("type" => "text"),
1092 "postopts" => array("type" => "text"),
1093 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1094 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1095 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("event" => "id")),
1096 "tag" => array("type" => "mediumtext"),
1097 "attach" => array("type" => "mediumtext"),
1098 "inform" => array("type" => "mediumtext"),
1099 "file" => array("type" => "mediumtext"),
1100 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1101 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1102 "allow_cid" => array("type" => "mediumtext"),
1103 "allow_gid" => array("type" => "mediumtext"),
1104 "deny_cid" => array("type" => "mediumtext"),
1105 "deny_gid" => array("type" => "mediumtext"),
1106 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1107 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1108 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1109 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1110 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1111 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1112 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1113 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1114 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1115 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1116 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1117 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1118 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1119 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1120 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1121 "rendered-html" => array("type" => "mediumtext"),
1122 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1125 "PRIMARY" => array("id"),
1126 "guid" => array("guid(191)"),
1127 "uri" => array("uri(191)"),
1128 "parent" => array("parent"),
1129 "parent-uri" => array("parent-uri(191)"),
1130 "extid" => array("extid(191)"),
1131 "uid_id" => array("uid","id"),
1132 "uid_contactid_id" => array("uid","contact-id","id"),
1133 "uid_created" => array("uid","created"),
1134 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1135 "uid_network_received" => array("uid","network(4)","received"),
1136 "uid_network_commented" => array("uid","network(4)","commented"),
1137 "uid_thrparent" => array("uid","thr-parent(190)"),
1138 "uid_parenturi" => array("uid","parent-uri(190)"),
1139 "uid_contactid_created" => array("uid","contact-id","created"),
1140 "authorid_created" => array("author-id","created"),
1141 "ownerid" => array("owner-id"),
1142 "uid_uri" => array("uid", "uri(190)"),
1143 "resource-id" => array("resource-id(191)"),
1144 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1145 "uid_type_changed" => array("uid","type(190)","changed"),
1146 "contactid_verb" => array("contact-id","verb(190)"),
1147 "deleted_changed" => array("deleted","changed"),
1148 "uid_wall_changed" => array("uid","wall","changed"),
1149 "uid_eventid" => array("uid","event-id"),
1150 "uid_authorlink" => array("uid","author-link(190)"),
1151 "uid_ownerlink" => array("uid","owner-link(190)"),
1154 $database["locks"] = array(
1156 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1157 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1158 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1159 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1162 "PRIMARY" => array("id"),
1165 $database["mail"] = array(
1167 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1168 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1169 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1170 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1171 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1172 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1173 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => array("contact" => "id")),
1174 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("conv" => "id")),
1175 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1176 "body" => array("type" => "mediumtext"),
1177 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1178 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1179 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1180 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1181 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1182 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1183 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1186 "PRIMARY" => array("id"),
1187 "uid_seen" => array("uid", "seen"),
1188 "convid" => array("convid"),
1189 "uri" => array("uri(64)"),
1190 "parent-uri" => array("parent-uri(64)"),
1191 "contactid" => array("contact-id(32)"),
1194 $database["mailacct"] = array(
1196 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1197 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1198 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1199 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1200 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1201 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1202 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1203 "pass" => array("type" => "text"),
1204 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1205 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1206 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1207 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1208 "last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1211 "PRIMARY" => array("id"),
1214 $database["manage"] = array(
1216 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1217 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1218 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1221 "PRIMARY" => array("id"),
1222 "uid_mid" => array("UNIQUE", "uid","mid"),
1225 $database["notify"] = array(
1227 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1228 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1229 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1230 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1231 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1232 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1233 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1234 "msg" => array("type" => "mediumtext"),
1235 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1236 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1237 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1238 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1239 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1240 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1241 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1242 "name_cache" => array("type" => "tinytext"),
1243 "msg_cache" => array("type" => "mediumtext")
1246 "PRIMARY" => array("id"),
1247 "hash_uid" => array("hash", "uid"),
1248 "seen_uid_date" => array("seen", "uid", "date"),
1249 "uid_date" => array("uid", "date"),
1250 "uid_type_link" => array("uid", "type", "link(190)"),
1253 $database["notify-threads"] = array(
1255 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1256 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("notify" => "id")),
1257 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1258 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1259 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1262 "PRIMARY" => array("id"),
1265 $database["oembed"] = array(
1267 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1268 "content" => array("type" => "mediumtext"),
1269 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1272 "PRIMARY" => array("url"),
1273 "created" => array("created"),
1276 $database["parsed_url"] = array(
1278 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1279 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1280 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1281 "content" => array("type" => "mediumtext"),
1282 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1285 "PRIMARY" => array("url", "guessing", "oembed"),
1286 "created" => array("created"),
1289 $database["pconfig"] = array(
1291 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1292 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1293 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1294 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1295 "v" => array("type" => "mediumtext"),
1298 "PRIMARY" => array("id"),
1299 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1302 $database["photo"] = array(
1304 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1305 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1306 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1307 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1308 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1309 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1310 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1311 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1312 "desc" => array("type" => "text"),
1313 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1314 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1315 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1316 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1317 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1318 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1319 "data" => array("type" => "mediumblob", "not null" => "1"),
1320 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1321 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1322 "allow_cid" => array("type" => "mediumtext"),
1323 "allow_gid" => array("type" => "mediumtext"),
1324 "deny_cid" => array("type" => "mediumtext"),
1325 "deny_gid" => array("type" => "mediumtext"),
1328 "PRIMARY" => array("id"),
1329 "contactid" => array("contact-id"),
1330 "uid_contactid" => array("uid", "contact-id"),
1331 "uid_profile" => array("uid", "profile"),
1332 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1333 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1334 "resource-id" => array("resource-id(64)"),
1337 $database["poll"] = array(
1339 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1340 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1341 "q0" => array("type" => "text"),
1342 "q1" => array("type" => "text"),
1343 "q2" => array("type" => "text"),
1344 "q3" => array("type" => "text"),
1345 "q4" => array("type" => "text"),
1346 "q5" => array("type" => "text"),
1347 "q6" => array("type" => "text"),
1348 "q7" => array("type" => "text"),
1349 "q8" => array("type" => "text"),
1350 "q9" => array("type" => "text"),
1353 "PRIMARY" => array("id"),
1354 "uid" => array("uid"),
1357 $database["poll_result"] = array(
1359 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1360 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("poll" => "id")),
1361 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1364 "PRIMARY" => array("id"),
1365 "poll_id" => array("poll_id"),
1366 "choice" => array("choice"),
1369 $database["process"] = array(
1371 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1372 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1373 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1376 "PRIMARY" => array("pid"),
1377 "command" => array("command"),
1380 $database["profile"] = array(
1382 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1383 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1384 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1385 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1386 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1387 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1388 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1389 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
1390 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1391 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1392 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1393 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1394 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1395 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1396 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1397 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1398 "with" => array("type" => "text"),
1399 "howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1400 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1401 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1402 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1403 "pub_keywords" => array("type" => "text"),
1404 "prv_keywords" => array("type" => "text"),
1405 "likes" => array("type" => "text"),
1406 "dislikes" => array("type" => "text"),
1407 "about" => array("type" => "text"),
1408 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1409 "music" => array("type" => "text"),
1410 "book" => array("type" => "text"),
1411 "tv" => array("type" => "text"),
1412 "film" => array("type" => "text"),
1413 "interest" => array("type" => "text"),
1414 "romance" => array("type" => "text"),
1415 "work" => array("type" => "text"),
1416 "education" => array("type" => "text"),
1417 "contact" => array("type" => "text"),
1418 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1419 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1420 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1421 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1422 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1423 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1426 "PRIMARY" => array("id"),
1427 "uid_is-default" => array("uid", "is-default"),
1430 $database["profile_check"] = array(
1432 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1433 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1434 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1435 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1436 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1437 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1440 "PRIMARY" => array("id"),
1443 $database["push_subscriber"] = array(
1445 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1446 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1447 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1448 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1449 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1450 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1451 "last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1452 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1455 "PRIMARY" => array("id"),
1458 $database["queue"] = array(
1460 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1461 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1462 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1463 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1464 "last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1465 "content" => array("type" => "mediumtext"),
1466 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1469 "PRIMARY" => array("id"),
1470 "cid" => array("cid"),
1471 "created" => array("created"),
1472 "last" => array("last"),
1473 "network" => array("network"),
1474 "batch" => array("batch"),
1477 $database["register"] = array(
1479 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1480 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1481 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1482 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1483 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1484 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1485 "note" => array("type" => "text"),
1488 "PRIMARY" => array("id"),
1491 $database["search"] = array(
1493 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1494 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1495 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1498 "PRIMARY" => array("id"),
1499 "uid" => array("uid"),
1502 $database["session"] = array(
1504 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1505 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1506 "data" => array("type" => "text"),
1507 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1510 "PRIMARY" => array("id"),
1511 "sid" => array("sid(64)"),
1512 "expire" => array("expire"),
1515 $database["sign"] = array(
1517 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1518 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1519 "signed_text" => array("type" => "mediumtext"),
1520 "signature" => array("type" => "text"),
1521 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1524 "PRIMARY" => array("id"),
1525 "iid" => array("UNIQUE", "iid"),
1528 $database["term"] = array(
1530 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1531 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1532 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1533 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1534 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1535 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1536 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1537 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1538 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1539 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1540 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1541 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1544 "PRIMARY" => array("tid"),
1545 "oid_otype_type_term" => array("oid","otype","type","term(32)"),
1546 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1547 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1548 "guid" => array("guid(64)"),
1551 $database["thread"] = array(
1553 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => array("item" => "id")),
1554 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1555 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1556 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1557 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1558 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1559 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1560 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1561 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1562 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1563 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1564 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1565 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1566 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1567 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1568 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1569 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1570 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1571 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1572 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1573 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1574 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1575 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1576 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1577 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1578 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1581 "PRIMARY" => array("iid"),
1582 "uid_network_commented" => array("uid","network","commented"),
1583 "uid_network_created" => array("uid","network","created"),
1584 "uid_contactid_commented" => array("uid","contact-id","commented"),
1585 "uid_contactid_created" => array("uid","contact-id","created"),
1586 "contactid" => array("contact-id"),
1587 "ownerid" => array("owner-id"),
1588 "authorid" => array("author-id"),
1589 "uid_created" => array("uid","created"),
1590 "uid_commented" => array("uid","commented"),
1591 "uid_wall_created" => array("uid","wall","created"),
1592 "private_wall_received" => array("private","wall","received"),
1595 $database["tokens"] = array(
1597 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1598 "secret" => array("type" => "text"),
1599 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
1600 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1601 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1602 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1605 "PRIMARY" => array("id"),
1608 $database["user"] = array(
1610 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1611 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1612 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1613 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1614 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1615 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1616 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1617 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1618 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1619 "register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1620 "login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1621 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1622 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1623 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1624 "pubkey" => array("type" => "text"),
1625 "prvkey" => array("type" => "text"),
1626 "spubkey" => array("type" => "text"),
1627 "sprvkey" => array("type" => "text"),
1628 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1629 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1630 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1631 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1632 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1633 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1634 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1635 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1636 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1637 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1638 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1639 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1640 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1641 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1642 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1643 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1644 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1645 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1646 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1647 "allow_cid" => array("type" => "mediumtext"),
1648 "allow_gid" => array("type" => "mediumtext"),
1649 "deny_cid" => array("type" => "mediumtext"),
1650 "deny_gid" => array("type" => "mediumtext"),
1651 "openidserver" => array("type" => "text"),
1654 "PRIMARY" => array("uid"),
1655 "nickname" => array("nickname(32)"),
1658 $database["userd"] = array(
1660 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1661 "username" => array("type" => "varchar(255)", "not null" => "1"),
1664 "PRIMARY" => array("id"),
1665 "username" => array("username(32)"),
1668 $database["workerqueue"] = array(
1670 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1671 "parameter" => array("type" => "text"),
1672 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1673 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1674 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1675 "executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1676 "done" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1679 "PRIMARY" => array("id"),
1680 "pid" => array("pid"),
1681 "parameter" => array("parameter(64)"),
1682 "priority_created" => array("priority", "created"),
1683 "executed" => array("executed"),