3 * @file src/Database/DBStructure.php
5 namespace Friendica\Database;
7 use Friendica\Core\Config;
8 use Friendica\Core\L10n;
9 use Friendica\Database\DBM;
12 require_once 'boot.php';
13 require_once 'include/dba.php';
14 require_once 'include/enotify.php';
15 require_once 'include/text.php';
18 * @brief This class contain functions for the database management
20 * This class contains functions that doesn't need to know if pdo, mysqli or whatever is used.
25 * Converts all tables from MyISAM to InnoDB
27 public static function convertToInnoDB() {
28 $r = q("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `engine` = 'MyISAM' AND `table_schema` = '%s'",
29 dbesc(dba::database_name()));
31 if (!DBM::is_result($r)) {
32 echo L10n::t('There are no tables on MyISAM.')."\n";
36 foreach ($r AS $table) {
37 $sql = sprintf("ALTER TABLE `%s` engine=InnoDB;", dbesc($table['TABLE_NAME']));
40 $result = dba::e($sql);
41 if (!DBM::is_result($result)) {
42 self::printUpdateError($sql);
48 * send the email and do what is needed to do on update fails
50 * @param update_id (int) number of failed update
51 * @param error_message (str) error message
53 public static function updateFail($update_id, $error_message) {
56 //send the administrators an e-mail
57 $admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
58 $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
63 if (!DBM::is_result($adminlist)) {
64 logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_NORMAL);
70 // every admin could had different language
71 foreach ($adminlist as $admin) {
72 $lang = (($admin['language'])?$admin['language']:'en');
73 L10n::pushLang($lang);
75 $preamble = deindent(L10n::t("
76 The friendica developers released update %s recently,
77 but when I tried to install it, something went terribly wrong.
78 This needs to be fixed soon and I can't do it alone. Please contact a
79 friendica developer if you can not help me on your own. My database might be invalid."));
80 $body = L10n::t("The error message is\n[pre]%s[/pre]");
81 $preamble = sprintf($preamble, $update_id);
82 $body = sprintf($body, $error_message);
85 'type' => SYSTEM_EMAIL,
86 'to_email' => $admin['email'],
87 'preamble' => $preamble,
94 logger("CRITICAL: Database structure update failed: ".$error_message);
98 private static function tableStructure($table) {
99 $structures = q("DESCRIBE `%s`", $table);
101 $full_columns = q("SHOW FULL COLUMNS FROM `%s`", $table);
103 $indexes = q("SHOW INDEX FROM `%s`", $table);
105 $table_status = q("SHOW TABLE STATUS WHERE `name` = '%s'", $table);
107 if (DBM::is_result($table_status)) {
108 $table_status = $table_status[0];
116 if (DBM::is_result($indexes)) {
117 foreach ($indexes AS $index) {
118 if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
119 $indexdata[$index["Key_name"]] = ['UNIQUE'];
122 $column = $index["Column_name"];
124 if ($index["Sub_part"] != "") {
125 $column .= "(".$index["Sub_part"].")";
128 $indexdata[$index["Key_name"]][] = $column;
131 if (DBM::is_result($structures)) {
132 foreach ($structures AS $field) {
133 // Replace the default size values so that we don't have to define them
134 $search = ['tinyint(1)', 'tinyint(4)', 'smallint(5) unsigned', 'smallint(6)', 'mediumint(9)', 'bigint(20)', 'int(11)'];
135 $replace = ['boolean', 'tinyint', 'smallint unsigned', 'smallint', 'mediumint', 'bigint', 'int'];
136 $field["Type"] = str_replace($search, $replace, $field["Type"]);
138 $fielddata[$field["Field"]]["type"] = $field["Type"];
139 if ($field["Null"] == "NO") {
140 $fielddata[$field["Field"]]["not null"] = true;
143 if (isset($field["Default"])) {
144 $fielddata[$field["Field"]]["default"] = $field["Default"];
147 if ($field["Extra"] != "") {
148 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
151 if ($field["Key"] == "PRI") {
152 $fielddata[$field["Field"]]["primary"] = true;
156 if (DBM::is_result($full_columns)) {
157 foreach ($full_columns AS $column) {
158 $fielddata[$column["Field"]]["Collation"] = $column["Collation"];
159 $fielddata[$column["Field"]]["comment"] = $column["Comment"];
163 return ["fields" => $fielddata, "indexes" => $indexdata, "table_status" => $table_status];
166 public static function printStructure() {
167 $database = self::definition();
169 echo "-- ------------------------------------------\n";
170 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
171 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
172 echo "-- ------------------------------------------\n\n\n";
173 foreach ($database AS $name => $structure) {
175 echo "-- TABLE $name\n";
177 self::createTable($name, $structure['fields'], true, false, $structure["indexes"]);
184 * @brief Print out database error messages
186 * @param string $message Message to be added to the error message
188 * @return string Error message
190 private static function printUpdateError($message) {
191 echo L10n::t("\nError %d occurred during database update:\n%s\n",
192 dba::errorNo(), dba::errorMessage());
194 return L10n::t('Errors encountered performing database changes: ').$message.EOL;
198 * Updates DB structure and returns eventual errors messages
200 * @param bool $verbose
201 * @param bool $action Whether to actually apply the update
202 * @param array $tables An array of the database tables
203 * @param array $definition An array of the definition tables
204 * @return string Empty string if the update is successful, error messages otherwise
206 public static function update($verbose, $action, array $tables = null, array $definition = null) {
208 Config::set('system', 'maintenance', 1);
209 Config::set('system', 'maintenance_reason', L10n::t(': Database update', DBM::date().' '.date('e')));
214 logger('updating structure', LOGGER_DEBUG);
216 // Get the current structure
219 if (is_null($tables)) {
220 $tables = q("SHOW TABLES");
223 if (DBM::is_result($tables)) {
224 foreach ($tables AS $table) {
225 $table = current($table);
227 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
228 $database[$table] = self::tableStructure($table);
232 // Get the definition
233 if (is_null($definition)) {
234 $definition = self::definition();
237 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
238 if ((version_compare(dba::server_info(), '5.7.4') >= 0) &&
239 !(strpos(dba::server_info(), 'MariaDB') !== false)) {
246 foreach ($definition AS $name => $structure) {
247 $is_new_table = False;
250 if (!isset($database[$name])) {
251 $r = self::createTable($name, $structure["fields"], $verbose, $action, $structure['indexes']);
252 if (!DBM::is_result($r)) {
253 $errors .= self::printUpdateError($name);
255 $is_new_table = True;
260 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
261 if (isset($database[$name]["indexes"][$indexname])) {
262 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
264 $current_index_definition = "__NOT_SET__";
266 $new_index_definition = implode(",",$fieldnames);
267 if ($current_index_definition != $new_index_definition) {
268 if ($fieldnames[0] == "UNIQUE") {
271 $temp_name = "temp-".$name;
278 * Drop the index if it isn't present in the definition
279 * or the definition differ from current status
280 * and index name doesn't start with "local_"
282 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
283 $current_index_definition = implode(",",$fieldnames);
284 if (isset($structure["indexes"][$indexname])) {
285 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
287 $new_index_definition = "__NOT_SET__";
289 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
290 $sql2=self::dropIndex($indexname);
292 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
298 // Compare the field structure field by field
299 foreach ($structure["fields"] AS $fieldname => $parameters) {
300 if (!isset($database[$name]["fields"][$fieldname])) {
301 $sql2=self::addTableField($fieldname, $parameters);
303 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
308 // Compare the field definition
309 $field_definition = $database[$name]["fields"][$fieldname];
311 // Remove the relation data that is used for the referential integrity
312 unset($parameters['relation']);
314 // We change the collation after the indexes had been changed.
315 // This is done to avoid index length problems.
316 // So here we always ensure that there is no need to change it.
317 unset($parameters['Collation']);
318 unset($field_definition['Collation']);
320 // Only update the comment when it is defined
321 if (!isset($parameters['comment'])) {
322 $parameters['comment'] = "";
325 $current_field_definition = implode(",", $field_definition);
326 $new_field_definition = implode(",", $parameters);
327 if ($current_field_definition != $new_field_definition) {
328 $sql2 = self::modifyTableField($fieldname, $parameters);
330 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
340 * Create the index if the index don't exists in database
341 * or the definition differ from the current status.
342 * Don't create keys if table is new
344 if (!$is_new_table) {
345 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
346 if (isset($database[$name]["indexes"][$indexname])) {
347 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
349 $current_index_definition = "__NOT_SET__";
351 $new_index_definition = implode(",",$fieldnames);
352 if ($current_index_definition != $new_index_definition) {
353 $sql2 = self::createIndex($indexname, $fieldnames);
355 // Fetch the "group by" fields for unique indexes
356 if ($fieldnames[0] == "UNIQUE") {
357 $group_by = self::groupBy($indexname, $fieldnames);
361 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
369 if (isset($database[$name]["table_status"]["Comment"])) {
370 if ($database[$name]["table_status"]["Comment"] != $structure['comment']) {
371 $sql2 = "COMMENT = '".dbesc($structure['comment'])."'";
374 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
381 if (isset($database[$name]["table_status"]["Collation"])) {
382 if ($database[$name]["table_status"]["Collation"] != 'utf8mb4_general_ci') {
383 $sql2 = "DEFAULT COLLATE utf8mb4_general_ci";
386 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
397 // Now have a look at the field collations
398 // Compare the field structure field by field
399 foreach ($structure["fields"] AS $fieldname => $parameters) {
400 // Compare the field definition
401 $field_definition = $database[$name]["fields"][$fieldname];
403 // Define the default collation if not given
404 if (!isset($parameters['Collation']) && !is_null($field_definition['Collation'])) {
405 $parameters['Collation'] = 'utf8mb4_general_ci';
407 $parameters['Collation'] = null;
410 if ($field_definition['Collation'] != $parameters['Collation']) {
411 $sql2 = self::modifyTableField($fieldname, $parameters);
412 if (($sql3 == "") || (substr($sql3, -2, 2) == "; ")) {
413 $sql3 .= "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
422 if (substr($sql3, -2, 2) != "; ") {
427 if ($is_unique && $ignore == '') {
428 foreach ($database[$name]["fields"] AS $fieldname => $parameters) {
429 $field_list .= 'ANY_VALUE(`' . $fieldname . '`),';
431 $field_list = rtrim($field_list, ',');
435 // Ensure index conversion to unique removes duplicates
436 if ($is_unique && ($temp_name != $name)) {
438 echo "SET session old_alter_table=1;\n";
440 echo "DROP TABLE IF EXISTS `".$temp_name."`;\n";
441 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
447 if ($is_unique && ($temp_name != $name)) {
449 echo "SET session old_alter_table=0;\n";
451 echo "INSERT INTO `".$temp_name."` SELECT ".dba::any_value_fallback($field_list)." FROM `".$name."`".$group_by.";\n";
452 echo "DROP TABLE `".$name."`;\n";
453 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
459 Config::set('system', 'maintenance_reason', L10n::t('%s: updating %s table.', DBM::date().' '.date('e'), $name));
461 // Ensure index conversion to unique removes duplicates
462 if ($is_unique && ($temp_name != $name)) {
464 dba::e("SET session old_alter_table=1;");
466 dba::e("DROP TABLE IF EXISTS `".$temp_name."`;");
467 if (!DBM::is_result($r)) {
468 $errors .= self::printUpdateError($sql3);
472 $r = dba::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
473 if (!DBM::is_result($r)) {
474 $errors .= self::printUpdateError($sql3);
481 if (!DBM::is_result($r)) {
482 $errors .= self::printUpdateError($sql3);
484 if ($is_unique && ($temp_name != $name)) {
486 dba::e("SET session old_alter_table=0;");
488 $r = dba::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
489 if (!DBM::is_result($r)) {
490 $errors .= self::printUpdateError($sql3);
493 $r = dba::e("DROP TABLE `".$name."`;");
494 if (!DBM::is_result($r)) {
495 $errors .= self::printUpdateError($sql3);
498 $r = dba::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
499 if (!DBM::is_result($r)) {
500 $errors .= self::printUpdateError($sql3);
510 Config::set('system', 'maintenance', 0);
511 Config::set('system', 'maintenance_reason', '');
515 Config::set('system', 'dbupdate', DB_UPDATE_FAILED);
517 Config::set('system', 'dbupdate', DB_UPDATE_SUCCESSFUL);
523 private static function FieldCommand($parameters, $create = true) {
524 $fieldstruct = $parameters["type"];
526 if (!is_null($parameters["Collation"])) {
527 $fieldstruct .= " COLLATE ".$parameters["Collation"];
530 if ($parameters["not null"]) {
531 $fieldstruct .= " NOT NULL";
534 if (isset($parameters["default"])) {
535 if (strpos(strtolower($parameters["type"]),"int")!==false) {
536 $fieldstruct .= " DEFAULT ".$parameters["default"];
538 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
541 if ($parameters["extra"] != "") {
542 $fieldstruct .= " ".$parameters["extra"];
545 if (!is_null($parameters["comment"])) {
546 $fieldstruct .= " COMMENT '".dbesc($parameters["comment"])."'";
549 /*if (($parameters["primary"] != "") && $create)
550 $fieldstruct .= " PRIMARY KEY";*/
552 return($fieldstruct);
555 private static function createTable($name, $fields, $verbose, $action, $indexes=null) {
560 foreach ($fields AS $fieldname => $field) {
561 $sql_rows[] = "`".dbesc($fieldname)."` ".self::FieldCommand($field);
562 if (x($field,'primary') && $field['primary']!='') {
563 $primary_keys[] = $fieldname;
567 if (!is_null($indexes)) {
568 foreach ($indexes AS $indexname => $fieldnames) {
569 $sql_index = self::createIndex($indexname, $fieldnames, "");
570 if (!is_null($sql_index)) {
571 $sql_rows[] = $sql_index;
576 $sql = implode(",\n\t", $sql_rows);
578 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT COLLATE utf8mb4_general_ci";
590 private static function addTableField($fieldname, $parameters) {
591 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), self::FieldCommand($parameters));
595 private static function modifyTableField($fieldname, $parameters) {
596 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), self::FieldCommand($parameters, false));
600 private static function dropIndex($indexname) {
601 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
605 private static function createIndex($indexname, $fieldnames, $method = "ADD") {
606 $method = strtoupper(trim($method));
607 if ($method!="" && $method!="ADD") {
608 throw new \Exception("Invalid parameter 'method' in self::createIndex(): '$method'");
611 if ($fieldnames[0] == "UNIQUE") {
612 array_shift($fieldnames);
613 $method .= ' UNIQUE';
617 foreach ($fieldnames AS $fieldname) {
622 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
623 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
625 $names .= "`".dbesc($fieldname)."`";
629 if ($indexname == "PRIMARY") {
630 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
634 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
638 private static function groupBy($indexname, $fieldnames) {
639 if ($fieldnames[0] != "UNIQUE") {
643 array_shift($fieldnames);
646 foreach ($fieldnames AS $fieldname) {
651 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
652 $names .= "`".dbesc($matches[1])."`";
654 $names .= "`".dbesc($fieldname)."`";
658 $sql = sprintf(" GROUP BY %s", $names);
662 public static function definition() {
665 $database["addon"] = [
666 "comment" => "registered addons",
668 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
669 "name" => ["type" => "varchar(190)", "not null" => "1", "default" => "", "comment" => ""],
670 "version" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
671 "installed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
672 "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
673 "timestamp" => ["type" => "bigint", "not null" => "1", "default" => "0", "comment" => ""],
674 "plugin_admin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
678 "name" => ["UNIQUE", "name"],
681 $database["attach"] = [
682 "comment" => "file attachments",
684 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
685 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
686 "hash" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => ""],
687 "filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
688 "filetype" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => ""],
689 "filesize" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
690 "data" => ["type" => "longblob", "not null" => "1", "comment" => ""],
691 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
692 "edited" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
693 "allow_cid" => ["type" => "mediumtext", "comment" => ""],
694 "allow_gid" => ["type" => "mediumtext", "comment" => ""],
695 "deny_cid" => ["type" => "mediumtext", "comment" => ""],
696 "deny_gid" => ["type" => "mediumtext", "comment" => ""],
702 $database["auth_codes"] = [
703 "comment" => "OAuth usage",
705 "id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
706 "client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => ["clients" => "client_id"], "comment" => ""],
707 "redirect_uri" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
708 "expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
709 "scope" => ["type" => "varchar(250)", "not null" => "1", "default" => "", "comment" => ""],
715 $database["cache"] = [
716 "comment" => "Used to store different data that doesn't to be stored for a long time",
718 "k" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => ""],
719 "v" => ["type" => "mediumtext", "comment" => ""],
720 "expire_mode" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
721 "updated" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
725 "expire_mode_updated" => ["expire_mode", "updated"],
728 $database["challenge"] = [
731 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
732 "challenge" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
733 "dfrn-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
734 "expire" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
735 "type" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
736 "last_update" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
742 $database["clients"] = [
743 "comment" => "OAuth usage",
745 "client_id" => ["type" => "varchar(20)", "not null" => "1", "primary" => "1", "comment" => ""],
746 "pw" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "comment" => ""],
747 "redirect_uri" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
748 "name" => ["type" => "text", "comment" => ""],
749 "icon" => ["type" => "text", "comment" => ""],
750 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
753 "PRIMARY" => ["client_id"],
756 $database["config"] = [
757 "comment" => "main configuration storage",
759 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
760 "cat" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
761 "k" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
762 "v" => ["type" => "mediumtext", "comment" => ""],
766 "cat_k" => ["UNIQUE", "cat", "k"],
769 $database["contact"] = [
770 "comment" => "contact table",
772 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
773 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
774 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
775 "self" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
776 "remote_self" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
777 "rel" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
778 "duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
779 "network" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
780 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
781 "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
782 "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
783 "about" => ["type" => "text", "comment" => ""],
784 "keywords" => ["type" => "text", "comment" => ""],
785 "gender" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
786 "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
787 "attag" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
788 "avatar" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
789 "photo" => ["type" => "text", "comment" => ""],
790 "thumb" => ["type" => "text", "comment" => ""],
791 "micro" => ["type" => "text", "comment" => ""],
792 "site-pubkey" => ["type" => "text", "comment" => ""],
793 "issued-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
794 "dfrn-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
795 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
796 "nurl" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
797 "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
798 "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
799 "pubkey" => ["type" => "text", "comment" => ""],
800 "prvkey" => ["type" => "text", "comment" => ""],
801 "batch" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
802 "request" => ["type" => "text", "comment" => ""],
803 "notify" => ["type" => "text", "comment" => ""],
804 "poll" => ["type" => "text", "comment" => ""],
805 "confirm" => ["type" => "text", "comment" => ""],
806 "poco" => ["type" => "text", "comment" => ""],
807 "aes_allow" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
808 "ret-aes" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
809 "usehub" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
810 "subhub" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
811 "hub-verify" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
812 "last-update" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
813 "success_update" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
814 "failure_update" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
815 "name-date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
816 "uri-date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
817 "avatar-date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
818 "term-date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
819 "last-item" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
820 "priority" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
821 "blocked" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
822 "readonly" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
823 "writable" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
824 "forum" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
825 "prv" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
826 "contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
827 "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
828 "archive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
829 "pending" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
830 "rating" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
831 "reason" => ["type" => "text", "comment" => ""],
832 "closeness" => ["type" => "tinyint", "not null" => "1", "default" => "99", "comment" => ""],
833 "info" => ["type" => "mediumtext", "comment" => ""],
834 "profile-id" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
835 "bdyear" => ["type" => "varchar(4)", "not null" => "1", "default" => "", "comment" => ""],
836 "bd" => ["type" => "date", "not null" => "1", "default" => "0001-01-01", "comment" => ""],
837 "notify_new_posts" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
838 "fetch_further_information" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
839 "ffi_keyword_blacklist" => ["type" => "text", "comment" => ""],
843 "uid_name" => ["uid", "name(190)"],
844 "self_uid" => ["self", "uid"],
845 "alias_uid" => ["alias(32)", "uid"],
846 "pending_uid" => ["pending", "uid"],
847 "blocked_uid" => ["blocked", "uid"],
848 "uid_rel_network_poll" => ["uid", "rel", "network(4)", "poll(64)", "archive"],
849 "uid_network_batch" => ["uid", "network(4)", "batch(64)"],
850 "addr_uid" => ["addr(32)", "uid"],
851 "nurl_uid" => ["nurl(32)", "uid"],
852 "nick_uid" => ["nick(32)", "uid"],
853 "dfrn-id" => ["dfrn-id(64)"],
854 "issued-id" => ["issued-id(64)"],
857 $database["conv"] = [
858 "comment" => "private messages",
860 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
861 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
862 "recips" => ["type" => "text", "comment" => ""],
863 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
864 "creator" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
865 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
866 "updated" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
867 "subject" => ["type" => "text", "comment" => ""],
874 $database["conversation"] = [
875 "comment" => "Raw data and structure information for messages",
877 "item-uri" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => ""],
878 "reply-to-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
879 "conversation-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
880 "conversation-href" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
881 "protocol" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
882 "source" => ["type" => "mediumtext", "comment" => ""],
883 "received" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
886 "PRIMARY" => ["item-uri"],
887 "conversation-uri" => ["conversation-uri"],
888 "received" => ["received"],
891 $database["event"] = [
892 "comment" => "Events",
894 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
895 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
896 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
897 "cid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
898 "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
899 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
900 "edited" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
901 "start" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
902 "finish" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
903 "summary" => ["type" => "text", "comment" => ""],
904 "desc" => ["type" => "text", "comment" => ""],
905 "location" => ["type" => "text", "comment" => ""],
906 "type" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
907 "nofinish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
908 "adjust" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
909 "ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
910 "allow_cid" => ["type" => "mediumtext", "comment" => ""],
911 "allow_gid" => ["type" => "mediumtext", "comment" => ""],
912 "deny_cid" => ["type" => "mediumtext", "comment" => ""],
913 "deny_gid" => ["type" => "mediumtext", "comment" => ""],
917 "uid_start" => ["uid", "start"],
920 $database["fcontact"] = [
921 "comment" => "Diaspora compatible contacts - used in the Diaspora implementation",
923 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
924 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
925 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
926 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
927 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
928 "request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
929 "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
930 "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
931 "batch" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
932 "notify" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
933 "poll" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
934 "confirm" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
935 "priority" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
936 "network" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
937 "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
938 "pubkey" => ["type" => "text", "comment" => ""],
939 "updated" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
943 "addr" => ["addr(32)"],
944 "url" => ["UNIQUE", "url(190)"],
947 $database["fsuggest"] = [
948 "comment" => "friend suggestion stuff",
950 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
951 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
952 "cid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
953 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
954 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
955 "request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
956 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
957 "note" => ["type" => "text", "comment" => ""],
958 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
964 $database["gcign"] = [
965 "comment" => "contacts ignored by friend suggestions",
967 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
968 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
969 "gcid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["gcontact" => "id"], "comment" => ""],
977 $database["gcontact"] = [
978 "comment" => "global contacts",
980 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
981 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
982 "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
983 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
984 "nurl" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
985 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
986 "connect" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
987 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
988 "updated" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
989 "last_contact" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
990 "last_failure" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
991 "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
992 "about" => ["type" => "text", "comment" => ""],
993 "keywords" => ["type" => "text", "comment" => ""],
994 "gender" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
995 "birthday" => ["type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01", "comment" => ""],
996 "community" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
997 "contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "-1", "comment" => ""],
998 "hide" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
999 "nsfw" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1000 "network" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1001 "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1002 "notify" => ["type" => "text", "comment" => ""],
1003 "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1004 "generation" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1005 "server_url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1008 "PRIMARY" => ["id"],
1009 "nurl" => ["UNIQUE", "nurl(190)"],
1010 "name" => ["name(64)"],
1011 "nick" => ["nick(32)"],
1012 "addr" => ["addr(64)"],
1013 "hide_network_updated" => ["hide", "network(4)", "updated"],
1014 "updated" => ["updated"],
1017 $database["glink"] = [
1018 "comment" => "'friends of friends' linkages derived from poco",
1020 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1021 "cid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1022 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1023 "gcid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["gcontact" => "id"], "comment" => ""],
1024 "zcid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["gcontact" => "id"], "comment" => ""],
1025 "updated" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1028 "PRIMARY" => ["id"],
1029 "cid_uid_gcid_zcid" => ["UNIQUE", "cid","uid","gcid","zcid"],
1033 $database["group"] = [
1034 "comment" => "privacy groups, group info",
1036 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1037 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1038 "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1039 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1040 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1043 "PRIMARY" => ["id"],
1047 $database["group_member"] = [
1048 "comment" => "privacy groups, member info",
1050 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1051 "gid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["group" => "id"], "comment" => ""],
1052 "contact-id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1055 "PRIMARY" => ["id"],
1056 "contactid" => ["contact-id"],
1057 "gid_contactid" => ["UNIQUE", "gid", "contact-id"],
1060 $database["gserver"] = [
1061 "comment" => "Global servers",
1063 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1064 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1065 "nurl" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1066 "version" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1067 "site_name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1068 "info" => ["type" => "text", "comment" => ""],
1069 "register_policy" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1070 "registered-users" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1071 "poco" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1072 "noscrape" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1073 "network" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1074 "platform" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1075 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1076 "last_poco_query" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
1077 "last_contact" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
1078 "last_failure" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
1081 "PRIMARY" => ["id"],
1082 "nurl" => ["UNIQUE", "nurl(190)"],
1085 $database["hook"] = [
1086 "comment" => "addon hook registry",
1088 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1089 "hook" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1090 "file" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1091 "function" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1092 "priority" => ["type" => "smallint", "not null" => "1", "default" => "0", "comment" => ""],
1095 "PRIMARY" => ["id"],
1096 "hook_file_function" => ["UNIQUE", "hook(50)","file(80)","function(60)"],
1099 $database["intro"] = [
1102 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1103 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1104 "fid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["fcontact" => "id"], "comment" => ""],
1105 "contact-id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1106 "knowyou" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1107 "duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1108 "note" => ["type" => "text", "comment" => ""],
1109 "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1110 "datetime" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1111 "blocked" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
1112 "ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1115 "PRIMARY" => ["id"],
1118 $database["item"] = [
1119 "comment" => "All posts",
1121 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "relation" => ["thread" => "iid"]],
1122 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1123 "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1124 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1125 "contact-id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1126 "gcontact-id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["gcontact" => "id"], "comment" => ""],
1127 "type" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1128 "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1129 "gravity" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1130 "parent" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
1131 "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1132 "extid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1133 "thr-parent" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1134 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1135 "edited" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1136 "commented" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1137 "received" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1138 "changed" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1139 "owner-id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1140 "owner-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1141 "owner-link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1142 "owner-avatar" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1143 "author-id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1144 "author-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1145 "author-link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1146 "author-avatar" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1147 "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1148 "body" => ["type" => "mediumtext", "comment" => ""],
1149 "app" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1150 "verb" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1151 "object-type" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1152 "object" => ["type" => "text", "comment" => ""],
1153 "target-type" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1154 "target" => ["type" => "text", "comment" => ""],
1155 "postopts" => ["type" => "text", "comment" => ""],
1156 "plink" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1157 "resource-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1158 "event-id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["event" => "id"], "comment" => ""],
1159 "tag" => ["type" => "mediumtext", "comment" => ""],
1160 "attach" => ["type" => "mediumtext", "comment" => ""],
1161 "inform" => ["type" => "mediumtext", "comment" => ""],
1162 "file" => ["type" => "mediumtext", "comment" => ""],
1163 "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1164 "coord" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1165 "allow_cid" => ["type" => "mediumtext", "comment" => ""],
1166 "allow_gid" => ["type" => "mediumtext", "comment" => ""],
1167 "deny_cid" => ["type" => "mediumtext", "comment" => ""],
1168 "deny_gid" => ["type" => "mediumtext", "comment" => ""],
1169 "private" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1170 "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1171 "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1172 "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1173 "spam" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1174 "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1175 "bookmark" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1176 "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
1177 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1178 "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1179 "forum_mode" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1180 "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1181 "network" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1182 "rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1183 "rendered-html" => ["type" => "mediumtext", "comment" => ""],
1184 "global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1187 "PRIMARY" => ["id"],
1188 "guid" => ["guid(191)"],
1189 "uri" => ["uri(191)"],
1190 "parent" => ["parent"],
1191 "parent-uri" => ["parent-uri(191)"],
1192 "extid" => ["extid(191)"],
1193 "uid_id" => ["uid","id"],
1194 "uid_contactid_id" => ["uid","contact-id","id"],
1195 "uid_created" => ["uid","created"],
1196 "uid_unseen_contactid" => ["uid","unseen","contact-id"],
1197 "uid_network_received" => ["uid","network(4)","received"],
1198 "uid_network_commented" => ["uid","network(4)","commented"],
1199 "uid_thrparent" => ["uid","thr-parent(190)"],
1200 "uid_parenturi" => ["uid","parent-uri(190)"],
1201 "uid_contactid_created" => ["uid","contact-id","created"],
1202 "authorid_created" => ["author-id","created"],
1203 "ownerid" => ["owner-id"],
1204 "uid_uri" => ["uid", "uri(190)"],
1205 "resource-id" => ["resource-id(191)"],
1206 "contactid_allowcid_allowpid_denycid_denygid" => ["contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"], //
1207 "uid_type_changed" => ["uid","type(190)","changed"],
1208 "contactid_verb" => ["contact-id","verb(190)"],
1209 "deleted_changed" => ["deleted","changed"],
1210 "uid_wall_changed" => ["uid","wall","changed"],
1211 "uid_eventid" => ["uid","event-id"],
1212 "uid_authorlink" => ["uid","author-link(190)"],
1213 "uid_ownerlink" => ["uid","owner-link(190)"],
1216 $database["locks"] = [
1219 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1220 "name" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => ""],
1221 "locked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1222 "pid" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1225 "PRIMARY" => ["id"],
1228 $database["mail"] = [
1229 "comment" => "private messages",
1231 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1232 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1233 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1234 "from-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1235 "from-photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1236 "from-url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1237 "contact-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => ["contact" => "id"], "comment" => ""],
1238 "convid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["conv" => "id"], "comment" => ""],
1239 "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1240 "body" => ["type" => "mediumtext", "comment" => ""],
1241 "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1242 "reply" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1243 "replied" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1244 "unknown" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1245 "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1246 "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1247 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1250 "PRIMARY" => ["id"],
1251 "uid_seen" => ["uid", "seen"],
1252 "convid" => ["convid"],
1253 "uri" => ["uri(64)"],
1254 "parent-uri" => ["parent-uri(64)"],
1255 "contactid" => ["contact-id(32)"],
1258 $database["mailacct"] = [
1259 "comment" => "Mail account data for fetching mails",
1261 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1262 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1263 "server" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1264 "port" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1265 "ssltype" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
1266 "mailbox" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1267 "user" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1268 "pass" => ["type" => "text", "comment" => ""],
1269 "reply_to" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1270 "action" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1271 "movetofolder" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1272 "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1273 "last_check" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1276 "PRIMARY" => ["id"],
1279 $database["manage"] = [
1280 "comment" => "table of accounts that can manage each other",
1282 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1283 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1284 "mid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1287 "PRIMARY" => ["id"],
1288 "uid_mid" => ["UNIQUE", "uid","mid"],
1291 $database["notify"] = [
1292 "comment" => "notifications",
1294 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1295 "hash" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => ""],
1296 "type" => ["type" => "smallint", "not null" => "1", "default" => "0", "comment" => ""],
1297 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1298 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1299 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1300 "date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1301 "msg" => ["type" => "mediumtext", "comment" => ""],
1302 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1303 "link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1304 "iid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
1305 "parent" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
1306 "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1307 "verb" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1308 "otype" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
1309 "name_cache" => ["type" => "tinytext", "comment" => ""],
1310 "msg_cache" => ["type" => "mediumtext", "comment" => ""]
1313 "PRIMARY" => ["id"],
1314 "hash_uid" => ["hash", "uid"],
1315 "seen_uid_date" => ["seen", "uid", "date"],
1316 "uid_date" => ["uid", "date"],
1317 "uid_type_link" => ["uid", "type", "link(190)"],
1320 $database["notify-threads"] = [
1323 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1324 "notify-id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["notify" => "id"], "comment" => ""],
1325 "master-parent-item" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
1326 "parent-item" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1327 "receiver-uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1330 "PRIMARY" => ["id"],
1333 $database["oembed"] = [
1334 "comment" => "cache for OEmbed queries",
1336 "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => ""],
1337 "maxwidth" => ["type" => "mediumint", "not null" => "1", "primary" => "1", "comment" => ""],
1338 "content" => ["type" => "mediumtext", "comment" => ""],
1339 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1342 "PRIMARY" => ["url", "maxwidth"],
1343 "created" => ["created"],
1346 $database["parsed_url"] = [
1347 "comment" => "cache for 'parse_url' queries",
1349 "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => ""],
1350 "guessing" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1351 "oembed" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => ""],
1352 "content" => ["type" => "mediumtext", "comment" => ""],
1353 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1356 "PRIMARY" => ["url", "guessing", "oembed"],
1357 "created" => ["created"],
1360 $database["participation"] = [
1361 "comment" => "Storage for participation messages from Diaspora",
1363 "iid" => ["type" => "int", "not null" => "1", "primary" => "1", "relation" => ["item" => "id"], "comment" => ""],
1364 "server" => ["type" => "varchar(60)", "not null" => "1", "primary" => "1", "comment" => ""],
1365 "cid" => ["type" => "int", "not null" => "1", "relation" => ["contact" => "id"], "comment" => ""],
1366 "fid" => ["type" => "int", "not null" => "1", "relation" => ["fcontact" => "id"], "comment" => ""],
1369 "PRIMARY" => ["iid", "server"]
1372 $database["pconfig"] = [
1373 "comment" => "personal (per user) configuration storage",
1375 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1376 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1377 "cat" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
1378 "k" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
1379 "v" => ["type" => "mediumtext", "comment" => ""],
1382 "PRIMARY" => ["id"],
1383 "uid_cat_k" => ["UNIQUE", "uid", "cat", "k"],
1386 $database["photo"] = [
1387 "comment" => "photo storage",
1389 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1390 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1391 "contact-id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1392 "guid" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => ""],
1393 "resource-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1394 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1395 "edited" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1396 "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1397 "desc" => ["type" => "text", "comment" => ""],
1398 "album" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1399 "filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1400 "type" => ["type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"],
1401 "height" => ["type" => "smallint", "not null" => "1", "default" => "0", "comment" => ""],
1402 "width" => ["type" => "smallint", "not null" => "1", "default" => "0", "comment" => ""],
1403 "datasize" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1404 "data" => ["type" => "mediumblob", "not null" => "1", "comment" => ""],
1405 "scale" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1406 "profile" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1407 "allow_cid" => ["type" => "mediumtext", "comment" => ""],
1408 "allow_gid" => ["type" => "mediumtext", "comment" => ""],
1409 "deny_cid" => ["type" => "mediumtext", "comment" => ""],
1410 "deny_gid" => ["type" => "mediumtext", "comment" => ""],
1413 "PRIMARY" => ["id"],
1414 "contactid" => ["contact-id"],
1415 "uid_contactid" => ["uid", "contact-id"],
1416 "uid_profile" => ["uid", "profile"],
1417 "uid_album_scale_created" => ["uid", "album(32)", "scale", "created"],
1418 "uid_album_resource-id_created" => ["uid", "album(32)", "resource-id(64)", "created"],
1419 "resource-id" => ["resource-id(64)"],
1422 $database["poll"] = [
1423 "comment" => "Currently unused table for storing poll results",
1425 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1426 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1427 "q0" => ["type" => "text", "comment" => ""],
1428 "q1" => ["type" => "text", "comment" => ""],
1429 "q2" => ["type" => "text", "comment" => ""],
1430 "q3" => ["type" => "text", "comment" => ""],
1431 "q4" => ["type" => "text", "comment" => ""],
1432 "q5" => ["type" => "text", "comment" => ""],
1433 "q6" => ["type" => "text", "comment" => ""],
1434 "q7" => ["type" => "text", "comment" => ""],
1435 "q8" => ["type" => "text", "comment" => ""],
1436 "q9" => ["type" => "text", "comment" => ""],
1439 "PRIMARY" => ["id"],
1443 $database["poll_result"] = [
1444 "comment" => "data for polls - currently unused",
1446 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1447 "poll_id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["poll" => "id"]],
1448 "choice" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1451 "PRIMARY" => ["id"],
1452 "poll_id" => ["poll_id"],
1455 $database["process"] = [
1456 "comment" => "Currently running system processes",
1458 "pid" => ["type" => "int", "not null" => "1", "primary" => "1", "comment" => ""],
1459 "command" => ["type" => "varbinary(32)", "not null" => "1", "default" => "", "comment" => ""],
1460 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1463 "PRIMARY" => ["pid"],
1464 "command" => ["command"],
1467 $database["profile"] = [
1468 "comment" => "user profiles data",
1470 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1471 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1472 "profile-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1473 "is-default" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1474 "hide-friends" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1475 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1476 "pdesc" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1477 "dob" => ["type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00", "comment" => ""],
1478 "address" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1479 "locality" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1480 "region" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1481 "postal-code" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1482 "country-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1483 "hometown" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1484 "gender" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1485 "marital" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1486 "with" => ["type" => "text", "comment" => ""],
1487 "howlong" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1488 "sexual" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1489 "politic" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1490 "religion" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1491 "pub_keywords" => ["type" => "text", "comment" => ""],
1492 "prv_keywords" => ["type" => "text", "comment" => ""],
1493 "likes" => ["type" => "text", "comment" => ""],
1494 "dislikes" => ["type" => "text", "comment" => ""],
1495 "about" => ["type" => "text", "comment" => ""],
1496 "summary" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1497 "music" => ["type" => "text", "comment" => ""],
1498 "book" => ["type" => "text", "comment" => ""],
1499 "tv" => ["type" => "text", "comment" => ""],
1500 "film" => ["type" => "text", "comment" => ""],
1501 "interest" => ["type" => "text", "comment" => ""],
1502 "romance" => ["type" => "text", "comment" => ""],
1503 "work" => ["type" => "text", "comment" => ""],
1504 "education" => ["type" => "text", "comment" => ""],
1505 "contact" => ["type" => "text", "comment" => ""],
1506 "homepage" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1507 "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1508 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1509 "thumb" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1510 "publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1511 "net-publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1514 "PRIMARY" => ["id"],
1515 "uid_is-default" => ["uid", "is-default"],
1518 $database["profile_check"] = [
1519 "comment" => "DFRN remote auth use",
1521 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1522 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1523 "cid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1524 "dfrn_id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1525 "sec" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1526 "expire" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1529 "PRIMARY" => ["id"],
1532 $database["push_subscriber"] = [
1533 "comment" => "Used for OStatus: Contains feed subscribers",
1535 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1536 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1537 "callback_url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1538 "topic" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1539 "nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1540 "push" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1541 "last_update" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1542 "secret" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1545 "PRIMARY" => ["id"],
1548 $database["queue"] = [
1549 "comment" => "Queue for messages that couldn't be delivered",
1551 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1552 "cid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Message receiver"],
1553 "network" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Receiver's network"],
1554 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Unique GUID of the message"],
1555 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date, when the message was created"],
1556 "last" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date of last trial"],
1557 "next" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Next retrial date"],
1558 "retrial" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1559 "content" => ["type" => "mediumtext", "comment" => ""],
1560 "batch" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1563 "PRIMARY" => ["id"],
1568 $database["register"] = [
1569 "comment" => "registrations requiring admin approval",
1571 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1572 "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1573 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1574 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1575 "password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1576 "language" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
1577 "note" => ["type" => "text", "comment" => ""],
1580 "PRIMARY" => ["id"],
1583 $database["search"] = [
1586 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1587 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1588 "term" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1591 "PRIMARY" => ["id"],
1595 $database["session"] = [
1596 "comment" => "web session storage",
1598 "id" => ["type" => "bigint", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1599 "sid" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
1600 "data" => ["type" => "text", "comment" => ""],
1601 "expire" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1604 "PRIMARY" => ["id"],
1605 "sid" => ["sid(64)"],
1606 "expire" => ["expire"],
1609 $database["sign"] = [
1610 "comment" => "Diaspora signatures",
1612 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1613 "iid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
1614 "signed_text" => ["type" => "mediumtext", "comment" => ""],
1615 "signature" => ["type" => "text", "comment" => ""],
1616 "signer" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1619 "PRIMARY" => ["id"],
1620 "iid" => ["UNIQUE", "iid"],
1623 $database["term"] = [
1624 "comment" => "item taxonomy (categories, tags, etc.) table",
1626 "tid" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1627 "oid" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
1628 "otype" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1629 "type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1630 "term" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1631 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1632 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1633 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1634 "received" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1635 "global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1636 "aid" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1637 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1640 "PRIMARY" => ["tid"],
1641 "oid_otype_type_term" => ["oid","otype","type","term(32)"],
1642 "uid_otype_type_term_global_created" => ["uid","otype","type","term(32)","global","created"],
1643 "uid_otype_type_url" => ["uid","otype","type","url(64)"],
1644 "guid" => ["guid(64)"],
1647 $database["thread"] = [
1648 "comment" => "Thread related data",
1650 "iid" => ["type" => "int", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["item" => "id"], "comment" => ""],
1651 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1652 "contact-id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1653 "gcontact-id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["gcontact" => "id"], "comment" => ""],
1654 "owner-id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1655 "author-id" => ["type" => "int", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1656 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1657 "edited" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1658 "commented" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1659 "received" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1660 "changed" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1661 "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1662 "private" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1663 "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1664 "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1665 "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1666 "spam" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1667 "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1668 "ignored" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1669 "bookmark" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1670 "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
1671 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1672 "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1673 "forum_mode" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1674 "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1675 "network" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1678 "PRIMARY" => ["iid"],
1679 "uid_network_commented" => ["uid","network","commented"],
1680 "uid_network_created" => ["uid","network","created"],
1681 "uid_contactid_commented" => ["uid","contact-id","commented"],
1682 "uid_contactid_created" => ["uid","contact-id","created"],
1683 "contactid" => ["contact-id"],
1684 "ownerid" => ["owner-id"],
1685 "authorid" => ["author-id"],
1686 "uid_created" => ["uid","created"],
1687 "uid_commented" => ["uid","commented"],
1688 "uid_wall_created" => ["uid","wall","created"],
1689 "private_wall_origin_commented" => ["private","wall","origin","commented"],
1692 $database["tokens"] = [
1693 "comment" => "OAuth usage",
1695 "id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
1696 "secret" => ["type" => "text", "comment" => ""],
1697 "client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => ["clients" => "client_id"]],
1698 "expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1699 "scope" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
1700 "uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1703 "PRIMARY" => ["id"],
1706 $database["user"] = [
1707 "comment" => "The local users",
1709 "uid" => ["type" => "mediumint", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1710 "parent-uid" => ["type" => "mediumint", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "The parent user that has full control about this user"],
1711 "guid" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => ""],
1712 "username" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1713 "password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1714 "legacy_password" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is the password hash double-hashed?"],
1715 "nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1716 "email" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1717 "openid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1718 "timezone" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => ""],
1719 "language" => ["type" => "varchar(32)", "not null" => "1", "default" => "en", "comment" => ""],
1720 "register_date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1721 "login_date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1722 "default-location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1723 "allow_location" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1724 "theme" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1725 "pubkey" => ["type" => "text", "comment" => ""],
1726 "prvkey" => ["type" => "text", "comment" => ""],
1727 "spubkey" => ["type" => "text", "comment" => ""],
1728 "sprvkey" => ["type" => "text", "comment" => ""],
1729 "verified" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1730 "blocked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1731 "blockwall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1732 "hidewall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1733 "blocktags" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1734 "unkmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1735 "cntunkmail" => ["type" => "int", "not null" => "1", "default" => "10", "comment" => ""],
1736 "notify-flags" => ["type" => "smallint unsigned", "not null" => "1", "default" => "65535", "comment" => ""],
1737 "page-flags" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1738 "account-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1739 "prvnets" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1740 "pwdreset" => ["type" => "varchar(255)", "comment" => "Password reset request token"],
1741 "pwdreset_time" => ["type" => "datetime", "comment" => "Timestamp of the last password reset request"],
1742 "maxreq" => ["type" => "int", "not null" => "1", "default" => "10", "comment" => ""],
1743 "expire" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1744 "account_removed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1745 "account_expired" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1746 "account_expires_on" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1747 "expire_notification_sent" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1748 "def_gid" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1749 "allow_cid" => ["type" => "mediumtext", "comment" => ""],
1750 "allow_gid" => ["type" => "mediumtext", "comment" => ""],
1751 "deny_cid" => ["type" => "mediumtext", "comment" => ""],
1752 "deny_gid" => ["type" => "mediumtext", "comment" => ""],
1753 "openidserver" => ["type" => "text", "comment" => ""],
1756 "PRIMARY" => ["uid"],
1757 "nickname" => ["nickname(32)"],
1760 $database["userd"] = [
1761 "comment" => "Deleted usernames",
1763 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1764 "username" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
1767 "PRIMARY" => ["id"],
1768 "username" => ["username(32)"],
1771 $database["workerqueue"] = [
1772 "comment" => "Background tasks queue entries",
1774 "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented worker task id"],
1775 "parameter" => ["type" => "mediumtext", "comment" => "Task command"],
1776 "priority" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Task priority"],
1777 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Creation date"],
1778 "pid" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => "Process id of the worker"],
1779 "executed" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Execution date"],
1780 "done" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marked when the task was done, will be deleted later"],
1783 "PRIMARY" => ["id"],
1785 "parameter" => ["parameter(64)"],
1786 "priority_created" => ["priority", "created"],
1787 "executed" => ["executed"],