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;
190 * Updates DB structure and returns eventual errors messages
192 * @param bool $verbose
193 * @param bool $action Whether to actually apply the update
194 * @param array $tables An array of the database tables
195 * @param array $definition An array of the definition tables
196 * @return string Empty string if the update is successful, error messages otherwise
198 public static function update($verbose, $action, array $tables = null, array $definition = null) {
200 Config::set('system', 'maintenance', 1);
201 Config::set('system', 'maintenance_reason', sprintf(t(': Database update'), DBM::date().' '.date('e')));
206 logger('updating structure', LOGGER_DEBUG);
208 // Get the current structure
211 if (is_null($tables)) {
212 $tables = q("SHOW TABLES");
215 if (DBM::is_result($tables)) {
216 foreach ($tables AS $table) {
217 $table = current($table);
219 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
220 $database[$table] = self::tableStructure($table);
224 // Get the definition
225 if (is_null($definition)) {
226 $definition = self::definition();
229 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
230 if ((version_compare(dba::server_info(), '5.7.4') >= 0) &&
231 !(strpos(dba::server_info(), 'MariaDB') !== false)) {
238 foreach ($definition AS $name => $structure) {
239 $is_new_table = False;
242 if (!isset($database[$name])) {
243 $r = self::createTable($name, $structure["fields"], $verbose, $action, $structure['indexes']);
244 if (!DBM::is_result($r)) {
245 $errors .= self::printUpdateError($name);
247 $is_new_table = True;
252 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
253 if (isset($database[$name]["indexes"][$indexname])) {
254 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
256 $current_index_definition = "__NOT_SET__";
258 $new_index_definition = implode(",",$fieldnames);
259 if ($current_index_definition != $new_index_definition) {
260 if ($fieldnames[0] == "UNIQUE") {
263 $temp_name = "temp-".$name;
270 * Drop the index if it isn't present in the definition
271 * or the definition differ from current status
272 * and index name doesn't start with "local_"
274 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
275 $current_index_definition = implode(",",$fieldnames);
276 if (isset($structure["indexes"][$indexname])) {
277 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
279 $new_index_definition = "__NOT_SET__";
281 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
282 $sql2=self::dropIndex($indexname);
284 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
290 // Compare the field structure field by field
291 foreach ($structure["fields"] AS $fieldname => $parameters) {
292 if (!isset($database[$name]["fields"][$fieldname])) {
293 $sql2=self::addTableField($fieldname, $parameters);
295 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
300 // Compare the field definition
301 $field_definition = $database[$name]["fields"][$fieldname];
303 // Remove the relation data that is used for the referential integrity
304 unset($parameters['relation']);
306 // We change the collation after the indexes had been changed.
307 // This is done to avoid index length problems.
308 // So here we always ensure that there is no need to change it.
309 unset($parameters['Collation']);
310 unset($field_definition['Collation']);
312 $current_field_definition = implode(",", $field_definition);
313 $new_field_definition = implode(",", $parameters);
314 if ($current_field_definition != $new_field_definition) {
315 $sql2 = self::modifyTableField($fieldname, $parameters);
317 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
327 * Create the index if the index don't exists in database
328 * or the definition differ from the current status.
329 * Don't create keys if table is new
331 if (!$is_new_table) {
332 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
333 if (isset($database[$name]["indexes"][$indexname])) {
334 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
336 $current_index_definition = "__NOT_SET__";
338 $new_index_definition = implode(",",$fieldnames);
339 if ($current_index_definition != $new_index_definition) {
340 $sql2 = self::createIndex($indexname, $fieldnames);
342 // Fetch the "group by" fields for unique indexes
343 if ($fieldnames[0] == "UNIQUE") {
344 $group_by = self::groupBy($indexname, $fieldnames);
348 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
356 if (isset($database[$name]["table_status"]["Collation"])) {
357 if ($database[$name]["table_status"]["Collation"] != 'utf8mb4_general_ci') {
358 $sql2 = "DEFAULT COLLATE utf8mb4_general_ci";
361 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
372 // Now have a look at the field collations
373 // Compare the field structure field by field
374 foreach ($structure["fields"] AS $fieldname => $parameters) {
375 // Compare the field definition
376 $field_definition = $database[$name]["fields"][$fieldname];
378 // Define the default collation if not given
379 if (!isset($parameters['Collation']) && !is_null($field_definition['Collation'])) {
380 $parameters['Collation'] = 'utf8mb4_general_ci';
382 $parameters['Collation'] = null;
385 if ($field_definition['Collation'] != $parameters['Collation']) {
386 $sql2 = self::modifyTableField($fieldname, $parameters);
387 if (($sql3 == "") || (substr($sql3, -2, 2) == "; ")) {
388 $sql3 .= "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
397 if (substr($sql3, -2, 2) != "; ") {
402 if ($is_unique && $ignore == '') {
403 foreach ($database[$name]["fields"] AS $fieldname => $parameters) {
404 $field_list .= 'ANY_VALUE(`' . $fieldname . '`),';
406 $field_list = rtrim($field_list, ',');
410 // Ensure index conversion to unique removes duplicates
411 if ($is_unique && ($temp_name != $name)) {
413 echo "SET session old_alter_table=1;\n";
415 echo "DROP TABLE IF EXISTS `".$temp_name."`;\n";
416 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
422 if ($is_unique && ($temp_name != $name)) {
424 echo "SET session old_alter_table=0;\n";
426 echo "INSERT INTO `".$temp_name."` SELECT ".dba::any_value_fallback($field_list)." FROM `".$name."`".$group_by.";\n";
427 echo "DROP TABLE `".$name."`;\n";
428 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
434 Config::set('system', 'maintenance_reason', sprintf(t('%s: updating %s table.'), DBM::date().' '.date('e'), $name));
436 // Ensure index conversion to unique removes duplicates
437 if ($is_unique && ($temp_name != $name)) {
439 dba::e("SET session old_alter_table=1;");
441 dba::e("DROP TABLE IF EXISTS `".$temp_name."`;");
442 if (!DBM::is_result($r)) {
443 $errors .= self::printUpdateError($sql3);
447 $r = dba::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
448 if (!DBM::is_result($r)) {
449 $errors .= self::printUpdateError($sql3);
456 if (!DBM::is_result($r)) {
457 $errors .= self::printUpdateError($sql3);
459 if ($is_unique && ($temp_name != $name)) {
461 dba::e("SET session old_alter_table=0;");
463 $r = dba::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
464 if (!DBM::is_result($r)) {
465 $errors .= self::printUpdateError($sql3);
468 $r = dba::e("DROP TABLE `".$name."`;");
469 if (!DBM::is_result($r)) {
470 $errors .= self::printUpdateError($sql3);
473 $r = dba::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
474 if (!DBM::is_result($r)) {
475 $errors .= self::printUpdateError($sql3);
485 Config::set('system', 'maintenance', 0);
486 Config::set('system', 'maintenance_reason', '');
490 Config::set('system', 'dbupdate', DB_UPDATE_FAILED);
492 Config::set('system', 'dbupdate', DB_UPDATE_SUCCESSFUL);
498 private static function FieldCommand($parameters, $create = true) {
499 $fieldstruct = $parameters["type"];
501 if (!is_null($parameters["Collation"])) {
502 $fieldstruct .= " COLLATE ".$parameters["Collation"];
505 if ($parameters["not null"]) {
506 $fieldstruct .= " NOT NULL";
509 if (isset($parameters["default"])) {
510 if (strpos(strtolower($parameters["type"]),"int")!==false) {
511 $fieldstruct .= " DEFAULT ".$parameters["default"];
513 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
516 if ($parameters["extra"] != "") {
517 $fieldstruct .= " ".$parameters["extra"];
520 /*if (($parameters["primary"] != "") && $create)
521 $fieldstruct .= " PRIMARY KEY";*/
523 return($fieldstruct);
526 private static function createTable($name, $fields, $verbose, $action, $indexes=null) {
530 $primary_keys = array();
531 foreach ($fields AS $fieldname => $field) {
532 $sql_rows[] = "`".dbesc($fieldname)."` ".self::FieldCommand($field);
533 if (x($field,'primary') && $field['primary']!='') {
534 $primary_keys[] = $fieldname;
538 if (!is_null($indexes)) {
539 foreach ($indexes AS $indexname => $fieldnames) {
540 $sql_index = self::createIndex($indexname, $fieldnames, "");
541 if (!is_null($sql_index)) {
542 $sql_rows[] = $sql_index;
547 $sql = implode(",\n\t", $sql_rows);
549 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT COLLATE utf8mb4_general_ci";
561 private static function addTableField($fieldname, $parameters) {
562 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), self::FieldCommand($parameters));
566 private static function modifyTableField($fieldname, $parameters) {
567 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), self::FieldCommand($parameters, false));
571 private static function dropIndex($indexname) {
572 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
576 private static function createIndex($indexname, $fieldnames, $method = "ADD") {
577 $method = strtoupper(trim($method));
578 if ($method!="" && $method!="ADD") {
579 throw new \Exception("Invalid parameter 'method' in self::createIndex(): '$method'");
582 if ($fieldnames[0] == "UNIQUE") {
583 array_shift($fieldnames);
584 $method .= ' UNIQUE';
588 foreach ($fieldnames AS $fieldname) {
593 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
594 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
596 $names .= "`".dbesc($fieldname)."`";
600 if ($indexname == "PRIMARY") {
601 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
605 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
609 private static function groupBy($indexname, $fieldnames) {
610 if ($fieldnames[0] != "UNIQUE") {
614 array_shift($fieldnames);
617 foreach ($fieldnames AS $fieldname) {
622 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
623 $names .= "`".dbesc($matches[1])."`";
625 $names .= "`".dbesc($fieldname)."`";
629 $sql = sprintf(" GROUP BY %s", $names);
633 public static function definition() {
636 $database["addon"] = array(
638 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
639 "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
640 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
641 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
642 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
643 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
644 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
647 "PRIMARY" => array("id"),
648 "name" => array("UNIQUE", "name"),
651 $database["attach"] = array(
653 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
654 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
655 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
656 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
657 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
658 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
659 "data" => array("type" => "longblob", "not null" => "1"),
660 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
661 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
662 "allow_cid" => array("type" => "mediumtext"),
663 "allow_gid" => array("type" => "mediumtext"),
664 "deny_cid" => array("type" => "mediumtext"),
665 "deny_gid" => array("type" => "mediumtext"),
668 "PRIMARY" => array("id"),
671 $database["auth_codes"] = array(
673 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
674 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
675 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
676 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
677 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
680 "PRIMARY" => array("id"),
683 $database["cache"] = array(
685 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
686 "v" => array("type" => "mediumtext"),
687 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
688 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
691 "PRIMARY" => array("k"),
692 "expire_mode_updated" => array("expire_mode", "updated"),
695 $database["challenge"] = array(
697 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
698 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
699 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
700 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
701 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
702 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
705 "PRIMARY" => array("id"),
708 $database["clients"] = array(
710 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
711 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
712 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
713 "name" => array("type" => "text"),
714 "icon" => array("type" => "text"),
715 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
718 "PRIMARY" => array("client_id"),
721 $database["config"] = array(
723 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
724 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
725 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
726 "v" => array("type" => "mediumtext"),
729 "PRIMARY" => array("id"),
730 "cat_k" => array("UNIQUE", "cat", "k"),
733 $database["contact"] = array(
735 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
736 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
737 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
738 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
739 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
740 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
741 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
742 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
743 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
744 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
745 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
746 "about" => array("type" => "text"),
747 "keywords" => array("type" => "text"),
748 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
749 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
750 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
751 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
752 "photo" => array("type" => "text"),
753 "thumb" => array("type" => "text"),
754 "micro" => array("type" => "text"),
755 "site-pubkey" => array("type" => "text"),
756 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
757 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
758 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
759 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
760 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
761 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
762 "pubkey" => array("type" => "text"),
763 "prvkey" => array("type" => "text"),
764 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
765 "request" => array("type" => "text"),
766 "notify" => array("type" => "text"),
767 "poll" => array("type" => "text"),
768 "confirm" => array("type" => "text"),
769 "poco" => array("type" => "text"),
770 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
771 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
772 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
773 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
774 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
775 "last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
776 "success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
777 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
778 "name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
779 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
780 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
781 "term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
782 "last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
783 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
784 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
785 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
786 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
787 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
788 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
789 "contact-type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
790 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
791 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
792 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
793 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
794 "reason" => array("type" => "text"),
795 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
796 "info" => array("type" => "mediumtext"),
797 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
798 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
799 "bd" => array("type" => "date", "not null" => "1", "default" => "0001-01-01"),
800 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
801 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
802 "ffi_keyword_blacklist" => array("type" => "text"),
805 "PRIMARY" => array("id"),
806 "uid_name" => array("uid", "name(190)"),
807 "self_uid" => array("self", "uid"),
808 "alias_uid" => array("alias(32)", "uid"),
809 "pending_uid" => array("pending", "uid"),
810 "blocked_uid" => array("blocked", "uid"),
811 "uid_rel_network_poll" => array("uid", "rel", "network(4)", "poll(64)", "archive"),
812 "uid_network_batch" => array("uid", "network(4)", "batch(64)"),
813 "addr_uid" => array("addr(32)", "uid"),
814 "nurl_uid" => array("nurl(32)", "uid"),
815 "nick_uid" => array("nick(32)", "uid"),
816 "dfrn-id" => array("dfrn-id(64)"),
817 "issued-id" => array("issued-id(64)"),
820 $database["conv"] = array(
822 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
823 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
824 "recips" => array("type" => "text"),
825 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
826 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
827 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
828 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
829 "subject" => array("type" => "text"),
832 "PRIMARY" => array("id"),
833 "uid" => array("uid"),
836 $database["conversation"] = array(
838 "item-uri" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
839 "reply-to-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
840 "conversation-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
841 "conversation-href" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
842 "protocol" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
843 "source" => array("type" => "mediumtext"),
844 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
847 "PRIMARY" => array("item-uri"),
848 "conversation-uri" => array("conversation-uri"),
849 "received" => array("received"),
852 $database["event"] = array(
854 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
855 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
856 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
857 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
858 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
859 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
860 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
861 "start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
862 "finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
863 "summary" => array("type" => "text"),
864 "desc" => array("type" => "text"),
865 "location" => array("type" => "text"),
866 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
867 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
868 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
869 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
870 "allow_cid" => array("type" => "mediumtext"),
871 "allow_gid" => array("type" => "mediumtext"),
872 "deny_cid" => array("type" => "mediumtext"),
873 "deny_gid" => array("type" => "mediumtext"),
876 "PRIMARY" => array("id"),
877 "uid_start" => array("uid", "start"),
880 $database["fcontact"] = array(
882 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
883 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
884 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
885 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
886 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
887 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
888 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
889 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
890 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
891 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
892 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
893 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
894 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
895 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
896 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
897 "pubkey" => array("type" => "text"),
898 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
901 "PRIMARY" => array("id"),
902 "addr" => array("addr(32)"),
903 "url" => array("UNIQUE", "url(190)"),
906 $database["fsuggest"] = array(
908 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
909 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
910 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
911 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
912 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
913 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
914 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
915 "note" => array("type" => "text"),
916 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
919 "PRIMARY" => array("id"),
922 $database["gcign"] = array(
924 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
925 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
926 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
929 "PRIMARY" => array("id"),
930 "uid" => array("uid"),
931 "gcid" => array("gcid"),
934 $database["gcontact"] = array(
936 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
937 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
938 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
939 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
940 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
941 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
942 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
943 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
944 "updated" => array("type" => "datetime", "default" => NULL_DATE),
945 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
946 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
947 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
948 "about" => array("type" => "text"),
949 "keywords" => array("type" => "text"),
950 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
951 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
952 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
953 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
954 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
955 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
956 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
957 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
958 "notify" => array("type" => "text"),
959 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
960 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
961 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
964 "PRIMARY" => array("id"),
965 "nurl" => array("UNIQUE", "nurl(190)"),
966 "name" => array("name(64)"),
967 "nick" => array("nick(32)"),
968 "addr" => array("addr(64)"),
969 "hide_network_updated" => array("hide", "network(4)", "updated"),
970 "updated" => array("updated"),
973 $database["glink"] = array(
975 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
976 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
977 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
978 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
979 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
980 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
983 "PRIMARY" => array("id"),
984 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
985 "gcid" => array("gcid"),
988 $database["group"] = array(
990 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
991 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
992 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
993 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
994 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
997 "PRIMARY" => array("id"),
998 "uid" => array("uid"),
1001 $database["group_member"] = array(
1003 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1004 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("group" => "id")),
1005 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1008 "PRIMARY" => array("id"),
1009 "contactid" => array("contact-id"),
1010 "gid_contactid" => array("UNIQUE", "gid", "contact-id"),
1013 $database["gserver"] = array(
1015 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1016 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1017 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1018 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1019 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1020 "info" => array("type" => "text"),
1021 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1022 "registered-users" => array("type" => "int(10)", "not null" => "1", "default" => "0"),
1023 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1024 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1025 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1026 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1027 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1028 "last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
1029 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
1030 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
1033 "PRIMARY" => array("id"),
1034 "nurl" => array("UNIQUE", "nurl(190)"),
1037 $database["hook"] = array(
1039 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1040 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1041 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1042 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1043 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1046 "PRIMARY" => array("id"),
1047 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
1050 $database["intro"] = array(
1052 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1053 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1054 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("fcontact" => "id")),
1055 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1056 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1057 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1058 "note" => array("type" => "text"),
1059 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1060 "datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1061 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1062 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1065 "PRIMARY" => array("id"),
1068 $database["item"] = array(
1070 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "relation" => array("thread" => "iid")),
1071 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1072 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1073 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1074 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1075 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1076 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1077 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1078 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1079 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1080 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1081 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1082 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1083 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1084 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1085 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1086 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1087 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1088 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1089 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1090 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1091 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1092 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1093 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1094 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1095 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1096 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1097 "body" => array("type" => "mediumtext"),
1098 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1099 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1100 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1101 "object" => array("type" => "text"),
1102 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1103 "target" => array("type" => "text"),
1104 "postopts" => array("type" => "text"),
1105 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1106 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1107 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("event" => "id")),
1108 "tag" => array("type" => "mediumtext"),
1109 "attach" => array("type" => "mediumtext"),
1110 "inform" => array("type" => "mediumtext"),
1111 "file" => array("type" => "mediumtext"),
1112 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1113 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1114 "allow_cid" => array("type" => "mediumtext"),
1115 "allow_gid" => array("type" => "mediumtext"),
1116 "deny_cid" => array("type" => "mediumtext"),
1117 "deny_gid" => array("type" => "mediumtext"),
1118 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1119 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1120 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1121 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1122 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1123 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1124 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1125 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1126 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1127 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1128 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1129 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1130 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1131 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1132 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1133 "rendered-html" => array("type" => "mediumtext"),
1134 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1137 "PRIMARY" => array("id"),
1138 "guid" => array("guid(191)"),
1139 "uri" => array("uri(191)"),
1140 "parent" => array("parent"),
1141 "parent-uri" => array("parent-uri(191)"),
1142 "extid" => array("extid(191)"),
1143 "uid_id" => array("uid","id"),
1144 "uid_contactid_id" => array("uid","contact-id","id"),
1145 "uid_created" => array("uid","created"),
1146 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1147 "uid_network_received" => array("uid","network(4)","received"),
1148 "uid_network_commented" => array("uid","network(4)","commented"),
1149 "uid_thrparent" => array("uid","thr-parent(190)"),
1150 "uid_parenturi" => array("uid","parent-uri(190)"),
1151 "uid_contactid_created" => array("uid","contact-id","created"),
1152 "authorid_created" => array("author-id","created"),
1153 "ownerid" => array("owner-id"),
1154 "uid_uri" => array("uid", "uri(190)"),
1155 "resource-id" => array("resource-id(191)"),
1156 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1157 "uid_type_changed" => array("uid","type(190)","changed"),
1158 "contactid_verb" => array("contact-id","verb(190)"),
1159 "deleted_changed" => array("deleted","changed"),
1160 "uid_wall_changed" => array("uid","wall","changed"),
1161 "uid_eventid" => array("uid","event-id"),
1162 "uid_authorlink" => array("uid","author-link(190)"),
1163 "uid_ownerlink" => array("uid","owner-link(190)"),
1166 $database["locks"] = array(
1168 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1169 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1170 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1171 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1174 "PRIMARY" => array("id"),
1177 $database["mail"] = array(
1179 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1180 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1181 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1182 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1183 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1184 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1185 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => array("contact" => "id")),
1186 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("conv" => "id")),
1187 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1188 "body" => array("type" => "mediumtext"),
1189 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1190 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1191 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1192 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1193 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1194 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1195 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1198 "PRIMARY" => array("id"),
1199 "uid_seen" => array("uid", "seen"),
1200 "convid" => array("convid"),
1201 "uri" => array("uri(64)"),
1202 "parent-uri" => array("parent-uri(64)"),
1203 "contactid" => array("contact-id(32)"),
1206 $database["mailacct"] = array(
1208 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1209 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1210 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1211 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1212 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1213 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1214 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1215 "pass" => array("type" => "text"),
1216 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1217 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1218 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1219 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1220 "last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1223 "PRIMARY" => array("id"),
1226 $database["manage"] = array(
1228 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1229 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1230 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1233 "PRIMARY" => array("id"),
1234 "uid_mid" => array("UNIQUE", "uid","mid"),
1237 $database["notify"] = array(
1239 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1240 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1241 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1242 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1243 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1244 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1245 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1246 "msg" => array("type" => "mediumtext"),
1247 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1248 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1249 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1250 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1251 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1252 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1253 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1254 "name_cache" => array("type" => "tinytext"),
1255 "msg_cache" => array("type" => "mediumtext")
1258 "PRIMARY" => array("id"),
1259 "hash_uid" => array("hash", "uid"),
1260 "seen_uid_date" => array("seen", "uid", "date"),
1261 "uid_date" => array("uid", "date"),
1262 "uid_type_link" => array("uid", "type", "link(190)"),
1265 $database["notify-threads"] = array(
1267 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1268 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("notify" => "id")),
1269 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1270 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1271 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1274 "PRIMARY" => array("id"),
1277 $database["oembed"] = array(
1279 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1280 "maxwidth" => array("type" => "int(11)", "not null" => "1", "primary" => "1"),
1281 "content" => array("type" => "mediumtext"),
1282 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1285 "PRIMARY" => array("url", "maxwidth"),
1286 "created" => array("created"),
1289 $database["parsed_url"] = array(
1291 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1292 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1293 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1294 "content" => array("type" => "mediumtext"),
1295 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1298 "PRIMARY" => array("url", "guessing", "oembed"),
1299 "created" => array("created"),
1302 $database["pconfig"] = array(
1304 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1305 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1306 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1307 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1308 "v" => array("type" => "mediumtext"),
1311 "PRIMARY" => array("id"),
1312 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1315 $database["photo"] = array(
1317 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1318 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1319 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1320 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1321 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1322 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1323 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1324 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1325 "desc" => array("type" => "text"),
1326 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1327 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1328 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1329 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1330 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1331 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1332 "data" => array("type" => "mediumblob", "not null" => "1"),
1333 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1334 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1335 "allow_cid" => array("type" => "mediumtext"),
1336 "allow_gid" => array("type" => "mediumtext"),
1337 "deny_cid" => array("type" => "mediumtext"),
1338 "deny_gid" => array("type" => "mediumtext"),
1341 "PRIMARY" => array("id"),
1342 "contactid" => array("contact-id"),
1343 "uid_contactid" => array("uid", "contact-id"),
1344 "uid_profile" => array("uid", "profile"),
1345 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1346 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1347 "resource-id" => array("resource-id(64)"),
1350 $database["poll"] = array(
1352 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1353 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1354 "q0" => array("type" => "text"),
1355 "q1" => array("type" => "text"),
1356 "q2" => array("type" => "text"),
1357 "q3" => array("type" => "text"),
1358 "q4" => array("type" => "text"),
1359 "q5" => array("type" => "text"),
1360 "q6" => array("type" => "text"),
1361 "q7" => array("type" => "text"),
1362 "q8" => array("type" => "text"),
1363 "q9" => array("type" => "text"),
1366 "PRIMARY" => array("id"),
1367 "uid" => array("uid"),
1370 $database["poll_result"] = array(
1372 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1373 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("poll" => "id")),
1374 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1377 "PRIMARY" => array("id"),
1378 "poll_id" => array("poll_id"),
1379 "choice" => array("choice"),
1382 $database["process"] = array(
1384 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1385 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1386 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1389 "PRIMARY" => array("pid"),
1390 "command" => array("command"),
1393 $database["profile"] = array(
1395 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1396 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1397 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1398 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1399 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1400 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1401 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1402 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
1403 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1404 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1405 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1406 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1407 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1408 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1409 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1410 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1411 "with" => array("type" => "text"),
1412 "howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1413 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1414 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1415 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1416 "pub_keywords" => array("type" => "text"),
1417 "prv_keywords" => array("type" => "text"),
1418 "likes" => array("type" => "text"),
1419 "dislikes" => array("type" => "text"),
1420 "about" => array("type" => "text"),
1421 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1422 "music" => array("type" => "text"),
1423 "book" => array("type" => "text"),
1424 "tv" => array("type" => "text"),
1425 "film" => array("type" => "text"),
1426 "interest" => array("type" => "text"),
1427 "romance" => array("type" => "text"),
1428 "work" => array("type" => "text"),
1429 "education" => array("type" => "text"),
1430 "contact" => array("type" => "text"),
1431 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1432 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1433 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1434 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1435 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1436 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1439 "PRIMARY" => array("id"),
1440 "uid_is-default" => array("uid", "is-default"),
1443 $database["profile_check"] = array(
1445 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1446 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1447 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1448 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1449 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1450 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1453 "PRIMARY" => array("id"),
1456 $database["push_subscriber"] = array(
1458 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1459 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1460 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1461 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1462 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1463 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1464 "last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1465 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1468 "PRIMARY" => array("id"),
1471 $database["queue"] = array(
1473 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1474 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1475 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1476 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1477 "last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1478 "content" => array("type" => "mediumtext"),
1479 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1482 "PRIMARY" => array("id"),
1483 "cid" => array("cid"),
1484 "created" => array("created"),
1485 "last" => array("last"),
1486 "network" => array("network"),
1487 "batch" => array("batch"),
1490 $database["register"] = array(
1492 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1493 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1494 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1495 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1496 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1497 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1498 "note" => array("type" => "text"),
1501 "PRIMARY" => array("id"),
1504 $database["search"] = array(
1506 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1507 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1508 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1511 "PRIMARY" => array("id"),
1512 "uid" => array("uid"),
1515 $database["session"] = array(
1517 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1518 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1519 "data" => array("type" => "text"),
1520 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1523 "PRIMARY" => array("id"),
1524 "sid" => array("sid(64)"),
1525 "expire" => array("expire"),
1528 $database["sign"] = array(
1530 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1531 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1532 "signed_text" => array("type" => "mediumtext"),
1533 "signature" => array("type" => "text"),
1534 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1537 "PRIMARY" => array("id"),
1538 "iid" => array("UNIQUE", "iid"),
1541 $database["term"] = array(
1543 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1544 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1545 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1546 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1547 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1548 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1549 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1550 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1551 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1552 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1553 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1554 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1557 "PRIMARY" => array("tid"),
1558 "oid_otype_type_term" => array("oid","otype","type","term(32)"),
1559 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1560 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1561 "guid" => array("guid(64)"),
1564 $database["thread"] = array(
1566 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => array("item" => "id")),
1567 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1568 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1569 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1570 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1571 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1572 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1573 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1574 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1575 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1576 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1577 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1578 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1579 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1580 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1581 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1582 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1583 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1584 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1585 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1586 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1587 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1588 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1589 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1590 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1591 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1594 "PRIMARY" => array("iid"),
1595 "uid_network_commented" => array("uid","network","commented"),
1596 "uid_network_created" => array("uid","network","created"),
1597 "uid_contactid_commented" => array("uid","contact-id","commented"),
1598 "uid_contactid_created" => array("uid","contact-id","created"),
1599 "contactid" => array("contact-id"),
1600 "ownerid" => array("owner-id"),
1601 "authorid" => array("author-id"),
1602 "uid_created" => array("uid","created"),
1603 "uid_commented" => array("uid","commented"),
1604 "uid_wall_created" => array("uid","wall","created"),
1605 "private_wall_commented" => array("private","wall","commented"),
1608 $database["tokens"] = array(
1610 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1611 "secret" => array("type" => "text"),
1612 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
1613 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1614 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1615 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1618 "PRIMARY" => array("id"),
1621 $database["user"] = array(
1623 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1624 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1625 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1626 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1627 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1628 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1629 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1630 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1631 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1632 "register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1633 "login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1634 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1635 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1636 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1637 "pubkey" => array("type" => "text"),
1638 "prvkey" => array("type" => "text"),
1639 "spubkey" => array("type" => "text"),
1640 "sprvkey" => array("type" => "text"),
1641 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1642 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1643 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1644 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1645 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1646 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1647 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1648 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1649 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1650 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1651 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1652 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1653 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1654 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1655 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1656 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1657 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1658 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1659 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1660 "allow_cid" => array("type" => "mediumtext"),
1661 "allow_gid" => array("type" => "mediumtext"),
1662 "deny_cid" => array("type" => "mediumtext"),
1663 "deny_gid" => array("type" => "mediumtext"),
1664 "openidserver" => array("type" => "text"),
1667 "PRIMARY" => array("uid"),
1668 "nickname" => array("nickname(32)"),
1671 $database["userd"] = array(
1673 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1674 "username" => array("type" => "varchar(255)", "not null" => "1"),
1677 "PRIMARY" => array("id"),
1678 "username" => array("username(32)"),
1681 $database["workerqueue"] = array(
1683 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1684 "parameter" => array("type" => "text"),
1685 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1686 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1687 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1688 "executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1689 "done" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1692 "PRIMARY" => array("id"),
1693 "pid" => array("pid"),
1694 "parameter" => array("parameter(64)"),
1695 "priority_created" => array("priority", "created"),
1696 "executed" => array("executed"),