2 require_once("boot.php");
3 require_once("include/text.php");
5 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
8 * send the email and do what is needed to do on update fails
10 * @param update_id (int) number of failed update
11 * @param error_message (str) error message
13 function update_fail($update_id, $error_message){
14 //send the administrators an e-mail
15 $admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
16 $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
21 if (!dbm::is_result($adminlist)) {
22 logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_WARNING);
28 // every admin could had different language
29 foreach ($adminlist as $admin) {
30 $lang = (($admin['language'])?$admin['language']:'en');
33 $preamble = deindent(t("
34 The friendica developers released update %s recently,
35 but when I tried to install it, something went terribly wrong.
36 This needs to be fixed soon and I can't do it alone. Please contact a
37 friendica developer if you can not help me on your own. My database might be invalid."));
38 $body = t("The error message is\n[pre]%s[/pre]");
39 $preamble = sprintf($preamble, $update_id);
40 $body = sprintf($body, $error_message);
43 'type' => "SYSTEM_EMAIL",
44 'to_email' => $admin['email'],
45 'preamble' => $preamble,
55 $email_tpl = get_intltext_template("update_fail_eml.tpl");
56 $email_msg = replace_macros($email_tpl, array(
57 '$sitename' => $a->config['sitename'],
58 '$siteurl' => App::get_baseurl(),
59 '$update' => DB_UPDATE_VERSION,
60 '$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
62 $subject=sprintf(t('Update Error at %s'), App::get_baseurl());
63 require_once('include/email.php');
64 $subject = email_header_encode($subject,'UTF-8');
65 mail($a->config['admin_email'], $subject, $email_msg,
66 'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n"
67 .'Content-type: text/plain; charset=UTF-8'."\n"
68 .'Content-transfer-encoding: 8bit');
71 logger("CRITICAL: Database structure update failed: ".$retval);
75 function table_structure($table) {
76 $structures = q("DESCRIBE `%s`", $table);
78 $indexes = q("SHOW INDEX FROM `%s`", $table);
83 if (dbm::is_result($indexes))
84 foreach ($indexes AS $index) {
85 if ($index["Index_type"] == "FULLTEXT") {
89 if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
90 $indexdata[$index["Key_name"]] = array('UNIQUE');
93 $column = $index["Column_name"];
94 // On utf8mb4 a varchar index can only have a length of 191
95 // To avoid the need to add this to every index definition we just ignore it here.
96 // Exception are primary indexes
97 // Since there are some combindex primary indexes we use the limit of 180 here.
98 if (($index["Sub_part"] != "") AND (($index["Sub_part"] < 180) OR ($index["Key_name"] == "PRIMARY"))) {
99 $column .= "(".$index["Sub_part"].")";
102 $indexdata[$index["Key_name"]][] = $column;
105 if (dbm::is_result($structures)) {
106 foreach ($structures AS $field) {
107 $fielddata[$field["Field"]]["type"] = $field["Type"];
108 if ($field["Null"] == "NO") {
109 $fielddata[$field["Field"]]["not null"] = true;
112 if (isset($field["Default"])) {
113 $fielddata[$field["Field"]]["default"] = $field["Default"];
116 if ($field["Extra"] != "") {
117 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
120 if ($field["Key"] == "PRI") {
121 $fielddata[$field["Field"]]["primary"] = true;
125 return(array("fields"=>$fielddata, "indexes"=>$indexdata));
128 function print_structure($database, $charset) {
129 echo "-- ------------------------------------------\n";
130 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
131 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
132 echo "-- ------------------------------------------\n\n\n";
133 foreach ($database AS $name => $structure) {
135 echo "-- TABLE $name\n";
137 db_create_table($name, $structure['fields'], $charset, true, false, $structure["indexes"]);
143 function update_structure($verbose, $action, $tables=null, $definition=null) {
147 set_config('system', 'maintenance', 1);
150 if (isset($a->config["system"]["db_charset"])) {
151 $charset = $a->config["system"]["db_charset"];
158 logger('updating structure', LOGGER_DEBUG);
160 // Get the current structure
163 if (is_null($tables)) {
164 $tables = q("SHOW TABLES");
167 foreach ($tables AS $table) {
168 $table = current($table);
170 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
171 $database[$table] = table_structure($table);
174 // Get the definition
175 if (is_null($definition)) {
176 $definition = db_definition($charset);
179 // Ensure index conversion to unique removes duplicates
180 $sql_config = "SET session old_alter_table=1;";
182 echo $sql_config."\n";
188 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
189 if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
190 !(strpos($db->server_info(), 'MariaDB') !== false)) {
197 foreach ($definition AS $name => $structure) {
198 $is_new_table = False;
200 if (!isset($database[$name])) {
201 $r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']);
202 if (!dbm::is_result($r)) {
203 $errors .= t('Errors encountered creating database tables.').$name.EOL;
205 $is_new_table = True;
208 * Drop the index if it isn't present in the definition
209 * or the definition differ from current status
210 * and index name doesn't start with "local_"
212 foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
213 $current_index_definition = implode(",",$fieldnames);
214 if (isset($structure["indexes"][$indexname])) {
215 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
217 $new_index_definition = "__NOT_SET__";
219 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
220 $sql2=db_drop_index($indexname);
222 $sql3 = "ALTER".$ignore." TABLE `".$name."` ".$sql2;
228 // Compare the field structure field by field
229 foreach ($structure["fields"] AS $fieldname => $parameters) {
230 if (!isset($database[$name]["fields"][$fieldname])) {
231 $sql2=db_add_table_field($fieldname, $parameters);
233 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
238 // Compare the field definition
239 $current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
240 $new_field_definition = implode(",",$parameters);
241 if ($current_field_definition != $new_field_definition) {
242 $sql2=db_modify_table_field($fieldname, $parameters);
244 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
255 * Create the index if the index don't exists in database
256 * or the definition differ from the current status.
257 * Don't create keys if table is new
259 if (!$is_new_table) {
260 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
261 if (isset($database[$name]["indexes"][$indexname])) {
262 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
264 $current_index_definition = "__NOT_SET__";
266 $new_index_definition = implode(",",$fieldnames);
267 if ($current_index_definition != $new_index_definition) {
268 $sql2=db_create_index($indexname, $fieldnames);
271 $sql3 = "ALTER" . $ignore . " TABLE `".$name."` ".$sql2;
286 if (dbm::is_result($r))
287 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
293 set_config('system', 'maintenance', 0);
298 function db_field_command($parameters, $create = true) {
299 $fieldstruct = $parameters["type"];
301 if ($parameters["not null"])
302 $fieldstruct .= " NOT NULL";
304 if (isset($parameters["default"])){
305 if (strpos(strtolower($parameters["type"]),"int")!==false) {
306 $fieldstruct .= " DEFAULT ".$parameters["default"];
308 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
311 if ($parameters["extra"] != "")
312 $fieldstruct .= " ".$parameters["extra"];
314 /*if (($parameters["primary"] != "") AND $create)
315 $fieldstruct .= " PRIMARY KEY";*/
317 return($fieldstruct);
320 function db_create_table($name, $fields, $charset, $verbose, $action, $indexes=null) {
328 $primary_keys = array();
329 foreach($fields AS $fieldname => $field) {
330 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
331 if (x($field,'primary') and $field['primary']!=''){
332 $primary_keys[] = $fieldname;
336 if (!is_null($indexes)) {
337 foreach ($indexes AS $indexname => $fieldnames) {
338 $sql_index = db_create_index($indexname, $fieldnames, "");
339 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
343 $sql = implode(",\n\t", $sql_rows);
345 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=".$charset;
355 function db_add_table_field($fieldname, $parameters) {
356 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
360 function db_modify_table_field($fieldname, $parameters) {
361 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
365 function db_drop_index($indexname) {
366 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
370 function db_create_index($indexname, $fieldnames, $method="ADD") {
372 $method = strtoupper(trim($method));
373 if ($method!="" && $method!="ADD") {
374 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
378 if ($fieldnames[0] == "UNIQUE") {
379 array_shift($fieldnames);
380 $method .= ' UNIQUE';
384 foreach ($fieldnames AS $fieldname) {
388 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
389 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
391 $names .= "`".dbesc($fieldname)."`";
395 if ($indexname == "PRIMARY") {
396 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
400 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
404 function db_index_suffix($charset, $reduce = 0) {
405 if ($charset != "utf8mb4") {
409 // On utf8mb4 indexes can only have a length of 191
410 $indexlength = 191 - $reduce;
412 return "(".$indexlength.")";
415 function db_definition($charset) {
419 $database["addon"] = array(
421 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
422 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
423 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
424 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
425 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
426 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
427 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
430 "PRIMARY" => array("id"),
433 $database["attach"] = array(
435 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
436 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
437 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
438 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
439 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
440 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
441 "data" => array("type" => "longblob", "not null" => "1"),
442 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
443 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
444 "allow_cid" => array("type" => "text"),
445 "allow_gid" => array("type" => "text"),
446 "deny_cid" => array("type" => "text"),
447 "deny_gid" => array("type" => "text"),
450 "PRIMARY" => array("id"),
453 $database["auth_codes"] = array(
455 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
456 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
457 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
458 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
459 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
462 "PRIMARY" => array("id"),
465 $database["cache"] = array(
467 "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
468 "v" => array("type" => "mediumtext"),
469 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
470 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
473 "PRIMARY" => array("k"),
474 "expire_mode_updated" => array("expire_mode", "updated"),
477 $database["challenge"] = array(
479 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
480 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
481 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
482 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
483 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
484 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
487 "PRIMARY" => array("id"),
490 $database["clients"] = array(
492 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
493 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
494 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
495 "name" => array("type" => "text"),
496 "icon" => array("type" => "text"),
497 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
500 "PRIMARY" => array("client_id"),
503 $database["config"] = array(
505 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
506 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
507 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
508 "v" => array("type" => "mediumtext"),
511 "PRIMARY" => array("id"),
512 "cat_k" => array("UNIQUE", "cat", "k"),
515 $database["contact"] = array(
517 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
518 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
519 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
520 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
521 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
522 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
523 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
524 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
525 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
526 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
527 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
528 "about" => array("type" => "text"),
529 "keywords" => array("type" => "text"),
530 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
531 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
532 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
533 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
534 "photo" => array("type" => "text"),
535 "thumb" => array("type" => "text"),
536 "micro" => array("type" => "text"),
537 "site-pubkey" => array("type" => "text"),
538 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
539 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
540 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
541 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
542 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
543 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
544 "pubkey" => array("type" => "text"),
545 "prvkey" => array("type" => "text"),
546 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
547 "request" => array("type" => "text"),
548 "notify" => array("type" => "text"),
549 "poll" => array("type" => "text"),
550 "confirm" => array("type" => "text"),
551 "poco" => array("type" => "text"),
552 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
553 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
554 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
555 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
556 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
557 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
558 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
559 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
560 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
561 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
562 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
563 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
564 "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
565 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
566 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
567 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
568 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
569 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
570 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
571 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
572 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
573 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
574 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
575 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
576 "reason" => array("type" => "text"),
577 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
578 "info" => array("type" => "mediumtext"),
579 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
580 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
581 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
582 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
583 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
584 "ffi_keyword_blacklist" => array("type" => "text"),
587 "PRIMARY" => array("id"),
588 "uid_name" => array("uid", "name"),
589 "self_uid" => array("self", "uid"),
590 "alias_uid" => array("alias(32)", "uid"),
591 "pending_uid" => array("pending", "uid"),
592 "blocked_uid" => array("blocked", "uid"),
593 "uid_rel_network_poll" => array("uid", "rel", "network", "poll(64)", "archive"),
594 "uid_network_batch" => array("uid", "network", "batch(64)"),
595 "addr_uid" => array("addr(32)", "uid"),
596 "nurl_uid" => array("nurl(32)", "uid"),
597 "nick_uid" => array("nick(32)", "uid"),
600 $database["conv"] = array(
602 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
603 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
604 "recips" => array("type" => "text"),
605 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
606 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
607 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
608 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
609 "subject" => array("type" => "text"),
612 "PRIMARY" => array("id"),
613 "uid" => array("uid"),
616 $database["deliverq"] = array(
618 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
619 "cmd" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
620 "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
621 "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
624 "PRIMARY" => array("id"),
625 "cmd_item_contact" => array("UNIQUE", "cmd", "item", "contact"),
628 $database["event"] = array(
630 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
631 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
632 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
633 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
634 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
635 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
636 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
637 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
638 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
639 "summary" => array("type" => "text"),
640 "desc" => array("type" => "text"),
641 "location" => array("type" => "text"),
642 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
643 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
644 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
645 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
646 "allow_cid" => array("type" => "text"),
647 "allow_gid" => array("type" => "text"),
648 "deny_cid" => array("type" => "text"),
649 "deny_gid" => array("type" => "text"),
652 "PRIMARY" => array("id"),
653 "uid_start" => array("uid", "start"),
656 $database["fcontact"] = array(
658 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
659 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
660 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
661 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
662 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
663 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
664 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
665 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
666 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
667 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
668 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
669 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
670 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
671 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
672 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
673 "pubkey" => array("type" => "text"),
674 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
677 "PRIMARY" => array("id"),
678 "addr" => array("addr(32)"),
681 $database["ffinder"] = array(
683 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
684 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
685 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
686 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
689 "PRIMARY" => array("id"),
692 $database["fserver"] = array(
694 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
695 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
696 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
697 "key" => array("type" => "text"),
700 "PRIMARY" => array("id"),
701 "server" => array("server(32)"),
704 $database["fsuggest"] = array(
706 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
707 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
708 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
709 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
710 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
711 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
712 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
713 "note" => array("type" => "text"),
714 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
717 "PRIMARY" => array("id"),
720 $database["gcign"] = array(
722 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
723 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
724 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
727 "PRIMARY" => array("id"),
728 "uid" => array("uid"),
729 "gcid" => array("gcid"),
732 $database["gcontact"] = array(
734 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
735 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
736 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
737 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
738 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
739 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
740 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
741 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
742 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
743 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
744 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
745 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
746 "about" => array("type" => "text"),
747 "keywords" => array("type" => "text"),
748 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
749 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
750 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
751 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
752 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
753 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
754 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
755 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
756 "notify" => array("type" => "text"),
757 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
758 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
759 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
762 "PRIMARY" => array("id"),
763 "nurl" => array("nurl(32)"),
764 "name" => array("name(32)"),
765 "nick" => array("nick(32)"),
766 "addr" => array("addr(32)"),
767 "updated" => array("updated"),
770 $database["glink"] = array(
772 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
773 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
774 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
775 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
776 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
777 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
780 "PRIMARY" => array("id"),
781 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
782 "gcid" => array("gcid"),
785 $database["group"] = array(
787 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
788 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
789 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
790 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
791 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
794 "PRIMARY" => array("id"),
795 "uid" => array("uid"),
798 $database["group_member"] = array(
800 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
801 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
802 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
803 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
806 "PRIMARY" => array("id"),
807 "gid_contactid" => array("gid", "contact-id"),
808 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
811 $database["gserver"] = array(
813 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
814 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
815 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
816 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
817 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
818 "info" => array("type" => "text"),
819 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
820 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
821 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
822 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
823 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
824 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
825 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
826 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
827 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
830 "PRIMARY" => array("id"),
831 "nurl" => array("nurl(32)"),
834 $database["hook"] = array(
836 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
837 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
838 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
839 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
840 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
843 "PRIMARY" => array("id"),
844 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
847 $database["intro"] = array(
849 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
850 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
851 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
852 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
853 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
854 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
855 "note" => array("type" => "text"),
856 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
857 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
858 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
859 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
862 "PRIMARY" => array("id"),
865 $database["item"] = array(
867 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
868 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
869 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
870 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
871 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
872 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
873 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
874 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
875 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
876 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
877 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
878 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
879 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
880 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
881 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
882 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
883 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
884 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
885 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
886 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
887 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
888 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
889 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
890 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
891 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
892 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
893 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
894 "body" => array("type" => "mediumtext"),
895 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
896 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
897 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
898 "object" => array("type" => "text"),
899 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
900 "target" => array("type" => "text"),
901 "postopts" => array("type" => "text"),
902 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
903 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
904 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
905 "tag" => array("type" => "mediumtext"),
906 "attach" => array("type" => "mediumtext"),
907 "inform" => array("type" => "mediumtext"),
908 "file" => array("type" => "mediumtext"),
909 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
910 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
911 "allow_cid" => array("type" => "mediumtext"),
912 "allow_gid" => array("type" => "mediumtext"),
913 "deny_cid" => array("type" => "mediumtext"),
914 "deny_gid" => array("type" => "mediumtext"),
915 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
916 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
917 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
918 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
919 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
920 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
921 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
922 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
923 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
924 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
925 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
926 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
927 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
928 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
929 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
930 "rendered-html" => array("type" => "mediumtext"),
931 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
934 "PRIMARY" => array("id"),
935 "guid" => array("guid"),
936 "uri" => array("uri"),
937 "parent" => array("parent"),
938 "parent-uri" => array("parent-uri"),
939 "extid" => array("extid"),
940 "uid_id" => array("uid","id"),
941 "uid_created" => array("uid","created"),
942 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
943 "uid_network_received" => array("uid","network","received"),
944 "uid_network_commented" => array("uid","network","commented"),
945 "uid_thrparent" => array("uid","thr-parent"),
946 "uid_parenturi" => array("uid","parent-uri"),
947 "uid_contactid_created" => array("uid","contact-id","created"),
948 "authorid_created" => array("author-id","created"),
949 "uid_uri" => array("uid", "uri"),
950 "resource-id" => array("resource-id"),
951 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
952 "uid_type_changed" => array("uid","type","changed"),
953 "contactid_verb" => array("contact-id","verb"),
954 "deleted_changed" => array("deleted","changed"),
955 "uid_wall_changed" => array("uid","wall","changed"),
956 "uid_eventid" => array("uid","event-id"),
957 "uid_authorlink" => array("uid","author-link"),
958 "uid_ownerlink" => array("uid","owner-link"),
961 $database["item_id"] = array(
963 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
964 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
965 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
966 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
967 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
970 "PRIMARY" => array("id"),
971 "uid" => array("uid"),
972 "sid" => array("sid"),
973 "service" => array("service(32)"),
974 "iid" => array("iid"),
977 $database["locks"] = array(
979 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
980 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
981 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
982 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
985 "PRIMARY" => array("id"),
988 $database["mail"] = array(
990 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
991 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
992 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
993 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
994 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
995 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
996 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
997 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
998 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
999 "body" => array("type" => "mediumtext"),
1000 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1001 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1002 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1003 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1004 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1005 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1006 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1009 "PRIMARY" => array("id"),
1010 "uid_seen" => array("uid", "seen"),
1011 "convid" => array("convid"),
1012 "uri" => array("uri(64)"),
1013 "parent-uri" => array("parent-uri(64)"),
1016 $database["mailacct"] = array(
1018 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1019 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1020 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1021 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1022 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1023 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1024 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1025 "pass" => array("type" => "text"),
1026 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1027 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1028 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1029 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1030 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1033 "PRIMARY" => array("id"),
1036 $database["manage"] = array(
1038 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1039 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1040 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1043 "PRIMARY" => array("id"),
1044 "uid_mid" => array("UNIQUE", "uid","mid"),
1047 $database["notify"] = array(
1049 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1050 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1051 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1052 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1053 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1054 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1055 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1056 "msg" => array("type" => "mediumtext"),
1057 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1058 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1059 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1060 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1061 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1062 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1063 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1064 "name_cache" => array("type" => "tinytext"),
1065 "msg_cache" => array("type" => "mediumtext")
1068 "PRIMARY" => array("id"),
1069 "uid_hash" => array("uid", "hash"),
1070 "seen_uid_date" => array("seen", "uid", "date"),
1071 "type_uid_link" => array("type", "uid", "link"),
1072 "uid_date" => array("uid", "date"),
1075 $database["notify-threads"] = array(
1077 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1078 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1079 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1080 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1081 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1084 "PRIMARY" => array("id"),
1087 $database["oembed"] = array(
1089 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1090 "content" => array("type" => "mediumtext"),
1091 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1094 "PRIMARY" => array("url"),
1095 "created" => array("created"),
1098 $database["parsed_url"] = array(
1100 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1101 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1102 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1103 "content" => array("type" => "mediumtext"),
1104 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1107 "PRIMARY" => array("url", "guessing", "oembed"),
1108 "created" => array("created"),
1111 $database["pconfig"] = array(
1113 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1114 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1115 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1116 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1117 "v" => array("type" => "mediumtext"),
1120 "PRIMARY" => array("id"),
1121 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1124 $database["photo"] = array(
1126 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1127 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1128 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1129 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1130 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1131 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1132 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1133 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1134 "desc" => array("type" => "text"),
1135 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1136 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1137 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1138 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1139 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1140 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1141 "data" => array("type" => "mediumblob", "not null" => "1"),
1142 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1143 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1144 "allow_cid" => array("type" => "mediumtext"),
1145 "allow_gid" => array("type" => "mediumtext"),
1146 "deny_cid" => array("type" => "mediumtext"),
1147 "deny_gid" => array("type" => "mediumtext"),
1150 "PRIMARY" => array("id"),
1151 "uid_contactid" => array("uid", "contact-id"),
1152 "uid_profile" => array("uid", "profile"),
1153 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1154 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1155 "resource-id" => array("resource-id(64)"),
1158 $database["poll"] = array(
1160 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1161 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1162 "q0" => array("type" => "text"),
1163 "q1" => array("type" => "text"),
1164 "q2" => array("type" => "text"),
1165 "q3" => array("type" => "text"),
1166 "q4" => array("type" => "text"),
1167 "q5" => array("type" => "text"),
1168 "q6" => array("type" => "text"),
1169 "q7" => array("type" => "text"),
1170 "q8" => array("type" => "text"),
1171 "q9" => array("type" => "text"),
1174 "PRIMARY" => array("id"),
1175 "uid" => array("uid"),
1178 $database["poll_result"] = array(
1180 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1181 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1182 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1185 "PRIMARY" => array("id"),
1186 "poll_id" => array("poll_id"),
1187 "choice" => array("choice"),
1190 $database["process"] = array(
1192 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1193 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1194 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1197 "PRIMARY" => array("pid"),
1198 "command" => array("command"),
1201 $database["profile"] = array(
1203 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1204 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1205 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1206 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1207 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1208 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1209 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1210 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1211 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1212 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1213 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1214 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1215 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1216 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1217 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1218 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1219 "with" => array("type" => "text"),
1220 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1221 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1222 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1223 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1224 "pub_keywords" => array("type" => "text"),
1225 "prv_keywords" => array("type" => "text"),
1226 "likes" => array("type" => "text"),
1227 "dislikes" => array("type" => "text"),
1228 "about" => array("type" => "text"),
1229 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1230 "music" => array("type" => "text"),
1231 "book" => array("type" => "text"),
1232 "tv" => array("type" => "text"),
1233 "film" => array("type" => "text"),
1234 "interest" => array("type" => "text"),
1235 "romance" => array("type" => "text"),
1236 "work" => array("type" => "text"),
1237 "education" => array("type" => "text"),
1238 "contact" => array("type" => "text"),
1239 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1240 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1241 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1242 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1243 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1244 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1247 "PRIMARY" => array("id"),
1250 $database["profile_check"] = array(
1252 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1253 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1254 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1255 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1256 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1257 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1260 "PRIMARY" => array("id"),
1263 $database["push_subscriber"] = array(
1265 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1266 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1267 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1268 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1269 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1270 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1271 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1272 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1275 "PRIMARY" => array("id"),
1278 $database["queue"] = array(
1280 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1281 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1282 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1283 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1284 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1285 "content" => array("type" => "mediumtext"),
1286 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1289 "PRIMARY" => array("id"),
1290 "cid" => array("cid"),
1291 "created" => array("created"),
1292 "last" => array("last"),
1293 "network" => array("network"),
1294 "batch" => array("batch"),
1297 $database["register"] = array(
1299 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1300 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1301 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1302 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1303 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1304 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1305 "note" => array("type" => "text"),
1308 "PRIMARY" => array("id"),
1311 $database["search"] = array(
1313 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1314 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1315 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1318 "PRIMARY" => array("id"),
1319 "uid" => array("uid"),
1322 $database["session"] = array(
1324 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1325 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1326 "data" => array("type" => "text"),
1327 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1330 "PRIMARY" => array("id"),
1331 "sid" => array("sid(64)"),
1332 "expire" => array("expire"),
1335 $database["sign"] = array(
1337 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1338 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1339 "signed_text" => array("type" => "mediumtext"),
1340 "signature" => array("type" => "text"),
1341 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1344 "PRIMARY" => array("id"),
1345 "iid" => array("iid"),
1348 $database["spam"] = array(
1350 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1351 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1352 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1353 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1354 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1355 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1358 "PRIMARY" => array("id"),
1359 "uid" => array("uid"),
1360 "spam" => array("spam"),
1361 "ham" => array("ham"),
1362 "term" => array("term"),
1365 $database["term"] = array(
1367 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1368 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1369 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1370 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1371 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1372 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1373 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1374 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1375 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1376 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1377 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1378 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1381 "PRIMARY" => array("tid"),
1382 "oid_otype_type_term" => array("oid","otype","type","term"),
1383 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1384 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1385 "guid" => array("guid(64)"),
1388 $database["thread"] = array(
1390 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1391 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1392 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1393 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1394 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1395 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1396 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1397 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1398 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1399 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1400 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1401 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1402 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1403 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1404 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1405 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1406 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1407 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1408 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1409 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1410 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1411 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1412 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1413 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1414 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1415 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1418 "PRIMARY" => array("iid"),
1419 "uid_network_commented" => array("uid","network","commented"),
1420 "uid_network_created" => array("uid","network","created"),
1421 "uid_contactid_commented" => array("uid","contact-id","commented"),
1422 "uid_contactid_created" => array("uid","contact-id","created"),
1423 "uid_created" => array("uid","created"),
1424 "uid_commented" => array("uid","commented"),
1427 $database["tokens"] = array(
1429 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1430 "secret" => array("type" => "text"),
1431 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1432 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1433 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1434 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1437 "PRIMARY" => array("id"),
1440 $database["user"] = array(
1442 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1443 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1444 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1445 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1446 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1447 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1448 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1449 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1450 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1451 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1452 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1453 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1454 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1455 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1456 "pubkey" => array("type" => "text"),
1457 "prvkey" => array("type" => "text"),
1458 "spubkey" => array("type" => "text"),
1459 "sprvkey" => array("type" => "text"),
1460 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1461 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1462 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1463 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1464 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1465 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1466 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1467 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1468 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1469 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1470 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1471 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1472 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1473 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1474 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1475 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1476 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1477 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1478 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1479 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1480 "allow_cid" => array("type" => "text"),
1481 "allow_gid" => array("type" => "text"),
1482 "deny_cid" => array("type" => "text"),
1483 "deny_gid" => array("type" => "text"),
1484 "openidserver" => array("type" => "text"),
1487 "PRIMARY" => array("uid"),
1488 "nickname" => array("nickname(32)"),
1491 $database["userd"] = array(
1493 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1494 "username" => array("type" => "varchar(255)", "not null" => "1"),
1497 "PRIMARY" => array("id"),
1498 "username" => array("username(32)"),
1501 $database["workerqueue"] = array(
1503 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1504 "parameter" => array("type" => "text"),
1505 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1506 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1507 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1508 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1511 "PRIMARY" => array("id"),
1520 * run from command line
1522 function dbstructure_run(&$argv, &$argc) {
1530 @include(".htconfig.php");
1531 require_once("include/dba.php");
1532 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1533 unset($db_host, $db_user, $db_pass, $db_data);
1539 update_structure(true, false);
1542 update_structure(true, true);
1544 $build = get_config('system','build');
1546 set_config('system','build',DB_UPDATE_VERSION);
1547 $build = DB_UPDATE_VERSION;
1550 $stored = intval($build);
1551 $current = intval(DB_UPDATE_VERSION);
1553 // run any left update_nnnn functions in update.php
1554 for($x = $stored; $x < $current; $x ++) {
1555 $r = run_update_function($x);
1559 set_config('system','build',DB_UPDATE_VERSION);
1562 // For the dump that is used to create the database.sql we always assume utfmb4
1563 $charset = "utf8mb4";
1564 print_structure(db_definition($charset), $charset);
1571 echo $argv[0]." <command>\n";
1574 echo "dryrun show database update schema queries without running them\n";
1575 echo "update update database schema\n";
1576 echo "dumpsql dump database schema\n";
1581 if (array_search(__file__,get_included_files())===0){
1582 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);