3 require_once("boot.php");
5 function dbstructure_run(&$argv, &$argc) {
13 @include(".htconfig.php");
14 require_once("include/dba.php");
15 $db = new dba($db_host, $db_user, $db_pass, $db_data);
16 unset($db_host, $db_user, $db_pass, $db_data);
19 load_config('config');
20 load_config('system');
25 if (array_search(__file__,get_included_files())===0){
26 dbstructure_run($argv,$argc);
30 function table_structure($table) {
31 $structures = q("DESCRIBE `%s`", $table);
33 $indexes = q("SHOW INDEX FROM `%s`", $table);
38 if (is_array($indexes))
39 foreach ($indexes AS $index) {
40 if ($index["Index_type"] == "FULLTEXT")
43 $column = $index["Column_name"];
44 if ($index["Sub_part"] != "")
45 $column .= "(".$index["Sub_part"].")";
47 $indexdata[$index["Key_name"]][] = $column;
50 if (is_array($structures)) {
51 foreach($structures AS $field) {
52 $fielddata[$field["Field"]]["type"] = $field["Type"];
53 if ($field["Null"] == "NO")
54 $fielddata[$field["Field"]]["not null"] = true;
56 if ($field["Default"] != "")
57 $fielddata[$field["Field"]]["default"] = $field["Default"];
59 if ($field["Extra"] != "")
60 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
62 if ($field["Key"] == "PRI")
63 $fielddata[$field["Field"]]["primary"] = true;
67 return(array("fields"=>$fielddata, "indexes"=>$indexdata));
70 function print_structure($db) {
71 foreach ($db AS $name => $structure) {
72 echo "\t".'$db["'.$name."\"] = array(\n";
74 echo "\t\t\t".'"fields" => array('."\n";
75 foreach ($structure["fields"] AS $fieldname => $parameters) {
76 echo "\t\t\t\t\t".'"'.$fieldname.'" => array(';
79 foreach ($parameters AS $name => $value) {
82 $data .= '"'.$name.'" => "'.$value.'"';
87 echo "\t\t\t\t\t),\n";
88 echo "\t\t\t".'"indexes" => array('."\n";
89 foreach ($structure["indexes"] AS $indexname => $fieldnames) {
90 echo "\t\t\t\t\t".'"'.$indexname.'" => array("'.implode($fieldnames, '","').'"'."),\n";
97 function update_structure($a) {
99 // Get the current structure
102 $tables = q("show tables");
104 foreach ($tables AS $table) {
105 $table = current($table);
107 $db[$table] = table_structure($table);
110 // Get the definition
111 $definition = db_definition();
114 foreach ($definition AS $name => $structure) {
115 if (!isset($db[$name]))
116 db_create_table($name, $structure["fields"]);
118 // Compare the field structure field by field
119 foreach ($structure["fields"] AS $fieldname => $parameters) {
120 if (!isset($db[$name]["fields"][$fieldname]))
121 db_add_table_field($name, $fieldname, $parameters);
123 // Compare the field definition
124 $current_field_definition = implode($db[$name]["fields"][$fieldname]);
125 $new_field_definition = implode($parameters);
126 if ($current_field_definition != $new_field_definition)
127 db_modify_table_field($name, $fieldname, $parameters);
132 // Drop the index if it isn't present in the definition
133 if (isset($db[$name]))
134 foreach ($db[$name]["indexes"] AS $indexname => $fieldnames)
135 if (!isset($structure["indexes"][$indexname]))
136 db_drop_index($name, $indexname);
139 foreach ($structure["indexes"] AS $indexname => $fieldnames)
140 if (!isset($db[$name]["indexes"][$indexname]))
141 db_create_index($name, $indexname, $fieldnames);
145 function db_field_command($parameters, $create = true) {
146 $fieldstruct = $parameters["type"];
148 if ($parameters["not null"])
149 $fieldstruct .= " NOT NULL";
151 if ($parameters["default"] != "")
152 $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
154 if ($parameters["extra"] != "")
155 $fieldstruct .= " ".$parameters["extra"];
157 if (($parameters["primary"] != "") AND $create)
158 $fieldstruct .= " PRIMARY KEY";
160 return($fieldstruct);
163 function db_create_table($name, $fields) {
165 foreach($fields AS $fieldname => $field) {
169 $sql .= "`".dbesc($fieldname)."` ".db_field_command($field);
172 $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n", dbesc($name)).$sql."\n) DEFAULT CHARSET=utf8";
177 function db_add_table_field($name, $fieldname, $parameters) {
178 $sql = sprintf("ALTER TABLE `%s` ADD `%s` %s", dbesc($name), dbesc($fieldname), db_field_command($parameters));
183 function db_modify_table_field($name, $fieldname, $parameters) {
184 $sql = sprintf("ALTER TABLE `%s` MODIFY `%s` %s", dbesc($name), dbesc($fieldname), db_field_command($parameters, false));
189 function db_drop_index($name, $indexname) {
190 $sql = sprintf("DROP INDEX `%s` ON `%s`", dbesc($indexname), dbesc($name));
195 function db_create_index($name, $indexname, $fieldnames) {
197 if ($indexname == "PRIMARY")
201 foreach ($fieldnames AS $fieldname) {
205 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches))
206 $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
208 $names .= "`".dbesc($fieldname)."`";
211 $sql = sprintf("CREATE INDEX `%s` ON `%s`(%s)", dbesc($indexname), dbesc($name), $names);
216 function db_definition() {
220 $db["addon"] = array(
222 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
223 "name" => array("type" => "char(255)", "not null" => "1"),
224 "version" => array("type" => "char(255)", "not null" => "1"),
225 "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
226 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
227 "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
228 "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
231 "PRIMARY" => array("id"),
234 $db["attach"] = array(
236 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
237 "uid" => array("type" => "int(11)", "not null" => "1"),
238 "hash" => array("type" => "char(64)", "not null" => "1"),
239 "filename" => array("type" => "char(255)", "not null" => "1"),
240 "filetype" => array("type" => "char(64)", "not null" => "1"),
241 "filesize" => array("type" => "int(11)", "not null" => "1"),
242 "data" => array("type" => "longblob", "not null" => "1"),
243 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
244 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
245 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
246 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
247 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
248 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
251 "PRIMARY" => array("id"),
254 $db["auth_codes"] = array(
256 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
257 "client_id" => array("type" => "varchar(20)", "not null" => "1"),
258 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1"),
259 "expires" => array("type" => "int(11)", "not null" => "1"),
260 "scope" => array("type" => "varchar(250)", "not null" => "1"),
263 "PRIMARY" => array("id"),
266 $db["cache"] = array(
268 "k" => array("type" => "char(255)", "not null" => "1", "primary" => "1"),
269 "v" => array("type" => "text", "not null" => "1"),
270 "updated" => array("type" => "datetime", "not null" => "1"),
273 "PRIMARY" => array("k"),
274 "updated" => array("updated"),
277 $db["challenge"] = array(
279 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
280 "challenge" => array("type" => "char(255)", "not null" => "1"),
281 "dfrn-id" => array("type" => "char(255)", "not null" => "1"),
282 "expire" => array("type" => "int(11)", "not null" => "1"),
283 "type" => array("type" => "char(255)", "not null" => "1"),
284 "last_update" => array("type" => "char(255)", "not null" => "1"),
287 "PRIMARY" => array("id"),
290 $db["clients"] = array(
292 "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
293 "pw" => array("type" => "varchar(20)", "not null" => "1"),
294 "redirect_uri" => array("type" => "varchar(200)", "not null" => "1"),
295 "name" => array("type" => "text"),
296 "icon" => array("type" => "text"),
297 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
300 "PRIMARY" => array("client_id"),
303 $db["config"] = array(
305 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
306 "cat" => array("type" => "char(255)", "not null" => "1"),
307 "k" => array("type" => "char(255)", "not null" => "1"),
308 "v" => array("type" => "text", "not null" => "1"),
311 "PRIMARY" => array("id"),
312 "access" => array("cat","k"),
315 $db["contact"] = array(
317 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
318 "uid" => array("type" => "int(11)", "not null" => "1"),
319 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
320 "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
321 "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
322 "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
323 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
324 "network" => array("type" => "char(255)", "not null" => "1"),
325 "name" => array("type" => "char(255)", "not null" => "1"),
326 "nick" => array("type" => "char(255)", "not null" => "1"),
327 "attag" => array("type" => "char(255)", "not null" => "1"),
328 "photo" => array("type" => "text", "not null" => "1"),
329 "thumb" => array("type" => "text", "not null" => "1"),
330 "micro" => array("type" => "text", "not null" => "1"),
331 "site-pubkey" => array("type" => "text", "not null" => "1"),
332 "issued-id" => array("type" => "char(255)", "not null" => "1"),
333 "dfrn-id" => array("type" => "char(255)", "not null" => "1"),
334 "url" => array("type" => "char(255)", "not null" => "1"),
335 "nurl" => array("type" => "char(255)", "not null" => "1"),
336 "addr" => array("type" => "char(255)", "not null" => "1"),
337 "alias" => array("type" => "char(255)", "not null" => "1"),
338 "pubkey" => array("type" => "text", "not null" => "1"),
339 "prvkey" => array("type" => "text", "not null" => "1"),
340 "batch" => array("type" => "char(255)", "not null" => "1"),
341 "request" => array("type" => "text", "not null" => "1"),
342 "notify" => array("type" => "text", "not null" => "1"),
343 "poll" => array("type" => "text", "not null" => "1"),
344 "confirm" => array("type" => "text", "not null" => "1"),
345 "poco" => array("type" => "text", "not null" => "1"),
346 "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
347 "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
348 "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
349 "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
350 "hub-verify" => array("type" => "char(255)", "not null" => "1"),
351 "last-update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
352 "success_update" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
353 "name-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
354 "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
355 "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
356 "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
357 "priority" => array("type" => "tinyint(3)", "not null" => "1"),
358 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
359 "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
360 "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
361 "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
362 "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
363 "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
364 "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
365 "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
366 "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
367 "reason" => array("type" => "text", "not null" => "1"),
368 "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
369 "info" => array("type" => "mediumtext", "not null" => "1"),
370 "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
371 "bdyear" => array("type" => "char(4)", "not null" => "1"),
372 "bd" => array("type" => "date", "not null" => "1"),
373 "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
374 "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
377 "PRIMARY" => array("id"),
378 "uid" => array("uid"),
383 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
384 "guid" => array("type" => "char(64)", "not null" => "1"),
385 "recips" => array("type" => "mediumtext", "not null" => "1"),
386 "uid" => array("type" => "int(11)", "not null" => "1"),
387 "creator" => array("type" => "char(255)", "not null" => "1"),
388 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
389 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
390 "subject" => array("type" => "mediumtext", "not null" => "1"),
393 "PRIMARY" => array("id"),
394 "uid" => array("uid"),
397 $db["deliverq"] = array(
399 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
400 "cmd" => array("type" => "char(32)", "not null" => "1"),
401 "item" => array("type" => "int(11)", "not null" => "1"),
402 "contact" => array("type" => "int(11)", "not null" => "1"),
405 "PRIMARY" => array("id"),
408 $db["dsprphotoq"] = array(
410 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
411 "uid" => array("type" => "int(11)", "not null" => "1"),
412 "msg" => array("type" => "mediumtext", "not null" => "1"),
413 "attempt" => array("type" => "tinyint(4)", "not null" => "1"),
416 "PRIMARY" => array("id"),
419 $db["event"] = array(
421 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
422 "uid" => array("type" => "int(11)", "not null" => "1"),
423 "cid" => array("type" => "int(11)", "not null" => "1"),
424 "uri" => array("type" => "char(255)", "not null" => "1"),
425 "created" => array("type" => "datetime", "not null" => "1"),
426 "edited" => array("type" => "datetime", "not null" => "1"),
427 "start" => array("type" => "datetime", "not null" => "1"),
428 "finish" => array("type" => "datetime", "not null" => "1"),
429 "summary" => array("type" => "text", "not null" => "1"),
430 "desc" => array("type" => "text", "not null" => "1"),
431 "location" => array("type" => "text", "not null" => "1"),
432 "type" => array("type" => "char(255)", "not null" => "1"),
433 "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
434 "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
435 "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
436 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
437 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
438 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
439 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
442 "PRIMARY" => array("id"),
443 "uid" => array("uid"),
446 $db["fcontact"] = array(
448 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
449 "url" => array("type" => "char(255)", "not null" => "1"),
450 "name" => array("type" => "char(255)", "not null" => "1"),
451 "photo" => array("type" => "char(255)", "not null" => "1"),
452 "request" => array("type" => "char(255)", "not null" => "1"),
453 "nick" => array("type" => "char(255)", "not null" => "1"),
454 "addr" => array("type" => "char(255)", "not null" => "1"),
455 "batch" => array("type" => "char(255)", "not null" => "1"),
456 "notify" => array("type" => "char(255)", "not null" => "1"),
457 "poll" => array("type" => "char(255)", "not null" => "1"),
458 "confirm" => array("type" => "char(255)", "not null" => "1"),
459 "priority" => array("type" => "tinyint(1)", "not null" => "1"),
460 "network" => array("type" => "char(32)", "not null" => "1"),
461 "alias" => array("type" => "char(255)", "not null" => "1"),
462 "pubkey" => array("type" => "text", "not null" => "1"),
463 "updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
466 "PRIMARY" => array("id"),
467 "addr" => array("addr"),
470 $db["ffinder"] = array(
472 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
473 "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
474 "cid" => array("type" => "int(10) unsigned", "not null" => "1"),
475 "fid" => array("type" => "int(10) unsigned", "not null" => "1"),
478 "PRIMARY" => array("id"),
481 $db["fserver"] = array(
483 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
484 "server" => array("type" => "char(255)", "not null" => "1"),
485 "posturl" => array("type" => "char(255)", "not null" => "1"),
486 "key" => array("type" => "text", "not null" => "1"),
489 "PRIMARY" => array("id"),
490 "server" => array("server"),
493 $db["fsuggest"] = array(
495 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
496 "uid" => array("type" => "int(11)", "not null" => "1"),
497 "cid" => array("type" => "int(11)", "not null" => "1"),
498 "name" => array("type" => "char(255)", "not null" => "1"),
499 "url" => array("type" => "char(255)", "not null" => "1"),
500 "request" => array("type" => "char(255)", "not null" => "1"),
501 "photo" => array("type" => "char(255)", "not null" => "1"),
502 "note" => array("type" => "text", "not null" => "1"),
503 "created" => array("type" => "datetime", "not null" => "1"),
506 "PRIMARY" => array("id"),
509 $db["gcign"] = array(
511 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
512 "uid" => array("type" => "int(11)", "not null" => "1"),
513 "gcid" => array("type" => "int(11)", "not null" => "1"),
516 "PRIMARY" => array("id"),
517 "uid" => array("uid"),
518 "gcid" => array("gcid"),
521 $db["gcontact"] = array(
523 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
524 "name" => array("type" => "char(255)", "not null" => "1"),
525 "url" => array("type" => "char(255)", "not null" => "1"),
526 "nurl" => array("type" => "char(255)", "not null" => "1"),
527 "photo" => array("type" => "char(255)", "not null" => "1"),
528 "connect" => array("type" => "char(255)", "not null" => "1"),
531 "PRIMARY" => array("id"),
532 "nurl" => array("nurl"),
535 $db["glink"] = array(
537 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
538 "cid" => array("type" => "int(11)", "not null" => "1"),
539 "uid" => array("type" => "int(11)", "not null" => "1"),
540 "gcid" => array("type" => "int(11)", "not null" => "1"),
541 "zcid" => array("type" => "int(11)", "not null" => "1"),
542 "updated" => array("type" => "datetime", "not null" => "1"),
545 "PRIMARY" => array("id"),
546 "cid_uid_gcid_zcid" => array("cid","uid","gcid","zcid"),
547 "gcid" => array("gcid"),
548 "zcid" => array("zcid"),
551 $db["group"] = array(
553 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
554 "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
555 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
556 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
557 "name" => array("type" => "char(255)", "not null" => "1"),
560 "PRIMARY" => array("id"),
561 "uid" => array("uid"),
564 $db["group_member"] = array(
566 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
567 "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
568 "gid" => array("type" => "int(10) unsigned", "not null" => "1"),
569 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1"),
572 "PRIMARY" => array("id"),
573 "uid_gid_contactid" => array("uid","gid","contact-id"),
578 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
579 "guid" => array("type" => "char(64)", "not null" => "1"),
582 "PRIMARY" => array("id"),
583 "guid" => array("guid"),
588 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
589 "hook" => array("type" => "char(255)", "not null" => "1"),
590 "file" => array("type" => "char(255)", "not null" => "1"),
591 "function" => array("type" => "char(255)", "not null" => "1"),
592 "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
595 "PRIMARY" => array("id"),
596 "hook_file_function" => array("hook","file","function"),
599 $db["intro"] = array(
601 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
602 "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
603 "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
604 "contact-id" => array("type" => "int(11)", "not null" => "1"),
605 "knowyou" => array("type" => "tinyint(1)", "not null" => "1"),
606 "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
607 "note" => array("type" => "text", "not null" => "1"),
608 "hash" => array("type" => "char(255)", "not null" => "1"),
609 "datetime" => array("type" => "datetime", "not null" => "1"),
610 "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
611 "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
614 "PRIMARY" => array("id"),
619 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
620 "guid" => array("type" => "char(64)", "not null" => "1"),
621 "uri" => array("type" => "char(255)", "not null" => "1"),
622 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
623 "contact-id" => array("type" => "int(11)", "not null" => "1"),
624 "type" => array("type" => "char(255)", "not null" => "1"),
625 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
626 "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
627 "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
628 "parent-uri" => array("type" => "char(255)", "not null" => "1"),
629 "extid" => array("type" => "char(255)", "not null" => "1"),
630 "thr-parent" => array("type" => "char(255)", "not null" => "1"),
631 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
632 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
633 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
634 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
635 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
636 "owner-name" => array("type" => "char(255)", "not null" => "1"),
637 "owner-link" => array("type" => "char(255)", "not null" => "1"),
638 "owner-avatar" => array("type" => "char(255)", "not null" => "1"),
639 "author-name" => array("type" => "char(255)", "not null" => "1"),
640 "author-link" => array("type" => "char(255)", "not null" => "1"),
641 "author-avatar" => array("type" => "char(255)", "not null" => "1"),
642 "title" => array("type" => "char(255)", "not null" => "1"),
643 "body" => array("type" => "mediumtext", "not null" => "1"),
644 "app" => array("type" => "char(255)", "not null" => "1"),
645 "verb" => array("type" => "char(255)", "not null" => "1"),
646 "object-type" => array("type" => "char(255)", "not null" => "1"),
647 "object" => array("type" => "text", "not null" => "1"),
648 "target-type" => array("type" => "char(255)", "not null" => "1"),
649 "target" => array("type" => "text", "not null" => "1"),
650 "postopts" => array("type" => "text", "not null" => "1"),
651 "plink" => array("type" => "char(255)", "not null" => "1"),
652 "resource-id" => array("type" => "char(255)", "not null" => "1"),
653 "event-id" => array("type" => "int(11)", "not null" => "1"),
654 "tag" => array("type" => "mediumtext", "not null" => "1"),
655 "attach" => array("type" => "mediumtext", "not null" => "1"),
656 "inform" => array("type" => "mediumtext", "not null" => "1"),
657 "file" => array("type" => "mediumtext", "not null" => "1"),
658 "location" => array("type" => "char(255)", "not null" => "1"),
659 "coord" => array("type" => "char(255)", "not null" => "1"),
660 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
661 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
662 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
663 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
664 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
665 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
666 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
667 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
668 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
669 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
670 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
671 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
672 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
673 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
674 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
675 "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
676 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
677 "network" => array("type" => "char(32)", "not null" => "1"),
680 "PRIMARY" => array("id"),
681 "guid" => array("guid"),
682 "uri" => array("uri"),
683 "parent" => array("parent"),
684 "parent-uri" => array("parent-uri"),
685 "extid" => array("extid"),
686 "uid_id" => array("uid","id"),
687 "uid_created" => array("uid","created"),
688 "uid_unseen" => array("uid","unseen"),
689 "uid_network_received" => array("uid","network","received"),
690 "uid_received" => array("uid","received"),
691 "uid_network_commented" => array("uid","network","commented"),
692 "uid_commented" => array("uid","commented"),
693 "uid_title" => array("uid","title"),
694 "uid_thrparent" => array("uid","thr-parent"),
695 "uid_parenturi" => array("uid","parent-uri"),
696 "uid_contactid_created" => array("uid","contact-id","created"),
697 "wall_body" => array("wall","body(6)"),
698 "uid_visible_moderated_created" => array("uid","visible","moderated","created"),
699 "uid_uri" => array("uid","uri"),
700 "uid_wall_created" => array("uid","wall","created"),
701 "resource-id" => array("resource-id"),
702 "uid_type" => array("uid","type"),
703 "uid_starred" => array("uid","starred"),
704 "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
705 "uid_wall_parent_created" => array("uid","wall","parent","created"),
706 "uid_type_changed" => array("uid","type","changed"),
707 "contactid_verb" => array("contact-id","verb"),
708 "deleted_changed" => array("deleted","changed"),
709 "uid_wall_changed" => array("uid","wall","changed"),
710 "uid_eventid" => array("uid","event-id"),
711 "uid_authorlink" => array("uid","author-link"),
712 "uid_ownerlink" => array("uid","owner-link"),
715 $db["item_id"] = array(
717 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
718 "iid" => array("type" => "int(11)", "not null" => "1"),
719 "uid" => array("type" => "int(11)", "not null" => "1"),
720 "sid" => array("type" => "char(255)", "not null" => "1"),
721 "service" => array("type" => "char(255)", "not null" => "1"),
724 "PRIMARY" => array("id"),
725 "uid" => array("uid"),
726 "sid" => array("sid"),
727 "service" => array("service"),
728 "iid" => array("iid"),
731 $db["locks"] = array(
733 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
734 "name" => array("type" => "char(128)", "not null" => "1"),
735 "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
738 "PRIMARY" => array("id"),
743 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
744 "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
745 "guid" => array("type" => "char(64)", "not null" => "1"),
746 "from-name" => array("type" => "char(255)", "not null" => "1"),
747 "from-photo" => array("type" => "char(255)", "not null" => "1"),
748 "from-url" => array("type" => "char(255)", "not null" => "1"),
749 "contact-id" => array("type" => "char(255)", "not null" => "1"),
750 "convid" => array("type" => "int(11) unsigned", "not null" => "1"),
751 "title" => array("type" => "char(255)", "not null" => "1"),
752 "body" => array("type" => "mediumtext", "not null" => "1"),
753 "seen" => array("type" => "tinyint(1)", "not null" => "1"),
754 "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
755 "replied" => array("type" => "tinyint(1)", "not null" => "1"),
756 "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
757 "uri" => array("type" => "char(255)", "not null" => "1"),
758 "parent-uri" => array("type" => "char(255)", "not null" => "1"),
759 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
762 "PRIMARY" => array("id"),
763 "uid" => array("uid"),
764 "guid" => array("guid"),
765 "convid" => array("convid"),
766 "reply" => array("reply"),
767 "uri" => array("uri"),
768 "parent-uri" => array("parent-uri"),
771 $db["mailacct"] = array(
773 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
774 "uid" => array("type" => "int(11)", "not null" => "1"),
775 "server" => array("type" => "char(255)", "not null" => "1"),
776 "port" => array("type" => "int(11)", "not null" => "1"),
777 "ssltype" => array("type" => "char(16)", "not null" => "1"),
778 "mailbox" => array("type" => "char(255)", "not null" => "1"),
779 "user" => array("type" => "char(255)", "not null" => "1"),
780 "pass" => array("type" => "text", "not null" => "1"),
781 "reply_to" => array("type" => "char(255)", "not null" => "1"),
782 "action" => array("type" => "int(11)", "not null" => "1"),
783 "movetofolder" => array("type" => "char(255)", "not null" => "1"),
784 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
785 "last_check" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
788 "PRIMARY" => array("id"),
791 $db["manage"] = array(
793 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
794 "uid" => array("type" => "int(11)", "not null" => "1"),
795 "mid" => array("type" => "int(11)", "not null" => "1"),
798 "PRIMARY" => array("id"),
799 "uid_mid" => array("uid","mid"),
802 $db["notify"] = array(
804 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
805 "hash" => array("type" => "char(64)", "not null" => "1"),
806 "type" => array("type" => "int(11)", "not null" => "1"),
807 "name" => array("type" => "char(255)", "not null" => "1"),
808 "url" => array("type" => "char(255)", "not null" => "1"),
809 "photo" => array("type" => "char(255)", "not null" => "1"),
810 "date" => array("type" => "datetime", "not null" => "1"),
811 "msg" => array("type" => "mediumtext", "not null" => "1"),
812 "uid" => array("type" => "int(11)", "not null" => "1"),
813 "link" => array("type" => "char(255)", "not null" => "1"),
814 "parent" => array("type" => "int(11)", "not null" => "1"),
815 "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
816 "verb" => array("type" => "char(255)", "not null" => "1"),
817 "otype" => array("type" => "char(16)", "not null" => "1"),
820 "PRIMARY" => array("id"),
821 "uid" => array("uid"),
824 $db["notify-threads"] = array(
826 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
827 "notify-id" => array("type" => "int(11)", "not null" => "1"),
828 "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
829 "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
830 "receiver-uid" => array("type" => "int(11)", "not null" => "1"),
833 "PRIMARY" => array("id"),
834 "master-parent-item" => array("master-parent-item"),
835 "receiver-uid" => array("receiver-uid"),
838 $db["pconfig"] = array(
840 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
841 "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
842 "cat" => array("type" => "char(255)", "not null" => "1"),
843 "k" => array("type" => "char(255)", "not null" => "1"),
844 "v" => array("type" => "mediumtext", "not null" => "1"),
847 "PRIMARY" => array("id"),
848 "access" => array("uid","cat","k"),
851 $db["photo"] = array(
853 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
854 "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
855 "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
856 "guid" => array("type" => "char(64)", "not null" => "1"),
857 "resource-id" => array("type" => "char(255)", "not null" => "1"),
858 "created" => array("type" => "datetime", "not null" => "1"),
859 "edited" => array("type" => "datetime", "not null" => "1"),
860 "title" => array("type" => "char(255)", "not null" => "1"),
861 "desc" => array("type" => "text", "not null" => "1"),
862 "album" => array("type" => "char(255)", "not null" => "1"),
863 "filename" => array("type" => "char(255)", "not null" => "1"),
864 "type" => array("type" => "char(128)", "not null" => "1", "default" => "image/jpeg"),
865 "height" => array("type" => "smallint(6)", "not null" => "1"),
866 "width" => array("type" => "smallint(6)", "not null" => "1"),
867 "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
868 "data" => array("type" => "mediumblob", "not null" => "1"),
869 "scale" => array("type" => "tinyint(3)", "not null" => "1"),
870 "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
871 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
872 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
873 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
874 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
877 "PRIMARY" => array("id"),
878 "uid" => array("uid"),
879 "resource-id" => array("resource-id"),
880 "guid" => array("guid"),
885 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
886 "uid" => array("type" => "int(11)", "not null" => "1"),
887 "q0" => array("type" => "mediumtext", "not null" => "1"),
888 "q1" => array("type" => "mediumtext", "not null" => "1"),
889 "q2" => array("type" => "mediumtext", "not null" => "1"),
890 "q3" => array("type" => "mediumtext", "not null" => "1"),
891 "q4" => array("type" => "mediumtext", "not null" => "1"),
892 "q5" => array("type" => "mediumtext", "not null" => "1"),
893 "q6" => array("type" => "mediumtext", "not null" => "1"),
894 "q7" => array("type" => "mediumtext", "not null" => "1"),
895 "q8" => array("type" => "mediumtext", "not null" => "1"),
896 "q9" => array("type" => "mediumtext", "not null" => "1"),
899 "PRIMARY" => array("id"),
900 "uid" => array("uid"),
903 $db["poll_result"] = array(
905 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
906 "poll_id" => array("type" => "int(11)", "not null" => "1"),
907 "choice" => array("type" => "int(11)", "not null" => "1"),
910 "PRIMARY" => array("id"),
911 "poll_id" => array("poll_id"),
912 "choice" => array("choice"),
915 $db["profile"] = array(
917 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
918 "uid" => array("type" => "int(11)", "not null" => "1"),
919 "profile-name" => array("type" => "char(255)", "not null" => "1"),
920 "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
921 "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
922 "name" => array("type" => "char(255)", "not null" => "1"),
923 "pdesc" => array("type" => "char(255)", "not null" => "1"),
924 "dob" => array("type" => "char(32)", "not null" => "1", "default" => "0000-00-00"),
925 "address" => array("type" => "char(255)", "not null" => "1"),
926 "locality" => array("type" => "char(255)", "not null" => "1"),
927 "region" => array("type" => "char(255)", "not null" => "1"),
928 "postal-code" => array("type" => "char(32)", "not null" => "1"),
929 "country-name" => array("type" => "char(255)", "not null" => "1"),
930 "hometown" => array("type" => "char(255)", "not null" => "1"),
931 "gender" => array("type" => "char(32)", "not null" => "1"),
932 "marital" => array("type" => "char(255)", "not null" => "1"),
933 "with" => array("type" => "text", "not null" => "1"),
934 "howlong" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
935 "sexual" => array("type" => "char(255)", "not null" => "1"),
936 "politic" => array("type" => "char(255)", "not null" => "1"),
937 "religion" => array("type" => "char(255)", "not null" => "1"),
938 "pub_keywords" => array("type" => "text", "not null" => "1"),
939 "prv_keywords" => array("type" => "text", "not null" => "1"),
940 "likes" => array("type" => "text", "not null" => "1"),
941 "dislikes" => array("type" => "text", "not null" => "1"),
942 "about" => array("type" => "text", "not null" => "1"),
943 "summary" => array("type" => "char(255)", "not null" => "1"),
944 "music" => array("type" => "text", "not null" => "1"),
945 "book" => array("type" => "text", "not null" => "1"),
946 "tv" => array("type" => "text", "not null" => "1"),
947 "film" => array("type" => "text", "not null" => "1"),
948 "interest" => array("type" => "text", "not null" => "1"),
949 "romance" => array("type" => "text", "not null" => "1"),
950 "work" => array("type" => "text", "not null" => "1"),
951 "education" => array("type" => "text", "not null" => "1"),
952 "contact" => array("type" => "text", "not null" => "1"),
953 "homepage" => array("type" => "char(255)", "not null" => "1"),
954 "photo" => array("type" => "char(255)", "not null" => "1"),
955 "thumb" => array("type" => "char(255)", "not null" => "1"),
956 "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
957 "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
960 "PRIMARY" => array("id"),
961 "hometown" => array("hometown"),
964 $db["profile_check"] = array(
966 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
967 "uid" => array("type" => "int(10) unsigned", "not null" => "1"),
968 "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
969 "dfrn_id" => array("type" => "char(255)", "not null" => "1"),
970 "sec" => array("type" => "char(255)", "not null" => "1"),
971 "expire" => array("type" => "int(11)", "not null" => "1"),
974 "PRIMARY" => array("id"),
977 $db["push_subscriber"] = array(
979 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
980 "uid" => array("type" => "int(11)", "not null" => "1"),
981 "callback_url" => array("type" => "char(255)", "not null" => "1"),
982 "topic" => array("type" => "char(255)", "not null" => "1"),
983 "nickname" => array("type" => "char(255)", "not null" => "1"),
984 "push" => array("type" => "int(11)", "not null" => "1"),
985 "last_update" => array("type" => "datetime", "not null" => "1"),
986 "secret" => array("type" => "char(255)", "not null" => "1"),
989 "PRIMARY" => array("id"),
992 $db["queue"] = array(
994 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
995 "cid" => array("type" => "int(11)", "not null" => "1"),
996 "network" => array("type" => "char(32)", "not null" => "1"),
997 "created" => array("type" => "datetime", "not null" => "1"),
998 "last" => array("type" => "datetime", "not null" => "1"),
999 "content" => array("type" => "mediumtext", "not null" => "1"),
1000 "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1003 "PRIMARY" => array("id"),
1004 "cid" => array("cid"),
1005 "created" => array("created"),
1006 "last" => array("last"),
1007 "network" => array("network"),
1008 "batch" => array("batch"),
1011 $db["register"] = array(
1013 "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1014 "hash" => array("type" => "char(255)", "not null" => "1"),
1015 "created" => array("type" => "datetime", "not null" => "1"),
1016 "uid" => array("type" => "int(11) unsigned", "not null" => "1"),
1017 "password" => array("type" => "char(255)", "not null" => "1"),
1018 "language" => array("type" => "char(16)", "not null" => "1"),
1021 "PRIMARY" => array("id"),
1024 $db["search"] = array(
1026 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1027 "uid" => array("type" => "int(11)", "not null" => "1"),
1028 "term" => array("type" => "char(255)", "not null" => "1"),
1031 "PRIMARY" => array("id"),
1032 "uid" => array("uid"),
1033 "term" => array("term"),
1036 $db["session"] = array(
1038 "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1039 "sid" => array("type" => "char(255)", "not null" => "1"),
1040 "data" => array("type" => "text", "not null" => "1"),
1041 "expire" => array("type" => "int(10) unsigned", "not null" => "1"),
1044 "PRIMARY" => array("id"),
1045 "sid" => array("sid"),
1046 "expire" => array("expire"),
1049 $db["sign"] = array(
1051 "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1052 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1053 "retract_iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1054 "signed_text" => array("type" => "mediumtext", "not null" => "1"),
1055 "signature" => array("type" => "text", "not null" => "1"),
1056 "signer" => array("type" => "char(255)", "not null" => "1"),
1059 "PRIMARY" => array("id"),
1060 "iid" => array("iid"),
1061 "retract_iid" => array("retract_iid"),
1064 $db["spam"] = array(
1066 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1067 "uid" => array("type" => "int(11)", "not null" => "1"),
1068 "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1069 "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1070 "term" => array("type" => "char(255)", "not null" => "1"),
1071 "date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1074 "PRIMARY" => array("id"),
1075 "uid" => array("uid"),
1076 "spam" => array("spam"),
1077 "ham" => array("ham"),
1078 "term" => array("term"),
1081 $db["term"] = array(
1083 "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1084 "oid" => array("type" => "int(10) unsigned", "not null" => "1"),
1085 "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1"),
1086 "type" => array("type" => "tinyint(3) unsigned", "not null" => "1"),
1087 "term" => array("type" => "char(255)", "not null" => "1"),
1088 "url" => array("type" => "char(255)", "not null" => "1"),
1089 "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1090 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1093 "PRIMARY" => array("tid"),
1094 "oid_otype_type_term" => array("oid","otype","type","term"),
1095 "uid_term_tid" => array("uid","term","tid"),
1096 "type_term" => array("type","term"),
1097 "uid_otype_type_term_tid" => array("uid","otype","type","term","tid"),
1098 "otype_type_term_tid" => array("otype","type","term","tid"),
1101 $db["thread"] = array(
1103 "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1"),
1104 "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1105 "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1106 "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1107 "edited" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1108 "commented" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1109 "received" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1110 "changed" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1111 "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1112 "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1113 "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1114 "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1115 "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1116 "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1117 "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1118 "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1119 "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1120 "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1121 "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1122 "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1123 "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1124 "network" => array("type" => "char(32)", "not null" => "1"),
1127 "PRIMARY" => array("iid"),
1128 "created" => array("created"),
1129 "commented" => array("commented"),
1130 "uid_network_commented" => array("uid","network","commented"),
1131 "uid_network_created" => array("uid","network","created"),
1132 "uid_contactid_commented" => array("uid","contact-id","commented"),
1133 "uid_contactid_created" => array("uid","contact-id","created"),
1134 "wall_private_received" => array("wall","private","received"),
1135 "uid_created" => array("uid","created"),
1136 "uid_commented" => array("uid","commented"),
1139 $db["tokens"] = array(
1141 "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1142 "secret" => array("type" => "text", "not null" => "1"),
1143 "client_id" => array("type" => "varchar(20)", "not null" => "1"),
1144 "expires" => array("type" => "int(11)", "not null" => "1"),
1145 "scope" => array("type" => "varchar(200)", "not null" => "1"),
1146 "uid" => array("type" => "int(11)", "not null" => "1"),
1149 "PRIMARY" => array("id"),
1152 $db["unique_contacts"] = array(
1154 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1155 "url" => array("type" => "char(255)", "not null" => "1"),
1156 "nick" => array("type" => "char(255)", "not null" => "1"),
1157 "name" => array("type" => "char(255)", "not null" => "1"),
1158 "avatar" => array("type" => "char(255)", "not null" => "1"),
1161 "PRIMARY" => array("id"),
1162 "url" => array("url"),
1165 $db["user"] = array(
1167 "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1168 "guid" => array("type" => "char(64)", "not null" => "1"),
1169 "username" => array("type" => "char(255)", "not null" => "1"),
1170 "password" => array("type" => "char(255)", "not null" => "1"),
1171 "nickname" => array("type" => "char(255)", "not null" => "1"),
1172 "email" => array("type" => "char(255)", "not null" => "1"),
1173 "openid" => array("type" => "char(255)", "not null" => "1"),
1174 "timezone" => array("type" => "char(128)", "not null" => "1"),
1175 "language" => array("type" => "char(32)", "not null" => "1", "default" => "en"),
1176 "register_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1177 "login_date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1178 "default-location" => array("type" => "char(255)", "not null" => "1"),
1179 "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1180 "theme" => array("type" => "char(255)", "not null" => "1"),
1181 "pubkey" => array("type" => "text", "not null" => "1"),
1182 "prvkey" => array("type" => "text", "not null" => "1"),
1183 "spubkey" => array("type" => "text", "not null" => "1"),
1184 "sprvkey" => array("type" => "text", "not null" => "1"),
1185 "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1186 "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1187 "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1188 "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1189 "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1190 "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1191 "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1192 "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1193 "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1194 "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1195 "pwdreset" => array("type" => "char(255)", "not null" => "1"),
1196 "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1197 "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1198 "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1199 "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1200 "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1201 "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
1202 "service_class" => array("type" => "char(32)", "not null" => "1"),
1203 "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1204 "allow_cid" => array("type" => "mediumtext", "not null" => "1"),
1205 "allow_gid" => array("type" => "mediumtext", "not null" => "1"),
1206 "deny_cid" => array("type" => "mediumtext", "not null" => "1"),
1207 "deny_gid" => array("type" => "mediumtext", "not null" => "1"),
1208 "openidserver" => array("type" => "text", "not null" => "1"),
1211 "PRIMARY" => array("uid"),
1212 "nickname" => array("nickname"),
1215 $db["userd"] = array(
1217 "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1218 "username" => array("type" => "char(255)", "not null" => "1"),
1221 "PRIMARY" => array("id"),
1222 "username" => array("username"),