3 * @file include/dbstructure.php
6 use Friendica\Core\System;
7 use Friendica\Core\Config;
8 use Friendica\Database\DBM;
10 require_once "boot.php";
11 require_once "include/text.php";
14 * Converts all tables from MyISAM to InnoDB
16 function convert_to_innodb() {
17 $r = q("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `engine` = 'MyISAM' AND `table_schema` = '%s'",
18 dbesc(dba::database_name()));
20 if (!DBM::is_result($r)) {
21 echo t('There are no tables on MyISAM.')."\n";
25 foreach ($r AS $table) {
26 $sql = sprintf("ALTER TABLE `%s` engine=InnoDB;", dbesc($table['TABLE_NAME']));
29 $result = dba::e($sql);
30 if (!DBM::is_result($result)) {
31 print_update_error($sql);
37 * send the email and do what is needed to do on update fails
39 * @param update_id (int) number of failed update
40 * @param error_message (str) error message
42 function update_fail($update_id, $error_message) {
43 //send the administrators an e-mail
44 $admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
45 $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
50 if (!DBM::is_result($adminlist)) {
51 logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_NORMAL);
57 // every admin could had different language
58 foreach ($adminlist as $admin) {
59 $lang = (($admin['language'])?$admin['language']:'en');
62 $preamble = deindent(t("
63 The friendica developers released update %s recently,
64 but when I tried to install it, something went terribly wrong.
65 This needs to be fixed soon and I can't do it alone. Please contact a
66 friendica developer if you can not help me on your own. My database might be invalid."));
67 $body = t("The error message is\n[pre]%s[/pre]");
68 $preamble = sprintf($preamble, $update_id);
69 $body = sprintf($body, $error_message);
72 'type' => SYSTEM_EMAIL,
73 'to_email' => $admin['email'],
74 'preamble' => $preamble,
81 logger("CRITICAL: Database structure update failed: ".$retval);
85 function table_structure($table) {
86 $structures = q("DESCRIBE `%s`", $table);
88 $full_columns = q("SHOW FULL COLUMNS FROM `%s`", $table);
90 $indexes = q("SHOW INDEX FROM `%s`", $table);
92 $table_status = q("SHOW TABLE STATUS WHERE `name` = '%s'", $table);
94 if (DBM::is_result($table_status)) {
95 $table_status = $table_status[0];
97 $table_status = array();
100 $fielddata = array();
101 $indexdata = array();
103 if (DBM::is_result($indexes))
104 foreach ($indexes AS $index) {
105 if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
106 $indexdata[$index["Key_name"]] = array('UNIQUE');
109 $column = $index["Column_name"];
111 if (($index["Sub_part"] != "")) {
112 $column .= "(".$index["Sub_part"].")";
115 $indexdata[$index["Key_name"]][] = $column;
117 if (DBM::is_result($structures)) {
118 foreach ($structures AS $field) {
119 $fielddata[$field["Field"]]["type"] = $field["Type"];
120 if ($field["Null"] == "NO") {
121 $fielddata[$field["Field"]]["not null"] = true;
124 if (isset($field["Default"])) {
125 $fielddata[$field["Field"]]["default"] = $field["Default"];
128 if ($field["Extra"] != "") {
129 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
132 if ($field["Key"] == "PRI") {
133 $fielddata[$field["Field"]]["primary"] = true;
137 if (DBM::is_result($full_columns)) {
138 foreach ($full_columns AS $column) {
139 $fielddata[$column["Field"]]["Collation"] = $column["Collation"];
143 return array("fields" => $fielddata, "indexes" => $indexdata, "table_status" => $table_status);
146 function print_structure($database) {
147 echo "-- ------------------------------------------\n";
148 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
149 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
150 echo "-- ------------------------------------------\n\n\n";
151 foreach ($database AS $name => $structure) {
153 echo "-- TABLE $name\n";
155 db_create_table($name, $structure['fields'], true, false, $structure["indexes"]);
162 * @brief Print out database error messages
164 * @param string $message Message to be added to the error message
166 * @return string Error message
168 function print_update_error($message) {
169 echo sprintf(t("\nError %d occurred during database update:\n%s\n"),
170 dba::errorNo(), dba::errorMessage());
172 return t('Errors encountered performing database changes: ').$message.EOL;
175 function update_structure($verbose, $action, $tables=null, $definition=null) {
179 Config::set('system', 'maintenance', 1);
180 Config::set('system', 'maintenance_reason', sprintf(t(': Database update'), DBM::date().' '.date('e')));
185 logger('updating structure', LOGGER_DEBUG);
187 // Get the current structure
190 if (is_null($tables)) {
191 $tables = q("SHOW TABLES");
194 if (DBM::is_result($tables)) {
195 foreach ($tables AS $table) {
196 $table = current($table);
198 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
199 $database[$table] = table_structure($table);
203 // Get the definition
204 if (is_null($definition)) {
205 $definition = db_definition();
208 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
209 if ((version_compare(dba::server_info(), '5.7.4') >= 0) &&
210 !(strpos(dba::server_info(), 'MariaDB') !== false)) {
217 foreach ($definition AS $name => $structure) {
218 $is_new_table = False;
221 if (!isset($database[$name])) {
222 $r = db_create_table($name, $structure["fields"], $verbose, $action, $structure['indexes']);
223 if (!DBM::is_result($r)) {
224 $errors .= print_update_error($name);
226 $is_new_table = True;
231 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
232 if (isset($database[$name]["indexes"][$indexname])) {
233 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
235 $current_index_definition = "__NOT_SET__";
237 $new_index_definition = implode(",",$fieldnames);
238 if ($current_index_definition != $new_index_definition) {
239 if ($fieldnames[0] == "UNIQUE") {
242 $temp_name = "temp-".$name;
249 * Drop the index if it isn't present in the definition
250 * or the definition differ from current status
251 * and index name doesn't start with "local_"
253 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
254 $current_index_definition = implode(",",$fieldnames);
255 if (isset($structure["indexes"][$indexname])) {
256 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
258 $new_index_definition = "__NOT_SET__";
260 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
261 $sql2=db_drop_index($indexname);
263 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
269 // Compare the field structure field by field
270 foreach ($structure["fields"] AS $fieldname => $parameters) {
271 if (!isset($database[$name]["fields"][$fieldname])) {
272 $sql2=db_add_table_field($fieldname, $parameters);
274 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
279 // Compare the field definition
280 $field_definition = $database[$name]["fields"][$fieldname];
282 // Remove the relation data that is used for the referential integrity
283 unset($parameters['relation']);
285 // We change the collation after the indexes had been changed.
286 // This is done to avoid index length problems.
287 // So here we always ensure that there is no need to change it.
288 unset($parameters['Collation']);
289 unset($field_definition['Collation']);
291 $current_field_definition = implode(",", $field_definition);
292 $new_field_definition = implode(",", $parameters);
293 if ($current_field_definition != $new_field_definition) {
294 $sql2 = db_modify_table_field($fieldname, $parameters);
296 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
306 * Create the index if the index don't exists in database
307 * or the definition differ from the current status.
308 * Don't create keys if table is new
310 if (!$is_new_table) {
311 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
312 if (isset($database[$name]["indexes"][$indexname])) {
313 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
315 $current_index_definition = "__NOT_SET__";
317 $new_index_definition = implode(",",$fieldnames);
318 if ($current_index_definition != $new_index_definition) {
319 $sql2 = db_create_index($indexname, $fieldnames);
321 // Fetch the "group by" fields for unique indexes
322 if ($fieldnames[0] == "UNIQUE") {
323 $group_by = db_group_by($indexname, $fieldnames);
327 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
335 if (isset($database[$name]["table_status"]["Collation"])) {
336 if ($database[$name]["table_status"]["Collation"] != 'utf8mb4_general_ci') {
337 $sql2 = "DEFAULT COLLATE utf8mb4_general_ci";
340 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
351 // Now have a look at the field collations
352 // Compare the field structure field by field
353 foreach ($structure["fields"] AS $fieldname => $parameters) {
354 // Compare the field definition
355 $field_definition = $database[$name]["fields"][$fieldname];
357 // Define the default collation if not given
358 if (!isset($parameters['Collation']) && !is_null($field_definition['Collation'])) {
359 $parameters['Collation'] = 'utf8mb4_general_ci';
361 $parameters['Collation'] = null;
364 if ($field_definition['Collation'] != $parameters['Collation']) {
365 $sql2 = db_modify_table_field($fieldname, $parameters);
366 if (($sql3 == "") || (substr($sql3, -2, 2) == "; ")) {
367 $sql3 .= "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
376 if (substr($sql3, -2, 2) != "; ") {
381 if ($is_unique && $ignore == '') {
382 foreach ($database[$name]["fields"] AS $fieldname => $parameters) {
383 $field_list .= 'ANY_VALUE(`' . $fieldname . '`),';
385 $field_list = rtrim($field_list, ',');
389 // Ensure index conversion to unique removes duplicates
390 if ($is_unique && ($temp_name != $name)) {
392 echo "SET session old_alter_table=1;\n";
394 echo "DROP TABLE IF EXISTS `".$temp_name."`;\n";
395 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
401 if ($is_unique && ($temp_name != $name)) {
403 echo "SET session old_alter_table=0;\n";
405 echo "INSERT INTO `".$temp_name."` SELECT ".dba::any_value_fallback($field_list)." FROM `".$name."`".$group_by.";\n";
406 echo "DROP TABLE `".$name."`;\n";
407 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
413 Config::set('system', 'maintenance_reason', sprintf(t('%s: updating %s table.'), DBM::date().' '.date('e'), $name));
415 // Ensure index conversion to unique removes duplicates
416 if ($is_unique && ($temp_name != $name)) {
418 dba::e("SET session old_alter_table=1;");
420 dba::e("DROP TABLE IF EXISTS `".$temp_name."`;");
421 if (!DBM::is_result($r)) {
422 $errors .= print_update_error($sql3);
426 $r = dba::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
427 if (!DBM::is_result($r)) {
428 $errors .= print_update_error($sql3);
435 if (!DBM::is_result($r)) {
436 $errors .= print_update_error($sql3);
438 if ($is_unique && ($temp_name != $name)) {
440 dba::e("SET session old_alter_table=0;");
442 $r = dba::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
443 if (!DBM::is_result($r)) {
444 $errors .= print_update_error($sql3);
447 $r = dba::e("DROP TABLE `".$name."`;");
448 if (!DBM::is_result($r)) {
449 $errors .= print_update_error($sql3);
452 $r = dba::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
453 if (!DBM::is_result($r)) {
454 $errors .= print_update_error($sql3);
464 Config::set('system', 'maintenance', 0);
465 Config::set('system', 'maintenance_reason', '');
469 Config::set('system', 'dbupdate', DB_UPDATE_FAILED);
471 Config::set('system', 'dbupdate', DB_UPDATE_SUCCESSFUL);
477 function db_field_command($parameters, $create = true) {
478 $fieldstruct = $parameters["type"];
480 if (!is_null($parameters["Collation"])) {
481 $fieldstruct .= " COLLATE ".$parameters["Collation"];
484 if ($parameters["not null"])
485 $fieldstruct .= " NOT NULL";
487 if (isset($parameters["default"])) {
488 if (strpos(strtolower($parameters["type"]),"int")!==false) {
489 $fieldstruct .= " DEFAULT ".$parameters["default"];
491 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
494 if ($parameters["extra"] != "")
495 $fieldstruct .= " ".$parameters["extra"];
497 /*if (($parameters["primary"] != "") && $create)
498 $fieldstruct .= " PRIMARY KEY";*/
500 return($fieldstruct);
503 function db_create_table($name, $fields, $verbose, $action, $indexes=null) {
511 $primary_keys = array();
512 foreach ($fields AS $fieldname => $field) {
513 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
514 if (x($field,'primary') && $field['primary']!='') {
515 $primary_keys[] = $fieldname;
519 if (!is_null($indexes)) {
520 foreach ($indexes AS $indexname => $fieldnames) {
521 $sql_index = db_create_index($indexname, $fieldnames, "");
522 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
526 $sql = implode(",\n\t", $sql_rows);
528 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT COLLATE utf8mb4_general_ci";
538 function db_add_table_field($fieldname, $parameters) {
539 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
543 function db_modify_table_field($fieldname, $parameters) {
544 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
548 function db_drop_index($indexname) {
549 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
553 function db_create_index($indexname, $fieldnames, $method="ADD") {
555 $method = strtoupper(trim($method));
556 if ($method!="" && $method!="ADD") {
557 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
561 if ($fieldnames[0] == "UNIQUE") {
562 array_shift($fieldnames);
563 $method .= ' UNIQUE';
567 foreach ($fieldnames AS $fieldname) {
571 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
572 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
574 $names .= "`".dbesc($fieldname)."`";
578 if ($indexname == "PRIMARY") {
579 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
583 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
587 function db_group_by($indexname, $fieldnames) {
589 if ($fieldnames[0] != "UNIQUE") {
593 array_shift($fieldnames);
596 foreach ($fieldnames AS $fieldname) {
600 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
601 $names .= "`".dbesc($matches[1])."`";
603 $names .= "`".dbesc($fieldname)."`";
607 $sql = sprintf(" GROUP BY %s", $names);
611 function db_definition() {
615 $database["addon"] = array(
617 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
618 "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
619 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
620 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
621 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
622 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
623 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
626 "PRIMARY" => array("id"),
627 "name" => array("UNIQUE", "name"),
630 $database["attach"] = array(
632 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
633 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
634 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
635 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
636 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
637 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
638 "data" => array("type" => "longblob", "not null" => "1"),
639 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
640 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
641 "allow_cid" => array("type" => "mediumtext"),
642 "allow_gid" => array("type" => "mediumtext"),
643 "deny_cid" => array("type" => "mediumtext"),
644 "deny_gid" => array("type" => "mediumtext"),
647 "PRIMARY" => array("id"),
650 $database["auth_codes"] = array(
652 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
653 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
654 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
655 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
656 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
659 "PRIMARY" => array("id"),
662 $database["cache"] = array(
664 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
665 "v" => array("type" => "mediumtext"),
666 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
667 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
670 "PRIMARY" => array("k"),
671 "expire_mode_updated" => array("expire_mode", "updated"),
674 $database["challenge"] = array(
676 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
677 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
678 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
679 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
680 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
681 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
684 "PRIMARY" => array("id"),
687 $database["clients"] = array(
689 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
690 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
691 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
692 "name" => array("type" => "text"),
693 "icon" => array("type" => "text"),
694 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
697 "PRIMARY" => array("client_id"),
700 $database["config"] = array(
702 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
703 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
704 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
705 "v" => array("type" => "mediumtext"),
708 "PRIMARY" => array("id"),
709 "cat_k" => array("UNIQUE", "cat", "k"),
712 $database["contact"] = array(
714 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
715 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
716 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
717 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
718 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
719 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
720 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
721 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
722 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
723 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
724 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
725 "about" => array("type" => "text"),
726 "keywords" => array("type" => "text"),
727 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
728 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
729 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
730 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
731 "photo" => array("type" => "text"),
732 "thumb" => array("type" => "text"),
733 "micro" => array("type" => "text"),
734 "site-pubkey" => array("type" => "text"),
735 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
736 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
737 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
738 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
739 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
740 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
741 "pubkey" => array("type" => "text"),
742 "prvkey" => array("type" => "text"),
743 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
744 "request" => array("type" => "text"),
745 "notify" => array("type" => "text"),
746 "poll" => array("type" => "text"),
747 "confirm" => array("type" => "text"),
748 "poco" => array("type" => "text"),
749 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
750 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
751 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
752 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
753 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
754 "last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
755 "success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
756 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
757 "name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
758 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
759 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
760 "term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
761 "last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
762 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
763 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
764 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
765 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
766 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
767 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
768 "contact-type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
769 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
770 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
771 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
772 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
773 "reason" => array("type" => "text"),
774 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
775 "info" => array("type" => "mediumtext"),
776 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
777 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
778 "bd" => array("type" => "date", "not null" => "1", "default" => "0001-01-01"),
779 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
780 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
781 "ffi_keyword_blacklist" => array("type" => "text"),
784 "PRIMARY" => array("id"),
785 "uid_name" => array("uid", "name(190)"),
786 "self_uid" => array("self", "uid"),
787 "alias_uid" => array("alias(32)", "uid"),
788 "pending_uid" => array("pending", "uid"),
789 "blocked_uid" => array("blocked", "uid"),
790 "uid_rel_network_poll" => array("uid", "rel", "network(4)", "poll(64)", "archive"),
791 "uid_network_batch" => array("uid", "network(4)", "batch(64)"),
792 "addr_uid" => array("addr(32)", "uid"),
793 "nurl_uid" => array("nurl(32)", "uid"),
794 "nick_uid" => array("nick(32)", "uid"),
795 "dfrn-id" => array("dfrn-id(64)"),
796 "issued-id" => array("issued-id(64)"),
799 $database["conv"] = array(
801 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
802 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
803 "recips" => array("type" => "text"),
804 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
805 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
806 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
807 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
808 "subject" => array("type" => "text"),
811 "PRIMARY" => array("id"),
812 "uid" => array("uid"),
815 $database["conversation"] = array(
817 "item-uri" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
818 "reply-to-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
819 "conversation-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
820 "conversation-href" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
821 "protocol" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
822 "source" => array("type" => "mediumtext"),
823 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
826 "PRIMARY" => array("item-uri"),
827 "conversation-uri" => array("conversation-uri"),
828 "received" => array("received"),
831 $database["event"] = array(
833 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
834 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
835 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
836 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
837 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
838 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
839 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
840 "start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
841 "finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
842 "summary" => array("type" => "text"),
843 "desc" => array("type" => "text"),
844 "location" => array("type" => "text"),
845 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
846 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
847 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
848 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
849 "allow_cid" => array("type" => "mediumtext"),
850 "allow_gid" => array("type" => "mediumtext"),
851 "deny_cid" => array("type" => "mediumtext"),
852 "deny_gid" => array("type" => "mediumtext"),
855 "PRIMARY" => array("id"),
856 "uid_start" => array("uid", "start"),
859 $database["fcontact"] = array(
861 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
862 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
863 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
864 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
865 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
866 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
867 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
868 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
869 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
870 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
871 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
872 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
873 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
874 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
875 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
876 "pubkey" => array("type" => "text"),
877 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
880 "PRIMARY" => array("id"),
881 "addr" => array("addr(32)"),
882 "url" => array("UNIQUE", "url(190)"),
885 $database["fsuggest"] = array(
887 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
888 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
889 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
890 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
891 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
892 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
893 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
894 "note" => array("type" => "text"),
895 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
898 "PRIMARY" => array("id"),
901 $database["gcign"] = array(
903 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
904 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
905 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
908 "PRIMARY" => array("id"),
909 "uid" => array("uid"),
910 "gcid" => array("gcid"),
913 $database["gcontact"] = array(
915 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
916 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
917 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
918 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
919 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
920 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
921 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
922 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
923 "updated" => array("type" => "datetime", "default" => NULL_DATE),
924 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
925 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
926 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
927 "about" => array("type" => "text"),
928 "keywords" => array("type" => "text"),
929 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
930 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
931 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
932 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
933 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
934 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
935 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
936 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
937 "notify" => array("type" => "text"),
938 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
939 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
940 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
943 "PRIMARY" => array("id"),
944 "nurl" => array("UNIQUE", "nurl(190)"),
945 "name" => array("name(64)"),
946 "nick" => array("nick(32)"),
947 "addr" => array("addr(64)"),
948 "hide_network_updated" => array("hide", "network(4)", "updated"),
949 "updated" => array("updated"),
952 $database["glink"] = array(
954 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
955 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
956 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
957 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
958 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
959 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
962 "PRIMARY" => array("id"),
963 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
964 "gcid" => array("gcid"),
967 $database["group"] = array(
969 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
970 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
971 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
972 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
973 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
976 "PRIMARY" => array("id"),
977 "uid" => array("uid"),
980 $database["group_member"] = array(
982 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
983 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
984 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("group" => "id")),
985 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
988 "PRIMARY" => array("id"),
989 "contactid" => array("contact-id"),
990 "gid_contactid" => array("gid", "contact-id"),
991 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
994 $database["gserver"] = array(
996 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
997 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
998 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
999 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1000 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1001 "info" => array("type" => "text"),
1002 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1003 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1004 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1005 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1006 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1007 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1008 "last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
1009 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
1010 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
1013 "PRIMARY" => array("id"),
1014 "nurl" => array("UNIQUE", "nurl(190)"),
1017 $database["hook"] = array(
1019 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1020 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1021 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1022 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1023 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1026 "PRIMARY" => array("id"),
1027 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
1030 $database["intro"] = array(
1032 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1033 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1034 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("fcontact" => "id")),
1035 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1036 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1037 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1038 "note" => array("type" => "text"),
1039 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1040 "datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1041 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1042 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1045 "PRIMARY" => array("id"),
1048 $database["item"] = array(
1050 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "relation" => array("thread" => "iid")),
1051 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1052 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1053 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1054 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1055 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1056 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1057 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1058 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1059 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1060 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1061 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1062 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1063 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1064 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1065 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1066 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1067 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1068 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1069 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1070 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1071 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1072 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1073 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1074 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1075 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1076 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1077 "body" => array("type" => "mediumtext"),
1078 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1079 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1080 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1081 "object" => array("type" => "text"),
1082 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1083 "target" => array("type" => "text"),
1084 "postopts" => array("type" => "text"),
1085 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1086 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1087 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("event" => "id")),
1088 "tag" => array("type" => "mediumtext"),
1089 "attach" => array("type" => "mediumtext"),
1090 "inform" => array("type" => "mediumtext"),
1091 "file" => array("type" => "mediumtext"),
1092 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1093 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1094 "allow_cid" => array("type" => "mediumtext"),
1095 "allow_gid" => array("type" => "mediumtext"),
1096 "deny_cid" => array("type" => "mediumtext"),
1097 "deny_gid" => array("type" => "mediumtext"),
1098 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1099 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1100 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1101 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1102 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1103 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1104 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1105 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1106 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1107 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1108 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1109 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1110 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1111 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1112 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1113 "rendered-html" => array("type" => "mediumtext"),
1114 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1117 "PRIMARY" => array("id"),
1118 "guid" => array("guid(191)"),
1119 "uri" => array("uri(191)"),
1120 "parent" => array("parent"),
1121 "parent-uri" => array("parent-uri(191)"),
1122 "extid" => array("extid(191)"),
1123 "uid_id" => array("uid","id"),
1124 "uid_contactid_id" => array("uid","contact-id","id"),
1125 "uid_created" => array("uid","created"),
1126 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1127 "uid_network_received" => array("uid","network(4)","received"),
1128 "uid_network_commented" => array("uid","network(4)","commented"),
1129 "uid_thrparent" => array("uid","thr-parent(190)"),
1130 "uid_parenturi" => array("uid","parent-uri(190)"),
1131 "uid_contactid_created" => array("uid","contact-id","created"),
1132 "authorid_created" => array("author-id","created"),
1133 "ownerid" => array("owner-id"),
1134 "uid_uri" => array("uid", "uri(190)"),
1135 "resource-id" => array("resource-id(191)"),
1136 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1137 "uid_type_changed" => array("uid","type(190)","changed"),
1138 "contactid_verb" => array("contact-id","verb(190)"),
1139 "deleted_changed" => array("deleted","changed"),
1140 "uid_wall_changed" => array("uid","wall","changed"),
1141 "uid_eventid" => array("uid","event-id"),
1142 "uid_authorlink" => array("uid","author-link(190)"),
1143 "uid_ownerlink" => array("uid","owner-link(190)"),
1146 $database["locks"] = array(
1148 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1149 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1150 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1151 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1154 "PRIMARY" => array("id"),
1157 $database["mail"] = array(
1159 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1160 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1161 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1162 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1163 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1164 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1165 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => array("contact" => "id")),
1166 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("conv" => "id")),
1167 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1168 "body" => array("type" => "mediumtext"),
1169 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1170 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1171 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1172 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1173 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1174 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1175 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1178 "PRIMARY" => array("id"),
1179 "uid_seen" => array("uid", "seen"),
1180 "convid" => array("convid"),
1181 "uri" => array("uri(64)"),
1182 "parent-uri" => array("parent-uri(64)"),
1183 "contactid" => array("contact-id(32)"),
1186 $database["mailacct"] = array(
1188 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1189 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1190 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1191 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1192 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1193 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1194 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1195 "pass" => array("type" => "text"),
1196 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1197 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1198 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1199 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1200 "last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1203 "PRIMARY" => array("id"),
1206 $database["manage"] = 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 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1213 "PRIMARY" => array("id"),
1214 "uid_mid" => array("UNIQUE", "uid","mid"),
1217 $database["notify"] = array(
1219 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1220 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1221 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1222 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1223 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1224 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1225 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1226 "msg" => array("type" => "mediumtext"),
1227 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1228 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1229 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1230 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1231 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1232 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1233 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1234 "name_cache" => array("type" => "tinytext"),
1235 "msg_cache" => array("type" => "mediumtext")
1238 "PRIMARY" => array("id"),
1239 "hash_uid" => array("hash", "uid"),
1240 "seen_uid_date" => array("seen", "uid", "date"),
1241 "uid_date" => array("uid", "date"),
1242 "uid_type_link" => array("uid", "type", "link(190)"),
1245 $database["notify-threads"] = array(
1247 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1248 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("notify" => "id")),
1249 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1250 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1251 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1254 "PRIMARY" => array("id"),
1257 $database["oembed"] = array(
1259 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1260 "content" => array("type" => "mediumtext"),
1261 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1264 "PRIMARY" => array("url"),
1265 "created" => array("created"),
1268 $database["parsed_url"] = array(
1270 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1271 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1272 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1273 "content" => array("type" => "mediumtext"),
1274 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1277 "PRIMARY" => array("url", "guessing", "oembed"),
1278 "created" => array("created"),
1281 $database["pconfig"] = array(
1283 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1284 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1285 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1286 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1287 "v" => array("type" => "mediumtext"),
1290 "PRIMARY" => array("id"),
1291 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1294 $database["photo"] = array(
1296 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1297 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1298 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1299 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1300 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1301 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1302 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1303 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1304 "desc" => array("type" => "text"),
1305 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1306 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1307 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1308 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1309 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1310 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1311 "data" => array("type" => "mediumblob", "not null" => "1"),
1312 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1313 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1314 "allow_cid" => array("type" => "mediumtext"),
1315 "allow_gid" => array("type" => "mediumtext"),
1316 "deny_cid" => array("type" => "mediumtext"),
1317 "deny_gid" => array("type" => "mediumtext"),
1320 "PRIMARY" => array("id"),
1321 "contactid" => array("contact-id"),
1322 "uid_contactid" => array("uid", "contact-id"),
1323 "uid_profile" => array("uid", "profile"),
1324 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1325 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1326 "resource-id" => array("resource-id(64)"),
1329 $database["poll"] = array(
1331 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1332 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1333 "q0" => array("type" => "text"),
1334 "q1" => array("type" => "text"),
1335 "q2" => array("type" => "text"),
1336 "q3" => array("type" => "text"),
1337 "q4" => array("type" => "text"),
1338 "q5" => array("type" => "text"),
1339 "q6" => array("type" => "text"),
1340 "q7" => array("type" => "text"),
1341 "q8" => array("type" => "text"),
1342 "q9" => array("type" => "text"),
1345 "PRIMARY" => array("id"),
1346 "uid" => array("uid"),
1349 $database["poll_result"] = array(
1351 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1352 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("poll" => "id")),
1353 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1356 "PRIMARY" => array("id"),
1357 "poll_id" => array("poll_id"),
1358 "choice" => array("choice"),
1361 $database["process"] = array(
1363 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1364 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1365 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1368 "PRIMARY" => array("pid"),
1369 "command" => array("command"),
1372 $database["profile"] = array(
1374 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1375 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1376 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1377 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1378 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1379 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1380 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1381 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
1382 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1383 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1384 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1385 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1386 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1387 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1388 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1389 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1390 "with" => array("type" => "text"),
1391 "howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1392 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1393 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1394 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1395 "pub_keywords" => array("type" => "text"),
1396 "prv_keywords" => array("type" => "text"),
1397 "likes" => array("type" => "text"),
1398 "dislikes" => array("type" => "text"),
1399 "about" => array("type" => "text"),
1400 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1401 "music" => array("type" => "text"),
1402 "book" => array("type" => "text"),
1403 "tv" => array("type" => "text"),
1404 "film" => array("type" => "text"),
1405 "interest" => array("type" => "text"),
1406 "romance" => array("type" => "text"),
1407 "work" => array("type" => "text"),
1408 "education" => array("type" => "text"),
1409 "contact" => array("type" => "text"),
1410 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1411 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1412 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1413 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1414 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1415 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1418 "PRIMARY" => array("id"),
1419 "uid_is-default" => array("uid", "is-default"),
1422 $database["profile_check"] = array(
1424 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1425 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1426 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1427 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1428 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1429 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1432 "PRIMARY" => array("id"),
1435 $database["push_subscriber"] = array(
1437 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1438 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1439 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1440 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1441 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1442 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1443 "last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1444 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1447 "PRIMARY" => array("id"),
1450 $database["queue"] = array(
1452 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1453 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1454 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1455 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1456 "last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1457 "content" => array("type" => "mediumtext"),
1458 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1461 "PRIMARY" => array("id"),
1462 "cid" => array("cid"),
1463 "created" => array("created"),
1464 "last" => array("last"),
1465 "network" => array("network"),
1466 "batch" => array("batch"),
1469 $database["register"] = array(
1471 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1472 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1473 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1474 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1475 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1476 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1477 "note" => array("type" => "text"),
1480 "PRIMARY" => array("id"),
1483 $database["search"] = array(
1485 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1486 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1487 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1490 "PRIMARY" => array("id"),
1491 "uid" => array("uid"),
1494 $database["session"] = array(
1496 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1497 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1498 "data" => array("type" => "text"),
1499 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1502 "PRIMARY" => array("id"),
1503 "sid" => array("sid(64)"),
1504 "expire" => array("expire"),
1507 $database["sign"] = array(
1509 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1510 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1511 "signed_text" => array("type" => "mediumtext"),
1512 "signature" => array("type" => "text"),
1513 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1516 "PRIMARY" => array("id"),
1517 "iid" => array("UNIQUE", "iid"),
1520 $database["term"] = array(
1522 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1523 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1524 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1525 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1526 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1527 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1528 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1529 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1530 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1531 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1532 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1533 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1536 "PRIMARY" => array("tid"),
1537 "oid_otype_type_term" => array("oid","otype","type","term(32)"),
1538 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1539 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1540 "guid" => array("guid(64)"),
1543 $database["thread"] = array(
1545 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => array("item" => "id")),
1546 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1547 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1548 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1549 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1550 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1551 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1552 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1553 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1554 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1555 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1556 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1557 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1558 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1559 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1560 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1561 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1562 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1563 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1564 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1565 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1566 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1567 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1568 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1569 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1570 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1573 "PRIMARY" => array("iid"),
1574 "uid_network_commented" => array("uid","network","commented"),
1575 "uid_network_created" => array("uid","network","created"),
1576 "uid_contactid_commented" => array("uid","contact-id","commented"),
1577 "uid_contactid_created" => array("uid","contact-id","created"),
1578 "contactid" => array("contact-id"),
1579 "ownerid" => array("owner-id"),
1580 "authorid" => array("author-id"),
1581 "uid_created" => array("uid","created"),
1582 "uid_commented" => array("uid","commented"),
1583 "uid_wall_created" => array("uid","wall","created"),
1584 "private_wall_received" => array("private","wall","received"),
1587 $database["tokens"] = array(
1589 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1590 "secret" => array("type" => "text"),
1591 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
1592 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1593 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1594 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1597 "PRIMARY" => array("id"),
1600 $database["user"] = array(
1602 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1603 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1604 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1605 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1606 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1607 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1608 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1609 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1610 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1611 "register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1612 "login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1613 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1614 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1615 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1616 "pubkey" => array("type" => "text"),
1617 "prvkey" => array("type" => "text"),
1618 "spubkey" => array("type" => "text"),
1619 "sprvkey" => array("type" => "text"),
1620 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1621 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1622 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1623 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1624 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1625 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1626 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1627 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1628 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1629 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1630 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1631 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1632 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1633 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1634 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1635 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1636 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1637 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1638 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1639 "allow_cid" => array("type" => "mediumtext"),
1640 "allow_gid" => array("type" => "mediumtext"),
1641 "deny_cid" => array("type" => "mediumtext"),
1642 "deny_gid" => array("type" => "mediumtext"),
1643 "openidserver" => array("type" => "text"),
1646 "PRIMARY" => array("uid"),
1647 "nickname" => array("nickname(32)"),
1650 $database["userd"] = array(
1652 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1653 "username" => array("type" => "varchar(255)", "not null" => "1"),
1656 "PRIMARY" => array("id"),
1657 "username" => array("username(32)"),
1660 $database["workerqueue"] = array(
1662 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1663 "parameter" => array("type" => "text"),
1664 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1665 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1666 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1667 "executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1668 "done" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1671 "PRIMARY" => array("id"),
1672 "pid" => array("pid"),
1673 "parameter" => array("parameter(64)"),
1674 "priority_created" => array("priority", "created"),
1675 "executed" => array("executed"),