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() {
157 $database = self::definition();
159 echo "-- ------------------------------------------\n";
160 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
161 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
162 echo "-- ------------------------------------------\n\n\n";
163 foreach ($database AS $name => $structure) {
165 echo "-- TABLE $name\n";
167 self::createTable($name, $structure['fields'], true, false, $structure["indexes"]);
174 * @brief Print out database error messages
176 * @param string $message Message to be added to the error message
178 * @return string Error message
180 private static function printUpdateError($message) {
181 echo sprintf(t("\nError %d occurred during database update:\n%s\n"),
182 dba::errorNo(), dba::errorMessage());
184 return t('Errors encountered performing database changes: ').$message.EOL;
187 public static function update($verbose, $action, $tables = null, $definition = null) {
189 Config::set('system', 'maintenance', 1);
190 Config::set('system', 'maintenance_reason', sprintf(t(': Database update'), DBM::date().' '.date('e')));
195 logger('updating structure', LOGGER_DEBUG);
197 // Get the current structure
200 if (is_null($tables)) {
201 $tables = q("SHOW TABLES");
204 if (DBM::is_result($tables)) {
205 foreach ($tables AS $table) {
206 $table = current($table);
208 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
209 $database[$table] = self::tableStructure($table);
213 // Get the definition
214 if (is_null($definition)) {
215 $definition = self::definition();
218 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
219 if ((version_compare(dba::server_info(), '5.7.4') >= 0) &&
220 !(strpos(dba::server_info(), 'MariaDB') !== false)) {
227 foreach ($definition AS $name => $structure) {
228 $is_new_table = False;
231 if (!isset($database[$name])) {
232 $r = self::createTable($name, $structure["fields"], $verbose, $action, $structure['indexes']);
233 if (!DBM::is_result($r)) {
234 $errors .= self::printUpdateError($name);
236 $is_new_table = True;
241 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
242 if (isset($database[$name]["indexes"][$indexname])) {
243 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
245 $current_index_definition = "__NOT_SET__";
247 $new_index_definition = implode(",",$fieldnames);
248 if ($current_index_definition != $new_index_definition) {
249 if ($fieldnames[0] == "UNIQUE") {
252 $temp_name = "temp-".$name;
259 * Drop the index if it isn't present in the definition
260 * or the definition differ from current status
261 * and index name doesn't start with "local_"
263 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
264 $current_index_definition = implode(",",$fieldnames);
265 if (isset($structure["indexes"][$indexname])) {
266 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
268 $new_index_definition = "__NOT_SET__";
270 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
271 $sql2=self::dropIndex($indexname);
273 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
279 // Compare the field structure field by field
280 foreach ($structure["fields"] AS $fieldname => $parameters) {
281 if (!isset($database[$name]["fields"][$fieldname])) {
282 $sql2=self::addTableField($fieldname, $parameters);
284 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
289 // Compare the field definition
290 $field_definition = $database[$name]["fields"][$fieldname];
292 // Remove the relation data that is used for the referential integrity
293 unset($parameters['relation']);
295 // We change the collation after the indexes had been changed.
296 // This is done to avoid index length problems.
297 // So here we always ensure that there is no need to change it.
298 unset($parameters['Collation']);
299 unset($field_definition['Collation']);
301 $current_field_definition = implode(",", $field_definition);
302 $new_field_definition = implode(",", $parameters);
303 if ($current_field_definition != $new_field_definition) {
304 $sql2 = self::modifyTableField($fieldname, $parameters);
306 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
316 * Create the index if the index don't exists in database
317 * or the definition differ from the current status.
318 * Don't create keys if table is new
320 if (!$is_new_table) {
321 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
322 if (isset($database[$name]["indexes"][$indexname])) {
323 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
325 $current_index_definition = "__NOT_SET__";
327 $new_index_definition = implode(",",$fieldnames);
328 if ($current_index_definition != $new_index_definition) {
329 $sql2 = self::createIndex($indexname, $fieldnames);
331 // Fetch the "group by" fields for unique indexes
332 if ($fieldnames[0] == "UNIQUE") {
333 $group_by = self::groupBy($indexname, $fieldnames);
337 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
345 if (isset($database[$name]["table_status"]["Collation"])) {
346 if ($database[$name]["table_status"]["Collation"] != 'utf8mb4_general_ci') {
347 $sql2 = "DEFAULT COLLATE utf8mb4_general_ci";
350 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
361 // Now have a look at the field collations
362 // Compare the field structure field by field
363 foreach ($structure["fields"] AS $fieldname => $parameters) {
364 // Compare the field definition
365 $field_definition = $database[$name]["fields"][$fieldname];
367 // Define the default collation if not given
368 if (!isset($parameters['Collation']) && !is_null($field_definition['Collation'])) {
369 $parameters['Collation'] = 'utf8mb4_general_ci';
371 $parameters['Collation'] = null;
374 if ($field_definition['Collation'] != $parameters['Collation']) {
375 $sql2 = self::modifyTableField($fieldname, $parameters);
376 if (($sql3 == "") || (substr($sql3, -2, 2) == "; ")) {
377 $sql3 .= "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
386 if (substr($sql3, -2, 2) != "; ") {
391 if ($is_unique && $ignore == '') {
392 foreach ($database[$name]["fields"] AS $fieldname => $parameters) {
393 $field_list .= 'ANY_VALUE(`' . $fieldname . '`),';
395 $field_list = rtrim($field_list, ',');
399 // Ensure index conversion to unique removes duplicates
400 if ($is_unique && ($temp_name != $name)) {
402 echo "SET session old_alter_table=1;\n";
404 echo "DROP TABLE IF EXISTS `".$temp_name."`;\n";
405 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
411 if ($is_unique && ($temp_name != $name)) {
413 echo "SET session old_alter_table=0;\n";
415 echo "INSERT INTO `".$temp_name."` SELECT ".dba::any_value_fallback($field_list)." FROM `".$name."`".$group_by.";\n";
416 echo "DROP TABLE `".$name."`;\n";
417 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
423 Config::set('system', 'maintenance_reason', sprintf(t('%s: updating %s table.'), DBM::date().' '.date('e'), $name));
425 // Ensure index conversion to unique removes duplicates
426 if ($is_unique && ($temp_name != $name)) {
428 dba::e("SET session old_alter_table=1;");
430 dba::e("DROP TABLE IF EXISTS `".$temp_name."`;");
431 if (!DBM::is_result($r)) {
432 $errors .= self::printUpdateError($sql3);
436 $r = dba::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
437 if (!DBM::is_result($r)) {
438 $errors .= self::printUpdateError($sql3);
445 if (!DBM::is_result($r)) {
446 $errors .= self::printUpdateError($sql3);
448 if ($is_unique && ($temp_name != $name)) {
450 dba::e("SET session old_alter_table=0;");
452 $r = dba::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
453 if (!DBM::is_result($r)) {
454 $errors .= self::printUpdateError($sql3);
457 $r = dba::e("DROP TABLE `".$name."`;");
458 if (!DBM::is_result($r)) {
459 $errors .= self::printUpdateError($sql3);
462 $r = dba::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
463 if (!DBM::is_result($r)) {
464 $errors .= self::printUpdateError($sql3);
474 Config::set('system', 'maintenance', 0);
475 Config::set('system', 'maintenance_reason', '');
479 Config::set('system', 'dbupdate', DB_UPDATE_FAILED);
481 Config::set('system', 'dbupdate', DB_UPDATE_SUCCESSFUL);
487 private static function FieldCommand($parameters, $create = true) {
488 $fieldstruct = $parameters["type"];
490 if (!is_null($parameters["Collation"])) {
491 $fieldstruct .= " COLLATE ".$parameters["Collation"];
494 if ($parameters["not null"]) {
495 $fieldstruct .= " NOT NULL";
498 if (isset($parameters["default"])) {
499 if (strpos(strtolower($parameters["type"]),"int")!==false) {
500 $fieldstruct .= " DEFAULT ".$parameters["default"];
502 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
505 if ($parameters["extra"] != "") {
506 $fieldstruct .= " ".$parameters["extra"];
509 /*if (($parameters["primary"] != "") && $create)
510 $fieldstruct .= " PRIMARY KEY";*/
512 return($fieldstruct);
515 private static function createTable($name, $fields, $verbose, $action, $indexes=null) {
519 $primary_keys = array();
520 foreach ($fields AS $fieldname => $field) {
521 $sql_rows[] = "`".dbesc($fieldname)."` ".self::FieldCommand($field);
522 if (x($field,'primary') && $field['primary']!='') {
523 $primary_keys[] = $fieldname;
527 if (!is_null($indexes)) {
528 foreach ($indexes AS $indexname => $fieldnames) {
529 $sql_index = self::createIndex($indexname, $fieldnames, "");
530 if (!is_null($sql_index)) {
531 $sql_rows[] = $sql_index;
536 $sql = implode(",\n\t", $sql_rows);
538 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT COLLATE utf8mb4_general_ci";
550 private static function addTableField($fieldname, $parameters) {
551 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), self::FieldCommand($parameters));
555 private static function modifyTableField($fieldname, $parameters) {
556 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), self::FieldCommand($parameters, false));
560 private static function dropIndex($indexname) {
561 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
565 private static function createIndex($indexname, $fieldnames, $method = "ADD") {
566 $method = strtoupper(trim($method));
567 if ($method!="" && $method!="ADD") {
568 throw new Exception("Invalid parameter 'method' in self::createIndex(): '$method'");
571 if ($fieldnames[0] == "UNIQUE") {
572 array_shift($fieldnames);
573 $method .= ' UNIQUE';
577 foreach ($fieldnames AS $fieldname) {
582 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
583 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
585 $names .= "`".dbesc($fieldname)."`";
589 if ($indexname == "PRIMARY") {
590 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
594 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
598 private static function groupBy($indexname, $fieldnames) {
599 if ($fieldnames[0] != "UNIQUE") {
603 array_shift($fieldnames);
606 foreach ($fieldnames AS $fieldname) {
611 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
612 $names .= "`".dbesc($matches[1])."`";
614 $names .= "`".dbesc($fieldname)."`";
618 $sql = sprintf(" GROUP BY %s", $names);
622 public static function definition() {
625 $database["addon"] = array(
627 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
628 "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
629 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
630 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
631 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
632 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
633 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
636 "PRIMARY" => array("id"),
637 "name" => array("UNIQUE", "name"),
640 $database["attach"] = array(
642 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
643 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
644 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
645 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
646 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
647 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
648 "data" => array("type" => "longblob", "not null" => "1"),
649 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
650 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
651 "allow_cid" => array("type" => "mediumtext"),
652 "allow_gid" => array("type" => "mediumtext"),
653 "deny_cid" => array("type" => "mediumtext"),
654 "deny_gid" => array("type" => "mediumtext"),
657 "PRIMARY" => array("id"),
660 $database["auth_codes"] = array(
662 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
663 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
664 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
665 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
666 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
669 "PRIMARY" => array("id"),
672 $database["cache"] = array(
674 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
675 "v" => array("type" => "mediumtext"),
676 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
677 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
680 "PRIMARY" => array("k"),
681 "expire_mode_updated" => array("expire_mode", "updated"),
684 $database["challenge"] = array(
686 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
687 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
688 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
689 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
690 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
691 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
694 "PRIMARY" => array("id"),
697 $database["clients"] = array(
699 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
700 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
701 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
702 "name" => array("type" => "text"),
703 "icon" => array("type" => "text"),
704 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
707 "PRIMARY" => array("client_id"),
710 $database["config"] = array(
712 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
713 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
714 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
715 "v" => array("type" => "mediumtext"),
718 "PRIMARY" => array("id"),
719 "cat_k" => array("UNIQUE", "cat", "k"),
722 $database["contact"] = array(
724 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
725 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
726 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
727 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
728 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
729 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
730 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
731 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
732 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
733 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
734 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
735 "about" => array("type" => "text"),
736 "keywords" => array("type" => "text"),
737 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
738 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
739 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
740 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
741 "photo" => array("type" => "text"),
742 "thumb" => array("type" => "text"),
743 "micro" => array("type" => "text"),
744 "site-pubkey" => array("type" => "text"),
745 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
746 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
747 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
748 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
749 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
750 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
751 "pubkey" => array("type" => "text"),
752 "prvkey" => array("type" => "text"),
753 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
754 "request" => array("type" => "text"),
755 "notify" => array("type" => "text"),
756 "poll" => array("type" => "text"),
757 "confirm" => array("type" => "text"),
758 "poco" => array("type" => "text"),
759 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
760 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
761 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
762 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
763 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
764 "last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
765 "success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
766 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
767 "name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
768 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
769 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
770 "term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
771 "last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
772 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
773 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
774 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
775 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
776 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
777 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
778 "contact-type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
779 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
780 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
781 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
782 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
783 "reason" => array("type" => "text"),
784 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
785 "info" => array("type" => "mediumtext"),
786 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
787 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
788 "bd" => array("type" => "date", "not null" => "1", "default" => "0001-01-01"),
789 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
790 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
791 "ffi_keyword_blacklist" => array("type" => "text"),
794 "PRIMARY" => array("id"),
795 "uid_name" => array("uid", "name(190)"),
796 "self_uid" => array("self", "uid"),
797 "alias_uid" => array("alias(32)", "uid"),
798 "pending_uid" => array("pending", "uid"),
799 "blocked_uid" => array("blocked", "uid"),
800 "uid_rel_network_poll" => array("uid", "rel", "network(4)", "poll(64)", "archive"),
801 "uid_network_batch" => array("uid", "network(4)", "batch(64)"),
802 "addr_uid" => array("addr(32)", "uid"),
803 "nurl_uid" => array("nurl(32)", "uid"),
804 "nick_uid" => array("nick(32)", "uid"),
805 "dfrn-id" => array("dfrn-id(64)"),
806 "issued-id" => array("issued-id(64)"),
809 $database["conv"] = array(
811 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
812 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
813 "recips" => array("type" => "text"),
814 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
815 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
816 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
817 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
818 "subject" => array("type" => "text"),
821 "PRIMARY" => array("id"),
822 "uid" => array("uid"),
825 $database["conversation"] = array(
827 "item-uri" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
828 "reply-to-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
829 "conversation-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
830 "conversation-href" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
831 "protocol" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
832 "source" => array("type" => "mediumtext"),
833 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
836 "PRIMARY" => array("item-uri"),
837 "conversation-uri" => array("conversation-uri"),
838 "received" => array("received"),
841 $database["event"] = array(
843 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
844 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
845 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
846 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
847 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
848 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
849 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
850 "start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
851 "finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
852 "summary" => array("type" => "text"),
853 "desc" => array("type" => "text"),
854 "location" => array("type" => "text"),
855 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
856 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
857 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
858 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
859 "allow_cid" => array("type" => "mediumtext"),
860 "allow_gid" => array("type" => "mediumtext"),
861 "deny_cid" => array("type" => "mediumtext"),
862 "deny_gid" => array("type" => "mediumtext"),
865 "PRIMARY" => array("id"),
866 "uid_start" => array("uid", "start"),
869 $database["fcontact"] = array(
871 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
872 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
873 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
874 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
875 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
876 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
877 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
878 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
879 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
880 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
881 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
882 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
883 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
884 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
885 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
886 "pubkey" => array("type" => "text"),
887 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
890 "PRIMARY" => array("id"),
891 "addr" => array("addr(32)"),
892 "url" => array("UNIQUE", "url(190)"),
895 $database["fsuggest"] = array(
897 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
898 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
899 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
900 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
901 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
902 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
903 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
904 "note" => array("type" => "text"),
905 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
908 "PRIMARY" => array("id"),
911 $database["gcign"] = array(
913 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
914 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
915 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
918 "PRIMARY" => array("id"),
919 "uid" => array("uid"),
920 "gcid" => array("gcid"),
923 $database["gcontact"] = array(
925 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
926 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
927 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
928 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
929 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
930 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
931 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
932 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
933 "updated" => array("type" => "datetime", "default" => NULL_DATE),
934 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
935 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
936 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
937 "about" => array("type" => "text"),
938 "keywords" => array("type" => "text"),
939 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
940 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
941 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
942 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
943 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
944 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
945 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
946 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
947 "notify" => array("type" => "text"),
948 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
949 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
950 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
953 "PRIMARY" => array("id"),
954 "nurl" => array("UNIQUE", "nurl(190)"),
955 "name" => array("name(64)"),
956 "nick" => array("nick(32)"),
957 "addr" => array("addr(64)"),
958 "hide_network_updated" => array("hide", "network(4)", "updated"),
959 "updated" => array("updated"),
962 $database["glink"] = array(
964 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
965 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
966 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
967 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
968 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
969 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
972 "PRIMARY" => array("id"),
973 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
974 "gcid" => array("gcid"),
977 $database["group"] = array(
979 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
980 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
981 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
982 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
983 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
986 "PRIMARY" => array("id"),
987 "uid" => array("uid"),
990 $database["group_member"] = array(
992 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
993 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("group" => "id")),
994 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
997 "PRIMARY" => array("id"),
998 "contactid" => array("contact-id"),
999 "gid" => array("gid"),
1000 "gid_contactid" => array("UNIQUE", "gid", "contact-id"),
1003 $database["gserver"] = array(
1005 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1006 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1007 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1008 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1009 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1010 "info" => array("type" => "text"),
1011 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1012 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1013 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1014 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1015 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1016 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1017 "last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
1018 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
1019 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
1022 "PRIMARY" => array("id"),
1023 "nurl" => array("UNIQUE", "nurl(190)"),
1026 $database["hook"] = array(
1028 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1029 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1030 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1031 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1032 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1035 "PRIMARY" => array("id"),
1036 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
1039 $database["intro"] = array(
1041 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1042 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1043 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("fcontact" => "id")),
1044 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1045 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1046 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1047 "note" => array("type" => "text"),
1048 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1049 "datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1050 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1051 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1054 "PRIMARY" => array("id"),
1057 $database["item"] = array(
1059 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "relation" => array("thread" => "iid")),
1060 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1061 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1062 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1063 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1064 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1065 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1066 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1067 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1068 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1069 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1070 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1071 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1072 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1073 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1074 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1075 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1076 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1077 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1078 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1079 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1080 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1081 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1082 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1083 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1084 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1085 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1086 "body" => array("type" => "mediumtext"),
1087 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1088 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1089 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1090 "object" => array("type" => "text"),
1091 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1092 "target" => array("type" => "text"),
1093 "postopts" => array("type" => "text"),
1094 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1095 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1096 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("event" => "id")),
1097 "tag" => array("type" => "mediumtext"),
1098 "attach" => array("type" => "mediumtext"),
1099 "inform" => array("type" => "mediumtext"),
1100 "file" => array("type" => "mediumtext"),
1101 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1102 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1103 "allow_cid" => array("type" => "mediumtext"),
1104 "allow_gid" => array("type" => "mediumtext"),
1105 "deny_cid" => array("type" => "mediumtext"),
1106 "deny_gid" => array("type" => "mediumtext"),
1107 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1108 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1109 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1110 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1111 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1112 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1113 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1114 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1115 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1116 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1117 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1118 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1119 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1120 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1121 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1122 "rendered-html" => array("type" => "mediumtext"),
1123 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1126 "PRIMARY" => array("id"),
1127 "guid" => array("guid(191)"),
1128 "uri" => array("uri(191)"),
1129 "parent" => array("parent"),
1130 "parent-uri" => array("parent-uri(191)"),
1131 "extid" => array("extid(191)"),
1132 "uid_id" => array("uid","id"),
1133 "uid_contactid_id" => array("uid","contact-id","id"),
1134 "uid_created" => array("uid","created"),
1135 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1136 "uid_network_received" => array("uid","network(4)","received"),
1137 "uid_network_commented" => array("uid","network(4)","commented"),
1138 "uid_thrparent" => array("uid","thr-parent(190)"),
1139 "uid_parenturi" => array("uid","parent-uri(190)"),
1140 "uid_contactid_created" => array("uid","contact-id","created"),
1141 "authorid_created" => array("author-id","created"),
1142 "ownerid" => array("owner-id"),
1143 "uid_uri" => array("uid", "uri(190)"),
1144 "resource-id" => array("resource-id(191)"),
1145 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1146 "uid_type_changed" => array("uid","type(190)","changed"),
1147 "contactid_verb" => array("contact-id","verb(190)"),
1148 "deleted_changed" => array("deleted","changed"),
1149 "uid_wall_changed" => array("uid","wall","changed"),
1150 "uid_eventid" => array("uid","event-id"),
1151 "uid_authorlink" => array("uid","author-link(190)"),
1152 "uid_ownerlink" => array("uid","owner-link(190)"),
1155 $database["locks"] = array(
1157 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1158 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1159 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1160 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1163 "PRIMARY" => array("id"),
1166 $database["mail"] = array(
1168 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1169 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1170 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1171 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1172 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1173 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1174 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => array("contact" => "id")),
1175 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("conv" => "id")),
1176 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1177 "body" => array("type" => "mediumtext"),
1178 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1179 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1180 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1181 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1182 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1183 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1184 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1187 "PRIMARY" => array("id"),
1188 "uid_seen" => array("uid", "seen"),
1189 "convid" => array("convid"),
1190 "uri" => array("uri(64)"),
1191 "parent-uri" => array("parent-uri(64)"),
1192 "contactid" => array("contact-id(32)"),
1195 $database["mailacct"] = array(
1197 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1198 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1199 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1200 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1201 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1202 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1203 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1204 "pass" => array("type" => "text"),
1205 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1206 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1207 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1208 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1209 "last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1212 "PRIMARY" => array("id"),
1215 $database["manage"] = array(
1217 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1218 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1219 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1222 "PRIMARY" => array("id"),
1223 "uid_mid" => array("UNIQUE", "uid","mid"),
1226 $database["notify"] = array(
1228 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1229 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1230 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1231 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1232 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1233 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1234 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1235 "msg" => array("type" => "mediumtext"),
1236 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1237 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1238 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1239 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1240 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1241 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1242 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1243 "name_cache" => array("type" => "tinytext"),
1244 "msg_cache" => array("type" => "mediumtext")
1247 "PRIMARY" => array("id"),
1248 "hash_uid" => array("hash", "uid"),
1249 "seen_uid_date" => array("seen", "uid", "date"),
1250 "uid_date" => array("uid", "date"),
1251 "uid_type_link" => array("uid", "type", "link(190)"),
1254 $database["notify-threads"] = array(
1256 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1257 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("notify" => "id")),
1258 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1259 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1260 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1263 "PRIMARY" => array("id"),
1266 $database["oembed"] = array(
1268 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1269 "content" => array("type" => "mediumtext"),
1270 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1273 "PRIMARY" => array("url"),
1274 "created" => array("created"),
1277 $database["parsed_url"] = array(
1279 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1280 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1281 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1282 "content" => array("type" => "mediumtext"),
1283 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1286 "PRIMARY" => array("url", "guessing", "oembed"),
1287 "created" => array("created"),
1290 $database["pconfig"] = array(
1292 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1293 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1294 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1295 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1296 "v" => array("type" => "mediumtext"),
1299 "PRIMARY" => array("id"),
1300 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1303 $database["photo"] = array(
1305 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1306 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1307 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1308 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1309 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1310 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1311 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1312 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1313 "desc" => array("type" => "text"),
1314 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1315 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1316 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1317 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1318 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1319 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1320 "data" => array("type" => "mediumblob", "not null" => "1"),
1321 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1322 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1323 "allow_cid" => array("type" => "mediumtext"),
1324 "allow_gid" => array("type" => "mediumtext"),
1325 "deny_cid" => array("type" => "mediumtext"),
1326 "deny_gid" => array("type" => "mediumtext"),
1329 "PRIMARY" => array("id"),
1330 "contactid" => array("contact-id"),
1331 "uid_contactid" => array("uid", "contact-id"),
1332 "uid_profile" => array("uid", "profile"),
1333 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1334 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1335 "resource-id" => array("resource-id(64)"),
1338 $database["poll"] = array(
1340 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1341 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1342 "q0" => array("type" => "text"),
1343 "q1" => array("type" => "text"),
1344 "q2" => array("type" => "text"),
1345 "q3" => array("type" => "text"),
1346 "q4" => array("type" => "text"),
1347 "q5" => array("type" => "text"),
1348 "q6" => array("type" => "text"),
1349 "q7" => array("type" => "text"),
1350 "q8" => array("type" => "text"),
1351 "q9" => array("type" => "text"),
1354 "PRIMARY" => array("id"),
1355 "uid" => array("uid"),
1358 $database["poll_result"] = array(
1360 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1361 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("poll" => "id")),
1362 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1365 "PRIMARY" => array("id"),
1366 "poll_id" => array("poll_id"),
1367 "choice" => array("choice"),
1370 $database["process"] = array(
1372 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1373 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1374 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1377 "PRIMARY" => array("pid"),
1378 "command" => array("command"),
1381 $database["profile"] = array(
1383 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1384 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1385 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1386 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1387 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1388 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1389 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1390 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
1391 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1392 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1393 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1394 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1395 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1396 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1397 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1398 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1399 "with" => array("type" => "text"),
1400 "howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1401 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1402 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1403 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1404 "pub_keywords" => array("type" => "text"),
1405 "prv_keywords" => array("type" => "text"),
1406 "likes" => array("type" => "text"),
1407 "dislikes" => array("type" => "text"),
1408 "about" => array("type" => "text"),
1409 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1410 "music" => array("type" => "text"),
1411 "book" => array("type" => "text"),
1412 "tv" => array("type" => "text"),
1413 "film" => array("type" => "text"),
1414 "interest" => array("type" => "text"),
1415 "romance" => array("type" => "text"),
1416 "work" => array("type" => "text"),
1417 "education" => array("type" => "text"),
1418 "contact" => array("type" => "text"),
1419 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1420 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1421 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1422 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1423 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1424 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1427 "PRIMARY" => array("id"),
1428 "uid_is-default" => array("uid", "is-default"),
1431 $database["profile_check"] = array(
1433 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1434 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1435 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1436 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1437 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1438 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1441 "PRIMARY" => array("id"),
1444 $database["push_subscriber"] = array(
1446 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1447 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1448 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1449 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1450 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1451 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1452 "last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1453 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1456 "PRIMARY" => array("id"),
1459 $database["queue"] = array(
1461 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1462 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1463 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1464 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1465 "last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1466 "content" => array("type" => "mediumtext"),
1467 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1470 "PRIMARY" => array("id"),
1471 "cid" => array("cid"),
1472 "created" => array("created"),
1473 "last" => array("last"),
1474 "network" => array("network"),
1475 "batch" => array("batch"),
1478 $database["register"] = array(
1480 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1481 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1482 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1483 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1484 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1485 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1486 "note" => array("type" => "text"),
1489 "PRIMARY" => array("id"),
1492 $database["search"] = array(
1494 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1495 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1496 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1499 "PRIMARY" => array("id"),
1500 "uid" => array("uid"),
1503 $database["session"] = array(
1505 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1506 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1507 "data" => array("type" => "text"),
1508 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1511 "PRIMARY" => array("id"),
1512 "sid" => array("sid(64)"),
1513 "expire" => array("expire"),
1516 $database["sign"] = array(
1518 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1519 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1520 "signed_text" => array("type" => "mediumtext"),
1521 "signature" => array("type" => "text"),
1522 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1525 "PRIMARY" => array("id"),
1526 "iid" => array("UNIQUE", "iid"),
1529 $database["term"] = array(
1531 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1532 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1533 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1534 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1535 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1536 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1537 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1538 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1539 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1540 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1541 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1542 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1545 "PRIMARY" => array("tid"),
1546 "oid_otype_type_term" => array("oid","otype","type","term(32)"),
1547 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1548 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1549 "guid" => array("guid(64)"),
1552 $database["thread"] = array(
1554 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => array("item" => "id")),
1555 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1556 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1557 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1558 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1559 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1560 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1561 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1562 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1563 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1564 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1565 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1566 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1567 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1568 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1569 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1570 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1571 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1572 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1573 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1574 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1575 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1576 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1577 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1578 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1579 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1582 "PRIMARY" => array("iid"),
1583 "uid_network_commented" => array("uid","network","commented"),
1584 "uid_network_created" => array("uid","network","created"),
1585 "uid_contactid_commented" => array("uid","contact-id","commented"),
1586 "uid_contactid_created" => array("uid","contact-id","created"),
1587 "contactid" => array("contact-id"),
1588 "ownerid" => array("owner-id"),
1589 "authorid" => array("author-id"),
1590 "uid_created" => array("uid","created"),
1591 "uid_commented" => array("uid","commented"),
1592 "uid_wall_created" => array("uid","wall","created"),
1593 "private_wall_received" => array("private","wall","received"),
1596 $database["tokens"] = array(
1598 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1599 "secret" => array("type" => "text"),
1600 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
1601 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1602 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1603 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1606 "PRIMARY" => array("id"),
1609 $database["user"] = array(
1611 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1612 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1613 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1614 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1615 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1616 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1617 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1618 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1619 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1620 "register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1621 "login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1622 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1623 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1624 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1625 "pubkey" => array("type" => "text"),
1626 "prvkey" => array("type" => "text"),
1627 "spubkey" => array("type" => "text"),
1628 "sprvkey" => array("type" => "text"),
1629 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1630 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1631 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1632 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1633 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1634 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1635 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1636 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1637 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1638 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1639 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1640 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1641 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1642 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1643 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1644 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1645 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1646 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1647 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1648 "allow_cid" => array("type" => "mediumtext"),
1649 "allow_gid" => array("type" => "mediumtext"),
1650 "deny_cid" => array("type" => "mediumtext"),
1651 "deny_gid" => array("type" => "mediumtext"),
1652 "openidserver" => array("type" => "text"),
1655 "PRIMARY" => array("uid"),
1656 "nickname" => array("nickname(32)"),
1659 $database["userd"] = array(
1661 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1662 "username" => array("type" => "varchar(255)", "not null" => "1"),
1665 "PRIMARY" => array("id"),
1666 "username" => array("username(32)"),
1669 $database["workerqueue"] = array(
1671 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1672 "parameter" => array("type" => "text"),
1673 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1674 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1675 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1676 "executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1677 "done" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1680 "PRIMARY" => array("id"),
1681 "pid" => array("pid"),
1682 "parameter" => array("parameter(64)"),
1683 "priority_created" => array("priority", "created"),
1684 "executed" => array("executed"),