]> git.mxchange.org Git - friendica.git/blob - include/dbstructure.php
DBClean now works with the conversation table as well
[friendica.git] / include / dbstructure.php
1 <?php
2 /**
3  * @file include/dbstructure.php
4  */
5 use Friendica\App;
6 use Friendica\Core\System;
7 use Friendica\Core\Config;
8 use Friendica\Database\DBM;
9
10 require_once "boot.php";
11 require_once "include/text.php";
12
13 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
14
15 const DB_UPDATE_NOT_CHECKED = 0; // Database check wasn't executed before
16 const DB_UPDATE_SUCCESSFUL = 1;  // Database check was successful
17 const DB_UPDATE_FAILED = 2;      // Database check failed
18
19 /*
20  * Converts all tables from MyISAM to InnoDB
21  */
22 function convert_to_innodb() {
23         $r = q("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `engine` = 'MyISAM' AND `table_schema` = '%s'",
24                 dbesc(dba::database_name()));
25
26         if (!DBM::is_result($r)) {
27                 echo t('There are no tables on MyISAM.')."\n";
28                 return;
29         }
30
31         foreach ($r AS $table) {
32                 $sql = sprintf("ALTER TABLE `%s` engine=InnoDB;", dbesc($table['TABLE_NAME']));
33                 echo $sql."\n";
34
35                 $result = dba::e($sql);
36                 if (!DBM::is_result($result)) {
37                         print_update_error($sql);
38                 }
39         }
40 }
41
42 /*
43  * send the email and do what is needed to do on update fails
44  *
45  * @param update_id             (int) number of failed update
46  * @param error_message (str) error message
47  */
48 function update_fail($update_id, $error_message) {
49         //send the administrators an e-mail
50         $admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
51         $adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
52                 $admin_mail_list
53         );
54
55         // No valid result?
56         if (!DBM::is_result($adminlist)) {
57                 logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_NORMAL);
58
59                 // Don't continue
60                 return;
61         }
62
63         // every admin could had different language
64         foreach ($adminlist as $admin) {
65                 $lang = (($admin['language'])?$admin['language']:'en');
66                 push_lang($lang);
67
68                 $preamble = deindent(t("
69                         The friendica developers released update %s recently,
70                         but when I tried to install it, something went terribly wrong.
71                         This needs to be fixed soon and I can't do it alone. Please contact a
72                         friendica developer if you can not help me on your own. My database might be invalid."));
73                 $body = t("The error message is\n[pre]%s[/pre]");
74                 $preamble = sprintf($preamble, $update_id);
75                 $body = sprintf($body, $error_message);
76
77                 notification(array(
78                         'type' => SYSTEM_EMAIL,
79                         'to_email' => $admin['email'],
80                         'preamble' => $preamble,
81                         'body' => $body,
82                         'language' => $lang)
83                 );
84         }
85
86         //try the logger
87         logger("CRITICAL: Database structure update failed: ".$retval);
88 }
89
90
91 function table_structure($table) {
92         $structures = q("DESCRIBE `%s`", $table);
93
94         $full_columns = q("SHOW FULL COLUMNS FROM `%s`", $table);
95
96         $indexes = q("SHOW INDEX FROM `%s`", $table);
97
98         $table_status = q("SHOW TABLE STATUS WHERE `name` = '%s'", $table);
99
100         if (DBM::is_result($table_status)) {
101                 $table_status = $table_status[0];
102         } else {
103                 $table_status = array();
104         }
105
106         $fielddata = array();
107         $indexdata = array();
108
109         if (DBM::is_result($indexes))
110                 foreach ($indexes AS $index) {
111                         if ($index['Key_name'] != 'PRIMARY' && $index['Non_unique'] == '0' && !isset($indexdata[$index["Key_name"]])) {
112                                 $indexdata[$index["Key_name"]] = array('UNIQUE');
113                         }
114
115                         $column = $index["Column_name"];
116
117                         if (($index["Sub_part"] != "")) {
118                                 $column .= "(".$index["Sub_part"].")";
119                         }
120
121                         $indexdata[$index["Key_name"]][] = $column;
122                 }
123         if (DBM::is_result($structures)) {
124                 foreach ($structures AS $field) {
125                         $fielddata[$field["Field"]]["type"] = $field["Type"];
126                         if ($field["Null"] == "NO") {
127                                 $fielddata[$field["Field"]]["not null"] = true;
128                         }
129
130                         if (isset($field["Default"])) {
131                                 $fielddata[$field["Field"]]["default"] = $field["Default"];
132                         }
133
134                         if ($field["Extra"] != "") {
135                                 $fielddata[$field["Field"]]["extra"] = $field["Extra"];
136                         }
137
138                         if ($field["Key"] == "PRI") {
139                                 $fielddata[$field["Field"]]["primary"] = true;
140                         }
141                 }
142         }
143         if (DBM::is_result($full_columns)) {
144                 foreach ($full_columns AS $column) {
145                         $fielddata[$column["Field"]]["Collation"] = $column["Collation"];
146                 }
147         }
148
149         return array("fields" => $fielddata, "indexes" => $indexdata, "table_status" => $table_status);
150 }
151
152 function print_structure($database) {
153         echo "-- ------------------------------------------\n";
154         echo "-- ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION." (".FRIENDICA_CODENAME,")\n";
155         echo "-- DB_UPDATE_VERSION ".DB_UPDATE_VERSION."\n";
156         echo "-- ------------------------------------------\n\n\n";
157         foreach ($database AS $name => $structure) {
158                 echo "--\n";
159                 echo "-- TABLE $name\n";
160                 echo "--\n";
161                 db_create_table($name, $structure['fields'], true, false, $structure["indexes"]);
162
163                 echo "\n";
164         }
165 }
166
167 /**
168  * @brief Print out database error messages
169  *
170  * @param string $message Message to be added to the error message
171  *
172  * @return string Error message
173  */
174 function print_update_error($message) {
175         echo sprintf(t("\nError %d occurred during database update:\n%s\n"),
176                 dba::errorNo(), dba::errorMessage());
177
178         return t('Errors encountered performing database changes: ').$message.EOL;
179 }
180
181 function update_structure($verbose, $action, $tables=null, $definition=null) {
182         global $a;
183
184         if ($action) {
185                 Config::set('system', 'maintenance', 1);
186                 Config::set('system', 'maintenance_reason', sprintf(t(': Database update'), DBM::date().' '.date('e')));
187         }
188
189         $errors = false;
190
191         logger('updating structure', LOGGER_DEBUG);
192
193         // Get the current structure
194         $database = array();
195
196         if (is_null($tables)) {
197                 $tables = q("SHOW TABLES");
198         }
199
200         if (DBM::is_result($tables)) {
201                 foreach ($tables AS $table) {
202                         $table = current($table);
203
204                         logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
205                         $database[$table] = table_structure($table);
206                 }
207         }
208
209         // Get the definition
210         if (is_null($definition)) {
211                 $definition = db_definition();
212         }
213
214         // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
215         if ((version_compare(dba::server_info(), '5.7.4') >= 0) &&
216                 !(strpos(dba::server_info(), 'MariaDB') !== false)) {
217                 $ignore = '';
218         } else {
219                 $ignore = ' IGNORE';
220         }
221
222         // Compare it
223         foreach ($definition AS $name => $structure) {
224                 $is_new_table = False;
225                 $group_by = "";
226                 $sql3 = "";
227                 if (!isset($database[$name])) {
228                         $r = db_create_table($name, $structure["fields"], $verbose, $action, $structure['indexes']);
229                         if (!DBM::is_result($r)) {
230                                 $errors .= print_update_error($name);
231                         }
232                         $is_new_table = True;
233                 } else {
234                         $is_unique = false;
235                         $temp_name = $name;
236
237                         foreach ($structure["indexes"] AS $indexname => $fieldnames) {
238                                 if (isset($database[$name]["indexes"][$indexname])) {
239                                         $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
240                                 } else {
241                                         $current_index_definition = "__NOT_SET__";
242                                 }
243                                 $new_index_definition = implode(",",$fieldnames);
244                                 if ($current_index_definition != $new_index_definition) {
245                                         if ($fieldnames[0] == "UNIQUE") {
246                                                 $is_unique = true;
247                                                 if ($ignore == "") {
248                                                         $temp_name = "temp-".$name;
249                                                 }
250                                         }
251                                 }
252                         }
253
254                         /*
255                          * Drop the index if it isn't present in the definition
256                          * or the definition differ from current status
257                          * and index name doesn't start with "local_"
258                          */
259                         foreach ($database[$name]["indexes"] as $indexname => $fieldnames) {
260                                 $current_index_definition = implode(",",$fieldnames);
261                                 if (isset($structure["indexes"][$indexname])) {
262                                         $new_index_definition = implode(",",$structure["indexes"][$indexname]);
263                                 } else {
264                                         $new_index_definition = "__NOT_SET__";
265                                 }
266                                 if ($current_index_definition != $new_index_definition && substr($indexname, 0, 6) != 'local_') {
267                                         $sql2=db_drop_index($indexname);
268                                         if ($sql3 == "") {
269                                                 $sql3 = "ALTER".$ignore." TABLE `".$temp_name."` ".$sql2;
270                                         } else {
271                                                 $sql3 .= ", ".$sql2;
272                                         }
273                                 }
274                         }
275                         // Compare the field structure field by field
276                         foreach ($structure["fields"] AS $fieldname => $parameters) {
277                                 if (!isset($database[$name]["fields"][$fieldname])) {
278                                         $sql2=db_add_table_field($fieldname, $parameters);
279                                         if ($sql3 == "") {
280                                                 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
281                                         } else {
282                                                 $sql3 .= ", ".$sql2;
283                                         }
284                                 } else {
285                                         // Compare the field definition
286                                         $field_definition = $database[$name]["fields"][$fieldname];
287
288                                         // Remove the relation data that is used for the referential integrity
289                                         unset($parameters['relation']);
290
291                                         // We change the collation after the indexes had been changed.
292                                         // This is done to avoid index length problems.
293                                         // So here we always ensure that there is no need to change it.
294                                         unset($parameters['Collation']);
295                                         unset($field_definition['Collation']);
296
297                                         $current_field_definition = implode(",", $field_definition);
298                                         $new_field_definition = implode(",", $parameters);
299                                         if ($current_field_definition != $new_field_definition) {
300                                                 $sql2 = db_modify_table_field($fieldname, $parameters);
301                                                 if ($sql3 == "") {
302                                                         $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
303                                                 } else {
304                                                         $sql3 .= ", ".$sql2;
305                                                 }
306                                         }
307                                 }
308                         }
309                 }
310
311                 /*
312                  * Create the index if the index don't exists in database
313                  * or the definition differ from the current status.
314                  * Don't create keys if table is new
315                  */
316                 if (!$is_new_table) {
317                         foreach ($structure["indexes"] AS $indexname => $fieldnames) {
318                                 if (isset($database[$name]["indexes"][$indexname])) {
319                                         $current_index_definition = implode(",",$database[$name]["indexes"][$indexname]);
320                                 } else {
321                                         $current_index_definition = "__NOT_SET__";
322                                 }
323                                 $new_index_definition = implode(",",$fieldnames);
324                                 if ($current_index_definition != $new_index_definition) {
325                                         $sql2 = db_create_index($indexname, $fieldnames);
326
327                                         // Fetch the "group by" fields for unique indexes
328                                         if ($fieldnames[0] == "UNIQUE") {
329                                                 $group_by = db_group_by($indexname, $fieldnames);
330                                         }
331                                         if ($sql2 != "") {
332                                                 if ($sql3 == "") {
333                                                         $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
334                                                 } else {
335                                                         $sql3 .= ", ".$sql2;
336                                                 }
337                                         }
338                                 }
339                         }
340
341                         if (isset($database[$name]["table_status"]["Collation"])) {
342                                 if ($database[$name]["table_status"]["Collation"] != 'utf8mb4_general_ci') {
343                                         $sql2 = "DEFAULT COLLATE utf8mb4_general_ci";
344
345                                         if ($sql3 == "") {
346                                                 $sql3 = "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
347                                         } else {
348                                                 $sql3 .= ", ".$sql2;
349                                         }
350                                 }
351                         }
352
353                         if ($sql3 != "") {
354                                 $sql3 .= "; ";
355                         }
356
357                         // Now have a look at the field collations
358                         // Compare the field structure field by field
359                         foreach ($structure["fields"] AS $fieldname => $parameters) {
360                                 // Compare the field definition
361                                 $field_definition = $database[$name]["fields"][$fieldname];
362
363                                 // Define the default collation if not given
364                                 if (!isset($parameters['Collation']) && !is_null($field_definition['Collation'])) {
365                                         $parameters['Collation'] = 'utf8mb4_general_ci';
366                                 } else {
367                                         $parameters['Collation'] = null;
368                                 }
369
370                                 if ($field_definition['Collation'] != $parameters['Collation']) {
371                                         $sql2 = db_modify_table_field($fieldname, $parameters);
372                                         if (($sql3 == "") || (substr($sql3, -2, 2) == "; ")) {
373                                                 $sql3 .= "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
374                                         } else {
375                                                 $sql3 .= ", ".$sql2;
376                                         }
377                                 }
378                         }
379                 }
380
381                 if ($sql3 != "") {
382                         if (substr($sql3, -2, 2) != "; ") {
383                                 $sql3 .= ";";
384                         }
385
386                         $field_list = '';
387                         if ($is_unique && $ignore == '') {
388                                 foreach ($structure['fields'] AS $fieldname => $parameters) {
389                                         $field_list .= 'ANY_VALUE(`' . $fieldname . '`),';
390                                 }
391                                 $field_list = rtrim($field_list, ',');
392                         }
393
394                         if ($verbose) {
395                                 // Ensure index conversion to unique removes duplicates
396                                 if ($is_unique && ($temp_name != $name)) {
397                                         if ($ignore != "") {
398                                                 echo "SET session old_alter_table=1;\n";
399                                         } else {
400                                                 echo "DROP TABLE IF EXISTS `".$temp_name."`;\n";
401                                                 echo "CREATE TABLE `".$temp_name."` LIKE `".$name."`;\n";
402                                         }
403                                 }
404
405                                 echo $sql3."\n";
406
407                                 if ($is_unique && ($temp_name != $name)) {
408                                         if ($ignore != "") {
409                                                 echo "SET session old_alter_table=0;\n";
410                                         } else {
411                                                 echo "INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";\n";
412                                                 echo "DROP TABLE `".$name."`;\n";
413                                                 echo "RENAME TABLE `".$temp_name."` TO `".$name."`;\n";
414                                         }
415                                 }
416                         }
417
418                         if ($action) {
419                                 Config::set('system', 'maintenance_reason', sprintf(t('%s: updating %s table.'), DBM::date().' '.date('e'), $name));
420
421                                 // Ensure index conversion to unique removes duplicates
422                                 if ($is_unique && ($temp_name != $name)) {
423                                         if ($ignore != "") {
424                                                 dba::e("SET session old_alter_table=1;");
425                                         } else {
426                                                 dba::e("DROP TABLE IF EXISTS `".$temp_name."`;");
427                                                 if (!DBM::is_result($r)) {
428                                                         $errors .= print_update_error($sql3);
429                                                         return $errors;
430                                                 }
431
432                                                 $r = dba::e("CREATE TABLE `".$temp_name."` LIKE `".$name."`;");
433                                                 if (!DBM::is_result($r)) {
434                                                         $errors .= print_update_error($sql3);
435                                                         return $errors;
436                                                 }
437                                         }
438                                 }
439
440                                 $r = @dba::e($sql3);
441                                 if (!DBM::is_result($r)) {
442                                         $errors .= print_update_error($sql3);
443                                 }
444                                 if ($is_unique && ($temp_name != $name)) {
445                                         if ($ignore != "") {
446                                                 dba::e("SET session old_alter_table=0;");
447                                         } else {
448                                                 $r = dba::e("INSERT INTO `".$temp_name."` SELECT ".$field_list." FROM `".$name."`".$group_by.";");
449                                                 if (!DBM::is_result($r)) {
450                                                         $errors .= print_update_error($sql3);
451                                                         return $errors;
452                                                 }
453                                                 $r = dba::e("DROP TABLE `".$name."`;");
454                                                 if (!DBM::is_result($r)) {
455                                                         $errors .= print_update_error($sql3);
456                                                         return $errors;
457                                                 }
458                                                 $r = dba::e("RENAME TABLE `".$temp_name."` TO `".$name."`;");
459                                                 if (!DBM::is_result($r)) {
460                                                         $errors .= print_update_error($sql3);
461                                                         return $errors;
462                                                 }
463                                         }
464                                 }
465                         }
466                 }
467         }
468
469         if ($action) {
470                 Config::set('system', 'maintenance', 0);
471                 Config::set('system', 'maintenance_reason', '');
472         }
473
474         if ($errors) {
475                 Config::set('system', 'dbupdate', DB_UPDATE_FAILED);
476         } else {
477                 Config::set('system', 'dbupdate', DB_UPDATE_SUCCESSFUL);
478         }
479
480         return $errors;
481 }
482
483 function db_field_command($parameters, $create = true) {
484         $fieldstruct = $parameters["type"];
485
486         if (!is_null($parameters["Collation"])) {
487                 $fieldstruct .= " COLLATE ".$parameters["Collation"];
488         }
489
490         if ($parameters["not null"])
491                 $fieldstruct .= " NOT NULL";
492
493         if (isset($parameters["default"])) {
494                 if (strpos(strtolower($parameters["type"]),"int")!==false) {
495                         $fieldstruct .= " DEFAULT ".$parameters["default"];
496                 } else {
497                         $fieldstruct .= " DEFAULT '".$parameters["default"]."'";
498                 }
499         }
500         if ($parameters["extra"] != "")
501                 $fieldstruct .= " ".$parameters["extra"];
502
503         /*if (($parameters["primary"] != "") && $create)
504                 $fieldstruct .= " PRIMARY KEY";*/
505
506         return($fieldstruct);
507 }
508
509 function db_create_table($name, $fields, $verbose, $action, $indexes=null) {
510         global $a;
511
512         $r = true;
513
514         $sql = "";
515
516         $sql_rows = array();
517         $primary_keys = array();
518         foreach ($fields AS $fieldname => $field) {
519                 $sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
520                 if (x($field,'primary') && $field['primary']!='') {
521                         $primary_keys[] = $fieldname;
522                 }
523         }
524
525         if (!is_null($indexes)) {
526                 foreach ($indexes AS $indexname => $fieldnames) {
527                         $sql_index = db_create_index($indexname, $fieldnames, "");
528                         if (!is_null($sql_index)) $sql_rows[] = $sql_index;
529                 }
530         }
531
532         $sql = implode(",\n\t", $sql_rows);
533
534         $sql = sprintf("CREATE TABLE IF NOT EXISTS `%s` (\n\t", dbesc($name)).$sql."\n) DEFAULT COLLATE utf8mb4_general_ci";
535         if ($verbose)
536                 echo $sql.";\n";
537
538         if ($action)
539                 $r = @dba::e($sql);
540
541         return $r;
542 }
543
544 function db_add_table_field($fieldname, $parameters) {
545         $sql = sprintf("ADD `%s` %s", dbesc($fieldname), db_field_command($parameters));
546         return($sql);
547 }
548
549 function db_modify_table_field($fieldname, $parameters) {
550         $sql = sprintf("MODIFY `%s` %s", dbesc($fieldname), db_field_command($parameters, false));
551         return($sql);
552 }
553
554 function db_drop_index($indexname) {
555         $sql = sprintf("DROP INDEX `%s`", dbesc($indexname));
556         return($sql);
557 }
558
559 function db_create_index($indexname, $fieldnames, $method="ADD") {
560
561         $method = strtoupper(trim($method));
562         if ($method!="" && $method!="ADD") {
563                 throw new Exception("Invalid parameter 'method' in db_create_index(): '$method'");
564                 killme();
565         }
566
567         if ($fieldnames[0] == "UNIQUE") {
568                 array_shift($fieldnames);
569                 $method .= ' UNIQUE';
570         }
571
572         $names = "";
573         foreach ($fieldnames AS $fieldname) {
574                 if ($names != "")
575                         $names .= ",";
576
577                 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
578                         $names .= "`".dbesc($matches[1])."`(".intval($matches[2]).")";
579                 } else {
580                         $names .= "`".dbesc($fieldname)."`";
581                 }
582         }
583
584         if ($indexname == "PRIMARY") {
585                 return sprintf("%s PRIMARY KEY(%s)", $method, $names);
586         }
587
588
589         $sql = sprintf("%s INDEX `%s` (%s)", $method, dbesc($indexname), $names);
590         return($sql);
591 }
592
593 function db_group_by($indexname, $fieldnames) {
594
595         if ($fieldnames[0] != "UNIQUE") {
596                 return "";
597         }
598
599         array_shift($fieldnames);
600
601         $names = "";
602         foreach ($fieldnames AS $fieldname) {
603                 if ($names != "")
604                         $names .= ",";
605
606                 if (preg_match('|(.+)\((\d+)\)|', $fieldname, $matches)) {
607                         $names .= "`".dbesc($matches[1])."`";
608                 } else {
609                         $names .= "`".dbesc($fieldname)."`";
610                 }
611         }
612
613         $sql = sprintf(" GROUP BY %s", $names);
614         return $sql;
615 }
616
617 function db_definition() {
618
619         $database = array();
620
621         $database["addon"] = array(
622                         "fields" => array(
623                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
624                                         "name" => array("type" => "varchar(190)", "not null" => "1", "default" => ""),
625                                         "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
626                                         "installed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
627                                         "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
628                                         "timestamp" => array("type" => "bigint(20)", "not null" => "1", "default" => "0"),
629                                         "plugin_admin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
630                                         ),
631                         "indexes" => array(
632                                         "PRIMARY" => array("id"),
633                                         "name" => array("UNIQUE", "name"),
634                                         )
635                         );
636         $database["attach"] = array(
637                         "fields" => array(
638                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
639                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
640                                         "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
641                                         "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
642                                         "filetype" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
643                                         "filesize" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
644                                         "data" => array("type" => "longblob", "not null" => "1"),
645                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
646                                         "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
647                                         "allow_cid" => array("type" => "mediumtext"),
648                                         "allow_gid" => array("type" => "mediumtext"),
649                                         "deny_cid" => array("type" => "mediumtext"),
650                                         "deny_gid" => array("type" => "mediumtext"),
651                                         ),
652                         "indexes" => array(
653                                         "PRIMARY" => array("id"),
654                                         )
655                         );
656         $database["auth_codes"] = array(
657                         "fields" => array(
658                                         "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
659                                         "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
660                                         "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
661                                         "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
662                                         "scope" => array("type" => "varchar(250)", "not null" => "1", "default" => ""),
663                                         ),
664                         "indexes" => array(
665                                         "PRIMARY" => array("id"),
666                                         )
667                         );
668         $database["cache"] = array(
669                         "fields" => array(
670                                         "k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
671                                         "v" => array("type" => "mediumtext"),
672                                         "expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
673                                         "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
674                                         ),
675                         "indexes" => array(
676                                         "PRIMARY" => array("k"),
677                                         "expire_mode_updated" => array("expire_mode", "updated"),
678                                         )
679                         );
680         $database["challenge"] = array(
681                         "fields" => array(
682                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
683                                         "challenge" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
684                                         "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
685                                         "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
686                                         "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
687                                         "last_update" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
688                                         ),
689                         "indexes" => array(
690                                         "PRIMARY" => array("id"),
691                                         )
692                         );
693         $database["clients"] = array(
694                         "fields" => array(
695                                         "client_id" => array("type" => "varchar(20)", "not null" => "1", "primary" => "1"),
696                                         "pw" => array("type" => "varchar(20)", "not null" => "1", "default" => ""),
697                                         "redirect_uri" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
698                                         "name" => array("type" => "text"),
699                                         "icon" => array("type" => "text"),
700                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
701                                         ),
702                         "indexes" => array(
703                                         "PRIMARY" => array("client_id"),
704                                         )
705                         );
706         $database["config"] = array(
707                         "fields" => array(
708                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
709                                         "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
710                                         "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
711                                         "v" => array("type" => "mediumtext"),
712                                         ),
713                         "indexes" => array(
714                                         "PRIMARY" => array("id"),
715                                         "cat_k" => array("UNIQUE", "cat", "k"),
716                                         )
717                         );
718         $database["contact"] = array(
719                         "fields" => array(
720                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
721                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
722                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
723                                         "self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
724                                         "remote_self" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
725                                         "rel" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
726                                         "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
727                                         "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
728                                         "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
729                                         "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
730                                         "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
731                                         "about" => array("type" => "text"),
732                                         "keywords" => array("type" => "text"),
733                                         "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
734                                         "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
735                                         "attag" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
736                                         "avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
737                                         "photo" => array("type" => "text"),
738                                         "thumb" => array("type" => "text"),
739                                         "micro" => array("type" => "text"),
740                                         "site-pubkey" => array("type" => "text"),
741                                         "issued-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
742                                         "dfrn-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
743                                         "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
744                                         "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
745                                         "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
746                                         "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
747                                         "pubkey" => array("type" => "text"),
748                                         "prvkey" => array("type" => "text"),
749                                         "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
750                                         "request" => array("type" => "text"),
751                                         "notify" => array("type" => "text"),
752                                         "poll" => array("type" => "text"),
753                                         "confirm" => array("type" => "text"),
754                                         "poco" => array("type" => "text"),
755                                         "aes_allow" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
756                                         "ret-aes" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
757                                         "usehub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
758                                         "subhub" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
759                                         "hub-verify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
760                                         "last-update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
761                                         "success_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
762                                         "failure_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
763                                         "name-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
764                                         "uri-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
765                                         "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
766                                         "term-date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
767                                         "last-item" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
768                                         "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
769                                         "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
770                                         "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
771                                         "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
772                                         "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
773                                         "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
774                                         "contact-type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
775                                         "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
776                                         "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
777                                         "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
778                                         "rating" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
779                                         "reason" => array("type" => "text"),
780                                         "closeness" => array("type" => "tinyint(2)", "not null" => "1", "default" => "99"),
781                                         "info" => array("type" => "mediumtext"),
782                                         "profile-id" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
783                                         "bdyear" => array("type" => "varchar(4)", "not null" => "1", "default" => ""),
784                                         "bd" => array("type" => "date", "not null" => "1", "default" => "0001-01-01"),
785                                         "notify_new_posts" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
786                                         "fetch_further_information" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
787                                         "ffi_keyword_blacklist" => array("type" => "text"),
788                                         ),
789                         "indexes" => array(
790                                         "PRIMARY" => array("id"),
791                                         "uid_name" => array("uid", "name(190)"),
792                                         "self_uid" => array("self", "uid"),
793                                         "alias_uid" => array("alias(32)", "uid"),
794                                         "pending_uid" => array("pending", "uid"),
795                                         "blocked_uid" => array("blocked", "uid"),
796                                         "uid_rel_network_poll" => array("uid", "rel", "network(4)", "poll(64)", "archive"),
797                                         "uid_network_batch" => array("uid", "network(4)", "batch(64)"),
798                                         "addr_uid" => array("addr(32)", "uid"),
799                                         "nurl_uid" => array("nurl(32)", "uid"),
800                                         "nick_uid" => array("nick(32)", "uid"),
801                                         "dfrn-id" => array("dfrn-id(64)"),
802                                         "issued-id" => array("issued-id(64)"),
803                                         )
804                         );
805         $database["conv"] = array(
806                         "fields" => array(
807                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
808                                         "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
809                                         "recips" => array("type" => "text"),
810                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
811                                         "creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
812                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
813                                         "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
814                                         "subject" => array("type" => "text"),
815                                         ),
816                         "indexes" => array(
817                                         "PRIMARY" => array("id"),
818                                         "uid" => array("uid"),
819                                         )
820                         );
821         $database["conversation"] = array(
822                         "fields" => array(
823                                         "item-uri" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
824                                         "reply-to-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
825                                         "conversation-uri" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
826                                         "conversation-href" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
827                                         "protocol" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
828                                         "source" => array("type" => "mediumtext"),
829                                         "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
830                                         ),
831                         "indexes" => array(
832                                         "PRIMARY" => array("item-uri"),
833                                         "conversation-uri" => array("conversation-uri"),
834                                         "received" => array("received"),
835                                         )
836                         );
837         $database["event"] = array(
838                         "fields" => array(
839                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
840                                         "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
841                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
842                                         "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
843                                         "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
844                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
845                                         "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
846                                         "start" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
847                                         "finish" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
848                                         "summary" => array("type" => "text"),
849                                         "desc" => array("type" => "text"),
850                                         "location" => array("type" => "text"),
851                                         "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
852                                         "nofinish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
853                                         "adjust" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
854                                         "ignore" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
855                                         "allow_cid" => array("type" => "mediumtext"),
856                                         "allow_gid" => array("type" => "mediumtext"),
857                                         "deny_cid" => array("type" => "mediumtext"),
858                                         "deny_gid" => array("type" => "mediumtext"),
859                                         ),
860                         "indexes" => array(
861                                         "PRIMARY" => array("id"),
862                                         "uid_start" => array("uid", "start"),
863                                         )
864                         );
865         $database["fcontact"] = array(
866                         "fields" => array(
867                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
868                                         "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
869                                         "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
870                                         "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
871                                         "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
872                                         "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
873                                         "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
874                                         "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
875                                         "batch" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
876                                         "notify" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
877                                         "poll" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
878                                         "confirm" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
879                                         "priority" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
880                                         "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
881                                         "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
882                                         "pubkey" => array("type" => "text"),
883                                         "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
884                                         ),
885                         "indexes" => array(
886                                         "PRIMARY" => array("id"),
887                                         "addr" => array("addr(32)"),
888                                         "url" => array("UNIQUE", "url(190)"),
889                                         )
890                         );
891         $database["ffinder"] = array(
892                         "fields" => array(
893                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
894                                         "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
895                                         "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
896                                         "fid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("fcontact" => "id")),
897                                         ),
898                         "indexes" => array(
899                                         "PRIMARY" => array("id"),
900                                         )
901                         );
902         $database["fserver"] = array(
903                         "fields" => array(
904                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
905                                         "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
906                                         "posturl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
907                                         "key" => array("type" => "text"),
908                                         ),
909                         "indexes" => array(
910                                         "PRIMARY" => array("id"),
911                                         "server" => array("server(32)"),
912                                         )
913                         );
914         $database["fsuggest"] = array(
915                         "fields" => array(
916                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
917                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
918                                         "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
919                                         "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
920                                         "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
921                                         "request" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
922                                         "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
923                                         "note" => array("type" => "text"),
924                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
925                                         ),
926                         "indexes" => array(
927                                         "PRIMARY" => array("id"),
928                                         )
929                         );
930         $database["gcign"] = array(
931                         "fields" => array(
932                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
933                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
934                                         "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
935                                         ),
936                         "indexes" => array(
937                                         "PRIMARY" => array("id"),
938                                         "uid" => array("uid"),
939                                         "gcid" => array("gcid"),
940                                         )
941                         );
942         $database["gcontact"] = array(
943                         "fields" => array(
944                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
945                                         "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
946                                         "nick" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
947                                         "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
948                                         "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
949                                         "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
950                                         "connect" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
951                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
952                                         "updated" => array("type" => "datetime", "default" => NULL_DATE),
953                                         "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
954                                         "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
955                                         "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
956                                         "about" => array("type" => "text"),
957                                         "keywords" => array("type" => "text"),
958                                         "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
959                                         "birthday" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
960                                         "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
961                                         "contact-type" => array("type" => "tinyint(1)", "not null" => "1", "default" => "-1"),
962                                         "hide" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
963                                         "nsfw" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
964                                         "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
965                                         "addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
966                                         "notify" => array("type" => "text"),
967                                         "alias" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
968                                         "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
969                                         "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
970                                         ),
971                         "indexes" => array(
972                                         "PRIMARY" => array("id"),
973                                         "nurl" => array("UNIQUE", "nurl(190)"),
974                                         "name" => array("name(64)"),
975                                         "nick" => array("nick(32)"),
976                                         "addr" => array("addr(64)"),
977                                         "hide_network_updated" => array("hide", "network(4)", "updated"),
978                                         "updated" => array("updated"),
979                                         )
980                         );
981         $database["glink"] = array(
982                         "fields" => array(
983                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
984                                         "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
985                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
986                                         "gcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
987                                         "zcid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
988                                         "updated" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
989                                         ),
990                         "indexes" => array(
991                                         "PRIMARY" => array("id"),
992                                         "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
993                                         "gcid" => array("gcid"),
994                                         )
995                         );
996         $database["group"] = array(
997                         "fields" => array(
998                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
999                                         "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1000                                         "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1001                                         "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1002                                         "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1003                                         ),
1004                         "indexes" => array(
1005                                         "PRIMARY" => array("id"),
1006                                         "uid" => array("uid"),
1007                                         )
1008                         );
1009         $database["group_member"] = array(
1010                         "fields" => array(
1011                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1012                                         "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1013                                         "gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("group" => "id")),
1014                                         "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1015                                         ),
1016                         "indexes" => array(
1017                                         "PRIMARY" => array("id"),
1018                                         "contactid" => array("contact-id"),
1019                                         "gid_contactid" => array("gid", "contact-id"),
1020                                         "uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
1021                                         )
1022                         );
1023         $database["gserver"] = array(
1024                         "fields" => array(
1025                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1026                                         "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1027                                         "nurl" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1028                                         "version" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1029                                         "site_name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1030                                         "info" => array("type" => "text"),
1031                                         "register_policy" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1032                                         "poco" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1033                                         "noscrape" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1034                                         "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1035                                         "platform" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1036                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1037                                         "last_poco_query" => array("type" => "datetime", "default" => NULL_DATE),
1038                                         "last_contact" => array("type" => "datetime", "default" => NULL_DATE),
1039                                         "last_failure" => array("type" => "datetime", "default" => NULL_DATE),
1040                                         ),
1041                         "indexes" => array(
1042                                         "PRIMARY" => array("id"),
1043                                         "nurl" => array("UNIQUE", "nurl(190)"),
1044                                         )
1045                         );
1046         $database["hook"] = array(
1047                         "fields" => array(
1048                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1049                                         "hook" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1050                                         "file" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1051                                         "function" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1052                                         "priority" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1053                                         ),
1054                         "indexes" => array(
1055                                         "PRIMARY" => array("id"),
1056                                         "hook_file_function" => array("UNIQUE", "hook(50)","file(80)","function(60)"),
1057                                         )
1058                         );
1059         $database["intro"] = array(
1060                         "fields" => array(
1061                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1062                                         "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1063                                         "fid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("fcontact" => "id")),
1064                                         "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1065                                         "knowyou" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1066                                         "duplex" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1067                                         "note" => array("type" => "text"),
1068                                         "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1069                                         "datetime" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1070                                         "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1071                                         "ignore" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1072                                         ),
1073                         "indexes" => array(
1074                                         "PRIMARY" => array("id"),
1075                                         )
1076                         );
1077         $database["item"] = array(
1078                         "fields" => array(
1079                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "relation" => array("thread" => "iid")),
1080                                         "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1081                                         "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1082                                         "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1083                                         "contact-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1084                                         "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1085                                         "type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1086                                         "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1087                                         "gravity" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1088                                         "parent" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1089                                         "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1090                                         "extid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1091                                         "thr-parent" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1092                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1093                                         "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1094                                         "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1095                                         "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1096                                         "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1097                                         "owner-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1098                                         "owner-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1099                                         "owner-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1100                                         "owner-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1101                                         "author-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1102                                         "author-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1103                                         "author-link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1104                                         "author-avatar" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1105                                         "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1106                                         "body" => array("type" => "mediumtext"),
1107                                         "app" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1108                                         "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1109                                         "object-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1110                                         "object" => array("type" => "text"),
1111                                         "target-type" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1112                                         "target" => array("type" => "text"),
1113                                         "postopts" => array("type" => "text"),
1114                                         "plink" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1115                                         "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1116                                         "event-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("event" => "id")),
1117                                         "tag" => array("type" => "mediumtext"),
1118                                         "attach" => array("type" => "mediumtext"),
1119                                         "inform" => array("type" => "mediumtext"),
1120                                         "file" => array("type" => "mediumtext"),
1121                                         "location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1122                                         "coord" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1123                                         "allow_cid" => array("type" => "mediumtext"),
1124                                         "allow_gid" => array("type" => "mediumtext"),
1125                                         "deny_cid" => array("type" => "mediumtext"),
1126                                         "deny_gid" => array("type" => "mediumtext"),
1127                                         "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1128                                         "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1129                                         "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1130                                         "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1131                                         "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1132                                         "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1133                                         "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1134                                         "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1135                                         "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1136                                         "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1137                                         "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1138                                         "last-child" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "1"),
1139                                         "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1140                                         "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1141                                         "rendered-hash" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1142                                         "rendered-html" => array("type" => "mediumtext"),
1143                                         "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1144                                         ),
1145                         "indexes" => array(
1146                                         "PRIMARY" => array("id"),
1147                                         "guid" => array("guid(191)"),
1148                                         "uri" => array("uri(191)"),
1149                                         "parent" => array("parent"),
1150                                         "parent-uri" => array("parent-uri(191)"),
1151                                         "extid" => array("extid(191)"),
1152                                         "uid_id" => array("uid","id"),
1153                                         "uid_contactid_id" => array("uid","contact-id","id"),
1154                                         "uid_created" => array("uid","created"),
1155                                         "uid_unseen_contactid" => array("uid","unseen","contact-id"),
1156                                         "uid_network_received" => array("uid","network(4)","received"),
1157                                         "uid_network_commented" => array("uid","network(4)","commented"),
1158                                         "uid_thrparent" => array("uid","thr-parent(190)"),
1159                                         "uid_parenturi" => array("uid","parent-uri(190)"),
1160                                         "uid_contactid_created" => array("uid","contact-id","created"),
1161                                         "authorid_created" => array("author-id","created"),
1162                                         "ownerid" => array("owner-id"),
1163                                         "uid_uri" => array("uid", "uri(190)"),
1164                                         "resource-id" => array("resource-id(191)"),
1165                                         "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), //
1166                                         "uid_type_changed" => array("uid","type(190)","changed"),
1167                                         "contactid_verb" => array("contact-id","verb(190)"),
1168                                         "deleted_changed" => array("deleted","changed"),
1169                                         "uid_wall_changed" => array("uid","wall","changed"),
1170                                         "uid_eventid" => array("uid","event-id"),
1171                                         "uid_authorlink" => array("uid","author-link(190)"),
1172                                         "uid_ownerlink" => array("uid","owner-link(190)"),
1173                                         )
1174                         );
1175         $database["item_id"] = array(
1176                         "fields" => array(
1177                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1178                                         "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1179                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1180                                         "sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1181                                         "service" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1182                                         ),
1183                         "indexes" => array(
1184                                         "PRIMARY" => array("id"),
1185                                         "uid" => array("uid"),
1186                                         "sid" => array("sid(32)"),
1187                                         "service" => array("service(32)"),
1188                                         "iid" => array("iid"),
1189                                         )
1190                         );
1191         $database["locks"] = array(
1192                         "fields" => array(
1193                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1194                                         "name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1195                                         "locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1196                                         "pid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1197                                         ),
1198                         "indexes" => array(
1199                                         "PRIMARY" => array("id"),
1200                                         )
1201                         );
1202         $database["mail"] = array(
1203                         "fields" => array(
1204                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1205                                         "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1206                                         "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1207                                         "from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1208                                         "from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1209                                         "from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1210                                         "contact-id" => array("type" => "varchar(255)", "not null" => "1", "default" => "", "relation" => array("contact" => "id")),
1211                                         "convid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("conv" => "id")),
1212                                         "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1213                                         "body" => array("type" => "mediumtext"),
1214                                         "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1215                                         "reply" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1216                                         "replied" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1217                                         "unknown" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1218                                         "uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1219                                         "parent-uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1220                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1221                                         ),
1222                         "indexes" => array(
1223                                         "PRIMARY" => array("id"),
1224                                         "uid_seen" => array("uid", "seen"),
1225                                         "convid" => array("convid"),
1226                                         "uri" => array("uri(64)"),
1227                                         "parent-uri" => array("parent-uri(64)"),
1228                                         "contactid" => array("contact-id(32)"),
1229                                         )
1230                         );
1231         $database["mailacct"] = array(
1232                         "fields" => array(
1233                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1234                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1235                                         "server" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1236                                         "port" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1237                                         "ssltype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1238                                         "mailbox" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1239                                         "user" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1240                                         "pass" => array("type" => "text"),
1241                                         "reply_to" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1242                                         "action" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1243                                         "movetofolder" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1244                                         "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1245                                         "last_check" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1246                                         ),
1247                         "indexes" => array(
1248                                         "PRIMARY" => array("id"),
1249                                         )
1250                         );
1251         $database["manage"] = array(
1252                         "fields" => array(
1253                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1254                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1255                                         "mid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1256                                         ),
1257                         "indexes" => array(
1258                                         "PRIMARY" => array("id"),
1259                                         "uid_mid" => array("UNIQUE", "uid","mid"),
1260                                         )
1261                         );
1262         $database["notify"] = array(
1263                         "fields" => array(
1264                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1265                                         "hash" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1266                                         "type" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1267                                         "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1268                                         "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1269                                         "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1270                                         "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1271                                         "msg" => array("type" => "mediumtext"),
1272                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1273                                         "link" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1274                                         "iid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1275                                         "parent" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1276                                         "seen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1277                                         "verb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1278                                         "otype" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1279                                         "name_cache" => array("type" => "tinytext"),
1280                                         "msg_cache" => array("type" => "mediumtext")
1281                                         ),
1282                         "indexes" => array(
1283                                         "PRIMARY" => array("id"),
1284                                         "hash_uid" => array("hash", "uid"),
1285                                         "seen_uid_date" => array("seen", "uid", "date"),
1286                                         "uid_date" => array("uid", "date"),
1287                                         "uid_type_link" => array("uid", "type", "link(190)"),
1288                                         )
1289                         );
1290         $database["notify-threads"] = array(
1291                         "fields" => array(
1292                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1293                                         "notify-id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("notify" => "id")),
1294                                         "master-parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1295                                         "parent-item" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1296                                         "receiver-uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1297                                         ),
1298                         "indexes" => array(
1299                                         "PRIMARY" => array("id"),
1300                                         )
1301                         );
1302         $database["oembed"] = array(
1303                         "fields" => array(
1304                                         "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1305                                         "content" => array("type" => "mediumtext"),
1306                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1307                                         ),
1308                         "indexes" => array(
1309                                         "PRIMARY" => array("url"),
1310                                         "created" => array("created"),
1311                                         )
1312                         );
1313         $database["parsed_url"] = array(
1314                         "fields" => array(
1315                                         "url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
1316                                         "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1317                                         "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
1318                                         "content" => array("type" => "mediumtext"),
1319                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1320                                         ),
1321                         "indexes" => array(
1322                                         "PRIMARY" => array("url", "guessing", "oembed"),
1323                                         "created" => array("created"),
1324                                         )
1325                         );
1326         $database["pconfig"] = array(
1327                         "fields" => array(
1328                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1329                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1330                                         "cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1331                                         "k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1332                                         "v" => array("type" => "mediumtext"),
1333                                         ),
1334                         "indexes" => array(
1335                                         "PRIMARY" => array("id"),
1336                                         "uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
1337                                         )
1338                         );
1339         $database["photo"] = array(
1340                         "fields" => array(
1341                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1342                                         "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1343                                         "contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1344                                         "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1345                                         "resource-id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1346                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1347                                         "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1348                                         "title" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1349                                         "desc" => array("type" => "text"),
1350                                         "album" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1351                                         "filename" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1352                                         "type" => array("type" => "varchar(128)", "not null" => "1", "default" => "image/jpeg"),
1353                                         "height" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1354                                         "width" => array("type" => "smallint(6)", "not null" => "1", "default" => "0"),
1355                                         "datasize" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1356                                         "data" => array("type" => "mediumblob", "not null" => "1"),
1357                                         "scale" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
1358                                         "profile" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1359                                         "allow_cid" => array("type" => "mediumtext"),
1360                                         "allow_gid" => array("type" => "mediumtext"),
1361                                         "deny_cid" => array("type" => "mediumtext"),
1362                                         "deny_gid" => array("type" => "mediumtext"),
1363                                         ),
1364                         "indexes" => array(
1365                                         "PRIMARY" => array("id"),
1366                                         "contactid" => array("contact-id"),
1367                                         "uid_contactid" => array("uid", "contact-id"),
1368                                         "uid_profile" => array("uid", "profile"),
1369                                         "uid_album_scale_created" => array("uid", "album(32)", "scale", "created"),
1370                                         "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
1371                                         "resource-id" => array("resource-id(64)"),
1372                                         )
1373                         );
1374         $database["poll"] = array(
1375                         "fields" => array(
1376                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1377                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1378                                         "q0" => array("type" => "text"),
1379                                         "q1" => array("type" => "text"),
1380                                         "q2" => array("type" => "text"),
1381                                         "q3" => array("type" => "text"),
1382                                         "q4" => array("type" => "text"),
1383                                         "q5" => array("type" => "text"),
1384                                         "q6" => array("type" => "text"),
1385                                         "q7" => array("type" => "text"),
1386                                         "q8" => array("type" => "text"),
1387                                         "q9" => array("type" => "text"),
1388                                         ),
1389                         "indexes" => array(
1390                                         "PRIMARY" => array("id"),
1391                                         "uid" => array("uid"),
1392                                         )
1393                         );
1394         $database["poll_result"] = array(
1395                         "fields" => array(
1396                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1397                                         "poll_id" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("poll" => "id")),
1398                                         "choice" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1399                                         ),
1400                         "indexes" => array(
1401                                         "PRIMARY" => array("id"),
1402                                         "poll_id" => array("poll_id"),
1403                                         "choice" => array("choice"),
1404                                         )
1405                         );
1406         $database["process"] = array(
1407                         "fields" => array(
1408                                         "pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
1409                                         "command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
1410                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1411                                         ),
1412                         "indexes" => array(
1413                                         "PRIMARY" => array("pid"),
1414                                         "command" => array("command"),
1415                                         )
1416                         );
1417         $database["profile"] = array(
1418                         "fields" => array(
1419                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1420                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1421                                         "profile-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1422                                         "is-default" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1423                                         "hide-friends" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1424                                         "name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1425                                         "pdesc" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1426                                         "dob" => array("type" => "varchar(32)", "not null" => "1", "default" => "0001-01-01"),
1427                                         "address" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1428                                         "locality" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1429                                         "region" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1430                                         "postal-code" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1431                                         "country-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1432                                         "hometown" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1433                                         "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1434                                         "marital" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1435                                         "with" => array("type" => "text"),
1436                                         "howlong" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1437                                         "sexual" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1438                                         "politic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1439                                         "religion" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1440                                         "pub_keywords" => array("type" => "text"),
1441                                         "prv_keywords" => array("type" => "text"),
1442                                         "likes" => array("type" => "text"),
1443                                         "dislikes" => array("type" => "text"),
1444                                         "about" => array("type" => "text"),
1445                                         "summary" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1446                                         "music" => array("type" => "text"),
1447                                         "book" => array("type" => "text"),
1448                                         "tv" => array("type" => "text"),
1449                                         "film" => array("type" => "text"),
1450                                         "interest" => array("type" => "text"),
1451                                         "romance" => array("type" => "text"),
1452                                         "work" => array("type" => "text"),
1453                                         "education" => array("type" => "text"),
1454                                         "contact" => array("type" => "text"),
1455                                         "homepage" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1456                                         "xmpp" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1457                                         "photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1458                                         "thumb" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1459                                         "publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1460                                         "net-publish" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1461                                         ),
1462                         "indexes" => array(
1463                                         "PRIMARY" => array("id"),
1464                                         "uid_is-default" => array("uid", "is-default"),
1465                                         )
1466                         );
1467         $database["profile_check"] = array(
1468                         "fields" => array(
1469                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1470                                         "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1471                                         "cid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1472                                         "dfrn_id" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1473                                         "sec" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1474                                         "expire" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1475                                         ),
1476                         "indexes" => array(
1477                                         "PRIMARY" => array("id"),
1478                                         )
1479                         );
1480         $database["push_subscriber"] = array(
1481                         "fields" => array(
1482                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1483                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1484                                         "callback_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1485                                         "topic" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1486                                         "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1487                                         "push" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1488                                         "last_update" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1489                                         "secret" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1490                                         ),
1491                         "indexes" => array(
1492                                         "PRIMARY" => array("id"),
1493                                         )
1494                         );
1495         $database["queue"] = array(
1496                         "fields" => array(
1497                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1498                                         "cid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1499                                         "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1500                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1501                                         "last" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1502                                         "content" => array("type" => "mediumtext"),
1503                                         "batch" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1504                                         ),
1505                         "indexes" => array(
1506                                         "PRIMARY" => array("id"),
1507                                         "cid" => array("cid"),
1508                                         "created" => array("created"),
1509                                         "last" => array("last"),
1510                                         "network" => array("network"),
1511                                         "batch" => array("batch"),
1512                                         )
1513                         );
1514         $database["register"] = array(
1515                         "fields" => array(
1516                                         "id" => array("type" => "int(11) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1517                                         "hash" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1518                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1519                                         "uid" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1520                                         "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1521                                         "language" => array("type" => "varchar(16)", "not null" => "1", "default" => ""),
1522                                         "note" => array("type" => "text"),
1523                                         ),
1524                         "indexes" => array(
1525                                         "PRIMARY" => array("id"),
1526                                         )
1527                         );
1528         $database["search"] = array(
1529                         "fields" => array(
1530                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1531                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1532                                         "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1533                                         ),
1534                         "indexes" => array(
1535                                         "PRIMARY" => array("id"),
1536                                         "uid" => array("uid"),
1537                                         )
1538                         );
1539         $database["session"] = array(
1540                         "fields" => array(
1541                                         "id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1542                                         "sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
1543                                         "data" => array("type" => "text"),
1544                                         "expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1545                                         ),
1546                         "indexes" => array(
1547                                         "PRIMARY" => array("id"),
1548                                         "sid" => array("sid(64)"),
1549                                         "expire" => array("expire"),
1550                                         )
1551                         );
1552         $database["sign"] = array(
1553                         "fields" => array(
1554                                         "id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1555                                         "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1556                                         "signed_text" => array("type" => "mediumtext"),
1557                                         "signature" => array("type" => "text"),
1558                                         "signer" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1559                                         ),
1560                         "indexes" => array(
1561                                         "PRIMARY" => array("id"),
1562                                         "iid" => array("UNIQUE", "iid"),
1563                                         )
1564                         );
1565         $database["spam"] = array(
1566                         "fields" => array(
1567                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1568                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1569                                         "spam" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1570                                         "ham" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1571                                         "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1572                                         "date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1573                                         ),
1574                         "indexes" => array(
1575                                         "PRIMARY" => array("id"),
1576                                         "uid" => array("uid"),
1577                                         "spam" => array("spam"),
1578                                         "ham" => array("ham"),
1579                                         "term" => array("term(32)"),
1580                                         )
1581                         );
1582         $database["term"] = array(
1583                         "fields" => array(
1584                                         "tid" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1585                                         "oid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("item" => "id")),
1586                                         "otype" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1587                                         "type" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1588                                         "term" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1589                                         "url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1590                                         "guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1591                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1592                                         "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1593                                         "global" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1594                                         "aid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
1595                                         "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1596                                         ),
1597                         "indexes" => array(
1598                                         "PRIMARY" => array("tid"),
1599                                         "oid_otype_type_term" => array("oid","otype","type","term(32)"),
1600                                         "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
1601                                         "uid_otype_type_url" => array("uid","otype","type","url(64)"),
1602                                         "guid" => array("guid(64)"),
1603                                         )
1604                         );
1605         $database["thread"] = array(
1606                         "fields" => array(
1607                                         "iid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => array("item" => "id")),
1608                                         "uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1609                                         "contact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1610                                         "gcontact-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("gcontact" => "id")),
1611                                         "owner-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1612                                         "author-id" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
1613                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1614                                         "edited" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1615                                         "commented" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1616                                         "received" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1617                                         "changed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1618                                         "wall" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1619                                         "private" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1620                                         "pubmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1621                                         "moderated" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1622                                         "visible" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1623                                         "spam" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1624                                         "starred" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1625                                         "ignored" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1626                                         "bookmark" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1627                                         "unseen" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
1628                                         "deleted" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1629                                         "origin" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1630                                         "forum_mode" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1631                                         "mention" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1632                                         "network" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
1633                                         ),
1634                         "indexes" => array(
1635                                         "PRIMARY" => array("iid"),
1636                                         "uid_network_commented" => array("uid","network","commented"),
1637                                         "uid_network_created" => array("uid","network","created"),
1638                                         "uid_contactid_commented" => array("uid","contact-id","commented"),
1639                                         "uid_contactid_created" => array("uid","contact-id","created"),
1640                                         "contactid" => array("contact-id"),
1641                                         "ownerid" => array("owner-id"),
1642                                         "authorid" => array("author-id"),
1643                                         "uid_created" => array("uid","created"),
1644                                         "uid_commented" => array("uid","commented"),
1645                                         "uid_wall_created" => array("uid","wall","created"),
1646                                         "private_wall_received" => array("private","wall","received"),
1647                                         )
1648                         );
1649         $database["tokens"] = array(
1650                         "fields" => array(
1651                                         "id" => array("type" => "varchar(40)", "not null" => "1", "primary" => "1"),
1652                                         "secret" => array("type" => "text"),
1653                                         "client_id" => array("type" => "varchar(20)", "not null" => "1", "default" => "", "relation" => array("clients" => "client_id")),
1654                                         "expires" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1655                                         "scope" => array("type" => "varchar(200)", "not null" => "1", "default" => ""),
1656                                         "uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
1657                                         ),
1658                         "indexes" => array(
1659                                         "PRIMARY" => array("id"),
1660                                         )
1661                         );
1662         $database["user"] = array(
1663                         "fields" => array(
1664                                         "uid" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1665                                         "guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
1666                                         "username" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1667                                         "password" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1668                                         "nickname" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1669                                         "email" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1670                                         "openid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1671                                         "timezone" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
1672                                         "language" => array("type" => "varchar(32)", "not null" => "1", "default" => "en"),
1673                                         "register_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1674                                         "login_date" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1675                                         "default-location" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1676                                         "allow_location" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1677                                         "theme" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1678                                         "pubkey" => array("type" => "text"),
1679                                         "prvkey" => array("type" => "text"),
1680                                         "spubkey" => array("type" => "text"),
1681                                         "sprvkey" => array("type" => "text"),
1682                                         "verified" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1683                                         "blocked" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1684                                         "blockwall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1685                                         "hidewall" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1686                                         "blocktags" => array("type" => "tinyint(1) unsigned", "not null" => "1", "default" => "0"),
1687                                         "unkmail" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1688                                         "cntunkmail" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1689                                         "notify-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "65535"),
1690                                         "page-flags" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1691                                         "account-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1692                                         "prvnets" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1693                                         "pwdreset" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
1694                                         "maxreq" => array("type" => "int(11)", "not null" => "1", "default" => "10"),
1695                                         "expire" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"),
1696                                         "account_removed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1697                                         "account_expired" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1698                                         "account_expires_on" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1699                                         "expire_notification_sent" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1700                                         "def_gid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1701                                         "allow_cid" => array("type" => "mediumtext"),
1702                                         "allow_gid" => array("type" => "mediumtext"),
1703                                         "deny_cid" => array("type" => "mediumtext"),
1704                                         "deny_gid" => array("type" => "mediumtext"),
1705                                         "openidserver" => array("type" => "text"),
1706                                         ),
1707                         "indexes" => array(
1708                                         "PRIMARY" => array("uid"),
1709                                         "nickname" => array("nickname(32)"),
1710                                         )
1711                         );
1712         $database["userd"] = array(
1713                         "fields" => array(
1714                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1715                                         "username" => array("type" => "varchar(255)", "not null" => "1"),
1716                                         ),
1717                         "indexes" => array(
1718                                         "PRIMARY" => array("id"),
1719                                         "username" => array("username(32)"),
1720                                         )
1721                         );
1722         $database["workerqueue"] = array(
1723                         "fields" => array(
1724                                         "id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
1725                                         "parameter" => array("type" => "text"),
1726                                         "priority" => array("type" => "tinyint(3) unsigned", "not null" => "1", "default" => "0"),
1727                                         "created" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1728                                         "pid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
1729                                         "executed" => array("type" => "datetime", "not null" => "1", "default" => NULL_DATE),
1730                                         "done" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
1731                                         ),
1732                         "indexes" => array(
1733                                         "PRIMARY" => array("id"),
1734                                         "pid" => array("pid"),
1735                                         "parameter" => array("parameter(64)"),
1736                                         "priority_created" => array("priority", "created"),
1737                                         "executed" => array("executed"),
1738                                         )
1739                         );
1740
1741         return($database);
1742 }