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
30 foreach ($adminlist as $admin) {
31 $lang = (($admin['language'])?$admin['language']:'en');
34 $preamble = deindent(t("
35 The friendica developers released update %s recently,
36 but when I tried to install it, something went terribly wrong.
37 This needs to be fixed soon and I can't do it alone. Please contact a
38 friendica developer if you can not help me on your own. My database might be invalid."));
39 $body = t("The error message is\n[pre]%s[/pre]");
40 $preamble = sprintf($preamble, $update_id);
41 $body = sprintf($body, $error_message);
44 'type' => "SYSTEM_EMAIL",
45 'to_email' => $admin['email'],
46 'preamble' => $preamble,
56 $email_tpl = get_intltext_template("update_fail_eml.tpl");
57 $email_msg = replace_macros($email_tpl, array(
58 '$sitename' => $a->config['sitename'],
59 '$siteurl' => $a->get_baseurl(),
60 '$update' => DB_UPDATE_VERSION,
61 '$error' => sprintf(t('Update %s failed. See error logs.'), DB_UPDATE_VERSION)
63 $subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
64 require_once('include/email.php');
65 $subject = email_header_encode($subject,'UTF-8');
66 mail($a->config['admin_email'], $subject, $email_msg,
67 'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME']."\n"
68 .'Content-type: text/plain; charset=UTF-8'."\n"
69 .'Content-transfer-encoding: 8bit');
72 logger("CRITICAL: Database structure update failed: ".$retval);
76 function table_structure($table) {
77 $structures = q("DESCRIBE `%s`", $table);
79 $indexes = q("SHOW INDEX FROM `%s`", $table);
84 if (dbm::is_result($indexes))
85 foreach ($indexes AS $index) {
86 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"].")";
101 $indexdata[$index["Key_name"]][] = $column;
104 if (dbm::is_result($structures)) {
105 foreach($structures AS $field) {
106 $fielddata[$field["Field"]]["type"] = $field["Type"];
107 if ($field["Null"] == "NO")
108 $fielddata[$field["Field"]]["not null"] = true;
110 if (isset($field["Default"]))
111 $fielddata[$field["Field"]]["default"] = $field["Default"];
113 if ($field["Extra"] != "")
114 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
116 if ($field["Key"] == "PRI")
117 $fielddata[$field["Field"]]["primary"] = true;
120 return(array("fields"=>$fielddata, "indexes"=>$indexdata));
123 function print_structure($database, $charset) {
124 echo "-- ------------------------------------------\n";
125 echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
126 echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
127 echo "-- ------------------------------------------\n\n\n";
128 foreach ($database AS $name => $structure) {
130 echo "-- TABLE $name\n";
132 db_create_table($name, $structure['fields'], $charset, true, false, $structure["indexes"]);
138 function update_structure($verbose, $action, $tables=null, $definition=null) {
142 set_config('system', 'maintenance', 1);
144 if (isset($a->config["system"]["db_charset"]))
145 $charset = $a->config["system"]["db_charset"];
151 logger('updating structure', LOGGER_DEBUG);
153 // Get the current structure
156 if (is_null($tables))
157 $tables = q("show tables");
159 foreach ($tables AS $table) {
160 $table = current($table);
162 logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
163 $database[$table] = table_structure($table);
166 // Get the definition
167 if (is_null($definition))
168 $definition = db_definition($charset);
170 // Ensure index conversion to unique removes duplicates
171 $sql_config = "SET session old_alter_table=1;";
173 echo $sql_config."\n";
175 @$db->q($sql_config);
177 // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
178 if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
179 !(strpos($db->server_info(), 'MariaDB') !== false)) {
186 foreach ($definition AS $name => $structure) {
187 $is_new_table = False;
189 if (!isset($database[$name])) {
190 $r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']);
191 if(!dbm::is_result($r)) {
192 $errors .= t('Errors encountered creating database tables.').$name.EOL;
194 $is_new_table = True;
196 // Drop the index if it isn't present in the definition
197 // or the definition differ from current status
198 // and index name doesn't start with "local_"
199 foreach ($database[$name]["indexes"] AS $indexname => $fieldnames) {
200 $current_index_definition = implode(",",$fieldnames);
201 if (isset($structure["indexes"][$indexname])) {
202 $new_index_definition = implode(",",$structure["indexes"][$indexname]);
204 $new_index_definition = "__NOT_SET__";
206 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
207 $sql2=db_drop_index($indexname);
209 $sql3 = "ALTER".$ignore." TABLE `".$name."` ".$sql2;
214 // Compare the field structure field by field
215 foreach ($structure["fields"] AS $fieldname => $parameters) {
216 if (!isset($database[$name]["fields"][$fieldname])) {
217 $sql2=db_add_table_field($fieldname, $parameters);
219 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
223 // Compare the field definition
224 $current_field_definition = implode(",",$database[$name]["fields"][$fieldname]);
225 $new_field_definition = implode(",",$parameters);
226 if ($current_field_definition != $new_field_definition) {
227 $sql2=db_modify_table_field($fieldname, $parameters);
229 $sql3 = "ALTER TABLE `".$name."` ".$sql2;
238 // Create the index if the index don't exists in database
239 // or the definition differ from the current status.
240 // Don't create keys if table is new
241 if (!$is_new_table) {
242 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
243 if (isset($database[$name]["indexes"][$indexname])) {
244 $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
246 $current_index_definition = "__NOT_SET__";
248 $new_index_definition = implode(",",$fieldnames);
249 if ($current_index_definition != $new_index_definition) {
250 $sql2=db_create_index($indexname, $fieldnames);
253 $sql3 = "ALTER" . $ignore . " TABLE `".$name."` ".$sql2;
268 if(dbm::is_result($r))
269 $errors .= t('Errors encountered performing database changes.').$sql3.EOL;
275 set_config('system', 'maintenance', 0);
280 function db_field_command($parameters, $create = true) {
281 $fieldstruct = $parameters["type"];
283 if ($parameters["not null"])
284 $fieldstruct .= " NOT NULL";
286 if (isset($parameters["default"])){
287 if (strpos(strtolower($parameters["type"]),"int")!==false) {
288 $fieldstruct .= " DEFAULT ".$parameters["default"];
290 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
293 if ($parameters["extra"] != "")
294 $fieldstruct .= " ".$parameters["extra"];
296 /*if (($parameters["primary"] != "") AND $create)
297 $fieldstruct .= " PRIMARY KEY";*/
299 return($fieldstruct);
302 function db_create_table($name, $fields, $charset, $verbose, $action, $indexes=null) {
310 $primary_keys = array();
311 foreach($fields AS $fieldname => $field) {
312 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
313 if (x($field,'primary') and $field['primary']!=''){
314 $primary_keys[] = $fieldname;
318 if (!is_null($indexes)) {
319 foreach ($indexes AS $indexname => $fieldnames) {
320 $sql_index = db_create_index($indexname, $fieldnames, "");
321 if (!is_null($sql_index)) $sql_rows[] = $sql_index;
325 $sql = implode(",\n\t", $sql_rows);
327 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT CHARSET=".$charset;
337 function db_add_table_field($fieldname, $parameters) {
338 $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
342 function db_modify_table_field($fieldname, $parameters) {
343 $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
347 function db_drop_index($indexname) {
348 $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
352 function db_create_index($indexname, $fieldnames, $method="ADD") {
354 $method = strtoupper(trim($method));
355 if ($method!="" && $method!="ADD") {
356 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
360 if ($fieldnames[0] == "UNIQUE") {
361 array_shift($fieldnames);
362 $method .= ' UNIQUE';
366 foreach ($fieldnames AS $fieldname) {
370 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches))
371 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
373 $names .= "`".dbesc($fieldname)."`";
376 if ($indexname == "PRIMARY") {
377 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
381 $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
385 function db_index_suffix($charset, $reduce = 0) {
386 if ($charset != "utf8mb4")
389 // On utf8mb4 indexes can only have a length of 191
390 $indexlength = 191 - $reduce;
392 return "(".$indexlength.")";
395 function db_definition($charset) {
399 $database["addon"] = array(
401 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
402 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
403 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
404 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
405 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
406 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
407 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
410 "PRIMARY" => array("id"),
413 $database["attach"] = array(
415 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
416 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
417 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
418 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
419 "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
420 "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
421 "data" => array("type" => "longblob", "not null" => "1"),
422 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
423 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
424 "allow_cid" => array("type" => "mediumtext"),
425 "allow_gid" => array("type" => "mediumtext"),
426 "deny_cid" => array("type" => "mediumtext"),
427 "deny_gid" => array("type" => "mediumtext"),
430 "PRIMARY" => array("id"),
433 $database["auth_codes"] = array(
435 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
436 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
437 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
438 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
439 "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
442 "PRIMARY" => array("id"),
445 $database["cache"] = array(
447 "k" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
448 "v" => array("type" => "text"),
449 "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
450 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
453 "PRIMARY" => array("k".db_index_suffix($charset)),
454 "updated" => array("updated"),
455 "expire_mode_updated" => array("expire_mode", "updated"),
458 $database["challenge"] = array(
460 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
461 "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
462 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
463 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
464 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
465 "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
468 "PRIMARY" => array("id"),
471 $database["clients"] = array(
473 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
474 "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
475 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
476 "name" => array("type" => "text"),
477 "icon" => array("type" => "text"),
478 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
481 "PRIMARY" => array("client_id"),
484 $database["config"] = array(
486 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
487 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
488 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
489 "v" => array("type" => "text"),
492 "PRIMARY" => array("id"),
493 "cat_k" => array("UNIQUE", "cat(30)","k(30)"),
496 $database["contact"] = array(
498 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
499 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
500 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
501 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
502 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
503 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
504 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
505 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
506 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
507 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
508 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
509 "about" => array("type" => "text"),
510 "keywords" => array("type" => "text"),
511 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
512 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
513 "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
514 "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
515 "photo" => array("type" => "text"),
516 "thumb" => array("type" => "text"),
517 "micro" => array("type" => "text"),
518 "site-pubkey" => array("type" => "text"),
519 "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
520 "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
521 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
522 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
523 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
524 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
525 "pubkey" => array("type" => "text"),
526 "prvkey" => array("type" => "text"),
527 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
528 "request" => array("type" => "text"),
529 "notify" => array("type" => "text"),
530 "poll" => array("type" => "text"),
531 "confirm" => array("type" => "text"),
532 "poco" => array("type" => "text"),
533 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
534 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
535 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
536 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
537 "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
538 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
539 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
540 "failure_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
541 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
542 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
543 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
544 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
545 "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
546 "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
547 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
548 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
549 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
550 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
551 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
552 "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
553 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
554 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
555 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
556 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
557 "reason" => array("type" => "text"),
558 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
559 "info" => array("type" => "mediumtext"),
560 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
561 "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
562 "bd" => array("type" => "date", "not null" => "1", "default" => "0000-00-00"),
563 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
564 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
565 "ffi_keyword_blacklist" => array("type" => "mediumtext"),
568 "PRIMARY" => array("id"),
569 "uid" => array("uid"),
570 "addr_uid" => array("addr", "uid"),
571 "nurl" => array("nurl"),
574 $database["conv"] = array(
576 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
577 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
578 "recips" => array("type" => "mediumtext"),
579 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
580 "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
581 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
582 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
583 "subject" => array("type" => "mediumtext"),
586 "PRIMARY" => array("id"),
587 "uid" => array("uid"),
590 $database["deliverq"] = array(
592 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
593 "cmd" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
594 "item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
595 "contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
598 "PRIMARY" => array("id"),
599 "cmd_item_contact" => array("UNIQUE", "cmd", "item", "contact"),
602 $database["event"] = array(
604 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
605 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
606 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
607 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
608 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
609 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
610 "start" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
611 "finish" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
612 "summary" => array("type" => "text"),
613 "desc" => array("type" => "text"),
614 "location" => array("type" => "text"),
615 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
616 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
617 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
618 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
619 "allow_cid" => array("type" => "mediumtext"),
620 "allow_gid" => array("type" => "mediumtext"),
621 "deny_cid" => array("type" => "mediumtext"),
622 "deny_gid" => array("type" => "mediumtext"),
625 "PRIMARY" => array("id"),
626 "uid" => array("uid"),
629 $database["fcontact"] = array(
631 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
632 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
633 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
634 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
635 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
636 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
637 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
638 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
639 "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
640 "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
641 "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
642 "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
643 "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
644 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
645 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
646 "pubkey" => array("type" => "text"),
647 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
650 "PRIMARY" => array("id"),
651 "addr" => array("addr"),
654 $database["ffinder"] = array(
656 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
657 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
658 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
659 "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
662 "PRIMARY" => array("id"),
665 $database["fserver"] = array(
667 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
668 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
669 "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
670 "key" => array("type" => "text"),
673 "PRIMARY" => array("id"),
674 "server" => array("server"),
677 $database["fsuggest"] = array(
679 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
680 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
681 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
682 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
683 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
684 "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
685 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
686 "note" => array("type" => "text"),
687 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
690 "PRIMARY" => array("id"),
693 $database["gcign"] = array(
695 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
696 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
697 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
700 "PRIMARY" => array("id"),
701 "uid" => array("uid"),
702 "gcid" => array("gcid"),
705 $database["gcontact"] = array(
707 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
708 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
709 "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
710 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
711 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
712 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
713 "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
714 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
715 "updated" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
716 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
717 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
718 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
719 "about" => array("type" => "text"),
720 "keywords" => array("type" => "text"),
721 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
722 "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
723 "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
724 "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
725 "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
726 "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
727 "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
728 "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
729 "notify" => array("type" => "text"),
730 "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
731 "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
732 "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
735 "PRIMARY" => array("id"),
736 "nurl" => array("nurl"),
737 "name" => array("name"),
738 "nick" => array("nick"),
739 "addr" => array("addr"),
740 "updated" => array("updated"),
743 $database["glink"] = array(
745 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
746 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
747 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
748 "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
749 "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
750 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
753 "PRIMARY" => array("id"),
754 "cid_uid_gcid_zcid" => array("cid","uid","gcid","zcid"),
755 "gcid" => array("gcid"),
756 "zcid" => array("zcid"),
759 $database["group"] = array(
761 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
762 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
763 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
764 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
765 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
768 "PRIMARY" => array("id"),
769 "uid" => array("uid"),
772 $database["group_member"] = array(
774 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
775 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
776 "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
777 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
780 "PRIMARY" => array("id"),
781 "uid_gid_contactid" => array("uid","gid","contact-id"),
784 $database["gserver"] = array(
786 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
787 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
788 "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
789 "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
790 "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
791 "info" => array("type" => "text"),
792 "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
793 "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
794 "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
795 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
796 "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
797 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
798 "last_poco_query" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
799 "last_contact" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
800 "last_failure" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
803 "PRIMARY" => array("id"),
804 "nurl" => array("nurl"),
807 $database["hook"] = array(
809 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
810 "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
811 "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
812 "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
813 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
816 "PRIMARY" => array("id"),
817 "hook_file_function" => array("hook(30)","file(60)","function(30)"),
820 $database["intro"] = array(
822 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
823 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
824 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
825 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
826 "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
827 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
828 "note" => array("type" => "text"),
829 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
830 "datetime" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
831 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
832 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
835 "PRIMARY" => array("id"),
838 $database["item"] = array(
840 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
841 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
842 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
843 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
844 "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
845 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
846 "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
847 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
848 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
849 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
850 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
851 "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
852 "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
853 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
854 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
855 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
856 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
857 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
858 "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
859 "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
860 "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
861 "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
862 "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
863 "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
864 "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
865 "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
866 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
867 "body" => array("type" => "mediumtext"),
868 "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
869 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
870 "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
871 "object" => array("type" => "text"),
872 "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
873 "target" => array("type" => "text"),
874 "postopts" => array("type" => "text"),
875 "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
876 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
877 "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
878 "tag" => array("type" => "mediumtext"),
879 "attach" => array("type" => "mediumtext"),
880 "inform" => array("type" => "mediumtext"),
881 "file" => array("type" => "mediumtext"),
882 "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
883 "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
884 "allow_cid" => array("type" => "mediumtext"),
885 "allow_gid" => array("type" => "mediumtext"),
886 "deny_cid" => array("type" => "mediumtext"),
887 "deny_gid" => array("type" => "mediumtext"),
888 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
889 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
890 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
891 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
892 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
893 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
894 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
895 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
896 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
897 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
898 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
899 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
900 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
901 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
902 "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
903 "rendered-html" => array("type" => "mediumtext"),
904 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
907 "PRIMARY" => array("id"),
908 "guid" => array("guid"),
909 "uri" => array("uri"),
910 "parent" => array("parent"),
911 "parent-uri" => array("parent-uri"),
912 "extid" => array("extid"),
913 "uid_id" => array("uid","id"),
914 "uid_created" => array("uid","created"),
915 "uid_unseen_contactid" => array("uid","unseen","contact-id"),
916 "uid_network_received" => array("uid","network","received"),
917 "uid_received" => array("uid","received"),
918 "uid_network_commented" => array("uid","network","commented"),
919 "uid_commented" => array("uid","commented"),
920 "uid_title" => array("uid","title"),
921 "uid_thrparent" => array("uid","thr-parent"),
922 "uid_parenturi" => array("uid","parent-uri"),
923 "uid_contactid_id" => array("uid","contact-id","id"),
924 "uid_contactid_created" => array("uid","contact-id","created"),
925 "gcontactid_uid_created" => array("gcontact-id","uid","created"),
926 "authorid_created" => array("author-id","created"),
927 "ownerid_created" => array("owner-id","created"),
928 "wall_body" => array("wall","body(6)"),
929 "uid_visible_moderated_created" => array("uid","visible","moderated","created"),
930 "uid_uri" => array("uid", "uri"),
931 "uid_wall_created" => array("uid","wall","created"),
932 "resource-id" => array("resource-id"),
933 "uid_type" => array("uid","type"),
934 "uid_starred_id" => array("uid","starred", "id"),
935 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
936 "uid_wall_parent_created" => array("uid","wall","parent","created"),
937 "uid_type_changed" => array("uid","type","changed"),
938 "contactid_verb" => array("contact-id","verb"),
939 "deleted_changed" => array("deleted","changed"),
940 "uid_wall_changed" => array("uid","wall","changed"),
941 "uid_eventid" => array("uid","event-id"),
942 "uid_authorlink" => array("uid","author-link"),
943 "uid_ownerlink" => array("uid","owner-link"),
946 $database["item_id"] = array(
948 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
949 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
950 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
951 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
952 "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
955 "PRIMARY" => array("id"),
956 "uid" => array("uid"),
957 "sid" => array("sid"),
958 "service" => array("service"),
959 "iid" => array("iid"),
962 $database["locks"] = array(
964 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
965 "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
966 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
967 "created" => array("type" => "datetime", "default" => "0000-00-00 00:00:00"),
970 "PRIMARY" => array("id"),
973 $database["mail"] = array(
975 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
976 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
977 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
978 "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
979 "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
980 "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
981 "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
982 "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
983 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
984 "body" => array("type" => "mediumtext"),
985 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
986 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
987 "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
988 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
989 "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
990 "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
991 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
994 "PRIMARY" => array("id"),
995 "uid" => array("uid"),
996 "guid" => array("guid"),
997 "convid" => array("convid"),
998 "reply" => array("reply"),
999 "uri" => array("uri"),
1000 "parent-uri" => array("parent-uri"),
1003 $database["mailacct"] = array(
1005 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1006 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1007 "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1008 "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1009 "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1010 "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1011 "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1012 "pass" => array("type" => "text"),
1013 "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1014 "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1015 "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1016 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1017 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1020 "PRIMARY" => array("id"),
1023 $database["manage"] = array(
1025 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1026 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1027 "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1030 "PRIMARY" => array("id"),
1031 "uid_mid" => array("uid","mid"),
1034 $database["notify"] = array(
1036 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1037 "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1038 "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1039 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1040 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1041 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1042 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1043 "msg" => array("type" => "mediumtext"),
1044 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1045 "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1046 "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1047 "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1048 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1049 "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1050 "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1051 "name_cache" => array("type" => "tinytext"),
1052 "msg_cache" => array("type" => "mediumtext")
1055 "PRIMARY" => array("id"),
1056 "uid" => array("uid"),
1059 $database["notify-threads"] = array(
1061 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1062 "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1063 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1064 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1065 "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1068 "PRIMARY" => array("id"),
1069 "master-parent-item" => array("master-parent-item"),
1070 "receiver-uid" => array("receiver-uid"),
1073 $database["oembed"] = array(
1075 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1076 "content" => array("type" => "text"),
1077 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1080 "PRIMARY" => array("url".db_index_suffix($charset)),
1081 "created" => array("created"),
1084 $database["parsed_url"] = array(
1086 "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
1087 "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1088 "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1089 "content" => array("type" => "text"),
1090 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1093 "PRIMARY" => array("url".db_index_suffix($charset), "guessing", "oembed"),
1094 "created" => array("created"),
1097 $database["pconfig"] = array(
1099 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1100 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1101 "cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1102 "k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1103 "v" => array("type" => "mediumtext"),
1106 "PRIMARY" => array("id"),
1107 "uid_cat_k" => array("UNIQUE", "uid","cat(30)","k(30)"),
1110 $database["photo"] = array(
1112 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1113 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1114 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1115 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1116 "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1117 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1118 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1119 "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1120 "desc" => array("type" => "text"),
1121 "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1122 "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1123 "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1124 "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1125 "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1126 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1127 "data" => array("type" => "mediumblob", "not null" => "1"),
1128 "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1129 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1130 "allow_cid" => array("type" => "mediumtext"),
1131 "allow_gid" => array("type" => "mediumtext"),
1132 "deny_cid" => array("type" => "mediumtext"),
1133 "deny_gid" => array("type" => "mediumtext"),
1136 "PRIMARY" => array("id"),
1137 "uid_contactid" => array("uid", "contact-id"),
1138 "uid_profile" => array("uid", "profile"),
1139 "uid_album_created" => array("uid", "album", "created"),
1140 "resource-id" => array("resource-id"),
1141 "guid" => array("guid"),
1144 $database["poll"] = array(
1146 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1147 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1148 "q0" => array("type" => "mediumtext"),
1149 "q1" => array("type" => "mediumtext"),
1150 "q2" => array("type" => "mediumtext"),
1151 "q3" => array("type" => "mediumtext"),
1152 "q4" => array("type" => "mediumtext"),
1153 "q5" => array("type" => "mediumtext"),
1154 "q6" => array("type" => "mediumtext"),
1155 "q7" => array("type" => "mediumtext"),
1156 "q8" => array("type" => "mediumtext"),
1157 "q9" => array("type" => "mediumtext"),
1160 "PRIMARY" => array("id"),
1161 "uid" => array("uid"),
1164 $database["poll_result"] = array(
1166 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1167 "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1168 "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1171 "PRIMARY" => array("id"),
1172 "poll_id" => array("poll_id"),
1173 "choice" => array("choice"),
1176 $database["process"] = array(
1178 "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1179 "command" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1180 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1183 "PRIMARY" => array("pid"),
1184 "command" => array("command"),
1187 $database["profile"] = array(
1189 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1190 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1191 "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1192 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1193 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1194 "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1195 "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1196 "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0000-00-00"),
1197 "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1198 "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1199 "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1200 "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1201 "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1202 "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1203 "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1204 "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1205 "with" => array("type" => "text"),
1206 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1207 "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1208 "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1209 "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1210 "pub_keywords" => array("type" => "text"),
1211 "prv_keywords" => array("type" => "text"),
1212 "likes" => array("type" => "text"),
1213 "dislikes" => array("type" => "text"),
1214 "about" => array("type" => "text"),
1215 "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1216 "music" => array("type" => "text"),
1217 "book" => array("type" => "text"),
1218 "tv" => array("type" => "text"),
1219 "film" => array("type" => "text"),
1220 "interest" => array("type" => "text"),
1221 "romance" => array("type" => "text"),
1222 "work" => array("type" => "text"),
1223 "education" => array("type" => "text"),
1224 "contact" => array("type" => "text"),
1225 "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1226 "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1227 "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1228 "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1229 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1230 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1233 "PRIMARY" => array("id"),
1234 "hometown" => array("hometown"),
1237 $database["profile_check"] = array(
1239 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1240 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1241 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1242 "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1243 "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1244 "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1247 "PRIMARY" => array("id"),
1250 $database["push_subscriber"] = array(
1252 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1253 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1254 "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1255 "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1256 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1257 "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1258 "last_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1259 "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1262 "PRIMARY" => array("id"),
1265 $database["queue"] = array(
1267 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1268 "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1269 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1270 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1271 "last" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1272 "content" => array("type" => "mediumtext"),
1273 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1276 "PRIMARY" => array("id"),
1277 "cid" => array("cid"),
1278 "created" => array("created"),
1279 "last" => array("last"),
1280 "network" => array("network"),
1281 "batch" => array("batch"),
1284 $database["register"] = array(
1286 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1287 "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1288 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1289 "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1290 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1291 "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1292 "note" => array("type" => "text"),
1295 "PRIMARY" => array("id"),
1298 $database["search"] = array(
1300 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1301 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1302 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1305 "PRIMARY" => array("id"),
1306 "uid" => array("uid"),
1307 "term" => array("term"),
1310 $database["session"] = array(
1312 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1313 "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1314 "data" => array("type" => "text"),
1315 "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1318 "PRIMARY" => array("id"),
1319 "sid" => array("sid"),
1320 "expire" => array("expire"),
1323 $database["sign"] = array(
1325 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1326 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1327 "signed_text" => array("type" => "mediumtext"),
1328 "signature" => array("type" => "text"),
1329 "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1332 "PRIMARY" => array("id"),
1333 "iid" => array("iid"),
1336 $database["spam"] = array(
1338 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1339 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1340 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1341 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1342 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1343 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1346 "PRIMARY" => array("id"),
1347 "uid" => array("uid"),
1348 "spam" => array("spam"),
1349 "ham" => array("ham"),
1350 "term" => array("term"),
1353 $database["term"] = array(
1355 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1356 "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1357 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1358 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1359 "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1360 "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1361 "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1362 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1363 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1364 "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1365 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1366 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1369 "PRIMARY" => array("tid"),
1370 "oid_otype_type_term" => array("oid","otype","type","term"),
1371 "uid_term_tid" => array("uid","term","tid"),
1372 "type_term" => array("type","term"),
1373 "uid_otype_type_term_global_created" => array("uid","otype","type","term","global","created"),
1374 "otype_type_term_tid" => array("otype","type","term","tid"),
1375 "uid_otype_type_url" => array("uid","otype","type","url"),
1376 "guid" => array("guid"),
1379 $database["thread"] = array(
1381 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1382 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1383 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1384 "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1385 "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1386 "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1387 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1388 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1389 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1390 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1391 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1392 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1393 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1394 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1395 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1396 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1397 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1398 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1399 "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1400 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1401 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1402 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1403 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1404 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1405 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1406 "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1409 "PRIMARY" => array("iid"),
1410 "created" => array("created"),
1411 "commented" => array("commented"),
1412 "uid_network_commented" => array("uid","network","commented"),
1413 "uid_network_created" => array("uid","network","created"),
1414 "uid_contactid_commented" => array("uid","contact-id","commented"),
1415 "uid_contactid_created" => array("uid","contact-id","created"),
1416 "uid_gcontactid_commented" => array("uid","gcontact-id","commented"),
1417 "uid_gcontactid_created" => array("uid","gcontact-id","created"),
1418 "wall_private_received" => array("wall","private","received"),
1419 "uid_created" => array("uid","created"),
1420 "uid_commented" => array("uid","commented"),
1423 $database["tokens"] = array(
1425 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1426 "secret" => array("type" => "text"),
1427 "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
1428 "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1429 "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1430 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1433 "PRIMARY" => array("id"),
1436 $database["user"] = array(
1438 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1439 "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1440 "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1441 "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1442 "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1443 "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1444 "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1445 "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1446 "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1447 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1448 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1449 "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1450 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1451 "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1452 "pubkey" => array("type" => "text"),
1453 "prvkey" => array("type" => "text"),
1454 "spubkey" => array("type" => "text"),
1455 "sprvkey" => array("type" => "text"),
1456 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1457 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1458 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1459 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1460 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1461 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1462 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1463 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1464 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1465 "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1466 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1467 "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1468 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1469 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1470 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1471 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1472 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1473 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1474 "service_class" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1475 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1476 "allow_cid" => array("type" => "mediumtext"),
1477 "allow_gid" => array("type" => "mediumtext"),
1478 "deny_cid" => array("type" => "mediumtext"),
1479 "deny_gid" => array("type" => "mediumtext"),
1480 "openidserver" => array("type" => "text"),
1483 "PRIMARY" => array("uid"),
1484 "nickname" => array("nickname"),
1487 $database["userd"] = array(
1489 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1490 "username" => array("type" => "varchar(255)", "not null" => "1"),
1493 "PRIMARY" => array("id"),
1494 "username" => array("username"),
1497 $database["workerqueue"] = array(
1499 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1500 "parameter" => array("type" => "text"),
1501 "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1502 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1503 "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1504 "executed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1507 "PRIMARY" => array("id"),
1508 "created" => array("created"),
1517 * run from command line
1519 function dbstructure_run(&$argv, &$argc) {
1527 @include(".htconfig.php");
1528 require_once("include/dba.php");
1529 $db = new dba($db_host, $db_user, $db_pass, $db_data);
1530 unset($db_host, $db_user, $db_pass, $db_data);
1536 update_structure(true, false);
1539 update_structure(true, true);
1541 $build = get_config('system','build');
1543 set_config('system','build',DB_UPDATE_VERSION);
1544 $build = DB_UPDATE_VERSION;
1547 $stored = intval($build);
1548 $current = intval(DB_UPDATE_VERSION);
1550 // run any left update_nnnn functions in update.php
1551 for($x = $stored; $x < $current; $x ++) {
1552 $r = run_update_function($x);
1556 set_config('system','build',DB_UPDATE_VERSION);
1559 // For the dump that is used to create the database.sql we always assume utfmb4
1560 $charset = "utf8mb4";
1561 print_structure(db_definition($charset), $charset);
1568 echo $argv[0]." <command>\n";
1571 echo "dryrun show database update schema queries without running them\n";
1572 echo "update update database schema\n";
1573 echo "dumpsql dump database schema\n";
1581 if (array_search(__file__,get_included_files())===0){
1582 dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);