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/dba.php';
13 require_once 'include/enotify.php';
14 require_once "include/text.php";
17 * @brief This class contain functions for the database management
19 * This class contains functions that doesn't need to know if pdo, mysqli or whatever is used.
23 * Converts all tables from MyISAM to InnoDB
25 public static function convertToInnoDB() {
26 $r = q("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `engine` = 'MyISAM' AND `table_schema` = '%s'",
27 dbesc(dba::database_name()));
29 if (!DBM::is_result($r)) {
30 echo t('There are no tables on MyISAM.')."\n";
34 foreach ($r AS $table) {
35 $sql = sprintf("ALTER TABLE `%s` engine=InnoDB;", dbesc($table['TABLE_NAME']));
38 $result = dba::e($sql);
39 if (!DBM::is_result($result)) {
40 self::printUpdateError($sql);
46 * send the email and do what is needed to do on update fails
48 * @param update_id (int) number of failed update
49 * @param error_message (str) error message
51 public static function updateFail($update_id, $error_message) {
54 //send the administrators an e-mail
55 $admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
56 $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
61 if (!DBM::is_result($adminlist)) {
62 logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_NORMAL);
68 // every admin could had different language
69 foreach ($adminlist as $admin) {
70 $lang = (($admin['language'])?$admin['language']:'en');
73 $preamble = deindent(t("
74 The friendica developers released update %s recently,
75 but when I tried to install it, something went terribly wrong.
76 This needs to be fixed soon and I can't do it alone. Please contact a
77 friendica developer if you can not help me on your own. My database might be invalid."));
78 $body = t("The error message is\n[pre]%s[/pre]");
79 $preamble = sprintf($preamble, $update_id);
80 $body = sprintf($body, $error_message);
83 'type' => SYSTEM_EMAIL,
84 'to_email' => $admin['email'],
85 'preamble' => $preamble,
92 logger("CRITICAL: Database structure update failed: ".$error_message);
96 private static function tableStructure($table) {
97 $structures = q("DESCRIBE `%s`", $table);
99 $full_columns = q("SHOW FULL COLUMNS FROM `%s`", $table);
101 $indexes = q("SHOW INDEX FROM `%s`", $table);
103 $table_status = q("SHOW TABLE STATUS WHERE `name` = '%s'", $table);
105 if (DBM::is_result($table_status)) {
106 $table_status = $table_status[0];
108 $table_status = array();
111 $fielddata = array();
112 $indexdata = array();
114 if (DBM::is_result($indexes)) {
115 foreach ($indexes AS $index) {
116 if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
117 $indexdata[$index["Key_name"]] = array('UNIQUE');
120 $column = $index["Column_name"];
122 if ($index["Sub_part"] != "") {
123 $column .= "(".$index["Sub_part"].")";
126 $indexdata[$index["Key_name"]][] = $column;
129 if (DBM::is_result($structures)) {
130 foreach ($structures AS $field) {
131 $fielddata[$field["Field"]]["type"] = $field["Type"];
132 if ($field["Null"] == "NO") {
133 $fielddata[$field["Field"]]["not null"] = true;
136 if (isset($field["Default"])) {
137 $fielddata[$field["Field"]]["default"] = $field["Default"];
140 if ($field["Extra"] != "") {
141 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
144 if ($field["Key"] == "PRI") {
145 $fielddata[$field["Field"]]["primary"] = true;
149 if (DBM::is_result($full_columns)) {
150 foreach ($full_columns AS $column) {
151 $fielddata[$column["Field"]]["Collation"] = $column["Collation"];
155 return array("fields" => $fielddata, "indexes" => $indexdata, "table_status" => $table_status);
158 public static function printStructure() {
159 $database = self::definition();
161 echo "-- ------------------------------------------\n";
162 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
163 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
164 echo "-- ------------------------------------------\n\n\n";
165 foreach ($database AS $name => $structure) {
167 echo "-- TABLE $name\n";
169 self::createTable($name, $structure['fields'], true, false, $structure["indexes"]);
176 * @brief Print out database error messages
178 * @param string $message Message to be added to the error message
180 * @return string Error message
182 private static function printUpdateError($message) {
183 echo sprintf(t("\nError %d occurred during database update:\n%s\n"),
184 dba::errorNo(), dba::errorMessage());
186 return t('Errors encountered performing database changes: ').$message.EOL;
189 public static function update($verbose, $action, $tables = null, $definition = null) {
191 Config::set('system', 'maintenance', 1);
192 Config::set('system', 'maintenance_reason', sprintf(t(': Database update'), DBM::date().' '.date('e')));
197 logger('updating structure', LOGGER_DEBUG);
199 // Get the current structure
202 if (is_null($tables)) {
203 $tables = q("SHOW TABLES");
206 if (DBM::is_result($tables)) {
207 foreach ($tables AS $table) {
208 $table = current($table);
210 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
211 $database[$table] = self::tableStructure($table);
215 // Get the definition
216 if (is_null($definition)) {
217 $definition = self::definition();
220 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
221 if ((version_compare(dba::server_info(), '5.7.4') >= 0) &&
222 !(strpos(dba::server_info(), 'MariaDB') !== false)) {
229 foreach ($definition AS $name => $structure) {
230 $is_new_table = False;
233 if (!isset($database[$name])) {
234 $r = self::createTable($name, $structure["fields"], $verbose, $action, $structure['indexes']);
235 if (!DBM::is_result($r)) {
236 $errors .= self::printUpdateError($name);
238 $is_new_table = True;
243 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
244 if (isset($database[$name]["indexes"][$indexname])) {
245 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
247 $current_index_definition = "__NOT_SET__";
249 $new_index_definition = implode(",",$fieldnames);
250 if ($current_index_definition != $new_index_definition) {
251 if ($fieldnames[0] == "UNIQUE") {
254 $temp_name = "temp-".$name;
261 * Drop the index if it isn't present in the definition
262 * or the definition differ from current status
263 * and index name doesn't start with "local_"
265 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
266 $current_index_definition = implode(",",$fieldnames);
267 if (isset($structure["indexes"][$indexname])) {
268 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
270 $new_index_definition = "__NOT_SET__";
272 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
273 $sql2=self::dropIndex($indexname);
275 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
281 // Compare the field structure field by field
282 foreach ($structure["fields"] AS $fieldname => $parameters) {
283 if (!isset($database[$name]["fields"][$fieldname])) {
284 $sql2=self::addTableField($fieldname, $parameters);
286 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
291 // Compare the field definition
292 $field_definition = $database[$name]["fields"][$fieldname];
294 // Remove the relation data that is used for the referential integrity
295 unset($parameters['relation']);
297 // We change the collation after the indexes had been changed.
298 // This is done to avoid index length problems.
299 // So here we always ensure that there is no need to change it.
300 unset($parameters['Collation']);
301 unset($field_definition['Collation']);
303 $current_field_definition = implode(",", $field_definition);
304 $new_field_definition = implode(",", $parameters);
305 if ($current_field_definition != $new_field_definition) {
306 $sql2 = self::modifyTableField($fieldname, $parameters);
308 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
318 * Create the index if the index don't exists in database
319 * or the definition differ from the current status.
320 * Don't create keys if table is new
322 if (!$is_new_table) {
323 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
324 if (isset($database[$name]["indexes"][$indexname])) {
325 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
327 $current_index_definition = "__NOT_SET__";
329 $new_index_definition = implode(",",$fieldnames);
330 if ($current_index_definition != $new_index_definition) {
331 $sql2 = self::createIndex($indexname, $fieldnames);
333 // Fetch the "group by" fields for unique indexes
334 if ($fieldnames[0] == "UNIQUE") {
335 $group_by = self::groupBy($indexname, $fieldnames);
339 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
347 if (isset($database[$name]["table_status"]["Collation"])) {
348 if ($database[$name]["table_status"]["Collation"] != 'utf8mb4_general_ci') {
349 $sql2 = "DEFAULT COLLATE utf8mb4_general_ci";
352 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
363 // Now have a look at the field collations
364 // Compare the field structure field by field
365 foreach ($structure["fields"] AS $fieldname => $parameters) {
366 // Compare the field definition
367 $field_definition = $database[$name]["fields"][$fieldname];
369 // Define the default collation if not given
370 if (!isset($parameters['Collation']) && !is_null($field_definition['Collation'])) {
371 $parameters['Collation'] = 'utf8mb4_general_ci';
373 $parameters['Collation'] = null;
376 if ($field_definition['Collation'] != $parameters['Collation']) {
377 $sql2 = self::modifyTableField($fieldname, $parameters);
378 if (($sql3 == "") || (substr($sql3, -2, 2) == "; ")) {
379 $sql3 .= "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
388 if (substr($sql3, -2, 2) != "; ") {
393 if ($is_unique && $ignore == '') {
394 foreach ($database[$name]["fields"] AS $fieldname => $parameters) {
395 $field_list .= 'ANY_VALUE(`' . $fieldname . '`),';
397 $field_list = rtrim($field_list, ',');
401 // Ensure index conversion to unique removes duplicates
402 if ($is_unique && ($temp_name != $name)) {
404 echo "SET session old_alter_table=1;\n";
406 echo "DROP TABLE IF EXISTS `".$temp_name."`;\n";
407 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
413 if ($is_unique && ($temp_name != $name)) {
415 echo "SET session old_alter_table=0;\n";
417 echo "INSERT INTO `".$temp_name."` SELECT ".dba::any_value_fallback($field_list)." FROM `".$name."`".$group_by.";\n";
418 echo "DROP TABLE `".$name."`;\n";
419 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
425 Config::set('system', 'maintenance_reason', sprintf(t('%s: updating %s table.'), DBM::date().' '.date('e'), $name));
427 // Ensure index conversion to unique removes duplicates
428 if ($is_unique && ($temp_name != $name)) {
430 dba::e("SET session old_alter_table=1;");
432 dba::e("DROP TABLE IF EXISTS `".$temp_name."`;");
433 if (!DBM::is_result($r)) {
434 $errors .= self::printUpdateError($sql3);
438 $r = dba::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
439 if (!DBM::is_result($r)) {
440 $errors .= self::printUpdateError($sql3);
447 if (!DBM::is_result($r)) {
448 $errors .= self::printUpdateError($sql3);
450 if ($is_unique && ($temp_name != $name)) {
452 dba::e("SET session old_alter_table=0;");
454 $r = dba::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
455 if (!DBM::is_result($r)) {
456 $errors .= self::printUpdateError($sql3);
459 $r = dba::e("DROP TABLE `".$name."`;");
460 if (!DBM::is_result($r)) {
461 $errors .= self::printUpdateError($sql3);
464 $r = dba::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
465 if (!DBM::is_result($r)) {
466 $errors .= self::printUpdateError($sql3);
476 Config::set('system', 'maintenance', 0);
477 Config::set('system', 'maintenance_reason', '');
481 Config::set('system', 'dbupdate', DB_UPDATE_FAILED);
483 Config::set('system', 'dbupdate', DB_UPDATE_SUCCESSFUL);
489 private static function FieldCommand($parameters, $create = true) {
490 $fieldstruct = $parameters["type"];
492 if (!is_null($parameters["Collation"])) {
493 $fieldstruct .= " COLLATE ".$parameters["Collation"];
496 if ($parameters["not null"]) {
497 $fieldstruct .= " NOT NULL";
500 if (isset($parameters["default"])) {
501 if (strpos(strtolower($parameters["type"]),"int")!==false) {
502 $fieldstruct .= " DEFAULT ".$parameters["default"];
504 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
507 if ($parameters["extra"] != "") {
508 $fieldstruct .= " ".$parameters["extra"];
511 /*if (($parameters["primary"] != "") && $create)
512 $fieldstruct .= " PRIMARY KEY";*/
514 return($fieldstruct);
517 private static function createTable($name, $fields, $verbose, $action, $indexes=null) {
521 $primary_keys = array();
522 foreach ($fields AS $fieldname => $field) {
523 $sql_rows[] = "`".dbesc($fieldname)."` ".self::FieldCommand($field);
524 if (x($field,'primary') && $field['primary']!='') {
525 $primary_keys[] = $fieldname;
529 if (!is_null($indexes)) {
530 foreach ($indexes AS $indexname => $fieldnames) {
531 $sql_index = self::createIndex($indexname, $fieldnames, "");
532 if (!is_null($sql_index)) {
533 $sql_rows[] = $sql_index;
538 $sql = implode(",\n\t", $sql_rows);
540 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT COLLATE utf8mb4_general_ci";
552 private static function addTableField($fieldname, $parameters) {
553 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), self::FieldCommand($parameters));
557 private static function modifyTableField($fieldname, $parameters) {
558 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), self::FieldCommand($parameters, false));
562 private static function dropIndex($indexname) {
563 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
567 private static function createIndex($indexname, $fieldnames, $method = "ADD") {
568 $method = strtoupper(trim($method));
569 if ($method!="" && $method!="ADD") {
570 throw new \Exception("Invalid parameter 'method' in self::createIndex(): '$method'");
573 if ($fieldnames[0] == "UNIQUE") {
574 array_shift($fieldnames);
575 $method .= ' UNIQUE';
579 foreach ($fieldnames AS $fieldname) {
584 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
585 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
587 $names .= "`".dbesc($fieldname)."`";
591 if ($indexname == "PRIMARY") {
592 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
596 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
600 private static function groupBy($indexname, $fieldnames) {
601 if ($fieldnames[0] != "UNIQUE") {
605 array_shift($fieldnames);
608 foreach ($fieldnames AS $fieldname) {
613 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
614 $names .= "`".dbesc($matches[1])."`";
616 $names .= "`".dbesc($fieldname)."`";
620 $sql = sprintf(" GROUP BY %s", $names);
624 public static function definition() {
627 $database["addon"] = array(
629 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
630 "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
631 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
632 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
633 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
634 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
635 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
638 "PRIMARY" => array("id"),
639 "name" => array("UNIQUE", "name"),
642 $database["attach"] = array(
644 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
645 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
646 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
647 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
648 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
649 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
650 "data" => array("type" => "longblob", "not null" => "1"),
651 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
652 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
653 "allow_cid" => array("type" => "mediumtext"),
654 "allow_gid" => array("type" => "mediumtext"),
655 "deny_cid" => array("type" => "mediumtext"),
656 "deny_gid" => array("type" => "mediumtext"),
659 "PRIMARY" => array("id"),
662 $database["auth_codes"] = array(
664 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
665 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
666 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
667 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
668 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
671 "PRIMARY" => array("id"),
674 $database["cache"] = array(
676 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
677 "v" => array("type" => "mediumtext"),
678 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
679 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
682 "PRIMARY" => array("k"),
683 "expire_mode_updated" => array("expire_mode", "updated"),
686 $database["challenge"] = array(
688 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
689 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
690 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
691 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
692 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
693 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
696 "PRIMARY" => array("id"),
699 $database["clients"] = array(
701 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
702 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
703 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
704 "name" => array("type" => "text"),
705 "icon" => array("type" => "text"),
706 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
709 "PRIMARY" => array("client_id"),
712 $database["config"] = array(
714 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
715 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
716 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
717 "v" => array("type" => "mediumtext"),
720 "PRIMARY" => array("id"),
721 "cat_k" => array("UNIQUE", "cat", "k"),
724 $database["contact"] = array(
726 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
727 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
728 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
729 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
730 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
731 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
732 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
733 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
734 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
735 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
736 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
737 "about" => array("type" => "text"),
738 "keywords" => array("type" => "text"),
739 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
740 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
741 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
742 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
743 "photo" => array("type" => "text"),
744 "thumb" => array("type" => "text"),
745 "micro" => array("type" => "text"),
746 "site-pubkey" => array("type" => "text"),
747 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
748 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
749 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
750 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
751 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
752 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
753 "pubkey" => array("type" => "text"),
754 "prvkey" => array("type" => "text"),
755 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
756 "request" => array("type" => "text"),
757 "notify" => array("type" => "text"),
758 "poll" => array("type" => "text"),
759 "confirm" => array("type" => "text"),
760 "poco" => array("type" => "text"),
761 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
762 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
763 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
764 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
765 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
766 "last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
767 "success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
768 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
769 "name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
770 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
771 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
772 "term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
773 "last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
774 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
775 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
776 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
777 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
778 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
779 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
780 "contact-type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
781 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
782 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
783 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
784 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
785 "reason" => array("type" => "text"),
786 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
787 "info" => array("type" => "mediumtext"),
788 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
789 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
790 "bd" => array("type" => "date", "not null" => "1", "default" => "0001-01-01"),
791 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
792 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
793 "ffi_keyword_blacklist" => array("type" => "text"),
796 "PRIMARY" => array("id"),
797 "uid_name" => array("uid", "name(190)"),
798 "self_uid" => array("self", "uid"),
799 "alias_uid" => array("alias(32)", "uid"),
800 "pending_uid" => array("pending", "uid"),
801 "blocked_uid" => array("blocked", "uid"),
802 "uid_rel_network_poll" => array("uid", "rel", "network(4)", "poll(64)", "archive"),
803 "uid_network_batch" => array("uid", "network(4)", "batch(64)"),
804 "addr_uid" => array("addr(32)", "uid"),
805 "nurl_uid" => array("nurl(32)", "uid"),
806 "nick_uid" => array("nick(32)", "uid"),
807 "dfrn-id" => array("dfrn-id(64)"),
808 "issued-id" => array("issued-id(64)"),
811 $database["conv"] = array(
813 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
814 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
815 "recips" => array("type" => "text"),
816 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
817 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
818 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
819 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
820 "subject" => array("type" => "text"),
823 "PRIMARY" => array("id"),
824 "uid" => array("uid"),
827 $database["conversation"] = array(
829 "item-uri" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
830 "reply-to-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
831 "conversation-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
832 "conversation-href" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
833 "protocol" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
834 "source" => array("type" => "mediumtext"),
835 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
838 "PRIMARY" => array("item-uri"),
839 "conversation-uri" => array("conversation-uri"),
840 "received" => array("received"),
843 $database["event"] = array(
845 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
846 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
847 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
848 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
849 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
850 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
851 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
852 "start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
853 "finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
854 "summary" => array("type" => "text"),
855 "desc" => array("type" => "text"),
856 "location" => array("type" => "text"),
857 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
858 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
859 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
860 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
861 "allow_cid" => array("type" => "mediumtext"),
862 "allow_gid" => array("type" => "mediumtext"),
863 "deny_cid" => array("type" => "mediumtext"),
864 "deny_gid" => array("type" => "mediumtext"),
867 "PRIMARY" => array("id"),
868 "uid_start" => array("uid", "start"),
871 $database["fcontact"] = array(
873 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
874 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
875 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
876 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
877 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
878 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
879 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
880 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
881 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
882 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
883 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
884 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
885 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
886 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
887 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
888 "pubkey" => array("type" => "text"),
889 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
892 "PRIMARY" => array("id"),
893 "addr" => array("addr(32)"),
894 "url" => array("UNIQUE", "url(190)"),
897 $database["fsuggest"] = array(
899 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
900 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
901 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
902 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
903 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
904 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
905 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
906 "note" => array("type" => "text"),
907 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
910 "PRIMARY" => array("id"),
913 $database["gcign"] = array(
915 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
916 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
917 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
920 "PRIMARY" => array("id"),
921 "uid" => array("uid"),
922 "gcid" => array("gcid"),
925 $database["gcontact"] = array(
927 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
928 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
929 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
930 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
931 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
932 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
933 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
934 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
935 "updated" => array("type" => "datetime", "default" => NULL_DATE),
936 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
937 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
938 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
939 "about" => array("type" => "text"),
940 "keywords" => array("type" => "text"),
941 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
942 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
943 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
944 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
945 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
946 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
947 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
948 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
949 "notify" => array("type" => "text"),
950 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
951 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
952 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
955 "PRIMARY" => array("id"),
956 "nurl" => array("UNIQUE", "nurl(190)"),
957 "name" => array("name(64)"),
958 "nick" => array("nick(32)"),
959 "addr" => array("addr(64)"),
960 "hide_network_updated" => array("hide", "network(4)", "updated"),
961 "updated" => array("updated"),
964 $database["glink"] = array(
966 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
967 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
968 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
969 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
970 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
971 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
974 "PRIMARY" => array("id"),
975 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
976 "gcid" => array("gcid"),
979 $database["group"] = array(
981 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
982 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
983 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
984 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
985 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
988 "PRIMARY" => array("id"),
989 "uid" => array("uid"),
992 $database["group_member"] = array(
994 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
995 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("group" => "id")),
996 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
999 "PRIMARY" => array("id"),
1000 "contactid" => array("contact-id"),
1001 "gid_contactid" => array("UNIQUE", "gid", "contact-id"),
1004 $database["gserver"] = array(
1006 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1007 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1008 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1009 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1010 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1011 "info" => array("type" => "text"),
1012 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1013 "registered-users" => array("type" => "int(10)", "not null" => "1", "default" => "0"),
1014 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1015 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1016 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1017 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1018 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1019 "last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
1020 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
1021 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
1024 "PRIMARY" => array("id"),
1025 "nurl" => array("UNIQUE", "nurl(190)"),
1028 $database["hook"] = array(
1030 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1031 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1032 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1033 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1034 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1037 "PRIMARY" => array("id"),
1038 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
1041 $database["intro"] = array(
1043 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1044 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1045 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("fcontact" => "id")),
1046 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1047 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1048 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1049 "note" => array("type" => "text"),
1050 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1051 "datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1052 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1053 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1056 "PRIMARY" => array("id"),
1059 $database["item"] = array(
1061 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "relation" => array("thread" => "iid")),
1062 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1063 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1064 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1065 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1066 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1067 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1068 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1069 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1070 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1071 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1072 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1073 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1074 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1075 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1076 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1077 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1078 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1079 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1080 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1081 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1082 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1083 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1084 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1085 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1086 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1087 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1088 "body" => array("type" => "mediumtext"),
1089 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1090 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1091 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1092 "object" => array("type" => "text"),
1093 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1094 "target" => array("type" => "text"),
1095 "postopts" => array("type" => "text"),
1096 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1097 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1098 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("event" => "id")),
1099 "tag" => array("type" => "mediumtext"),
1100 "attach" => array("type" => "mediumtext"),
1101 "inform" => array("type" => "mediumtext"),
1102 "file" => array("type" => "mediumtext"),
1103 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1104 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1105 "allow_cid" => array("type" => "mediumtext"),
1106 "allow_gid" => array("type" => "mediumtext"),
1107 "deny_cid" => array("type" => "mediumtext"),
1108 "deny_gid" => array("type" => "mediumtext"),
1109 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1110 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1111 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1112 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1113 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1114 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1115 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1116 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1117 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1118 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1119 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1120 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1121 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1122 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1123 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1124 "rendered-html" => array("type" => "mediumtext"),
1125 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1128 "PRIMARY" => array("id"),
1129 "guid" => array("guid(191)"),
1130 "uri" => array("uri(191)"),
1131 "parent" => array("parent"),
1132 "parent-uri" => array("parent-uri(191)"),
1133 "extid" => array("extid(191)"),
1134 "uid_id" => array("uid","id"),
1135 "uid_contactid_id" => array("uid","contact-id","id"),
1136 "uid_created" => array("uid","created"),
1137 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1138 "uid_network_received" => array("uid","network(4)","received"),
1139 "uid_network_commented" => array("uid","network(4)","commented"),
1140 "uid_thrparent" => array("uid","thr-parent(190)"),
1141 "uid_parenturi" => array("uid","parent-uri(190)"),
1142 "uid_contactid_created" => array("uid","contact-id","created"),
1143 "authorid_created" => array("author-id","created"),
1144 "ownerid" => array("owner-id"),
1145 "uid_uri" => array("uid", "uri(190)"),
1146 "resource-id" => array("resource-id(191)"),
1147 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1148 "uid_type_changed" => array("uid","type(190)","changed"),
1149 "contactid_verb" => array("contact-id","verb(190)"),
1150 "deleted_changed" => array("deleted","changed"),
1151 "uid_wall_changed" => array("uid","wall","changed"),
1152 "uid_eventid" => array("uid","event-id"),
1153 "uid_authorlink" => array("uid","author-link(190)"),
1154 "uid_ownerlink" => array("uid","owner-link(190)"),
1157 $database["locks"] = array(
1159 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1160 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1161 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1162 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1165 "PRIMARY" => array("id"),
1168 $database["mail"] = array(
1170 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1171 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1172 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1173 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1174 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1175 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1176 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => array("contact" => "id")),
1177 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("conv" => "id")),
1178 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1179 "body" => array("type" => "mediumtext"),
1180 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1181 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1182 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1183 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1184 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1185 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1186 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1189 "PRIMARY" => array("id"),
1190 "uid_seen" => array("uid", "seen"),
1191 "convid" => array("convid"),
1192 "uri" => array("uri(64)"),
1193 "parent-uri" => array("parent-uri(64)"),
1194 "contactid" => array("contact-id(32)"),
1197 $database["mailacct"] = array(
1199 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1200 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1201 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1202 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1203 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1204 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1205 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1206 "pass" => array("type" => "text"),
1207 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1208 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1209 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1210 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1211 "last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1214 "PRIMARY" => array("id"),
1217 $database["manage"] = array(
1219 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1220 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1221 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1224 "PRIMARY" => array("id"),
1225 "uid_mid" => array("UNIQUE", "uid","mid"),
1228 $database["notify"] = array(
1230 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1231 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1232 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1233 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1234 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1235 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1236 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1237 "msg" => array("type" => "mediumtext"),
1238 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1239 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1240 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1241 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1242 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1243 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1244 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1245 "name_cache" => array("type" => "tinytext"),
1246 "msg_cache" => array("type" => "mediumtext")
1249 "PRIMARY" => array("id"),
1250 "hash_uid" => array("hash", "uid"),
1251 "seen_uid_date" => array("seen", "uid", "date"),
1252 "uid_date" => array("uid", "date"),
1253 "uid_type_link" => array("uid", "type", "link(190)"),
1256 $database["notify-threads"] = array(
1258 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1259 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("notify" => "id")),
1260 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1261 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1262 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1265 "PRIMARY" => array("id"),
1268 $database["oembed"] = array(
1270 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1271 "content" => array("type" => "mediumtext"),
1272 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1275 "PRIMARY" => array("url"),
1276 "created" => array("created"),
1279 $database["parsed_url"] = array(
1281 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1282 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1283 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1284 "content" => array("type" => "mediumtext"),
1285 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1288 "PRIMARY" => array("url", "guessing", "oembed"),
1289 "created" => array("created"),
1292 $database["pconfig"] = array(
1294 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1295 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1296 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1297 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1298 "v" => array("type" => "mediumtext"),
1301 "PRIMARY" => array("id"),
1302 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1305 $database["photo"] = array(
1307 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1308 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1309 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1310 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1311 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1312 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1313 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1314 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1315 "desc" => array("type" => "text"),
1316 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1317 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1318 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1319 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1320 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1321 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1322 "data" => array("type" => "mediumblob", "not null" => "1"),
1323 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1324 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1325 "allow_cid" => array("type" => "mediumtext"),
1326 "allow_gid" => array("type" => "mediumtext"),
1327 "deny_cid" => array("type" => "mediumtext"),
1328 "deny_gid" => array("type" => "mediumtext"),
1331 "PRIMARY" => array("id"),
1332 "contactid" => array("contact-id"),
1333 "uid_contactid" => array("uid", "contact-id"),
1334 "uid_profile" => array("uid", "profile"),
1335 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1336 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1337 "resource-id" => array("resource-id(64)"),
1340 $database["poll"] = array(
1342 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1343 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1344 "q0" => array("type" => "text"),
1345 "q1" => array("type" => "text"),
1346 "q2" => array("type" => "text"),
1347 "q3" => array("type" => "text"),
1348 "q4" => array("type" => "text"),
1349 "q5" => array("type" => "text"),
1350 "q6" => array("type" => "text"),
1351 "q7" => array("type" => "text"),
1352 "q8" => array("type" => "text"),
1353 "q9" => array("type" => "text"),
1356 "PRIMARY" => array("id"),
1357 "uid" => array("uid"),
1360 $database["poll_result"] = array(
1362 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1363 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("poll" => "id")),
1364 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1367 "PRIMARY" => array("id"),
1368 "poll_id" => array("poll_id"),
1369 "choice" => array("choice"),
1372 $database["process"] = array(
1374 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1375 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1376 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1379 "PRIMARY" => array("pid"),
1380 "command" => array("command"),
1383 $database["profile"] = array(
1385 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1386 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1387 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1388 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1389 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1390 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1391 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1392 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
1393 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1394 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1395 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1396 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1397 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1398 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1399 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1400 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1401 "with" => array("type" => "text"),
1402 "howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1403 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1404 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1405 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1406 "pub_keywords" => array("type" => "text"),
1407 "prv_keywords" => array("type" => "text"),
1408 "likes" => array("type" => "text"),
1409 "dislikes" => array("type" => "text"),
1410 "about" => array("type" => "text"),
1411 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1412 "music" => array("type" => "text"),
1413 "book" => array("type" => "text"),
1414 "tv" => array("type" => "text"),
1415 "film" => array("type" => "text"),
1416 "interest" => array("type" => "text"),
1417 "romance" => array("type" => "text"),
1418 "work" => array("type" => "text"),
1419 "education" => array("type" => "text"),
1420 "contact" => array("type" => "text"),
1421 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1422 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1423 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1424 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1425 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1426 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1429 "PRIMARY" => array("id"),
1430 "uid_is-default" => array("uid", "is-default"),
1433 $database["profile_check"] = array(
1435 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1436 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1437 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1438 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1439 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1440 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1443 "PRIMARY" => array("id"),
1446 $database["push_subscriber"] = array(
1448 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1449 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1450 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1451 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1452 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1453 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1454 "last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1455 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1458 "PRIMARY" => array("id"),
1461 $database["queue"] = array(
1463 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1464 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1465 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1466 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1467 "last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1468 "content" => array("type" => "mediumtext"),
1469 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1472 "PRIMARY" => array("id"),
1473 "cid" => array("cid"),
1474 "created" => array("created"),
1475 "last" => array("last"),
1476 "network" => array("network"),
1477 "batch" => array("batch"),
1480 $database["register"] = array(
1482 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1483 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1484 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1485 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1486 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1487 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1488 "note" => array("type" => "text"),
1491 "PRIMARY" => array("id"),
1494 $database["search"] = array(
1496 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1497 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1498 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1501 "PRIMARY" => array("id"),
1502 "uid" => array("uid"),
1505 $database["session"] = array(
1507 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1508 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1509 "data" => array("type" => "text"),
1510 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1513 "PRIMARY" => array("id"),
1514 "sid" => array("sid(64)"),
1515 "expire" => array("expire"),
1518 $database["sign"] = array(
1520 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1521 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1522 "signed_text" => array("type" => "mediumtext"),
1523 "signature" => array("type" => "text"),
1524 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1527 "PRIMARY" => array("id"),
1528 "iid" => array("UNIQUE", "iid"),
1531 $database["term"] = array(
1533 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1534 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1535 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1536 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1537 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1538 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1539 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1540 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1541 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1542 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1543 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1544 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1547 "PRIMARY" => array("tid"),
1548 "oid_otype_type_term" => array("oid","otype","type","term(32)"),
1549 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1550 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1551 "guid" => array("guid(64)"),
1554 $database["thread"] = array(
1556 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => array("item" => "id")),
1557 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1558 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1559 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1560 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1561 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1562 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1563 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1564 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1565 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1566 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1567 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1568 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1569 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1570 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1571 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1572 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1573 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1574 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1575 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1576 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1577 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1578 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1579 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1580 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1581 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1584 "PRIMARY" => array("iid"),
1585 "uid_network_commented" => array("uid","network","commented"),
1586 "uid_network_created" => array("uid","network","created"),
1587 "uid_contactid_commented" => array("uid","contact-id","commented"),
1588 "uid_contactid_created" => array("uid","contact-id","created"),
1589 "contactid" => array("contact-id"),
1590 "ownerid" => array("owner-id"),
1591 "authorid" => array("author-id"),
1592 "uid_created" => array("uid","created"),
1593 "uid_commented" => array("uid","commented"),
1594 "uid_wall_created" => array("uid","wall","created"),
1595 "private_wall_received" => array("private","wall","received"),
1598 $database["tokens"] = array(
1600 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1601 "secret" => array("type" => "text"),
1602 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
1603 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1604 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1605 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1608 "PRIMARY" => array("id"),
1611 $database["user"] = array(
1613 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1614 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1615 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1616 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1617 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1618 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1619 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1620 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1621 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1622 "register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1623 "login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1624 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1625 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1626 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1627 "pubkey" => array("type" => "text"),
1628 "prvkey" => array("type" => "text"),
1629 "spubkey" => array("type" => "text"),
1630 "sprvkey" => array("type" => "text"),
1631 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1632 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1633 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1634 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1635 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1636 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1637 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1638 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1639 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1640 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1641 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1642 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1643 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1644 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1645 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1646 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1647 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1648 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1649 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1650 "allow_cid" => array("type" => "mediumtext"),
1651 "allow_gid" => array("type" => "mediumtext"),
1652 "deny_cid" => array("type" => "mediumtext"),
1653 "deny_gid" => array("type" => "mediumtext"),
1654 "openidserver" => array("type" => "text"),
1657 "PRIMARY" => array("uid"),
1658 "nickname" => array("nickname(32)"),
1661 $database["userd"] = array(
1663 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1664 "username" => array("type" => "varchar(255)", "not null" => "1"),
1667 "PRIMARY" => array("id"),
1668 "username" => array("username(32)"),
1671 $database["workerqueue"] = array(
1673 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1674 "parameter" => array("type" => "text"),
1675 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1676 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1677 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1678 "executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1679 "done" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1682 "PRIMARY" => array("id"),
1683 "pid" => array("pid"),
1684 "parameter" => array("parameter(64)"),
1685 "priority_created" => array("priority", "created"),
1686 "executed" => array("executed"),