3 use \Friendica\Core\Config;
5 require_once("boot.php");
6 require_once("include/text.php");
8 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
11 * send the email and do what is needed to do on update fails
13 * @param update_id (int) number of failed update
14 * @param error_message (str) error message
16 function update_fail($update_id, $error_message){
17 //send the administrators an e-mail
18 $admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
19 $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
24 if (!dbm::is_result($adminlist)) {
25 logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_WARNING);
31 // every admin could had different language
32 foreach ($adminlist as $admin) {
33 $lang = (($admin['language'])?$admin['language']:'en');
36 $preamble = deindent(t("
37 The friendica developers released update %s recently,
38 but when I tried to install it, something went terribly wrong.
39 This needs to be fixed soon and I can't do it alone. Please contact a
40 friendica developer if you can not help me on your own. My database might be invalid."));
41 $body = t("The error message is\n[pre]%s[/pre]");
42 $preamble = sprintf($preamble, $update_id);
43 $body = sprintf($body, $error_message);
46 'type' => "SYSTEM_EMAIL",
47 'to_email' => $admin['email'],
48 'preamble' => $preamble,
58 $email_tpl = get_intltext_template("update_fail_eml.tpl");
59 $email_msg = replace_macros($email_tpl, array(
60 '$sitename' => $a->config['sitename'],
61 '$siteurl' => App::get_baseurl(),
62 '$update' => DB_UPDATE_VERSION,
63 '$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
65 $subject=sprintf(t('Update Error at %s'), App::get_baseurl());
66 require_once('include/email.php');
67 $subject = email_header_encode($subject,'UTF-8');
68 mail($a->config['admin_email'], $subject, $email_msg,
69 'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n"
70 .'Content-type: text/plain; charset=UTF-8'."\n"
71 .'Content-transfer-encoding: 8bit');
74 logger("CRITICAL: Database structure update failed: ".$retval);
78 function table_structure($table) {
79 $structures = q("DESCRIBE `%s`", $table);
81 $full_columns = q("SHOW FULL COLUMNS FROM `%s`", $table);
83 $indexes = q("SHOW INDEX FROM `%s`", $table);
85 $table_status = q("SHOW TABLE STATUS WHERE `name` = '%s'", $table);
87 if (dbm::is_result($table_status)) {
88 $table_status = $table_status[0];
90 $table_status = array();
96 if (dbm::is_result($indexes))
97 foreach ($indexes AS $index) {
98 if ($index["Index_type"] == "FULLTEXT") {
102 if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
103 $indexdata[$index["Key_name"]] = array('UNIQUE');
106 $column = $index["Column_name"];
107 // On utf8mb4 a varchar index can only have a length of 191
108 // To avoid the need to add this to every index definition we just ignore it here.
109 // Exception are primary indexes
110 // Since there are some combindex primary indexes we use the limit of 180 here.
111 if (($index["Sub_part"] != "") AND (($index["Sub_part"] < 180) OR ($index["Key_name"] == "PRIMARY"))) {
112 $column .= "(".$index["Sub_part"].")";
115 $indexdata[$index["Key_name"]][] = $column;
117 if (dbm::is_result($structures)) {
118 foreach ($structures AS $field) {
119 $fielddata[$field["Field"]]["type"] = $field["Type"];
120 if ($field["Null"] == "NO") {
121 $fielddata[$field["Field"]]["not null"] = true;
124 if (isset($field["Default"])) {
125 $fielddata[$field["Field"]]["default"] = $field["Default"];
128 if ($field["Extra"] != "") {
129 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
132 if ($field["Key"] == "PRI") {
133 $fielddata[$field["Field"]]["primary"] = true;
137 if (dbm::is_result($full_columns)) {
138 foreach ($full_columns AS $column) {
139 $fielddata[$column["Field"]]["Collation"] = $column["Collation"];
143 return array("fields" => $fielddata, "indexes" => $indexdata, "table_status" => $table_status);
146 function print_structure($database) {
147 echo "-- ------------------------------------------\n";
148 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
149 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
150 echo "-- ------------------------------------------\n\n\n";
151 foreach ($database AS $name => $structure) {
153 echo "-- TABLE $name\n";
155 db_create_table($name, $structure['fields'], true, false, $structure["indexes"]);
161 function update_structure($verbose, $action, $tables=null, $definition=null) {
165 Config::set('system', 'maintenance', 1);
166 Config::set('system', 'maintenance_reason', sprintf(t(': Database update'), dbm::date().' '.date('e')));
171 logger('updating structure', LOGGER_DEBUG);
173 // Get the current structure
176 if (is_null($tables)) {
177 $tables = q("SHOW TABLES");
180 if (dbm::is_result($tables)) {
181 foreach ($tables AS $table) {
182 $table = current($table);
184 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
185 $database[$table] = table_structure($table);
189 // Get the definition
190 if (is_null($definition)) {
191 $definition = db_definition();
194 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
195 if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
196 !(strpos($db->server_info(), 'MariaDB') !== false)) {
203 foreach ($definition AS $name => $structure) {
204 $is_new_table = False;
207 if (!isset($database[$name])) {
208 $r = db_create_table($name, $structure["fields"], $verbose, $action, $structure['indexes']);
209 if (!dbm::is_result($r)) {
210 $errors .= t('Errors encountered creating database tables.').$name.EOL;
212 $is_new_table = True;
217 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
218 if (isset($database[$name]["indexes"][$indexname])) {
219 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
221 $current_index_definition = "__NOT_SET__";
223 $new_index_definition = implode(",",$fieldnames);
224 if ($current_index_definition != $new_index_definition) {
225 if ($fieldnames[0] == "UNIQUE") {
228 $temp_name = "temp-".$name;
235 * Drop the index if it isn't present in the definition
236 * or the definition differ from current status
237 * and index name doesn't start with "local_"
239 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
240 $current_index_definition = implode(",",$fieldnames);
241 if (isset($structure["indexes"][$indexname])) {
242 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
244 $new_index_definition = "__NOT_SET__";
246 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
247 $sql2=db_drop_index($indexname);
249 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
255 // Compare the field structure field by field
256 foreach ($structure["fields"] AS $fieldname => $parameters) {
257 if (!isset($database[$name]["fields"][$fieldname])) {
258 $sql2=db_add_table_field($fieldname, $parameters);
260 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
265 // Compare the field definition
266 // At first remove the collation from the array that is about to be compared
267 $field_definition = $database[$name]["fields"][$fieldname];
268 $collation = $field_definition['Collation'];
269 unset($field_definition['Collation']);
271 $current_field_definition = implode(",", $field_definition);
272 $new_field_definition = implode(",", $parameters);
273 if (($current_field_definition != $new_field_definition) OR
274 (!is_null($collation) AND ($collation != 'utf8mb4_general_ci'))) {
275 $sql2 = db_modify_table_field($fieldname, $parameters, $collation);
277 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
287 * Create the index if the index don't exists in database
288 * or the definition differ from the current status.
289 * Don't create keys if table is new
291 if (!$is_new_table) {
292 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
293 if (isset($database[$name]["indexes"][$indexname])) {
294 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
296 $current_index_definition = "__NOT_SET__";
298 $new_index_definition = implode(",",$fieldnames);
299 if ($current_index_definition != $new_index_definition) {
300 $sql2 = db_create_index($indexname, $fieldnames);
302 // Fetch the "group by" fields for unique indexes
303 if ($fieldnames[0] == "UNIQUE") {
304 $group_by = db_group_by($indexname, $fieldnames);
308 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
316 if (isset($database[$name]["table_status"]["Collation"])) {
317 if ($database[$name]["table_status"]["Collation"] != 'utf8mb4_general_ci') {
318 $sql2 = "DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci";
321 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
332 // Ensure index conversion to unique removes duplicates
335 echo "SET session old_alter_table=1;\n";
337 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
345 echo "SET session old_alter_table=0;\n";
347 echo "INSERT INTO `".$temp_name."` SELECT * FROM `".$name."`".$group_by.";\n";
348 echo "DROP TABLE `".$name."`;\n";
349 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
355 Config::set('system', 'maintenance_reason', sprintf(t('%s: updating %s table.'), dbm::date().' '.date('e'), $name));
357 // Ensure index conversion to unique removes duplicates
360 $db->q("SET session old_alter_table=1;");
362 $r = $db->q("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
363 if (!dbm::is_result($r)) {
364 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
371 if (!dbm::is_result($r))
372 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
376 $db->q("SET session old_alter_table=0;");
378 $r = $db->q("INSERT INTO `".$temp_name."` SELECT * FROM `".$name."`".$group_by.";");
379 if (!dbm::is_result($r)) {
380 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
383 $r = $db->q("DROP TABLE `".$name."`;");
384 if (!dbm::is_result($r)) {
385 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
388 $r = $db->q("RENAME TABLE `".$temp_name."` TO `".$name."`;");
389 if (!dbm::is_result($r)) {
390 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
400 Config::set('system', 'maintenance', 0);
401 Config::set('system', 'maintenance_reason', '');
407 function db_field_command($parameters, $collation = null, $create = true) {
408 $fieldstruct = $parameters["type"];
410 if (!is_null($collation)) {
411 $fieldstruct .= " CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci";
414 if ($parameters["not null"])
415 $fieldstruct .= " NOT NULL";
417 if (isset($parameters["default"])){
418 if (strpos(strtolower($parameters["type"]),"int")!==false) {
419 $fieldstruct .= " DEFAULT ".$parameters["default"];
421 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
424 if ($parameters["extra"] != "")
425 $fieldstruct .= " ".$parameters["extra"];
427 /*if (($parameters["primary"] != "") AND $create)
428 $fieldstruct .= " PRIMARY KEY";*/
430 return($fieldstruct);
433 function db_create_table($name, $fields, $verbose, $action, $indexes=null) {
441 $primary_keys = array();
442 foreach($fields AS $fieldname => $field) {
443 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
444 if (x($field,'primary') and $field['primary']!=''){
445 $primary_keys[] = $fieldname;
449 if (!is_null($indexes)) {
450 foreach ($indexes AS $indexname => $fieldnames) {
451 $sql_index = db_create_index($indexname, $fieldnames, "");
452 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
456 $sql = implode(",\n\t", $sql_rows);
458 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=utf8mb4";
468 function db_add_table_field($fieldname, $parameters) {
469 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
473 function db_modify_table_field($fieldname, $parameters, $collation) {
474 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, $collation, false));
478 function db_drop_index($indexname) {
479 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
483 function db_create_index($indexname, $fieldnames, $method="ADD") {
485 $method = strtoupper(trim($method));
486 if ($method!="" && $method!="ADD") {
487 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
491 if ($fieldnames[0] == "UNIQUE") {
492 array_shift($fieldnames);
493 $method .= ' UNIQUE';
497 foreach ($fieldnames AS $fieldname) {
501 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
502 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
504 $names .= "`".dbesc($fieldname)."`";
508 if ($indexname == "PRIMARY") {
509 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
513 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
517 function db_group_by($indexname, $fieldnames) {
519 if ($fieldnames[0] != "UNIQUE") {
523 array_shift($fieldnames);
526 foreach ($fieldnames AS $fieldname) {
530 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
531 $names .= "`".dbesc($matches[1])."`";
533 $names .= "`".dbesc($fieldname)."`";
537 $sql = sprintf(" GROUP BY %s", $names);
541 function db_definition() {
545 $database["addon"] = array(
547 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
548 "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
549 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
550 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
551 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
552 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
553 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
556 "PRIMARY" => array("id"),
557 "name" => array("UNIQUE", "name"),
560 $database["attach"] = array(
562 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
563 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
564 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
565 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
566 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
567 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
568 "data" => array("type" => "longblob", "not null" => "1"),
569 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
570 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
571 "allow_cid" => array("type" => "mediumtext"),
572 "allow_gid" => array("type" => "mediumtext"),
573 "deny_cid" => array("type" => "mediumtext"),
574 "deny_gid" => array("type" => "mediumtext"),
577 "PRIMARY" => array("id"),
580 $database["auth_codes"] = array(
582 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
583 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
584 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
585 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
586 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
589 "PRIMARY" => array("id"),
592 $database["cache"] = array(
594 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
595 "v" => array("type" => "mediumtext"),
596 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
597 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
600 "PRIMARY" => array("k"),
601 "expire_mode_updated" => array("expire_mode", "updated"),
604 $database["challenge"] = array(
606 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
607 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
608 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
609 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
610 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
611 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
614 "PRIMARY" => array("id"),
617 $database["clients"] = array(
619 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
620 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
621 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
622 "name" => array("type" => "text"),
623 "icon" => array("type" => "text"),
624 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
627 "PRIMARY" => array("client_id"),
630 $database["config"] = array(
632 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
633 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
634 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
635 "v" => array("type" => "mediumtext"),
638 "PRIMARY" => array("id"),
639 "cat_k" => array("UNIQUE", "cat", "k"),
642 $database["contact"] = array(
644 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
645 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
646 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
647 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
648 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
649 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
650 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
651 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
652 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
653 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
654 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
655 "about" => array("type" => "text"),
656 "keywords" => array("type" => "text"),
657 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
658 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
659 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
660 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
661 "photo" => array("type" => "text"),
662 "thumb" => array("type" => "text"),
663 "micro" => array("type" => "text"),
664 "site-pubkey" => array("type" => "text"),
665 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
666 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
667 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
668 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
669 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
670 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
671 "pubkey" => array("type" => "text"),
672 "prvkey" => array("type" => "text"),
673 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
674 "request" => array("type" => "text"),
675 "notify" => array("type" => "text"),
676 "poll" => array("type" => "text"),
677 "confirm" => array("type" => "text"),
678 "poco" => array("type" => "text"),
679 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
680 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
681 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
682 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
683 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
684 "last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
685 "success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
686 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
687 "name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
688 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
689 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
690 "term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
691 "last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
692 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
693 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
694 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
695 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
696 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
697 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
698 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
699 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
700 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
701 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
702 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
703 "reason" => array("type" => "text"),
704 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
705 "info" => array("type" => "mediumtext"),
706 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
707 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
708 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
709 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
710 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
711 "ffi_keyword_blacklist" => array("type" => "text"),
714 "PRIMARY" => array("id"),
715 "uid_name" => array("uid", "name"),
716 "self_uid" => array("self", "uid"),
717 "alias_uid" => array("alias(32)", "uid"),
718 "pending_uid" => array("pending", "uid"),
719 "blocked_uid" => array("blocked", "uid"),
720 "uid_rel_network_poll" => array("uid", "rel", "network", "poll(64)", "archive"),
721 "uid_network_batch" => array("uid", "network", "batch(64)"),
722 "addr_uid" => array("addr(32)", "uid"),
723 "nurl_uid" => array("nurl(32)", "uid"),
724 "nick_uid" => array("nick(32)", "uid"),
725 "dfrn-id" => array("dfrn-id"),
726 "issued-id" => array("issued-id"),
729 $database["conv"] = array(
731 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
732 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
733 "recips" => array("type" => "text"),
734 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
735 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
736 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
737 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
738 "subject" => array("type" => "text"),
741 "PRIMARY" => array("id"),
742 "uid" => array("uid"),
745 $database["event"] = array(
747 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
748 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
749 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
750 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
751 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
752 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
753 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
754 "start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
755 "finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
756 "summary" => array("type" => "text"),
757 "desc" => array("type" => "text"),
758 "location" => array("type" => "text"),
759 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
760 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
761 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
762 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
763 "allow_cid" => array("type" => "mediumtext"),
764 "allow_gid" => array("type" => "mediumtext"),
765 "deny_cid" => array("type" => "mediumtext"),
766 "deny_gid" => array("type" => "mediumtext"),
769 "PRIMARY" => array("id"),
770 "uid_start" => array("uid", "start"),
773 $database["fcontact"] = array(
775 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
776 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
777 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
778 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
779 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
780 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
781 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
782 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
783 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
784 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
785 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
786 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
787 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
788 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
789 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
790 "pubkey" => array("type" => "text"),
791 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
794 "PRIMARY" => array("id"),
795 "addr" => array("addr(32)"),
796 "url" => array("url"),
799 $database["ffinder"] = array(
801 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
802 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
803 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
804 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
807 "PRIMARY" => array("id"),
810 $database["fserver"] = array(
812 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
813 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
814 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
815 "key" => array("type" => "text"),
818 "PRIMARY" => array("id"),
819 "server" => array("server(32)"),
822 $database["fsuggest"] = array(
824 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
825 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
826 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
827 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
828 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
829 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
830 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
831 "note" => array("type" => "text"),
832 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
835 "PRIMARY" => array("id"),
838 $database["gcign"] = array(
840 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
841 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
842 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
845 "PRIMARY" => array("id"),
846 "uid" => array("uid"),
847 "gcid" => array("gcid"),
850 $database["gcontact"] = array(
852 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
853 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
854 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
855 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
856 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
857 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
858 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
859 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
860 "updated" => array("type" => "datetime", "default" => NULL_DATE),
861 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
862 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
863 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
864 "about" => array("type" => "text"),
865 "keywords" => array("type" => "text"),
866 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
867 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
868 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
869 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
870 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
871 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
872 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
873 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
874 "notify" => array("type" => "text"),
875 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
876 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
877 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
880 "PRIMARY" => array("id"),
881 "nurl" => array("nurl(64)"),
882 "name" => array("name(64)"),
883 "nick" => array("nick(32)"),
884 "addr" => array("addr(64)"),
885 "hide_network_updated" => array("hide", "network", "updated"),
886 "updated" => array("updated"),
889 $database["glink"] = array(
891 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
892 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
893 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
894 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
895 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
896 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
899 "PRIMARY" => array("id"),
900 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
901 "gcid" => array("gcid"),
904 $database["group"] = array(
906 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
907 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
908 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
909 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
910 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
913 "PRIMARY" => array("id"),
914 "uid" => array("uid"),
917 $database["group_member"] = array(
919 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
920 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
921 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
922 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
925 "PRIMARY" => array("id"),
926 "contactid" => array("contact-id"),
927 "gid_contactid" => array("gid", "contact-id"),
928 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
931 $database["gserver"] = array(
933 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
934 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
935 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
936 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
937 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
938 "info" => array("type" => "text"),
939 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
940 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
941 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
942 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
943 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
944 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
945 "last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
946 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
947 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
950 "PRIMARY" => array("id"),
951 "nurl" => array("nurl(32)"),
954 $database["hook"] = array(
956 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
957 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
958 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
959 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
960 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
963 "PRIMARY" => array("id"),
964 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
967 $database["intro"] = array(
969 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
970 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
971 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
972 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
973 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
974 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
975 "note" => array("type" => "text"),
976 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
977 "datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
978 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
979 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
982 "PRIMARY" => array("id"),
985 $database["item"] = array(
987 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
988 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
989 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
990 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
991 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
992 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
993 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
994 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
995 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
996 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
997 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
998 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
999 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1000 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1001 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1002 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1003 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1004 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1005 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1006 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1007 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1008 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1009 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1010 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1011 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1012 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1013 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1014 "body" => array("type" => "mediumtext"),
1015 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1016 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1017 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1018 "object" => array("type" => "text"),
1019 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1020 "target" => array("type" => "text"),
1021 "postopts" => array("type" => "text"),
1022 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1023 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1024 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1025 "tag" => array("type" => "mediumtext"),
1026 "attach" => array("type" => "mediumtext"),
1027 "inform" => array("type" => "mediumtext"),
1028 "file" => array("type" => "mediumtext"),
1029 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1030 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1031 "allow_cid" => array("type" => "mediumtext"),
1032 "allow_gid" => array("type" => "mediumtext"),
1033 "deny_cid" => array("type" => "mediumtext"),
1034 "deny_gid" => array("type" => "mediumtext"),
1035 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1036 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1037 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1038 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1039 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1040 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1041 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1042 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1043 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1044 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1045 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1046 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1047 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1048 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1049 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1050 "rendered-html" => array("type" => "mediumtext"),
1051 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1054 "PRIMARY" => array("id"),
1055 "guid" => array("guid"),
1056 "uri" => array("uri"),
1057 "parent" => array("parent"),
1058 "parent-uri" => array("parent-uri"),
1059 "extid" => array("extid"),
1060 "uid_id" => array("uid","id"),
1061 "uid_contactid_id" => array("uid","contact-id","id"),
1062 "uid_created" => array("uid","created"),
1063 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1064 "uid_network_received" => array("uid","network","received"),
1065 "uid_network_commented" => array("uid","network","commented"),
1066 "uid_thrparent" => array("uid","thr-parent"),
1067 "uid_parenturi" => array("uid","parent-uri"),
1068 "uid_contactid_created" => array("uid","contact-id","created"),
1069 "authorid_created" => array("author-id","created"),
1070 "uid_uri" => array("uid", "uri"),
1071 "resource-id" => array("resource-id"),
1072 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1073 "uid_type_changed" => array("uid","type","changed"),
1074 "contactid_verb" => array("contact-id","verb"),
1075 "deleted_changed" => array("deleted","changed"),
1076 "uid_wall_changed" => array("uid","wall","changed"),
1077 "uid_eventid" => array("uid","event-id"),
1078 "uid_authorlink" => array("uid","author-link"),
1079 "uid_ownerlink" => array("uid","owner-link"),
1082 $database["item_id"] = array(
1084 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1085 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1086 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1087 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1088 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1091 "PRIMARY" => array("id"),
1092 "uid" => array("uid"),
1093 "sid" => array("sid"),
1094 "service" => array("service(32)"),
1095 "iid" => array("iid"),
1098 $database["locks"] = array(
1100 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1101 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1102 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1103 "created" => array("type" => "datetime", "default" => NULL_DATE),
1106 "PRIMARY" => array("id"),
1109 $database["mail"] = array(
1111 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1112 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1113 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1114 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1115 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1116 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1117 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1118 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1119 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1120 "body" => array("type" => "mediumtext"),
1121 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1122 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1123 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1124 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1125 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1126 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1127 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1130 "PRIMARY" => array("id"),
1131 "uid_seen" => array("uid", "seen"),
1132 "convid" => array("convid"),
1133 "uri" => array("uri(64)"),
1134 "parent-uri" => array("parent-uri(64)"),
1137 $database["mailacct"] = array(
1139 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1140 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1141 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1142 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1143 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1144 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1145 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1146 "pass" => array("type" => "text"),
1147 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1148 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1149 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1150 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1151 "last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1154 "PRIMARY" => array("id"),
1157 $database["manage"] = array(
1159 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1160 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1161 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1164 "PRIMARY" => array("id"),
1165 "uid_mid" => array("UNIQUE", "uid","mid"),
1168 $database["notify"] = array(
1170 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1171 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1172 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1173 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1174 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1175 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1176 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1177 "msg" => array("type" => "mediumtext"),
1178 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1179 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1180 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1181 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1182 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1183 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1184 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1185 "name_cache" => array("type" => "tinytext"),
1186 "msg_cache" => array("type" => "mediumtext")
1189 "PRIMARY" => array("id"),
1190 "hash_uid" => array("hash", "uid"),
1191 "seen_uid_date" => array("seen", "uid", "date"),
1192 "uid_date" => array("uid", "date"),
1193 "uid_type_link" => array("uid", "type", "link"),
1196 $database["notify-threads"] = array(
1198 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1199 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1200 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1201 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1202 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1205 "PRIMARY" => array("id"),
1208 $database["oembed"] = array(
1210 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1211 "content" => array("type" => "mediumtext"),
1212 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1215 "PRIMARY" => array("url"),
1216 "created" => array("created"),
1219 $database["parsed_url"] = array(
1221 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1222 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1223 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1224 "content" => array("type" => "mediumtext"),
1225 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1228 "PRIMARY" => array("url", "guessing", "oembed"),
1229 "created" => array("created"),
1232 $database["pconfig"] = array(
1234 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1235 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1236 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1237 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1238 "v" => array("type" => "mediumtext"),
1241 "PRIMARY" => array("id"),
1242 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1245 $database["photo"] = array(
1247 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1248 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1249 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1250 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1251 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1252 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1253 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1254 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1255 "desc" => array("type" => "text"),
1256 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1257 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1258 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1259 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1260 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1261 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1262 "data" => array("type" => "mediumblob", "not null" => "1"),
1263 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1264 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1265 "allow_cid" => array("type" => "mediumtext"),
1266 "allow_gid" => array("type" => "mediumtext"),
1267 "deny_cid" => array("type" => "mediumtext"),
1268 "deny_gid" => array("type" => "mediumtext"),
1271 "PRIMARY" => array("id"),
1272 "uid_contactid" => array("uid", "contact-id"),
1273 "uid_profile" => array("uid", "profile"),
1274 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1275 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1276 "resource-id" => array("resource-id(64)"),
1279 $database["poll"] = array(
1281 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1282 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1283 "q0" => array("type" => "text"),
1284 "q1" => array("type" => "text"),
1285 "q2" => array("type" => "text"),
1286 "q3" => array("type" => "text"),
1287 "q4" => array("type" => "text"),
1288 "q5" => array("type" => "text"),
1289 "q6" => array("type" => "text"),
1290 "q7" => array("type" => "text"),
1291 "q8" => array("type" => "text"),
1292 "q9" => array("type" => "text"),
1295 "PRIMARY" => array("id"),
1296 "uid" => array("uid"),
1299 $database["poll_result"] = array(
1301 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1302 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1303 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1306 "PRIMARY" => array("id"),
1307 "poll_id" => array("poll_id"),
1308 "choice" => array("choice"),
1311 $database["process"] = array(
1313 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1314 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1315 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1318 "PRIMARY" => array("pid"),
1319 "command" => array("command"),
1322 $database["profile"] = array(
1324 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1325 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1326 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1327 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1328 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1329 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1330 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1331 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1332 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1333 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1334 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1335 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1336 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1337 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1338 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1339 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1340 "with" => array("type" => "text"),
1341 "howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1342 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1343 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1344 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1345 "pub_keywords" => array("type" => "text"),
1346 "prv_keywords" => array("type" => "text"),
1347 "likes" => array("type" => "text"),
1348 "dislikes" => array("type" => "text"),
1349 "about" => array("type" => "text"),
1350 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1351 "music" => array("type" => "text"),
1352 "book" => array("type" => "text"),
1353 "tv" => array("type" => "text"),
1354 "film" => array("type" => "text"),
1355 "interest" => array("type" => "text"),
1356 "romance" => array("type" => "text"),
1357 "work" => array("type" => "text"),
1358 "education" => array("type" => "text"),
1359 "contact" => array("type" => "text"),
1360 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1361 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1362 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1363 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1364 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1365 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1368 "PRIMARY" => array("id"),
1369 "uid_is-default" => array("uid", "is-default"),
1372 $database["profile_check"] = array(
1374 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1375 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1376 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1377 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1378 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1379 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1382 "PRIMARY" => array("id"),
1385 $database["push_subscriber"] = array(
1387 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1388 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1389 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1390 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1391 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1392 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1393 "last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1394 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1397 "PRIMARY" => array("id"),
1400 $database["queue"] = array(
1402 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1403 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1404 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1405 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1406 "last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1407 "content" => array("type" => "mediumtext"),
1408 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1411 "PRIMARY" => array("id"),
1412 "cid" => array("cid"),
1413 "created" => array("created"),
1414 "last" => array("last"),
1415 "network" => array("network"),
1416 "batch" => array("batch"),
1419 $database["register"] = array(
1421 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1422 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1423 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1424 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1425 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1426 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1427 "note" => array("type" => "text"),
1430 "PRIMARY" => array("id"),
1433 $database["search"] = array(
1435 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1436 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1437 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1440 "PRIMARY" => array("id"),
1441 "uid" => array("uid"),
1444 $database["session"] = array(
1446 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1447 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1448 "data" => array("type" => "text"),
1449 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1452 "PRIMARY" => array("id"),
1453 "sid" => array("sid(64)"),
1454 "expire" => array("expire"),
1457 $database["sign"] = array(
1459 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1460 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1461 "signed_text" => array("type" => "mediumtext"),
1462 "signature" => array("type" => "text"),
1463 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1466 "PRIMARY" => array("id"),
1467 "iid" => array("iid"),
1470 $database["spam"] = array(
1472 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1473 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1474 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1475 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1476 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1477 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1480 "PRIMARY" => array("id"),
1481 "uid" => array("uid"),
1482 "spam" => array("spam"),
1483 "ham" => array("ham"),
1484 "term" => array("term"),
1487 $database["term"] = array(
1489 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1490 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1491 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1492 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1493 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1494 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1495 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1496 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1497 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1498 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1499 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1500 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1503 "PRIMARY" => array("tid"),
1504 "oid_otype_type_term" => array("oid","otype","type","term"),
1505 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1506 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1507 "guid" => array("guid(64)"),
1510 $database["thread"] = array(
1512 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1513 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1514 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1515 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1516 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1517 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1518 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1519 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1520 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1521 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1522 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1523 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1524 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1525 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1526 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1527 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1528 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1529 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1530 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1531 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1532 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1533 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1534 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1535 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1536 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1537 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1540 "PRIMARY" => array("iid"),
1541 "uid_network_commented" => array("uid","network","commented"),
1542 "uid_network_created" => array("uid","network","created"),
1543 "uid_contactid_commented" => array("uid","contact-id","commented"),
1544 "uid_contactid_created" => array("uid","contact-id","created"),
1545 "uid_created" => array("uid","created"),
1546 "uid_commented" => array("uid","commented"),
1547 "uid_wall_created" => array("uid","wall","created"),
1550 $database["tokens"] = array(
1552 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1553 "secret" => array("type" => "text"),
1554 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1555 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1556 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1557 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1560 "PRIMARY" => array("id"),
1563 $database["user"] = array(
1565 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1566 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1567 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1568 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1569 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1570 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1571 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1572 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1573 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1574 "register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1575 "login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1576 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1577 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1578 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1579 "pubkey" => array("type" => "text"),
1580 "prvkey" => array("type" => "text"),
1581 "spubkey" => array("type" => "text"),
1582 "sprvkey" => array("type" => "text"),
1583 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1584 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1585 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1586 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1587 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1588 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1589 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1590 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1591 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1592 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1593 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1594 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1595 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1596 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1597 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1598 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1599 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1600 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1601 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1602 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1603 "allow_cid" => array("type" => "mediumtext"),
1604 "allow_gid" => array("type" => "mediumtext"),
1605 "deny_cid" => array("type" => "mediumtext"),
1606 "deny_gid" => array("type" => "mediumtext"),
1607 "openidserver" => array("type" => "text"),
1610 "PRIMARY" => array("uid"),
1611 "nickname" => array("nickname(32)"),
1614 $database["userd"] = array(
1616 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1617 "username" => array("type" => "varchar(255)", "not null" => "1"),
1620 "PRIMARY" => array("id"),
1621 "username" => array("username(32)"),
1624 $database["workerqueue"] = array(
1626 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1627 "parameter" => array("type" => "text"),
1628 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1629 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1630 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1631 "executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1634 "PRIMARY" => array("id"),
1643 * run from command line
1645 function dbstructure_run(&$argv, &$argc) {
1653 @include(".htconfig.php");
1654 require_once("include/dba.php");
1655 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1656 unset($db_host, $db_user, $db_pass, $db_data);
1662 update_structure(true, false);
1665 update_structure(true, true);
1667 $build = get_config('system','build');
1669 set_config('system','build',DB_UPDATE_VERSION);
1670 $build = DB_UPDATE_VERSION;
1673 $stored = intval($build);
1674 $current = intval(DB_UPDATE_VERSION);
1676 // run any left update_nnnn functions in update.php
1677 for($x = $stored; $x < $current; $x ++) {
1678 $r = run_update_function($x);
1682 set_config('system','build',DB_UPDATE_VERSION);
1685 print_structure(db_definition());
1692 echo $argv[0]." <command>\n";
1695 echo "dryrun show database update schema queries without running them\n";
1696 echo "update update database schema\n";
1697 echo "dumpsql dump database schema\n";
1702 if (array_search(__file__,get_included_files())===0){
1703 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);