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" => "mediumtext"),
445 "allow_gid" => array("type" => "mediumtext"),
446 "deny_cid" => array("type" => "mediumtext"),
447 "deny_gid" => array("type" => "mediumtext"),
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" => "text"),
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 "updated" => array("updated"),
475 "expire_mode_updated" => array("expire_mode", "updated"),
478 $database["challenge"] = array(
480 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
481 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
482 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
483 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
484 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
485 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
488 "PRIMARY" => array("id"),
491 $database["clients"] = array(
493 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
494 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
495 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
496 "name" => array("type" => "text"),
497 "icon" => array("type" => "text"),
498 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
501 "PRIMARY" => array("client_id"),
504 $database["config"] = array(
506 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
507 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
508 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
509 "v" => array("type" => "text"),
512 "PRIMARY" => array("id"),
513 "cat_k" => array("UNIQUE", "cat", "k"),
516 $database["contact"] = array(
518 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
519 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
520 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
521 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
522 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
523 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
524 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
525 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
526 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
527 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
528 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
529 "about" => array("type" => "text"),
530 "keywords" => array("type" => "text"),
531 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
532 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
533 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
534 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
535 "photo" => array("type" => "text"),
536 "thumb" => array("type" => "text"),
537 "micro" => array("type" => "text"),
538 "site-pubkey" => array("type" => "text"),
539 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
540 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
541 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
542 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
543 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
544 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
545 "pubkey" => array("type" => "text"),
546 "prvkey" => array("type" => "text"),
547 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
548 "request" => array("type" => "text"),
549 "notify" => array("type" => "text"),
550 "poll" => array("type" => "text"),
551 "confirm" => array("type" => "text"),
552 "poco" => array("type" => "text"),
553 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
554 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
555 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
556 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
557 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
558 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
559 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
560 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
561 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
562 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
563 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
564 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
565 "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
566 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
567 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
568 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
569 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
570 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
571 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
572 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
573 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
574 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
575 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
576 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
577 "reason" => array("type" => "text"),
578 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
579 "info" => array("type" => "mediumtext"),
580 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
581 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
582 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
583 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
584 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
585 "ffi_keyword_blacklist" => array("type" => "mediumtext"),
588 "PRIMARY" => array("id"),
589 "uid_name" => array("uid", "name"),
590 "self_uid" => array("self", "uid"),
591 "alias_uid" => array("alias(32)", "uid"),
592 "pending_uid" => array("pending", "uid"),
593 "blocked_uid" => array("blocked", "uid"),
594 "uid_rel_network_poll" => array("uid", "rel", "network", "poll(64)", "archive"),
595 "uid_network_batch" => array("uid", "network", "batch(64)"),
596 "addr_uid" => array("addr(32)", "uid"),
597 "nurl_uid" => array("nurl(32)", "uid"),
598 "nick_uid" => array("nick(32)", "uid"),
601 $database["conv"] = array(
603 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
604 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
605 "recips" => array("type" => "mediumtext"),
606 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
607 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
608 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
609 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
610 "subject" => array("type" => "mediumtext"),
613 "PRIMARY" => array("id"),
614 "uid" => array("uid"),
617 $database["deliverq"] = array(
619 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
620 "cmd" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
621 "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
622 "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
625 "PRIMARY" => array("id"),
626 "cmd_item_contact" => array("UNIQUE", "cmd", "item", "contact"),
629 $database["event"] = array(
631 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
632 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
633 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
634 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
635 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
636 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
637 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
638 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
639 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
640 "summary" => array("type" => "text"),
641 "desc" => array("type" => "text"),
642 "location" => array("type" => "text"),
643 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
644 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
645 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
646 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
647 "allow_cid" => array("type" => "mediumtext"),
648 "allow_gid" => array("type" => "mediumtext"),
649 "deny_cid" => array("type" => "mediumtext"),
650 "deny_gid" => array("type" => "mediumtext"),
653 "PRIMARY" => array("id"),
654 "uid_start" => array("uid", "start"),
657 $database["fcontact"] = array(
659 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
660 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
661 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
662 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
663 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
664 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
665 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
666 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
667 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
668 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
669 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
670 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
671 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
672 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
673 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
674 "pubkey" => array("type" => "text"),
675 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
678 "PRIMARY" => array("id"),
679 "addr" => array("addr(32)"),
682 $database["ffinder"] = array(
684 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
685 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
686 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
687 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
690 "PRIMARY" => array("id"),
693 $database["fserver"] = array(
695 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
696 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
697 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
698 "key" => array("type" => "text"),
701 "PRIMARY" => array("id"),
702 "server" => array("server(32)"),
705 $database["fsuggest"] = array(
707 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
708 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
709 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
710 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
711 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
712 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
713 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
714 "note" => array("type" => "text"),
715 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
718 "PRIMARY" => array("id"),
721 $database["gcign"] = array(
723 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
724 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
725 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
728 "PRIMARY" => array("id"),
729 "uid" => array("uid"),
730 "gcid" => array("gcid"),
733 $database["gcontact"] = array(
735 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
736 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
737 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
738 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
739 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
740 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
741 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
742 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
743 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
744 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
745 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
746 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
747 "about" => array("type" => "text"),
748 "keywords" => array("type" => "text"),
749 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
750 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
751 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
752 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
753 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
754 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
755 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
756 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
757 "notify" => array("type" => "text"),
758 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
759 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
760 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
763 "PRIMARY" => array("id"),
764 "nurl" => array("nurl(32)"),
765 "name" => array("name(32)"),
766 "nick" => array("nick(32)"),
767 "addr" => array("addr(32)"),
768 "updated" => array("updated"),
771 $database["glink"] = array(
773 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
774 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
775 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
776 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
777 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
778 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
781 "PRIMARY" => array("id"),
782 "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
783 "gcid" => array("gcid"),
784 "zcid" => array("zcid"),
787 $database["group"] = array(
789 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
790 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
791 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
792 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
793 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
796 "PRIMARY" => array("id"),
797 "uid" => array("uid"),
800 $database["group_member"] = array(
802 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
803 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
804 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
805 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
808 "PRIMARY" => array("id"),
809 "gid_contactid" => array("gid", "contact-id"),
810 "uid_contactid" => array("uid", "contact-id"),
811 "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
814 $database["gserver"] = array(
816 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
817 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
818 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
819 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
820 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
821 "info" => array("type" => "text"),
822 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
823 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
824 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
825 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
826 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
827 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
828 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
829 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
830 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
833 "PRIMARY" => array("id"),
834 "nurl" => array("nurl(32)"),
837 $database["hook"] = array(
839 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
840 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
841 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
842 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
843 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
846 "PRIMARY" => array("id"),
847 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
850 $database["intro"] = array(
852 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
853 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
854 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
855 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
856 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
857 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
858 "note" => array("type" => "text"),
859 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
860 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
861 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
862 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
865 "PRIMARY" => array("id"),
868 $database["item"] = array(
870 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
871 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
872 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
873 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
874 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
875 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
876 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
877 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
878 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
879 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
880 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
881 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
882 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
883 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
884 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
885 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
886 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
887 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
888 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
889 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
890 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
891 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
892 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
893 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
894 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
895 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
896 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
897 "body" => array("type" => "mediumtext"),
898 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
899 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
900 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
901 "object" => array("type" => "text"),
902 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
903 "target" => array("type" => "text"),
904 "postopts" => array("type" => "text"),
905 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
906 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
907 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
908 "tag" => array("type" => "mediumtext"),
909 "attach" => array("type" => "mediumtext"),
910 "inform" => array("type" => "mediumtext"),
911 "file" => array("type" => "mediumtext"),
912 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
913 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
914 "allow_cid" => array("type" => "mediumtext"),
915 "allow_gid" => array("type" => "mediumtext"),
916 "deny_cid" => array("type" => "mediumtext"),
917 "deny_gid" => array("type" => "mediumtext"),
918 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
919 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
920 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
921 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
922 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
923 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
924 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
925 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
926 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
927 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
928 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
929 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
930 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
931 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
932 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
933 "rendered-html" => array("type" => "mediumtext"),
934 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
937 "PRIMARY" => array("id"),
938 "guid" => array("guid"),
939 "uri" => array("uri"),
940 "parent" => array("parent"),
941 "parent-uri" => array("parent-uri"),
942 "extid" => array("extid"),
943 "uid_id" => array("uid","id"),
944 "uid_created" => array("uid","created"),
945 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
946 "uid_network_received" => array("uid","network","received"),
947 "uid_received" => array("uid","received"),
948 "uid_network_commented" => array("uid","network","commented"),
949 "uid_title" => array("uid","title"),
950 "uid_thrparent" => array("uid","thr-parent"),
951 "uid_parenturi" => array("uid","parent-uri"),
952 "uid_contactid_id" => array("uid","contact-id","id"),
953 "uid_contactid_created" => array("uid","contact-id","created"),
954 "authorid_created" => array("author-id","created"),
955 "uid_uri" => array("uid", "uri"),
956 "uid_wall_created" => array("uid","wall","created"),
957 "resource-id" => array("resource-id"),
958 "uid_type" => array("uid","type"),
959 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
960 "uid_type_changed" => array("uid","type","changed"),
961 "contactid_verb" => array("contact-id","verb"),
962 "deleted_changed" => array("deleted","changed"),
963 "uid_wall_changed" => array("uid","wall","changed"),
964 "uid_eventid" => array("uid","event-id"),
965 "uid_authorlink" => array("uid","author-link"),
966 "uid_ownerlink" => array("uid","owner-link"),
969 $database["item_id"] = array(
971 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
972 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
973 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
974 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
975 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
978 "PRIMARY" => array("id"),
979 "uid" => array("uid"),
980 "sid" => array("sid"),
981 "service" => array("service(32)"),
982 "iid" => array("iid"),
985 $database["locks"] = array(
987 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
988 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
989 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
990 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
993 "PRIMARY" => array("id"),
996 $database["mail"] = array(
998 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
999 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1000 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1001 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1002 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1003 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1004 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1005 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1006 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1007 "body" => array("type" => "mediumtext"),
1008 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1009 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1010 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1011 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1012 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1013 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1014 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1017 "PRIMARY" => array("id"),
1018 "uid" => array("uid"),
1019 "uid_seen" => array("uid", "seen"),
1020 "convid" => array("convid"),
1021 "uri" => array("uri(64)"),
1022 "parent-uri" => array("parent-uri(64)"),
1025 $database["mailacct"] = array(
1027 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1028 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1029 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1030 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1031 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1032 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1033 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1034 "pass" => array("type" => "text"),
1035 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1036 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1037 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1038 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1039 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1042 "PRIMARY" => array("id"),
1045 $database["manage"] = array(
1047 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1048 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1049 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1052 "PRIMARY" => array("id"),
1053 "uid_mid" => array("uid","mid"),
1056 $database["notify"] = array(
1058 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1059 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1060 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1061 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1062 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1063 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1064 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1065 "msg" => array("type" => "mediumtext"),
1066 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1067 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1068 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1069 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1070 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1071 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1072 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1073 "name_cache" => array("type" => "tinytext"),
1074 "msg_cache" => array("type" => "mediumtext")
1077 "PRIMARY" => array("id"),
1078 "uid_hash" => array("uid", "hash"),
1079 "uid_seen_date" => array("uid", "seen", "date"),
1080 "uid_type_link" => array("uid", "type", "link"),
1081 "uid_link" => array("uid", "link"),
1082 "uid_date" => array("uid", "date"),
1085 $database["notify-threads"] = array(
1087 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1088 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1089 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1090 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1091 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1094 "PRIMARY" => array("id"),
1095 "master-parent-item" => array("master-parent-item"),
1098 $database["oembed"] = array(
1100 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1101 "content" => array("type" => "text"),
1102 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1105 "PRIMARY" => array("url"),
1106 "created" => array("created"),
1109 $database["parsed_url"] = array(
1111 "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1112 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1113 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1114 "content" => array("type" => "text"),
1115 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1118 "PRIMARY" => array("url", "guessing", "oembed"),
1119 "created" => array("created"),
1122 $database["pconfig"] = array(
1124 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1125 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1126 "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1127 "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1128 "v" => array("type" => "mediumtext"),
1131 "PRIMARY" => array("id"),
1132 "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1135 $database["photo"] = array(
1137 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1138 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1139 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1140 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1141 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1142 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1143 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1144 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1145 "desc" => array("type" => "text"),
1146 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1147 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1148 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1149 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1150 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1151 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1152 "data" => array("type" => "mediumblob", "not null" => "1"),
1153 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1154 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1155 "allow_cid" => array("type" => "mediumtext"),
1156 "allow_gid" => array("type" => "mediumtext"),
1157 "deny_cid" => array("type" => "mediumtext"),
1158 "deny_gid" => array("type" => "mediumtext"),
1161 "PRIMARY" => array("id"),
1162 "uid_contactid" => array("uid", "contact-id"),
1163 "uid_profile" => array("uid", "profile"),
1164 "uid_album_created" => array("uid", "album(32)", "created"),
1165 "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1166 "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1167 "resource-id" => array("resource-id(64)"),
1170 $database["poll"] = array(
1172 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1173 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1174 "q0" => array("type" => "mediumtext"),
1175 "q1" => array("type" => "mediumtext"),
1176 "q2" => array("type" => "mediumtext"),
1177 "q3" => array("type" => "mediumtext"),
1178 "q4" => array("type" => "mediumtext"),
1179 "q5" => array("type" => "mediumtext"),
1180 "q6" => array("type" => "mediumtext"),
1181 "q7" => array("type" => "mediumtext"),
1182 "q8" => array("type" => "mediumtext"),
1183 "q9" => array("type" => "mediumtext"),
1186 "PRIMARY" => array("id"),
1187 "uid" => array("uid"),
1190 $database["poll_result"] = array(
1192 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1193 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1194 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1197 "PRIMARY" => array("id"),
1198 "poll_id" => array("poll_id"),
1199 "choice" => array("choice"),
1202 $database["process"] = array(
1204 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1205 "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1206 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1209 "PRIMARY" => array("pid"),
1210 "command" => array("command"),
1213 $database["profile"] = array(
1215 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1216 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1217 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1218 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1219 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1220 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1221 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1222 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1223 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1224 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1225 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1226 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1227 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1228 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1229 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1230 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1231 "with" => array("type" => "text"),
1232 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1233 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1234 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1235 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1236 "pub_keywords" => array("type" => "text"),
1237 "prv_keywords" => array("type" => "text"),
1238 "likes" => array("type" => "text"),
1239 "dislikes" => array("type" => "text"),
1240 "about" => array("type" => "text"),
1241 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1242 "music" => array("type" => "text"),
1243 "book" => array("type" => "text"),
1244 "tv" => array("type" => "text"),
1245 "film" => array("type" => "text"),
1246 "interest" => array("type" => "text"),
1247 "romance" => array("type" => "text"),
1248 "work" => array("type" => "text"),
1249 "education" => array("type" => "text"),
1250 "contact" => array("type" => "text"),
1251 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1252 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1253 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1254 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1255 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1256 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1259 "PRIMARY" => array("id"),
1262 $database["profile_check"] = array(
1264 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1265 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1266 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1267 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1268 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1269 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1272 "PRIMARY" => array("id"),
1275 $database["push_subscriber"] = array(
1277 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1278 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1279 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1280 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1281 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1282 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1283 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1284 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1287 "PRIMARY" => array("id"),
1290 $database["queue"] = array(
1292 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1293 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1294 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1295 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1296 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1297 "content" => array("type" => "mediumtext"),
1298 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1301 "PRIMARY" => array("id"),
1302 "cid" => array("cid"),
1303 "created" => array("created"),
1304 "last" => array("last"),
1305 "network" => array("network"),
1306 "batch" => array("batch"),
1309 $database["register"] = array(
1311 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1312 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1313 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1314 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1315 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1316 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1317 "note" => array("type" => "text"),
1320 "PRIMARY" => array("id"),
1323 $database["search"] = array(
1325 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1326 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1327 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1330 "PRIMARY" => array("id"),
1331 "uid" => array("uid"),
1334 $database["session"] = array(
1336 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1337 "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1338 "data" => array("type" => "text"),
1339 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1342 "PRIMARY" => array("id"),
1343 "sid" => array("sid(64)"),
1344 "expire" => array("expire"),
1347 $database["sign"] = array(
1349 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1350 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1351 "signed_text" => array("type" => "mediumtext"),
1352 "signature" => array("type" => "text"),
1353 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1356 "PRIMARY" => array("id"),
1357 "iid" => array("iid"),
1360 $database["spam"] = array(
1362 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1363 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1364 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1365 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1366 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1367 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1370 "PRIMARY" => array("id"),
1371 "uid" => array("uid"),
1372 "spam" => array("spam"),
1373 "ham" => array("ham"),
1374 "term" => array("term"),
1377 $database["term"] = array(
1379 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1380 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1381 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1382 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1383 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1384 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1385 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1386 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1387 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1388 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1389 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1390 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1393 "PRIMARY" => array("tid"),
1394 "oid_otype_type_term" => array("oid","otype","type","term"),
1395 "uid_term_tid" => array("uid","term(32)","tid"),
1396 "type_term" => array("type","term(32)"),
1397 "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1398 "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1399 "guid" => array("guid(64)"),
1402 $database["thread"] = array(
1404 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1405 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1406 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1407 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1408 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1409 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1410 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1411 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1412 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1413 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1414 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1415 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1416 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1417 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1418 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1419 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1420 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1421 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1422 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1423 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1424 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1425 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1426 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1427 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1428 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1429 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1432 "PRIMARY" => array("iid"),
1433 "created" => array("created"),
1434 "commented" => array("commented"),
1435 "uid_network_commented" => array("uid","network","commented"),
1436 "uid_network_created" => array("uid","network","created"),
1437 "uid_contactid_commented" => array("uid","contact-id","commented"),
1438 "uid_contactid_created" => array("uid","contact-id","created"),
1439 "uid_created" => array("uid","created"),
1440 "uid_commented" => array("uid","commented"),
1443 $database["tokens"] = array(
1445 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1446 "secret" => array("type" => "text"),
1447 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1448 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1449 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1450 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1453 "PRIMARY" => array("id"),
1456 $database["user"] = array(
1458 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1459 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1460 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1461 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1462 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1463 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1464 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1465 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1466 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1467 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1468 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1469 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1470 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1471 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1472 "pubkey" => array("type" => "text"),
1473 "prvkey" => array("type" => "text"),
1474 "spubkey" => array("type" => "text"),
1475 "sprvkey" => array("type" => "text"),
1476 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1477 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1478 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1479 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1480 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1481 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1482 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1483 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1484 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1485 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1486 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1487 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1488 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1489 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1490 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1491 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1492 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1493 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1494 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1495 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1496 "allow_cid" => array("type" => "mediumtext"),
1497 "allow_gid" => array("type" => "mediumtext"),
1498 "deny_cid" => array("type" => "mediumtext"),
1499 "deny_gid" => array("type" => "mediumtext"),
1500 "openidserver" => array("type" => "text"),
1503 "PRIMARY" => array("uid"),
1504 "nickname" => array("nickname(32)"),
1507 $database["userd"] = array(
1509 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1510 "username" => array("type" => "varchar(255)", "not null" => "1"),
1513 "PRIMARY" => array("id"),
1514 "username" => array("username(32)"),
1517 $database["workerqueue"] = array(
1519 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1520 "parameter" => array("type" => "text"),
1521 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1522 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1523 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1524 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1527 "PRIMARY" => array("id"),
1528 "created" => array("created"),
1537 * run from command line
1539 function dbstructure_run(&$argv, &$argc) {
1547 @include(".htconfig.php");
1548 require_once("include/dba.php");
1549 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1550 unset($db_host, $db_user, $db_pass, $db_data);
1556 update_structure(true, false);
1559 update_structure(true, true);
1561 $build = get_config('system','build');
1563 set_config('system','build',DB_UPDATE_VERSION);
1564 $build = DB_UPDATE_VERSION;
1567 $stored = intval($build);
1568 $current = intval(DB_UPDATE_VERSION);
1570 // run any left update_nnnn functions in update.php
1571 for($x = $stored; $x < $current; $x ++) {
1572 $r = run_update_function($x);
1576 set_config('system','build',DB_UPDATE_VERSION);
1579 // For the dump that is used to create the database.sql we always assume utfmb4
1580 $charset = "utf8mb4";
1581 print_structure(db_definition($charset), $charset);
1588 echo $argv[0]." <command>\n";
1591 echo "dryrun show database update schema queries without running them\n";
1592 echo "update update database schema\n";
1593 echo "dumpsql dump database schema\n";
1598 if (array_search(__file__,get_included_files())===0){
1599 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);