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 $indexes = q("SHOW INDEX FROM `%s`", $table);
86 if (dbm::is_result($indexes))
87 foreach ($indexes AS $index) {
88 if ($index["Index_type"] == "FULLTEXT") {
92 if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
93 $indexdata[$index["Key_name"]] = array('UNIQUE');
96 $column = $index["Column_name"];
97 // On utf8mb4 a varchar index can only have a length of 191
98 // To avoid the need to add this to every index definition we just ignore it here.
99 // Exception are primary indexes
100 // Since there are some combindex primary indexes we use the limit of 180 here.
101 if (($index["Sub_part"] != "") AND (($index["Sub_part"] < 180) OR ($index["Key_name"] == "PRIMARY"))) {
102 $column .= "(".$index["Sub_part"].")";
105 $indexdata[$index["Key_name"]][] = $column;
108 if (dbm::is_result($structures)) {
109 foreach ($structures AS $field) {
110 $fielddata[$field["Field"]]["type"] = $field["Type"];
111 if ($field["Null"] == "NO") {
112 $fielddata[$field["Field"]]["not null"] = true;
115 if (isset($field["Default"])) {
116 $fielddata[$field["Field"]]["default"] = $field["Default"];
119 if ($field["Extra"] != "") {
120 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
123 if ($field["Key"] == "PRI") {
124 $fielddata[$field["Field"]]["primary"] = true;
128 return(array("fields"=>$fielddata, "indexes"=>$indexdata));
131 function print_structure($database, $charset) {
132 echo "-- ------------------------------------------\n";
133 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
134 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
135 echo "-- ------------------------------------------\n\n\n";
136 foreach ($database AS $name => $structure) {
138 echo "-- TABLE $name\n";
140 db_create_table($name, $structure['fields'], $charset, true, false, $structure["indexes"]);
146 function update_structure($verbose, $action, $tables=null, $definition=null) {
150 Config::set('system', 'maintenance', 1);
151 Config::set('system', 'maintenance_reason', 'Database update');
154 if (isset($a->config["system"]["db_charset"])) {
155 $charset = $a->config["system"]["db_charset"];
162 logger('updating structure', LOGGER_DEBUG);
164 // Get the current structure
167 if (is_null($tables)) {
168 $tables = q("SHOW TABLES");
171 foreach ($tables AS $table) {
172 $table = current($table);
174 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
175 $database[$table] = table_structure($table);
178 // Get the definition
179 if (is_null($definition)) {
180 $definition = db_definition($charset);
183 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
184 if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
185 !(strpos($db->server_info(), 'MariaDB') !== false)) {
192 foreach ($definition AS $name => $structure) {
193 $is_new_table = False;
196 if (!isset($database[$name])) {
197 $r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']);
198 if (!dbm::is_result($r)) {
199 $errors .= t('Errors encountered creating database tables.').$name.EOL;
201 $is_new_table = True;
206 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
207 if (isset($database[$name]["indexes"][$indexname])) {
208 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
210 $current_index_definition = "__NOT_SET__";
212 $new_index_definition = implode(",",$fieldnames);
213 if ($current_index_definition != $new_index_definition) {
214 if ($fieldnames[0] == "UNIQUE") {
217 $temp_name = "temp-".$name;
224 * Drop the index if it isn't present in the definition
225 * or the definition differ from current status
226 * and index name doesn't start with "local_"
228 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
229 $current_index_definition = implode(",",$fieldnames);
230 if (isset($structure["indexes"][$indexname])) {
231 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
233 $new_index_definition = "__NOT_SET__";
235 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
236 $sql2=db_drop_index($indexname);
238 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
244 // Compare the field structure field by field
245 foreach ($structure["fields"] AS $fieldname => $parameters) {
246 if (!isset($database[$name]["fields"][$fieldname])) {
247 $sql2=db_add_table_field($fieldname, $parameters);
249 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
254 // Compare the field definition
255 $current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
256 $new_field_definition = implode(",",$parameters);
257 if ($current_field_definition != $new_field_definition) {
258 $sql2=db_modify_table_field($fieldname, $parameters);
260 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
271 * Create the index if the index don't exists in database
272 * or the definition differ from the current status.
273 * Don't create keys if table is new
275 if (!$is_new_table) {
276 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
277 if (isset($database[$name]["indexes"][$indexname])) {
278 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
280 $current_index_definition = "__NOT_SET__";
282 $new_index_definition = implode(",",$fieldnames);
283 if ($current_index_definition != $new_index_definition) {
284 $sql2 = db_create_index($indexname, $fieldnames);
286 // Fetch the "group by" fields for unique indexes
287 if ($fieldnames[0] == "UNIQUE") {
288 $group_by = db_group_by($indexname, $fieldnames);
292 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
303 // Ensure index conversion to unique removes duplicates
306 echo "SET session old_alter_table=1;\n";
308 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
316 echo "SET session old_alter_table=0;\n";
318 echo "INSERT INTO `".$temp_name."` SELECT * FROM `".$name."`".$group_by.";\n";
319 echo "DROP TABLE `".$name."`;\n";
320 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
326 // Ensure index conversion to unique removes duplicates
329 $db->q("SET session old_alter_table=1;");
331 $r = $db->q("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
332 if (!dbm::is_result($r)) {
333 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
340 if (!dbm::is_result($r))
341 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
345 $db->q("SET session old_alter_table=0;");
347 $r = $db->q("INSERT INTO `".$temp_name."` SELECT * FROM `".$name."`".$group_by.";");
348 if (!dbm::is_result($r)) {
349 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
352 $r = $db->q("DROP TABLE `".$name."`;");
353 if (!dbm::is_result($r)) {
354 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
357 $r = $db->q("RENAME TABLE `".$temp_name."` TO `".$name."`;");
358 if (!dbm::is_result($r)) {
359 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
369 Config::set('system', 'maintenance', 0);
370 Config::set('system', 'maintenance_reason', '');
376 function db_field_command($parameters, $create = true) {
377 $fieldstruct = $parameters["type"];
379 if ($parameters["not null"])
380 $fieldstruct .= " NOT NULL";
382 if (isset($parameters["default"])){
383 if (strpos(strtolower($parameters["type"]),"int")!==false) {
384 $fieldstruct .= " DEFAULT ".$parameters["default"];
386 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
389 if ($parameters["extra"] != "")
390 $fieldstruct .= " ".$parameters["extra"];
392 /*if (($parameters["primary"] != "") AND $create)
393 $fieldstruct .= " PRIMARY KEY";*/
395 return($fieldstruct);
398 function db_create_table($name, $fields, $charset, $verbose, $action, $indexes=null) {
406 $primary_keys = array();
407 foreach($fields AS $fieldname => $field) {
408 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
409 if (x($field,'primary') and $field['primary']!=''){
410 $primary_keys[] = $fieldname;
414 if (!is_null($indexes)) {
415 foreach ($indexes AS $indexname => $fieldnames) {
416 $sql_index = db_create_index($indexname, $fieldnames, "");
417 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
421 $sql = implode(",\n\t", $sql_rows);
423 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=".$charset;
433 function db_add_table_field($fieldname, $parameters) {
434 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
438 function db_modify_table_field($fieldname, $parameters) {
439 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
443 function db_drop_index($indexname) {
444 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
448 function db_create_index($indexname, $fieldnames, $method="ADD") {
450 $method = strtoupper(trim($method));
451 if ($method!="" && $method!="ADD") {
452 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
456 if ($fieldnames[0] == "UNIQUE") {
457 array_shift($fieldnames);
458 $method .= ' UNIQUE';
462 foreach ($fieldnames AS $fieldname) {
466 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
467 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
469 $names .= "`".dbesc($fieldname)."`";
473 if ($indexname == "PRIMARY") {
474 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
478 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
482 function db_group_by($indexname, $fieldnames) {
484 if ($fieldnames[0] != "UNIQUE") {
488 array_shift($fieldnames);
491 foreach ($fieldnames AS $fieldname) {
495 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
496 $names .= "`".dbesc($matches[1])."`";
498 $names .= "`".dbesc($fieldname)."`";
502 $sql = sprintf(" GROUP BY %s", $names);
506 function db_index_suffix($charset, $reduce = 0) {
507 if ($charset != "utf8mb4") {
511 // On utf8mb4 indexes can only have a length of 191
512 $indexlength = 191 - $reduce;
514 return "(".$indexlength.")";
517 function db_definition($charset) {
521 $database["addon"] = array(
523 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
524 "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
525 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
526 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
527 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
528 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
529 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
532 "PRIMARY" => array("id"),
533 "name" => array("UNIQUE", "name"),
536 $database["attach"] = array(
538 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
539 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
540 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
541 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
542 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
543 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
544 "data" => array("type" => "longblob", "not null" => "1"),
545 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
546 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
547 "allow_cid" => array("type" => "mediumtext"),
548 "allow_gid" => array("type" => "mediumtext"),
549 "deny_cid" => array("type" => "mediumtext"),
550 "deny_gid" => array("type" => "mediumtext"),
553 "PRIMARY" => array("id"),
556 $database["auth_codes"] = array(
558 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
559 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
560 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
561 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
562 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
565 "PRIMARY" => array("id"),
568 $database["cache"] = array(
570 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
571 "v" => array("type" => "mediumtext"),
572 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
573 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
576 "PRIMARY" => array("k"),
577 "expire_mode_updated" => array("expire_mode", "updated"),
580 $database["challenge"] = array(
582 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
583 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
584 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
585 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
586 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
587 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
590 "PRIMARY" => array("id"),
593 $database["clients"] = array(
595 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
596 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
597 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
598 "name" => array("type" => "text"),
599 "icon" => array("type" => "text"),
600 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
603 "PRIMARY" => array("client_id"),
606 $database["config"] = array(
608 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
609 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
610 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
611 "v" => array("type" => "mediumtext"),
614 "PRIMARY" => array("id"),
615 "cat_k" => array("UNIQUE", "cat", "k"),
618 $database["contact"] = array(
620 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
621 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
622 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
623 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
624 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
625 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
626 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
627 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
628 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
629 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
630 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
631 "about" => array("type" => "text"),
632 "keywords" => array("type" => "text"),
633 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
634 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
635 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
636 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
637 "photo" => array("type" => "text"),
638 "thumb" => array("type" => "text"),
639 "micro" => array("type" => "text"),
640 "site-pubkey" => array("type" => "text"),
641 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
642 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
643 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
644 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
645 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
646 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
647 "pubkey" => array("type" => "text"),
648 "prvkey" => array("type" => "text"),
649 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
650 "request" => array("type" => "text"),
651 "notify" => array("type" => "text"),
652 "poll" => array("type" => "text"),
653 "confirm" => array("type" => "text"),
654 "poco" => array("type" => "text"),
655 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
656 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
657 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
658 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
659 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
660 "last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
661 "success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
662 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
663 "name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
664 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
665 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
666 "term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
667 "last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
668 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
669 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
670 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
671 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
672 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
673 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
674 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
675 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
676 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
677 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
678 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
679 "reason" => array("type" => "text"),
680 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
681 "info" => array("type" => "mediumtext"),
682 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
683 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
684 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
685 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
686 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
687 "ffi_keyword_blacklist" => array("type" => "text"),
690 "PRIMARY" => array("id"),
691 "uid_name" => array("uid", "name"),
692 "self_uid" => array("self", "uid"),
693 "alias_uid" => array("alias(32)", "uid"),
694 "pending_uid" => array("pending", "uid"),
695 "blocked_uid" => array("blocked", "uid"),
696 "uid_rel_network_poll" => array("uid", "rel", "network", "poll(64)", "archive"),
697 "uid_network_batch" => array("uid", "network", "batch(64)"),
698 "addr_uid" => array("addr(32)", "uid"),
699 "nurl_uid" => array("nurl(32)", "uid"),
700 "nick_uid" => array("nick(32)", "uid"),
701 "dfrn-id" => array("dfrn-id"),
702 "issued-id" => array("issued-id"),
705 $database["conv"] = array(
707 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
708 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
709 "recips" => array("type" => "text"),
710 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
711 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
712 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
713 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
714 "subject" => array("type" => "text"),
717 "PRIMARY" => array("id"),
718 "uid" => array("uid"),
721 $database["event"] = array(
723 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
724 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
725 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
726 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
727 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
728 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
729 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
730 "start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
731 "finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
732 "summary" => array("type" => "text"),
733 "desc" => array("type" => "text"),
734 "location" => array("type" => "text"),
735 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
736 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
737 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
738 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
739 "allow_cid" => array("type" => "mediumtext"),
740 "allow_gid" => array("type" => "mediumtext"),
741 "deny_cid" => array("type" => "mediumtext"),
742 "deny_gid" => array("type" => "mediumtext"),
745 "PRIMARY" => array("id"),
746 "uid_start" => array("uid", "start"),
749 $database["fcontact"] = array(
751 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
752 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
753 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
754 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
755 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
756 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
757 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
758 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
759 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
760 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
761 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
762 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
763 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
764 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
765 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
766 "pubkey" => array("type" => "text"),
767 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
770 "PRIMARY" => array("id"),
771 "addr" => array("addr(32)"),
772 "url" => array("url"),
775 $database["ffinder"] = array(
777 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
778 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
779 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
780 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
783 "PRIMARY" => array("id"),
786 $database["fserver"] = array(
788 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
789 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
790 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
791 "key" => array("type" => "text"),
794 "PRIMARY" => array("id"),
795 "server" => array("server(32)"),
798 $database["fsuggest"] = array(
800 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
801 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
802 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
803 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
804 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
805 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
806 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
807 "note" => array("type" => "text"),
808 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
811 "PRIMARY" => array("id"),
814 $database["gcign"] = array(
816 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
817 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
818 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
821 "PRIMARY" => array("id"),
822 "uid" => array("uid"),
823 "gcid" => array("gcid"),
826 $database["gcontact"] = array(
828 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
829 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
830 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
831 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
832 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
833 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
834 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
835 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
836 "updated" => array("type" => "datetime", "default" => NULL_DATE),
837 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
838 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
839 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
840 "about" => array("type" => "text"),
841 "keywords" => array("type" => "text"),
842 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
843 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
844 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
845 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
846 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
847 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
848 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
849 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
850 "notify" => array("type" => "text"),
851 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
852 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
853 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
856 "PRIMARY" => array("id"),
857 "nurl" => array("nurl(64)"),
858 "name" => array("name(64)"),
859 "nick" => array("nick(32)"),
860 "addr" => array("addr(64)"),
861 "hide_network_updated" => array("hide", "network", "updated"),
862 "updated" => array("updated"),
865 $database["glink"] = array(
867 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
868 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
869 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
870 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
871 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
872 "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
875 "PRIMARY" => array("id"),
876 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
877 "gcid" => array("gcid"),
880 $database["group"] = array(
882 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
883 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
884 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
885 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
886 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
889 "PRIMARY" => array("id"),
890 "uid" => array("uid"),
893 $database["group_member"] = array(
895 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
896 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
897 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
898 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
901 "PRIMARY" => array("id"),
902 "contactid" => array("contact-id"),
903 "gid_contactid" => array("gid", "contact-id"),
904 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
907 $database["gserver"] = array(
909 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
910 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
911 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
912 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
913 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
914 "info" => array("type" => "text"),
915 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
916 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
917 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
918 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
919 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
920 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
921 "last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
922 "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
923 "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
926 "PRIMARY" => array("id"),
927 "nurl" => array("nurl(32)"),
930 $database["hook"] = array(
932 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
933 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
934 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
935 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
936 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
939 "PRIMARY" => array("id"),
940 "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
943 $database["intro"] = array(
945 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
946 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
947 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
948 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
949 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
950 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
951 "note" => array("type" => "text"),
952 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
953 "datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
954 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
955 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
958 "PRIMARY" => array("id"),
961 $database["item"] = array(
963 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
964 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
965 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
966 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
967 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
968 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
969 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
970 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
971 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
972 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
973 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
974 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
975 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
976 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
977 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
978 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
979 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
980 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
981 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
982 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
983 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
984 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
985 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
986 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
987 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
988 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
989 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
990 "body" => array("type" => "mediumtext"),
991 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
992 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
993 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
994 "object" => array("type" => "text"),
995 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
996 "target" => array("type" => "text"),
997 "postopts" => array("type" => "text"),
998 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
999 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1000 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1001 "tag" => array("type" => "mediumtext"),
1002 "attach" => array("type" => "mediumtext"),
1003 "inform" => array("type" => "mediumtext"),
1004 "file" => array("type" => "mediumtext"),
1005 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1006 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1007 "allow_cid" => array("type" => "mediumtext"),
1008 "allow_gid" => array("type" => "mediumtext"),
1009 "deny_cid" => array("type" => "mediumtext"),
1010 "deny_gid" => array("type" => "mediumtext"),
1011 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1012 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1013 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1014 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1015 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1016 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1017 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1018 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1019 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1020 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1021 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1022 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1023 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1024 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1025 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1026 "rendered-html" => array("type" => "mediumtext"),
1027 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1030 "PRIMARY" => array("id"),
1031 "guid" => array("guid"),
1032 "uri" => array("uri"),
1033 "parent" => array("parent"),
1034 "parent-uri" => array("parent-uri"),
1035 "extid" => array("extid"),
1036 "uid_id" => array("uid","id"),
1037 "uid_contactid_id" => array("uid","contact-id","id"),
1038 "uid_created" => array("uid","created"),
1039 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1040 "uid_network_received" => array("uid","network","received"),
1041 "uid_network_commented" => array("uid","network","commented"),
1042 "uid_thrparent" => array("uid","thr-parent"),
1043 "uid_parenturi" => array("uid","parent-uri"),
1044 "uid_contactid_created" => array("uid","contact-id","created"),
1045 "authorid_created" => array("author-id","created"),
1046 "uid_uri" => array("uid", "uri"),
1047 "resource-id" => array("resource-id"),
1048 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1049 "uid_type_changed" => array("uid","type","changed"),
1050 "contactid_verb" => array("contact-id","verb"),
1051 "deleted_changed" => array("deleted","changed"),
1052 "uid_wall_changed" => array("uid","wall","changed"),
1053 "uid_eventid" => array("uid","event-id"),
1054 "uid_authorlink" => array("uid","author-link"),
1055 "uid_ownerlink" => array("uid","owner-link"),
1058 $database["item_id"] = array(
1060 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1061 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1062 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1063 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1064 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1067 "PRIMARY" => array("id"),
1068 "uid" => array("uid"),
1069 "sid" => array("sid"),
1070 "service" => array("service(32)"),
1071 "iid" => array("iid"),
1074 $database["locks"] = array(
1076 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1077 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1078 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1079 "created" => array("type" => "datetime", "default" => NULL_DATE),
1082 "PRIMARY" => array("id"),
1085 $database["mail"] = array(
1087 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1088 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1089 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1090 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1091 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1092 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1093 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1094 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1095 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1096 "body" => array("type" => "mediumtext"),
1097 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1098 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1099 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1100 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1101 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1102 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1103 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1106 "PRIMARY" => array("id"),
1107 "uid_seen" => array("uid", "seen"),
1108 "convid" => array("convid"),
1109 "uri" => array("uri(64)"),
1110 "parent-uri" => array("parent-uri(64)"),
1113 $database["mailacct"] = array(
1115 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1116 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1117 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1118 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1119 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1120 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1121 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1122 "pass" => array("type" => "text"),
1123 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1124 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1125 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1126 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1127 "last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1130 "PRIMARY" => array("id"),
1133 $database["manage"] = array(
1135 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1136 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1137 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1140 "PRIMARY" => array("id"),
1141 "uid_mid" => array("UNIQUE", "uid","mid"),
1144 $database["notify"] = array(
1146 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1147 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1148 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1149 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1150 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1151 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1152 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1153 "msg" => array("type" => "mediumtext"),
1154 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1155 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1156 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1157 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1158 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1159 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1160 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1161 "name_cache" => array("type" => "tinytext"),
1162 "msg_cache" => array("type" => "mediumtext")
1165 "PRIMARY" => array("id"),
1166 "hash_uid" => array("hash", "uid"),
1167 "seen_uid_date" => array("seen", "uid", "date"),
1168 "uid_date" => array("uid", "date"),
1169 "uid_type_link" => array("uid", "type", "link"),
1172 $database["notify-threads"] = array(
1174 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1175 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1176 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1177 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1178 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1181 "PRIMARY" => array("id"),
1184 $database["oembed"] = array(
1186 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1187 "content" => array("type" => "mediumtext"),
1188 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1191 "PRIMARY" => array("url"),
1192 "created" => array("created"),
1195 $database["parsed_url"] = array(
1197 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1198 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1199 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1200 "content" => array("type" => "mediumtext"),
1201 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1204 "PRIMARY" => array("url", "guessing", "oembed"),
1205 "created" => array("created"),
1208 $database["pconfig"] = array(
1210 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1211 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1212 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1213 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1214 "v" => array("type" => "mediumtext"),
1217 "PRIMARY" => array("id"),
1218 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1221 $database["photo"] = array(
1223 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1224 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1225 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1226 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1227 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1228 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1229 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1230 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1231 "desc" => array("type" => "text"),
1232 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1233 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1234 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1235 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1236 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1237 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1238 "data" => array("type" => "mediumblob", "not null" => "1"),
1239 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1240 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1241 "allow_cid" => array("type" => "mediumtext"),
1242 "allow_gid" => array("type" => "mediumtext"),
1243 "deny_cid" => array("type" => "mediumtext"),
1244 "deny_gid" => array("type" => "mediumtext"),
1247 "PRIMARY" => array("id"),
1248 "uid_contactid" => array("uid", "contact-id"),
1249 "uid_profile" => array("uid", "profile"),
1250 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1251 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1252 "resource-id" => array("resource-id(64)"),
1255 $database["poll"] = array(
1257 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1258 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1259 "q0" => array("type" => "text"),
1260 "q1" => array("type" => "text"),
1261 "q2" => array("type" => "text"),
1262 "q3" => array("type" => "text"),
1263 "q4" => array("type" => "text"),
1264 "q5" => array("type" => "text"),
1265 "q6" => array("type" => "text"),
1266 "q7" => array("type" => "text"),
1267 "q8" => array("type" => "text"),
1268 "q9" => array("type" => "text"),
1271 "PRIMARY" => array("id"),
1272 "uid" => array("uid"),
1275 $database["poll_result"] = array(
1277 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1278 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1279 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1282 "PRIMARY" => array("id"),
1283 "poll_id" => array("poll_id"),
1284 "choice" => array("choice"),
1287 $database["process"] = array(
1289 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1290 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1291 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1294 "PRIMARY" => array("pid"),
1295 "command" => array("command"),
1298 $database["profile"] = array(
1300 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1301 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1302 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1303 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1304 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1305 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1306 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1307 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1308 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1309 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1310 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1311 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1312 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1313 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1314 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1315 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1316 "with" => array("type" => "text"),
1317 "howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1318 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1319 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1320 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1321 "pub_keywords" => array("type" => "text"),
1322 "prv_keywords" => array("type" => "text"),
1323 "likes" => array("type" => "text"),
1324 "dislikes" => array("type" => "text"),
1325 "about" => array("type" => "text"),
1326 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1327 "music" => array("type" => "text"),
1328 "book" => array("type" => "text"),
1329 "tv" => array("type" => "text"),
1330 "film" => array("type" => "text"),
1331 "interest" => array("type" => "text"),
1332 "romance" => array("type" => "text"),
1333 "work" => array("type" => "text"),
1334 "education" => array("type" => "text"),
1335 "contact" => array("type" => "text"),
1336 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1337 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1338 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1339 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1340 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1341 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1344 "PRIMARY" => array("id"),
1345 "uid_is-default" => array("uid", "is-default"),
1348 $database["profile_check"] = array(
1350 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1351 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1352 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1353 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1354 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1355 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1358 "PRIMARY" => array("id"),
1361 $database["push_subscriber"] = array(
1363 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1364 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1365 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1366 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1367 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1368 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1369 "last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1370 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1373 "PRIMARY" => array("id"),
1376 $database["queue"] = array(
1378 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1379 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1380 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1381 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1382 "last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1383 "content" => array("type" => "mediumtext"),
1384 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1387 "PRIMARY" => array("id"),
1388 "cid" => array("cid"),
1389 "created" => array("created"),
1390 "last" => array("last"),
1391 "network" => array("network"),
1392 "batch" => array("batch"),
1395 $database["register"] = array(
1397 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1398 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1399 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1400 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1401 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1402 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1403 "note" => array("type" => "text"),
1406 "PRIMARY" => array("id"),
1409 $database["search"] = array(
1411 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1412 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1413 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1416 "PRIMARY" => array("id"),
1417 "uid" => array("uid"),
1420 $database["session"] = array(
1422 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1423 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1424 "data" => array("type" => "text"),
1425 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1428 "PRIMARY" => array("id"),
1429 "sid" => array("sid(64)"),
1430 "expire" => array("expire"),
1433 $database["sign"] = array(
1435 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1436 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1437 "signed_text" => array("type" => "mediumtext"),
1438 "signature" => array("type" => "text"),
1439 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1442 "PRIMARY" => array("id"),
1443 "iid" => array("iid"),
1446 $database["spam"] = array(
1448 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1449 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1450 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1451 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1452 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1453 "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1456 "PRIMARY" => array("id"),
1457 "uid" => array("uid"),
1458 "spam" => array("spam"),
1459 "ham" => array("ham"),
1460 "term" => array("term"),
1463 $database["term"] = array(
1465 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1466 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1467 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1468 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1469 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1470 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1471 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1472 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1473 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1474 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1475 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1476 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1479 "PRIMARY" => array("tid"),
1480 "oid_otype_type_term" => array("oid","otype","type","term"),
1481 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1482 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1483 "guid" => array("guid(64)"),
1486 $database["thread"] = array(
1488 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1489 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1490 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1491 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1492 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1493 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1494 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1495 "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1496 "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1497 "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1498 "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1499 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1500 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1501 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1502 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1503 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1504 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1505 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1506 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1507 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1508 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1509 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1510 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1511 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1512 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1513 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1516 "PRIMARY" => array("iid"),
1517 "uid_network_commented" => array("uid","network","commented"),
1518 "uid_network_created" => array("uid","network","created"),
1519 "uid_contactid_commented" => array("uid","contact-id","commented"),
1520 "uid_contactid_created" => array("uid","contact-id","created"),
1521 "uid_created" => array("uid","created"),
1522 "uid_commented" => array("uid","commented"),
1523 "uid_wall_created" => array("uid","wall","created"),
1526 $database["tokens"] = array(
1528 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1529 "secret" => array("type" => "text"),
1530 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1531 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1532 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1533 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1536 "PRIMARY" => array("id"),
1539 $database["user"] = array(
1541 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1542 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1543 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1544 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1545 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1546 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1547 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1548 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1549 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1550 "register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1551 "login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1552 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1553 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1554 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1555 "pubkey" => array("type" => "text"),
1556 "prvkey" => array("type" => "text"),
1557 "spubkey" => array("type" => "text"),
1558 "sprvkey" => array("type" => "text"),
1559 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1560 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1561 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1562 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1563 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1564 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1565 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1566 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1567 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1568 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1569 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1570 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1571 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1572 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1573 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1574 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1575 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1576 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1577 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1578 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1579 "allow_cid" => array("type" => "mediumtext"),
1580 "allow_gid" => array("type" => "mediumtext"),
1581 "deny_cid" => array("type" => "mediumtext"),
1582 "deny_gid" => array("type" => "mediumtext"),
1583 "openidserver" => array("type" => "text"),
1586 "PRIMARY" => array("uid"),
1587 "nickname" => array("nickname(32)"),
1590 $database["userd"] = array(
1592 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1593 "username" => array("type" => "varchar(255)", "not null" => "1"),
1596 "PRIMARY" => array("id"),
1597 "username" => array("username(32)"),
1600 $database["workerqueue"] = array(
1602 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1603 "parameter" => array("type" => "text"),
1604 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1605 "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1606 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1607 "executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1610 "PRIMARY" => array("id"),
1619 * run from command line
1621 function dbstructure_run(&$argv, &$argc) {
1629 @include(".htconfig.php");
1630 require_once("include/dba.php");
1631 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1632 unset($db_host, $db_user, $db_pass, $db_data);
1638 update_structure(true, false);
1641 update_structure(true, true);
1643 $build = get_config('system','build');
1645 set_config('system','build',DB_UPDATE_VERSION);
1646 $build = DB_UPDATE_VERSION;
1649 $stored = intval($build);
1650 $current = intval(DB_UPDATE_VERSION);
1652 // run any left update_nnnn functions in update.php
1653 for($x = $stored; $x < $current; $x ++) {
1654 $r = run_update_function($x);
1658 set_config('system','build',DB_UPDATE_VERSION);
1661 // For the dump that is used to create the database.sql we always assume utfmb4
1662 $charset = "utf8mb4";
1663 print_structure(db_definition($charset), $charset);
1670 echo $argv[0]." <command>\n";
1673 echo "dryrun show database update schema queries without running them\n";
1674 echo "update update database schema\n";
1675 echo "dumpsql dump database schema\n";
1680 if (array_search(__file__,get_included_files())===0){
1681 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);