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(3) unsigned', 'tinyint(4)', 'smallint(5) unsigned', 'smallint(6)', 'mediumint(8) unsigned', 'mediumint(9)', 'bigint(20)', 'int(10) unsigned', 'int(11)'];
135 $replace = ['boolean', 'tinyint unsigned', 'tinyint', 'smallint unsigned', 'smallint', 'mediumint unsigned', 'mediumint', 'bigint', 'int unsigned', '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 bool $install Is this the initial update during the installation?
203 * @param array $tables An array of the database tables
204 * @param array $definition An array of the definition tables
205 * @return string Empty string if the update is successful, error messages otherwise
207 public static function update($verbose, $action, $install = false, array $tables = null, array $definition = null) {
208 if ($action && !$install) {
209 Config::set('system', 'maintenance', 1);
210 Config::set('system', 'maintenance_reason', L10n::t('%s: Database update', DBM::date().' '.date('e')));
215 logger('updating structure', LOGGER_DEBUG);
217 // Get the current structure
220 if (is_null($tables)) {
221 $tables = q("SHOW TABLES");
224 if (DBM::is_result($tables)) {
225 foreach ($tables AS $table) {
226 $table = current($table);
228 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
229 $database[$table] = self::tableStructure($table);
233 // Get the definition
234 if (is_null($definition)) {
235 $definition = self::definition();
238 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
239 if ((version_compare(dba::server_info(), '5.7.4') >= 0) &&
240 !(strpos(dba::server_info(), 'MariaDB') !== false)) {
247 foreach ($definition AS $name => $structure) {
248 $is_new_table = false;
253 if (!isset($database[$name])) {
254 $r = self::createTable($name, $structure["fields"], $verbose, $action, $structure['indexes']);
255 if (!DBM::is_result($r)) {
256 $errors .= self::printUpdateError($name);
258 $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";
460 Config::set('system', 'maintenance_reason', L10n::t('%s: updating %s table.', DBM::date().' '.date('e'), $name));
463 // Ensure index conversion to unique removes duplicates
464 if ($is_unique && ($temp_name != $name)) {
466 dba::e("SET session old_alter_table=1;");
468 $r = dba::e("DROP TABLE IF EXISTS `".$temp_name."`;");
469 if (!DBM::is_result($r)) {
470 $errors .= self::printUpdateError($sql3);
474 $r = dba::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
475 if (!DBM::is_result($r)) {
476 $errors .= self::printUpdateError($sql3);
483 if (!DBM::is_result($r)) {
484 $errors .= self::printUpdateError($sql3);
486 if ($is_unique && ($temp_name != $name)) {
488 dba::e("SET session old_alter_table=0;");
490 $r = dba::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
491 if (!DBM::is_result($r)) {
492 $errors .= self::printUpdateError($sql3);
495 $r = dba::e("DROP TABLE `".$name."`;");
496 if (!DBM::is_result($r)) {
497 $errors .= self::printUpdateError($sql3);
500 $r = dba::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
501 if (!DBM::is_result($r)) {
502 $errors .= self::printUpdateError($sql3);
511 if ($action && !$install) {
512 Config::set('system', 'maintenance', 0);
513 Config::set('system', 'maintenance_reason', '');
516 Config::set('system', 'dbupdate', DB_UPDATE_FAILED);
518 Config::set('system', 'dbupdate', DB_UPDATE_SUCCESSFUL);
525 private static function FieldCommand($parameters, $create = true) {
526 $fieldstruct = $parameters["type"];
528 if (!is_null($parameters["Collation"])) {
529 $fieldstruct .= " COLLATE ".$parameters["Collation"];
532 if ($parameters["not null"]) {
533 $fieldstruct .= " NOT NULL";
536 if (isset($parameters["default"])) {
537 if (strpos(strtolower($parameters["type"]),"int")!==false) {
538 $fieldstruct .= " DEFAULT ".$parameters["default"];
540 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
543 if ($parameters["extra"] != "") {
544 $fieldstruct .= " ".$parameters["extra"];
547 if (!is_null($parameters["comment"])) {
548 $fieldstruct .= " COMMENT '".dbesc($parameters["comment"])."'";
551 /*if (($parameters["primary"] != "") && $create)
552 $fieldstruct .= " PRIMARY KEY";*/
554 return($fieldstruct);
557 private static function createTable($name, $fields, $verbose, $action, $indexes=null) {
562 foreach ($fields AS $fieldname => $field) {
563 $sql_rows[] = "`".dbesc($fieldname)."` ".self::FieldCommand($field);
564 if (x($field,'primary') && $field['primary']!='') {
565 $primary_keys[] = $fieldname;
569 if (!is_null($indexes)) {
570 foreach ($indexes AS $indexname => $fieldnames) {
571 $sql_index = self::createIndex($indexname, $fieldnames, "");
572 if (!is_null($sql_index)) {
573 $sql_rows[] = $sql_index;
578 $sql = implode(",\n\t", $sql_rows);
580 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT COLLATE utf8mb4_general_ci";
592 private static function addTableField($fieldname, $parameters) {
593 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), self::FieldCommand($parameters));
597 private static function modifyTableField($fieldname, $parameters) {
598 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), self::FieldCommand($parameters, false));
602 private static function dropIndex($indexname) {
603 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
607 private static function createIndex($indexname, $fieldnames, $method = "ADD") {
608 $method = strtoupper(trim($method));
609 if ($method!="" && $method!="ADD") {
610 throw new \Exception("Invalid parameter 'method' in self::createIndex(): '$method'");
613 if ($fieldnames[0] == "UNIQUE") {
614 array_shift($fieldnames);
615 $method .= ' UNIQUE';
619 foreach ($fieldnames AS $fieldname) {
624 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
625 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
627 $names .= "`".dbesc($fieldname)."`";
631 if ($indexname == "PRIMARY") {
632 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
636 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
640 private static function groupBy($indexname, $fieldnames) {
641 if ($fieldnames[0] != "UNIQUE") {
645 array_shift($fieldnames);
648 foreach ($fieldnames AS $fieldname) {
653 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
654 $names .= "`".dbesc($matches[1])."`";
656 $names .= "`".dbesc($fieldname)."`";
660 $sql = sprintf(" GROUP BY %s", $names);
664 public static function definition() {
667 $database["addon"] = [
668 "comment" => "registered addons",
670 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
671 "name" => ["type" => "varchar(50)", "not null" => "1", "default" => "", "comment" => "addon base (file)name"],
672 "version" => ["type" => "varchar(50)", "not null" => "1", "default" => "", "comment" => "currently unused"],
673 "installed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "currently always 1"],
674 "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "currently unused"],
675 "timestamp" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "file timestamp to check for reloads"],
676 "plugin_admin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 = has admin config, 0 = has no admin config"],
680 "name" => ["UNIQUE", "name"],
683 $database["attach"] = [
684 "comment" => "file attachments",
686 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "generated index"],
687 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
688 "hash" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "hash"],
689 "filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "filename of original"],
690 "filetype" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "mimetype"],
691 "filesize" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "size in bytes"],
692 "data" => ["type" => "longblob", "not null" => "1", "comment" => "file data"],
693 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "creation time"],
694 "edited" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "last edit time"],
695 "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>"],
696 "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
697 "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
698 "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
704 $database["auth_codes"] = [
705 "comment" => "OAuth usage",
707 "id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
708 "client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => ["clients" => "client_id"], "comment" => ""],
709 "redirect_uri" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
710 "expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
711 "scope" => ["type" => "varchar(250)", "not null" => "1", "default" => "", "comment" => ""],
717 $database["cache"] = [
718 "comment" => "Stores temporary data",
720 "k" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "cache key"],
721 "v" => ["type" => "mediumtext", "comment" => "cached serialized value"],
722 "expires" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "datetime of cache expiration"],
723 "updated" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "datetime of cache insertion"],
727 "k_expires" => ["k", "expires"],
730 $database["challenge"] = [
733 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
734 "challenge" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
735 "dfrn-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
736 "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
737 "type" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
738 "last_update" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
744 $database["clients"] = [
745 "comment" => "OAuth usage",
747 "client_id" => ["type" => "varchar(20)", "not null" => "1", "primary" => "1", "comment" => ""],
748 "pw" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "comment" => ""],
749 "redirect_uri" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
750 "name" => ["type" => "text", "comment" => ""],
751 "icon" => ["type" => "text", "comment" => ""],
752 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
755 "PRIMARY" => ["client_id"],
758 $database["config"] = [
759 "comment" => "main configuration storage",
761 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
762 "cat" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
763 "k" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
764 "v" => ["type" => "mediumtext", "comment" => ""],
768 "cat_k" => ["UNIQUE", "cat", "k"],
771 $database["contact"] = [
772 "comment" => "contact table",
774 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
775 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
776 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
777 "self" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 if the contact is the user him/her self"],
778 "remote_self" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
779 "rel" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "The kind of the relation between the user and the contact"],
780 "duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
781 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Network protocol of the contact"],
782 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name that this contact is known by"],
783 "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Nick- and user name of the contact"],
784 "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
785 "about" => ["type" => "text", "comment" => ""],
786 "keywords" => ["type" => "text", "comment" => "public keywords (interests) of the contact"],
787 "gender" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
788 "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
789 "attag" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
790 "avatar" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
791 "photo" => ["type" => "varchar(255)", "default" => "", "comment" => "Link to the profile photo of the contact"],
792 "thumb" => ["type" => "varchar(255)", "default" => "", "comment" => "Link to the profile photo (thumb size)"],
793 "micro" => ["type" => "varchar(255)", "default" => "", "comment" => "Link to the profile photo (micro size)"],
794 "site-pubkey" => ["type" => "text", "comment" => ""],
795 "issued-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
796 "dfrn-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
797 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
798 "nurl" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
799 "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
800 "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
801 "pubkey" => ["type" => "text", "comment" => "RSA public key 4096 bit"],
802 "prvkey" => ["type" => "text", "comment" => "RSA private key 4096 bit"],
803 "batch" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
804 "request" => ["type" => "varchar(255)", "comment" => ""],
805 "notify" => ["type" => "varchar(255)", "comment" => ""],
806 "poll" => ["type" => "varchar(255)", "comment" => ""],
807 "confirm" => ["type" => "varchar(255)", "comment" => ""],
808 "poco" => ["type" => "varchar(255)", "comment" => ""],
809 "aes_allow" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
810 "ret-aes" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
811 "usehub" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
812 "subhub" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
813 "hub-verify" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
814 "last-update" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date of the last try to update the contact info"],
815 "success_update" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date of the last successful contact update"],
816 "failure_update" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date of the last failed update"],
817 "name-date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
818 "uri-date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
819 "avatar-date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
820 "term-date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
821 "last-item" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "date of the last post"],
822 "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
823 "blocked" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
824 "readonly" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "posts of the contact are readonly"],
825 "writable" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
826 "forum" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "contact is a forum"],
827 "prv" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "contact is a private group"],
828 "contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
829 "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
830 "archive" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
831 "pending" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
832 "rating" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
833 "reason" => ["type" => "text", "comment" => ""],
834 "closeness" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "99", "comment" => ""],
835 "info" => ["type" => "mediumtext", "comment" => ""],
836 "profile-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
837 "bdyear" => ["type" => "varchar(4)", "not null" => "1", "default" => "", "comment" => ""],
838 "bd" => ["type" => "date", "not null" => "1", "default" => "0001-01-01", "comment" => ""],
839 "notify_new_posts" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
840 "fetch_further_information" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
841 "ffi_keyword_blacklist" => ["type" => "text", "comment" => ""],
845 "uid_name" => ["uid", "name(190)"],
846 "self_uid" => ["self", "uid"],
847 "alias_uid" => ["alias(32)", "uid"],
848 "pending_uid" => ["pending", "uid"],
849 "blocked_uid" => ["blocked", "uid"],
850 "uid_rel_network_poll" => ["uid", "rel", "network", "poll(64)", "archive"],
851 "uid_network_batch" => ["uid", "network", "batch(64)"],
852 "addr_uid" => ["addr(32)", "uid"],
853 "nurl_uid" => ["nurl(32)", "uid"],
854 "nick_uid" => ["nick(32)", "uid"],
855 "dfrn-id" => ["dfrn-id(64)"],
856 "issued-id" => ["issued-id(64)"],
859 $database["conv"] = [
860 "comment" => "private messages",
862 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
863 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this conversation"],
864 "recips" => ["type" => "text", "comment" => "sender_handle;recipient_handle"],
865 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
866 "creator" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "handle of creator"],
867 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "creation timestamp"],
868 "updated" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "edited timestamp"],
869 "subject" => ["type" => "text", "comment" => "subject of initial message"],
876 $database["conversation"] = [
877 "comment" => "Raw data and structure information for messages",
879 "item-uri" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "URI of the item"],
880 "reply-to-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "URI to which this item is a reply"],
881 "conversation-uri" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation URI"],
882 "conversation-href" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => "GNU Social conversation link"],
883 "protocol" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "The protocol of the item"],
884 "source" => ["type" => "mediumtext", "comment" => "Original source"],
885 "received" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Receiving date"],
888 "PRIMARY" => ["item-uri"],
889 "conversation-uri" => ["conversation-uri"],
890 "received" => ["received"],
893 $database["event"] = [
894 "comment" => "Events",
896 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
897 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
898 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
899 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "contact_id (ID of the contact in contact table)"],
900 "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
901 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "creation time"],
902 "edited" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "last edit time"],
903 "start" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "event start time"],
904 "finish" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "event end time"],
905 "summary" => ["type" => "text", "comment" => "short description or title of the event"],
906 "desc" => ["type" => "text", "comment" => "event description"],
907 "location" => ["type" => "text", "comment" => "event location"],
908 "type" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "comment" => "event or birthday"],
909 "nofinish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if event does have no end this is 1"],
910 "adjust" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "adjust to timezone of the recipient (0 or 1)"],
911 "ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "0 or 1"],
912 "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
913 "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
914 "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
915 "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
919 "uid_start" => ["uid", "start"],
922 $database["fcontact"] = [
923 "comment" => "Diaspora compatible contacts - used in the Diaspora implementation",
925 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
926 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "unique id"],
927 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
928 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
929 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
930 "request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
931 "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
932 "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
933 "batch" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
934 "notify" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
935 "poll" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
936 "confirm" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
937 "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
938 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
939 "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
940 "pubkey" => ["type" => "text", "comment" => ""],
941 "updated" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
945 "addr" => ["addr(32)"],
946 "url" => ["UNIQUE", "url(190)"],
949 $database["fsuggest"] = [
950 "comment" => "friend suggestion stuff",
952 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
953 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
954 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
955 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
956 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
957 "request" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
958 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
959 "note" => ["type" => "text", "comment" => ""],
960 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
966 $database["gcign"] = [
967 "comment" => "contacts ignored by friend suggestions",
969 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
970 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Local User id"],
971 "gcid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["gcontact" => "id"], "comment" => "gcontact.id of ignored contact"],
979 $database["gcontact"] = [
980 "comment" => "global contacts",
982 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
983 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name that this contact is known by"],
984 "nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Nick- and user name of the contact"],
985 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Link to the contacts profile page"],
986 "nurl" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
987 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Link to the profile photo"],
988 "connect" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
989 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
990 "updated" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
991 "last_contact" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
992 "last_failure" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
993 "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
994 "about" => ["type" => "text", "comment" => ""],
995 "keywords" => ["type" => "text", "comment" => "puplic keywords (interests)"],
996 "gender" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
997 "birthday" => ["type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01", "comment" => ""],
998 "community" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 if contact is forum account"],
999 "contact-type" => ["type" => "tinyint", "not null" => "1", "default" => "-1", "comment" => ""],
1000 "hide" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 = should be hidden from search"],
1001 "nsfw" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 = contact posts nsfw content"],
1002 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "social network protocol"],
1003 "addr" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1004 "notify" => ["type" => "varchar(255)", "comment" => ""],
1005 "alias" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1006 "generation" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1007 "server_url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "baseurl of the contacts server"],
1010 "PRIMARY" => ["id"],
1011 "nurl" => ["UNIQUE", "nurl(190)"],
1012 "name" => ["name(64)"],
1013 "nick" => ["nick(32)"],
1014 "addr" => ["addr(64)"],
1015 "hide_network_updated" => ["hide", "network", "updated"],
1016 "updated" => ["updated"],
1019 $database["glink"] = [
1020 "comment" => "'friends of friends' linkages derived from poco",
1022 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1023 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1024 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1025 "gcid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["gcontact" => "id"], "comment" => ""],
1026 "zcid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["gcontact" => "id"], "comment" => ""],
1027 "updated" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1030 "PRIMARY" => ["id"],
1031 "cid_uid_gcid_zcid" => ["UNIQUE", "cid","uid","gcid","zcid"],
1035 $database["group"] = [
1036 "comment" => "privacy groups, group info",
1038 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1039 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
1040 "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 indicates the member list is not private"],
1041 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 indicates the group has been deleted"],
1042 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "human readable name of group"],
1045 "PRIMARY" => ["id"],
1049 $database["group_member"] = [
1050 "comment" => "privacy groups, member info",
1052 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1053 "gid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["group" => "id"], "comment" => "groups.id of the associated group"],
1054 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "contact.id of the member assigned to the associated group"],
1057 "PRIMARY" => ["id"],
1058 "contactid" => ["contact-id"],
1059 "gid_contactid" => ["UNIQUE", "gid", "contact-id"],
1062 $database["gserver"] = [
1063 "comment" => "Global servers",
1065 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1066 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1067 "nurl" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1068 "version" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1069 "site_name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1070 "info" => ["type" => "text", "comment" => ""],
1071 "register_policy" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
1072 "registered-users" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Number of registered users"],
1073 "poco" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1074 "noscrape" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1075 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
1076 "platform" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1077 "relay-subscribe" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Has the server subscribed to the relay system"],
1078 "relay-scope" => ["type" => "varchar(10)", "not null" => "1", "default" => "", "comment" => "The scope of messages that the server wants to get"],
1079 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1080 "last_poco_query" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
1081 "last_contact" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
1082 "last_failure" => ["type" => "datetime", "default" => NULL_DATE, "comment" => ""],
1085 "PRIMARY" => ["id"],
1086 "nurl" => ["UNIQUE", "nurl(190)"],
1089 $database["gserver-tag"] = [
1090 "comment" => "Tags that the server has subscribed",
1092 "gserver-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["gserver" => "id"], "primary" => "1", "comment" => "The id of the gserver"],
1093 "tag" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "primary" => "1", "comment" => "Tag that the server has subscribed"],
1096 "PRIMARY" => ["gserver-id", "tag"],
1100 $database["hook"] = [
1101 "comment" => "addon hook registry",
1103 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1104 "hook" => ["type" => "varbinary(100)", "not null" => "1", "default" => "", "comment" => "name of hook"],
1105 "file" => ["type" => "varbinary(200)", "not null" => "1", "default" => "", "comment" => "relative filename of hook handler"],
1106 "function" => ["type" => "varbinary(200)", "not null" => "1", "default" => "", "comment" => "function name of hook handler"],
1107 "priority" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => "not yet implemented - can be used to sort conflicts in hook handling by calling handlers in priority order"],
1110 "PRIMARY" => ["id"],
1111 "hook_file_function" => ["UNIQUE", "hook", "file", "function"],
1114 $database["intro"] = [
1117 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1118 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1119 "fid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["fcontact" => "id"], "comment" => ""],
1120 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1121 "knowyou" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1122 "duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1123 "note" => ["type" => "text", "comment" => ""],
1124 "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1125 "datetime" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1126 "blocked" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
1127 "ignore" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1130 "PRIMARY" => ["id"],
1133 $database["item"] = [
1134 "comment" => "All posts",
1136 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "relation" => ["thread" => "iid"]],
1137 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this item"],
1138 "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1139 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner id which owns this copy of the item"],
1140 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "contact.id"],
1141 "type" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "comment" => ""],
1142 "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "This item was posted to the wall of uid"],
1143 "gravity" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1144 "parent" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => "item.id of the parent to this item if it is a reply of some form; otherwise this must be set to the id of this item"],
1145 "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "uri of the parent to this item"],
1146 "extid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1147 "thr-parent" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "If the parent of this item is not the top-level item in the conversation, the uri of the immediate parent; otherwise set to parent-uri"],
1148 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Creation timestamp."],
1149 "edited" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date of last edit (default is created)"],
1150 "commented" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date of last comment/reply to this item"],
1151 "received" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "datetime"],
1152 "changed" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date that something in the conversation changed, indicating clients should fetch the conversation again"],
1153 "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Link to the contact table with uid=0 of the owner of this item"],
1154 "owner-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name of the owner of this item"],
1155 "owner-link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Link to the profile page of the owner of this item"],
1156 "owner-avatar" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Link to the avatar picture of the owner of this item"],
1157 "author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Link to the contact table with uid=0 of the author of this item"],
1158 "author-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name of the author of this item"],
1159 "author-link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Link to the profile page of the author of this item"],
1160 "author-avatar" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Link to the avatar picture of the author of this item"],
1161 "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "item title"],
1162 "content-warning" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1163 "body" => ["type" => "mediumtext", "comment" => "item body content"],
1164 "app" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "application which generated this item"],
1165 "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams verb"],
1166 "object-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams object type"],
1167 "object" => ["type" => "text", "comment" => "JSON encoded object structure unless it is an implied object (normal post)"],
1168 "target-type" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => "ActivityStreams target type if applicable (URI)"],
1169 "target" => ["type" => "text", "comment" => "JSON encoded target structure if used"],
1170 "postopts" => ["type" => "text", "comment" => "External post connectors add their network name to this comma-separated string to identify that they should be delivered to these networks during delivery"],
1171 "plink" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "permalink or URL to a displayable copy of the message at its source"],
1172 "resource-id" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => "Used to link other tables to items, it identifies the linked resource (e.g. photo) and if set must also set resource_type"],
1173 "event-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["event" => "id"], "comment" => "Used to link to the event.id"],
1174 "tag" => ["type" => "mediumtext", "comment" => ""],
1175 "attach" => ["type" => "mediumtext", "comment" => "JSON structure representing attachments to this item"],
1176 "inform" => ["type" => "mediumtext", "comment" => ""],
1177 "file" => ["type" => "mediumtext", "comment" => ""],
1178 "location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "text location where this item originated"],
1179 "coord" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "longitude/latitude pair representing location where this item originated"],
1180 "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
1181 "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
1182 "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
1183 "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
1184 "private" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "distribution is restricted"],
1185 "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1186 "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1187 "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1188 "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item has been favourited"],
1189 "bookmark" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item has been bookmarked"],
1190 "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => "item has not been seen"],
1191 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item has been deleted"],
1192 "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "item originated at this site"],
1193 "forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1194 "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "The owner of this item was mentioned in it"],
1195 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Network from where the item comes from"],
1196 "rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1197 "rendered-html" => ["type" => "mediumtext", "comment" => "item.body converted to html"],
1200 "PRIMARY" => ["id"],
1201 "guid" => ["guid(191)"],
1202 "uri" => ["uri(191)"],
1203 "parent" => ["parent"],
1204 "parent-uri" => ["parent-uri(191)"],
1205 "extid" => ["extid(191)"],
1206 "uid_id" => ["uid","id"],
1207 "uid_contactid_id" => ["uid","contact-id","id"],
1208 "uid_created" => ["uid","created"],
1209 "uid_commented" => ["uid","commented"],
1210 "uid_unseen_contactid" => ["uid","unseen","contact-id"],
1211 "uid_network_received" => ["uid","network","received"],
1212 "uid_network_commented" => ["uid","network","commented"],
1213 "uid_thrparent" => ["uid","thr-parent(190)"],
1214 "uid_parenturi" => ["uid","parent-uri(190)"],
1215 "uid_contactid_created" => ["uid","contact-id","created"],
1216 "authorid_created" => ["author-id","created"],
1217 "ownerid" => ["owner-id"],
1218 "uid_uri" => ["uid", "uri(190)"],
1219 "resource-id" => ["resource-id"],
1220 "contactid_allowcid_allowpid_denycid_denygid" => ["contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"], //
1221 "uid_type_changed" => ["uid","type","changed"],
1222 "contactid_verb" => ["contact-id","verb"],
1223 "deleted_changed" => ["deleted","changed"],
1224 "uid_wall_changed" => ["uid","wall","changed"],
1225 "uid_eventid" => ["uid","event-id"],
1226 "uid_authorlink" => ["uid","author-link(190)"],
1227 "uid_ownerlink" => ["uid","owner-link(190)"],
1230 $database["locks"] = [
1233 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1234 "name" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => ""],
1235 "locked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1236 "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process ID"],
1239 "PRIMARY" => ["id"],
1242 $database["mail"] = [
1243 "comment" => "private messages",
1245 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1246 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
1247 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this private message"],
1248 "from-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "name of the sender"],
1249 "from-photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "contact photo link of the sender"],
1250 "from-url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "profile linke of the sender"],
1251 "contact-id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => ["contact" => "id"], "comment" => "contact.id"],
1252 "convid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["conv" => "id"], "comment" => "conv.id"],
1253 "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1254 "body" => ["type" => "mediumtext", "comment" => ""],
1255 "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if message visited it is 1"],
1256 "reply" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1257 "replied" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1258 "unknown" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if sender not in the contact table this is 1"],
1259 "uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1260 "parent-uri" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1261 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "creation time of the private message"],
1264 "PRIMARY" => ["id"],
1265 "uid_seen" => ["uid", "seen"],
1266 "convid" => ["convid"],
1267 "uri" => ["uri(64)"],
1268 "parent-uri" => ["parent-uri(64)"],
1269 "contactid" => ["contact-id(32)"],
1272 $database["mailacct"] = [
1273 "comment" => "Mail account data for fetching mails",
1275 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1276 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1277 "server" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1278 "port" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1279 "ssltype" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
1280 "mailbox" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1281 "user" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1282 "pass" => ["type" => "text", "comment" => ""],
1283 "reply_to" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1284 "action" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1285 "movetofolder" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1286 "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1287 "last_check" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1290 "PRIMARY" => ["id"],
1293 $database["manage"] = [
1294 "comment" => "table of accounts that can manage each other",
1296 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1297 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1298 "mid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1301 "PRIMARY" => ["id"],
1302 "uid_mid" => ["UNIQUE", "uid","mid"],
1305 $database["notify"] = [
1306 "comment" => "notifications",
1308 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1309 "hash" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => ""],
1310 "type" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1311 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1312 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1313 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1314 "date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1315 "msg" => ["type" => "mediumtext", "comment" => ""],
1316 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
1317 "link" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1318 "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => "item.id"],
1319 "parent" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
1320 "seen" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1321 "verb" => ["type" => "varchar(100)", "not null" => "1", "default" => "", "comment" => ""],
1322 "otype" => ["type" => "varchar(10)", "not null" => "1", "default" => "", "comment" => ""],
1323 "name_cache" => ["type" => "tinytext", "comment" => "Cached bbcode parsing of name"],
1324 "msg_cache" => ["type" => "mediumtext", "comment" => "Cached bbcode parsing of msg"]
1327 "PRIMARY" => ["id"],
1328 "hash_uid" => ["hash", "uid"],
1329 "seen_uid_date" => ["seen", "uid", "date"],
1330 "uid_date" => ["uid", "date"],
1331 "uid_type_link" => ["uid", "type", "link(190)"],
1334 $database["notify-threads"] = [
1337 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1338 "notify-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["notify" => "id"], "comment" => ""],
1339 "master-parent-item" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
1340 "parent-item" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1341 "receiver-uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1344 "PRIMARY" => ["id"],
1347 $database["oembed"] = [
1348 "comment" => "cache for OEmbed queries",
1350 "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
1351 "maxwidth" => ["type" => "mediumint unsigned", "not null" => "1", "primary" => "1", "comment" => "Maximum width passed to Oembed"],
1352 "content" => ["type" => "mediumtext", "comment" => "OEmbed data of the page"],
1353 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "datetime of creation"],
1356 "PRIMARY" => ["url", "maxwidth"],
1357 "created" => ["created"],
1360 $database["parsed_url"] = [
1361 "comment" => "cache for 'parse_url' queries",
1363 "url" => ["type" => "varbinary(255)", "not null" => "1", "primary" => "1", "comment" => "page url"],
1364 "guessing" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the 'guessing' mode active?"],
1365 "oembed" => ["type" => "boolean", "not null" => "1", "default" => "0", "primary" => "1", "comment" => "is the data the result of oembed?"],
1366 "content" => ["type" => "mediumtext", "comment" => "page data"],
1367 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "datetime of creation"],
1370 "PRIMARY" => ["url", "guessing", "oembed"],
1371 "created" => ["created"],
1374 $database["participation"] = [
1375 "comment" => "Storage for participation messages from Diaspora",
1377 "iid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "relation" => ["item" => "id"], "comment" => ""],
1378 "server" => ["type" => "varchar(60)", "not null" => "1", "primary" => "1", "comment" => ""],
1379 "cid" => ["type" => "int unsigned", "not null" => "1", "relation" => ["contact" => "id"], "comment" => ""],
1380 "fid" => ["type" => "int unsigned", "not null" => "1", "relation" => ["fcontact" => "id"], "comment" => ""],
1383 "PRIMARY" => ["iid", "server"]
1386 $database["pconfig"] = [
1387 "comment" => "personal (per user) configuration storage",
1389 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1390 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1391 "cat" => ["type" => "varbinary(50)", "not null" => "1", "default" => "", "comment" => ""],
1392 "k" => ["type" => "varbinary(100)", "not null" => "1", "default" => "", "comment" => ""],
1393 "v" => ["type" => "mediumtext", "comment" => ""],
1396 "PRIMARY" => ["id"],
1397 "uid_cat_k" => ["UNIQUE", "uid", "cat", "k"],
1400 $database["photo"] = [
1401 "comment" => "photo storage",
1403 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1404 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
1405 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "contact.id"],
1406 "guid" => ["type" => "char(16)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this photo"],
1407 "resource-id" => ["type" => "char(32)", "not null" => "1", "default" => "", "comment" => ""],
1408 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "creation date"],
1409 "edited" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "last edited date"],
1410 "title" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1411 "desc" => ["type" => "text", "comment" => ""],
1412 "album" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "The name of the album to which the photo belongs"],
1413 "filename" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1414 "type" => ["type" => "varchar(30)", "not null" => "1", "default" => "image/jpeg"],
1415 "height" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1416 "width" => ["type" => "smallint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1417 "datasize" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1418 "data" => ["type" => "mediumblob", "not null" => "1", "comment" => ""],
1419 "scale" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1420 "profile" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1421 "allow_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed contact.id '<19><78>'"],
1422 "allow_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of allowed groups"],
1423 "deny_cid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied contact.id"],
1424 "deny_gid" => ["type" => "mediumtext", "comment" => "Access Control - list of denied groups"],
1427 "PRIMARY" => ["id"],
1428 "contactid" => ["contact-id"],
1429 "uid_contactid" => ["uid", "contact-id"],
1430 "uid_profile" => ["uid", "profile"],
1431 "uid_album_scale_created" => ["uid", "album(32)", "scale", "created"],
1432 "uid_album_resource-id_created" => ["uid", "album(32)", "resource-id", "created"],
1433 "resource-id" => ["resource-id"],
1436 $database["poll"] = [
1437 "comment" => "Currently unused table for storing poll results",
1439 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1440 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1441 "q0" => ["type" => "text", "comment" => ""],
1442 "q1" => ["type" => "text", "comment" => ""],
1443 "q2" => ["type" => "text", "comment" => ""],
1444 "q3" => ["type" => "text", "comment" => ""],
1445 "q4" => ["type" => "text", "comment" => ""],
1446 "q5" => ["type" => "text", "comment" => ""],
1447 "q6" => ["type" => "text", "comment" => ""],
1448 "q7" => ["type" => "text", "comment" => ""],
1449 "q8" => ["type" => "text", "comment" => ""],
1450 "q9" => ["type" => "text", "comment" => ""],
1453 "PRIMARY" => ["id"],
1457 $database["poll_result"] = [
1458 "comment" => "data for polls - currently unused",
1460 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1461 "poll_id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["poll" => "id"]],
1462 "choice" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1465 "PRIMARY" => ["id"],
1466 "poll_id" => ["poll_id"],
1469 $database["process"] = [
1470 "comment" => "Currently running system processes",
1472 "pid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "comment" => ""],
1473 "command" => ["type" => "varbinary(32)", "not null" => "1", "default" => "", "comment" => ""],
1474 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1477 "PRIMARY" => ["pid"],
1478 "command" => ["command"],
1481 $database["profile"] = [
1482 "comment" => "user profiles data",
1484 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1485 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "Owner User id"],
1486 "profile-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name of the profile"],
1487 "is-default" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Mark this profile as default profile"],
1488 "hide-friends" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Hide friend list from viewers of this profile"],
1489 "name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1490 "pdesc" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Title or description"],
1491 "dob" => ["type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00", "comment" => "Day of birth"],
1492 "address" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1493 "locality" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1494 "region" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1495 "postal-code" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1496 "country-name" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1497 "hometown" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1498 "gender" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
1499 "marital" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1500 "with" => ["type" => "text", "comment" => ""],
1501 "howlong" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1502 "sexual" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1503 "politic" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1504 "religion" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1505 "pub_keywords" => ["type" => "text", "comment" => ""],
1506 "prv_keywords" => ["type" => "text", "comment" => ""],
1507 "likes" => ["type" => "text", "comment" => ""],
1508 "dislikes" => ["type" => "text", "comment" => ""],
1509 "about" => ["type" => "text", "comment" => ""],
1510 "summary" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1511 "music" => ["type" => "text", "comment" => ""],
1512 "book" => ["type" => "text", "comment" => ""],
1513 "tv" => ["type" => "text", "comment" => ""],
1514 "film" => ["type" => "text", "comment" => ""],
1515 "interest" => ["type" => "text", "comment" => ""],
1516 "romance" => ["type" => "text", "comment" => ""],
1517 "work" => ["type" => "text", "comment" => ""],
1518 "education" => ["type" => "text", "comment" => ""],
1519 "contact" => ["type" => "text", "comment" => ""],
1520 "homepage" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1521 "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1522 "photo" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1523 "thumb" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1524 "publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish default profile in local directory"],
1525 "net-publish" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "publish profile in global directory"],
1528 "PRIMARY" => ["id"],
1529 "uid_is-default" => ["uid", "is-default"],
1532 $database["profile_check"] = [
1533 "comment" => "DFRN remote auth use",
1535 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1536 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1537 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "contact.id"],
1538 "dfrn_id" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1539 "sec" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1540 "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1543 "PRIMARY" => ["id"],
1546 $database["push_subscriber"] = [
1547 "comment" => "Used for OStatus: Contains feed subscribers",
1549 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1550 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1551 "callback_url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1552 "topic" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1553 "nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1554 "push" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1555 "last_update" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date of last successful trial"],
1556 "next_try" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Next retrial date"],
1557 "renewed" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date of last subscription renewal"],
1558 "secret" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1561 "PRIMARY" => ["id"],
1562 "next_try" => ["next_try"],
1565 $database["queue"] = [
1566 "comment" => "Queue for messages that couldn't be delivered",
1568 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1569 "cid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Message receiver"],
1570 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Receiver's network"],
1571 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Unique GUID of the message"],
1572 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date, when the message was created"],
1573 "last" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date of last trial"],
1574 "next" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Next retrial date"],
1575 "retrial" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
1576 "content" => ["type" => "mediumtext", "comment" => ""],
1577 "batch" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1580 "PRIMARY" => ["id"],
1585 $database["register"] = [
1586 "comment" => "registrations requiring admin approval",
1588 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1589 "hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1590 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1591 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1592 "password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1593 "language" => ["type" => "varchar(16)", "not null" => "1", "default" => "", "comment" => ""],
1594 "note" => ["type" => "text", "comment" => ""],
1597 "PRIMARY" => ["id"],
1600 $database["search"] = [
1603 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1604 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1605 "term" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1608 "PRIMARY" => ["id"],
1612 $database["session"] = [
1613 "comment" => "web session storage",
1615 "id" => ["type" => "bigint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1616 "sid" => ["type" => "varbinary(255)", "not null" => "1", "default" => "", "comment" => ""],
1617 "data" => ["type" => "text", "comment" => ""],
1618 "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1621 "PRIMARY" => ["id"],
1622 "sid" => ["sid(64)"],
1623 "expire" => ["expire"],
1626 $database["sign"] = [
1627 "comment" => "Diaspora signatures",
1629 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1630 "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => "item.id"],
1631 "signed_text" => ["type" => "mediumtext", "comment" => ""],
1632 "signature" => ["type" => "text", "comment" => ""],
1633 "signer" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1636 "PRIMARY" => ["id"],
1637 "iid" => ["UNIQUE", "iid"],
1640 $database["term"] = [
1641 "comment" => "item taxonomy (categories, tags, etc.) table",
1643 "tid" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
1644 "oid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["item" => "id"], "comment" => ""],
1645 "otype" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1646 "type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1647 "term" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1648 "url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1649 "guid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1650 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1651 "received" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1652 "global" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1653 "aid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1654 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1657 "PRIMARY" => ["tid"],
1658 "oid_otype_type_term" => ["oid","otype","type","term(32)"],
1659 "uid_otype_type_term_global_created" => ["uid","otype","type","term(32)","global","created"],
1660 "uid_otype_type_url" => ["uid","otype","type","url(64)"],
1661 "guid" => ["guid(64)"],
1664 $database["thread"] = [
1665 "comment" => "Thread related data",
1667 "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["item" => "id"], "comment" => "sequential ID"],
1668 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1669 "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => ""],
1670 "owner-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Item owner"],
1671 "author-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["contact" => "id"], "comment" => "Item author"],
1672 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1673 "edited" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1674 "commented" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1675 "received" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1676 "changed" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
1677 "wall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1678 "private" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1679 "pubmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1680 "moderated" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1681 "visible" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1682 "starred" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1683 "ignored" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1684 "bookmark" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1685 "unseen" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
1686 "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1687 "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1688 "forum_mode" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1689 "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1690 "network" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => ""],
1693 "PRIMARY" => ["iid"],
1694 "uid_network_commented" => ["uid","network","commented"],
1695 "uid_network_created" => ["uid","network","created"],
1696 "uid_contactid_commented" => ["uid","contact-id","commented"],
1697 "uid_contactid_created" => ["uid","contact-id","created"],
1698 "contactid" => ["contact-id"],
1699 "ownerid" => ["owner-id"],
1700 "authorid" => ["author-id"],
1701 "uid_created" => ["uid","created"],
1702 "uid_commented" => ["uid","commented"],
1703 "uid_wall_created" => ["uid","wall","created"],
1704 "private_wall_origin_commented" => ["private","wall","origin","commented"],
1707 $database["tokens"] = [
1708 "comment" => "OAuth usage",
1710 "id" => ["type" => "varchar(40)", "not null" => "1", "primary" => "1", "comment" => ""],
1711 "secret" => ["type" => "text", "comment" => ""],
1712 "client_id" => ["type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => ["clients" => "client_id"]],
1713 "expires" => ["type" => "int", "not null" => "1", "default" => "0", "comment" => ""],
1714 "scope" => ["type" => "varchar(200)", "not null" => "1", "default" => "", "comment" => ""],
1715 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
1718 "PRIMARY" => ["id"],
1721 $database["user"] = [
1722 "comment" => "The local users",
1724 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1725 "parent-uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "The parent user that has full control about this user"],
1726 "guid" => ["type" => "varchar(64)", "not null" => "1", "default" => "", "comment" => "A unique identifier for this user"],
1727 "username" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Name that this user is known by"],
1728 "password" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "encrypted password"],
1729 "legacy_password" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Is the password hash double-hashed?"],
1730 "nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "nick- and user name"],
1731 "email" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "the users email address"],
1732 "openid" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
1733 "timezone" => ["type" => "varchar(128)", "not null" => "1", "default" => "", "comment" => "PHP-legal timezone"],
1734 "language" => ["type" => "varchar(32)", "not null" => "1", "default" => "en", "comment" => "default language"],
1735 "register_date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "timestamp of registration"],
1736 "login_date" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "timestamp of last login"],
1737 "default-location" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Default for item.location"],
1738 "allow_location" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 allows to display the location"],
1739 "theme" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "user theme preference"],
1740 "pubkey" => ["type" => "text", "comment" => "RSA public key 4096 bit"],
1741 "prvkey" => ["type" => "text", "comment" => "RSA private key 4096 bit"],
1742 "spubkey" => ["type" => "text", "comment" => ""],
1743 "sprvkey" => ["type" => "text", "comment" => ""],
1744 "verified" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "user is verified through email"],
1745 "blocked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 for user is blocked"],
1746 "blockwall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Prohibit contacts to post to the profile page of the user"],
1747 "hidewall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Hide profile details from unkown viewers"],
1748 "blocktags" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Prohibit contacts to tag the post of this user"],
1749 "unkmail" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Permit unknown people to send private mails to this user"],
1750 "cntunkmail" => ["type" => "int unsigned", "not null" => "1", "default" => "10", "comment" => ""],
1751 "notify-flags" => ["type" => "smallint unsigned", "not null" => "1", "default" => "65535", "comment" => "email notification options"],
1752 "page-flags" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "page/profile type"],
1753 "account-type" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1754 "prvnets" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1755 "pwdreset" => ["type" => "varchar(255)", "comment" => "Password reset request token"],
1756 "pwdreset_time" => ["type" => "datetime", "comment" => "Timestamp of the last password reset request"],
1757 "maxreq" => ["type" => "int unsigned", "not null" => "1", "default" => "10", "comment" => ""],
1758 "expire" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1759 "account_removed" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "if 1 the account is removed"],
1760 "account_expired" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
1761 "account_expires_on" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "timestamp when account expires and will be deleted"],
1762 "expire_notification_sent" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "timestamp of last warning of account expiration"],
1763 "def_gid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => ""],
1764 "allow_cid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
1765 "allow_gid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
1766 "deny_cid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
1767 "deny_gid" => ["type" => "mediumtext", "comment" => "default permission for this user"],
1768 "openidserver" => ["type" => "text", "comment" => ""],
1771 "PRIMARY" => ["uid"],
1772 "nickname" => ["nickname(32)"],
1775 $database["userd"] = [
1776 "comment" => "Deleted usernames",
1778 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
1779 "username" => ["type" => "varchar(255)", "not null" => "1", "comment" => ""],
1782 "PRIMARY" => ["id"],
1783 "username" => ["username(32)"],
1786 $database["user-item"] = [
1787 "comment" => "User specific item data",
1789 "iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["item" => "id"], "comment" => "Item id"],
1790 "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["user" => "uid"], "comment" => "User id"],
1791 "hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide an item from the user"],
1794 "PRIMARY" => ["uid", "iid"],
1797 $database["workerqueue"] = [
1798 "comment" => "Background tasks queue entries",
1800 "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "Auto incremented worker task id"],
1801 "parameter" => ["type" => "mediumblob", "comment" => "Task command"],
1802 "priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Task priority"],
1803 "created" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Creation date"],
1804 "pid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "comment" => "Process id of the worker"],
1805 "executed" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Execution date"],
1806 "done" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marked 1 when the task was done - will be deleted later"],
1809 "PRIMARY" => ["id"],
1811 "parameter" => ["parameter(64)"],
1812 "priority_created" => ["priority", "created"],
1813 "done_executed" => ["done", "executed"],
1817 \Friendica\Core\Addon::callHooks('dbstructure_definition', $database);